mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
f5b9c288a3
Undefined weak symbols with non-default visibility are seen as local by SYMBOL_REFERENCES_LOCAL. This stops a got indirect to relative optimisation for them, so that pies and dlls don't get non-zero values when loading somewhere other than the address they are linked at (which always happens). The optimisation could be allowed for pdes, but I thought it best not to allow it there too. bfd/ * elf64-ppc.c (ppc64_elf_relocate_section): Don't optimise got indirect to pc-relative or toc-relative for undefined symbols. ld/ * testsuite/ld-powerpc/weak1.d, * testsuite/ld-powerpc/weak1.r, * testsuite/ld-powerpc/weak1.s, * testsuite/ld-powerpc/weak1so.d, * testsuite/ld-powerpc/weak1so.r: New tests. * testsuite/ld-powerpc/powerpc.exp: Run them.
23 lines
387 B
ArmAsm
23 lines
387 B
ArmAsm
.weak x1, x2, x3, x4
|
|
.protected x2
|
|
.hidden x3
|
|
.internal x4
|
|
.global _start
|
|
_start:
|
|
pld 3,x1@got@pcrel
|
|
pld 3,x2@got@pcrel
|
|
pld 3,x3@got@pcrel
|
|
pld 3,x4@got@pcrel
|
|
ld 3,x1@got(2)
|
|
ld 3,x2@got(2)
|
|
ld 3,x3@got(2)
|
|
ld 3,x4@got(2)
|
|
addis 9,2,x1@got@ha
|
|
ld 3,x1@got@l(9)
|
|
addis 9,2,x2@got@ha
|
|
ld 3,x2@got@l(9)
|
|
addis 9,2,x3@got@ha
|
|
ld 3,x3@got@l(9)
|
|
addis 9,2,x4@got@ha
|
|
ld 3,x4@got@l(9)
|