diff --git a/compiler-rt/lib/hwasan/hwasan_setjmp_aarch64.S b/compiler-rt/lib/hwasan/hwasan_setjmp_aarch64.S --- a/compiler-rt/lib/hwasan/hwasan_setjmp_aarch64.S +++ b/compiler-rt/lib/hwasan/hwasan_setjmp_aarch64.S @@ -53,6 +53,8 @@ b ASM_WRAPPER_NAME(sigsetjmp) CFI_ENDPROC ASM_SIZE(ASM_WRAPPER_NAME(setjmp_bionic)) + +ASM_INTERCEPTOR_TRAMPOLINE(setjmp_bionic) #endif .global ASM_WRAPPER_NAME(sigsetjmp) @@ -79,20 +81,17 @@ CFI_ENDPROC ASM_SIZE(ASM_WRAPPER_NAME(sigsetjmp)) +ASM_INTERCEPTOR_TRAMPOLINE(sigsetjmp) -.macro WEAK_ALIAS first second - .weak \second - .equ \second\(), \first -.endm #if SANITIZER_ANDROID -WEAK_ALIAS ASM_WRAPPER_NAME(sigsetjmp), sigsetjmp -WEAK_ALIAS ASM_WRAPPER_NAME(setjmp_bionic), setjmp +ASM_TRAMPOLINE_ALIAS(sigsetjmp, sigsetjmp) +ASM_TRAMPOLINE_ALIAS(setjmp, setjmp_bionic) #else -WEAK_ALIAS ASM_WRAPPER_NAME(sigsetjmp), __sigsetjmp +ASM_TRAMPOLINE_ALIAS(__sigsetjmp, sigsetjmp) #endif -WEAK_ALIAS ASM_WRAPPER_NAME(setjmp), _setjmp +ASM_TRAMPOLINE_ALIAS(_setjmp, setjmp) #endif // We do not need executable stack. diff --git a/compiler-rt/lib/hwasan/hwasan_setjmp_riscv64.S b/compiler-rt/lib/hwasan/hwasan_setjmp_riscv64.S --- a/compiler-rt/lib/hwasan/hwasan_setjmp_riscv64.S +++ b/compiler-rt/lib/hwasan/hwasan_setjmp_riscv64.S @@ -82,15 +82,10 @@ CFI_ENDPROC ASM_SIZE(ASM_WRAPPER_NAME(sigsetjmp)) - -.macro WEAK_ALIAS first second - .weak \second - .equ \second\(), \first -.endm - -WEAK_ALIAS ASM_WRAPPER_NAME(sigsetjmp), __sigsetjmp - -WEAK_ALIAS ASM_WRAPPER_NAME(setjmp), _setjmp +ASM_INTERCEPTOR_TRAMPOLINE(sigsetjmp) +ASM_TRAMPOLINE_ALIAS(__sigsetjmp, sigsetjmp) +ASM_INTERCEPTOR_TRAMPOLINE(setjmp) +ASM_TRAMPOLINE_ALIAS(_setjmp, setjmp) #endif // We do not need executable stack. diff --git a/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S b/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S --- a/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S +++ b/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S @@ -69,14 +69,10 @@ CFI_ENDPROC ASM_SIZE(ASM_WRAPPER_NAME(sigsetjmp)) - -.macro WEAK_ALIAS first second - .weak \second - .equ \second\(), \first -.endm - -WEAK_ALIAS ASM_WRAPPER_NAME(sigsetjmp), __sigsetjmp -WEAK_ALIAS ASM_WRAPPER_NAME(setjmp), _setjmp +ASM_INTERCEPTOR_TRAMPOLINE(sigsetjmp) +ASM_TRAMPOLINE_ALIAS(__sigsetjmp, sigsetjmp) +ASM_INTERCEPTOR_TRAMPOLINE(setjmp) +ASM_TRAMPOLINE_ALIAS(_setjmp, setjmp) #endif // We do not need executable stack. diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_asm.h b/compiler-rt/lib/sanitizer_common/sanitizer_asm.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_asm.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_asm.h @@ -49,6 +49,10 @@ # define ASM_SYMBOL(symbol) symbol # define ASM_SYMBOL_INTERCEPTOR(symbol) symbol # define ASM_WRAPPER_NAME(symbol) __interceptor_##symbol +# define ASM_TRAMPOLINE_ALIAS(symbol, name) \ + .weak symbol; \ + .set symbol, ASM_WRAPPER_NAME(name) +# define ASM_INTERCEPTOR_TRAMPOLINE(name) #else # define ASM_HIDDEN(symbol) # define ASM_TYPE_FUNCTION(symbol) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_aarch64.inc.S @@ -40,8 +40,8 @@ ret ASM_SIZE(vfork) -.weak vfork -.set vfork, ASM_WRAPPER_NAME(vfork) +ASM_INTERCEPTOR_TRAMPOLINE(vfork) +ASM_TRAMPOLINE_ALIAS(vfork, vfork) GNU_PROPERTY_BTI_PAC diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_arm.inc.S b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_arm.inc.S --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_arm.inc.S +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_arm.inc.S @@ -43,7 +43,7 @@ ASM_SIZE(vfork) -.weak vfork -.set vfork, ASM_WRAPPER_NAME(vfork) +ASM_INTERCEPTOR_TRAMPOLINE(vfork) +ASM_TRAMPOLINE_ALIAS(vfork, vfork) #endif diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_i386.inc.S @@ -58,7 +58,7 @@ ret ASM_SIZE(vfork) -.weak vfork -.set vfork, ASM_WRAPPER_NAME(vfork) +ASM_INTERCEPTOR_TRAMPOLINE(vfork) +ASM_TRAMPOLINE_ALIAS(vfork, vfork) #endif diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_loongarch64.inc.S b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_loongarch64.inc.S --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_loongarch64.inc.S +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_loongarch64.inc.S @@ -51,7 +51,7 @@ jr $ra ASM_SIZE(vfork) -.weak vfork -.set vfork, ASM_WRAPPER_NAME(vfork) +ASM_INTERCEPTOR_TRAMPOLINE(vfork) +ASM_TRAMPOLINE_ALIAS(vfork, vfork) #endif diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_riscv64.inc.S b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_riscv64.inc.S --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_riscv64.inc.S +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_riscv64.inc.S @@ -50,7 +50,7 @@ ret ASM_SIZE(vfork) -.weak vfork -.set vfork, ASM_WRAPPER_NAME(vfork) +ASM_INTERCEPTOR_TRAMPOLINE(vfork) +ASM_TRAMPOLINE_ALIAS(vfork, vfork) #endif diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_vfork_x86_64.inc.S @@ -34,9 +34,9 @@ .L_exit: pop %rax ret -ASM_SIZE(vfork) +ASM_SIZE(ASM_WRAPPER_NAME(vfork)) -.weak vfork -.set vfork, ASM_WRAPPER_NAME(vfork) +ASM_INTERCEPTOR_TRAMPOLINE(vfork) +ASM_TRAMPOLINE_ALIAS(vfork, vfork) #endif