[compiler-rt] r366258 - [TSan] Improve handling of stack pointer mangling in {set, long}jmp, pt.6
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 16 13:41:04 PDT 2019
Author: yln
Date: Tue Jul 16 13:41:04 2019
New Revision: 366258
URL: http://llvm.org/viewvc/llvm-project?rev=366258&view=rev
Log:
[TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.6
Cleanup ARM64 assembly after removing unnecessary computation of mangled
stack pointer in previous commit.
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S?rev=366258&r1=366257&r2=366258&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S Tue Jul 16 13:41:04 2019
@@ -39,7 +39,7 @@ ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR
ASM_SYMBOL_INTERCEPTOR(setjmp):
CFI_STARTPROC
- // save env parameters for function call
+ // Save frame/link register
stp x29, x30, [sp, -32]!
CFI_DEF_CFA_OFFSET (32)
CFI_OFFSET (29, -32)
@@ -49,10 +49,9 @@ ASM_SYMBOL_INTERCEPTOR(setjmp):
add x29, sp, 0
CFI_DEF_CFA_REGISTER (29)
- // Save jmp_buf
- str x19, [sp, 16]
- CFI_OFFSET (19, -16)
- mov x19, x0
+ // Save env parameter
+ str x0, [sp, 16]
+ CFI_OFFSET (0, -16)
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
add x0, x29, 32
@@ -60,12 +59,14 @@ ASM_SYMBOL_INTERCEPTOR(setjmp):
// call tsan interceptor
bl ASM_SYMBOL(__tsan_setjmp)
- // restore env parameter
- mov x0, x19
- ldr x19, [sp, 16]
+ // Restore env parameter
+ ldr x0, [sp, 16]
+ CFI_RESTORE (0)
+
+ // Restore frame/link register
ldp x29, x30, [sp], 32
+ CFI_RESTORE (29)
CFI_RESTORE (30)
- CFI_RESTORE (19)
CFI_DEF_CFA (31, 0)
// tail jump to libc setjmp
@@ -89,7 +90,7 @@ ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR
ASM_SYMBOL_INTERCEPTOR(_setjmp):
CFI_STARTPROC
- // save env parameters for function call
+ // Save frame/link register
stp x29, x30, [sp, -32]!
CFI_DEF_CFA_OFFSET (32)
CFI_OFFSET (29, -32)
@@ -99,10 +100,9 @@ ASM_SYMBOL_INTERCEPTOR(_setjmp):
add x29, sp, 0
CFI_DEF_CFA_REGISTER (29)
- // Save jmp_buf
- str x19, [sp, 16]
- CFI_OFFSET (19, -16)
- mov x19, x0
+ // Save env parameter
+ str x0, [sp, 16]
+ CFI_OFFSET (0, -16)
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
add x0, x29, 32
@@ -110,12 +110,14 @@ ASM_SYMBOL_INTERCEPTOR(_setjmp):
// call tsan interceptor
bl ASM_SYMBOL(__tsan_setjmp)
- // Restore jmp_buf parameter
- mov x0, x19
- ldr x19, [sp, 16]
+ // Restore env parameter
+ ldr x0, [sp, 16]
+ CFI_RESTORE (0)
+
+ // Restore frame/link register
ldp x29, x30, [sp], 32
+ CFI_RESTORE (29)
CFI_RESTORE (30)
- CFI_RESTORE (19)
CFI_DEF_CFA (31, 0)
// tail jump to libc setjmp
@@ -139,7 +141,7 @@ ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR
ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
CFI_STARTPROC
- // save env parameters for function call
+ // Save frame/link register
stp x29, x30, [sp, -32]!
CFI_DEF_CFA_OFFSET (32)
CFI_OFFSET (29, -32)
@@ -149,12 +151,10 @@ ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
add x29, sp, 0
CFI_DEF_CFA_REGISTER (29)
- // Save jmp_buf and savesigs
- stp x19, x20, [sp, 16]
- CFI_OFFSET (19, -16)
- CFI_OFFSET (20, -8)
- mov w20, w1
- mov x19, x0
+ // Save env and savesigs parameter
+ stp x0, x1, [sp, 16]
+ CFI_OFFSET (0, -16)
+ CFI_OFFSET (1, -8)
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
add x0, x29, 32
@@ -162,15 +162,15 @@ ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
// call tsan interceptor
bl ASM_SYMBOL(__tsan_setjmp)
- // restore env parameter
- mov w1, w20
- mov x0, x19
- ldp x19, x20, [sp, 16]
+ // Restore env and savesigs parameter
+ ldp x0, x1, [sp, 16]
+ CFI_RESTORE (0)
+ CFI_RESTORE (1)
+
+ // Restore frame/link register
ldp x29, x30, [sp], 32
- CFI_RESTORE (30)
CFI_RESTORE (29)
- CFI_RESTORE (19)
- CFI_RESTORE (20)
+ CFI_RESTORE (30)
CFI_DEF_CFA (31, 0)
// tail jump to libc sigsetjmp
@@ -194,7 +194,7 @@ ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR
ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
CFI_STARTPROC
- // save env parameters for function call
+ // Save frame/link register
stp x29, x30, [sp, -32]!
CFI_DEF_CFA_OFFSET (32)
CFI_OFFSET (29, -32)
@@ -204,12 +204,10 @@ ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
add x29, sp, 0
CFI_DEF_CFA_REGISTER (29)
- // Save jmp_buf and savesigs
- stp x19, x20, [sp, 16]
- CFI_OFFSET (19, -16)
- CFI_OFFSET (20, -8)
- mov w20, w1
- mov x19, x0
+ // Save env and savesigs parameter
+ stp x0, x1, [sp, 16]
+ CFI_OFFSET (0, -16)
+ CFI_OFFSET (1, -8)
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
add x0, x29, 32
@@ -217,14 +215,15 @@ ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
// call tsan interceptor
bl ASM_SYMBOL(__tsan_setjmp)
- mov w1, w20
- mov x0, x19
- ldp x19, x20, [sp, 16]
+ // Restore env and savesigs parameter
+ ldp x0, x1, [sp, 16]
+ CFI_RESTORE (0)
+ CFI_RESTORE (1)
+
+ // Restore frame/link register
ldp x29, x30, [sp], 32
- CFI_RESTORE (30)
CFI_RESTORE (29)
- CFI_RESTORE (19)
- CFI_RESTORE (20)
+ CFI_RESTORE (30)
CFI_DEF_CFA (31, 0)
// tail jump to libc __sigsetjmp
More information about the llvm-commits
mailing list