mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-14 09:56:33 +00:00

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
14 lines
390 B
LLVM
14 lines
390 B
LLVM
; Sample code for amdgpu address sanitizer runtime.
|
|
|
|
; Note the runtime functions need to have weak linkage and default
|
|
; visibility, otherwise they may be internalized and removed by GlobalOptPass.
|
|
|
|
define weak void @__amdgpu_device_library_preserve_asan_functions() {
|
|
tail call void @__asan_report_load1(i64 0)
|
|
ret void
|
|
}
|
|
|
|
define weak void @__asan_report_load1(i64 %0) {
|
|
ret void
|
|
}
|