[lld] r371361 - [ELF][test] Improve and reorganize another set of tests

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 8 20:35:14 PDT 2019


Author: maskray
Date: Sun Sep  8 20:35:14 2019
New Revision: 371361

URL: http://llvm.org/viewvc/llvm-project?rev=371361&view=rev
Log:
[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;

Added:
    lld/trunk/test/ELF/Inputs/canonical-plt-pcrel.s
    lld/trunk/test/ELF/Inputs/copy-rel.s
    lld/trunk/test/ELF/aarch64-plt.s
      - copied, changed from r371316, lld/trunk/test/ELF/plt-aarch64.s
    lld/trunk/test/ELF/canonical-plt-pcrel.s
    lld/trunk/test/ELF/canonical-plt-symbolic.s
    lld/trunk/test/ELF/copy-rel.s
    lld/trunk/test/ELF/i386-plt.s
      - copied, changed from r371316, lld/trunk/test/ELF/plt-i686.s
    lld/trunk/test/ELF/version-script-local-preemptible.s
      - copied, changed from r371316, lld/trunk/test/ELF/local-ver-preemptible.s
    lld/trunk/test/ELF/weak-undef-got-pie.s
      - copied, changed from r371316, lld/trunk/test/ELF/pie-weak.s
    lld/trunk/test/ELF/x86-64-plt.s
      - copied, changed from r371316, lld/trunk/test/ELF/plt.s
Removed:
    lld/trunk/test/ELF/Inputs/copy-rel-pie.s
    lld/trunk/test/ELF/Inputs/gnu-ifunc-gotpcrel.s
    lld/trunk/test/ELF/Inputs/protected-function-access.s
    lld/trunk/test/ELF/Inputs/startstop-shared2.s
    lld/trunk/test/ELF/copy-rel-pie.s
    lld/trunk/test/ELF/copy-rel-pie2.s
    lld/trunk/test/ELF/emit-relocs-shared.s
    lld/trunk/test/ELF/gnu-ifunc-gotpcrel.s
    lld/trunk/test/ELF/local-ver-preemptible.s
    lld/trunk/test/ELF/merge-section-types.s
    lld/trunk/test/ELF/pie-weak.s
    lld/trunk/test/ELF/plt-aarch64.s
    lld/trunk/test/ELF/plt-i686.s
    lld/trunk/test/ELF/plt.s
    lld/trunk/test/ELF/typed-undef.s
Modified:
    lld/trunk/test/ELF/Inputs/gnu-ifunc-dso.s
    lld/trunk/test/ELF/compatible-section-types.s
    lld/trunk/test/ELF/dynsym-pie.s
    lld/trunk/test/ELF/executable-undefined-ignoreall.s
    lld/trunk/test/ELF/gc-sections-local-sym.s
    lld/trunk/test/ELF/global-offset-table-position.s
    lld/trunk/test/ELF/gnu-ifunc-dso.s
    lld/trunk/test/ELF/linkerscript/symbol-reserved.s
    lld/trunk/test/ELF/protected-data-access.s
    lld/trunk/test/ELF/protected-function-access.s
    lld/trunk/test/ELF/relro-tls.s
    lld/trunk/test/ELF/startstop-gccollect.s
    lld/trunk/test/ELF/startstop-shared2.s
    lld/trunk/test/ELF/symbol-ordering-file.s
    lld/trunk/test/ELF/tls-opt.s
    lld/trunk/test/ELF/wrap-entry.s
    lld/trunk/test/ELF/wrap-no-real.s
    lld/trunk/test/ELF/wrap-plt.s
    lld/trunk/test/ELF/x86-64-reloc-size-shared.s

Added: lld/trunk/test/ELF/Inputs/canonical-plt-pcrel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/canonical-plt-pcrel.s?rev=371361&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/canonical-plt-pcrel.s (added)
+++ lld/trunk/test/ELF/Inputs/canonical-plt-pcrel.s Sun Sep  8 20:35:14 2019
@@ -0,0 +1,5 @@
+.globl func, ifunc
+.type func, @function
+.type ifunc, @gnu_indirect_function
+func:
+ifunc:

Removed: lld/trunk/test/ELF/Inputs/copy-rel-pie.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/copy-rel-pie.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/copy-rel-pie.s (original)
+++ lld/trunk/test/ELF/Inputs/copy-rel-pie.s (removed)
@@ -1,12 +0,0 @@
-.data
-.global foo
-.type foo, @object
-.size foo, 4
-foo:
-.long 0
-
-.text
-.global bar
-.type bar, @function
-bar:
-retq

Added: lld/trunk/test/ELF/Inputs/copy-rel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/copy-rel.s?rev=371361&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/copy-rel.s (added)
+++ lld/trunk/test/ELF/Inputs/copy-rel.s Sun Sep  8 20:35:14 2019
@@ -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

Modified: lld/trunk/test/ELF/Inputs/gnu-ifunc-dso.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/gnu-ifunc-dso.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/Inputs/gnu-ifunc-dso.s (original)
+++ lld/trunk/test/ELF/Inputs/gnu-ifunc-dso.s Sun Sep  8 20:35:14 2019
@@ -1,3 +1,5 @@
 .type foo STT_GNU_IFUNC
-.globl foo
+.type bar STT_GNU_IFUNC
+.globl foo, bar
 foo:
+bar:

Removed: lld/trunk/test/ELF/Inputs/gnu-ifunc-gotpcrel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/gnu-ifunc-gotpcrel.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/gnu-ifunc-gotpcrel.s (original)
+++ lld/trunk/test/ELF/Inputs/gnu-ifunc-gotpcrel.s (removed)
@@ -1,4 +0,0 @@
-.type foo STT_GNU_IFUNC
-.globl foo
-foo:
-ret

Removed: lld/trunk/test/ELF/Inputs/protected-function-access.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/protected-function-access.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/protected-function-access.s (original)
+++ lld/trunk/test/ELF/Inputs/protected-function-access.s (removed)
@@ -1,5 +0,0 @@
-        .global foo
-        .protected foo
-        .type foo, @function
-foo:
-        ret

Removed: lld/trunk/test/ELF/Inputs/startstop-shared2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/startstop-shared2.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/startstop-shared2.s (original)
+++ lld/trunk/test/ELF/Inputs/startstop-shared2.s (removed)
@@ -1,2 +0,0 @@
-.globl __start_foo
-__start_foo:

Copied: lld/trunk/test/ELF/aarch64-plt.s (from r371316, lld/trunk/test/ELF/plt-aarch64.s)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-plt.s?p2=lld/trunk/test/ELF/aarch64-plt.s&p1=lld/trunk/test/ELF/plt-aarch64.s&r1=371316&r2=371361&rev=371361&view=diff
==============================================================================
    (empty)

Added: lld/trunk/test/ELF/canonical-plt-pcrel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/canonical-plt-pcrel.s?rev=371361&view=auto
==============================================================================
--- lld/trunk/test/ELF/canonical-plt-pcrel.s (added)
+++ lld/trunk/test/ELF/canonical-plt-pcrel.s Sun Sep  8 20:35:14 2019
@@ -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 at plt>
+# DISASM-NEXT:   callq {{.*}} <ifunc at plt>
+
+.globl _start
+_start:
+  .byte 0xe8
+  .long func - . -4    # STT_FUNC
+  .byte 0xe8
+  .long ifunc - . -4   # STT_GNU_IFUNC

Added: lld/trunk/test/ELF/canonical-plt-symbolic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/canonical-plt-symbolic.s?rev=371361&view=auto
==============================================================================
--- lld/trunk/test/ELF/canonical-plt-symbolic.s (added)
+++ lld/trunk/test/ELF/canonical-plt-symbolic.s Sun Sep  8 20:35:14 2019
@@ -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

Modified: lld/trunk/test/ELF/compatible-section-types.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/compatible-section-types.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/compatible-section-types.s (original)
+++ lld/trunk/test/ELF/compatible-section-types.s Sun Sep  8 20:35:14 2019
@@ -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

Removed: lld/trunk/test/ELF/copy-rel-pie.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/copy-rel-pie.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/copy-rel-pie.s (original)
+++ lld/trunk/test/ELF/copy-rel-pie.s (removed)
@@ -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 at plt>
-// DISASM-NEXT:   callq   {{.*}} <foo>

Removed: lld/trunk/test/ELF/copy-rel-pie2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/copy-rel-pie2.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/copy-rel-pie2.s (original)
+++ lld/trunk/test/ELF/copy-rel-pie2.s (removed)
@@ -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

Added: lld/trunk/test/ELF/copy-rel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/copy-rel.s?rev=371361&view=auto
==============================================================================
--- lld/trunk/test/ELF/copy-rel.s (added)
+++ lld/trunk/test/ELF/copy-rel.s Sun Sep  8 20:35:14 2019
@@ -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

Modified: lld/trunk/test/ELF/dynsym-pie.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynsym-pie.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/dynsym-pie.s (original)
+++ lld/trunk/test/ELF/dynsym-pie.s Sun Sep  8 20:35:14 2019
@@ -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

Removed: lld/trunk/test/ELF/emit-relocs-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/emit-relocs-shared.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/emit-relocs-shared.s (original)
+++ lld/trunk/test/ELF/emit-relocs-shared.s (removed)
@@ -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: ]

Modified: lld/trunk/test/ELF/executable-undefined-ignoreall.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/executable-undefined-ignoreall.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/executable-undefined-ignoreall.s (original)
+++ lld/trunk/test/ELF/executable-undefined-ignoreall.s Sun Sep  8 20:35:14 2019
@@ -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: ]
 

Modified: lld/trunk/test/ELF/gc-sections-local-sym.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gc-sections-local-sym.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/gc-sections-local-sym.s (original)
+++ lld/trunk/test/ELF/gc-sections-local-sym.s Sun Sep  8 20:35:14 2019
@@ -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

Modified: lld/trunk/test/ELF/global-offset-table-position.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/global-offset-table-position.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/global-offset-table-position.s (original)
+++ lld/trunk/test/ELF/global-offset-table-position.s Sun Sep  8 20:35:14 2019
@@ -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 at 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)

Modified: lld/trunk/test/ELF/gnu-ifunc-dso.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-ifunc-dso.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/gnu-ifunc-dso.s (original)
+++ lld/trunk/test/ELF/gnu-ifunc-dso.s Sun Sep  8 20:35:14 2019
@@ -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 at gotpcrel(%rip), %rax
+ .quad bar

Removed: lld/trunk/test/ELF/gnu-ifunc-gotpcrel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gnu-ifunc-gotpcrel.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/gnu-ifunc-gotpcrel.s (original)
+++ lld/trunk/test/ELF/gnu-ifunc-gotpcrel.s (removed)
@@ -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 at gotpcrel(%rip), %rax

Copied: lld/trunk/test/ELF/i386-plt.s (from r371316, lld/trunk/test/ELF/plt-i686.s)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/i386-plt.s?p2=lld/trunk/test/ELF/i386-plt.s&p1=lld/trunk/test/ELF/plt-i686.s&r1=371316&r2=371361&rev=371361&view=diff
==============================================================================
    (empty)

Modified: lld/trunk/test/ELF/linkerscript/symbol-reserved.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/symbol-reserved.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/symbol-reserved.s (original)
+++ lld/trunk/test/ELF/linkerscript/symbol-reserved.s Sun Sep  8 20:35:14 2019
@@ -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

Removed: lld/trunk/test/ELF/local-ver-preemptible.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/local-ver-preemptible.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/local-ver-preemptible.s (original)
+++ lld/trunk/test/ELF/local-ver-preemptible.s (removed)
@@ -1,22 +0,0 @@
-# REQUIRES: x86
-# 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
-
-# RUN: echo "{ global: main; local: *; };" > %t.script
-
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: ld.lld %t.o %t.so -o %t -version-script %t.script
-# 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:      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
-
-.globl _start
-_start:
-  movl $foo - ., %eax

Removed: lld/trunk/test/ELF/merge-section-types.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-section-types.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/merge-section-types.s (original)
+++ lld/trunk/test/ELF/merge-section-types.s (removed)
@@ -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

Removed: lld/trunk/test/ELF/pie-weak.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/pie-weak.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/pie-weak.s (original)
+++ lld/trunk/test/ELF/pie-weak.s (removed)
@@ -1,22 +0,0 @@
-# REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %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-readobj -r %t | FileCheck --check-prefix=RELOCS %s
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
-
-# RELOCS:      Relocations [
-# RELOCS-NEXT:   Section ({{.*}}) .rela.dyn {
-# RELOCS-NEXT:     R_X86_64_GLOB_DAT foo 0x0
-# RELOCS-NEXT:   }
-# RELOCS-NEXT: ]
-
-.weak foo
-
-.globl _start
-_start:
-# DISASM: _start:
-# DISASM-NEXT: 1000: 48 8b 05 a9 10 00 00 movq 4265(%rip), %rax
-#                                              ^ .got - (.text + 7)
-mov foo at gotpcrel(%rip), %rax

Removed: lld/trunk/test/ELF/plt-aarch64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/plt-aarch64.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/plt-aarch64.s (original)
+++ lld/trunk/test/ELF/plt-aarch64.s (removed)
@@ -1,199 +0,0 @@
-// REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-freebsd %s -o %t.o
-// RUN: llvm-mc -filetype=obj -triple=aarch64-pc-freebsd %p/Inputs/plt-aarch64.s -o %t2.o
-// RUN: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
-// RUN: ld.lld -shared %t.o %t2.so -o %t.so
-// RUN: ld.lld %t.o %t2.so -o %t.exe
-// RUN: llvm-readobj -S -r %t.so | FileCheck --check-prefix=CHECKDSO %s
-// RUN: llvm-objdump -s -section=.got.plt %t.so | FileCheck --check-prefix=DUMPDSO %s
-// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.so | FileCheck --check-prefix=DISASMDSO %s
-// RUN: llvm-readobj -S -r %t.exe | FileCheck --check-prefix=CHECKEXE %s
-// RUN: llvm-objdump -s -section=.got.plt %t.exe | FileCheck --check-prefix=DUMPEXE %s
-// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.exe | FileCheck --check-prefix=DISASMEXE %s
-
-// CHECKDSO:     Name: .plt
-// CHECKDSO-NEXT:     Type: SHT_PROGBITS
-// CHECKDSO-NEXT:     Flags [
-// CHECKDSO-NEXT:       SHF_ALLOC
-// CHECKDSO-NEXT:       SHF_EXECINSTR
-// CHECKDSO-NEXT:     ]
-// CHECKDSO-NEXT:     Address: 0x10340
-// CHECKDSO-NEXT:     Offset:
-// CHECKDSO-NEXT:     Size: 80
-// CHECKDSO-NEXT:     Link:
-// CHECKDSO-NEXT:     Info:
-// CHECKDSO-NEXT:     AddressAlignment: 16
-
-// CHECKDSO:     Name: .got.plt
-// CHECKDSO-NEXT:     Type: SHT_PROGBITS
-// CHECKDSO-NEXT:     Flags [
-// CHECKDSO-NEXT:       SHF_ALLOC
-// CHECKDSO-NEXT:       SHF_WRITE
-// CHECKDSO-NEXT:     ]
-// CHECKDSO-NEXT:     Address: 0x30450
-// CHECKDSO-NEXT:     Offset:
-// CHECKDSO-NEXT:     Size: 48
-// CHECKDSO-NEXT:     Link:
-// CHECKDSO-NEXT:     Info:
-// CHECKDSO-NEXT:     AddressAlignment: 8
-
-// CHECKDSO: Relocations [
-// CHECKDSO-NEXT:   Section ({{.*}}) .rela.plt {
-
-// &(.got.plt[3]) = 0x30450 + 3 * 8 = 0x30468
-// CHECKDSO-NEXT:     0x30468 R_AARCH64_JUMP_SLOT foo
-
-// &(.got.plt[4]) = 0x30450 + 4 * 8 = 0x30470
-// CHECKDSO-NEXT:     0x30470 R_AARCH64_JUMP_SLOT bar
-
-// &(.got.plt[5]) = 0x30000 + 5 * 8 = 0x30470
-// CHECKDSO-NEXT:     0x30478 R_AARCH64_JUMP_SLOT weak
-// CHECKDSO-NEXT:   }
-// CHECKDSO-NEXT: ]
-
-// DUMPDSO: Contents of section .got.plt:
-// .got.plt[0..2] = 0 (reserved)
-// .got.plt[3..5] = .plt = 0x10010
-// DUMPDSO-NEXT: 30450 00000000 00000000 00000000 00000000
-// DUMPDSO-NEXT: 30460 00000000 00000000 40030100 00000000
-// DUMPDSO-NEXT: 30470 40030100 00000000 40030100 00000000
-
-// DISASMDSO: _start:
-// DISASMDSO-NEXT:     10330: b       #0x30 <foo at plt>
-// DISASMDSO-NEXT:     10334: b       #0x3c <bar at plt>
-// DISASMDSO-NEXT:     10338: b       #0x48 <weak at plt>
-
-// DISASMDSO: foo:
-// DISASMDSO-NEXT:     1033c: nop
-
-// DISASMDSO: Disassembly of section .plt:
-// DISASMDSO-EMPTY:
-// DISASMDSO-NEXT: .plt:
-// DISASMDSO-NEXT:     10340: stp     x16, x30, [sp, #-0x10]!
-// &(.got.plt[2]) = 0x30450 + 2 * 8 = 0x30460
-// DISASMDSO-NEXT:     10344: adrp    x16, #0x20000
-// DISASMDSO-NEXT:     10348: ldr     x17, [x16, #0x460]
-// DISASMDSO-NEXT:     1034c: add     x16, x16, #0x460
-// DISASMDSO-NEXT:     10350: br      x17
-// DISASMDSO-NEXT:     10354: nop
-// DISASMDSO-NEXT:     10358: nop
-// DISASMDSO-NEXT:     1035c: nop
-
-// foo at plt 0x30468
-// &.got.plt[foo] = 0x30468
-// DISASMDSO-EMPTY:
-// DISASMDSO-NEXT:   foo at plt:
-// DISASMDSO-NEXT:     10360: adrp    x16, #0x20000
-// DISASMDSO-NEXT:     10364: ldr     x17, [x16, #0x468]
-// DISASMDSO-NEXT:     10368: add     x16, x16, #0x468
-// DISASMDSO-NEXT:     1036c: br      x17
-
-// bar at plt
-// &.got.plt[foo] = 0x30470
-// DISASMDSO-EMPTY:
-// DISASMDSO-NEXT:   bar at plt:
-// DISASMDSO-NEXT:     10370: adrp    x16, #0x20000
-// DISASMDSO-NEXT:     10374: ldr     x17, [x16, #0x470]
-// DISASMDSO-NEXT:     10378: add     x16, x16, #0x470
-// DISASMDSO-NEXT:     1037c: br      x17
-
-// weak at plt
-// 0x30468 = 0x10000 + 131072 + 1128
-// DISASMDSO-EMPTY:
-// DISASMDSO-NEXT:   weak at plt:
-// DISASMDSO-NEXT:     10380: adrp    x16, #0x20000
-// DISASMDSO-NEXT:     10384: ldr     x17, [x16, #0x478]
-// DISASMDSO-NEXT:     10388: add     x16, x16, #0x478
-// DISASMDSO-NEXT:     1038c: br      x17
-
-// CHECKEXE:     Name: .plt
-// CHECKEXE-NEXT:     Type: SHT_PROGBITS
-// CHECKEXE-NEXT:     Flags [
-// CHECKEXE-NEXT:       SHF_ALLOC
-// CHECKEXE-NEXT:       SHF_EXECINSTR
-// CHECKEXE-NEXT:     ]
-// CHECKEXE-NEXT:     Address: 0x2102E0
-// CHECKEXE-NEXT:     Offset:
-// CHECKEXE-NEXT:     Size: 64
-// CHECKEXE-NEXT:     Link:
-// CHECKEXE-NEXT:     Info:
-// CHECKEXE-NEXT:     AddressAlignment: 16
-
-// CHECKEXE:     Name: .got.plt
-// CHECKEXE-NEXT:     Type: SHT_PROGBITS
-// CHECKEXE-NEXT:     Flags [
-// CHECKEXE-NEXT:       SHF_ALLOC
-// CHECKEXE-NEXT:       SHF_WRITE
-// CHECKEXE-NEXT:     ]
-// CHECKEXE-NEXT:     Address: 0x2303F0
-// CHECKEXE-NEXT:     Offset:
-// CHECKEXE-NEXT:     Size: 40
-// CHECKEXE-NEXT:     Link:
-// CHECKEXE-NEXT:     Info:
-// CHECKEXE-NEXT:     AddressAlignment: 8
-
-// CHECKEXE: Relocations [
-// CHECKEXE-NEXT:   Section ({{.*}}) .rela.plt {
-
-// &(.got.plt[3]) = 0x2303f0 + 3 * 8 = 0x230408
-// CHECKEXE-NEXT:     0x230408 R_AARCH64_JUMP_SLOT bar 0x0
-
-// &(.got.plt[4]) = 0x2303f0 + 4 * 8 = 0x230410
-// CHECKEXE-NEXT:     0x230410 R_AARCH64_JUMP_SLOT weak 0x0
-// CHECKEXE-NEXT:   }
-// CHECKEXE-NEXT: ]
-
-// DUMPEXE: Contents of section .got.plt:
-// .got.plt[0..2] = 0 (reserved)
-// .got.plt[3..4] = .plt = 0x40010
-// DUMPEXE-NEXT:  2303f0 00000000 00000000 00000000 00000000
-// DUMPEXE-NEXT:  230400 00000000 00000000 e0022100 00000000
-// DUMPEXE-NEXT:  230410 e0022100 00000000
-
-// DISASMEXE: _start:
-// DISASMEXE-NEXT:    2102c8: b #0xc <foo>
-// DISASMEXE-NEXT:    2102cc: b #0x34 <bar at plt>
-// DISASMEXE-NEXT:    2102d0: b #0x40 <weak at plt>
-
-// DISASMEXE: foo:
-// DISASMEXE-NEXT:    2102d4: nop
-
-// DISASMEXE: Disassembly of section .plt:
-// DISASMEXE-EMPTY:
-// DISASMEXE-NEXT: .plt:
-// DISASMEXE-NEXT:    2102e0: stp     x16, x30, [sp, #-0x10]!
-// &(.got.plt[2]) = 0x2303f0 + 2 * 8 = 0x230400
-// DISASMEXE-NEXT:    2102e4: adrp    x16, #0x20000
-// DISASMEXE-NEXT:    2102e8: ldr     x17, [x16, #0x400]
-// DISASMEXE-NEXT:    2102ec: add     x16, x16, #0x400
-// DISASMEXE-NEXT:    2102f0: br      x17
-// DISASMEXE-NEXT:    2102f4: nop
-// DISASMEXE-NEXT:    2102f8: nop
-// DISASMEXE-NEXT:    2102fc: nop
-
-// bar at plt
-// DISASMEXE-EMPTY:
-// DISASMEXE-NEXT:   bar at plt:
-// DISASMEXE-NEXT:    210300: adrp    x16, #0x20000
-// DISASMEXE-NEXT:    210304: ldr     x17, [x16, #0x408]
-// DISASMEXE-NEXT:    210308: add     x16, x16, #0x408
-// DISASMEXE-NEXT:    21030c: br      x17
-
-// weak at plt
-// DISASMEXE-EMPTY:
-// DISASMEXE-NEXT:   weak at plt:
-// DISASMEXE-NEXT:    210310: adrp    x16, #0x20000
-// DISASMEXE-NEXT:    210314: ldr     x17, [x16, #0x410]
-// DISASMEXE-NEXT:    210318: add     x16, x16, #0x410
-// DISASMEXE-NEXT:    21031c: br      x17
-
-.global _start,foo,bar
-.weak weak
-_start:
-  b foo
-  b bar
-  b weak
-
-.section .text2,"ax", at progbits
-foo:
-  nop

Removed: lld/trunk/test/ELF/plt-i686.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/plt-i686.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/plt-i686.s (original)
+++ lld/trunk/test/ELF/plt-i686.s (removed)
@@ -1,176 +0,0 @@
-// REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o
-// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared.s -o %t2.o
-// RUN: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
-// RUN: ld.lld %t.o %t2.so -o %t
-// RUN: llvm-readobj -S -r %t | FileCheck %s
-// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t | FileCheck --check-prefix=DISASM %s
-// RUN: ld.lld -shared %t.o %t2.so -o %t
-// RUN: llvm-readobj -S -r %t | FileCheck --check-prefix=CHECKSHARED %s
-// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASMSHARED %s
-// RUN: ld.lld -pie %t.o %t2.so -o %t
-// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASMPIE %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: 0x4011E0
-// CHECK-NEXT: Offset:
-// CHECK-NEXT: Size: 48
-// CHECK-NEXT: Link: 0
-// CHECK-NEXT: Info: 0
-// CHECK-NEXT: AddressAlignment: 16
-
-// CHECK:      Name: .got.plt
-// CHECK-NEXT: Type: SHT_PROGBITS
-// CHECK-NEXT: Flags [
-// CHECK-NEXT:   SHF_ALLOC
-// CHECK-NEXT:   SHF_WRITE
-// CHECK-NEXT: ]
-// CHECK-NEXT: Address: 0x403278
-// CHECK-NEXT: Offset: 0x278
-// CHECK-NEXT: Size: 20
-// CHECK-NEXT: Link: 0
-// CHECK-NEXT: Info: 0
-// CHECK-NEXT: AddressAlignment: 4
-// CHECK-NEXT: EntrySize: 0
-
-// First 3 slots of .got.plt are reserved.
-// &.got.plt[3] = 0x403278 + 12 = 0x403284
-// &.got.plt[4] = 0x403278 + 16 = 0x403288
-// CHECK:      Relocations [
-// CHECK-NEXT:   Section ({{.*}}) .rel.plt {
-// CHECK-NEXT:     0x403284 R_386_JUMP_SLOT bar 0x0
-// CHECK-NEXT:     0x403288 R_386_JUMP_SLOT zed 0x0
-// CHECK-NEXT:   }
-// CHECK-NEXT: ]
-
-// DISASM:       local:
-// DISASM-NEXT:  4011bc:
-// DISASM-NEXT:  4011be:
-// DISASM:       _start:
-// DISASM-NEXT: 4011c0:       jmp 0x2b <bar at plt>
-// DISASM-NEXT: 4011c5:       jmp 0x26 <bar at plt>
-// DISASM-NEXT: 4011ca:       jmp 0x31 <zed at plt>
-// DISASM-NEXT: 4011cf:       jmp -0x18 <local>
-
-// DISASM:      Disassembly of section .plt:
-// DISASM-EMPTY:
-// DISASM-NEXT: .plt:
-/// Push .got.plt[1], then jump to .got.plt[2]
-// DISASM-NEXT: 4011e0:       pushl 0x40327c
-// DISASM-NEXT:               jmpl *0x403280
-// DISASM-NEXT:               nop
-// DISASM-NEXT:               nop
-// DISASM-NEXT:               nop
-// DISASM-NEXT:               nop
-// DISASM-EMPTY:
-// DISASM-NEXT: bar at plt:
-/// .got.plt[3] = 0x403278 + 12 = 0x403284
-// DISASM-NEXT: 4011f0:       jmpl *0x403284
-// DISASM-NEXT:               pushl $0x0
-// DISASM-NEXT:               jmp -0x20 <.plt>
-// DISASM-EMPTY:
-// DISASM-NEXT: zed at plt:
-/// .got.plt[4] = 0x403278 + 16 = 0x403288
-// DISASM-NEXT: 401200:       jmpl *0x403288
-// DISASM-NEXT:               pushl $0x8
-// DISASM-NEXT:               jmp -0x30 <.plt>
-
-// CHECKSHARED:        Name: .plt
-// CHECKSHARED-NEXT:   Type: SHT_PROGBITS
-// CHECKSHARED-NEXT:   Flags [
-// CHECKSHARED-NEXT:     SHF_ALLOC
-// CHECKSHARED-NEXT:     SHF_EXECINSTR
-// CHECKSHARED-NEXT:   ]
-// CHECKSHARED-NEXT:   Address: 0x1200
-// CHECKSHARED-NEXT:   Offset: 0x200
-// CHECKSHARED-NEXT:   Size: 48
-// CHECKSHARED-NEXT:   Link: 0
-// CHECKSHARED-NEXT:   Info: 0
-// CHECKSHARED-NEXT:   AddressAlignment: 16
-// CHECKSHARED-NEXT:   EntrySize: 0
-// CHECKSHARED-NEXT:   }
-// CHECKSHARED:        Name: .got.plt
-// CHECKSHARED-NEXT:   Type: SHT_PROGBITS
-// CHECKSHARED-NEXT:   Flags [
-// CHECKSHARED-NEXT:     SHF_ALLOC
-// CHECKSHARED-NEXT:     SHF_WRITE
-// CHECKSHARED-NEXT:   ]
-// CHECKSHARED-NEXT:   Address: 0x3290
-// CHECKSHARED-NEXT:   Offset: 0x290
-// CHECKSHARED-NEXT:   Size: 20
-// CHECKSHARED-NEXT:   Link: 0
-// CHECKSHARED-NEXT:   Info: 0
-// CHECKSHARED-NEXT:   AddressAlignment: 4
-// CHECKSHARED-NEXT:   EntrySize: 0
-// CHECKSHARED-NEXT:   }
-
-// 0x3000 + got.plt.reserved(12) = 0x300C
-// 0x3000 + got.plt.reserved(12) + 4 = 0x3010
-// CHECKSHARED:        Relocations [
-// CHECKSHARED-NEXT:     Section ({{.*}}) .rel.plt {
-// CHECKSHARED-NEXT:       0x329C R_386_JUMP_SLOT bar 0x0
-// CHECKSHARED-NEXT:       0x32A0 R_386_JUMP_SLOT zed 0x0
-// CHECKSHARED-NEXT:     }
-// CHECKSHARED-NEXT:   ]
-
-// DISASMSHARED:      local:
-// DISASMSHARED-NEXT: 11e0:
-// DISASMSHARED-NEXT: 11e2:
-// DISASMSHARED:      _start:
-// DISASMSHARED-NEXT: 11e4:       jmp 39 <bar at plt>
-// DISASMSHARED-NEXT:             jmp 34 <bar at plt>
-// DISASMSHARED-NEXT:             jmp 45 <zed at plt>
-// DISASMSHARED-NEXT:             jmp -24 <local>
-// DISASMSHARED-EMPTY:
-// DISASMSHARED-NEXT: Disassembly of section .plt:
-// DISASMSHARED-EMPTY:
-// DISASMSHARED-NEXT: .plt:
-// DISASMSHARED-NEXT: 1200:       pushl 4(%ebx)
-// DISASMSHARED-NEXT:             jmpl *8(%ebx)
-// DISASMSHARED-NEXT:             nop
-// DISASMSHARED-NEXT:             nop
-// DISASMSHARED-NEXT:             nop
-// DISASMSHARED-NEXT:             nop
-// DISASMSHARED:      bar at plt:
-// DISASMSHARED-NEXT: 1210:       jmpl *12(%ebx)
-// DISASMSHARED-NEXT:             pushl $0
-// DISASMSHARED-NEXT:             jmp -32 <.plt>
-// DISASMSHARED:      zed at plt:
-// DISASMSHARED-NEXT: 1220:       jmpl *16(%ebx)
-// DISASMSHARED-NEXT:             pushl $8
-// DISASMSHARED-NEXT:             jmp -48 <.plt>
-
-// DISASMPIE:      Disassembly of section .plt:
-// DISASMPIE-EMPTY:
-// DISASMPIE-NEXT: .plt:
-// DISASMPIE-NEXT: 11e0:       pushl 4(%ebx)
-// DISASMPIE-NEXT:             jmpl *8(%ebx)
-// DISASMPIE-NEXT:             nop
-// DISASMPIE-NEXT:             nop
-// DISASMPIE-NEXT:             nop
-// DISASMPIE-NEXT:             nop
-// DISASMPIE-EMPTY:
-// DISASMPIE-NEXT: bar at plt:
-// DISASMPIE-NEXT: 11f0:       jmpl *12(%ebx)
-// DISASMPIE-NEXT:             pushl $0
-// DISASMPIE-NEXT:             jmp -32 <.plt>
-// DISASMPIE-EMPTY:
-// DISASMPIE-NEXT: zed at plt:
-// DISASMPIE-NEXT: 1200:       jmpl *16(%ebx)
-// DISASMPIE-NEXT:             pushl $8
-// DISASMPIE-NEXT:             jmp -48 <.plt>
-
-local:
-.long 0
-
-.global _start
-_start:
-  jmp bar at PLT
-  jmp bar at PLT
-  jmp zed at PLT
-  jmp local at plt

Removed: lld/trunk/test/ELF/plt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/plt.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/plt.s (original)
+++ lld/trunk/test/ELF/plt.s (removed)
@@ -1,130 +0,0 @@
-// 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 -shared %t.o %t2.so -o %t
-// RUN: ld.lld %t.o %t2.so -o %t3
-// RUN: llvm-readobj -S -r %t | FileCheck %s
-// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
-// RUN: llvm-readobj -S -r %t3 | FileCheck --check-prefix=CHECK2 %s
-// RUN: llvm-objdump -d %t3 | FileCheck --check-prefix=DISASM2 %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: 64
-// 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 bar 0x0
-// CHECK-NEXT:     0x3020 R_X86_64_JUMP_SLOT zed 0x0
-// CHECK-NEXT:     0x3028 R_X86_64_JUMP_SLOT _start 0x0
-// CHECK-NEXT:   }
-// CHECK-NEXT: ]
-
-// CHECK2:      Name: .plt
-// CHECK2-NEXT: Type: SHT_PROGBITS
-// CHECK2-NEXT: Flags [
-// CHECK2-NEXT:   SHF_ALLOC
-// CHECK2-NEXT:   SHF_EXECINSTR
-// CHECK2-NEXT: ]
-// CHECK2-NEXT: Address: 0x201020
-// CHECK2-NEXT: Offset:
-// CHECK2-NEXT: Size: 48
-// CHECK2-NEXT: Link: 0
-// CHECK2-NEXT: Info: 0
-// CHECK2-NEXT: AddressAlignment: 16
-
-// CHECK2:      Relocations [
-// CHECK2-NEXT:   Section ({{.*}}) .rela.plt {
-// CHECK2-NEXT:     0x203018 R_X86_64_JUMP_SLOT bar 0x0
-// CHECK2-NEXT:     0x203020 R_X86_64_JUMP_SLOT zed 0x0
-// CHECK2-NEXT:   }
-// CHECK2-NEXT: ]
-
-// Unfortunately FileCheck can't do math, so we have to check for explicit
-// values:
-
-// 0x1030 - (0x1000 + 5) = 43
-// 0x1030 - (0x1005 + 5) = 38
-// 0x1040 - (0x100a + 5) = 49
-// 0x1048 - (0x100a + 5) = 60
-
-// DISASM:      _start:
-// DISASM-NEXT:   1000:  e9 {{.*}}       jmp  43
-// DISASM-NEXT:   1005:  e9 {{.*}}       jmp  38
-// DISASM-NEXT:   100a:  e9 {{.*}}       jmp  49
-// DISASM-NEXT:   100f:  e9 {{.*}}       jmp  60
-
-// 0x3018 - 0x1036  = 8162
-// 0x3020 - 0x1046  = 8154
-// 0x3028 - 0x1056  = 8146
-
-// DISASM:      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-EMPTY:
-// DISASM-NEXT:   bar 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-EMPTY:
-// DISASM-NEXT:   zed 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-EMPTY:
-// DISASM-NEXT:   _start at plt:
-// DISASM-NEXT:   1050:  ff 25 d2 1f 00 00  jmpq *8146(%rip)
-// DISASM-NEXT:   1056:  68 02 00 00 00     pushq $2
-// DISASM-NEXT:   105b:  e9 c0 ff ff ff     jmp -64 <.plt>
-
-// 0x201030 - (0x201000 + 1) - 4 = 43
-// 0x201030 - (0x201005 + 1) - 4 = 38
-// 0x201040 - (0x20100a + 1) - 4 = 49
-// 0x201000 - (0x20100f + 1) - 4 = -20
-
-// DISASM2:      _start:
-// DISASM2-NEXT:   201000:  e9 {{.*}}     jmp  43
-// DISASM2-NEXT:   201005:  e9 {{.*}}     jmp  38
-// DISASM2-NEXT:   20100a:  e9 {{.*}}     jmp  49
-// DISASM2-NEXT:   20100f:  e9 {{.*}}     jmp  -20
-
-// 0x202018 - 0x201036  = 4066
-// 0x202020 - 0x201046  = 4058
-
-// DISASM2:      Disassembly of section .plt:
-// DISASM2-EMPTY:
-// DISASM2-NEXT: .plt:
-// DISASM2-NEXT:  201020:  ff 35 e2 1f 00 00   pushq 8162(%rip)
-// DISASM2-NEXT:  201026:  ff 25 e4 1f 00 00   jmpq *8164(%rip)
-// DISASM2-NEXT:  20102c:  0f 1f 40 00         nopl  (%rax)
-// DISASM2-EMPTY:
-// DISASM2-NEXT:   bar at plt:
-// DISASM2-NEXT:  201030:  ff 25 e2 1f 00 00   jmpq *8162(%rip)
-// DISASM2-NEXT:  201036:  68 00 00 00 00      pushq $0
-// DISASM2-NEXT:  20103b:  e9 e0 ff ff ff      jmp -32 <.plt>
-// DISASM2-EMPTY:
-// DISASM2-NEXT:   zed at plt:
-// DISASM2-NEXT:  201040:  ff 25 da 1f 00 00   jmpq *8154(%rip)
-// DISASM2-NEXT:  201046:  68 01 00 00 00      pushq $1
-// DISASM2-NEXT:  20104b:  e9 d0 ff ff ff      jmp -48 <.plt>
-// DISASM2-NOT:   2010C0
-
-.global _start
-_start:
-  jmp bar at PLT
-  jmp bar at PLT
-  jmp zed at PLT
-  jmp _start at plt

Modified: lld/trunk/test/ELF/protected-data-access.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/protected-data-access.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/protected-data-access.s (original)
+++ lld/trunk/test/ELF/protected-data-access.s Sun Sep  8 20:35:14 2019
@@ -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

Modified: lld/trunk/test/ELF/protected-function-access.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/protected-function-access.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/protected-function-access.s (original)
+++ lld/trunk/test/ELF/protected-function-access.s Sun Sep  8 20:35:14 2019
@@ -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, at 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

Modified: lld/trunk/test/ELF/relro-tls.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relro-tls.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/relro-tls.s (original)
+++ lld/trunk/test/ELF/relro-tls.s Sun Sep  8 20:35:14 2019
@@ -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

Modified: lld/trunk/test/ELF/startstop-gccollect.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/startstop-gccollect.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/startstop-gccollect.s (original)
+++ lld/trunk/test/ELF/startstop-gccollect.s Sun Sep  8 20:35:14 2019
@@ -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

Modified: lld/trunk/test/ELF/startstop-shared2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/startstop-shared2.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/startstop-shared2.s (original)
+++ lld/trunk/test/ELF/startstop-shared2.s Sun Sep  8 20:35:14 2019
@@ -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
 

Modified: lld/trunk/test/ELF/symbol-ordering-file.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/symbol-ordering-file.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/symbol-ordering-file.s (original)
+++ lld/trunk/test/ELF/symbol-ordering-file.s Sun Sep  8 20:35:14 2019
@@ -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", at progbits,unique,1
 _foo1:

Modified: lld/trunk/test/ELF/tls-opt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/tls-opt.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/tls-opt.s (original)
+++ lld/trunk/test/ELF/tls-opt.s Sun Sep  8 20:35:14 2019
@@ -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, at object
 .section .tbss,"awT", at nobits

Removed: lld/trunk/test/ELF/typed-undef.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/typed-undef.s?rev=371360&view=auto
==============================================================================
--- lld/trunk/test/ELF/typed-undef.s (original)
+++ lld/trunk/test/ELF/typed-undef.s (removed)
@@ -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

Copied: lld/trunk/test/ELF/version-script-local-preemptible.s (from r371316, lld/trunk/test/ELF/local-ver-preemptible.s)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/version-script-local-preemptible.s?p2=lld/trunk/test/ELF/version-script-local-preemptible.s&p1=lld/trunk/test/ELF/local-ver-preemptible.s&r1=371316&r2=371361&rev=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/local-ver-preemptible.s (original)
+++ lld/trunk/test/ELF/version-script-local-preemptible.s Sun Sep  8 20:35:14 2019
@@ -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:

Copied: lld/trunk/test/ELF/weak-undef-got-pie.s (from r371316, lld/trunk/test/ELF/pie-weak.s)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/weak-undef-got-pie.s?p2=lld/trunk/test/ELF/weak-undef-got-pie.s&p1=lld/trunk/test/ELF/pie-weak.s&r1=371316&r2=371361&rev=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/pie-weak.s (original)
+++ lld/trunk/test/ELF/weak-undef-got-pie.s Sun Sep  8 20:35:14 2019
@@ -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 at gotpcrel(%rip), %rax

Modified: lld/trunk/test/ELF/wrap-entry.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/wrap-entry.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/wrap-entry.s (original)
+++ lld/trunk/test/ELF/wrap-entry.s Sun Sep  8 20:35:14 2019
@@ -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:

Modified: lld/trunk/test/ELF/wrap-no-real.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/wrap-no-real.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/wrap-no-real.s (original)
+++ lld/trunk/test/ELF/wrap-no-real.s Sun Sep  8 20:35:14 2019
@@ -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

Modified: lld/trunk/test/ELF/wrap-plt.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/wrap-plt.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/wrap-plt.s (original)
+++ lld/trunk/test/ELF/wrap-plt.s Sun Sep  8 20:35:14 2019
@@ -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 at plt>
+// DISASM-NEXT:   jmp {{.*}} <__wrap_foo at plt>
+// DISASM-NEXT:   jmp {{.*}} <_start at plt>
 
 .global foo
 foo:

Copied: lld/trunk/test/ELF/x86-64-plt.s (from r371316, lld/trunk/test/ELF/plt.s)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-plt.s?p2=lld/trunk/test/ELF/x86-64-plt.s&p1=lld/trunk/test/ELF/plt.s&r1=371316&r2=371361&rev=371361&view=diff
==============================================================================
    (empty)

Modified: lld/trunk/test/ELF/x86-64-reloc-size-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-size-shared.s?rev=371361&r1=371360&r2=371361&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-size-shared.s (original)
+++ lld/trunk/test/ELF/x86-64-reloc-size-shared.s Sun Sep  8 20:35:14 2019
@@ -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 at SIZE-1
   .quad foo at SIZE
@@ -56,6 +48,7 @@ _data:
   .quad fooshared at SIZE
   .quad fooshared at SIZE+1
 
+.section test, "awx"
 .globl _start
 _start:
   // R_X86_64_SIZE32:




More information about the llvm-commits mailing list