From 9a02d31baa5e83387b3bbfaadca70f4ebc6cce15 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 4 Nov 2020 12:02:31 -0800 Subject: [PATCH] go: disable -fipa-icf-functions by default in Go frontend 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c index 2cfb41042bd..08c1f38a2c1 100644 --- a/gcc/go/go-lang.c +++ b/gcc/go/go-lang.c @@ -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 -- 2.30.2