[compiler-rt] 1aedf77 - [HWASan] Use a single .weak binding in asm.

Matt Morehouse via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 09:35:32 PDT 2021


Author: Matt Morehouse
Date: 2021-09-22T09:35:09-07:00
New Revision: 1aedf77ece6bc9a1fc70453d4603280bde6ebf1f

URL: https://github.com/llvm/llvm-project/commit/1aedf77ece6bc9a1fc70453d4603280bde6ebf1f
DIFF: https://github.com/llvm/llvm-project/commit/1aedf77ece6bc9a1fc70453d4603280bde6ebf1f.diff

LOG: [HWASan] Use a single .weak binding in asm.

Specifying .global and .weak causes a compiler warning:

  warning: __sigsetjmp changed binding to STB_WEAK

Specifying only .weak should have the same effect without causing a
warning.

Reviewed By: eugenis

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

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_setjmp_aarch64.S
    compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_setjmp_aarch64.S b/compiler-rt/lib/hwasan/hwasan_setjmp_aarch64.S
index bdefb67ee2800..744748a5101f5 100644
--- a/compiler-rt/lib/hwasan/hwasan_setjmp_aarch64.S
+++ b/compiler-rt/lib/hwasan/hwasan_setjmp_aarch64.S
@@ -80,24 +80,19 @@ __interceptor_sigsetjmp:
 ASM_SIZE(__interceptor_sigsetjmp)
 
 
-.macro ALIAS first second
-  .globl \second
+.macro WEAK_ALIAS first second
+  .weak \second
   .equ \second\(), \first
 .endm
 
 #if SANITIZER_ANDROID
-ALIAS __interceptor_sigsetjmp, sigsetjmp
-.weak sigsetjmp
-
-ALIAS __interceptor_setjmp_bionic, setjmp
-.weak setjmp
+WEAK_ALIAS __interceptor_sigsetjmp, sigsetjmp
+WEAK_ALIAS __interceptor_setjmp_bionic, setjmp
 #else
-ALIAS __interceptor_sigsetjmp, __sigsetjmp
-.weak __sigsetjmp
+WEAK_ALIAS __interceptor_sigsetjmp, __sigsetjmp
 #endif
 
-ALIAS __interceptor_setjmp, _setjmp
-.weak _setjmp
+WEAK_ALIAS __interceptor_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
index 0209e6d44f105..84512d10b238a 100644
--- a/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S
+++ b/compiler-rt/lib/hwasan/hwasan_setjmp_x86_64.S
@@ -68,9 +68,8 @@ ASM_SIZE(__interceptor_sigsetjmp)
 
 
 .macro WEAK_ALIAS first second
-  .globl \second
-  .equ \second\(), \first
   .weak \second
+  .equ \second\(), \first
 .endm
 
 WEAK_ALIAS __interceptor_sigsetjmp, __sigsetjmp


        


More information about the llvm-commits mailing list