> Hi,
> 
> the patch
> 
> 2017-07-06  Jan Hubicka  <hubi...@ucw.cz>
> 
>       * lto-wrapper.c (merge_and_complain): Do not merge
>       fexceptions, fnon_call_exceptions, ftrapv, ffp_contract_, fmath_errno,
>       fsigned_zeros, ftrapping_math, fwrapv.
>       (append_compiler_options): Do not track these options.
>       (append_linker_options): Likewie
> 
> has broken exception handling in LTO mode for targets which don't force 
> either 
> -funwind-tables or -fasynchronous-unwind-tables (i.e not x86) and do not 
> default to -fdwarf2-cfi-asm (i.e. not Linux), for example SPARC/Solaris.
> 
> The problem is that the eh_frame section is no longer generated because it is 
> emitted from compile_file:
> 
>     #if defined DWARF2_DEBUGGING_INFO || defined DWARF2_UNWIND_INFO
>       if (dwarf2out_do_frame ())
>       dwarf2out_frame_finish ();
>     #endif
> 
> and this requires that either flag_unwind_tables or flag_exceptions be set.
> 
> But both -funwind-tables and -fexceptions are optimization options defaulting 
> to 0 and they are reset to 0 through optimization_default_node after the last 
> function is processed by the cgraph machinery.
> 
> Note that flag_exceptions is generally set to 1 in lto_init_eh very early, 
> but 
> the above mechanism overrides it.  However, flag_exceptions may *never* be 
> set 
> to 1 for a specific partition if it contains only EH-neutral functions; 
> that's 
> why I think that there is no other way than restoring the build-wide handling 
> of -fexceptions before Jan's patch (hopefully it's the only affected switch).

I am not sure I follow your argumentation here.  flag_exceptions is optimization
which means that one should not test it globally. For that reason I would just
change dwarf2out to simply trigger dwarf2out_frame_finish if any of the compiled
functions needed it (had flag_exceptions set).

My readon of lto-wrapper is that it will set flag_exceptions for whole 
compilation
unit when one of compilation units were copmiled with flag_exceptions.

How that helps the neutral functions?
Honza

Reply via email to