]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
s390: Avoid reloc overflows on undefined weak symbols
authorAndreas Krebbel <krebbel@linux.ibm.com>
Tue, 27 Feb 2024 13:01:41 +0000 (14:01 +0100)
committerAndreas Krebbel <krebbel@linux.ibm.com>
Tue, 27 Feb 2024 13:07:17 +0000 (14:07 +0100)
commit896a639babe2d883467978abce7a4c55bc9f00ed
treea34555d413cf1725e980564cef66f03bcfda3cfa
parentd6a14e41381d0aa0a99c6796d3bd3677c80dfe06
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, a
NOP, or a trapping insn.

This prevents the PC32DBL relocation from overflowing in case the
binary will be loaded at 4GB or more.

bfd/ChangeLog:

* bfd/elf64-s390.c (elf_s390_relocate_section): Replace
instructions using undefined weak symbols with relative addressing
to avoid relocation overflows.

ld/ChangeLog:
* ld/testsuite/ld-s390/s390.exp:
* ld/testsuite/ld-s390/8GB.ld: New test.
* ld/testsuite/ld-s390/weakundef-1.dd: New test.
* ld/testsuite/ld-s390/weakundef-1.s: New test.
bfd/elf64-s390.c
ld/testsuite/ld-s390/8GB.ld [new file with mode: 0644]
ld/testsuite/ld-s390/s390.exp
ld/testsuite/ld-s390/weakundef-1.dd [new file with mode: 0644]
ld/testsuite/ld-s390/weakundef-1.s [new file with mode: 0644]