go: disable -fipa-icf-functions by default in Go frontend
authorIan Lance Taylor <iant@golang.org>
Wed, 4 Nov 2020 20:02:31 +0000 (12:02 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 4 Nov 2020 20:05:22 +0000 (12:05 -0800)
Go programs expect to be able to get reliable backtrace information
with correct file/line information, but -fipa-icf-functions breaks
that because it merges together distinct functions which should have
distinct file/line info.

* go-lang.c (go_langhook_post_options): Disable
-fipa-icf-functions if it was not explicitly enabled.

gcc/go/go-lang.c

index 2cfb41042bddfa7bcdc3c33bc92a805e120fdf26..08c1f38a2c1f7cad627cb41f62a37c42cf964404 100644 (file)
@@ -306,6 +306,12 @@ go_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED)
   SET_OPTION_IF_UNSET (&global_options, &global_options_set,
                       flag_partial_inlining, 0);
 
+  /* Go programs expect runtime.Callers to give the right answers,
+     which means that we can't combine functions even if they look the
+     same.  */
+  SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+                      flag_ipa_icf_functions, 0);
+
   /* If the debug info level is still 1, as set in init_options, make
      sure that some debugging type is selected.  */
   if (global_options.x_debug_info_level == DINFO_LEVEL_TERSE