re PR lto/91307 (-flto causes binary to vary)
authorRichard Biener <rguenther@suse.de>
Tue, 20 Aug 2019 13:14:59 +0000 (13:14 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 20 Aug 2019 13:14:59 +0000 (13:14 +0000)
2019-08-20  Richard Biener  <rguenther@suse.de>

PR lto/91307
* ipa.c (cgraph_build_static_cdtor_1): Use names not recognizable
by collect2 when targetm.have_ctors_dtors which avoids dragging
in temporary filenames from LTO input objects.

From-SVN: r274748

gcc/ChangeLog
gcc/ipa.c

index b750de4b421d4815c7d6005a0a0451bd95bf8140..353429d0f17f60ca8c67c16fa5290d29ba8ae827 100644 (file)
@@ -1,3 +1,10 @@
+2019-08-20  Richard Biener  <rguenther@suse.de>
+
+       PR lto/91307
+       * ipa.c (cgraph_build_static_cdtor_1): Use names not recognizable
+       by collect2 when targetm.have_ctors_dtors which avoids dragging
+       in temporary filenames from LTO input objects.
+
 2019-08-20  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/37242
index 2496694124cc606a5bceb26c4705ddd5d31cc508..6b84e1f9bdaac5cdd792308cb12aae8abe762965 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -836,13 +836,18 @@ cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final,
   /* The priority is encoded in the constructor or destructor name.
      collect2 will sort the names and arrange that they are called at
      program startup.  */
-  if (final)
-    sprintf (which_buf, "%c_%.5d_%d", which, priority, counter++);
+  if (!targetm.have_ctors_dtors && final)
+    {
+      sprintf (which_buf, "%c_%.5d_%d", which, priority, counter++);
+      name = get_file_function_name (which_buf);
+    }
   else
-  /* Proudce sane name but one not recognizable by collect2, just for the
-     case we fail to inline the function.  */
-    sprintf (which_buf, "sub_%c_%.5d_%d", which, priority, counter++);
-  name = get_file_function_name (which_buf);
+    {
+      /* Proudce sane name but one not recognizable by collect2, just for the
+        case we fail to inline the function.  */
+      sprintf (which_buf, "_sub_%c_%.5d_%d", which, priority, counter++);
+      name = get_identifier (which_buf);
+    }
 
   decl = build_decl (input_location, FUNCTION_DECL, name,
                     build_function_type_list (void_type_node, NULL_TREE));