aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-07-26 17:45:00 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2016-07-26 20:00:48 +0100
commit54806ffa85643c3a1ee721d5c3f5586d32f86ee1 (patch)
treef23e2aec8ed954c4650d21b5b46638c8c9523ec2 /bfd
parent40c31709c6a51926fcb409611caa52b2da6515c0 (diff)
downloadgdb-54806ffa85643c3a1ee721d5c3f5586d32f86ee1.zip
gdb-54806ffa85643c3a1ee721d5c3f5586d32f86ee1.tar.gz
gdb-54806ffa85643c3a1ee721d5c3f5586d32f86ee1.tar.bz2
MIPS/BFD: Handle branches in PLT compression selection
Complement: commit 1bbce132647e6d72aaa065cce5c1d5dd6585c2b2 Author: Maciej W. Rozycki <macro@linux-mips.org> Date: Mon Jun 24 23:55:46 2013 +0000 <https://sourceware.org/ml/binutils/2013-06/msg00077.html>, ("MIPS: Compressed PLT/stubs support"), and also choose between regular and compressed PLT entries as appropriate for any branches referring. bfd/ * elfxx-mips.c (mips_elf_calculate_relocation): Handle branches in PLT compression selection. (_bfd_mips_elf_check_relocs): Likewise. ld/ * testsuite/ld-mips-elf/compressed-plt-1.s: Add branch support. * testsuite/ld-mips-elf/compressed-plt-1a.s: Likewise. * testsuite/ld-mips-elf/compressed-plt-1b.s: Likewise. * testsuite/ld-mips-elf/compressed-plt-1-o32-branch.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-branch.rd: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.rd: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.rd: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.rd: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.rd: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elfxx-mips.c9
2 files changed, 12 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ab92c6c..0779178 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-07-26 Maciej W. Rozycki <macro@imgtec.com>
+
+ * elfxx-mips.c (mips_elf_calculate_relocation): Handle branches
+ in PLT compression selection.
+ (_bfd_mips_elf_check_relocs): Likewise.
+
2016-07-22 Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (relocate_fix_got_relocs_for_got_info): Handle the
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 5dcbcf9..cdc5d96 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -5585,7 +5585,8 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
case the symbol will have been set by mips_elf_set_plt_sym_value
to point to the standard PLT entry, so redirect to the compressed
one. */
- else if ((r_type == R_MIPS16_26 || r_type == R_MICROMIPS_26_S1)
+ else if ((mips16_branch_reloc_p (r_type)
+ || micromips_branch_reloc_p (r_type))
&& !bfd_link_relocatable (info)
&& h != NULL
&& h->use_plt_entry
@@ -8795,7 +8796,9 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
a PLT entry is not created because the symbol is satisfied
locally. */
if (h != NULL
- && jal_reloc_p (r_type)
+ && (branch_reloc_p (r_type)
+ || mips16_branch_reloc_p (r_type)
+ || micromips_branch_reloc_p (r_type))
&& !SYMBOL_CALLS_LOCAL (info, h))
{
if (h->plt.plist == NULL)
@@ -8803,7 +8806,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (h->plt.plist == NULL)
return FALSE;
- if (r_type == R_MIPS_26)
+ if (branch_reloc_p (r_type))
h->plt.plist->need_mips = TRUE;
else
h->plt.plist->need_comp = TRUE;