[all-commits] [llvm/llvm-project] c4afb5: [HIP] Fix linking of asanrt.bc

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Mon Sep 27 10:26:15 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c4afb5f81b62b903e4af8a92235e1b901e184040
      https://github.com/llvm/llvm-project/commit/c4afb5f81b62b903e4af8a92235e1b901e184040
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2021-09-27 (Mon, 27 Sep 2021)

  Changed paths:
    M clang/include/clang/Driver/ToolChain.h
    M clang/lib/Driver/ToolChain.cpp
    M clang/lib/Driver/ToolChains/HIP.cpp
    M clang/lib/Driver/ToolChains/HIP.h
    A clang/test/CodeGenCUDA/Inputs/amdgpu-asanrtl.ll
    M clang/test/CodeGenCUDA/amdgpu-asan.cu
    M clang/test/Driver/hip-sanitize-options.hip

  Log Message:
  -----------
  [HIP] Fix linking of asanrt.bc

HIP currently uses -mlink-builtin-bitcode to link all bitcode libraries, which
changes the linkage of functions to be internal once they are linked in. This
works for common bitcode libraries since these functions are not intended
to be exposed for external callers.

However, the functions in the sanitizer bitcode library is intended to be
called by instructions generated by the sanitizer pass. If their linkage is
changed to internal, their parameters may be altered by optimizations before
the sanitizer pass, which renders them unusable by the sanitizer pass.

To fix this issue, HIP toolchain links the sanitizer bitcode library with
-mlink-bitcode-file, which does not change the linkage.

A struct BitCodeLibraryInfo is introduced in ToolChain as a generic
approach to pass the bitcode library information between ToolChain and Tool.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D110304




More information about the All-commits mailing list