[llvm] 1271ba4 - [AArch64][test] Test GOT relocations referencing local STT_TLS are not converted to reference STT_SECTION symbols

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 26 17:17:29 PDT 2023


Author: Fangrui Song
Date: 2023-08-26T17:17:24-07:00
New Revision: 1271ba473e276977d2afb443d462d0a6766d8f95

URL: https://github.com/llvm/llvm-project/commit/1271ba473e276977d2afb443d462d0a6766d8f95
DIFF: https://github.com/llvm/llvm-project/commit/1271ba473e276977d2afb443d462d0a6766d8f95.diff

LOG: [AArch64][test] Test GOT relocations referencing local STT_TLS are not converted to reference STT_SECTION symbols

AArch64 encodes the GOT-generating intent in MCValue::RefKind instead of
MCSymbolRef::Kind for most other targets. It seems useful to test the
case for additional coverage.

Added: 
    

Modified: 
    llvm/test/MC/AArch64/tls-relocs.s

Removed: 
    


################################################################################
diff  --git a/llvm/test/MC/AArch64/tls-relocs.s b/llvm/test/MC/AArch64/tls-relocs.s
index 47243c28bc7a82..3cdad8e5ca5042 100644
--- a/llvm/test/MC/AArch64/tls-relocs.s
+++ b/llvm/test/MC/AArch64/tls-relocs.s
@@ -175,27 +175,28 @@
 
         // TLS initial-exec forms
         movz x15, #:gottprel_g1:var
-        movz w14, #:gottprel_g1:var
+// GOT relocations referencing local STT_TLS are not converted to reference STT_SECTION symbols.
+        movz w14, #:gottprel_g1:local0
 
 // CHECK: movz    x15, #:gottprel_g1:var  // encoding: [0bAAA01111,A,0b101AAAAA,0x92]
 // CHECK:                                 //   fixup A - offset: 0, value: :gottprel_g1:var, kind: fixup_aarch64_movw
-// CHECK: movz    w14, #:gottprel_g1:var  // encoding: [0bAAA01110,A,0b101AAAAA,0x12]
-// CHECK:                                 //   fixup A - offset: 0, value: :gottprel_g1:var, kind: fixup_aarch64_movw
+// CHECK: movz    w14, #:gottprel_g1:local0  // encoding: [0bAAA01110,A,0b101AAAAA,0x12]
+// CHECK:                                 //   fixup A - offset: 0, value: :gottprel_g1:local0, kind: fixup_aarch64_movw
 
 // CHECK-ELF-NEXT:     0x78 R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 [[VARSYM]]
-// CHECK-ELF-NEXT:     0x7C R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 [[VARSYM]]
+// CHECK-ELF-NEXT:     0x7C R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 local0
 
 
         movk x13, #:gottprel_g0_nc:var
-        movk w12, #:gottprel_g0_nc:var
+        movk w12, #:gottprel_g0_nc:local1
 
 // CHECK: movk    x13, #:gottprel_g0_nc:var // encoding: [0bAAA01101,A,0b100AAAAA,0xf2]
 // CHECK:                                   //   fixup A - offset: 0, value: :gottprel_g0_nc:var, kind: fixup_aarch64_movw
-// CHECK: movk    w12, #:gottprel_g0_nc:var // encoding: [0bAAA01100,A,0b100AAAAA,0x72]
-// CHECK:                                   //   fixup A - offset: 0, value: :gottprel_g0_nc:var, kind: fixup_aarch64_movw
+// CHECK: movk    w12, #:gottprel_g0_nc:local1 // encoding: [0bAAA01100,A,0b100AAAAA,0x72]
+// CHECK:                                   //   fixup A - offset: 0, value: :gottprel_g0_nc:local1, kind: fixup_aarch64_movw
 
 // CHECK-ELF-NEXT:     0x80 R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC [[VARSYM]]
-// CHECK-ELF-NEXT:     0x84 R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC [[VARSYM]]
+// CHECK-ELF-NEXT:     0x84 R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC local1
 
 
         adrp x11, :gottprel:var
@@ -396,6 +397,11 @@
 // CHECK-ELF-NEXT:     0x10C R_AARCH64_TLSDESC_ADD_LO12 [[VARSYM]]
 // CHECK-ELF-NEXT:     0x110 R_AARCH64_TLSDESC_CALL [[VARSYM]]
 
+        .section        .tbss,"awT", at nobits
+        .p2align        2, 0x0
+local0:
+local1:
+        .word   0
 
 // Make sure symbol 5 has type STT_TLS:
 


        


More information about the llvm-commits mailing list