[arm] branches to weak symbols
Tue May 4 16:07:00 GMT 2010
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 <email@example.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
/* 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)
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?
More information about the Binutils