[patch bfd]: Some adjustments on coff-link.c

Alan Modra amodra@gmail.com
Mon Oct 10 03:09:00 GMT 2011


On Sun, Oct 09, 2011 at 09:18:25PM +0200, Kai Tietz wrote:
> This patch improves COFF linker for undefined weak symbols

I'm not sure this is a good idea.  Unix linkers generally don't
extract an archive member just to satisfy an undefined weak
reference.  I know some coff linkers do, but is it better to have GNU
ld consistent across targets, or more compatible with native linkers?
Another issue is that PE has IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY, so
your patch is wrong for that case.

> and avoids writing symbols for discarded sections - if linker tells so
> -, and for IR generated sections.
> 
> ChangeLog
> 
> 2011-10-09  Kai Tietz  <ktietz@redhat.com>
> 
>        * cofflink.c (coff_link_check_ar_symbols): Allow
>        adding of archive-file if symbol was undefined weak.
>        (_bfd_coff_write_global_sym): Skip write for symbol
>        in discared section, or if section is coming from IR, or
>        if input section has explicit SEC_EXCLUDED set.
>        (_bfd_coff_generic_relocate_section): For undefined weak
>        symbol and replacing it by another undefined weak, mark
>        section as absolute.

I'll OK the _bfd_coff_write_global_sym changes, but not the rest of
the patch dealing with undefined weak symbols.  A COFF maintainer
needs to decide on that.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list