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

            Bug ID: 91794
           Summary: exception and unwind state is not carried to LTO but
                    controls EH vs debug frame
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

On targets where -funwind-tables is not enabled by default doing

gcc -c -flto -funwind-tables t.c -g
gcc t.o -g

ends up without unwind tables even if the flags state is recorded in
per-function settings.  dwarf2out.c suggests the state is accumulated
from all functions in the TU

  /* Unlike the debug version, the EH version of frame unwind info is a per-
     function setting so we need to record whether we need it for the unit.  */
  do_eh_frame |= dwarf2out_do_eh_frame ();

but that doesn't work since dwarf2out_do_eh_frame looks at the global
flag_unwind_tables (and global flag_exceptions and passes global opts to
the target hook).

We probably can switch between EH-frame and debug-frame per function but
a way out would be to handle flag_{,asynchronous_}unwind_tables in
lto-wrapper.

Eric was here fixing the similar PR81351.

One target where this shows is riscv.

Reply via email to