]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
s390: Do not replace brcth referencing undefined weak symbol
authorJens Remus <jremus@linux.ibm.com>
Fri, 12 Jul 2024 14:53:47 +0000 (16:53 +0200)
committerJens Remus <jremus@linux.ibm.com>
Fri, 12 Jul 2024 14:53:47 +0000 (16:53 +0200)
commit83511d2679bbcc4b8d6ac42fb71cfbc35e77107e
tree0a02921cf0d56dc7c59826c496cea01337c57b14
parent7bdb051fd62ca70aa2cf549441b7728d20a3a631
s390: Do not replace brcth referencing undefined weak symbol

Branch Relative on Count High (brcth) is a conditional branch relative
instruction. It is not guaranteed that it only appears within loops
that sooner or later will take the branch. It may very well be used to
check a condition that will prevent the branch from ever being taken.

bfd/
* elf64-s390.c (elf_s390_relocate_section): Do not replace brcth
referencing undefined weak symbol with a trap.

ld/
* testsuite/ld-s390/weakundef-1.s: Update test case accordingly.
* testsuite/ld-s390/weakundef-1.dd: Likewise.

Fixes: 896a639babe2 ("s390: Avoid reloc overflows on undefined weak symbols")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
bfd/elf64-s390.c
ld/testsuite/ld-s390/weakundef-1.dd
ld/testsuite/ld-s390/weakundef-1.s