Fix PR12762 using linkonce sections in plugin bfd
H.J. Lu
hjl.tools@gmail.com
Tue Aug 16 18:04:00 GMT 2011
On Sat, Aug 13, 2011 at 7:31 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sat, Aug 13, 2011 at 2:59 AM, Alan Modra <amodra@gmail.com> wrote:
>> Revised patch. This one gives the plugin comdat_key symbols sections
>> named .gnu.linkonce.t.<comdat_key>, so that SEC_LINK_ONCE gets set for
>> the sections when recreating them during bfd_make_readable().
>>
>> I've also given the COFF backend its own bfd_section_already_linked
>> and tidied the existing bfd_section_already_linked functions. I'd
>> appreciate someone familiar with our COFF support reviewing
>> _bfd_coff_section_already_linked in case I've made some glaring
>> mistakes.. The old code basically matched on section name, but if
>> both sections had a comdat symbol then the symbols had to match too.
>> That meant a comdat section could match a non-comdat section with the
>> same name, something the new code specifically disallows, and anyway
>> is a side-effect of hashing on the comdat key. COFF also gets the
>> benefit of the ELF code for SEC_LINK_DUPLICATES_SAME_CONTENTS, so
>> section contents are actually checked now.
>>
>> bfd/
>> PR ld/12762
>> * bfd-in.h (struct bfd_section_already_linked): Forward declare.
>> (_bfd_handle_already_linked): Declare.
>> * coff-alpha.c (_bfd_ecoff_section_already_linked): Define as
>> _bfd_coff_section_already_linked.
>> * coff-mips.c (_bfd_ecoff_section_already_linked): Likewise.
>> * coffcode.h (coff_section_already_linked): Likewise.
>> * cofflink.c (coff_link_add_symbols): Revert 2011-07-09 changes.
>> * elf-bfd.h: Likewise.
>> * libbfd-in.h: Likewise.
>> * targets.c: Likewise.
>> * linker.c (bfd_section_already_linked): Likewise.
>> (bfd_section_already_linked_table_lookup): Likewise.
>> (bfd_section_already_linked_table_insert): Likewise.
>> (_bfd_generic_section_already_linked): Likewise. Call
>> _bfd_handle_already_linked.
>> (_bfd_handle_already_linked): New function, split out from..
>> * elflink.c (_bfd_elf_section_already_linked): ..here. Revert
>> 2011-07-09 changes. Avoid unnecessary strcmp when matching
>> already_linked_list entries. Match plugin linkonce section.
>> (section_signature): Delete.
>> * coffgen.c (_bfd_coff_section_already_linked): New function.
>> * libcoff-in.h (_bfd_coff_section_already_linked): Declare.
>> * libbfd.h: Regenerate.
>> * libcoff.h: Regenerate.
>> * bfd-in2.h: Regenerate.
>> ld/
>> PR ld/12762
>> * ldlang.c (section_already_linked): Revert 2011-07-09 changes.
>> * plugin.c: Likewise.
>> (asymbol_from_plugin_symbol): Create linkonce section for syms
>> with comdat_key.
>>
>
> It works.
>
I got:
ld: BFD (Linux/GNU Binutils) 2.21.53.0.3.20110813 assertion fail
/net/gnu-6/export/linux/src/binutils/binutils/bfd/elflink.c:12634
on a Linux/x86-64 kernel driver build.
--
H.J.
More information about the Binutils
mailing list