[compiler-rt] [tsan] Export __cxa_guard_ interceptors from TSan runtime. (PR #171921)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 14:52:44 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: Alexey Samsonov (vonosmas)

<details>
<summary>Changes</summary>

These functions from C++ ABI are defined in
compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp and are supposed to replace implementations from libstdc++/libc++abi.

We need to export them similar to why we need to export other interceptors and TSan runtime functions - e.g. if a dlopen-ed shared library depends on `__cxa_guard_acquire`, it needs to pick up the exported definition from the TSan runtime that was linked into the main executable calling the dlopen()

However, because the `__cxa_guard_` functions don't use traditional interceptor machinery, they are omitted from the auto-generated `libclang_rt.tsan.a.syms` files. Fix this by adding them to tsan.syms.extra file explicitly.

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


1 Files Affected:

- (modified) compiler-rt/lib/tsan/rtl/tsan.syms.extra (+3) 


``````````diff
diff --git a/compiler-rt/lib/tsan/rtl/tsan.syms.extra b/compiler-rt/lib/tsan/rtl/tsan.syms.extra
index 6416e5d47fc41..03d17d21e74e8 100644
--- a/compiler-rt/lib/tsan/rtl/tsan.syms.extra
+++ b/compiler-rt/lib/tsan/rtl/tsan.syms.extra
@@ -1,3 +1,6 @@
+__cxa_guard_acquire
+__cxa_guard_abort
+__cxa_guard_release
 __tsan_init
 __tsan_flush_memory
 __tsan_read*

``````````

</details>


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


More information about the llvm-commits mailing list