lto-wrapper: Pass through -funwind-tables and -fasynchronous-unwind-tables

Message ID mvmttzyx1b3.fsf@suse.de
State Committed
Commit 9453e3cd0ffd0c377a648b83a9a5fdc5809e60d7
Headers
Series lto-wrapper: Pass through -funwind-tables and -fasynchronous-unwind-tables |

Commit Message

Andreas Schwab Feb. 6, 2023, 3:26 p.m. UTC
  The -funwind-tables and -fasynchronous-unwind-tables options are relevant
for the output pass, so they need to be passed through by the LTO wrapper.
Otherwise, dwarf2out_assembly_start may output a ".cfi_sections
.debug_frame" directive when debug info was enabled even if every
translation unit was compiled with -funwind-tables.

gcc/
	* lto-wrapper.cc (merge_and_complain): Handle
	-funwind-tables and -fasynchronous-unwind-tables.
	(append_compiler_options): Likewise.
---
 gcc/lto-wrapper.cc | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Richard Biener Feb. 9, 2023, 8:20 a.m. UTC | #1
On Mon, Feb 6, 2023 at 4:27 PM Andreas Schwab via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> The -funwind-tables and -fasynchronous-unwind-tables options are relevant
> for the output pass, so they need to be passed through by the LTO wrapper.
> Otherwise, dwarf2out_assembly_start may output a ".cfi_sections
> .debug_frame" directive when debug info was enabled even if every
> translation unit was compiled with -funwind-tables.

OK.

> gcc/
>         * lto-wrapper.cc (merge_and_complain): Handle
>         -funwind-tables and -fasynchronous-unwind-tables.
>         (append_compiler_options): Likewise.
> ---
>  gcc/lto-wrapper.cc | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
> index 11c4d1b38a4..fe8c5f6e80d 100644
> --- a/gcc/lto-wrapper.cc
> +++ b/gcc/lto-wrapper.cc
> @@ -335,6 +335,8 @@ merge_and_complain (vec<cl_decoded_option> &decoded_options,
>
>         case OPT_fopenmp:
>         case OPT_fopenacc:
> +       case OPT_fasynchronous_unwind_tables:
> +       case OPT_funwind_tables:
>           /* For selected options we can merge conservatively.  */
>           if (existing_opt == -1)
>             decoded_options.safe_push (*foption);
> @@ -737,6 +739,8 @@ append_compiler_options (obstack *argv_obstack, vec<cl_decoded_option> opts)
>         case OPT_fopenacc_dim_:
>         case OPT_foffload_abi_:
>         case OPT_fcf_protection_:
> +       case OPT_fasynchronous_unwind_tables:
> +       case OPT_funwind_tables:
>         case OPT_g:
>         case OPT_O:
>         case OPT_Ofast:
> --
> 2.39.1
>
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
  

Patch

diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
index 11c4d1b38a4..fe8c5f6e80d 100644
--- a/gcc/lto-wrapper.cc
+++ b/gcc/lto-wrapper.cc
@@ -335,6 +335,8 @@  merge_and_complain (vec<cl_decoded_option> &decoded_options,
 
 	case OPT_fopenmp:
 	case OPT_fopenacc:
+	case OPT_fasynchronous_unwind_tables:
+	case OPT_funwind_tables:
 	  /* For selected options we can merge conservatively.  */
 	  if (existing_opt == -1)
 	    decoded_options.safe_push (*foption);
@@ -737,6 +739,8 @@  append_compiler_options (obstack *argv_obstack, vec<cl_decoded_option> opts)
 	case OPT_fopenacc_dim_:
 	case OPT_foffload_abi_:
 	case OPT_fcf_protection_:
+	case OPT_fasynchronous_unwind_tables:
+	case OPT_funwind_tables:
 	case OPT_g:
 	case OPT_O:
 	case OPT_Ofast: