[clang] [compiler-rt] [compiler-rt] Support `-shared-libsan` for Offload UBSan (PR #226551)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 10:47:16 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
The offload UBSan is intentionally implemented as a separate 'add-on'
library. This makes it more clear where the separation lies and avoids
including it in all existing UBSan users. However, this doesn't work
with `-shared-libsan`'s `*.so` builds because we now have a function
call barrier and the internal utility functions are hidden.

This PR changes the shared version to fold the HSA / Offloading handlers
into the `libclang_rt.ubsan.so` library. The specific fallout is that
~30KiB is added to the shared library and it will now intercept `dlsym`
for other users, but this should be benign. The overhead here is less
concerning than in the static case because it is shared and usually
loaded lazily by the system.


---
Full diff: https://github.com/llvm/llvm-project/pull/226551.diff


6 Files Affected:

- (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+3-2) 
- (modified) clang/test/Driver/fsanitize-undefined-offload.c (+8) 
- (modified) compiler-rt/lib/ubsan/CMakeLists.txt (+15-5) 
- (modified) compiler-rt/lib/ubsan/offload/CMakeLists.txt (+14-4) 
- (modified) compiler-rt/lib/ubsan/offload/ubsan_offload_hsa_interceptors.cpp (+15-11) 
- (modified) compiler-rt/test/ubsan/AMDGPU/host-and-device.hip (+2) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


https://github.com/llvm/llvm-project/pull/226551


More information about the llvm-commits mailing list