diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -2450,6 +2450,7 @@ 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 @@ -2504,9 +2505,10 @@ } 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; } } diff --git a/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s b/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s --- a/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s +++ b/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s @@ -37,7 +37,7 @@ # 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 @@ -59,7 +59,7 @@ # 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 diff --git a/lld/test/ELF/aarch64-gnu-ifunc-plt.s b/lld/test/ELF/aarch64-gnu-ifunc-plt.s --- a/lld/test/ELF/aarch64-gnu-ifunc-plt.s +++ b/lld/test/ELF/aarch64-gnu-ifunc-plt.s @@ -39,8 +39,8 @@ // DISASM: bar: // DISASM-NEXT: 2102dc: ret // DISASM: _start: -// DISASM-NEXT: 2102e0: bl #80 -// DISASM-NEXT: 2102e4: bl #92 +// DISASM-NEXT: 2102e0: bl #80 +// DISASM-NEXT: 2102e4: bl #92 // DISASM-NEXT: 2102e8: bl #40 // DISASM-NEXT: 2102ec: bl #52 // DISASM-EMPTY: @@ -67,6 +67,10 @@ // 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 diff --git a/lld/test/ELF/aarch64-gnu-ifunc.s b/lld/test/ELF/aarch64-gnu-ifunc.s --- a/lld/test/ELF/aarch64-gnu-ifunc.s +++ b/lld/test/ELF/aarch64-gnu-ifunc.s @@ -111,9 +111,9 @@ // 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 diff --git a/lld/test/ELF/aarch64-gnu-ifunc2.s b/lld/test/ELF/aarch64-gnu-ifunc2.s --- a/lld/test/ELF/aarch64-gnu-ifunc2.s +++ b/lld/test/ELF/aarch64-gnu-ifunc2.s @@ -16,9 +16,9 @@ # 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] diff --git a/lld/test/ELF/aarch64-ifunc-bti.s b/lld/test/ELF/aarch64-ifunc-bti.s --- a/lld/test/ELF/aarch64-ifunc-bti.s +++ b/lld/test/ELF/aarch64-ifunc-bti.s @@ -27,8 +27,10 @@ # 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] diff --git a/lld/test/ELF/arm-gnu-ifunc.s b/lld/test/ELF/arm-gnu-ifunc.s --- a/lld/test/ELF/arm-gnu-ifunc.s +++ b/lld/test/ELF/arm-gnu-ifunc.s @@ -37,7 +37,7 @@ // 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 @@ -128,7 +128,7 @@ // 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 diff --git a/lld/test/ELF/gnu-ifunc-canon.s b/lld/test/ELF/gnu-ifunc-canon.s --- a/lld/test/ELF/gnu-ifunc-canon.s +++ b/lld/test/ELF/gnu-ifunc-canon.s @@ -58,7 +58,7 @@ // 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 diff --git a/lld/test/ELF/gnu-ifunc-i386.s b/lld/test/ELF/gnu-ifunc-i386.s --- a/lld/test/ELF/gnu-ifunc-i386.s +++ b/lld/test/ELF/gnu-ifunc-i386.s @@ -75,7 +75,7 @@ // 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 @@ -93,7 +93,7 @@ // 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 @@ -118,7 +118,7 @@ // 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 diff --git a/lld/test/ELF/gnu-ifunc-plt-i386.s b/lld/test/ELF/gnu-ifunc-plt-i386.s --- a/lld/test/ELF/gnu-ifunc-plt-i386.s +++ b/lld/test/ELF/gnu-ifunc-plt-i386.s @@ -37,8 +37,8 @@ // DISASM: bar: // DISASM-NEXT: 4011b5: retl // DISASM: _start: -// DISASM-NEXT: 4011b6: calll 69 -// DISASM-NEXT: calll 80 +// DISASM-NEXT: 4011b6: calll 69 +// DISASM-NEXT: calll 80 // DISASM-NEXT: calll 27 // DISASM-NEXT: calll 38 // DISASM-EMPTY: @@ -61,6 +61,10 @@ // 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 -32 diff --git a/lld/test/ELF/gnu-ifunc-plt.s b/lld/test/ELF/gnu-ifunc-plt.s --- a/lld/test/ELF/gnu-ifunc-plt.s +++ b/lld/test/ELF/gnu-ifunc-plt.s @@ -62,6 +62,10 @@ // 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 -32 diff --git a/lld/test/ELF/gnu-ifunc-shared.s b/lld/test/ELF/gnu-ifunc-shared.s --- a/lld/test/ELF/gnu-ifunc-shared.s +++ b/lld/test/ELF/gnu-ifunc-shared.s @@ -39,6 +39,9 @@ // 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 -32 diff --git a/lld/test/ELF/gnu-ifunc.s b/lld/test/ELF/gnu-ifunc.s --- a/lld/test/ELF/gnu-ifunc.s +++ b/lld/test/ELF/gnu-ifunc.s @@ -102,9 +102,9 @@ // 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 -32 <_start+0x16> diff --git a/lld/test/ELF/linkerscript/orphan-report.s b/lld/test/ELF/linkerscript/orphan-report.s --- a/lld/test/ELF/linkerscript/orphan-report.s +++ b/lld/test/ELF/linkerscript/orphan-report.s @@ -34,7 +34,7 @@ # REPORT-NEXT: :(.rela.plt) is being placed in '.rela.plt' # REPORT-NEXT: :(.rela.dyn) is being placed in '.rela.dyn' # REPORT-NEXT: :(.plt) is being placed in '.plt' -# REPORT-NEXT: :(.plt) is being placed in '.plt' +# REPORT-NEXT: :(.iplt) is being placed in '.iplt' # REPORT-NEXT: :(.symtab) is being placed in '.symtab' # REPORT-NEXT: :(.symtab_shndx) is being placed in '.symtab_shndx' # REPORT-NEXT: :(.shstrtab) is being placed in '.shstrtab' diff --git a/lld/test/ELF/ppc32-call-stub-pic.s b/lld/test/ELF/ppc32-call-stub-pic.s --- a/lld/test/ELF/ppc32-call-stub-pic.s +++ b/lld/test/ELF/ppc32-call-stub-pic.s @@ -28,18 +28,18 @@ # 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 @@ -94,11 +94,11 @@ # 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 @@ -108,8 +108,8 @@ # 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 diff --git a/lld/test/ELF/ppc32-gnu-ifunc.s b/lld/test/ELF/ppc32-gnu-ifunc.s --- a/lld/test/ELF/ppc32-gnu-ifunc.s +++ b/lld/test/ELF/ppc32-gnu-ifunc.s @@ -1,4 +1,5 @@ # 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 diff --git a/lld/test/ELF/ppc32-tls-gd.s b/lld/test/ELF/ppc32-tls-gd.s --- a/lld/test/ELF/ppc32-tls-gd.s +++ b/lld/test/ELF/ppc32-tls-gd.s @@ -18,15 +18,15 @@ # 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 diff --git a/lld/test/ELF/ppc32-tls-ld.s b/lld/test/ELF/ppc32-tls-ld.s --- a/lld/test/ELF/ppc32-tls-ld.s +++ b/lld/test/ELF/ppc32-tls-ld.s @@ -11,7 +11,7 @@ # 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 diff --git a/lld/test/ELF/ppc64-dtprel.s b/lld/test/ELF/ppc64-dtprel.s --- a/lld/test/ELF/ppc64-dtprel.s +++ b/lld/test/ELF/ppc64-dtprel.s @@ -140,12 +140,12 @@ // 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 diff --git a/lld/test/ELF/ppc64-toc-relax-ifunc.s b/lld/test/ELF/ppc64-toc-relax-ifunc.s --- a/lld/test/ELF/ppc64-toc-relax-ifunc.s +++ b/lld/test/ELF/ppc64-toc-relax-ifunc.s @@ -14,15 +14,15 @@ ## 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,