ipa.c (cgraph_build_static_cdtor): Pass optimization_default_node and target_option_d...
authorJan Hubicka <hubicka@ucw.cz>
Wed, 13 Nov 2019 09:05:14 +0000 (10:05 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 13 Nov 2019 09:05:14 +0000 (09:05 +0000)
* ipa.c (cgraph_build_static_cdtor): Pass optimization_default_node
and target_option_default_node to get -fprofile-generate ctors working
right with LTO.

From-SVN: r278123

gcc/ChangeLog
gcc/ipa.c

index 9054178018eabae9142ae1473a5cff098c590c1d..fbf586dc1b5a316f8c464e116734d45832baeca9 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-13  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa.c (cgraph_build_static_cdtor): Pass optimization_default_node
+       and target_option_default_node to get -fprofile-generate ctors working
+       right with LTO.
+
 2019-11-13  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vectorizer.h (vect_nop_conversion_p): Declare.
index 934e49785f3a1fc5ea079e74476234b7c1e59964..0c92980db462c9d152ee493fd57322b55d4302c5 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -914,7 +914,14 @@ cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final,
 void
 cgraph_build_static_cdtor (char which, tree body, int priority)
 {
-  cgraph_build_static_cdtor_1 (which, body, priority, false, NULL, NULL);
+  /* FIXME: We should be able to
+     gcc_assert (!in_lto_p);
+     because at LTO time the global options are not safe to use.
+     Unfortunately ASAN finish_file will produce constructors late and they
+     may lead to surprises.  */
+  cgraph_build_static_cdtor_1 (which, body, priority, false,
+                              optimization_default_node,
+                              target_option_default_node);
 }
 
 /* When target does not have ctors and dtors, we call all constructor