[HIP] Fix linking of asanrt.bc

Authored by yaxunl on Sep 22 2021, 8:45 PM.


[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


yaxunlSep 27 2021, 10:25 AM
Differential Revision
D110304: [HIP] Fix linking of asanrt.bc
rG6dd5b1e33e04: [MLIR][LLVM] Add error if using incorrect attribute type for specifying LLVM…