This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lto] add direct-to-ELF serialization to lto1


On Fri, Jun 27, 2008 at 15:26, Ollie Wild <aaw@google.com> wrote:

> Strictly speaking, -fsyntax-only isn't required.  It is, however,
> useful, as it suppresses the generation of assembly code.  When the
> final code is in place, -fpartition will implicitly enable
> -fsyntax-only and -flto.  This is the same mechanism gcj uses when
> generating bytecode.

Ah, OK.  Thanks.

> I've resolved the other formatting issues and reverted to a
> langhooks-based approach.  Since the output blocks need to be saved
> until the ELF file is actually written, I've modified the old
> write_section_data hook to take a block argument and renamed it
> append_data (to avoid the suggesting that data is actually being
> written at this point).  This was done in the old patch as well but
> was obscured by the fact that the langhooks were being removed.

Sounds good.

> 2008-06-27  Ollie Wild  <aaw@google.com>
>
>        * lto-elf.c (lto-section-out.h): New include.
>        (struct lto_elf_file): Remove bits member.  Add scn, shstrtab_stream,
>        and data members.
>        (cached_file_attrs): New static variable.
>        (lto_elf_get_shdr, lto_elf_free_shdr): Remove elf_file parameter.
>        Use cached_file_attrs for checking bits.
>        (lto_elf_build_section_table): Remove elf_file argument from
>        lto_elf_get_shdr and lto_elf_free_shdr calls.
>        (DEFINE_INIT_SHDR): New macro.
>        (init_shdr32, init_shdr64): New functions defined via the
>        DEFINE_INIT_SHDR macro.
>        (lto_elf_begin_section_with_type): New function.
>        (lto_elf_begin_section): New function.
>        (lto_elf_append_data): New function.
>        (lto_elf_end_section): New function.
>        (DEFINE_VALIDATE_EHDR): New macro.
>        (validate_ehdr32, validate_ehdr64): New functions defined via the
>        DEFINE_VALIDATE_EHDR macro.
>        (validate_file): New function.
>        (DEFINE_INIT_EHDR): New macro.
>        (init_ehdr32, init_ehdr64): New functions defined via the
>        DEFINE_INIT_EHDR macro.
>        (init_ehdr): New function.
>        (lto_elf_file_open): Add support for writable files.  Move some
>        validation logic to validate_file.
>        (lto_elf_file_close): Add support for writable files.  Write file data
>        and free data blocks.
>        (current_out_file): New static variable.
>        (lto_set_current_out_file): New function.
>        (lto_get_current_out_file): New function.
>        * lto.c (lto_main): Add writable argument to lto_elf_file_open calls.
>        Add temporary initialization for testing ELF serialization.
>        * lto.h (lto-section-out.h): New include.
>        (struct lto_file_struct): Slight modification to comment.
>        (lto_elf_file_open): Add writable parameter.
>        (lto_elf_begin_section): New function declaration.
>        (lto_elf_append_data): New function declaration.
>        (lto_elf_end_section): New function declaration.
>        (lto_set_current_out_file, lto_get_current_out_file): New function
>        declarations.
>        * lto-lang.c (LANG_HOOKS_BEGIN_SECTION): Set as lto_elf_begin_section.
>        (LANG_HOOKS_APPEND_DATA): Set as lto_elf_append_data.
>        (LANG_HOOKS_END_SECTION): Set as lto_elf_end_section.
>        * Make-lang.in (LTO_H): Add lto-section-out.h.

>
> 2008-06-27  Ollie Wild  <aaw@google.com>
>
>        * lto-section-out.h (lto_begin_section): New function declaration.
>        (lto_end_section): New function declaration.
>        (lto_output_data_stream): New function declaration.
>        * lto-section-out.c (lto_begin_section): New function.
>        (lto_end_section): New function.
>        (lto_write_stream): Modify lang_hooks call.  Remove free.
>        (append_block): New function.
>        (lto_output_1_stream): Replace block allocation with call to
>        append_block.
>        (lto_output_data_stream): New function.
>        (lto_destroy_simple_output_block): Add header_stream.  Replace
>        lang_hook calls with lto-section functions.
>        (write_global_references): Add ref_stream.  Replace lang_hooks call
>        with lto-section calls.
>        (produce_asm_for_decls): Add header_stream.  Replace lang_hook calls
>        with lto-section calls.
>        * lto-function-out.c (langhooks.h): Remove include.
>        (produce_asm): Add header_stream.  Replace lang_hook calls with
>        lto-section calls.
>        * langhooks.h (struct lang_hooks_for_lto): Rename write_section_data
>        to append_data.  Add a block parameter.
>        * langhooks-def.h (lhd_append_data): Rename from
>        lhd_write_section_data.  Add a new parameter.
>        (lhd_write_section_data): Rename to lhd_append_data.
>        (LANG_HOOKS_APPEND_DATA): Rename from LANG_HOOKS_WRITE_SECTION_DATA.
>        Change lhd_write_section_data to lhd_append_data.
>        (LANG_HOOKS_WRITE_SECTION_DATA): Rename to LANG_HOOKS_APPEND_DATA.
>        (LANG_HOOKS_LTO): Change LANG_HOOKS_WRITE_SECTION-DATA to
>        LANG_HOOKS_APPEND_DATA.
>        * langhooks.c (lhd_append_data): Rename from lhd_write_section_data.
>        Add a block parameter.
>        (lhd_write_section_data): Rename to lhd_append_data.
>


OK.


Thanks.  Diego.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]