summaryrefslogtreecommitdiffstats
path: root/lld/test
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-09-09 03:35:14 +0000
committerFangrui Song <maskray@google.com>2019-09-09 03:35:14 +0000
commit88796a798856abecbebf9de666562bf6df41a303 (patch)
treef7ee936c116943568be67c217262406b40efae48 /lld/test
parent197901081bc52061d7827df6b1959b940b0704e5 (diff)
downloadbcm5719-llvm-88796a798856abecbebf9de666562bf6df41a303.tar.gz
bcm5719-llvm-88796a798856abecbebf9de666562bf6df41a303.zip
[ELF][test] Improve and reorganize another set of tests
Add file-level comments Replace trivial Input/*.s with echo ... | llvm-mc Delete insignificant addresses to make them more tolerant to layout changes Simplify test output Merge merge-section-types.s into compatible-section-types.s and add a missed case Merge gnu-ifunc-gotpcrel.s (added in D19517) into gnu-ifunc-dso.s (added in D35119) and add missed cases Delete typed-undef.s - covered by executable-undefined-ignoreall.s Delete emit-relocs-shared.s - covered by emit-relocs-merge.s Replace copy-rel-pie.s and copy-rel-pie2.s with canonical-plt-pcrel.s, canonical-plt-symbolic.s and copy-rel.s: add -no-pie cases. add a case that a canonical PLT can be created for STT_GNU_IFUNC. The logic in Symbols.h was untested: // ctor of SharedSymbol if (this->type == llvm::ELF::STT_GNU_IFUNC) this->type = llvm::ELF::STT_FUNC; llvm-svn: 371361
Diffstat (limited to 'lld/test')
-rw-r--r--lld/test/ELF/Inputs/canonical-plt-pcrel.s5
-rw-r--r--lld/test/ELF/Inputs/copy-rel-pie.s12
-rw-r--r--lld/test/ELF/Inputs/copy-rel.s11
-rw-r--r--lld/test/ELF/Inputs/gnu-ifunc-dso.s4
-rw-r--r--lld/test/ELF/Inputs/gnu-ifunc-gotpcrel.s4
-rw-r--r--lld/test/ELF/Inputs/protected-function-access.s5
-rw-r--r--lld/test/ELF/Inputs/startstop-shared2.s2
-rw-r--r--lld/test/ELF/aarch64-plt.s (renamed from lld/test/ELF/plt-aarch64.s)0
-rw-r--r--lld/test/ELF/canonical-plt-pcrel.s33
-rw-r--r--lld/test/ELF/canonical-plt-symbolic.s24
-rw-r--r--lld/test/ELF/compatible-section-types.s26
-rw-r--r--lld/test/ELF/copy-rel-pie.s30
-rw-r--r--lld/test/ELF/copy-rel-pie2.s13
-rw-r--r--lld/test/ELF/copy-rel.s25
-rw-r--r--lld/test/ELF/dynsym-pie.s8
-rw-r--r--lld/test/ELF/emit-relocs-shared.s16
-rw-r--r--lld/test/ELF/executable-undefined-ignoreall.s15
-rw-r--r--lld/test/ELF/gc-sections-local-sym.s5
-rw-r--r--lld/test/ELF/global-offset-table-position.s8
-rw-r--r--lld/test/ELF/gnu-ifunc-dso.s20
-rw-r--r--lld/test/ELF/gnu-ifunc-gotpcrel.s14
-rw-r--r--lld/test/ELF/i386-plt.s (renamed from lld/test/ELF/plt-i686.s)0
-rw-r--r--lld/test/ELF/linkerscript/symbol-reserved.s3
-rw-r--r--lld/test/ELF/merge-section-types.s20
-rw-r--r--lld/test/ELF/protected-data-access.s7
-rw-r--r--lld/test/ELF/protected-function-access.s13
-rw-r--r--lld/test/ELF/relro-tls.s1
-rw-r--r--lld/test/ELF/startstop-gccollect.s8
-rw-r--r--lld/test/ELF/startstop-shared2.s9
-rw-r--r--lld/test/ELF/symbol-ordering-file.s8
-rw-r--r--lld/test/ELF/tls-opt.s46
-rw-r--r--lld/test/ELF/typed-undef.s11
-rw-r--r--lld/test/ELF/version-script-local-preemptible.s (renamed from lld/test/ELF/local-ver-preemptible.s)8
-rw-r--r--lld/test/ELF/weak-undef-got-pie.s (renamed from lld/test/ELF/pie-weak.s)12
-rw-r--r--lld/test/ELF/wrap-entry.s8
-rw-r--r--lld/test/ELF/wrap-no-real.s4
-rw-r--r--lld/test/ELF/wrap-plt.s26
-rw-r--r--lld/test/ELF/x86-64-plt.s (renamed from lld/test/ELF/plt.s)0
-rw-r--r--lld/test/ELF/x86-64-reloc-size-shared.s57
39 files changed, 268 insertions, 253 deletions
diff --git a/lld/test/ELF/Inputs/canonical-plt-pcrel.s b/lld/test/ELF/Inputs/canonical-plt-pcrel.s
new file mode 100644
index 00000000000..966f26a1e64
--- /dev/null
+++ b/lld/test/ELF/Inputs/canonical-plt-pcrel.s
@@ -0,0 +1,5 @@
+.globl func, ifunc
+.type func, @function
+.type ifunc, @gnu_indirect_function
+func:
+ifunc:
diff --git a/lld/test/ELF/Inputs/copy-rel-pie.s b/lld/test/ELF/Inputs/copy-rel-pie.s
deleted file mode 100644
index b3345ceea67..00000000000
--- a/lld/test/ELF/Inputs/copy-rel-pie.s
+++ /dev/null
@@ -1,12 +0,0 @@
-.data
-.global foo
-.type foo, @object
-.size foo, 4
-foo:
-.long 0
-
-.text
-.global bar
-.type bar, @function
-bar:
-retq
diff --git a/lld/test/ELF/Inputs/copy-rel.s b/lld/test/ELF/Inputs/copy-rel.s
new file mode 100644
index 00000000000..e6714943019
--- /dev/null
+++ b/lld/test/ELF/Inputs/copy-rel.s
@@ -0,0 +1,11 @@
+.globl foo, bar
+.type foo, @object
+.size foo, 4
+foo:
+.long 1
+
+.weak bar
+.type bar, @object
+.size bar, 4
+bar:
+.long 2
diff --git a/lld/test/ELF/Inputs/gnu-ifunc-dso.s b/lld/test/ELF/Inputs/gnu-ifunc-dso.s
index bd82718718b..e4ce32e36fd 100644
--- a/lld/test/ELF/Inputs/gnu-ifunc-dso.s
+++ b/lld/test/ELF/Inputs/gnu-ifunc-dso.s
@@ -1,3 +1,5 @@
.type foo STT_GNU_IFUNC
-.globl foo
+.type bar STT_GNU_IFUNC
+.globl foo, bar
foo:
+bar:
diff --git a/lld/test/ELF/Inputs/gnu-ifunc-gotpcrel.s b/lld/test/ELF/Inputs/gnu-ifunc-gotpcrel.s
deleted file mode 100644
index 83b06e05d46..00000000000
--- a/lld/test/ELF/Inputs/gnu-ifunc-gotpcrel.s
+++ /dev/null
@@ -1,4 +0,0 @@
-.type foo STT_GNU_IFUNC
-.globl foo
-foo:
-ret
diff --git a/lld/test/ELF/Inputs/protected-function-access.s b/lld/test/ELF/Inputs/protected-function-access.s
deleted file mode 100644
index 4dfffe51295..00000000000
--- a/lld/test/ELF/Inputs/protected-function-access.s
+++ /dev/null
@@ -1,5 +0,0 @@
- .global foo
- .protected foo
- .type foo, @function
-foo:
- ret
diff --git a/lld/test/ELF/Inputs/startstop-shared2.s b/lld/test/ELF/Inputs/startstop-shared2.s
deleted file mode 100644
index 414bf6dc876..00000000000
--- a/lld/test/ELF/Inputs/startstop-shared2.s
+++ /dev/null
@@ -1,2 +0,0 @@
-.globl __start_foo
-__start_foo:
diff --git a/lld/test/ELF/plt-aarch64.s b/lld/test/ELF/aarch64-plt.s
index d37d775def1..d37d775def1 100644
--- a/lld/test/ELF/plt-aarch64.s
+++ b/lld/test/ELF/aarch64-plt.s
diff --git a/lld/test/ELF/canonical-plt-pcrel.s b/lld/test/ELF/canonical-plt-pcrel.s
new file mode 100644
index 00000000000..51ad97bb975
--- /dev/null
+++ b/lld/test/ELF/canonical-plt-pcrel.s
@@ -0,0 +1,33 @@
+# REQUIRES: x86
+
+## Test canonical PLT can be created for -no-pie and -pie.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/canonical-plt-pcrel.s -o %t1.o
+# RUN: ld.lld %t1.o -o %t1.so -shared -soname=so
+
+# RUN: ld.lld %t.o %t1.so -o %t
+# RUN: llvm-readobj -r %t | FileCheck %s
+# RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
+
+# RUN: ld.lld %t.o %t1.so -o %t -pie
+# RUN: llvm-readobj -r %t | FileCheck %s
+# RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
+
+# CHECK: Relocations [
+# CHECK-NEXT: .rela.plt {
+# CHECK-NEXT: R_X86_64_JUMP_SLOT func 0x0
+# CHECK-NEXT: R_X86_64_JUMP_SLOT ifunc 0x0
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+# DISASM: _start:
+# DISASM-NEXT: callq {{.*}} <func@plt>
+# DISASM-NEXT: callq {{.*}} <ifunc@plt>
+
+.globl _start
+_start:
+ .byte 0xe8
+ .long func - . -4 # STT_FUNC
+ .byte 0xe8
+ .long ifunc - . -4 # STT_GNU_IFUNC
diff --git a/lld/test/ELF/canonical-plt-symbolic.s b/lld/test/ELF/canonical-plt-symbolic.s
new file mode 100644
index 00000000000..d6ea093caf5
--- /dev/null
+++ b/lld/test/ELF/canonical-plt-symbolic.s
@@ -0,0 +1,24 @@
+# REQUIRES: x86
+
+## Test canonical PLT can be created for -no-pie and -pie.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/canonical-plt-pcrel.s -o %t1.o
+# RUN: ld.lld %t1.o -o %t1.so -shared -soname=so
+
+# RUN: ld.lld %t.o %t1.so -o %t
+# RUN: llvm-readobj -r %t | FileCheck %s
+
+# RUN: ld.lld %t.o %t1.so -o %t -pie
+# RUN: llvm-readobj -r %t | FileCheck %s
+
+# CHECK: Relocations [
+# CHECK-NEXT: .rela.plt {
+# CHECK-NEXT: R_X86_64_JUMP_SLOT func 0x0
+# CHECK-NEXT: R_X86_64_JUMP_SLOT ifunc 0x0
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+.rodata
+ .quad func # STT_FUNC
+ .quad ifunc # STT_GNU_IFUNC
diff --git a/lld/test/ELF/compatible-section-types.s b/lld/test/ELF/compatible-section-types.s
index e47006c5514..8aaf7194ec3 100644
--- a/lld/test/ELF/compatible-section-types.s
+++ b/lld/test/ELF/compatible-section-types.s
@@ -1,9 +1,15 @@
-// REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: ld.lld -shared %t.o -o %t
-// RUN: llvm-objdump -section-headers %t | FileCheck %s
+# REQUIRES: x86
-// CHECK: .foo {{0*}}28
+## Some section types (e.g. SHT_NOBITS, SHT_NOTE, SHT_PREINIT_ARRAY) can be
+## mixed with SHT_PROGBITS. The output type is SHT_PROGBITS.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld -shared %t.o -o %t
+# RUN: llvm-readelf -S %t | FileCheck %s
+
+# CHECK: .foo2 PROGBITS {{.*}} 000002 00 A
+# CHECK: .foo PROGBITS {{.*}} 000028 00 WA
+# CHECK: .foo1 PROGBITS {{.*}} 000010 00 WA
.section .foo, "aw", @progbits, unique, 1
.quad 0
@@ -19,3 +25,13 @@
.section .foo, "aw", @note, unique, 5
.quad 0
+
+.section .foo1, "aw", @progbits, unique, 1
+.quad 0
+.section .foo1, "aw", @nobits, unique, 2
+.quad 0
+
+.section .foo2, "a", @nobits, unique, 1
+.byte 0
+.section .foo2, "a", @progbits, unique, 2
+.byte 0
diff --git a/lld/test/ELF/copy-rel-pie.s b/lld/test/ELF/copy-rel-pie.s
deleted file mode 100644
index 5a7a71f5317..00000000000
--- a/lld/test/ELF/copy-rel-pie.s
+++ /dev/null
@@ -1,30 +0,0 @@
-# REQUIRES: x86
-
-## Test copy relocations can be created for -pie.
-
-# RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
-# RUN: llvm-mc %p/Inputs/copy-rel-pie.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux
-# RUN: ld.lld %t2.o -o %t2.so -shared
-# RUN: ld.lld %t.o %t2.so -o %t -pie
-# RUN: llvm-readobj -r %t | FileCheck %s
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
-
-.global _start
-_start:
- .byte 0xe8
- .long bar - . -4
- .byte 0xe8
- .long foo - . -4
-
-// CHECK: Relocations [
-// CHECK-NEXT: .rela.dyn {
-// CHECK-NEXT: R_X86_64_COPY foo 0x0
-// CHECK-NEXT: }
-// CHECK-NEXT: .rela.plt {
-// CHECK-NEXT: R_X86_64_JUMP_SLOT bar 0x0
-// CHECK-NEXT: }
-// CHECK-NEXT: ]
-
-// DISASM: _start:
-// DISASM-NEXT: callq {{.*}} <bar@plt>
-// DISASM-NEXT: callq {{.*}} <foo>
diff --git a/lld/test/ELF/copy-rel-pie2.s b/lld/test/ELF/copy-rel-pie2.s
deleted file mode 100644
index 81cfac4e316..00000000000
--- a/lld/test/ELF/copy-rel-pie2.s
+++ /dev/null
@@ -1,13 +0,0 @@
-// REQUIRES: x86
-// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
-// RUN: llvm-mc %p/Inputs/copy-rel-pie.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux
-// RUN: ld.lld %t2.o -o %t2.so -shared
-// RUN: ld.lld %t.o %t2.so -o %t -pie
-// RUN: llvm-readobj -r %t | FileCheck %s
-
-// CHECK: R_X86_64_COPY
-// CHECK: R_X86_64_JUMP_SLOT
-
-.rodata
-.quad bar
-.quad foo
diff --git a/lld/test/ELF/copy-rel.s b/lld/test/ELF/copy-rel.s
new file mode 100644
index 00000000000..c93e5b04ca3
--- /dev/null
+++ b/lld/test/ELF/copy-rel.s
@@ -0,0 +1,25 @@
+# REQUIRES: x86
+
+## Test copy relocations can be created for -no-pie and -pie.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/copy-rel.s -o %t1.o
+# RUN: ld.lld %t1.o -o %t1.so -shared -soname=so
+
+# RUN: ld.lld %t.o %t1.so -o %t
+# RUN: llvm-readobj -r %t | FileCheck %s
+
+# RUN: ld.lld %t.o %t1.so -o %t -pie
+# RUN: llvm-readobj -r %t | FileCheck %s
+
+# CHECK: Relocations [
+# CHECK-NEXT: .rela.dyn {
+# CHECK-NEXT: R_X86_64_COPY bar 0x0
+# CHECK-NEXT: R_X86_64_COPY foo 0x0
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+.global _start
+_start:
+ mov $foo - ., %eax
+ movabs $bar, %rax
diff --git a/lld/test/ELF/dynsym-pie.s b/lld/test/ELF/dynsym-pie.s
index 10ddfa5cb25..54c7ceecc05 100644
--- a/lld/test/ELF/dynsym-pie.s
+++ b/lld/test/ELF/dynsym-pie.s
@@ -6,7 +6,7 @@
# CHECK: Symbols [
# CHECK: Symbol {
# CHECK: Name: hidden
-# CHECK-NEXT: Value: 0x1000
+# CHECK-NEXT: Value: [[ADDR:.*]]
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local
# CHECK-NEXT: Type: None
@@ -17,7 +17,7 @@
# CHECK-NEXT: }
# CHECK: Symbol {
# CHECK: Name: internal
-# CHECK-NEXT: Value: 0x1000
+# CHECK-NEXT: Value: [[ADDR]]
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local
# CHECK-NEXT: Type: None
@@ -28,7 +28,7 @@
# CHECK-NEXT: }
# CHECK: Symbol {
# CHECK: Name: default
-# CHECK-NEXT: Value: 0x1000
+# CHECK-NEXT: Value: [[ADDR]]
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: None
@@ -37,7 +37,7 @@
# CHECK-NEXT: }
# CHECK: Symbol {
# CHECK: Name: protected
-# CHECK-NEXT: Value: 0x1000
+# CHECK-NEXT: Value: [[ADDR]]
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: None
diff --git a/lld/test/ELF/emit-relocs-shared.s b/lld/test/ELF/emit-relocs-shared.s
deleted file mode 100644
index 6c4456e04a9..00000000000
--- a/lld/test/ELF/emit-relocs-shared.s
+++ /dev/null
@@ -1,16 +0,0 @@
-# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-# RUN: ld.lld --hash-style=sysv --emit-relocs %t.o -o %t.so -shared
-# RUN: llvm-readobj -r %t.so | FileCheck %s
-
-.data
-.quad foo
-
-# CHECK: Relocations [
-# CHECK-NEXT: Section {{.*}} .rela.dyn {
-# CHECK-NEXT: 0x2000 R_X86_64_64 foo 0x0
-# CHECK-NEXT: }
-# CHECK-NEXT: Section {{.*}} .rela.data {
-# CHECK-NEXT: 0x2000 R_X86_64_64 foo 0x0
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
diff --git a/lld/test/ELF/executable-undefined-ignoreall.s b/lld/test/ELF/executable-undefined-ignoreall.s
index 514435afcfe..a479317c0f7 100644
--- a/lld/test/ELF/executable-undefined-ignoreall.s
+++ b/lld/test/ELF/executable-undefined-ignoreall.s
@@ -1,11 +1,18 @@
# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: ld.lld %t -o %tout --unresolved-symbols=ignore-all -pie
-# RUN: llvm-readobj -r %tout | FileCheck %s
+
+## --unresolved-symbols=ignore-all behaves similar to -shared:
+## for PLT relocations to undefined symbols, produce dynamic reloctions if we
+## emit .dynsym.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: ld.lld %t.o -o %t --unresolved-symbols=ignore-all -pie
+# RUN: llvm-readobj -r %t | FileCheck %s
+# RUN: ld.lld %t.o -o %t --unresolved-symbols=ignore-all --export-dynamic
+# RUN: llvm-readobj -r %t | FileCheck %s
# CHECK: Relocations [
# CHECK-NEXT: Section ({{.*}}) .rela.plt {
-# CHECK-NEXT: 0x3018 R_X86_64_JUMP_SLOT foo 0x0
+# CHECK-NEXT: R_X86_64_JUMP_SLOT foo 0x0
# CHECK-NEXT: }
# CHECK-NEXT: ]
diff --git a/lld/test/ELF/gc-sections-local-sym.s b/lld/test/ELF/gc-sections-local-sym.s
index d43275e2167..f6b99b06803 100644
--- a/lld/test/ELF/gc-sections-local-sym.s
+++ b/lld/test/ELF/gc-sections-local-sym.s
@@ -1,4 +1,7 @@
// REQUIRES: x86
+
+/// When copying local symbols, skip those defined in discarded sections.
+
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
// RUN: ld.lld %t -o %t2 -shared --gc-sections
// RUN: llvm-readobj --symbols -S --section-data %t2 | FileCheck %s
@@ -36,7 +39,7 @@ zed:
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: _DYNAMIC
-// CHECK-NEXT: Value: 0x1000
+// CHECK-NEXT: Value:
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None
diff --git a/lld/test/ELF/global-offset-table-position.s b/lld/test/ELF/global-offset-table-position.s
index 2efeadcc8c0..bbb517e09f8 100644
--- a/lld/test/ELF/global-offset-table-position.s
+++ b/lld/test/ELF/global-offset-table-position.s
@@ -1,7 +1,7 @@
// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
-// RUN: ld.lld --hash-style=sysv -shared %t -o %t2
-// RUN: llvm-readobj --symbols %t2 | FileCheck %s
+// RUN: ld.lld -shared %t -o %t2
+// RUN: llvm-readobj -S --symbols %t2 | FileCheck %s
// The X86_64 _GLOBAL_OFFSET_TABLE_ is defined at the start of the .got.plt
// section.
@@ -21,8 +21,10 @@ callq f@PLT
.data
.long _GLOBAL_OFFSET_TABLE_ - .
+// CHECK: Name: .got.plt
+// CHECK: Address: [[ADDR:.*]]
// CHECK: Name: _GLOBAL_OFFSET_TABLE_
-// CHECK-NEXT: Value: 0x3008
+// CHECK-NEXT: Value: [[ADDR]]
// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Local
// CHECK-NEXT: Type: None (0x0)
diff --git a/lld/test/ELF/gnu-ifunc-dso.s b/lld/test/ELF/gnu-ifunc-dso.s
index 5c2d9d54cc2..c448c1f0578 100644
--- a/lld/test/ELF/gnu-ifunc-dso.s
+++ b/lld/test/ELF/gnu-ifunc-dso.s
@@ -1,13 +1,21 @@
# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/gnu-ifunc-dso.s -o %t1.o
-# RUN: ld.lld -shared %t1.o -o %t.so
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o
-# RUN: ld.lld -shared %t2.o %t.so -o %t
+
+## Produce dynamic relocations (symbolic or GOT) for relocations to ifunc
+## defined in a DSO.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %S/Inputs/gnu-ifunc-dso.s -o %t1.o
+# RUN: ld.lld -shared %t1.o -soname=so -o %t1.so
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: ld.lld %t.o %t1.so -o %t
# RUN: llvm-readobj --dyn-relocations %t | FileCheck %s
+# RUN: ld.lld -shared %t.o %t1.so -o %t.so
+# RUN: llvm-readobj --dyn-relocations %t.so | FileCheck %s
# CHECK: Dynamic Relocations {
-# CHECK-NEXT: 0x2000 R_X86_64_64 foo 0x0
+# CHECK-NEXT: R_X86_64_64 bar 0x0
+# CHECK-NEXT: R_X86_64_GLOB_DAT foo 0x0
# CHECK-NEXT: }
.data
- .quad foo
+ mov foo@gotpcrel(%rip), %rax
+ .quad bar
diff --git a/lld/test/ELF/gnu-ifunc-gotpcrel.s b/lld/test/ELF/gnu-ifunc-gotpcrel.s
deleted file mode 100644
index 7ec30757f5c..00000000000
--- a/lld/test/ELF/gnu-ifunc-gotpcrel.s
+++ /dev/null
@@ -1,14 +0,0 @@
-# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/gnu-ifunc-gotpcrel.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t2.so
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-# RUN: ld.lld --hash-style=sysv %t.o %t2.so -o %t
-# RUN: llvm-readobj --dyn-relocations %t | FileCheck %s
-
-# CHECK: Dynamic Relocations {
-# CHECK-NEXT: 0x2020B0 R_X86_64_GLOB_DAT foo 0x0
-# CHECK-NEXT: }
-
-.globl _start
-_start:
-mov foo@gotpcrel(%rip), %rax
diff --git a/lld/test/ELF/plt-i686.s b/lld/test/ELF/i386-plt.s
index a11f4011074..a11f4011074 100644
--- a/lld/test/ELF/plt-i686.s
+++ b/lld/test/ELF/i386-plt.s
diff --git a/lld/test/ELF/linkerscript/symbol-reserved.s b/lld/test/ELF/linkerscript/symbol-reserved.s
index 8ae9d0cd661..a4c88daeb80 100644
--- a/lld/test/ELF/linkerscript/symbol-reserved.s
+++ b/lld/test/ELF/linkerscript/symbol-reserved.s
@@ -1,4 +1,7 @@
# REQUIRES: x86
+
+## Test linker synthesized symbols (e.g. __ehdr_start, _end) can be used in linker scripts.
+
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: echo "PROVIDE_HIDDEN(newsym = __ehdr_start + 5);" > %t.script
# RUN: ld.lld -o %t1 %t.script %t
diff --git a/lld/test/ELF/merge-section-types.s b/lld/test/ELF/merge-section-types.s
deleted file mode 100644
index a83e8cdfb29..00000000000
--- a/lld/test/ELF/merge-section-types.s
+++ /dev/null
@@ -1,20 +0,0 @@
-// REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: ld.lld -shared %t.o -o %t
-// RUN: llvm-readobj -S %t | FileCheck %s
-
-// CHECK: Name: .foo
-// CHECK-NEXT: Type: SHT_PROGBITS
-// CHECK-NEXT: Flags [
-// CHECK-NEXT: SHF_ALLOC
-// CHECK-NEXT: SHF_WRITE
-// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x2000
-// CHECK-NEXT: Offset: 0x2000
-// CHECK-NEXT: Size: 16
-
-.section .foo, "aw", @progbits, unique, 1
-.quad 0
-
-.section .foo, "aw", @nobits, unique, 2
-.quad 0
diff --git a/lld/test/ELF/protected-data-access.s b/lld/test/ELF/protected-data-access.s
index 530710751d6..35fd1e2db87 100644
--- a/lld/test/ELF/protected-data-access.s
+++ b/lld/test/ELF/protected-data-access.s
@@ -1,4 +1,7 @@
# REQUIRES: x86
+
+## Disallow copy relocation if the symbol is defined as protected in a DSO.
+
# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %p/Inputs/protected-data-access.s -o %t2.o
# RUN: ld.lld %t2.o -o %t2.so -shared
# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t.o
@@ -6,11 +9,11 @@
# RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck --check-prefix=ERR %s
# ERR: error: cannot preempt symbol: foo
+## Allow that if --ignore-data-address-equality is specified.
+
# RUN: ld.lld --ignore-data-address-equality %t.o %t2.so -o %t
# RUN: llvm-readobj --dyn-symbols --relocations %t | FileCheck %s
-# Check that we have a copy relocation.
-
# CHECK: R_X86_64_COPY foo 0x0
# CHECK: Name: foo
diff --git a/lld/test/ELF/protected-function-access.s b/lld/test/ELF/protected-function-access.s
index 2fa682b412f..60db1656f23 100644
--- a/lld/test/ELF/protected-function-access.s
+++ b/lld/test/ELF/protected-function-access.s
@@ -1,9 +1,14 @@
# REQUIRES: x86
-# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %p/Inputs/protected-function-access.s -o %t2.o
-# RUN: ld.lld %t2.o -o %t2.so -shared
+
+## Don't create a canonical PLT if the symbol is defined as protected in a DSO,
+## because thay may break pointer equality.
+
+# RUN: echo '.globl foo; .protected foo; .type foo,@function; foo:' | \
+# RUN: llvm-mc -filetype=obj -triple=x86_64 - -o %t2.o
+# RUN: ld.lld %t2.o -o %t2.so -shared -soname=so
# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t.o
-# RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck --check-prefix=ERR %s
+# RUN: not ld.lld %t.o %t2.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
# ERR: error: cannot preempt symbol: foo
# RUN: ld.lld --ignore-function-address-equality %t.o %t2.so -o %t
@@ -14,7 +19,7 @@
# CHECK: R_X86_64_JUMP_SLOT foo 0x0
# CHECK: Name: foo
-# CHECK-NEXT: Value: 0x201020
+# CHECK-NEXT: Value: 0x20{{.*}}
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: Function
diff --git a/lld/test/ELF/relro-tls.s b/lld/test/ELF/relro-tls.s
index 42f982e320d..9c391e6aa11 100644
--- a/lld/test/ELF/relro-tls.s
+++ b/lld/test/ELF/relro-tls.s
@@ -9,6 +9,7 @@
## Currently p_memsz of PT_GNU_RELRO is rounded up to protect the last page.
# CHECK: Type: PT_GNU_RELRO
+# CHECK: VirtualAddress: 0x201000
# CHECK: FileSize: 4
# CHECK-NEXT: MemSize: 4096
# CHECK: Alignment: 1
diff --git a/lld/test/ELF/startstop-gccollect.s b/lld/test/ELF/startstop-gccollect.s
index 8fdd01c0908..a53ac81ec4d 100644
--- a/lld/test/ELF/startstop-gccollect.s
+++ b/lld/test/ELF/startstop-gccollect.s
@@ -18,18 +18,18 @@
# RUN: llvm-objdump -d %tout | FileCheck -check-prefix=DISASM %s
# DISASM: _start:
-# DISASM-NEXT: 201000: e8 05 00 00 00 callq 5 <__start_foo>
-# DISASM-NEXT: 201005: e8 02 00 00 00 callq 2 <__stop_bar>
+# DISASM-NEXT: callq {{.*}} <__start_foo>
+# DISASM-NEXT: callq {{.*}} <__stop_bar>
# DISASM-EMPTY:
# DISASM-NEXT: Disassembly of section foo:
# DISASM-EMPTY:
# DISASM-NEXT: __start_foo:
-# DISASM-NEXT: 20100a: 90 nop
+# DISASM-NEXT: nop
# DISASM-EMPTY:
# DISASM-NEXT: Disassembly of section bar:
# DISASM-EMPTY:
# DISASM-NEXT: bar:
-# DISASM-NEXT: 20100b: 90 nop
+# DISASM-NEXT: nop
.global _start
.text
diff --git a/lld/test/ELF/startstop-shared2.s b/lld/test/ELF/startstop-shared2.s
index b8bd8abe90d..4b887bea56a 100644
--- a/lld/test/ELF/startstop-shared2.s
+++ b/lld/test/ELF/startstop-shared2.s
@@ -1,7 +1,10 @@
// REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/startstop-shared2.s -o %t.o
-// RUN: ld.lld -o %t.so %t.o -shared
-// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2.o
+
+/// Synthesize __start_* and __stop_* even if there exists a definition in a DSO.
+
+// RUN: echo '.globl __start_foo; __start_foo:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t.o
+// RUN: ld.lld -o %t.so -soname=so %t.o -shared
+// RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t2.o
// RUN: ld.lld -o %t %t2.o %t.so
// RUN: llvm-objdump -s -h %t | FileCheck %s
diff --git a/lld/test/ELF/symbol-ordering-file.s b/lld/test/ELF/symbol-ordering-file.s
index 34d67701933..73d45a794d3 100644
--- a/lld/test/ELF/symbol-ordering-file.s
+++ b/lld/test/ELF/symbol-ordering-file.s
@@ -4,9 +4,9 @@
# RUN: llvm-objdump -s %t.out| FileCheck %s --check-prefix=BEFORE
# BEFORE: Contents of section .foo:
-# BEFORE-NEXT: 201000 11223344 5566
+# BEFORE-NEXT: 11223344 5566
# BEFORE: Contents of section .init:
-# BEFORE-NEXT: 201006 1122
+# BEFORE-NEXT: 1122
# RUN: echo "_foo4 " > %t_order.txt
# RUN: echo " _foo3" >> %t_order.txt
@@ -25,9 +25,9 @@
# RUN: llvm-objdump -s %t2.out| FileCheck %s --check-prefix=AFTER
# AFTER: Contents of section .foo:
-# AFTER-NEXT: 201000 44335566 2211
+# AFTER-NEXT: 44335566 2211
# AFTER: Contents of section .init:
-# AFTER-NEXT: 201006 1122
+# AFTER-NEXT: 1122
.section .foo,"ax",@progbits,unique,1
_foo1:
diff --git a/lld/test/ELF/tls-opt.s b/lld/test/ELF/tls-opt.s
index 856e82c4b32..36810163411 100644
--- a/lld/test/ELF/tls-opt.s
+++ b/lld/test/ELF/tls-opt.s
@@ -2,42 +2,42 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %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: ]
// DISASM: _start:
-// DISASM-NEXT: 201000: 48 c7 c0 f8 ff ff ff movq $-8, %rax
-// DISASM-NEXT: 201007: 49 c7 c7 f8 ff ff ff movq $-8, %r15
-// DISASM-NEXT: 20100e: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax
-// DISASM-NEXT: 201015: 4d 8d bf f8 ff ff ff leaq -8(%r15), %r15
-// DISASM-NEXT: 20101c: 48 81 c4 f8 ff ff ff addq $-8, %rsp
-// DISASM-NEXT: 201023: 49 81 c4 f8 ff ff ff addq $-8, %r12
-// DISASM-NEXT: 20102a: 48 c7 c0 fc ff ff ff movq $-4, %rax
-// DISASM-NEXT: 201031: 49 c7 c7 fc ff ff ff movq $-4, %r15
-// DISASM-NEXT: 201038: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax
-// DISASM-NEXT: 20103f: 4d 8d bf fc ff ff ff leaq -4(%r15), %r15
-// DISASM-NEXT: 201046: 48 81 c4 fc ff ff ff addq $-4, %rsp
-// DISASM-NEXT: 20104d: 49 81 c4 fc ff ff ff addq $-4, %r12
+// DISASM-NEXT: 201000: movq $-8, %rax
+// DISASM-NEXT: 201007: movq $-8, %r15
+// DISASM-NEXT: 20100e: leaq -8(%rax), %rax
+// DISASM-NEXT: 201015: leaq -8(%r15), %r15
+// DISASM-NEXT: 20101c: addq $-8, %rsp
+// DISASM-NEXT: 201023: addq $-8, %r12
+// DISASM-NEXT: 20102a: movq $-4, %rax
+// DISASM-NEXT: 201031: movq $-4, %r15
+// DISASM-NEXT: 201038: leaq -4(%rax), %rax
+// DISASM-NEXT: 20103f: leaq -4(%r15), %r15
+// DISASM-NEXT: 201046: addq $-4, %rsp
+// DISASM-NEXT: 20104d: addq $-4, %r12
// LD to LE:
-// DISASM-NEXT: 201054: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax
-// DISASM-NEXT: 201060: 48 8d 88 f8 ff ff ff leaq -8(%rax), %rcx
-// DISASM-NEXT: 201067: 66 66 66 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax
-// DISASM-NEXT: 201073: 48 8d 88 fc ff ff ff leaq -4(%rax), %rcx
+// DISASM-NEXT: 201054: movq %fs:0, %rax
+// DISASM-NEXT: 201060: leaq -8(%rax), %rcx
+// DISASM-NEXT: 201067: movq %fs:0, %rax
+// DISASM-NEXT: 201073: leaq -4(%rax), %rcx
// GD to LE:
-// DISASM-NEXT: 20107a: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax
-// DISASM-NEXT: 201083: 48 8d 80 f8 ff ff ff leaq -8(%rax), %rax
-// DISASM-NEXT: 20108a: 64 48 8b 04 25 00 00 00 00 movq %fs:0, %rax
-// DISASM-NEXT: 201093: 48 8d 80 fc ff ff ff leaq -4(%rax), %rax
+// DISASM-NEXT: 20107a: movq %fs:0, %rax
+// DISASM-NEXT: 201083: leaq -8(%rax), %rax
+// DISASM-NEXT: 20108a: movq %fs:0, %rax
+// DISASM-NEXT: 201093: leaq -4(%rax), %rax
// LD to LE:
// DISASM: _DTPOFF64_1:
-// DISASM-NEXT: 20109a: f8 clc
+// DISASM-NEXT: 20109a: clc
// DISASM: _DTPOFF64_2:
-// DISASM-NEXT: 2010a3: fc cld
+// DISASM-NEXT: 2010a3: cld
.type tls0,@object
.section .tbss,"awT",@nobits
diff --git a/lld/test/ELF/typed-undef.s b/lld/test/ELF/typed-undef.s
deleted file mode 100644
index 879a80975bc..00000000000
--- a/lld/test/ELF/typed-undef.s
+++ /dev/null
@@ -1,11 +0,0 @@
-# REQUIRES: x86
-
-# We used to crash on this, check that we don't
-
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-# RUN: ld.lld %t.o -o /dev/null -pie --unresolved-symbols=ignore-all
-
- .global _start
-_start:
- .quad foo - .
- .type foo, @object
diff --git a/lld/test/ELF/local-ver-preemptible.s b/lld/test/ELF/version-script-local-preemptible.s
index 80d78c4a8d8..ffb16648dc8 100644
--- a/lld/test/ELF/local-ver-preemptible.s
+++ b/lld/test/ELF/version-script-local-preemptible.s
@@ -1,4 +1,8 @@
# REQUIRES: x86
+
+## Version scripts are handled before relocation processing, so
+## { local: *; } does not make a canonical PLT VER_NDX_LOCAL.
+
# RUN: echo '.global foo; .type foo, @function; foo:' | \
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t.so.o
# RUN: ld.lld %t.so.o -o %t.so -shared
@@ -10,12 +14,12 @@
# RUN: llvm-readelf -r --symbols %t | FileCheck %s
# CHECK: Relocation section '.rela.plt' at offset {{.*}} contains 1 entries:
-# CHECK: R_X86_64_JUMP_SLOT 0000000000201020 foo + 0
+# CHECK: R_X86_64_JUMP_SLOT [[ADDR:[0-9a-f]+]] foo + 0
# CHECK: Symbol table '.dynsym' contains 2 entries:
# CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
# CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
-# CHECK-NEXT: 1: 0000000000201020 0 FUNC GLOBAL DEFAULT UND foo
+# CHECK-NEXT: 1: [[ADDR]] 0 FUNC GLOBAL DEFAULT UND foo
.globl _start
_start:
diff --git a/lld/test/ELF/pie-weak.s b/lld/test/ELF/weak-undef-got-pie.s
index 0bfea1f402a..a93b7e44aae 100644
--- a/lld/test/ELF/pie-weak.s
+++ b/lld/test/ELF/weak-undef-got-pie.s
@@ -1,10 +1,11 @@
# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/dummy-shared.s -o %t1.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/dummy-shared.s -o %t1.o
# RUN: ld.lld %t1.o -shared -o %t1.so
-# RUN: llvm-mc -filetype=obj -relax-relocations=false -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: ld.lld --hash-style=sysv -pie %t.o %t1.so -o %t
+# RUN: llvm-mc -filetype=obj -relax-relocations=false -triple=x86_64 %s -o %t.o
+
+# RUN: ld.lld -pie %t.o %t1.so -o %t
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOCS %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
# RELOCS: Relocations [
# RELOCS-NEXT: Section ({{.*}}) .rela.dyn {
@@ -17,6 +18,5 @@
.globl _start
_start:
# DISASM: _start:
-# DISASM-NEXT: 1000: 48 8b 05 a9 10 00 00 movq 4265(%rip), %rax
-# ^ .got - (.text + 7)
+# DISASM-NEXT: movq {{.*}}(%rip), %rax
mov foo@gotpcrel(%rip), %rax
diff --git a/lld/test/ELF/wrap-entry.s b/lld/test/ELF/wrap-entry.s
index 8594bbd6aa0..8102bea7551 100644
--- a/lld/test/ELF/wrap-entry.s
+++ b/lld/test/ELF/wrap-entry.s
@@ -2,9 +2,13 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
// RUN: ld.lld -o %t.exe %t.o -wrap=_start
-// RUN: llvm-readobj --file-headers %t.exe | FileCheck %s
+// RUN: llvm-readobj --symbols -h %t.exe | FileCheck %s
-// CHECK: Entry: 0x201001
+/// Note, ld.bfd uses _start as the _entry.
+
+// CHECK: Entry: [[ADDR:[0-9A-F]+]]
+// CHECK: Name: __wrap__start
+// CHECK-NEXT: Value: [[ADDR]]
.global _start, __wrap__start
_start:
diff --git a/lld/test/ELF/wrap-no-real.s b/lld/test/ELF/wrap-no-real.s
index 2dba291ac9d..a0ca2507f16 100644
--- a/lld/test/ELF/wrap-no-real.s
+++ b/lld/test/ELF/wrap-no-real.s
@@ -18,10 +18,10 @@
// RUN: llvm-objdump -t %t | FileCheck -check-prefix=SYM %s
-// SYM: 0000000000202000 .dynamic 00000000 .hidden _DYNAMIC
+// SYM: {{.*}} .dynamic 00000000 .hidden _DYNAMIC
// SYM-NEXT: 0000000000011000 *ABS* 00000000 __real_foo
// SYM-NEXT: 0000000000011010 *ABS* 00000000 __wrap_foo
-// SYM-NEXT: 0000000000201000 .text 00000000 _start
+// SYM-NEXT: {{.*}} .text 00000000 _start
// SYM-NEXT: 0000000000011000 *ABS* 00000000 foo
.global _start
diff --git a/lld/test/ELF/wrap-plt.s b/lld/test/ELF/wrap-plt.s
index 997200ead06..f888db821be 100644
--- a/lld/test/ELF/wrap-plt.s
+++ b/lld/test/ELF/wrap-plt.s
@@ -1,34 +1,24 @@
// REQUIRES: x86
+
+/// Test we correctly wrap PLT calls.
+
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
// RUN: ld.lld -o %t2 %t -wrap foo -shared
// RUN: llvm-readobj -S -r %t2 | FileCheck %s
// RUN: llvm-objdump -d %t2 | FileCheck --check-prefix=DISASM %s
-// CHECK: Name: .plt
-// CHECK-NEXT: Type: SHT_PROGBITS
-// CHECK-NEXT: Flags [
-// CHECK-NEXT: SHF_ALLOC
-// CHECK-NEXT: SHF_EXECINSTR
-// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x1020
-// CHECK-NEXT: Offset:
-// CHECK-NEXT: Size: 48
-// CHECK-NEXT: Link: 0
-// CHECK-NEXT: Info: 0
-// CHECK-NEXT: AddressAlignment: 16
-
// CHECK: Relocations [
// CHECK-NEXT: Section ({{.*}}) .rela.plt {
-// CHECK-NEXT: 0x3018 R_X86_64_JUMP_SLOT __wrap_foo 0x0
-// CHECK-NEXT: 0x3020 R_X86_64_JUMP_SLOT _start 0x0
+// CHECK-NEXT: R_X86_64_JUMP_SLOT __wrap_foo 0x0
+// CHECK-NEXT: R_X86_64_JUMP_SLOT _start 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
// DISASM: _start:
-// DISASM-NEXT: jmp 41
-// DISASM-NEXT: jmp 36
-// DISASM-NEXT: jmp 47
+// DISASM-NEXT: jmp {{.*}} <__wrap_foo@plt>
+// DISASM-NEXT: jmp {{.*}} <__wrap_foo@plt>
+// DISASM-NEXT: jmp {{.*}} <_start@plt>
.global foo
foo:
diff --git a/lld/test/ELF/plt.s b/lld/test/ELF/x86-64-plt.s
index 15e82fa6638..15e82fa6638 100644
--- a/lld/test/ELF/plt.s
+++ b/lld/test/ELF/x86-64-plt.s
diff --git a/lld/test/ELF/x86-64-reloc-size-shared.s b/lld/test/ELF/x86-64-reloc-size-shared.s
index 13f52bc722e..de2e0da9a8b 100644
--- a/lld/test/ELF/x86-64-reloc-size-shared.s
+++ b/lld/test/ELF/x86-64-reloc-size-shared.s
@@ -1,43 +1,37 @@
// 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/relocation-size-shared.s -o %tso.o
-// RUN: ld.lld -shared %tso.o -o %tso
-// RUN: ld.lld %t.o %tso -o %t1
-// RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=RELOCSHARED %s
-// RUN: llvm-objdump -d %t1 | FileCheck --check-prefix=DISASM %s
+// RUN: ld.lld -shared %tso.o -soname=so -o %t1.so
+// RUN: ld.lld %t.o %t1.so -o %t
+// RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOCSHARED %s
+// RUN: llvm-readelf -x .data %t | FileCheck --check-prefix=DATA %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASM %s
// RELOCSHARED: Relocations [
// RELOCSHARED-NEXT: Section ({{.*}}) .rela.dyn {
-// RELOCSHARED-NEXT: 0x201018 R_X86_64_SIZE64 fooshared 0xFFFFFFFFFFFFFFFF
-// RELOCSHARED-NEXT: 0x201020 R_X86_64_SIZE64 fooshared 0x0
-// RELOCSHARED-NEXT: 0x201028 R_X86_64_SIZE64 fooshared 0x1
-// RELOCSHARED-NEXT: 0x201048 R_X86_64_SIZE32 fooshared 0xFFFFFFFFFFFFFFFF
-// RELOCSHARED-NEXT: 0x20104F R_X86_64_SIZE32 fooshared 0x0
-// RELOCSHARED-NEXT: 0x201056 R_X86_64_SIZE32 fooshared 0x1
+// RELOCSHARED-NEXT: R_X86_64_SIZE32 fooshared 0xFFFFFFFFFFFFFFFF
+// RELOCSHARED-NEXT: R_X86_64_SIZE32 fooshared 0x0
+// RELOCSHARED-NEXT: R_X86_64_SIZE32 fooshared 0x1
+// RELOCSHARED-NEXT: R_X86_64_SIZE64 fooshared 0xFFFFFFFFFFFFFFFF
+// RELOCSHARED-NEXT: R_X86_64_SIZE64 fooshared 0x0
+// RELOCSHARED-NEXT: R_X86_64_SIZE64 fooshared 0x1
// RELOCSHARED-NEXT: }
// RELOCSHARED-NEXT:]
-// DISASM: Disassembly of section test
-// DISASM-EMPTY:
-// DISASM: _data:
-// DISASM-NEXT: 201000: 19 00
-// DISASM-NEXT: 201002: 00 00
-// DISASM-NEXT: 201004: 00 00
-// DISASM-NEXT: 201006: 00 00
-// DISASM-NEXT: 201008: 1a 00
-// DISASM-NEXT: 20100a: 00 00
-// DISASM-NEXT: 20100c: 00 00
-// DISASM-NEXT: 20100e: 00 00
-// DISASM-NEXT: 201010: 1b 00
-// DISASM-NEXT: ...
-// DISASM-NEXT: 20102e: 00 00
+// DATA: section '.data':
+// DATA-NEXT: 00000000 00000000 00000000 00000000
+// DATA-NEXT: 00000000 00000000 00001900 00000000
+// DATA-NEXT: 00001a00 00000000 00001b00 00000000
+// DATA-NEXT: 00000000 00000000 00000000 00000000
+// DATA-NEXT: 00000000 00000000 0000
+
// DISASM: _start:
-// DISASM-NEXT: 201030: 8b 04 25 19 00 00 00 movl 25, %eax
-// DISASM-NEXT: 201037: 8b 04 25 1a 00 00 00 movl 26, %eax
-// DISASM-NEXT: 20103e: 8b 04 25 1b 00 00 00 movl 27, %eax
-// DISASM-NEXT: 201045: 8b 04 25 00 00 00 00 movl 0, %eax
-// DISASM-NEXT: 20104c: 8b 04 25 00 00 00 00 movl 0, %eax
-// DISASM-NEXT: 201053: 8b 04 25 00 00 00 00 movl 0, %eax
+// DISASM-NEXT: movl 25, %eax
+// DISASM-NEXT: movl 26, %eax
+// DISASM-NEXT: movl 27, %eax
+// DISASM-NEXT: movl 0, %eax
+// DISASM-NEXT: movl 0, %eax
+// DISASM-NEXT: movl 0, %eax
.data
.global foo
@@ -46,8 +40,6 @@
foo:
.zero 26
-.section test, "awx"
-_data:
// R_X86_64_SIZE64:
.quad foo@SIZE-1
.quad foo@SIZE
@@ -56,6 +48,7 @@ _data:
.quad fooshared@SIZE
.quad fooshared@SIZE+1
+.section test, "awx"
.globl _start
_start:
// R_X86_64_SIZE32:
OpenPOWER on IntegriCloud