This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lto] add direct-to-ELF serialization to lto1
- From: Diego Novillo <dnovillo at google dot com>
- To: Ollie Wild <aaw at google dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Kenneth Zadeck <zadeck at naturalbridge dot com>, =?big5?b?RG91ZyBLd2FuICjD9q62vHcp?= <dougkwan at google dot com>
- Date: Thu, 26 Jun 2008 17:52:27 -0400
- Subject: Re: [lto] add direct-to-ELF serialization to lto1
- References: <65dd6fd50806251156l647c5bb7vd5fe28e19d76d459@mail.gmail.com>
On Wed, Jun 25, 2008 at 14:56, Ollie Wild <aaw@google.com> wrote:
> + if (obs->first_block == NULL)
> + {
> + /* This is the first time the stream has been written
> + into. */
> + obs->block_size = 1024;
Does it make sense to #define or --param this number?
> + pointer to the new block. */
> + tptr = obs->current_block;
> + tptr->ptr = (char *)new_block;
Space after typecast.
> + }
> +
> + /* Set the place for the next char at the first position after the
> + chain to the next block. */
> + obs->current_pointer
> + = ((char *)new_block) + sizeof (struct lto_char_ptr_base);
Likewise.
> @@ -36,6 +36,7 @@ Boston, MA 02110-1301, USA. */
> #include "tm.h"
> #include "libiberty.h"
> #include "ggc.h"
> +#include "lto-section-out.h"
Needs corresponding changes in lto/Make-lang.in
> + /* Grab the current output file and do some basic assertion checking. */
> + file = (lto_elf_file *)lto_get_current_out_file (),
Space after type cast.
> + gcc_assert (file);
> + gcc_assert (file->elf);
> + gcc_assert (!file->scn);
> +
> + /* Create a new section. */
> + scn = elf_newscn(file->elf);
Space after '('.
> +
> + /* Free any ELF data buffers. */
> + cur = elf_file->data;
> + while (cur)
> + {
> + tmp = cur;
> + cur = (struct lto_char_ptr_base *)cur->ptr;
Space after typecast.
> + /* This is some bogus wrapper code for development testing. It will be
> + replaced once some basic WPA partitioning logic is implemented. To use
> + this pass "-flto -fsyntax-only" to the lto1 invocation. */
> + if (flag_generate_lto)
> + {
> + lto_file *file;
> +
> + file = lto_elf_file_open ("bogus.lto.o", /*writable=*/true);
> + if (!file)
> + fatal_error ("lto_elf_file_open() failed");
> + lto_set_current_out_file (file);
> + }
> +
I'm confused by this hunk. What are you testing here? It also
seems that it will trigger with just -flto. Where does
-fsyntax-only come to play?
> -/* Open the ELF input file indicated by FILENAME. Return */
> -extern lto_file *lto_elf_file_open (const char *filename);
> +/* Open the ELF file indicated by FILENAME. Return */
Return what?
With the exception of the -fsyntax-only test and the langhooks,
the rest looks fine to me.
Diego.