]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
arm: Handle undefweak with ST_BRANCH_UNKNOWN
authorChristophe Lyon <christophe.lyon@linaro.org>
Fri, 6 Sep 2024 17:10:02 +0000 (17:10 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Wed, 11 Sep 2024 15:34:32 +0000 (15:34 +0000)
commita77ccc81295f41b72f96db000d1aa44e4dc91254
treefe8e072af55498a7d07c80b9c601bf6c0e7ea6fe
parent1628e02267448cd82e219a60a4ed37cfa18fd35a
arm: Handle undefweak with ST_BRANCH_UNKNOWN

A previous patch made ld fail early on Thumb-only where branch_type is
ST_BRANCH_UNKNOWN.

However, this fails erroneously when the target is undefweak: in that
case the branch should be replaced by a branch to the next instruction
(or nop.w on thumb2).  This patch accepts this case and restores the
previous behaviour in such cases.

This was reported by failures in the GCC testsuite, where we fail to
link executables because __deregister_frame_info is undefweak:

(__deregister_frame_info): Unknown destination type (ARM/Thumb) in ...crtbegin.o
crtbegin.o: in function `__do_global_dtors_aux':
crtstuff.c:(.text+0x52): dangerous relocation: unsupported relocation
bfd/elf32-arm.c
ld/testsuite/ld-arm/arm-elf.exp
ld/testsuite/ld-arm/farcall-missing-type-main-undefweak.s [new file with mode: 0644]
ld/testsuite/ld-arm/farcall-missing-type-undefweak.d [new file with mode: 0644]