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
This commit is contained in:
Richard Biener 2019-08-20 13:14:59 +00:00 committed by Richard Biener
parent 3ed01d5408
commit 00f7060a2d
2 changed files with 18 additions and 6 deletions

View 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

View file

@ -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));