[clang] [compiler-rt] [compiler-rt] Support `-shared-libsan` for Offload UBSan (PR #226551)
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 21:01:29 PDT 2026
================
@@ -1744,8 +1744,9 @@ collectSanitizerRuntimes(Compilation &C, const ToolChain &TC,
if (SanArgs.needsAsanRt())
HelperStaticRuntimes.push_back("asan_static");
- // Offloading images can live in DSOs, the host interceptors must follow.
- if (NeedsOffloadRt) {
+ // Offloading images can live in DSOs, the host interceptors must follow. The
+ // shared UBSan runtime already contains them.
+ if (NeedsOffloadRt && !SanArgs.needsSharedRt()) {
----------------
yxsamliu wrote:
Could we make sure shared UBSan stays in the finished program when only device code uses UBSan? The host may have no UBSan references, so `--as-needed` can drop the library even though it appears on the link command. Device reports would then have no host handler. Could we test this by checking the final binary’s `DT_NEEDED` entries and ensure the library is retained?
https://github.com/llvm/llvm-project/pull/226551
More information about the llvm-commits
mailing list