aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2016-09-22 16:36:20 +0100
committerThomas Preud'homme <thomas.preudhomme@arm.com>2016-09-22 16:45:24 +0100
commita08f609340d6d2b69d981f72b7900398f3816346 (patch)
treeedb901d803189f8dec71c8064665baee231863e5
parent35f401d187dee61fb83e626527ef46fcd5c0fc16 (diff)
downloadgdb-a08f609340d6d2b69d981f72b7900398f3816346.zip
gdb-a08f609340d6d2b69d981f72b7900398f3816346.tar.gz
gdb-a08f609340d6d2b69d981f72b7900398f3816346.tar.bz2
Fix feature checks based on ARM architecture value
2016-09-22 Andre Vieira <andre.simoesdiasvieira@arm.com> Backport from mainline 2016-06-14 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * elf32-arm.c (using_thumb_only): Force review of arch check logic for new architecture. (using_thumb2): Try Tag_THUMB_ISA_use first and check for exact arch value then. Force review of arch check logic for new architecture. (arch_has_arm_nop): Update and fix arch check logic. Force review of that logic for new architecture. (arch_has_thumb2_nop): Remove. (elf32_arm_tls_relax): Use using_thumb2 instead of above function. (elf32_arm_final_link_relocate): Likewise but using thumb2.
-rw-r--r--bfd/ChangeLog.arm16
-rw-r--r--bfd/elf32-arm.c52
2 files changed, 51 insertions, 17 deletions
diff --git a/bfd/ChangeLog.arm b/bfd/ChangeLog.arm
index c772818..e96a7f6 100644
--- a/bfd/ChangeLog.arm
+++ b/bfd/ChangeLog.arm
@@ -1,5 +1,21 @@
2016-09-22 Andre Vieira <andre.simoesdiasvieira@arm.com>
+ Backport from mainline
+ 2016-06-14 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * elf32-arm.c (using_thumb_only): Force review of arch check logic for
+ new architecture.
+ (using_thumb2): Try Tag_THUMB_ISA_use first and check
+ for exact arch value then. Force review of arch check logic for new
+ architecture.
+ (arch_has_arm_nop): Update and fix arch check logic. Force review of
+ that logic for new architecture.
+ (arch_has_thumb2_nop): Remove.
+ (elf32_arm_tls_relax): Use using_thumb2 instead of above function.
+ (elf32_arm_final_link_relocate): Likewise but using thumb2.
+
+2016-09-22 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
* elf32-arm.c (arm_new_stubs_start_offset_ptr): Add case for
arm_stub_long_branch_thumb2_only.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index f5f4b49..5688898 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -3498,6 +3498,11 @@ using_thumb_only (struct elf32_arm_link_hash_table *globals)
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. */
+ BFD_ASSERT (arch <= TAG_CPU_ARCH_V8
+ || arch == TAG_CPU_ARCH_V8M_BASE
+ || arch == TAG_CPU_ARCH_V8M_MAIN);
+
if (arch == TAG_CPU_ARCH_V6_M
|| arch == TAG_CPU_ARCH_V6S_M
|| arch == TAG_CPU_ARCH_V7E_M
@@ -3513,9 +3518,25 @@ using_thumb_only (struct elf32_arm_link_hash_table *globals)
static bfd_boolean
using_thumb2 (struct elf32_arm_link_hash_table *globals)
{
- int arch = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
- Tag_CPU_arch);
- return arch == TAG_CPU_ARCH_V6T2 || arch >= TAG_CPU_ARCH_V7;
+ int arch;
+ int thumb_isa = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
+ Tag_THUMB_ISA_use);
+
+ if (thumb_isa)
+ return thumb_isa == 2;
+
+ 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. */
+ BFD_ASSERT (arch <= TAG_CPU_ARCH_V8
+ || arch == TAG_CPU_ARCH_V8M_BASE
+ || arch == TAG_CPU_ARCH_V8M_MAIN);
+
+ return (arch == TAG_CPU_ARCH_V6T2
+ || arch == TAG_CPU_ARCH_V7
+ || arch == TAG_CPU_ARCH_V7E_M
+ || arch == TAG_CPU_ARCH_V8
+ || arch == TAG_CPU_ARCH_V8M_MAIN);
}
/* Create .plt, .rel(a).plt, .got, .got.plt, .rel(a).got, .dynbss, and
@@ -3717,19 +3738,16 @@ arch_has_arm_nop (struct elf32_arm_link_hash_table *globals)
{
const int arch = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
Tag_CPU_arch);
- return arch == TAG_CPU_ARCH_V6T2
- || arch == TAG_CPU_ARCH_V6K
- || arch == TAG_CPU_ARCH_V7
- || arch == TAG_CPU_ARCH_V7E_M;
-}
-static bfd_boolean
-arch_has_thumb2_nop (struct elf32_arm_link_hash_table *globals)
-{
- const int arch = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
- Tag_CPU_arch);
- return (arch == TAG_CPU_ARCH_V6T2 || arch == TAG_CPU_ARCH_V7
- || arch == TAG_CPU_ARCH_V7E_M);
+ /* Force return logic to be reviewed for each new architecture. */
+ BFD_ASSERT (arch <= TAG_CPU_ARCH_V8
+ || arch == TAG_CPU_ARCH_V8M_BASE
+ || arch == TAG_CPU_ARCH_V8M_MAIN);
+
+ return (arch == TAG_CPU_ARCH_V6T2
+ || arch == TAG_CPU_ARCH_V6K
+ || arch == TAG_CPU_ARCH_V7
+ || arch == TAG_CPU_ARCH_V8);
}
static bfd_boolean
@@ -9603,7 +9621,7 @@ elf32_arm_tls_relax (struct elf32_arm_link_hash_table *globals,
if (!is_local)
/* add r0,pc; ldr r0, [r0] */
insn = 0x44786800;
- else if (arch_has_thumb2_nop (globals))
+ else if (using_thumb2 (globals))
/* nop.w */
insn = 0xf3af8000;
else
@@ -10434,7 +10452,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
if (h && h->root.type == bfd_link_hash_undefweak
&& plt_offset == (bfd_vma) -1)
{
- if (arch_has_thumb2_nop (globals))
+ if (thumb2)
{
bfd_put_16 (input_bfd, 0xf3af, hit_data);
bfd_put_16 (input_bfd, 0x8000, hit_data + 2);