1 // The content of this file is AArch64-only:
2 #if defined(__aarch64__)
4 #include "sanitizer_common/sanitizer_asm.h"
9 .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
10 .long _setjmp$non_lazy_ptr
12 .indirect_symbol _setjmp
15 .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
16 .long __setjmp$non_lazy_ptr
17 __setjmp$non_lazy_ptr:
18 .indirect_symbol __setjmp
21 .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
22 .long _sigsetjmp$non_lazy_ptr
23 _sigsetjmp$non_lazy_ptr:
24 .indirect_symbol _sigsetjmp
28 #if !defined(__APPLE__)
31 .section __TEXT,__text
35 ASM_HIDDEN(__tsan_setjmp)
36 .comm _ZN14__interception11real_setjmpE,8,8
37 .globl ASM_SYMBOL_INTERCEPTOR(setjmp)
38 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(setjmp))
39 ASM_SYMBOL_INTERCEPTOR(setjmp):
42 // Save frame/link register
43 stp x29, x30, [sp, -32]!
44 CFI_DEF_CFA_OFFSET (32)
48 // Adjust the SP for previous frame
50 CFI_DEF_CFA_REGISTER (29)
56 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
59 // call tsan interceptor
60 bl ASM_SYMBOL(__tsan_setjmp)
62 // Restore env parameter
66 // Restore frame/link register
67 ldp x29, x30, [sp], 32
72 // tail jump to libc setjmp
73 #if !defined(__APPLE__)
74 adrp x1, :got:_ZN14__interception11real_setjmpE
75 ldr x1, [x1, #:got_lo12:_ZN14__interception11real_setjmpE]
78 adrp x1, _setjmp$non_lazy_ptr@page
79 add x1, x1, _setjmp$non_lazy_ptr@pageoff
85 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(setjmp))
87 .comm _ZN14__interception12real__setjmpE,8,8
88 .globl ASM_SYMBOL_INTERCEPTOR(_setjmp)
89 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(_setjmp))
90 ASM_SYMBOL_INTERCEPTOR(_setjmp):
93 // Save frame/link register
94 stp x29, x30, [sp, -32]!
95 CFI_DEF_CFA_OFFSET (32)
99 // Adjust the SP for previous frame
101 CFI_DEF_CFA_REGISTER (29)
103 // Save env parameter
107 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
110 // call tsan interceptor
111 bl ASM_SYMBOL(__tsan_setjmp)
113 // Restore env parameter
117 // Restore frame/link register
118 ldp x29, x30, [sp], 32
123 // tail jump to libc setjmp
124 #if !defined(__APPLE__)
125 adrp x1, :got:_ZN14__interception12real__setjmpE
126 ldr x1, [x1, #:got_lo12:_ZN14__interception12real__setjmpE]
129 adrp x1, __setjmp$non_lazy_ptr@page
130 add x1, x1, __setjmp$non_lazy_ptr@pageoff
136 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(_setjmp))
138 .comm _ZN14__interception14real_sigsetjmpE,8,8
139 .globl ASM_SYMBOL_INTERCEPTOR(sigsetjmp)
140 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
141 ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
144 // Save frame/link register
145 stp x29, x30, [sp, -32]!
146 CFI_DEF_CFA_OFFSET (32)
150 // Adjust the SP for previous frame
152 CFI_DEF_CFA_REGISTER (29)
154 // Save env and savesigs parameter
159 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
162 // call tsan interceptor
163 bl ASM_SYMBOL(__tsan_setjmp)
165 // Restore env and savesigs parameter
170 // Restore frame/link register
171 ldp x29, x30, [sp], 32
176 // tail jump to libc sigsetjmp
177 #if !defined(__APPLE__)
178 adrp x2, :got:_ZN14__interception14real_sigsetjmpE
179 ldr x2, [x2, #:got_lo12:_ZN14__interception14real_sigsetjmpE]
182 adrp x2, _sigsetjmp$non_lazy_ptr@page
183 add x2, x2, _sigsetjmp$non_lazy_ptr@pageoff
188 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
190 #if !defined(__APPLE__)
191 .comm _ZN14__interception16real___sigsetjmpE,8,8
192 .globl ASM_SYMBOL_INTERCEPTOR(__sigsetjmp)
193 ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
194 ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
197 // Save frame/link register
198 stp x29, x30, [sp, -32]!
199 CFI_DEF_CFA_OFFSET (32)
203 // Adjust the SP for previous frame
205 CFI_DEF_CFA_REGISTER (29)
207 // Save env and savesigs parameter
212 // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
215 // call tsan interceptor
216 bl ASM_SYMBOL(__tsan_setjmp)
218 // Restore env and savesigs parameter
223 // Restore frame/link register
224 ldp x29, x30, [sp], 32
229 // tail jump to libc __sigsetjmp
230 #if !defined(__APPLE__)
231 adrp x2, :got:_ZN14__interception16real___sigsetjmpE
232 ldr x2, [x2, #:got_lo12:_ZN14__interception16real___sigsetjmpE]
235 adrp x2, ASM_SYMBOL(__sigsetjmp)@page
236 add x2, x2, ASM_SYMBOL(__sigsetjmp)@pageoff
240 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
243 NO_EXEC_STACK_DIRECTIVE