[compiler-rt] [tsan][ppc64] Fix copy-paste bug in __sigsetjmp OPD TOC loading (PR #210589)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 19 05:10:33 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: c4x64 (c4x64)

<details>
<summary>Changes</summary>

In `__sigsetjmp`'s big-endian OPD path, the TOC was loaded from `_setjmp`'s OPD entry instead of `__sigsetjmp`'s own entry, due to a copy-paste error.

```diff
-        addis   r2,r2,_setjmp-1b@<!-- -->ha
-        addi    r2,r2,_setjmp-1b@<!-- -->l
+        addis   r2,r2,__sigsetjmp-1b@<!-- -->ha
+        addi    r2,r2,__sigsetjmp-1b@<!-- -->l
```

This caused an incorrect TOC pointer to be loaded on big-endian PPC64 when `__sigsetjmp`/sigsetjmp was intercepted by TSan. The corresponding `_setjmp` path (which uses label `0b`) correctly references its own symbol for the OPD lookup.

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


1 Files Affected:

- (modified) compiler-rt/lib/tsan/rtl/tsan_rtl_ppc64.S (+2-2) 


``````````diff
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_ppc64.S b/compiler-rt/lib/tsan/rtl/tsan_rtl_ppc64.S
index 8285e21aa1ec7..661252b944e0d 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_ppc64.S
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_ppc64.S
@@ -180,8 +180,8 @@ __sigsetjmp:
         addis   r2,r2,.TOC.-1b at ha
         addi    r2,r2,.TOC.-1b at l
 #else
-        addis   r2,r2,_setjmp-1b at ha
-        addi    r2,r2,_setjmp-1b at l
+        addis   r2,r2,__sigsetjmp-1b at ha
+        addi    r2,r2,__sigsetjmp-1b at l
         ld      r2,8(r2)
 #endif
         // Call the interceptor.

``````````

</details>


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


More information about the llvm-commits mailing list