[lld] r371514 - [ELF][test] Make tests more tolerant to exact symbol addresses

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 05:28:07 PDT 2019


Author: maskray
Date: Tue Sep 10 05:28:07 2019
New Revision: 371514

URL: http://llvm.org/viewvc/llvm-project?rev=371514&view=rev
Log:
[ELF][test] Make tests more tolerant to exact symbol addresses

Delete relocation-local.s and relocation-shared.s - covered by various tests

Removed:
    lld/trunk/test/ELF/relocation-local.s
    lld/trunk/test/ELF/relocation-shared.s
Modified:
    lld/trunk/test/ELF/Inputs/copy-in-shared.s
    lld/trunk/test/ELF/Inputs/relocation-copy-align-common.s
    lld/trunk/test/ELF/compressed-debug-input.s
    lld/trunk/test/ELF/discard-merge-unnamed.s
    lld/trunk/test/ELF/dynamic-list-weak-archive.s
    lld/trunk/test/ELF/gc-sections-string.s
    lld/trunk/test/ELF/gnu-ifunc-noplt.s
    lld/trunk/test/ELF/gnu-ifunc-plt.s
    lld/trunk/test/ELF/gnu-ifunc-shared.s
    lld/trunk/test/ELF/local-got-shared.s
    lld/trunk/test/ELF/local-got.s
    lld/trunk/test/ELF/pre_init_fini_array.s
    lld/trunk/test/ELF/relocation-copy-align-common.s
    lld/trunk/test/ELF/relocation-copy-align.s
    lld/trunk/test/ELF/resolution.s
    lld/trunk/test/ELF/startstop.s
    lld/trunk/test/ELF/tls.s
    lld/trunk/test/ELF/x86-64-reloc-size.s
    lld/trunk/test/ELF/x86-64-retpoline-znow.s
    lld/trunk/test/ELF/x86-64-retpoline.s

Modified: lld/trunk/test/ELF/Inputs/copy-in-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/copy-in-shared.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/Inputs/copy-in-shared.s (original)
+++ lld/trunk/test/ELF/Inputs/copy-in-shared.s Tue Sep 10 05:28:07 2019
@@ -2,3 +2,4 @@
 .global foo
 foo:
 .size foo, 4
+.space 4

Modified: lld/trunk/test/ELF/Inputs/relocation-copy-align-common.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/relocation-copy-align-common.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/Inputs/relocation-copy-align-common.s (original)
+++ lld/trunk/test/ELF/Inputs/relocation-copy-align-common.s Tue Sep 10 05:28:07 2019
@@ -1,7 +1,7 @@
 .data
 .global foo
 .type foo, @object
-.align 8
-.size foo, 8
+.align 32
+.size foo, 32
 foo:
 .quad 0

Modified: lld/trunk/test/ELF/compressed-debug-input.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/compressed-debug-input.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/compressed-debug-input.s (original)
+++ lld/trunk/test/ELF/compressed-debug-input.s Tue Sep 10 05:28:07 2019
@@ -54,7 +54,7 @@
 # DATA-NEXT:     SHF_STRINGS (0x20)
 # DATA-NEXT:   ]
 # DATA-NEXT:   Address: 0x0
-# DATA-NEXT:   Offset: 0x1060
+# DATA-NEXT:   Offset:
 # DATA-NEXT:   Size: 69
 # DATA-NEXT:   Link: 0
 # DATA-NEXT:   Info: 0

Modified: lld/trunk/test/ELF/discard-merge-unnamed.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/discard-merge-unnamed.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/discard-merge-unnamed.s (original)
+++ lld/trunk/test/ELF/discard-merge-unnamed.s Tue Sep 10 05:28:07 2019
@@ -15,7 +15,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: _DYNAMIC
-// CHECK-NEXT:     Value: 0x2000
+// CHECK-NEXT:     Value:
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Local
 // CHECK-NEXT:     Type: None

Modified: lld/trunk/test/ELF/dynamic-list-weak-archive.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynamic-list-weak-archive.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/dynamic-list-weak-archive.s (original)
+++ lld/trunk/test/ELF/dynamic-list-weak-archive.s Tue Sep 10 05:28:07 2019
@@ -1,7 +1,11 @@
 # REQUIRES: x86
 
+## A weak reference does not fetch the lazy definition. Test foo is preemptable
+## even in the presence of a dynamic list, so a dynamic relocation will be
+## produced.
+
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/dynamic-list-weak-archive.s -o %t2.o
+# RUN: echo '.globl foo; foo:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t2.o
 # RUN: rm -f %t.a
 # RUN: llvm-ar rcs %t.a %t2.o
 # RUN: echo "{ zed; };" > %t.list
@@ -10,7 +14,7 @@
 
 # CHECK:      Relocations [
 # CHECK-NEXT:   Section ({{.*}}) .rela.plt {
-# CHECK-NEXT:     0x3018 R_X86_64_JUMP_SLOT foo
+# CHECK-NEXT:     R_X86_64_JUMP_SLOT foo
 # CHECK-NEXT:   }
 # CHECK-NEXT: ]
 

Modified: lld/trunk/test/ELF/gc-sections-string.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gc-sections-string.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/gc-sections-string.s (original)
+++ lld/trunk/test/ELF/gc-sections-string.s Tue Sep 10 05:28:07 2019
@@ -35,7 +35,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:   Symbol {
 // CHECK-NEXT:     Name: _start
-// CHECK-NEXT:     Value: 0x201000
+// CHECK-NEXT:     Value:
 // CHECK-NEXT:     Size: 0
 // CHECK-NEXT:     Binding: Global (0x1)
 // CHECK-NEXT:     Type: Function (0x2)

Modified: lld/trunk/test/ELF/gnu-ifunc-noplt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-ifunc-noplt.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/gnu-ifunc-noplt.s (original)
+++ lld/trunk/test/ELF/gnu-ifunc-noplt.s Tue Sep 10 05:28:07 2019
@@ -1,6 +1,9 @@
 // REQUIRES: x86
+
+/// Test -z ifunc-noplt.
+
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-freebsd %S/Inputs/shared2-x86-64.s -o %t1.o
-// RUN: ld.lld %t1.o --shared -o %t.so
+// RUN: ld.lld %t1.o --shared -soname=so -o %t.so
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-freebsd %s -o %t.o
 // RUN: ld.lld -z ifunc-noplt -z notext --hash-style=sysv %t.so %t.o -o %tout
 // RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck %s --check-prefix=DISASM

Modified: lld/trunk/test/ELF/gnu-ifunc-plt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-ifunc-plt.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/gnu-ifunc-plt.s (original)
+++ lld/trunk/test/ELF/gnu-ifunc-plt.s Tue Sep 10 05:28:07 2019
@@ -1,9 +1,12 @@
 // REQUIRES: x86
+
+/// For non-preemptable ifunc, place ifunc PLT entries after regular PLT entries.
+
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/shared2-x86-64.s -o %t1.o
-// RUN: ld.lld %t1.o --shared -o %t.so
+// RUN: ld.lld %t1.o --shared -soname=so -o %t.so
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 // RUN: ld.lld --hash-style=sysv %t.so %t.o -o %tout
-// RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DISASM
+// RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck %s --check-prefix=DISASM
 // RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT
 // RUN: llvm-readobj -r --dynamic-table %tout | FileCheck %s
 
@@ -34,37 +37,37 @@
 // DISASM: Disassembly of section .text:
 // DISASM-EMPTY:
 // DISASM-NEXT: foo:
-// DISASM-NEXT:   201000:       c3      retq
+// DISASM-NEXT:   201000:       retq
 // DISASM:      bar:
-// DISASM-NEXT:   201001:       c3      retq
+// DISASM-NEXT:   201001:       retq
 // DISASM:      _start:
-// DISASM-NEXT:   201002:       e8 49 00 00 00          callq   73
-// DISASM-NEXT:   201007:       e8 54 00 00 00          callq   84
-// DISASM-NEXT:   20100c:       e8 1f 00 00 00          callq   31
-// DISASM-NEXT:   201011:       e8 2a 00 00 00          callq   42
+// DISASM-NEXT:   201002:       callq   73
+// DISASM-NEXT:   201007:       callq   84
+// DISASM-NEXT:                 callq   {{.*}} <bar2 at plt>
+// DISASM-NEXT:                 callq   {{.*}} <zed2 at plt>
 // DISASM-EMPTY:
 // DISASM-NEXT: Disassembly of section .plt:
 // DISASM-EMPTY:
 // DISASM-NEXT: .plt:
-// DISASM-NEXT:   201020:       ff 35 e2 1f 00 00       pushq   8162(%rip)
-// DISASM-NEXT:   201026:       ff 25 e4 1f 00 00       jmpq    *8164(%rip)
-// DISASM-NEXT:   20102c:       0f 1f 40 00     nopl    (%rax)
+// DISASM-NEXT:   201020:       pushq   8162(%rip)
+// DISASM-NEXT:   201026:       jmpq    *8164(%rip)
+// DISASM-NEXT:   20102c:       nopl    (%rax)
 // DISASM-EMPTY:
 // DISASM-NEXT:   bar2 at plt:
-// DISASM-NEXT:   201030:       ff 25 e2 1f 00 00       jmpq    *8162(%rip)
-// DISASM-NEXT:   201036:       68 00 00 00 00          pushq   $0
-// DISASM-NEXT:   20103b:       e9 e0 ff ff ff          jmp     -32 <.plt>
+// DISASM-NEXT:   201030:       jmpq    *8162(%rip)
+// DISASM-NEXT:   201036:       pushq   $0
+// DISASM-NEXT:   20103b:       jmp     -32 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT:   zed2 at plt:
-// DISASM-NEXT:   201040:       ff 25 da 1f 00 00       jmpq    *8154(%rip)
-// DISASM-NEXT:   201046:       68 01 00 00 00          pushq   $1
-// DISASM-NEXT:   20104b:       e9 d0 ff ff ff          jmp     -48 <.plt>
-// DISASM-NEXT:   201050:       ff 25 d2 1f 00 00       jmpq    *8146(%rip)
-// DISASM-NEXT:   201056:       68 00 00 00 00          pushq   $0
-// DISASM-NEXT:   20105b:       e9 e0 ff ff ff          jmp     -32 <zed2 at plt>
-// DISASM-NEXT:   201060:       ff 25 ca 1f 00 00       jmpq    *8138(%rip)
-// DISASM-NEXT:   201066:       68 01 00 00 00          pushq   $1
-// DISASM-NEXT:   20106b:       e9 d0 ff ff ff          jmp     -48 <zed2 at plt>
+// DISASM-NEXT:   201040:       jmpq    *8154(%rip)
+// DISASM-NEXT:   201046:       pushq   $1
+// DISASM-NEXT:   20104b:       jmp     -48 <.plt>
+// DISASM-NEXT:   201050:       jmpq    *8146(%rip)
+// DISASM-NEXT:   201056:       pushq   $0
+// DISASM-NEXT:   20105b:       jmp     -32 <zed2 at plt>
+// DISASM-NEXT:   201060:       jmpq    *8138(%rip)
+// DISASM-NEXT:   201066:       pushq   $1
+// DISASM-NEXT:   20106b:       jmp     -48 <zed2 at plt>
 
 .text
 .type foo STT_GNU_IFUNC

Modified: lld/trunk/test/ELF/gnu-ifunc-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-ifunc-shared.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/gnu-ifunc-shared.s (original)
+++ lld/trunk/test/ELF/gnu-ifunc-shared.s Tue Sep 10 05:28:07 2019
@@ -1,7 +1,10 @@
 // REQUIRES: x86
+
+/// For non-preemptable ifunc, place ifunc PLT entries after regular PLT entries.
+
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-// RUN: ld.lld --hash-style=sysv --shared -o %t.so %t.o
-// RUN: llvm-objdump -d %t.so | FileCheck %s --check-prefix=DISASM
+// RUN: ld.lld --shared -o %t.so %t.o
+// RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s --check-prefix=DISASM
 // RUN: llvm-readobj -r %t.so | FileCheck %s
 
 // Check that an IRELATIVE relocation is used for a non-preemptible ifunc
@@ -9,42 +12,42 @@
 // DISASM: Disassembly of section .text:
 // DISASM-EMPTY:
 // DISASM-NEXT: fct:
-// DISASM-NEXT:     1000:       c3      retq
+// DISASM-NEXT:     1000:       retq
 // DISASM:     fct2:
-// DISASM-NEXT:     1001:       c3      retq
+// DISASM-NEXT:     1001:       retq
 // DISASM:     f1:
-// DISASM-NEXT:     1002:       e8 49 00 00 00          callq   73
-// DISASM-NEXT:     1007:       e8 24 00 00 00          callq   36
-// DISASM-NEXT:     100c:       e8 2f 00 00 00          callq   47
-// DISASM-NEXT:     1011:       c3      retq
+// DISASM-NEXT:     1002:       callq   73
+// DISASM-NEXT:     1007:       callq   36
+// DISASM-NEXT:     100c:       callq   47
+// DISASM-NEXT:     1011:       retq
 // DISASM:     f2:
-// DISASM-NEXT:     1012:       c3      retq
+// DISASM-NEXT:     1012:       retq
 // DISASM-EMPTY:
 // DISASM-NEXT: Disassembly of section .plt:
 // DISASM-EMPTY:
 // DISASM-NEXT: .plt:
-// DISASM-NEXT:     1020:       ff 35 e2 1f 00 00       pushq   8162(%rip)
-// DISASM-NEXT:     1026:       ff 25 e4 1f 00 00       jmpq    *8164(%rip)
-// DISASM-NEXT:     102c:       0f 1f 40 00     nopl    (%rax)
+// DISASM-NEXT:     1020:       pushq   8162(%rip)
+// DISASM-NEXT:     1026:       jmpq    *8164(%rip)
+// DISASM-NEXT:     102c:       nopl    (%rax)
 // DISASM-EMPTY:
 // DISASM-NEXT:   fct2 at plt:
-// DISASM-NEXT:     1030:       ff 25 e2 1f 00 00       jmpq    *8162(%rip)
-// DISASM-NEXT:     1036:       68 00 00 00 00          pushq   $0
-// DISASM-NEXT:     103b:       e9 e0 ff ff ff          jmp     -32 <.plt>
+// DISASM-NEXT:     1030:       jmpq    *8162(%rip)
+// DISASM-NEXT:     1036:       pushq   $0
+// DISASM-NEXT:     103b:       jmp     -32 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT:   f2 at plt:
-// DISASM-NEXT:     1040:       ff 25 da 1f 00 00       jmpq    *8154(%rip)
-// DISASM-NEXT:     1046:       68 01 00 00 00          pushq   $1
-// DISASM-NEXT:     104b:       e9 d0 ff ff ff          jmp     -48 <.plt>
-// DISASM-NEXT:     1050:       ff 25 d2 1f 00 00       jmpq    *8146(%rip)
-// DISASM-NEXT:     1056:       68 00 00 00 00          pushq   $0
-// DISASM-NEXT:     105b:       e9 e0 ff ff ff          jmp     -32 <f2 at plt>
+// DISASM-NEXT:     1040:       jmpq    *8154(%rip)
+// DISASM-NEXT:     1046:       pushq   $1
+// DISASM-NEXT:     104b:       jmp     -48 <.plt>
+// DISASM-NEXT:     1050:       jmpq    *8146(%rip)
+// DISASM-NEXT:     1056:       pushq   $0
+// DISASM-NEXT:     105b:       jmp     -32 <f2 at plt>
 
 // CHECK: Relocations [
-// CHECK-NEXT:   Section (4) .rela.dyn {
+// CHECK-NEXT:   Section (5) .rela.dyn {
 // CHECK-NEXT:     0x3028 R_X86_64_IRELATIVE - 0x1000
 // CHECK-NEXT:   }
-// CHECK-NEXT:   Section (5) .rela.plt {
+// CHECK-NEXT:   Section (6) .rela.plt {
 // CHECK-NEXT:     0x3018 R_X86_64_JUMP_SLOT fct2 0x0
 // CHECK-NEXT:     0x3020 R_X86_64_JUMP_SLOT f2 0x0
 // CHECK-NEXT:   }

Modified: lld/trunk/test/ELF/local-got-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/local-got-shared.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/local-got-shared.s (original)
+++ lld/trunk/test/ELF/local-got-shared.s Tue Sep 10 05:28:07 2019
@@ -1,8 +1,8 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-// RUN: ld.lld --hash-style=sysv %t.o -o %t -shared
+// RUN: ld.lld %t.o -o %t -shared
 // RUN: llvm-readobj -S -r -d %t | FileCheck %s
-// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASM %s
 
 bar:
 	call foo at gotpcrel
@@ -12,12 +12,12 @@ bar:
 foo:
         nop
 
-// 0x20A0 - 0x1000 - 5 = 4251
+// 0x20B0 - 0x1000 - 5 = 4267
 // DISASM:      bar:
-// DISASM-NEXT:   1000: {{.*}} callq 4251
+// DISASM-NEXT:   1000:       callq 4267
 
 // DISASM:      foo:
-// DISASM-NEXT:   1005: {{.*}} nop
+// DISASM-NEXT:   1005:       nop
 
 // CHECK:      Name: .got
 // CHECK-NEXT: Type: SHT_PROGBITS
@@ -25,13 +25,13 @@ foo:
 // CHECK-NEXT:   SHF_ALLOC
 // CHECK-NEXT:   SHF_WRITE
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x20A0
+// CHECK-NEXT: Address: 0x20B0
 // CHECK-NEXT: Offset:
 // CHECK-NEXT: Size: 8
 
 // CHECK:      Relocations [
 // CHECK-NEXT:   Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT:     0x20A0 R_X86_64_RELATIVE - 0x1005
+// CHECK-NEXT:     0x20B0 R_X86_64_RELATIVE - 0x1005
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]
 // CHECK:      0x000000006FFFFFF9 RELACOUNT            1

Modified: lld/trunk/test/ELF/local-got.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/local-got.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/local-got.s (original)
+++ lld/trunk/test/ELF/local-got.s Tue Sep 10 05:28:07 2019
@@ -1,10 +1,10 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
-// RUN: ld.lld -shared %t2.o -o %t2.so
-// RUN: ld.lld --hash-style=sysv %t.o %t2.so -o %t
+// RUN: ld.lld -shared %t2.o -soname=so -o %t2.so
+// RUN: ld.lld %t.o %t2.so -o %t
 // RUN: llvm-readobj -S -r --section-data %t | FileCheck %s
-// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASM %s
 
         .globl _start
 _start:
@@ -15,14 +15,14 @@ _start:
 foo:
         nop
 
-// 0x2020B0 - 0x201000 - 5 =  4251
-// 0x2020B8 - 0x201005 - 5 =  4254
+// 0x2020C0 - 0x201000 - 5 =  4283
+// 0x2020C8 - 0x201005 - 5 =  4286
 // DISASM:      _start:
-// DISASM-NEXT:   201000: {{.*}} callq 4267
-// DISASM-NEXT:   201005: {{.*}} callq 4270
-
-// DISASM:      foo:
-// DISASM-NEXT:   20100a: {{.*}} nop
+// DISASM-NEXT:   201000:       callq 4283
+// DISASM-NEXT:   201005:       callq 4286
+                            
+// DISASM:      foo:        
+// DISASM-NEXT:   20100a:       nop
 
 // CHECK:      Name: .got
 // CHECK-NEXT: Type: SHT_PROGBITS
@@ -30,7 +30,7 @@ foo:
 // CHECK-NEXT:   SHF_ALLOC
 // CHECK-NEXT:   SHF_WRITE
 // CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x2020B0
+// CHECK-NEXT: Address: 0x2020C0
 // CHECK-NEXT: Offset:
 // CHECK-NEXT: Size: 16
 // CHECK-NEXT: Link: 0
@@ -38,12 +38,11 @@ foo:
 // CHECK-NEXT: AddressAlignment: 8
 // CHECK-NEXT: EntrySize: 0
 // CHECK-NEXT: SectionData (
-// 0x20200a in little endian
 // CHECK-NEXT:   0000:  00000000 00000000 0A102000 00000000
 // CHECK-NEXT: )
 
 // CHECK:      Relocations [
 // CHECK-NEXT:   Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT:     0x2020B0 R_X86_64_GLOB_DAT bar 0x0
+// CHECK-NEXT:     0x2020C0 R_X86_64_GLOB_DAT bar 0x0
 // CHECK-NEXT:   }
 // CHECK-NEXT: ]

Modified: lld/trunk/test/ELF/pre_init_fini_array.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/pre_init_fini_array.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/pre_init_fini_array.s (original)
+++ lld/trunk/test/ELF/pre_init_fini_array.s Tue Sep 10 05:28:07 2019
@@ -1,7 +1,7 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2
-// RUN: ld.lld %t2 -o %t2.so -shared
+// RUN: ld.lld %t2 -o %t2.so -shared -soname=so
 // RUN: ld.lld %t %t2.so -o %t2
 // RUN: llvm-readobj -r --symbols --sections --dynamic-table %t2 | FileCheck %s
 // RUN: llvm-objdump -d %t2 | FileCheck --check-prefix=DISASM %s
@@ -63,7 +63,7 @@ _start:
 // CHECK-NEXT: ]
 
 // CHECK:        Name: __fini_array_end
-// CHECK-NEXT:   Value: 0x20201B
+// CHECK-NEXT:   Value:
 // CHECK-NEXT:   Size: 0
 // CHECK-NEXT:   Binding: Local
 // CHECK-NEXT:   Type: None
@@ -85,7 +85,7 @@ _start:
 // CHECK-NEXT: }
 // CHECK-NEXT: Symbol {
 // CHECK-NEXT:   Name: __init_array_end
-// CHECK-NEXT:   Value: 0x202008
+// CHECK-NEXT:   Value:
 // CHECK-NEXT:   Size: 0
 // CHECK-NEXT:   Binding: Local
 // CHECK-NEXT:   Type: None
@@ -107,7 +107,7 @@ _start:
 // CHECK-NEXT: }
 // CHECK-NEXT: Symbol {
 // CHECK-NEXT:   Name: __preinit_array_end
-// CHECK-NEXT:   Value: 0x202011
+// CHECK-NEXT:   Value:
 // CHECK-NEXT:   Size: 0
 // CHECK-NEXT:   Binding: Local
 // CHECK-NEXT:   Type: None
@@ -136,17 +136,10 @@ _start:
 // CHECK: FINI_ARRAY           [[FINI_ADDR]]
 // CHECK: FINI_ARRAYSZ         [[FINI_SIZE]] (bytes)
 
-
-// 0x202008 - (0x201000 + 5) = 4099
-// 0x202011 - (0x201005 + 5) = 4103
-// 0x202000 - (0x20100a + 5) = 4081
-// 0x202008 - (0x20100f + 5) = 4084
-// 0x202011 - (0x201014 + 5) = 4088
-// 0x20201B - (0x201019 + 5) = 4093
 // DISASM:      _start:
-// DISASM-NEXT:   201000:  e8 {{.*}}  callq  4099
-// DISASM-NEXT:   201005:  e8 {{.*}}  callq  4103
-// DISASM-NEXT:   20100a:  e8 {{.*}}  callq  4081
-// DISASM-NEXT:   20100f:  e8 {{.*}}  callq  4084
-// DISASM-NEXT:   201014:  e8 {{.*}}  callq  4088
-// DISASM-NEXT:   201019:  e8 {{.*}}  callq  4093
+// DISASM-NEXT:   callq   {{.*}} <__preinit_array_start>
+// DISASM-NEXT:   callq   {{.*}} <__fini_array_start>
+// DISASM-NEXT:   callq   {{.*}} <__init_array_start>
+// DISASM-NEXT:   callq   {{.*}} <__preinit_array_start>
+// DISASM-NEXT:   callq   {{.*}} <__fini_array_start>
+// DISASM-NEXT:   callq   {{.*}} <__fini_array_end>

Modified: lld/trunk/test/ELF/relocation-copy-align-common.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-copy-align-common.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocation-copy-align-common.s (original)
+++ lld/trunk/test/ELF/relocation-copy-align-common.s Tue Sep 10 05:28:07 2019
@@ -1,10 +1,14 @@
 # REQUIRES: x86
+
+## Alignment of the copy relocated symbol is respected, even when .bss includes
+## other sections (COMMON).
+
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux \
 # RUN:   %p/Inputs/relocation-copy-align-common.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t.so
-# RUN: ld.lld --hash-style=sysv %t.o %t.so -o %t3
-# RUN: llvm-readobj -S -r --expand-relocs %t3 | FileCheck %s
+# RUN: ld.lld -shared %t2.o -soname=so -o %t.so
+# RUN: ld.lld %t.o %t.so -o %t3
+# RUN: llvm-readobj -S -r %t3 | FileCheck %s
 
 # CHECK:      Section {
 # CHECK:        Index:
@@ -16,21 +20,16 @@
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   Address: 0x203000
 # CHECK-NEXT:   Offset: 0x3000
-# CHECK-NEXT:   Size: 16
+# CHECK-NEXT:   Size: 64
 # CHECK-NEXT:   Link: 0
 # CHECK-NEXT:   Info: 0
-# CHECK-NEXT:   AddressAlignment: 8
+# CHECK-NEXT:   AddressAlignment: 32
 # CHECK-NEXT:   EntrySize: 0
 # CHECK-NEXT: }
 
 # CHECK:      Relocations [
 # CHECK-NEXT:   Section {{.*}} .rela.dyn {
-# CHECK-NEXT:     Relocation {
-# CHECK-NEXT:       Offset: 0x203008
-# CHECK-NEXT:       Type: R_X86_64_COPY
-# CHECK-NEXT:       Symbol: foo
-# CHECK-NEXT:       Addend: 0x0
-# CHECK-NEXT:     }
+# CHECK-NEXT:     0x203020 R_X86_64_COPY foo 0x0
 # CHECK-NEXT:   }
 # CHECK-NEXT: ]
 

Modified: lld/trunk/test/ELF/relocation-copy-align.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-copy-align.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocation-copy-align.s (original)
+++ lld/trunk/test/ELF/relocation-copy-align.s Tue Sep 10 05:28:07 2019
@@ -1,4 +1,7 @@
 // REQUIRES: x86
+
+/// Alignment of the copy relocated symbol is respected.
+
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy-align.s -o %t2.o
 // RUN: ld.lld -shared %t2.o -o %t.so

Removed: lld/trunk/test/ELF/relocation-local.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-local.s?rev=371513&view=auto
==============================================================================
--- lld/trunk/test/ELF/relocation-local.s (original)
+++ lld/trunk/test/ELF/relocation-local.s (removed)
@@ -1,40 +0,0 @@
-// REQUIRES: x86
-// Test that relocation of local symbols is working.
-// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
-// RUN: ld.lld %t -o %t2
-// RUN: llvm-objdump -s -d %t2 | FileCheck %s
-
-
-.global _start
-_start:
-  call lulz
-
-.zero 4
-lulz:
-
-.section       .text2,"ax", at progbits
-R_X86_64_32:
-  movl $R_X86_64_32, %edx
-
-// FIXME: this would be far more self evident if llvm-objdump printed
-// constants in hex.
-// CHECK: Disassembly of section .text2:
-// CHECK-EMPTY:
-// CHECK-NEXT: R_X86_64_32:
-// CHECK-NEXT:  201009: {{.*}} movl $2101257, %edx
-
-.section .R_X86_64_32S,"ax", at progbits
-R_X86_64_32S:
-  movq lulz - 0x100000, %rdx
-
-// CHECK: Disassembly of section .R_X86_64_32S:
-// CHECK-EMPTY:
-// CHECK-NEXT: R_X86_64_32S:
-// CHECK-NEXT:  {{.*}}: {{.*}} movq 1052681, %rdx
-
-.section .R_X86_64_64,"a", at progbits
-R_X86_64_64:
- .quad R_X86_64_64
-
-// CHECK:      Contents of section .R_X86_64_64:
-// CHECK-NEXT:   200120 20012000 00000000

Removed: lld/trunk/test/ELF/relocation-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-shared.s?rev=371513&view=auto
==============================================================================
--- lld/trunk/test/ELF/relocation-shared.s (original)
+++ lld/trunk/test/ELF/relocation-shared.s (removed)
@@ -1,36 +0,0 @@
-// REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: ld.lld %t.o -shared -o %t.so
-// RUN: llvm-readobj -r -S --section-data %t.so | FileCheck %s
-
-// CHECK:      Name: foo
-// CHECK-NEXT: Type: SHT_PROGBITS
-// CHECK-NEXT: Flags [
-// CHECK-NEXT:   SHF_ALLOC
-// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x20D
-// CHECK-NEXT: Offset:
-// CHECK-NEXT: Size: 8
-// CHECK-NEXT: Link: 0
-// CHECK-NEXT: Info: 0
-// CHECK-NEXT: AddressAlignment: 1
-// CHECK-NEXT: EntrySize: 0
-// CHECK-NEXT: SectionData (
-// CHECK-NEXT:   0000: F30D0000 00000000
-//                     0x1000 - 0x20D = 0xDF3
-// CHECK-NEXT: )
-
-// CHECK:      Name: .text
-// CHECK-NEXT: Type: SHT_PROGBITS
-// CHECK-NEXT: Flags [
-// CHECK-NEXT:   SHF_ALLOC
-// CHECK-NEXT:   SHF_EXECINSTR
-// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x1000
-
-// CHECK:      Relocations [
-// CHECK-NEXT: ]
-
-bar:
-        .section foo,"a", at progbits
-        .quad bar - .

Modified: lld/trunk/test/ELF/resolution.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/resolution.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/resolution.s (original)
+++ lld/trunk/test/ELF/resolution.s Tue Sep 10 05:28:07 2019
@@ -308,7 +308,7 @@
 // CHECK-NEXT:   }
 // CHECK-NEXT:  Symbol {
 // CHECK-NEXT:    Name: _start
-// CHECK-NEXT:    Value: 0x201000
+// CHECK-NEXT:    Value:
 // CHECK-NEXT:    Size: 0
 // CHECK-NEXT:    Binding: Global (0x1)
 // CHECK-NEXT:    Type: None (0x0)

Modified: lld/trunk/test/ELF/startstop.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/startstop.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/startstop.s (original)
+++ lld/trunk/test/ELF/startstop.s Tue Sep 10 05:28:07 2019
@@ -1,25 +1,25 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-// RUN: ld.lld --hash-style=sysv %t -o %tout -shared
-// RUN: llvm-objdump -d %tout | FileCheck -check-prefix=DISASM %s
-// RUN: llvm-readobj --symbols -r %tout | FileCheck -check-prefix=SYMBOL %s
+// RUN: ld.lld %t -o %t.so -shared
+// RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck -check-prefix=DISASM %s
+// RUN: llvm-readobj --symbols -r %t.so | FileCheck -check-prefix=SYMBOL %s
 
 // DISASM: _start:
-// DISASM:    1000:       {{.*}}  callq   10
-// DISASM:    1005:       {{.*}}  callq   8
-// DISASM:    100a:       {{.*}}  callq   3
+// DISASM:    1000:       callq   10 <__start_foo>
+// DISASM:    1005:       callq   8 <__start_bar>
+// DISASM:    100a:       callq   3 <__start_bar>
 // DISASM: Disassembly of section foo:
 // DISASM-EMPTY:
 // DISASM: __start_foo:
-// DISASM:    100f:       90      nop
-// DISASM:    1010:       90      nop
-// DISASM:    1011:       90      nop
+// DISASM:    100f:       nop
+// DISASM:                nop
+// DISASM:                nop
 // DISASM: Disassembly of section bar:
 // DISASM-EMPTY:
 // DISASM: __start_bar:
-// DISASM:    1012:       90      nop
-// DISASM:    1013:       90      nop
-// DISASM:    1014:       90      nop
+// DISASM:    1012:       nop
+// DISASM:                nop
+// DISASM:                nop
 
 // SYMBOL:      Relocations [
 // SYMBOL-NEXT:   Section ({{.*}}) .rela.dyn {

Modified: lld/trunk/test/ELF/tls.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/tls.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/tls.s (original)
+++ lld/trunk/test/ELF/tls.s Tue Sep 10 05:28:07 2019
@@ -165,7 +165,7 @@ d:
 // DIS:      Disassembly of section .text:
 // DIS-EMPTY:
 // DIS-NEXT: _start:
-// DIS-NEXT:    201000: {{.+}} movl    %fs:-8, %eax
-// DIS-NEXT:    201008: {{.+}} movl    %fs:-16, %eax
-// DIS-NEXT:    201010: {{.+}} movl    %fs:-4, %eax
-// DIS-NEXT:    201018: {{.+}} movl    %fs:-12, %eax
+// DIS-NEXT:   movl    %fs:-8, %eax
+// DIS-NEXT:   movl    %fs:-16, %eax
+// DIS-NEXT:   movl    %fs:-4, %eax
+// DIS-NEXT:   movl    %fs:-12, %eax

Modified: lld/trunk/test/ELF/x86-64-reloc-size.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-size.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-size.s (original)
+++ lld/trunk/test/ELF/x86-64-reloc-size.s Tue Sep 10 05:28:07 2019
@@ -20,10 +20,10 @@
 # DATA-NEXT: 0x00202030 00001b00 00000000 0000
 
 # DISASM:      _start:
-# DISASM-NEXT:   201000: movl 25, %eax
-# DISASM-NEXT:   201007: movl 27, %eax
-# DISASM-NEXT:   20100e: movl 25, %eax
-# DISASM-NEXT:   201015: movl 27, %eax
+# DISASM-NEXT:   movl 25, %eax
+# DISASM-NEXT:   movl 27, %eax
+# DISASM-NEXT:   movl 25, %eax
+# DISASM-NEXT:   movl 27, %eax
 
 # RELOC2:      Relocations [
 # RELOC2-NEXT: Section ({{.*}}) .rela.dyn {
@@ -41,10 +41,10 @@
 # DATA2-NEXT: 00001b00 00000000 0000
 
 # DISASM2:      _start:
-# DISASM2-NEXT:   1000: movl 0, %eax
-# DISASM2-NEXT:   1007: movl 0, %eax
-# DISASM2-NEXT:   100e: movl 25, %eax
-# DISASM2-NEXT:   1015: movl 27, %eax
+# DISASM2-NEXT:   movl 0, %eax
+# DISASM2-NEXT:   movl 0, %eax
+# DISASM2-NEXT:   movl 25, %eax
+# DISASM2-NEXT:   movl 27, %eax
 
 .data
 .global foo, foohidden

Modified: lld/trunk/test/ELF/x86-64-retpoline-znow.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-retpoline-znow.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-retpoline-znow.s (original)
+++ lld/trunk/test/ELF/x86-64-retpoline-znow.s Tue Sep 10 05:28:07 2019
@@ -1,7 +1,7 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
-// RUN: ld.lld -shared %t2.o -o %t2.so
+// RUN: ld.lld -shared %t2.o -soname=so -o %t2.so
 
 // RUN: ld.lld -shared %t1.o %t2.so -o %t.exe -z retpolineplt -z now
 // RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s
@@ -10,38 +10,38 @@
 // CHECK-EMPTY:
 // CHECK-NEXT: .plt:
 // CHECK-NEXT: 1010:       callq   11 <.plt+0x10>
-// CHECK-NEXT: 1015:       pause
-// CHECK-NEXT: 1017:       lfence
-// CHECK-NEXT: 101a:       jmp     -7 <.plt+0x5>
-// CHECK-NEXT: 101c:       int3
-// CHECK-NEXT: 101d:       int3
-// CHECK-NEXT: 101e:       int3
-// CHECK-NEXT: 101f:       int3
+// CHECK-NEXT:             pause
+// CHECK-NEXT:             lfence
+// CHECK-NEXT:             jmp     -7 <.plt+0x5>
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
 // CHECK-NEXT: 1020:       movq    %r11, (%rsp)
-// CHECK-NEXT: 1024:       retq
-// CHECK-NEXT: 1025:       int3
-// CHECK-NEXT: 1026:       int3
-// CHECK-NEXT: 1027:       int3
-// CHECK-NEXT: 1028:       int3
-// CHECK-NEXT: 1029:       int3
-// CHECK-NEXT: 102a:       int3
-// CHECK-NEXT: 102b:       int3
-// CHECK-NEXT: 102c:       int3
-// CHECK-NEXT: 102d:       int3
-// CHECK-NEXT: 102e:       int3
-// CHECK-NEXT: 102f:       int3
+// CHECK-NEXT:             retq
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
 // CHECK-NEXT: 1030:       movq    4289(%rip), %r11
-// CHECK-NEXT: 1037:       jmp     -44 <.plt>
-// CHECK-NEXT: 103c:       int3
-// CHECK-NEXT: 103d:       int3
-// CHECK-NEXT: 103e:       int3
-// CHECK-NEXT: 103f:       int3
+// CHECK-NEXT:             jmp     -44 <.plt>
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
 // CHECK-NEXT: 1040:       movq    4281(%rip), %r11
-// CHECK-NEXT: 1047:       jmp     -60 <.plt>
-// CHECK-NEXT: 104c:       int3
-// CHECK-NEXT: 104d:       int3
-// CHECK-NEXT: 104e:       int3
-// CHECK-NEXT: 104f:       int3
+// CHECK-NEXT:             jmp     -60 <.plt>
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
+// CHECK-NEXT:             int3
 
 // CHECK:      Contents of section .got.plt:
 // CHECK-NEXT: 20e0 00200000 00000000 00000000 00000000

Modified: lld/trunk/test/ELF/x86-64-retpoline.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-retpoline.s?rev=371514&r1=371513&r2=371514&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-retpoline.s (original)
+++ lld/trunk/test/ELF/x86-64-retpoline.s Tue Sep 10 05:28:07 2019
@@ -1,7 +1,7 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
-// RUN: ld.lld -shared %t2.o -o %t2.so
+// RUN: ld.lld -shared %t2.o -soname=so -o %t2.so
 
 // RUN: ld.lld -shared %t1.o %t2.so -o %t.exe -z retpolineplt
 // RUN: llvm-objdump -d -s --no-show-raw-insn %t.exe | FileCheck %s




More information about the llvm-commits mailing list