[3/6] Fix overcounting of ARM PLT references

H.J. Lu hjl.tools@gmail.com
Thu May 31 21:10:00 GMT 2012


On Fri, Mar 4, 2011 at 8:07 AM, Richard Sandiford
<richard.sandiford@linaro.org> wrote:
> If a shared object has only non-call references to a function that is
> defined in the same shared object, we will nevertheless generate an
> unused PLT entry for it.  This is due to some overeager counting in
> elf32_arm_check_relocs.
>
> The patch below restructures check_relocs and its gc_sweep_hook
> counterpart to make things a little more obvious (I hope).
> This also makes it easier to slip in the ifunc handling.
> I've kept a fair bit of the existing commentary, but moved
> it around.
>
> Note that the R_ARM_ABS12 case was misplaced: it fell through
> into the PLT relocs instead of the absolute relocs.
>
> Tested on arm-linux-gnueabi.  OK to install?
>
> Richard
>
>
> bfd/
>        * elf32-arm.c (elf32_arm_check_relocs): Use call_reloc_p,
>        may_need_local_target_p and may_become_dynamic_p to classify
>        the relocation type.  Don't check info->symbolic or h->def_regular
>        when deciding whether to record a potential dynamic reloc.
>        Don't treat potential dynamic relocs as PLT references.
>        (elf32_arm_gc_sweep_hook): Update to match.  Assert that we don't
>        try to make the PLT reference count go negative.
>

This caused:

http://sourceware.org/bugzilla/show_bug.cgi?id=14189

-- 
H.J.



More information about the Binutils mailing list