This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [arm] branches to weak symbols
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: Nathan Sidwell <nathan at codesourcery dot com>, binutils <binutils at sources dot redhat dot com>, Paul Brook <paul at codesourcery dot com>
- Date: Tue, 4 May 2010 12:07:36 -0400
- Subject: Re: [arm] branches to weak symbols
- References: <4BD7F68D.9070102@codesourcery.com> <4BD99B84.4090502@redhat.com>
On Thu, Apr 29, 2010 at 03:45:24PM +0100, Nick Clifton wrote:
> Hi Nathan,
>
> >This patch fixes some arm cases where the assembler did not consider
> >that a weakly defined symbol might be overridden in the final link.
>
> >2010-04-28 Nathan Sidwell <nathan@codesourcery.com>
> >
> > * write.c (fixup_segment): Do not assume we know the section a
> > defined weak symbol is in.
> > * config/tc-arm.c (relax_adr, relax_branch, md_apply_fix): Treat
> > weak symbols as not known to be in the same section, even if they
> > are defined.
> >
> > testsuite/
> > * gas/arm/weakdef-1.s: New.
> > * gas/arm/weakdef-1.d: New.
> > * gas/arm/weakdef-2.s: New.
> > * gas/arm/weakdef-2.d: New.
> > * gas/arm/weakdef-2.l: New.
>
> Approved and applied. Note - I made one small change which was to
> disable the new tests for non-ELF targeted ARM toolchains.
I have to agree with Alan that the write.c change is not correct
(specifically, I think it will not catch the other cases checked for
in generic_force_reloc, like IFUNC). The current behavior is
deliberate:
/* Resolve these relocations even if the symbol is extern or weak. */
if (fixp->fx_r_type == BFD_RELOC_ARM_IMMEDIATE
|| fixp->fx_r_type == BFD_RELOC_ARM_OFFSET_IMM
|| fixp->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE
|| fixp->fx_r_type == BFD_RELOC_ARM_T32_ADD_IMM
|| fixp->fx_r_type == BFD_RELOC_ARM_T32_IMMEDIATE
|| fixp->fx_r_type == BFD_RELOC_ARM_T32_IMM12
|| fixp->fx_r_type == BFD_RELOC_ARM_T32_ADD_PC12)
return 0;
I believe it's that last relocation type in this case?
This block was originally added for those first three relocations. I
don't know why; it was part of the big Thumb-2 commit. Paul extended
the list when implementing some relaxation.
Paul, do you know what this change was for?
--
Daniel Jacobowitz
CodeSourcery