[compiler-rt] r365229 - [TSan] Improve handling of stack pointer mangling in {set, long}jmp, pt.4
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 5 11:00:13 PDT 2019
Author: yln
Date: Fri Jul 5 11:00:12 2019
New Revision: 365229
URL: http://llvm.org/viewvc/llvm-project?rev=365229&view=rev
Log:
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.4
For x86_64, since we don't clobber %rsi (2nd argument) anymore, we don't
have to save/restore it.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D63946
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S?rev=365229&r1=365228&r2=365229&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S Fri Jul 5 11:00:12 2019
@@ -271,30 +271,16 @@ ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
push %rdi
CFI_ADJUST_CFA_OFFSET(8)
CFI_REL_OFFSET(%rdi, 0)
- // save savesigs parameter
- push %rsi
- CFI_ADJUST_CFA_OFFSET(8)
- CFI_REL_OFFSET(%rsi, 0)
- // align stack frame
- sub $8, %rsp
- CFI_ADJUST_CFA_OFFSET(8)
// obtain SP, store in %rdi, first argument to `void __tsan_setjmp(uptr sp)`
#if defined(__FreeBSD__) || defined(__NetBSD__)
- lea 24(%rsp), %rdi
+ lea 8(%rsp), %rdi
#elif defined(__linux__) || defined(__APPLE__)
- lea 32(%rsp), %rdi
+ lea 16(%rsp), %rdi
#else
# error "Unknown platform"
#endif
// call tsan interceptor
call ASM_SYMBOL(__tsan_setjmp)
- // unalign stack frame
- add $8, %rsp
- CFI_ADJUST_CFA_OFFSET(-8)
- // restore savesigs parameter
- pop %rsi
- CFI_ADJUST_CFA_OFFSET(-8)
- CFI_RESTORE(%rsi)
// restore env parameter
pop %rdi
CFI_ADJUST_CFA_OFFSET(-8)
@@ -327,28 +313,14 @@ ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
push %rdi
CFI_ADJUST_CFA_OFFSET(8)
CFI_REL_OFFSET(%rdi, 0)
- // save savesigs parameter
- push %rsi
- CFI_ADJUST_CFA_OFFSET(8)
- CFI_REL_OFFSET(%rsi, 0)
- // align stack frame
- sub $8, %rsp
- CFI_ADJUST_CFA_OFFSET(8)
// obtain SP, store in %rdi, first argument to `void __tsan_setjmp(uptr sp)`
#if defined(__FreeBSD__)
- lea 24(%rsp), %rdi
+ lea 8(%rsp), %rdi
#else
- lea 32(%rsp), %rdi
+ lea 16(%rsp), %rdi
#endif
// call tsan interceptor
call ASM_SYMBOL(__tsan_setjmp)
- // unalign stack frame
- add $8, %rsp
- CFI_ADJUST_CFA_OFFSET(-8)
- // restore savesigs parameter
- pop %rsi
- CFI_ADJUST_CFA_OFFSET(-8)
- CFI_RESTORE(%rsi)
// restore env parameter
pop %rdi
CFI_ADJUST_CFA_OFFSET(-8)
More information about the llvm-commits
mailing list