aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAndre Vieira <andre.simoesdiasvieira@arm.com>2019-05-21 14:49:03 +0100
committerAndre Vieira <andre.simoesdiasvieira@arm.com>2019-05-21 14:53:49 +0100
commite6f65e7573a317ac4efff26fe0e49fe1b9e7a596 (patch)
treee12394a240761592fb54c179256bf96004ffe34e /bfd
parent739b5c9c778dee9e2f54d864f83a81ecb0639535 (diff)
downloadgdb-e6f65e7573a317ac4efff26fe0e49fe1b9e7a596.zip
gdb-e6f65e7573a317ac4efff26fe0e49fe1b9e7a596.tar.gz
gdb-e6f65e7573a317ac4efff26fe0e49fe1b9e7a596.tar.bz2
[binutils][Arm] Fix Branch Future relocation handling and testisms
bfd/ChangeLog: 2019-05-21 Andre Vieira <andre.simoesdiasvieira@arm.com> PR/target 24460 * elf32-arm.c (get_value_helper): Remove. (elf32_arm_final_link_relocate): Fix branch future relocations. gas/ChangeLog: 2019-05-21 Andre Vieira <andre.simoesdiasvieira@arm.com> * testsuite/gas/arm/armv8_1-m-bf.d: Allow different branch target naming conventions. * testsuite/gas/arm/armv8_1-m-bfl.d: Likewise. * testsuite/gas/arm/armv8_1-m-bfcsel.d: Likewise. * testsuite/gas/arm/armv8_1-m-loloop.d: Likewise. * testsuite/gas/arm/armv8_1-m-bf-rel.d: Skip for vxworks. * testsuite/gas/arm/armv8_1-m-bf-rela.d: New test. * testsuite/gas/arm/armv8_1-m-bfl-rel.d: Skip for vxworks. * testsuite/gas/arm/armv8_1-m-bfl-rela.d: New test. ld/ChangeLog: 2019-05-21 Andre Vieira <andre.simoesdiasvieira@arm.com> * testsuite/ld-arm/arm-elf.exp: Add tests * testsuite/ld-arm/bfs-0.s: New test. * testsuite/ld-arm/bfs-1.s: New test. * testsuite/ld-arm/branch-futures.d: New test.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-arm.c75
2 files changed, 12 insertions, 69 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2e7158f..81885bd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2019-05-21 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ PR 24460
+ * elf32-arm.c (get_value_helper): Remove.
+ (elf32_arm_final_link_relocate): Fix branch future relocations.
+
2019-05-21 Tamar Christina <tamar.christina@arm.com>
PR ld/24373
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 418458c..7f08526 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -10293,59 +10293,6 @@ identify_add_or_sub (bfd_vma insn)
return 0;
}
-/* Helper function to compute the Addend for Armv8.1-M Mainline relocations. */
-static bfd_vma
-get_value_helper (bfd_vma plt_offset,
- asection *splt,
- asection *input_section,
- asection *sym_sec,
- struct elf_link_hash_entry * h,
- struct bfd_link_info *info,
- bfd *input_bfd,
- Elf_Internal_Rela *rel,
- const char *sym_name,
- unsigned char st_type,
- struct elf32_arm_link_hash_table *globals,
- bfd_boolean *unresolved_reloc_p)
-{
- bfd_vma value = 0;
- enum arm_st_branch_type branch_type;
- enum elf32_arm_stub_type stub_type = arm_stub_none;
- struct elf32_arm_stub_hash_entry *stub_entry;
- struct elf32_arm_link_hash_entry *hash
- = (struct elf32_arm_link_hash_entry *)h;
-
-
- if (plt_offset != (bfd_vma) -1)
- {
- value = (splt->output_section->vma
- + splt->output_offset
- + plt_offset);
- value -= PLT_THUMB_STUB_SIZE;
- *unresolved_reloc_p = FALSE;
- }
-
- stub_type = arm_type_of_stub (info, input_section, rel,
- st_type, &branch_type,
- hash, value, sym_sec,
- input_bfd, sym_name);
-
- if (stub_type != arm_stub_none)
- {
- stub_entry = elf32_arm_get_stub_entry (input_section,
- sym_sec, h,
- rel, globals,
- stub_type);
- if (stub_entry != NULL)
- {
- value = (stub_entry->stub_offset
- + stub_entry->stub_sec->output_offset
- + stub_entry->stub_sec->output_section->vma);
- }
- }
- return value;
-}
-
/* Perform a relocation as part of a final link. */
static bfd_reloc_status_type
@@ -12968,14 +12915,10 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
addend |= (immC << 1);
addend |= 1;
/* Sign extend. */
- addend = (addend & 0x10000) ? addend - (1 << 17) : addend;
+ signed_addend = (addend & 0x10000) ? addend - (1 << 17) : addend;
}
- value = get_value_helper (plt_offset, splt, input_section, sym_sec, h,
- info, input_bfd, rel, sym_name, st_type,
- globals, unresolved_reloc_p);
-
- relocation = value + addend;
+ relocation = value + signed_addend;
relocation -= (input_section->output_section->vma
+ input_section->output_offset
+ rel->r_offset);
@@ -13014,13 +12957,10 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
addend |= 1;
/* Sign extend. */
addend = (addend & 0x1000) ? addend - (1 << 13) : addend;
+ signed_addend = addend;
}
- value = get_value_helper (plt_offset, splt, input_section, sym_sec, h,
- info, input_bfd, rel, sym_name, st_type,
- globals, unresolved_reloc_p);
-
- relocation = value + addend;
+ relocation = value + signed_addend;
relocation -= (input_section->output_section->vma
+ input_section->output_offset
+ rel->r_offset);
@@ -13059,13 +12999,10 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
addend |= 1;
/* Sign extend. */
addend = (addend & 0x40000) ? addend - (1 << 19) : addend;
+ signed_addend = addend;
}
- value = get_value_helper (plt_offset, splt, input_section, sym_sec, h,
- info, input_bfd, rel, sym_name, st_type,
- globals, unresolved_reloc_p);
-
- relocation = value + addend;
+ relocation = value + signed_addend;
relocation -= (input_section->output_section->vma
+ input_section->output_offset
+ rel->r_offset);