On Wed, Nov 25, 2015 at 12:59 AM, Jan Hubicka <hubi...@ucw.cz> wrote:
> Hi,
> PR 67548 is about LTO not supporting incremental linking.  I never really
> considered our current incremental linking very useful, because it triggers
> code generation at the incremental link time basically nullifying any
> benefits of whole program optimization and in fact I think it is harmful,
> because it sort of works and w/o any warning produce not very optimized code.
>

> --- gcc/lto/lto-lang.c  (revision 230847)
> +++ gcc/lto/lto-lang.c  (working copy)
> @@ -819,6 +819,56 @@ lto_post_options (const char **pfilename
>    if (flag_wpa)
>      flag_generate_lto = 1;
>
> +  /* Initialize the codegen flags according to the output type.  */
> +  switch (flag_lto_linker_output)
> +    {
> +    case LTO_LINKER_OUTPUT_REL: /* .o: incremental link producing LTO IL  */
> +      /* Configure compiler same way as normal frontend would do with -flto:
> +        this way we read the trees (declarations & types), symbol table,
> +        optimization summaries and link them. Subsequently we output new LTO
> +        file.  */
> +      flag_lto = "";
> +      flag_incremental_link = 2;
> +      flag_whole_program = 0;
> +      flag_wpa = 0;
> +      flag_generate_lto = 1;
> +      /* It would be cool to produce .o file directly, but our current
> +        simple objects does not contain the lto symbol markers.  Go the slow
> +        way through the asm file.  */
> +      lang_hooks.lto.begin_section = lhd_begin_section;
> +      lang_hooks.lto.append_data = lhd_append_data;
> +      lang_hooks.lto.end_section = lhd_end_section;
> +      if (flag_ltrans)
> +       error ("-flinker-output=rel and -fltrans are mutually exclussive");
> +      break;
> +
> +    case LTO_LINKER_OUTPUT_NOLTOREL: /* .o: incremental link producing asm  
> */
> +      flag_whole_program = 0;
> +      flag_incremental_link = 1;
> +      break;
> +
> +    case LTO_LINKER_OUTPUT_DYN: /* .so: PID library */
> +      /* On some targets, like i386 it makes sense to build PIC library 
> wihout
> +        -fpic for performance reasons.  So no need to adjust flags.  */
> +      break;
> +
> +    case LTO_LINKER_OUTPUT_PIE: /* PIE binary */
> +      /* If -fPIC or -fPIE was used at compile time, be sure that
> +         flag_pie is 2.  */
> +      if (!flag_pie && flag_pic)
> +       flag_pie = flag_pic;
> +      flag_pic = 0;
          ^^^^^^^^^^^^^^^^ This is wrong since PIE implies PIC.

This caused:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70258

> +      break;
> +
>

Reply via email to