summaryrefslogtreecommitdiffstats
path: root/lld/test
diff options
context:
space:
mode:
authorSean Fertile <sfertile@ca.ibm.com>2018-05-09 02:07:53 +0000
committerSean Fertile <sfertile@ca.ibm.com>2018-05-09 02:07:53 +0000
commit49914cc807a933f3bafd61b88248e75a90101333 (patch)
tree7571aca48bc28d40ffc448eca2a44b89c1350832 /lld/test
parent27bba4495a21034651d559f0bbeeb6c4da71bc54 (diff)
downloadbcm5719-llvm-49914cc807a933f3bafd61b88248e75a90101333.tar.gz
bcm5719-llvm-49914cc807a933f3bafd61b88248e75a90101333.zip
[PPC64] Add lazy symbol resolution stubs.
Adds support for .glink resolver stubs from the example implementation in the V2 ABI (Section 4.2.5.3. Procedure Linkage Table). The stubs are written to the PltSection, and the sections are renamed to match the PPC64 ABI: .got.plt --> .plt Type = SHT_NOBITS .plt --> .glink And adds the DT_PPC64_GLINK dynamic tag to the dynamic section when the plt is not empty. Differential Revision: https://reviews.llvm.org/D45642 llvm-svn: 331840
Diffstat (limited to 'lld/test')
-rw-r--r--lld/test/ELF/ppc64-dynamic-relocations.s22
-rw-r--r--lld/test/ELF/ppc64-ifunc.s33
-rw-r--r--lld/test/ELF/ppc64-plt-stub.s4
3 files changed, 26 insertions, 33 deletions
diff --git a/lld/test/ELF/ppc64-dynamic-relocations.s b/lld/test/ELF/ppc64-dynamic-relocations.s
index c23370560d2..2d9dfc6f804 100644
--- a/lld/test/ELF/ppc64-dynamic-relocations.s
+++ b/lld/test/ELF/ppc64-dynamic-relocations.s
@@ -5,7 +5,7 @@
// RUN: ld.lld -shared %t2.o -o %t2.so
// RUN: ld.lld %t.o %t2.so -o %t
// RUN: llvm-readobj -dyn-relocations %t | FileCheck %s
-// RUN: llvm-objdump -D %t | FileCheck --check-prefix=DIS %s
+// RUN: llvm-objdump --section-headers %t | FileCheck --check-prefix=DIS %s
// RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
@@ -13,29 +13,23 @@
// RUN: ld.lld -shared %t2.o -o %t2.so
// RUN: ld.lld %t.o %t2.so -o %t
// RUN: llvm-readobj -dyn-relocations %t | FileCheck %s
-// RUN: llvm-objdump -D %t | FileCheck --check-prefix=DIS %s
+// RUN: llvm-objdump --section-headers %t | FileCheck --check-prefix=DIS %s
// RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
// The dynamic relocation for foo should point to 16 bytes past the start of
-// the .got.plt section.
+// the .plt section.
// CHECK: Dynamic Relocations {
-// CHECK-NEXT: 0x10020010 R_PPC64_JMP_SLOT foo 0x0
+// CHECK-NEXT: 0x10030010 R_PPC64_JMP_SLOT foo 0x0
// There should be 2 reserved doublewords before the first entry. The dynamic
// linker will fill those in with the address of the resolver entry point and
// the dynamic object identifier.
-// DIS: Disassembly of section .got.plt:
-// DIS-NEXT: .got.plt:
-// DIS-NEXT: 10020000: 00 00 00 00 <unknown>
-// DIS-NEXT: 10020004: 00 00 00 00 <unknown>
-// DIS-NEXT: 10020008: 00 00 00 00 <unknown>
-// DIS-NEXT: 1002000c: 00 00 00 00 <unknown>
-// DIS-NEXT: 10020010: 00 00 00 00 <unknown>
-// DIS-NEXT: 10020014: 00 00 00 00 <unknown>
+// DIS: Idx Name Size Address Type
+// DIS: .plt 00000018 0000000010030000 BSS
-// DT_PLTGOT should point to the start of the .got.plt section.
-// DT: 0x0000000000000003 PLTGOT 0x10020000
+// DT_PLTGOT should point to the start of the .plt section.
+// DT: 0x0000000000000003 PLTGOT 0x10030000
.text
.abiversion 2
diff --git a/lld/test/ELF/ppc64-ifunc.s b/lld/test/ELF/ppc64-ifunc.s
index ccf4c635677..9bb0d9053c9 100644
--- a/lld/test/ELF/ppc64-ifunc.s
+++ b/lld/test/ELF/ppc64-ifunc.s
@@ -5,30 +5,32 @@
# RUN: ld.lld -shared %t2.o -o %t2.so
# RUN: ld.lld %t.o %t2.so -o %t
# RUN: llvm-objdump -D %t | FileCheck %s
+# RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
# RUN: ld.lld -shared %t2.o -o %t2.so
# RUN: ld.lld %t.o %t2.so -o %t
# RUN: llvm-objdump -D %t | FileCheck %s
+# RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
# CHECK: Disassembly of section .text:
-# Tocbase + (-2 << 16) + 32576
-# 0x100380d0 + (-131072) + 32576 = 0x10020010 (.got.plt[2])
+# Tocbase + (0 << 16) + 32560
+# 0x100280e0 + 0 + 32560 = 0x10030010 (.plt[2])
# CHECK: __plt_foo:
# CHECK-NEXT: std 2, 24(1)
-# CHECK-NEXT: addis 12, 2, -2
-# CHECK-NEXT: ld 12, 32576(12)
+# CHECK-NEXT: addis 12, 2, 0
+# CHECK-NEXT: ld 12, 32560(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
-# Tocbase + (-2 << 16) + 32584
-# 0x100380d0 + (-131072) + 32584 = 0x10020018 (.got.plt[3])
+# Tocbase + (0 << 16) + 32568
+# 0x100280e0 + 0 + 32568 = 0x1003018 (.plt[3])
# CHECK: __plt_ifunc:
# CHECK-NEXT: std 2, 24(1)
-# CHECK-NEXT: addis 12, 2, -2
-# CHECK-NEXT: ld 12, 32584(12)
+# CHECK-NEXT: addis 12, 2, 0
+# CHECK-NEXT: ld 12, 32568(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
@@ -36,24 +38,21 @@
# CHECK-NEXT: 10010028: {{.*}} nop
# CHECK: _start:
-# CHECK-NEXT: addis 2, 12, 3
-# CHECK-NEXT: addi 2, 2, -32604
+# CHECK-NEXT: addis 2, 12, 2
+# CHECK-NEXT: addi 2, 2, -32588
# CHECK-NEXT: bl .+67108812
# CHECK-NEXT: ld 2, 24(1)
# CHECK-NEXT: bl .+67108824
# CHECK-NEXT: ld 2, 24(1)
-# Address of .got.plt
-# CHECK: Disassembly of section .got.plt:
-# CHECK-NEXT: .got.plt:
-# CHECK-NEXT: 10020000:
-
-
# Check tocbase
# CHECK: Disassembly of section .got:
# CHECK-NEXT: .got:
-# CHECK-NEXT: 100300d0:
+# CHECK-NEXT: 100200e0
+# Check .plt address
+# DT_PLTGOT should point to the start of the .plt section.
+# DT: 0x0000000000000003 PLTGOT 0x10030000
.text
.abiversion 2
diff --git a/lld/test/ELF/ppc64-plt-stub.s b/lld/test/ELF/ppc64-plt-stub.s
index 86fd4734997..a644f487b8b 100644
--- a/lld/test/ELF/ppc64-plt-stub.s
+++ b/lld/test/ELF/ppc64-plt-stub.s
@@ -15,8 +15,8 @@
// CHECK: Disassembly of section .text:
// CHECK-NEXT: __plt_foo:
// CHECK-NEXT: std 2, 24(1)
-// CHECK-NEXT: addis 12, 2, -2
-// CHECK-NEXT: ld 12, 32576(12)
+// CHECK-NEXT: addis 12, 2, 0
+// CHECK-NEXT: ld 12, 32560(12)
// CHECK-NEXT: mtctr 12
// CHECK-NEXT: bctr
OpenPOWER on IntegriCloud