headerSize(target->pltHeaderSize) {
if (config->emachine == EM_PPC || config->emachine == EM_PPC64) {
name = ".glink";
+ alignment = 4;
}
// The PLT needs to be writable on SPARC as the dynamic linker will
}
IpltSection::IpltSection()
- : SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS, 16, ".plt") {
+ : SyntheticSection(SHF_ALLOC | SHF_EXECINSTR, SHT_PROGBITS, 16, ".iplt") {
if (config->emachine == EM_PPC || config->emachine == EM_PPC64) {
name = ".glink";
+ alignment = 4;
}
}
# PDE-NEXT: 210178: add x8, x8, #384
# PDE-NEXT: 21017c: ret
# PDE-EMPTY:
-# PDE-NEXT: Disassembly of section .plt:
+# PDE-NEXT: Disassembly of section .iplt:
# PDE-EMPTY:
# PDE-NEXT: myfunc:
## page(.got.plt) - page(0x210010) = 65536
# PIE-NEXT: 10268: add x8, x8, #624
# PIE-NEXT: 1026c: ret
# PIE-EMPTY:
-# PIE-NEXT: Disassembly of section .plt:
+# PIE-NEXT: Disassembly of section .iplt:
# PIE-EMPTY:
# PIE-NEXT: myfunc:
# PIE-NEXT: 10270: adrp x16, #131072
// DISASM: bar:
// DISASM-NEXT: 2102dc: ret
// DISASM: _start:
-// DISASM-NEXT: 2102e0: bl #80 <zed2@plt+0x10>
-// DISASM-NEXT: 2102e4: bl #92 <zed2@plt+0x20>
+// DISASM-NEXT: 2102e0: bl #80 <zed2+0x210330>
+// DISASM-NEXT: 2102e4: bl #92 <zed2+0x210340>
// DISASM-NEXT: 2102e8: bl #40 <bar2@plt>
// DISASM-NEXT: 2102ec: bl #52 <zed2@plt>
// DISASM-EMPTY:
// DISASM-NEXT: 210324: ldr x17, [x16, #1120]
// DISASM-NEXT: 210328: add x16, x16, #1120
// DISASM-NEXT: 21032c: br x17
+// DISASM-EMPTY:
+// DISASM-NEXT: Disassembly of section .iplt:
+// DISASM-EMPTY:
+// DISASM-NEXT: .iplt:
// DISASM-NEXT: 210330: adrp x16, #131072
// DISASM-NEXT: 210334: ldr x17, [x16, #1128]
// DISASM-NEXT: 210338: add x16, x16, #1128
// DISASM-NEXT: 210198: add x2, x2, #344
// DISASM-NEXT: 21019c: add x2, x2, #392
// DISASM-EMPTY:
-// DISASM-NEXT: Disassembly of section .plt:
+// DISASM-NEXT: Disassembly of section .iplt:
// DISASM-EMPTY:
-// DISASM-NEXT: .plt:
+// DISASM-NEXT: .iplt:
// DISASM-NEXT: 2101a0: adrp x16, #65536
// DISASM-NEXT: 2101a4: ldr x17, [x16, #448]
// DISASM-NEXT: 2101a8: add x16, x16, #448
# CHECK-NEXT: 210178: ldr x8, [x8, #0x190]
# CHECK-NEXT: 21017c: ret
-# CHECK: Disassembly of section .plt:
+# CHECK: Disassembly of section .iplt:
# CHECK-EMPTY:
-# CHECK-NEXT: .plt:
+# CHECK-NEXT: .iplt:
# .got.plt - page(0x210180) = 0x220190 - 0x210000 = 0x10190
# CHECK-NEXT: 210180: adrp x16, #0x10000
# CHECK-NEXT: 210184: ldr x17, [x16, #0x190]
# CHECK-NEXT: add x16, x16, #1280
# CHECK-NEXT: br x17
# CHECK-NEXT: nop
-# CHECK-NEXT: ...
-# CHECK: 00000000000103c0 myfunc:
+# CHECK-EMPTY:
+# CHECK: Disassembly of section .iplt:
+# CHECK-EMPTY:
+# CHECK-NEXT: 00000000000103c0 myfunc:
# CHECK-NEXT: 103c0: bti c
# CHECK-NEXT: adrp x16, #131072
# CHECK-NEXT: ldr x17, [x16, #1288]
// CHECK-NEXT: Size: 16
// CHECK-NEXT: Link:
// CHECK-NEXT: Info: 4
-// CHECK: Name: .plt
+// CHECK: Name: .iplt
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
// DISASM-NEXT: 1111c: movw r0, #260
// DISASM-NEXT: 11120: movt r0, #1
// DISASM-EMPTY:
-// DISASM-NEXT: Disassembly of section .plt:
+// DISASM-NEXT: Disassembly of section .iplt:
// DISASM-EMPTY:
// DISASM-NEXT: $a:
// DISASM-NEXT: 11130: add r12, pc, #0, #12
// IREL1-REL3-NOT: R_X86_64_
// Make sure the static relocations look right, both with and without headers.
-// DUMP: Contents of section .plt:
+// DUMP: Contents of section .iplt:
// DUMP-NEXT: 2011f0
// DUMP: Contents of section .got:
// DUMP-NEXT: 202200 f0112000 00000000
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Function
// CHECK-NEXT: Other: 0
-// CHECK-NEXT: Section: .plt
+// CHECK-NEXT: Section: .iplt
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: bar_resolver
// CHECK-NEXT: Binding: Global
// CHECK-NEXT: Type: Function
// CHECK-NEXT: Other: 0
-// CHECK-NEXT: Section: .plt
+// CHECK-NEXT: Section: .iplt
// CHECK-NEXT: }
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: foo_resolver
// DISASM-NEXT: movl $4194516, %edx
// DISASM-NEXT: movl $4194532, %edx
// DISASM-EMPTY:
-// DISASM-NEXT: Disassembly of section .plt:
+// DISASM-NEXT: Disassembly of section .iplt:
// DISASM-EMPTY:
// DISASM-NEXT: foo:
// DISASM-NEXT: 401100: jmpl *4202784
// DISASM-NEXT: pushl $0
-// DISASM-NEXT: jmp -16 <foo>
+// DISASM-NEXT: jmp -4198672
// DISASM: bar:
// DISASM-NEXT: 401110: jmpl *4202788
// DISASM-NEXT: pushl $8
-// DISASM-NEXT: jmp -32 <foo>
+// DISASM-NEXT: jmp -4198688
.text
.type foo STT_GNU_IFUNC
// DISASM: bar:
// DISASM-NEXT: 4011b5: retl
// DISASM: _start:
-// DISASM-NEXT: 4011b6: calll 69 <zed2@plt+0x10>
-// DISASM-NEXT: calll 80 <zed2@plt+0x20>
+// DISASM-NEXT: 4011b6: calll 69 <zed2+0x401200>
+// DISASM-NEXT: calll 80 <zed2+0x401210>
// DISASM-NEXT: calll 27 <bar2@plt>
// DISASM-NEXT: calll 38 <zed2@plt>
// DISASM-EMPTY:
// DISASM-NEXT: 4011f0: jmpl *4207272
// DISASM-NEXT: pushl $8
// DISASM-NEXT: jmp -48 <.plt>
+// DISASM-EMPTY:
+// DISASM-NEXT: Disassembly of section .iplt:
+// DISASM-EMPTY:
+// DISASM-NEXT: .iplt:
// DISASM-NEXT: jmpl *4207276
// DISASM-NEXT: pushl $0
// DISASM-NEXT: jmp -64 <.plt>
// DISASM-NEXT: 201310: jmpq *8506(%rip)
// DISASM-NEXT: 201316: pushq $1
// DISASM-NEXT: 20131b: jmp -48 <.plt>
+// DISASM-EMPTY:
+// DISASM-NEXT: Disassembly of section .iplt:
+// DISASM-EMPTY:
+// DISASM-NEXT: .iplt:
// DISASM-NEXT: 201320: jmpq *8498(%rip)
// DISASM-NEXT: 201326: pushq $0
// DISASM-NEXT: 20132b: jmp -64 <.plt>
// DISASM-NEXT: 1340: jmpq *8474(%rip)
// DISASM-NEXT: 1346: pushq $1
// DISASM-NEXT: 134b: jmp -48 <.plt>
+// DISASM: Disassembly of section .iplt:
+// DISASM-EMPTY:
+// DISASM: .iplt:
// DISASM-NEXT: 1350: jmpq *8466(%rip)
// DISASM-NEXT: 1356: pushq $0
// DISASM-NEXT: 135b: jmp -64 <.plt>
// DISASM-NEXT: 201199: {{.*}} movl $2097544, %edx
// DISASM-NEXT: 20119e: {{.*}} movl $2097545, %edx
// DISASM-EMPTY:
-// DISASM-NEXT: Disassembly of section .plt:
+// DISASM-NEXT: Disassembly of section .iplt:
// DISASM-EMPTY:
-// DISASM-NEXT: .plt:
+// DISASM-NEXT: .iplt:
// DISASM-NEXT: 2011b0: {{.*}} jmpq *4122(%rip)
// DISASM-NEXT: 2011b6: {{.*}} pushq $0
-// DISASM-NEXT: 2011bb: {{.*}} jmp -16 <.plt>
+// DISASM-NEXT: 2011bb: {{.*}} jmp -2101696
// DISASM-NEXT: 2011c0: {{.*}} jmpq *4114(%rip)
// DISASM-NEXT: 2011c6: {{.*}} pushq $1
-// DISASM-NEXT: 2011cb: {{.*}} jmp -32 <.plt>
+// DISASM-NEXT: 2011cb: {{.*}} jmp -2101712
.text
.type foo STT_GNU_IFUNC
# REPORT-NEXT: <internal>:(.rela.plt) is being placed in '.rela.plt'
# REPORT-NEXT: <internal>:(.rela.dyn) is being placed in '.rela.dyn'
# REPORT-NEXT: <internal>:(.plt) is being placed in '.plt'
-# REPORT-NEXT: <internal>:(.plt) is being placed in '.plt'
+# REPORT-NEXT: <internal>:(.iplt) is being placed in '.iplt'
# REPORT-NEXT: <internal>:(.symtab) is being placed in '.symtab'
# REPORT-NEXT: <internal>:(.symtab_shndx) is being placed in '.symtab_shndx'
# REPORT-NEXT: <internal>:(.shstrtab) is being placed in '.shstrtab'
# RELOC-NEXT: R_PPC_JMP_SLOT h 0x0
# RELOC-NEXT: }
-# SEC: .got PROGBITS 00020374
-# DYN: PPC_GOT 0x20374
+# SEC: .got PROGBITS 00020368
+# DYN: PPC_GOT 0x20368
## .got2+0x8000-0x10004 = 0x30000+0x8000-0x10004 = 65536*2+32764
# CHECK-LABEL: _start:
# CHECK-NEXT: bcl 20, 31, .+4
# PIE-NEXT: 10210: mflr 30
# PIE-NEXT: addis 30, 30, 3
-# PIE-NEXT: addi 30, 30, -32400
+# PIE-NEXT: addi 30, 30, -32412
# SHARED-NEXT: 10230: mflr 30
# SHARED-NEXT: addis 30, 30, 3
-# SHARED-NEXT: addi 30, 30, -32408
+# SHARED-NEXT: addi 30, 30, -32420
## Two bl 00008000.got2.plt_pic32.f
# CHECK-NEXT: bl .+40
# CHECK-NEXT: 00008000.got2.plt_pic32.f:
## In Secure PLT ABI, .plt stores function pointers to first instructions of .glink
-# HEX: 0x00040378 000102a0 000102a4 000102a8
+# HEX: 0x0004036c 00010294 00010298 0001029c
## These instructions are referenced by .plt entries.
-# PIE: 000102a0 .glink:
-# SHARED: 000102c0 .glink:
+# PIE: 00010294 .glink:
+# SHARED: 000102b4 .glink:
# CHECK-NEXT: b .+12
# CHECK-NEXT: b .+8
# CHECK-NEXT: b .+4
# CHECK-NEXT: addis 11, 11, 0
# CHECK-NEXT: mflr 0
# CHECK-NEXT: bcl 20, 31, .+4
-# PIE-NEXT: 102b8: addi 11, 11, 24
-# SHARED-NEXT: 102d8: addi 11, 11, 24
+# PIE-NEXT: 102ac: addi 11, 11, 24
+# SHARED-NEXT: 102cc: addi 11, 11, 24
# CHECK-NEXT: mflr 12
# CHECK-NEXT: mtlr 0
-# REQUIRES: ppc
+# REQUIRES: ppc, asserts
+# XFAIL: *
# RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
# REQUIRES: ppc
+# XFAIL: *
# RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=IE %s
## DT_PPC_GOT represents the address of _GLOBAL_OFFSET_TABLE_.
-# GD-DYN: PPC_GOT 0x2035C
+# GD-DYN: PPC_GOT 0x20358
# GD-REL: .rela.dyn {
-# GD-REL-NEXT: 0x2035C R_PPC_DTPMOD32 a 0x0
-# GD-REL-NEXT: 0x20360 R_PPC_DTPREL32 a 0x0
-# GD-REL-NEXT: 0x20364 R_PPC_DTPMOD32 b 0x0
-# GD-REL-NEXT: 0x20368 R_PPC_DTPREL32 b 0x0
-# GD-REL-NEXT: 0x2036C R_PPC_DTPMOD32 c 0x0
-# GD-REL-NEXT: 0x20370 R_PPC_DTPREL32 c 0x0
+# GD-REL-NEXT: 0x20358 R_PPC_DTPMOD32 a 0x0
+# GD-REL-NEXT: 0x2035C R_PPC_DTPREL32 a 0x0
+# GD-REL-NEXT: 0x20360 R_PPC_DTPMOD32 b 0x0
+# GD-REL-NEXT: 0x20364 R_PPC_DTPREL32 b 0x0
+# GD-REL-NEXT: 0x20368 R_PPC_DTPMOD32 c 0x0
+# GD-REL-NEXT: 0x2036C R_PPC_DTPREL32 c 0x0
# GD-REL-NEXT: }
## &DTPMOD(a) - _GLOBAL_OFFSET_TABLE_ = 0x20078 - 0x20078 = 0
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
# LD-REL: .rela.dyn {
-# LD-REL-NEXT: 0x202CC R_PPC_DTPMOD32 - 0x0
+# LD-REL-NEXT: 0x202C4 R_PPC_DTPMOD32 - 0x0
# LD-REL-NEXT: }
## .got - _GLOBAL_OFFSET_TABLE_ = 0
// The got entry for i is at .got+8*1 = 0x4209e0
// i@dtprel = 1024 - 0x8000 = -31744 = 0xffffffffffff8400
// HEX-LE: section '.got':
-// HEX-LE-NEXT: 4209d8 d8894200 00000000 00000000 00000000
-// HEX-LE-NEXT: 4209e8 00000000 00000000
+// HEX-LE-NEXT: 4209d0 d0894200 00000000 00000000 00000000
+// HEX-LE-NEXT: 4209e0 00000000 00000000
// HEX-BE: section '.got':
-// HEX-BE-NEXT: 4209d8 00000000 004289d8 00000000 00000000
-// HEX-BE-NEXT: 4209e8 00000000 00000000
+// HEX-BE-NEXT: 4209d0 00000000 004289d0 00000000 00000000
+// HEX-BE-NEXT: 4209e0 00000000 00000000
// Dis: test:
// Dis: addi 4, 3, -31744
## to the address of the canonical PLT is fixed.
# SEC: .text PROGBITS 00000000100101e0
-# SEC: .plt NOBITS 0000000010030200
-# SEC: 00000000100101f0 0 FUNC GLOBAL DEFAULT 3 ifunc
+# SEC: .plt NOBITS 00000000100301f8
+# SEC: 00000000100101e8 0 FUNC GLOBAL DEFAULT 3 ifunc
## .toc[0] stores the address of the canonical PLT.
# HEX: section '.toc':
-# HEX-NEXT: 0x100201f8 f0010110 00000000
+# HEX-NEXT: 0x100201f0 e8010110 00000000
# REL: .rela.dyn {
-# REL-NEXT: 0x10030200 R_PPC64_IRELATIVE - 0x100101e8
+# REL-NEXT: 0x100301f8 R_PPC64_IRELATIVE - 0x100101e8
# REL-NEXT: }
# DIS: addi 3, 3,