binutils-gdb/ld/testsuite/ld-s390
Jens Remus 6f8b365b65 s390: Avoid reloc overflows on undefined weak symbols (cont)
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>
2024-07-12 16:53:47 +02:00
..
8GB.ld
gotreloc_31-1.dd
gotreloc_31-no-pie-1.dd
gotreloc_64-no-pie-1.dd
gotreloc_64-norelro-1.dd
gotreloc_64-relro-1.dd
gotreloc-1.s
gotreloc-1.ver
pltoffset-1.dd
pltoffset-1.ld
pltoffset-1.s
pr26918-1.d
pr26918-1.s
reloccheck-1.d
reloccheck-1.s
reloctlsle-1.d
reloctlsle-1.s
s390.exp s390: Avoid reloc overflows on undefined weak symbols (cont) 2024-07-12 16:53:47 +02:00
tlsbin_64.dd
tlsbin_64.rd
tlsbin_64.s
tlsbin_64.sd
tlsbin_64.td
tlsbin.dd
tlsbin.rd
tlsbin.s
tlsbin.sd
tlsbin.td
tlsbinpic_64.s
tlsbinpic.s
tlslib_64.s
tlslib.s
tlspic1_64.s
tlspic1.s
tlspic2_64.s
tlspic2.s
tlspic_64.dd
tlspic_64.rd
tlspic_64.sd
tlspic_64.td
tlspic.dd
tlspic.rd
tlspic.sd
tlspic.td
weakundef-1.dd s390: Do not replace brcth referencing undefined weak symbol 2024-07-12 16:53:47 +02:00
weakundef-1.s s390: Do not replace brcth referencing undefined weak symbol 2024-07-12 16:53:47 +02:00
weakundef-2.dd s390: Avoid reloc overflows on undefined weak symbols (cont) 2024-07-12 16:53:47 +02:00
weakundef-2.s s390: Avoid reloc overflows on undefined weak symbols (cont) 2024-07-12 16:53:47 +02:00