[lld] 7b39124 - [PowerPC] Fix thunk alignment issue when using pc-rel instruction
Victor Huang via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 07:10:17 PDT 2020
Author: Victor Huang
Date: 2020-08-17T09:09:36-05:00
New Revision: 7b391245d8eab16d1dfabde9f67a97fa9809ab49
URL: https://github.com/llvm/llvm-project/commit/7b391245d8eab16d1dfabde9f67a97fa9809ab49
DIFF: https://github.com/llvm/llvm-project/commit/7b391245d8eab16d1dfabde9f67a97fa9809ab49.diff
LOG: [PowerPC] Fix thunk alignment issue when using pc-rel instruction
Thunk alignment is added in thie patch when using pc-rel instructions
to avoid crossing the 64 byte boundary.
Patched by: nemanjai, NeHuang
Reviewed By: sfertile, MaskRay
Differential Revision: https://reviews.llvm.org/D85973
Added:
Modified:
lld/ELF/SyntheticSections.cpp
lld/ELF/Thunks.cpp
lld/test/ELF/ppc64-bsymbolic-toc-restore.s
lld/test/ELF/ppc64-call-reach.s
lld/test/ELF/ppc64-dtprel.s
lld/test/ELF/ppc64-ifunc.s
lld/test/ELF/ppc64-local-dynamic.s
lld/test/ELF/ppc64-long-branch-init.s
lld/test/ELF/ppc64-long-branch-rel14.s
lld/test/ELF/ppc64-long-branch.s
lld/test/ELF/ppc64-pcrel-call-to-extern.s
lld/test/ELF/ppc64-pcrel-call-to-toc.s
lld/test/ELF/ppc64-plt-stub-compatible.s
lld/test/ELF/ppc64-plt-stub.s
lld/test/ELF/ppc64-tls-gd.s
lld/test/ELF/ppc64-toc-call-to-pcrel.s
lld/test/ELF/ppc64-toc-restore-recursive-call.s
lld/test/ELF/ppc64-toc-restore.s
Removed:
################################################################################
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index fd3d4797bb51..6c9651d9c80a 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -3525,8 +3525,8 @@ bool ARMExidxSyntheticSection::classof(const SectionBase *d) {
}
ThunkSection::ThunkSection(OutputSection *os, uint64_t off)
- : SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS, 4,
- ".text.thunk") {
+ : SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS,
+ config->emachine == EM_PPC64 ? 16 : 4, ".text.thunk") {
this->parent = os;
this->outSecOff = off;
}
diff --git a/lld/ELF/Thunks.cpp b/lld/ELF/Thunks.cpp
index 193e00c50d14..b18bca063fe6 100644
--- a/lld/ELF/Thunks.cpp
+++ b/lld/ELF/Thunks.cpp
@@ -301,7 +301,7 @@ class PPC64R2SaveStub final : public Thunk {
// callee's global entry point into r12 without a save of R2.
class PPC64R12SetupStub final : public Thunk {
public:
- PPC64R12SetupStub(Symbol &dest) : Thunk(dest, 0) {}
+ PPC64R12SetupStub(Symbol &dest) : Thunk(dest, 0) { alignment = 16; }
uint32_t size() override { return 16; }
void writeTo(uint8_t *buf) override;
void addSymbols(ThunkSection &isec) override;
@@ -316,7 +316,7 @@ class PPC64R12SetupStub final : public Thunk {
// 2) Transferring control to the target function through an indirect branch.
class PPC64PCRelPLTStub final : public Thunk {
public:
- PPC64PCRelPLTStub(Symbol &dest) : Thunk(dest, 0) {}
+ PPC64PCRelPLTStub(Symbol &dest) : Thunk(dest, 0) { alignment = 16; }
uint32_t size() override { return 16; }
void writeTo(uint8_t *buf) override;
void addSymbols(ThunkSection &isec) override;
diff --git a/lld/test/ELF/ppc64-bsymbolic-toc-restore.s b/lld/test/ELF/ppc64-bsymbolic-toc-restore.s
index a8f821ec9d16..a55d79e344e1 100644
--- a/lld/test/ELF/ppc64-bsymbolic-toc-restore.s
+++ b/lld/test/ELF/ppc64-bsymbolic-toc-restore.s
@@ -63,8 +63,10 @@ caller:
# CHECK-EMPTY:
# CHECK-NEXT: <def>:
# CHECK-NEXT: addis 2, 12, 2
-# CHECK-NEXT: addi 2, 2, -32456
+# CHECK-NEXT: addi 2, 2, -32448
# CHECK-NEXT: [[DEF]]: li 3, 55
# CHECK-NEXT: blr
+# CHECK-NEXT: trap
+# CHECK-NEXT: trap
# CHECK-EMPTY:
# CHECK-NEXT: 00000000000[[NOT_DEFINED]] <__plt_not_defined>:
diff --git a/lld/test/ELF/ppc64-call-reach.s b/lld/test/ELF/ppc64-call-reach.s
index 5f0e2dc47015..fe4caab25bf0 100644
--- a/lld/test/ELF/ppc64-call-reach.s
+++ b/lld/test/ELF/ppc64-call-reach.s
@@ -66,19 +66,19 @@ test:
# NEGOFFSET: 10010024: b 0xe010024
# THUNK-LABEL: <test>:
-# THUNK: 10010014: bl 0x10010028
-# THUNK: 10010024: b 0x10010038
+# THUNK: 10010014: bl 0x10010030
+# THUNK: 10010024: b 0x10010040
# .branch_lt[0]
# THUNK-LABEL: <__long_branch_callee>:
-# THUNK-NEXT: 10010028: addis 12, 2, 1
+# THUNK-NEXT: 10010030: addis 12, 2, 1
# THUNK-NEXT: ld 12, -32760(12)
# THUNK-NEXT: mtctr 12
# THUNK-NEXT: bctr
# .branch_lt[1]
# THUNK-LABEL: <__long_branch_tail_callee>:
-# THUNK-NEXT: 10010038: addis 12, 2, 1
+# THUNK-NEXT: 10010040: addis 12, 2, 1
# THUNK-NEXT: ld 12, -32752(12)
# THUNK-NEXT: mtctr 12
# THUNK-NEXT: bctr
diff --git a/lld/test/ELF/ppc64-dtprel.s b/lld/test/ELF/ppc64-dtprel.s
index 97076117b88f..4871b7835cee 100644
--- a/lld/test/ELF/ppc64-dtprel.s
+++ b/lld/test/ELF/ppc64-dtprel.s
@@ -140,12 +140,12 @@ k:
// The got entry for i is at .got+8*1 = 0x4209e0
// i at dtprel = 1024 - 0x8000 = -31744 = 0xffffffffffff8400
// HEX-LE: section '.got':
-// HEX-LE-NEXT: 4209c8 c8894200 00000000 00000000 00000000
-// HEX-LE-NEXT: 4209d8 00000000 00000000
+// HEX-LE-NEXT: 4209d0 d0894200 00000000 00000000 00000000
+// HEX-LE-NEXT: 4209e0 00000000 00000000
// HEX-BE: section '.got':
-// HEX-BE-NEXT: 4209c8 00000000 004289c8 00000000 00000000
-// HEX-BE-NEXT: 4209d8 00000000 00000000
+// HEX-BE-NEXT: 4209d0 00000000 004289d0 00000000 00000000
+// HEX-BE-NEXT: 4209e0 00000000 00000000
// Dis: <test>:
// Dis: addi 4, 3, -31744
diff --git a/lld/test/ELF/ppc64-ifunc.s b/lld/test/ELF/ppc64-ifunc.s
index 75a3e1072e06..a959f817c1dc 100644
--- a/lld/test/ELF/ppc64-ifunc.s
+++ b/lld/test/ELF/ppc64-ifunc.s
@@ -16,9 +16,9 @@
# SYM: Value Size Type Bind Vis Ndx
# SYM: 0000000010028298 0 NOTYPE LOCAL HIDDEN 4 .TOC.
-# SYM: 0000000010010284 0 FUNC GLOBAL DEFAULT 3 ifunc1
+# SYM: 0000000010010288 0 FUNC GLOBAL DEFAULT 3 ifunc1
# SYM: 0000000010010210 0 IFUNC GLOBAL DEFAULT 2 ifunc2
-# SYM: 0000000010010274 0 FUNC GLOBAL DEFAULT 3 ifunc3
+# SYM: 0000000010010278 0 FUNC GLOBAL DEFAULT 3 ifunc3
# SECTIONS: .plt NOBITS 00000000100302a0 0002a0 000018 00 WA 0 0 8
@@ -27,14 +27,14 @@
# CHECK: <_start>:
# CHECK-NEXT: addis 2, 12, 2
# CHECK-NEXT: addi 2, 2, -32636
-# CHECK-NEXT: 1001021c: bl 0x1001023c
+# CHECK-NEXT: 1001021c: bl 0x10010240
# CHECK-NEXT: ld 2, 24(1)
-# CHECK-NEXT: 10010224: bl 0x10010250
+# CHECK-NEXT: 10010224: bl 0x10010254
# CHECK-NEXT: ld 2, 24(1)
# CHECK-NEXT: addis 3, 2, -2
-# CHECK-NEXT: addi 3, 3, 32748
+# CHECK-NEXT: addi 3, 3, 32752
# CHECK-NEXT: addis 3, 2, -2
-# CHECK-NEXT: addi 3, 3, 32732
+# CHECK-NEXT: addi 3, 3, 32736
# .plt[0] - .TOC. = 0x100302a0 - 0x10028298 = (1<<16) - 32760
# CHECK: <__plt_ifunc2>:
@@ -57,19 +57,19 @@
## ifunc2 and ifunc3 have the same code sequence as their PLT call stubs.
# CHECK: Disassembly of section .glink:
# CHECK-EMPTY:
-# CHECK-NEXT: 0000000010010264 <.glink>:
+# CHECK-NEXT: 0000000010010268 <.glink>:
# CHECK-NEXT: addis 12, 2, 1
# CHECK-NEXT: ld 12, -32760(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
# CHECK-EMPTY:
-# CHECK-NEXT: 0000000010010274 <ifunc3>:
+# CHECK-NEXT: 0000000010010278 <ifunc3>:
# CHECK-NEXT: addis 12, 2, 1
# CHECK-NEXT: ld 12, -32752(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
# CHECK-EMPTY:
-# CHECK-NEXT: 0000000010010284 <ifunc1>:
+# CHECK-NEXT: 0000000010010288 <ifunc1>:
# CHECK-NEXT: addis 12, 2, 1
# CHECK-NEXT: ld 12, -32744(12)
# CHECK-NEXT: mtctr 12
diff --git a/lld/test/ELF/ppc64-local-dynamic.s b/lld/test/ELF/ppc64-local-dynamic.s
index f0f3967387dd..0113116d0463 100644
--- a/lld/test/ELF/ppc64-local-dynamic.s
+++ b/lld/test/ELF/ppc64-local-dynamic.s
@@ -113,7 +113,7 @@ k:
// Dis: <test>:
// Dis: addis 3, 2, 0
// Dis-NEXT: addi 3, 3, -32760
-// Dis-NEXT: bl 0x10058
+// Dis-NEXT: bl 0x10060
// Dis-NEXT: ld 2, 24(1)
// Dis-NEXT: addis 3, 3, 0
// Dis-NEXT: lwa 3, -32768(3)
diff --git a/lld/test/ELF/ppc64-long-branch-init.s b/lld/test/ELF/ppc64-long-branch-init.s
index a045407b52e2..e0be082e4b54 100644
--- a/lld/test/ELF/ppc64-long-branch-init.s
+++ b/lld/test/ELF/ppc64-long-branch-init.s
@@ -14,6 +14,8 @@
# CHECK-EMPTY:
# CHECK-LABEL: <_init>:
# CHECK: blr
+# CHECK-NEXT: trap
+# CHECK-NEXT: trap
# CHECK-EMPTY:
# CHECK-LABEL: <__long_branch_foo>:
diff --git a/lld/test/ELF/ppc64-long-branch-rel14.s b/lld/test/ELF/ppc64-long-branch-rel14.s
index dc67e932fd3c..3332e4ec6d9e 100644
--- a/lld/test/ELF/ppc64-long-branch-rel14.s
+++ b/lld/test/ELF/ppc64-long-branch-rel14.s
@@ -17,21 +17,24 @@
# SEC: There are no relocations in this file.
# CHECK-LABEL: <_start>:
-# CHECK-NEXT: 2000: bt 2, 0x2014
-# CHECK-NEXT: bt+ 2, 0x2014
+# CHECK-NEXT: 2000: bt 2, 0x2020
+# CHECK-NEXT: bt+ 2, 0x2020
# CHECK-NEXT: bf 2, 0xa004
-# CHECK-NEXT: bt 2, 0x2024
+# CHECK-NEXT: bt 2, 0x2030
# CHECK-NEXT: blr
+# CHECK-NEXT: trap
+# CHECK-NEXT: trap
+# CHECK-NEXT: trap
# CHECK-EMPTY:
# CHECK-NEXT: <__long_branch_high>:
-# CHECK-NEXT: 2014: addis 12, 2, 0
+# CHECK-NEXT: 2020: addis 12, 2, 0
# CHECK-NEXT: ld 12, {{.*}}(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
# CHECK-EMPTY:
# CHECK-NEXT: <__long_branch_>:
-# CHECK-NEXT: 2024: addis 12, 2, 0
+# CHECK-NEXT: 2030: addis 12, 2, 0
# CHECK-NEXT: ld 12, {{.*}}(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
diff --git a/lld/test/ELF/ppc64-long-branch.s b/lld/test/ELF/ppc64-long-branch.s
index cf23364431b2..7fa3c4b327fd 100644
--- a/lld/test/ELF/ppc64-long-branch.s
+++ b/lld/test/ELF/ppc64-long-branch.s
@@ -19,33 +19,33 @@
# RUN: llvm-nm --no-sort %t | FileCheck --check-prefix=NM %s
# SEC: Name Type Address Off Size ES Flg Lk Inf Al
-# SEC: .got PROGBITS 0000000002002028 2002028 000008 00 WA 0 0 8
-# SEC: .branch_lt PROGBITS 0000000002002030 2002030 000018 00 WA 0 0 8
+# SEC: .got PROGBITS 0000000002002030 2002030 000008 00 WA 0 0 8
+# SEC: .branch_lt PROGBITS 0000000002002038 2002038 000018 00 WA 0 0 8
# SEC: There are no relocations in this file.
## high at localentry (high+8), .text_high+16 and .text_low+8
-# BRANCH-LE: 0x02002030 08200002 00000000 10200002 00000000
-# BRANCH-LE-NEXT: 0x02002040 08200000 00000000
-# BRANCH-BE: 0x02002030 00000000 02002008 00000000 02002010
-# BRANCH-BE-NEXT: 0x02002040 00000000 00002008
+# BRANCH-LE: 0x02002038 08200002 00000000 10200002 00000000
+# BRANCH-LE-NEXT: 0x02002048 08200000 00000000
+# BRANCH-BE: 0x02002038 00000000 02002008 00000000 02002010
+# BRANCH-BE-NEXT: 0x02002048 00000000 00002008
# CHECK: <_start>:
-# CHECK-NEXT: 2000: bl 0x2018
-# CHECK-NEXT: bl 0x2018
-# CHECK-NEXT: bl 0x2018
+# CHECK-NEXT: 2000: bl 0x2020
+# CHECK-NEXT: bl 0x2020
+# CHECK-NEXT: bl 0x2020
# CHECK-NEXT: bl 0x2002008
## &.branch_lt[0] - .TOC. = .branch_lt - (.got+0x8000) = -32760
# CHECK: <__long_branch_high>:
-# CHECK-NEXT: 2018: addis 12, 2, 0
+# CHECK-NEXT: 2020: addis 12, 2, 0
# CHECK-NEXT: ld 12, -32760(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
## &.branch_lt[1] - .TOC. = .branch_lt - (.got+0x8000) = -32752
# CHECK: <__long_branch_>:
-# CHECK-NEXT: 2028: addis 12, 2, 0
+# CHECK-NEXT: 2030: addis 12, 2, 0
# CHECK-NEXT: ld 12, -32752(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
@@ -64,11 +64,11 @@ blr
# CHECK-EMPTY:
# CHECK-NEXT: <high>:
# CHECK-NEXT: 2002000: addis 2, 12, 1
-# CHECK-NEXT: addi 2, 2, -32728
+# CHECK-NEXT: addi 2, 2, -32720
# CHECK-NEXT: bl 0x2008
-# CHECK-NEXT: bl 0x2002014
+# CHECK-NEXT: bl 0x2002020
# CHECK: <__long_branch_>:
-# CHECK-NEXT: 2002014: addis 12, 2, 0
+# CHECK-NEXT: 2002020: addis 12, 2, 0
# CHECK-NEXT: ld 12, -32744(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
diff --git a/lld/test/ELF/ppc64-pcrel-call-to-extern.s b/lld/test/ELF/ppc64-pcrel-call-to-extern.s
index ab2eaf09a6ac..a1d9a7df3b44 100644
--- a/lld/test/ELF/ppc64-pcrel-call-to-extern.s
+++ b/lld/test/ELF/ppc64-pcrel-call-to-extern.s
@@ -35,55 +35,55 @@
# SYMBOL: 2: 0000000010010000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 6 caller1
# SYMBOL-NEXT: 3: 0000000010020000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 7 caller2
# SYMBOL-NEXT: 4: 0000000010030000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 8 caller3
-# SYMBOL: 6: 0000000010010008 16 FUNC LOCAL DEFAULT 6 __plt_pcrel_callee_global_stother0
-# SYMBOL-NEXT: 7: 0000000010020008 16 FUNC LOCAL DEFAULT 7 __plt_pcrel_callee_global_stother1
-# SYMBOL-NEXT: 8: 0000000010030008 16 FUNC LOCAL DEFAULT 8 __plt_pcrel_callee_global_TOC
+# SYMBOL: 6: 0000000010010010 16 FUNC LOCAL DEFAULT 6 __plt_pcrel_callee_global_stother0
+# SYMBOL-NEXT: 7: 0000000010020010 16 FUNC LOCAL DEFAULT 7 __plt_pcrel_callee_global_stother1
+# SYMBOL-NEXT: 8: 0000000010030010 16 FUNC LOCAL DEFAULT 8 __plt_pcrel_callee_global_TOC
# SYMBOL-NEXT: 9: 0000000000000000 0 NOTYPE GLOBAL DEFAULT [<other: 0x60>] UND callee_global_TOC
# SYMBOL-NEXT: 10: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND callee_global_stother0
# SYMBOL-NEXT: 11: 0000000000000000 0 NOTYPE GLOBAL DEFAULT [<other: 0x20>] UND callee_global_stother1
## DT_PLTGOT points to .plt
-# SEC: .plt NOBITS 0000000010030140 040140 000028 00 WA 0 0 8
-# SEC: 0x0000000000000003 (PLTGOT) 0x10030140
+# SEC: .plt NOBITS 0000000010030148 040148 000028 00 WA 0 0 8
+# SEC: 0x0000000000000003 (PLTGOT) 0x10030148
## The first 2 entries in the .plt are reserved for the dynamic linkers
## usage. The JMP_SLOT relocations are stored at .plt[2], .plt[3], .plt[4].
## Check that we emit 3 R_PPC64_JMP_SLOT in .rela.plt.
# REL: .rela.plt {
-# REL-NEXT: 0x10030150 R_PPC64_JMP_SLOT callee_global_stother0 0x0
-# REL-NEXT: 0x10030158 R_PPC64_JMP_SLOT callee_global_stother1 0x0
-# REL-NEXT: 0x10030160 R_PPC64_JMP_SLOT callee_global_TOC 0x0
+# REL-NEXT: 0x10030158 R_PPC64_JMP_SLOT callee_global_stother0 0x0
+# REL-NEXT: 0x10030160 R_PPC64_JMP_SLOT callee_global_stother1 0x0
+# REL-NEXT: 0x10030168 R_PPC64_JMP_SLOT callee_global_TOC 0x0
# REL-NEXT: }
# CHECK-LABEL: <caller1>:
-# CHECK: 10010000: bl 0x10010008
+# CHECK: 10010000: bl 0x10010010
# CHECK-NEXT: 10010004: blr
-## .plt[2] - 0x10010008 = 0x10030150 - 0x10010008 = 0x20148 = 131400
+## .plt[2] - 0x10010010 = 0x10030158 - 0x10010010 = 0x20148 = 131400
# CHECK-LABEL: <__plt_pcrel_callee_global_stother0>:
-# CHECK: 10010008: pld 12, 131400(0), 1
-# CHECK-NEXT: 10010010: mtctr 12
-# CHECK-NEXT: 10010014: bctr
+# CHECK: 10010010: pld 12, 131400(0), 1
+# CHECK-NEXT: 10010018: mtctr 12
+# CHECK-NEXT: 1001001c: bctr
# CHECK-LABEL: <caller2>:
-# CHECK: 10020000: bl 0x10020008
+# CHECK: 10020000: bl 0x10020010
# CHECK-NEXT: 10020004: blr
-## .plt[3] - 0x10020008 = 0x10030158 - 0x10020008 = 0x10150 = 65872
+## .plt[3] - 0x10020010 = 0x10030160 - 0x10020010 = 0x10150 = 65872
# CHECK-LABEL: <__plt_pcrel_callee_global_stother1>:
-# CHECK: 10020008: pld 12, 65872(0), 1
-# CHECK-NEXT: 10020010: mtctr 12
-# CHECK-NEXT: 10020014: bctr
+# CHECK: 10020010: pld 12, 65872(0), 1
+# CHECK-NEXT: 10020018: mtctr 12
+# CHECK-NEXT: 1002001c: bctr
# CHECK-LABEL: <caller3>:
-# CHECK: 10030000: bl 0x10030008
+# CHECK: 10030000: bl 0x10030010
# CHECK-NEXT: 10030004: blr
-## .plt[4] - 0x10030008 = 0x10030160 - 0x10030008 = 0x158 = 344
+## .plt[4] - 0x10030010 = 0x10030168 - 0x10030010 = 0x150 = 344
# CHECK-LABEL: <__plt_pcrel_callee_global_TOC>:
-# CHECK: 10030008: pld 12, 344(0), 1
-# CHECK-NEXT: 10030010: mtctr 12
-# CHECK-NEXT: 10030014: bctr
+# CHECK: 10030010: pld 12, 344(0), 1
+# CHECK-NEXT: 10030018: mtctr 12
+# CHECK-NEXT: 1003001c: bctr
.ifdef AUX
.section .text_caller1, "ax", %progbits
diff --git a/lld/test/ELF/ppc64-pcrel-call-to-toc.s b/lld/test/ELF/ppc64-pcrel-call-to-toc.s
index d85b559a9cf3..f7463f2daffd 100644
--- a/lld/test/ELF/ppc64-pcrel-call-to-toc.s
+++ b/lld/test/ELF/ppc64-pcrel-call-to-toc.s
@@ -21,7 +21,7 @@
# SYMBOL: 1: 0000000010020000 0 NOTYPE LOCAL DEFAULT [<other: 0x60>] 2 callee
# SYMBOL-NEXT: 2: 0000000010030000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 3 caller
# SYMBOL-NEXT: 3: 0000000010010000 0 NOTYPE LOCAL DEFAULT 1 func
-# SYMBOL: 6: 000000001003000c 16 FUNC LOCAL DEFAULT 3 __gep_setup_callee
+# SYMBOL: 6: 0000000010030010 16 FUNC LOCAL DEFAULT 3 __gep_setup_callee
# CHECK-LABEL: <func>:
# CHECK-NEXT: blr
@@ -33,11 +33,11 @@
# CHECK-NEXT: blr
# CHECK-LABEL: <caller>:
-# CHECK-NEXT: bl 0x1003000c
+# CHECK-NEXT: bl 0x10030010
# CHECK-NEXT: blr
# CHECK-LABEL: <__gep_setup_callee>:
-# CHECK-NEXT: paddi 12, 0, -65548, 1
+# CHECK-NEXT: paddi 12, 0, -65552, 1
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
diff --git a/lld/test/ELF/ppc64-plt-stub-compatible.s b/lld/test/ELF/ppc64-plt-stub-compatible.s
index 916b3aebe4b1..c0ffb4154ccc 100644
--- a/lld/test/ELF/ppc64-plt-stub-compatible.s
+++ b/lld/test/ELF/ppc64-plt-stub-compatible.s
@@ -29,16 +29,16 @@ callee:
# T2-LABEL: <p9codegen>:
# T2-NEXT: 10010300: addis 2, 12, 1
-# T2-NEXT: 10010304: addi 2, 2, -32392
+# T2-NEXT: 10010304: addi 2, 2, -32384
# T2-NEXT: 10010308: addis 4, 2, -1
-# T2-NEXT: 1001030c: lwa 3, 32436(4)
+# T2-NEXT: 1001030c: lwa 3, 32428(4)
# T2-NEXT: 10010310: bl 0x10010330
# T2-NEXT: 10010314: ld 2, 24(1)
# T2-NEXT: 10010318: blr
# T2-LABEL: <p10codegen>:
# T2-NEXT: 1001031c: plwa 3, 16(0), 1
-# T2-NEXT: 10010324: bl 0x10010344
+# T2-NEXT: 10010324: bl 0x10010350
# T2-NEXT: 10010328: blr
# T2-LABEL: <__plt_callee>:
@@ -49,9 +49,9 @@ callee:
# T2-NEXT: 10010340: bctr
# T2-LABEL: <__plt_pcrel_callee>:
-# T2-NEXT: 10010344: pld 12, 332(0), 1
-# T2-NEXT: 1001034c: mtctr 12
-# T2-NEXT: 10010350: bctr
+# T2-NEXT: 10010350: pld 12, 328(0), 1
+# T2-NEXT: 10010358: mtctr 12
+# T2-NEXT: 1001035c: bctr
.ifdef T2
.section .text_start, "ax", %progbits
p9codegen:
diff --git a/lld/test/ELF/ppc64-plt-stub.s b/lld/test/ELF/ppc64-plt-stub.s
index d21ddbfc7566..2f9f4cb5a51d 100644
--- a/lld/test/ELF/ppc64-plt-stub.s
+++ b/lld/test/ELF/ppc64-plt-stub.s
@@ -15,8 +15,8 @@
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
## DT_PLTGOT points to .plt
-# SEC: .plt NOBITS 00000000100303e8 0003e8 000018
-# SEC: 0x0000000000000003 (PLTGOT) 0x100303e8
+# SEC: .plt NOBITS 00000000100303f0 0003f0 000018
+# SEC: 0x0000000000000003 (PLTGOT) 0x100303f0
## .plt[0] holds the address of _dl_runtime_resolve.
## .plt[1] holds the link map.
@@ -24,9 +24,9 @@
# RELOC: 0x10030010 R_PPC64_JMP_SLOT foo 0x0
# CHECK: <_start>:
-# CHECK: 10010298: bl 0x100102a8
+# CHECK: 10010298: bl 0x100102b0
-# CHECK-LABEL: 00000000100102a8 <__plt_foo>:
+# CHECK-LABEL: 00000000100102b0 <__plt_foo>:
# CHECK-NEXT: std 2, 24(1)
# CHECK-NEXT: addis 12, 2, 1
# CHECK-NEXT: ld 12, -32744(12)
diff --git a/lld/test/ELF/ppc64-tls-gd.s b/lld/test/ELF/ppc64-tls-gd.s
index 90047331762f..a869897f53b9 100644
--- a/lld/test/ELF/ppc64-tls-gd.s
+++ b/lld/test/ELF/ppc64-tls-gd.s
@@ -16,29 +16,29 @@
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=IE %s
# GD-REL: .rela.dyn {
-# GD-REL-NEXT: 0x20538 R_PPC64_DTPMOD64 a 0x0
-# GD-REL-NEXT: 0x20540 R_PPC64_DTPREL64 a 0x0
-# GD-REL-NEXT: 0x20548 R_PPC64_DTPMOD64 b 0x0
-# GD-REL-NEXT: 0x20550 R_PPC64_DTPREL64 b 0x0
-# GD-REL-NEXT: 0x20558 R_PPC64_DTPMOD64 c 0x0
-# GD-REL-NEXT: 0x20560 R_PPC64_DTPREL64 c 0x0
+# GD-REL-NEXT: 0x20548 R_PPC64_DTPMOD64 a 0x0
+# GD-REL-NEXT: 0x20550 R_PPC64_DTPREL64 a 0x0
+# GD-REL-NEXT: 0x20558 R_PPC64_DTPMOD64 b 0x0
+# GD-REL-NEXT: 0x20560 R_PPC64_DTPREL64 b 0x0
+# GD-REL-NEXT: 0x20568 R_PPC64_DTPMOD64 c 0x0
+# GD-REL-NEXT: 0x20570 R_PPC64_DTPREL64 c 0x0
# GD-REL-NEXT: }
## &DTPMOD(a) - .TOC. = &.got[0] - (.got+0x8000) = -32768
# GD: addis 3, 2, 0
# GD-NEXT: addi 3, 3, -32768
-# GD-NEXT: bl 0x103f4
+# GD-NEXT: bl 0x10400
# GD-NEXT: ld 2, 24(1)
## &DTPMOD(b) - .TOC. = &.got[2] - (.got+0x8000) = -32752
# GD-NEXT: addis 3, 2, 0
# GD-NEXT: addi 3, 3, -32752
-# GD-NEXT: bl 0x103f4
+# GD-NEXT: bl 0x10400
# GD-NEXT: ld 2, 24(1)
## &DTPMOD(b) - .TOC. = &.got[4] - (.got+0x8000) = -32736
# GD-NEXT: li 3, -32736
-# GD-NEXT: bl 0x103f4
+# GD-NEXT: bl 0x10400
# GD-NEXT: ld 2, 24(1)
# NOREL: no relocations
diff --git a/lld/test/ELF/ppc64-toc-call-to-pcrel.s b/lld/test/ELF/ppc64-toc-call-to-pcrel.s
index 1807895a1914..132f90fcc782 100644
--- a/lld/test/ELF/ppc64-toc-call-to-pcrel.s
+++ b/lld/test/ELF/ppc64-toc-call-to-pcrel.s
@@ -21,18 +21,18 @@
# SYMBOL: 10010000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 1 callee
# SYMBOL: 10020000 0 NOTYPE LOCAL DEFAULT [<other: 0x60>] 2 caller
# SYMBOL: 10020020 0 NOTYPE LOCAL DEFAULT [<other: 0x60>] 2 caller_14
-# SYMBOL: 1002003c 8 FUNC LOCAL DEFAULT 2 __toc_save_callee
+# SYMBOL: 10020040 8 FUNC LOCAL DEFAULT 2 __toc_save_callee
# CHECK-LABEL: callee
# CHECK: blr
# CHECK-LABEL: caller
-# CHECK: bl 0x1002003c
+# CHECK: bl 0x10020040
# CHECK-NEXT: ld 2, 24(1)
# CHECK-NEXT: blr
# CHECK-LABEL: caller_14
-# CHECK: bfl 0, 0x1002003c
+# CHECK: bfl 0, 0x10020040
# CHECK-NEXT: ld 2, 24(1)
# CHECK-NEXT: blr
diff --git a/lld/test/ELF/ppc64-toc-restore-recursive-call.s b/lld/test/ELF/ppc64-toc-restore-recursive-call.s
index a49705a2b654..c700d71573b9 100644
--- a/lld/test/ELF/ppc64-toc-restore-recursive-call.s
+++ b/lld/test/ELF/ppc64-toc-restore-recursive-call.s
@@ -15,10 +15,10 @@
# with non-recursive calls.
# CHECK-LABEL: 0000000000010290 <recursive_func>:
-# CHECK: 102b8: bl 0x102d8
+# CHECK: 102b8: bl 0x102e0
# CHECK-NEXT: ld 2, 24(1)
-# CHECK-LABEL: 00000000000102d8 <__plt_recursive_func>:
+# CHECK-LABEL: 00000000000102e0 <__plt_recursive_func>:
.abiversion 2
.section ".text"
diff --git a/lld/test/ELF/ppc64-toc-restore.s b/lld/test/ELF/ppc64-toc-restore.s
index dec760903632..af041232c201 100644
--- a/lld/test/ELF/ppc64-toc-restore.s
+++ b/lld/test/ELF/ppc64-toc-restore.s
@@ -29,7 +29,7 @@ _start:
nop
bl bar_local
// CHECK-LABEL: <_start>:
-// CHECK-NEXT: 100102c8: bl 0x10010304
+// CHECK-NEXT: 100102c8: bl 0x10010310
// CHECK-NEXT: 100102cc: ld 2, 24(1)
// CHECK-NEXT: 100102d0: bl 0x100102c0
// CHECK-EMPTY:
@@ -61,5 +61,5 @@ last:
bl foo
nop
// CHECK-LABEL: <last>:
-// CHECK-NEXT: 100102e4: bl 0x10010304
+// CHECK-NEXT: 100102e4: bl 0x10010310
// CHECK-NEXT: 100102e8: ld 2, 24(1)
More information about the llvm-commits
mailing list