Fwd: [lto] create language hooks for outputting lto sections

Ollie Wild aaw@google.com
Wed Jun 18 18:48:00 GMT 2008


This is the first in a series of patches to support WPA repackaging.

This patch adds three new language hooks (LANG_HOOKS_BEGIN_SECTION,
LANG_HOOKS_WRITE_SECTION_DATA, and LANG_HOOKS_END_SECTION) for
outputting lto sections.  There should be no functional difference.  A
subsequent patch will override the default implementation inside lto1
with routines which call libelf directly.

Tested with a C/C++/LTO bootstrap and testsuite on i686-pc-linux.gnu.

Ollie


2008-06-18  Ollie Wild  <aaw@google.com>

        * langhooks-def.h (lhd_begin_section): New function declaration.
        (lhd_write_section): New function declaration.
        (lhd_end_section): New function declaration.
        (LANG_HOOKS_BEGIN_SECTION): New macro.
        (LANG_HOOKS_WRITE_SECTION_DATA): New macro.
        (LANG_HOOKS_END_SECTION): New macro.
        (LANG_HOOKS_LTO): New macro.
        (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_LTO.
        * langhooks.c (output.h): Add include.
        (saved_section): New static variable.
        (lhd_begin_section): New function.
        (lhd_write_section_data): New function.
        (lhd_end_section): New function.
        * langhooks.h (struct lang_hooks_for_lto): New structure.
        (struct lang_hooks): Add member lto.
        * lto-function-out.c (output.h): Remove include.
        (produce_asm): Call the lto.begin_section, lto.write_section_data, and
        lto.end_section language hooks.
        (lto_output): Remove saved_section and call to switch_to_section.
        * lto-section-out.c (output.h): Remove include.
        (lto_get_section): Remove function.
        (lto_write_stream): Call the lto.write_section_data language hook.
        (lto_destroy_simple_output_block): Call the lto.begin_section,
        lto.write_section_data, and lto.end_section language hooks.
        (produce_asm_for_decls): Call the lto.begin_section,
        lto.write_section_data, and lto.end_section language hooks.
        * lto-header.h (lto_get_section): Remove function declaration.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lto-hooks.patch
Type: text/x-patch
Size: 12811 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080618/0a24137c/attachment.bin>


More information about the Gcc-patches mailing list