aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2021-05-11 16:18:25 +0100
committerRichard Earnshaw <rearnsha@arm.com>2021-05-11 16:18:25 +0100
commitd8147d7053fa848f7f1ce6692c6788224d14869d (patch)
tree541fc885fddce6e96baccf98d83ba5f42b82237d /bfd
parentd30182b51edd04b9f09b1a79d429fc286458b221 (diff)
downloadgdb-d8147d7053fa848f7f1ce6692c6788224d14869d.zip
gdb-d8147d7053fa848f7f1ce6692c6788224d14869d.tar.gz
gdb-d8147d7053fa848f7f1ce6692c6788224d14869d.tar.bz2
arm: correctly decode Tag_THUMB_ISA_use=3 for thumb2 features
This was detected when a user accidentally tried to build a shared library using armv8-m.main objects. The resulting error was "warning: thumb-1 mode PLT generation not currently supported". Something was clearly wrong because v8-m.main is a thumb-2 variant. It turns out that the code to detect thumb-2 in object files hadn't been updated for the extended definition of Tag_THUMB_ISA_use to support the value 3, meaning 'work it out for yourself from the architecture tag'; something that is now necessary given that the line between thumb-1 and thumb-2 has become blurred over time. Another problem with the function doing this calculation was that the absence of this tag (implying a default value 0) should mean use of thumb code was NOT permitted. However, the code went on to look at the architecture flags and decide that it could ignore this if the architecture flags said that thumb2 features were available, thus completely ignoring the intended meaning. bfd/ * elf32-arm.c (using_thumb2): Correctly handle Tag_THUMB_ISA_use values 0 and 3.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf32-arm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 79b94e8..cb567fe 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -3888,9 +3888,11 @@ using_thumb2 (struct elf32_arm_link_hash_table *globals)
int thumb_isa = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
Tag_THUMB_ISA_use);
- if (thumb_isa)
+ /* No use of thumb permitted, or a legacy thumb-1/2 definition. */
+ if (thumb_isa < 3)
return thumb_isa == 2;
+ /* Variant of thumb is described by the architecture tag. */
arch = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC, Tag_CPU_arch);
/* Force return logic to be reviewed for each new architecture. */