[lld] d5e310b - [ELF][test] Make some TLS tests less sensitive to addresses

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 25 22:05:27 PST 2021


Author: Fangrui Song
Date: 2021-12-25T22:05:20-08:00
New Revision: d5e310b154351e28f56fbf3c5401da63caef2f98

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

LOG: [ELF][test] Make some TLS tests less sensitive to addresses

Added: 
    

Modified: 
    lld/test/ELF/aarch64-tls-le.s
    lld/test/ELF/aarch64-tlsdesc-zrel.s
    lld/test/ELF/i386-tls-opt.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/aarch64-tls-le.s b/lld/test/ELF/aarch64-tls-le.s
index c43345e8e254f..803818eb9e7fa 100644
--- a/lld/test/ELF/aarch64-tls-le.s
+++ b/lld/test/ELF/aarch64-tls-le.s
@@ -1,15 +1,15 @@
 # REQUIRES: aarch64
-# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %tmain.o
-# RUN: ld.lld %tmain.o -o %tout
-# RUN: llvm-objdump -d %tout | FileCheck %s
-# RUN: llvm-readobj -S -r %tout | FileCheck -check-prefix=RELOC %s
+# RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
+# RUN: llvm-readobj -S -r %t | FileCheck -check-prefix=RELOC %s
 
 #Local-Dynamic to Local-Exec relax creates no
 #RELOC:      Relocations [
 #RELOC-NEXT: ]
 
 ## Reject local-exec TLS relocations for -shared.
-# RUN: not ld.lld -shared %tmain.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:
+# RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error:
 
 # ERR: error: relocation R_AARCH64_TLSLE_ADD_TPREL_HI12 against v1 cannot be used with -shared
 # ERR: error: relocation R_AARCH64_TLSLE_ADD_TPREL_LO12_NC against v1 cannot be used with -shared
@@ -27,13 +27,13 @@ _start:
 
 # TCB size = 0x16 and foo is first element from TLS register.
 #CHECK: Disassembly of section .text:
-#CHECK: <_start>:
-#CHECK:  210158: 40 d0 3b d5     mrs     x0, TPIDR_EL0
-#CHECK:  21015c: 00 00 40 91     add     x0, x0, #0, lsl #12
-#CHECK:  210160: 00 40 00 91     add     x0, x0, #16
-#CHECK:  210164: 40 d0 3b d5     mrs     x0, TPIDR_EL0
-#CHECK:  210168: 00 fc 7f 91     add     x0, x0, #4095, lsl #12
-#CHECK:  21016c: 00 e0 3f 91     add     x0, x0, #4088
+#CHECK:      <_start>:
+#CHECK-NEXT:   mrs     x0, TPIDR_EL0
+#CHECK-NEXT:   add     x0, x0, #0, lsl #12
+#CHECK-NEXT:   add     x0, x0, #16
+#CHECK-NEXT:   mrs     x0, TPIDR_EL0
+#CHECK-NEXT:   add     x0, x0, #4095, lsl #12
+#CHECK-NEXT:   add     x0, x0, #4088
 
 .section        .tbss,"awT", at nobits
 

diff  --git a/lld/test/ELF/aarch64-tlsdesc-zrel.s b/lld/test/ELF/aarch64-tlsdesc-zrel.s
index f9f69c43d1a75..1b35e0d29a26f 100644
--- a/lld/test/ELF/aarch64-tlsdesc-zrel.s
+++ b/lld/test/ELF/aarch64-tlsdesc-zrel.s
@@ -9,14 +9,14 @@
 
 // RELA:       Relocations [
 // RELA-NEXT:   Section (5) .rela.dyn {
-// RELA-NEXT:     0x20340 R_AARCH64_TLSDESC - 0x0
-// RELA-NEXT:     0x20350 R_AARCH64_TLSDESC - 0x4
+// RELA-NEXT:     0x[[#%x,ADDR:]] R_AARCH64_TLSDESC - 0x0
+// RELA-NEXT:     0x[[#ADDR+16]]  R_AARCH64_TLSDESC - 0x4
 // RELA-NEXT:   }
 // RELA-NEXT: ]
 // RELA-NEXT:              Hex dump of section '.got':
-// RELA-NEXT:              0x00020340 00000000 00000000 00000000 00000000
-// RELA-NO-ADDENDS-NEXT:   0x00020350 00000000 00000000 00000000 00000000
-// RELA-WITH-ADDENDS-NEXT: 0x00020350 00000000 00000000 04000000 00000000
+// RELA-NEXT:              0x000[[#ADDR]]    00000000 00000000 00000000 00000000
+// RELA-NO-ADDENDS-NEXT:   0x000[[#ADDR+16]] 00000000 00000000 00000000 00000000
+// RELA-WITH-ADDENDS-NEXT: 0x000[[#ADDR+16]] 00000000 00000000 04000000 00000000
 ///                Addend 0x4 for R_AARCH64_TLSDESC -----^
 // RELA-EMPTY:
 
@@ -24,13 +24,13 @@
 // RUN: llvm-readobj -W -r -x .got %t-rel.so | FileCheck %s --check-prefix=REL
 // REL:       Relocations [
 // REL-NEXT:   Section (5) .rel.dyn {
-// REL-NEXT:     0x20330 R_AARCH64_TLSDESC -{{$}}
-// REL-NEXT:     0x20340 R_AARCH64_TLSDESC -{{$}}
+// REL-NEXT:     0x[[#%x,ADDR:]] R_AARCH64_TLSDESC -{{$}}
+// REL-NEXT:     0x[[#ADDR+16]]  R_AARCH64_TLSDESC -{{$}}
 // REL-NEXT:   }
 // REL-NEXT: ]
 // REL-NEXT: Hex dump of section '.got':
-// REL-NEXT: 0x00020330 00000000 00000000 00000000 00000000
-// REL-NEXT: 0x00020340 00000000 00000000 04000000 00000000
+// REL-NEXT: 0x000[[#ADDR]]    00000000 00000000 00000000 00000000
+// REL-NEXT: 0x000[[#ADDR+16]] 00000000 00000000 04000000 00000000
 ///  Addend 0x4 for R_AARCH64_TLSDESC -----^
 // REL-EMPTY:
 

diff  --git a/lld/test/ELF/i386-tls-opt.s b/lld/test/ELF/i386-tls-opt.s
index d6838cab73972..a5aad4c40936f 100644
--- a/lld/test/ELF/i386-tls-opt.s
+++ b/lld/test/ELF/i386-tls-opt.s
@@ -1,8 +1,8 @@
 // REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=i686 %s -o %t.o
 // RUN: ld.lld %t.o -o %t1
 // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s
-// RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t1 | FileCheck --check-prefix=DISASM %s
 
 // NORELOC:      Relocations [
 // NORELOC-NEXT: ]
@@ -11,25 +11,25 @@
 // DISASM-EMPTY:
 // DISASM-NEXT: <_start>:
 // LD -> LE:
-// DISASM-NEXT: 4010f4: 65 a1 00 00 00 00 movl %gs:0, %eax
-// DISASM-NEXT: 4010fa: 90                nop
-// DISASM-NEXT: 4010fb: 8d 74 26 00       leal (%esi,%eiz), %esi
-// DISASM-NEXT: 4010ff: 8d 90 f8 ff ff ff leal -8(%eax), %edx
-// DISASM-NEXT: 401105: 65 a1 00 00 00 00 movl %gs:0, %eax
-// DISASM-NEXT: 40110b: 90                nop
-// DISASM-NEXT: 40110c: 8d 74 26 00       leal (%esi,%eiz), %esi
-// DISASM-NEXT: 401110: 8d 90 fc ff ff ff leal -4(%eax), %edx
+// DISASM-NEXT:   movl %gs:0, %eax
+// DISASM-NEXT:   nop
+// DISASM-NEXT:   leal (%esi,%eiz), %esi
+// DISASM-NEXT:   leal -8(%eax), %edx
+// DISASM-NEXT:   movl %gs:0, %eax
+// DISASM-NEXT:   nop
+// DISASM-NEXT:   leal (%esi,%eiz), %esi
+// DISASM-NEXT:   leal -4(%eax), %edx
 // IE -> LE:
 // 4294967288 == 0xFFFFFFF8
 // 4294967292 == 0xFFFFFFFC
-// DISASM-NEXT: 401116: 65 a1 00 00 00 00  movl %gs:0, %eax
-// DISASM-NEXT: 40111c: c7 c0 f8 ff ff ff  movl $4294967288, %eax
-// DISASM-NEXT: 401122: 65 a1 00 00 00 00  movl %gs:0, %eax
-// DISASM-NEXT: 401128: c7 c0 fc ff ff ff  movl $4294967292, %eax
-// DISASM-NEXT: 40112e: 65 a1 00 00 00 00  movl %gs:0, %eax
-// DISASM-NEXT: 401134: 8d 80 f8 ff ff ff  leal -8(%eax), %eax
-// DISASM-NEXT: 40113a: 65 a1 00 00 00 00  movl %gs:0, %eax
-// DISASM-NEXT: 401140: 8d 80 fc ff ff ff  leal -4(%eax), %eax
+// DISASM-NEXT:   movl %gs:0, %eax
+// DISASM-NEXT:   movl $4294967288, %eax
+// DISASM-NEXT:   movl %gs:0, %eax
+// DISASM-NEXT:   movl $4294967292, %eax
+// DISASM-NEXT:   movl %gs:0, %eax
+// DISASM-NEXT:   leal -8(%eax), %eax
+// DISASM-NEXT:   movl %gs:0, %eax
+// DISASM-NEXT:   leal -4(%eax), %eax
 .type tls0, at object
 .section .tbss,"awT", at nobits
 .globl tls0


        


More information about the llvm-commits mailing list