summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/debug.h3
-rw-r--r--gcc/dwarf2cfi.c18
-rw-r--r--gcc/dwarf2out.c9
-rw-r--r--gcc/lto-opts.c67
-rw-r--r--gcc/toplev.c7
6 files changed, 38 insertions, 82 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 87d200b24f1..241e9ca6ab1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2017-11-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR lto/81351
+ * debug.h (dwarf2out_do_eh_frame): Declare.
+ * dwarf2cfi.c (dwarf2out_do_eh_frame): New predicate.
+ (dwarf2out_do_frame): Use it.
+ (dwarf2out_do_cfi_asm): Likewise.
+ * dwarf2out.c (dwarf2out_frame_finish): Likewise.
+ (dwarf2out_assembly_start): Likewise.
+ (dwarf2out_begin_prologue): Fix comment.
+ * toplev.c (compile_file): Always call dwarf2out_frame_finish
+ if the target needs either debug or unwind DWARF2 info.
+ * lto-opts.c (lto_write_options): Do not save -fexceptions,
+ -fnon-call-exceptions, -ffp-contract, -fmath-errno, -fsigned-zeros,
+ -ftrapping-math, -ftrapv and -fwrapv.
+
2017-11-13 Jan Hubicka <hubicka@ucw.cz>
* cgraph.c (cgraph_edge::sreal_frequency): New function.
diff --git a/gcc/debug.h b/gcc/debug.h
index 19b27848ca8..277d990c20f 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -241,8 +241,7 @@ extern void dwarf2out_vms_end_prologue (unsigned int, const char *);
extern void dwarf2out_vms_begin_epilogue (unsigned int, const char *);
extern void dwarf2out_end_epilogue (unsigned int, const char *);
extern void dwarf2out_frame_finish (void);
-/* Decide whether we want to emit frame unwind information for the current
- translation unit. */
+extern bool dwarf2out_do_eh_frame (void);
extern bool dwarf2out_do_frame (void);
extern bool dwarf2out_do_cfi_asm (void);
extern void dwarf2out_switch_text_section (void);
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 45b5e3099d2..62117e7c850 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -3402,6 +3402,17 @@ debug_cfi_row (dw_cfi_row *row)
This variable is tri-state, with 0 unset, >0 true, <0 false. */
static GTY(()) signed char saved_do_cfi_asm = 0;
+/* Decide whether to emit EH frame unwind information for the current
+ translation unit. */
+
+bool
+dwarf2out_do_eh_frame (void)
+{
+ return
+ (flag_unwind_tables || flag_exceptions)
+ && targetm_common.except_unwind_info (&global_options) == UI_DWARF2;
+}
+
/* Decide whether we want to emit frame unwind information for the current
translation unit. */
@@ -3420,8 +3431,7 @@ dwarf2out_do_frame (void)
if (targetm.debug_unwind_info () == UI_DWARF2)
return true;
- if ((flag_unwind_tables || flag_exceptions)
- && targetm_common.except_unwind_info (&global_options) == UI_DWARF2)
+ if (dwarf2out_do_eh_frame ())
return true;
return false;
@@ -3456,9 +3466,7 @@ dwarf2out_do_cfi_asm (void)
/* If we can't get the assembler to emit only .debug_frame, and we don't need
dwarf2 unwind info for exceptions, then emit .debug_frame by hand. */
- if (!HAVE_GAS_CFI_SECTIONS_DIRECTIVE
- && !flag_unwind_tables && !flag_exceptions
- && targetm_common.except_unwind_info (&global_options) != UI_DWARF2)
+ if (!HAVE_GAS_CFI_SECTIONS_DIRECTIVE && !dwarf2out_do_eh_frame ())
return false;
/* Success! */
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index b8f4e4888f1..df854672724 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -263,7 +263,6 @@ static GTY(()) int dw2_string_counter;
static GTY(()) bool have_multiple_function_sections = false;
/* Whether the default text and cold text sections have been used at all. */
-
static GTY(()) bool text_section_used = false;
static GTY(()) bool cold_text_section_used = false;
@@ -1060,7 +1059,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
dup_label = xstrdup (label);
current_function_func_begin_label = dup_label;
- /* We can elide the fde allocation if we're not emitting debug info. */
+ /* We can elide FDE allocation if we're not emitting frame unwind info. */
if (!do_frame)
return;
@@ -1180,8 +1179,7 @@ dwarf2out_frame_finish (void)
output_call_frame_info (0);
/* Output another copy for the unwinder. */
- if ((flag_unwind_tables || flag_exceptions)
- && targetm_common.except_unwind_info (&global_options) == UI_DWARF2)
+ if (dwarf2out_do_eh_frame ())
output_call_frame_info (1);
}
@@ -27522,8 +27520,7 @@ dwarf2out_assembly_start (void)
if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
&& dwarf2out_do_cfi_asm ()
- && (!(flag_unwind_tables || flag_exceptions)
- || targetm_common.except_unwind_info (&global_options) != UI_DWARF2))
+ && !dwarf2out_do_eh_frame ())
fprintf (asm_out_file, "\t.cfi_sections\t.debug_frame\n");
}
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index 641b2795b2c..e39f05d0e9c 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -70,73 +70,10 @@ lto_write_options (void)
obstack_init (&temporary_obstack);
- /* Output options that affect GIMPLE IL semantics and are implicitly
- enabled by the frontend.
- This for now includes an explicit set of options that we also handle
- explicitly in lto-wrapper.c. In the end the effects on GIMPLE IL
- semantics should be explicitely encoded in the IL or saved per
- function rather than per compilation unit. */
- /* -fexceptions causes the EH machinery to be initialized, enabling
- generation of unwind data so that explicit throw() calls work. */
- if (!global_options_set.x_flag_exceptions
- && global_options.x_flag_exceptions)
- append_to_collect_gcc_options (&temporary_obstack, &first_p,
- "-fexceptions");
- /* -fnon-call-exceptions changes the generation of exception
- regions. It is enabled implicitly by the Go frontend. */
- if (!global_options_set.x_flag_non_call_exceptions
- && global_options.x_flag_non_call_exceptions)
- append_to_collect_gcc_options (&temporary_obstack, &first_p,
- "-fnon-call-exceptions");
- /* The default -ffp-contract changes depending on the language
- standard. Pass thru conservative standard settings. */
- if (!global_options_set.x_flag_fp_contract_mode)
- switch (global_options.x_flag_fp_contract_mode)
- {
- case FP_CONTRACT_OFF:
- append_to_collect_gcc_options (&temporary_obstack, &first_p,
- "-ffp-contract=off");
- break;
- case FP_CONTRACT_ON:
- append_to_collect_gcc_options (&temporary_obstack, &first_p,
- "-ffp-contract=on");
- break;
- case FP_CONTRACT_FAST:
- /* Nothing. That merges conservatively and is the default for LTO. */
- break;
- default:
- gcc_unreachable ();
- }
- /* The default -fmath-errno, -fsigned-zeros and -ftrapping-math change
- depending on the language (they can be disabled by the Ada front-end).
- Pass thru conservative standard settings. */
- if (!global_options_set.x_flag_errno_math)
- append_to_collect_gcc_options (&temporary_obstack, &first_p,
- global_options.x_flag_errno_math
- ? "-fmath-errno"
- : "-fno-math-errno");
- if (!global_options_set.x_flag_signed_zeros)
- append_to_collect_gcc_options (&temporary_obstack, &first_p,
- global_options.x_flag_signed_zeros
- ? "-fsigned-zeros"
- : "-fno-signed-zeros");
- if (!global_options_set.x_flag_trapping_math)
- append_to_collect_gcc_options (&temporary_obstack, &first_p,
- global_options.x_flag_trapping_math
- ? "-ftrapping-math"
- : "-fno-trapping-math");
- /* We need to merge -f[no-]strict-overflow, -f[no-]wrapv and -f[no-]trapv
- conservatively, so stream out their defaults. */
- if (!global_options_set.x_flag_wrapv
- && global_options.x_flag_wrapv)
- append_to_collect_gcc_options (&temporary_obstack, &first_p, "-fwrapv");
- if (!global_options_set.x_flag_trapv
- && !global_options.x_flag_trapv)
- append_to_collect_gcc_options (&temporary_obstack, &first_p, "-fno-trapv");
-
if (!global_options_set.x_flag_openmp
&& !global_options.x_flag_openmp)
- append_to_collect_gcc_options (&temporary_obstack, &first_p, "-fno-openmp");
+ append_to_collect_gcc_options (&temporary_obstack, &first_p,
+ "-fno-openmp");
if (!global_options_set.x_flag_openacc
&& !global_options.x_flag_openacc)
append_to_collect_gcc_options (&temporary_obstack, &first_p,
diff --git a/gcc/toplev.c b/gcc/toplev.c
index eff169008d1..2f154960a17 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -525,10 +525,9 @@ compile_file (void)
/* Do dbx symbols. */
timevar_push (TV_SYMOUT);
- #if defined DWARF2_DEBUGGING_INFO || defined DWARF2_UNWIND_INFO
- if (dwarf2out_do_frame ())
- dwarf2out_frame_finish ();
- #endif
+#if defined DWARF2_DEBUGGING_INFO || defined DWARF2_UNWIND_INFO
+ dwarf2out_frame_finish ();
+#endif
(*debug_hooks->finish) (main_input_filename);
timevar_pop (TV_SYMOUT);