PATCH: Enable 2 stage linking and support "ld -r" on mixed IR objects in BFD linker

H.J. Lu hjl.tools@gmail.com
Sat Dec 11 17:49:00 GMT 2010


On Fri, Dec 10, 2010 at 5:27 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> This patch enables 2 stage linking and supports "ld -r" on mixed IR
> objects in BFD linker. It provides transparent LTO support in BFD
> linker.  No GCC changes are required.
>
> Any comments?
>
> Thanks.
>

The linker spec is at:

http://www.kernel.org/pub/linux/devel/gcc/lto/mixed-IR/mixed-IR.pdf

BFD linker in the Linux binutils will have the full and transparent LTO
support.


H.J.
--
> ---
> bfd/
>
> 2010-12-10  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR ld/12248
>        PR ld/12277
>        PR ld/12291
>        * bfd.c (bfd_lto_object_type): New.
>        (BFD_PLUGIN): Likewise.
>        (BFD_PLUGIN_DUMMY): Likewise.
>        (bfd_group_signature): Likewise.
>        (BFD_FLAGS_SAVED): Add BFD_PLUGIN and BFD_PLUGIN_DUMMY.
>        (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.
>        (bfd): Add object_only_section and lto_type.
>
>        * elf.c (special_sections_g): Add ".gnu.lto" and .gnu_object_only.
>        (_bfd_elf_get_special_section): Allow `_' as separator.
>
>        * elflink.c (elf_link_add_archive_symbols): Remove subsbfd.
>
>        * format.c (bfd_set_lto_type): New.
>        (bfd_check_format_matches): Use it.
>
>        * section.c (GNU_OBJECT_ONLY_SECTION_NAME): New.
>
>        * bfd-in2.h: Regenerated.
>
> binutils/
>
> 2010-12-10  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR ld/12248
>        PR ld/12277
>        PR ld/12291
>        * objcopy.c (group_signature): Removed.
>        (is_strip_section): Replace group_signature with
>        bfd_group_signature.
>        (setup_section): Likewise.
>
>        * readelf.c (get_section_type_name): Handle SHT_GNU_OBJECT_ONLY.
>
> gas/testsuite/
>
> 2010-12-10  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR ld/12248
>        PR ld/12277
>        PR ld/12291
>        * gas/elf/elf.exp: Run section9.
>
>        * gas/elf/section9.d: New.
>        * gas/elf/section9.s: Likewise.
>
> include/
>
> 2010-12-10  H.J. Lu  <hongjiu.lu@intel.com>
>
>        * bfdlink.h (bfd_link_info): Add emit_gnu_object_only and
>        emitting_gnu_object_only.
>
> include/elf/
>
> 2010-12-10  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR ld/12248
>        PR ld/12277
>        PR ld/12291
>        * common.h (SHT_GNU_OBJECT_ONLY): New.
>
> ld/
>
> 2010-12-10  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR ld/12248
>        PR ld/12277
>        PR ld/12291
>        * ldfile.c: Updated for 2 stage linking and support for mixed
>        IR/non-IR objects.
>        * ldlang.c: Likewise.
>
>        * ldlang.h (lang_input_statement_struct): Add stage1.
>        (lang_init): Take a bfd_boolean argument.
>        (cmdline_enum_type): New.
>        (cmdline_header_type): Likewise.
>        (cmdline_input_statement_type): Likewise.
>        (cmdline_file_type): Likewise.
>        (cmdline_bfd_type): Likewise.
>        (cmdline_union_type): Likewise.
>        (cmdline_list_type): Likewise.
>        (cmdline_option_append): Likewise.
>        (cmdline_option_insert_claimed_output): Likewise.
>        (cmdline_set_next_claimed_output): Likewise.
>        (cmdline_claimed_archive_member_list_append): Likewise.
>        (cmdline_emit_object_only_section): Likewise.
>        (cmdline_check_object_only_section): Likewise.
>        (cmdline_remove_object_only_files): Likewise.
>
>        * ldmain.c (main): Pass FALSE to lang_init.  Use
>        ld_parse_linker_script.  Set link_info.output_bfd to NULL
>        after close.  Call cmdline_emit_object_only_section if needed.
>        (ld_parse_linker_script): New.
>        (add_archive_element): Updated for 2 stage linking and support
>        for mixed IR/non-IR objects.
>
>        * ldmain.h (ld_parse_linker_script): New.
>
>        * plugin.c (IRONLY_SUFFIX_LEN): Removed.
>        (plugin_opt_plugin_arg): Ignore -pass-through=.
>        (plugin_get_ir_dummy_bfd): Set BFD_PLUGIN_DUMMY on dummy IR
>        input.
>        (is_ir_dummy_bfd): Check BFD_PLUGIN_DUMMY.
>        (get_symbols): Re-indent.
>        (add_input_file): Replace lang_add_input_file with
>        cmdline_list_insert_claimed_output.
>        (add_input_library): Likewise
>
>        * emultempl/elf32.em (orphan_init_done): Moved out of
>        gld${EMULATION_NAME}_place_orphan.
>        (hold): Likewise.
>        (gld${EMULATION_NAME}_finish): New.
>        (ld_${EMULATION_NAME}_emulation): Use gld${EMULATION_NAME}_finish.
>
>        * scripttempl/armbpabi.sc: Also discard .gnu_object_only
>        sections.
>        * scripttempl/elf.sc: Likewise.
>        * scripttempl/elf32sh-symbian.sc: Likewise.
>        * scripttempl/elf64hppa.sc: Likewise.
>        * scripttempl/elfxtensa.sc: Likewise.
>        * scripttempl/mep.sc: Likewise.
>        * scripttempl/pe.sc: Likewise.
>        * scripttempl/pep.sc: Likewise.
>
> ld/testsuite/
>
> 2010-12-10  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR ld/12248
>        PR ld/12277
>        PR ld/12291
>        * ld-plugin/func1p.c: New.
>        * ld-plugin/func2.c: Likewise.
>        * ld-plugin/func2i.c: Likewise.
>        * ld-plugin/func3h.c: Likewise.
>
>        * ld-plugin/plugin.exp: Add object files for symbols claimed
>        or created by testplugin.
>        * ld-plugin/plugin-7.d: Updated.
>        * ld-plugin/plugin-8.d: Likewise.
>        * ld-plugin/plugin-9.d: Likewise.
>



More information about the Binutils mailing list