Skip to content

Commit

Permalink
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.5
Browse files Browse the repository at this point in the history
Remove unnecessary computation of mangled SP for ARM64 architecture.

Reviewed By: dvyukov

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

llvm-svn: 365230
  • Loading branch information
yln committed Jul 5, 2019
1 parent 6bb13da commit 515fdfd
Showing 1 changed file with 4 additions and 39 deletions.
43 changes: 4 additions & 39 deletions compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
Expand Up @@ -105,18 +105,8 @@ ASM_SYMBOL_INTERCEPTOR(setjmp):
CFI_OFFSET (19, -16)
mov x19, x0

#if !defined(__APPLE__)
// SP pointer mangling (see glibc setjmp)
adrp x2, __tsan_pointer_chk_guard
ldr x2, [x2, #:lo12:__tsan_pointer_chk_guard]
add x0, x29, 32
eor x1, x2, x0
#else
adrp x2, ___tsan_darwin_setjmp_xor_key@page
ldr x2, [x2, ___tsan_darwin_setjmp_xor_key@pageoff]
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
add x0, x29, 32
eor x1, x2, x0
#endif

// call tsan interceptor
bl ASM_SYMBOL(__tsan_setjmp)
Expand Down Expand Up @@ -165,18 +155,8 @@ ASM_SYMBOL_INTERCEPTOR(_setjmp):
CFI_OFFSET (19, -16)
mov x19, x0

#if !defined(__APPLE__)
// SP pointer mangling (see glibc setjmp)
adrp x2, __tsan_pointer_chk_guard
ldr x2, [x2, #:lo12:__tsan_pointer_chk_guard]
add x0, x29, 32
eor x1, x2, x0
#else
adrp x2, ___tsan_darwin_setjmp_xor_key@page
ldr x2, [x2, ___tsan_darwin_setjmp_xor_key@pageoff]
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
add x0, x29, 32
eor x1, x2, x0
#endif

// call tsan interceptor
bl ASM_SYMBOL(__tsan_setjmp)
Expand Down Expand Up @@ -227,18 +207,8 @@ ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
mov w20, w1
mov x19, x0

#if !defined(__APPLE__)
// SP pointer mangling (see glibc setjmp)
adrp x2, __tsan_pointer_chk_guard
ldr x2, [x2, #:lo12:__tsan_pointer_chk_guard]
add x0, x29, 32
eor x1, x2, x0
#else
adrp x2, ___tsan_darwin_setjmp_xor_key@page
ldr x2, [x2, ___tsan_darwin_setjmp_xor_key@pageoff]
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
add x0, x29, 32
eor x1, x2, x0
#endif

// call tsan interceptor
bl ASM_SYMBOL(__tsan_setjmp)
Expand Down Expand Up @@ -292,13 +262,8 @@ ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
mov w20, w1
mov x19, x0

#if !defined(__APPLE__)
// SP pointer mangling (see glibc setjmp)
adrp x2, __tsan_pointer_chk_guard
ldr x2, [x2, #:lo12:__tsan_pointer_chk_guard]
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
add x0, x29, 32
eor x1, x2, x0
#endif

// call tsan interceptor
bl ASM_SYMBOL(__tsan_setjmp)
Expand Down

0 comments on commit 515fdfd

Please sign in to comment.