mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-03-01 13:26:47 +08:00
This complements and reuses logic from Andreas Krebbel's commit
896a639bab
("s390: Avoid reloc overflows on undefined weak symbols").
Replace relative long addressing instructions of weak symbols, which
will definitely resolve to zero, with either a load address of 0 or a
a trapping insn.
This prevents the PLT32DBL relocation from overflowing in case the
binary will be loaded at 4GB or more.
bfd/
* elf64-s390.c (elf_s390_relocate_section): Replace
instructions using undefined weak symbols with relative
addressing to avoid relocation overflows.
ld/
* testsuite/ld-s390/s390.exp: Add new test.
* testsuite/ld-s390/weakundef-2.s: New test.
* testsuite/ld-s390/weakundef-2.dd: Likewise.
Reported-by: Alexander Gordeev <agordeev@linux.ibm.com>
Suggested-by: Ilya Leoshkevich <iii@linux.ibm.com>
Suggested-by: Andreas Krebbel <krebbel@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
18 lines
213 B
ArmAsm
18 lines
213 B
ArmAsm
.text
|
|
.globl foo
|
|
foo:
|
|
larl %r1,d@PLT
|
|
larl %r1,wd@PLT
|
|
larl %r1,wu@PLT
|
|
brasl %r14,d@PLT
|
|
brasl %r14,wd@PLT
|
|
brasl %r14,wu@PLT
|
|
.weak wu
|
|
.type d,@function
|
|
d:
|
|
br %r14
|
|
.weak wd
|
|
.type wd,@function
|
|
wd:
|
|
br %r14
|