[compiler-rt] ad3fadd - [compiler-rt] Fix the longjmp sp slot on FreeBSD AArch64

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 14:23:07 PDT 2022


Author: Andrew Turner
Date: 2022-06-08T17:22:27-04:00
New Revision: ad3faddaa67d148fc9a2aef554a05e57df8075c8

URL: https://github.com/llvm/llvm-project/commit/ad3faddaa67d148fc9a2aef554a05e57df8075c8
DIFF: https://github.com/llvm/llvm-project/commit/ad3faddaa67d148fc9a2aef554a05e57df8075c8.diff

LOG: [compiler-rt] Fix the longjmp sp slot on FreeBSD AArch64

The stack pointer is stored in the second slot in the jump buffer on
AArch64. Use the correct slot value to read this rather than the
following register.

Reviewed by: melver

Differential Revision: https://reviews.llvm.org/D125762

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
index 17dbdff8a539..807f6be2eee3 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
@@ -402,7 +402,11 @@ static uptr UnmangleLongJmpSp(uptr mangled_sp) {
 #elif defined(__powerpc__)
 # define LONG_JMP_SP_ENV_SLOT 0
 #elif SANITIZER_FREEBSD
-# define LONG_JMP_SP_ENV_SLOT 2
+# ifdef __aarch64__
+#  define LONG_JMP_SP_ENV_SLOT 1
+# else
+#  define LONG_JMP_SP_ENV_SLOT 2
+# endif
 #elif SANITIZER_LINUX
 # ifdef __aarch64__
 #  define LONG_JMP_SP_ENV_SLOT 13


        


More information about the llvm-commits mailing list