PATCH: PR ld/13177: garbage collector retains zombie references to external libraries

H.J. Lu hjl.tools@gmail.com
Mon Oct 17 17:21:00 GMT 2011


On Mon, Oct 17, 2011 at 12:28 AM, Alan Modra <amodra@gmail.com> wrote:
> HJ,
>  Your patch for PR13177 causes
> hppa-linux  +FAIL: --gc-sections with __start_
> mips64-linux  +FAIL: --gc-sections with __start_
> mipsel-linux-gnu  +FAIL: --gc-sections with __start_
> mipsisa32el-linux  +FAIL: --gc-sections with __start_
> mips-linux  +FAIL: --gc-sections with __start_
> powerpc64-linux  +FAIL: --gc-sections with __start_
>
> The failures show up because __start__foo is undefined when
> lang_gc_sections runs (the symbol is defined later in
> lang_place_orphans).  This exposes an error in the way you treat
> undefined symbols.  Not all ABIs require an undefined symbol reference
> to generate a PLT entry.  You only need one when there is a function
> call, or when the address of a function is taken and the ABI defines
> the address to be the PLT entry in the executable
> (ptr_equality_needed case).  So it is quite reasonable for
> __start__foo to have a plt.refcount of zero in elf_gc_sweep_symbol.
>
> I'm testing the following.
>
>        PR ld/13177
>        * elflink.c (_bfd_elf_gc_mark_rsec): Set symbol "mark".
>        (elf_gc_sweep_symbol): Don't test plt/got refcounts, instead test
>        "mark".  Hide undefweak too.
>        (elf_link_output_extsym): Correct test for warning when forced local
>        executable syms are referenced from shared libraries.
>

Should we make elf_gc_sweep_symbol target dependent to take ABI
differences into account?


-- 
H.J.



More information about the Binutils mailing list