aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.h
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2024-06-19 12:35:30 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2024-09-04 13:35:10 +0000
commit31ed3a9d691493486f6e32357d89a55229dbdc0a (patch)
tree2f359f29f3f1684fc18a507b545df2e5709f0da1 /gdb/python/python.h
parent9a3781f12032153e27a38ec0894f8b663ed67306 (diff)
downloadbinutils-31ed3a9d691493486f6e32357d89a55229dbdc0a.zip
binutils-31ed3a9d691493486f6e32357d89a55229dbdc0a.tar.gz
binutils-31ed3a9d691493486f6e32357d89a55229dbdc0a.tar.bz2
arm: Do not insert stubs needing Arm code on Thumb-only cores.
We recently fixed a bug in libgcc (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115360) where a symbol was missing a %function .type decoration. This meant the linker would silently pick the wrong type of 'farcall stub', involving Arm-mode instructions on Thumb-only CPUs. This patch emits an error instead, and warns in some other cases, to encourage users to add the missing '.type foo,%function' directive. In practice: in arm_type_of_stub() we no longer try to infer which stub to use if the destination is of unknown type and the CPU is Thumb-only; so we won't lie to elf32_arm_size_stubs() which does not check branch_type. If branch_type is ST_BRANCH_TO_ARM but the CPU is Thumb-only, we now convert it to ST_BRANCH_TO_THUMB only if the destination is of absolute type. This is to support the case where the destination of the branch is defined by the linker script (see thumb-b-lks-sym.s and thumb-bl-lks-sym.s testcases for instance). The motivating case is covered by the new farcall-missing-type testcase, where we now emit an error message. We do not emit an error when branch_type is ST_BRANCH_UNKNOWN and the CPU supports Arm-mode: a lot of legacy code (e.g. newlib's crt0.S) lacks the corresponding '.type foo, %function' directives and even a (too verbose) warning could be perceived as a nuisance. Existing testcases where such a warning would trigger: arm-static-app.s (app_func, app_func2) arm-rel32.s (foo) arm-app.s (app_func) rel32-reject.s () main) fix-arm1176.s (func_to_branch_to) but this list is not exhaustive. For the sake of clarity, the patch replaces occurrences of sym.st_target_internal = 0; with sym.st_target_internal = ST_BRANCH_TO_ARM; enum arm_st_branch_type is defined in include/elf/arm.h, and relies on ST_BRANCH_TO_ARM==0, as sym.st_target_internal is also initialized to 0 in other target-independent parts of BFD code. (For instance, swapping the ST_BRANCH_TO_ARM and ST_BRANCH_TO_THUMB entries in the enum definition leads to 'interesting' results...) Regarding the testsuite: * new expected warning for thumb-b-lks-sym and thumb-bl-lks-sym * new testcase farcall-missing-type to check the new error case * attr-merge-arch-2b.s, branch-futures (and bfs-1.s) updated to avoid a diagnostic Tested on arm-eabi and arm-pe with no regression.
Diffstat (limited to 'gdb/python/python.h')
0 files changed, 0 insertions, 0 deletions