summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-08-20 13:14:59 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-08-20 13:14:59 +0000
commit00f7060a2db60e6fe7066bf65244909dc7693d19 (patch)
tree77498d10da26f0e9f067280982844b09b8d290bf
parent3ed01d5408045d80a1efc42fadacfcfb98f14997 (diff)
re PR lto/91307 (-flto causes binary to vary)
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
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/ipa.c17
2 files changed, 18 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b750de4b421..353429d0f17 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
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
* tree-ssa-sccvn.c (visit_nary_op): Also CSE (T)(a + b)
to (T)a + (T)b if we know that a + b does not overflow.
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 2496694124c..6b84e1f9bda 100644
--- 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));