This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Don't relocate R_MIPS_JALR against dynamic symbols
- From: Adam Nemet <anemet at caviumnetworks dot com>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 3 Sep 2009 11:45:43 -0700
- Subject: Re: [PATCH] Don't relocate R_MIPS_JALR against dynamic symbols
- References: <19088.18512.864347.894300@ropi.home> <87tyztw08a.fsf@firetop.home> <19094.55734.991733.765587@ropi.home> <87hbvtvxt0.fsf@firetop.home>
Richard Sandiford writes:
> Adam Nemet <anemet@caviumnetworks.com> writes:
> > Richard Sandiford writes:
> >> ? I think we want:
> >>
> >> if (h != NULL && !SYMBOL_CALLS_LOCAL (info, h))
> >>
> >> instead.
> >
> > I'll try that. Should I check it in if it works (regtest, GCC bootstrap)?
>
> Yeah, please do.
This is what I've checked in after a GCC bootstrap with my R_MIPS_JALR
annotation changes and an ld regtest for mips64octeon-linux.
Sorry about the delay. Seems like I still made it before the branch.
Adam
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/bfd/ChangeLog,v
retrieving revision 1.4758
diff -F^\([(a-zA-Z0-9_]\|#define\) -u -p -r1.4758 ChangeLog
--- ChangeLog 3 Sep 2009 18:21:21 -0000 1.4758
+++ ChangeLog 3 Sep 2009 18:25:51 -0000
@@ -1,5 +1,10 @@
2009-09-03 Adam Nemet <anemet@caviumnetworks.com>
+ * elfxx-mips.c (mips_elf_calculate_relocation): Don't relocate
+ R_MIPS_JALR unless symbol resolves locally.
+
+2009-09-03 Adam Nemet <anemet@caviumnetworks.com>
+
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Don't set
has_static_relocs for R_MIPS_JALR.
Index: elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.259
diff -F^\([(a-zA-Z0-9_]\|#define\) -u -p -r1.259 elfxx-mips.c
--- elfxx-mips.c 3 Sep 2009 18:21:21 -0000 1.259
+++ elfxx-mips.c 3 Sep 2009 18:25:52 -0000
@@ -5489,8 +5489,8 @@ mips_elf_calculate_relocation (bfd *abfd
case R_MIPS_JALR:
/* This relocation is only a hint. In some cases, we optimize
it into a bal instruction. But we don't try to optimize
- branches to the PLT; that will wind up wasting time. */
- if (h != NULL && h->root.plt.offset != (bfd_vma) -1)
+ when the symbol does not resolve locally. */
+ if (h != NULL && !SYMBOL_CALLS_LOCAL (info, &h->root))
return bfd_reloc_continue;
value = symbol + addend;
break;