> 
> It looks like when transitioning to using target and optimization
> option nodes for compile-time to link-time option streaming you
> didn't adjust lto-opts.c nor lto-wrapper.c.  The following fixes

Yep, I assumed that lto-wrapper's merging is now redundant for optimization
options, while it is still needed for global functions (-fPIC) that was
not covered by my changes and since this was all bit late, it seemed I can
just keep it for next stage1.

> the target option side (for SWITCHABLE_TARGET).  Do not record
> any target options in the lto_opts section.
> 
> Honza - I suppose we don't have any testcase that this works, I'll
> try to come up with sth.  This also looks like a correctness issue
> to me.

Thanks, that would be a good idea. So with SWITCHABLE_TARGET
we have problem that after switching the options are misinterpretted?
I think Jakub made patch to simply skip target-option-node streaming here,
how this is supposed to work.
> 
> We can do similar changes for optimize options, now, for all targets, no?

I am not quite sure about this; not all options are per-function nature.
I need to audit all the target options for LTO safety, I did some work
on this for optimization options, but the target options are still very wild.
For example I am not quite convinced mixing -malign-double -mno-align-double 
units
will work as expected.

Honza
> 
> Thanks,
> Richard.
> 
> 2015-04-23  Richard Biener  <rguent...@suse.de>
> 
>       * lto-opts.c (lto_write_options): Do not record target options
>       if we are targeting a SWITCHABLE_TARGET target.  We use target
>       options on functions to transfer target flags from compile to
>       link time.
> 
> Index: gcc/lto-opts.c
> ===================================================================
> *** gcc/lto-opts.c    (revision 222360)
> --- gcc/lto-opts.c    (working copy)
> *************** lto_write_options (void)
> *** 219,224 ****
> --- 219,230 ----
>         && lto_stream_offload_p)
>          continue;
>   
> +       /* Do not store target-specific options if we target a
> +          SWITCHABLE_TARGET target.  */
> +       if ((cl_options[option->opt_index].flags & CL_TARGET)
> +       && SWITCHABLE_TARGET)
> +     continue;
> + 
>         /* Drop options created from the gcc driver that will be rejected
>        when passed on to the driver again.  */
>         if (cl_options[option->opt_index].cl_reject_driver)

Reply via email to