binutils-gdb/ld/testsuite/ld-powerpc/abs-reloc.s
Alan Modra 3a3a4c1fe4 PowerPC64 treatment of absolute symbols
Supporting -static-pie on PowerPC64 requires the linker to properly
treat SHN_ABS symbols for cases like glibc's _nl_current_LC_CTYPE_used
absolute symbol.  I've been slow to fix the linker on powerpc because
there is some chance that this will break some shared libraries or
PIEs.

bfd/
	* elf64-ppc.c (ppc64_elf_check_relocs): Consolidate local sym
	handling code.  Don't count dyn relocs against non-dynamic
	absolute symbols.
	(dec_dynrel_count): Adjust to suit.
	(ppc64_elf_edit_toc): Don't remove entries for absolute symbols
	when pic.
	(allocate_got): Don't allocate space for got relocs against
	non-dynamic absolute syms.
	(ppc64_elf_layout_multitoc): Likewise.
	(got_and_plt_relr): Likewise.
	(ppc64_elf_size_dynamic_sections): Likewise for local got.
	(got_and_plt_relr_for_local_syms): Likewise.
	(ppc64_elf_size_stubs): Don't allocate space for relr either.
	(ppc64_elf_relocate_section): Don't write relocs against non-dynamic
	absolute symbols.  Don't optimise got and toc code sequences
	loading absolute symbol entries.
ld/
	* testsuite/ld-powerpc/abs-reloc.s,
	* testsuite/ld-powerpc/abs-static.d,
	* testsuite/ld-powerpc/abs-static.r,
	* testsuite/ld-powerpc/abs-pie.d,
	* testsuite/ld-powerpc/abs-pie.r,
	* testsuite/ld-powerpc/abs-shared.d,
	* testsuite/ld-powerpc/abs-shared.r,
	* testsuite/ld-powerpc/abs-pie-relr.d,
	* testsuite/ld-powerpc/abs-pie-relr.r,
	* testsuite/ld-powerpc/abs-shared-relr.d,
	* testsuite/ld-powerpc/abs-shared-relr.r: New tests.
	* testsuite/ld-powerpc/powerpc.exp: Run them.
2022-02-03 13:40:41 +10:30

50 lines
652 B
ArmAsm

.globl x
.hidden x
.section .toc,"aw"
.p2align 3
.Lx:
.quad x
.La:
.quad a
.Lb:
.quad b
.Lc:
.quad c
.data
.p2align 3
x:
.quad x
.quad a
.quad b
.quad c
.text
.p2align 2
.globl _start
.type _start,@function
_start:
0:
addis 2,12,.TOC.-0b@ha
addi 2,2,.TOC.-0b@l
.localentry _start,.-_start
addis 3,2,.Lx@toc@ha
ld 3,.Lx@toc@l(3)
addis 4,2,.La@toc@ha
ld 4,.La@toc@l(4)
addis 5,2,.Lb@toc@ha
ld 5,.Lb@toc@l(5)
addis 6,2,.Lc@toc@ha
ld 6,.Lc@toc@l(6)
addis 7,2,x@got@ha
ld 7,x@got@l(7)
addis 8,2,a@got@ha
ld 8,a@got@l(8)
addis 9,2,b@got@ha
ld 9,b@got@l(9)
addis 10,2,c@got@ha
ld 10,c@got@l(10)
.size _start,.-_start