public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/lto_priv-partial-linking)] LTO: add lto_priv suffixfor LTO_LINKER_OUTPUT_NOLTOREL.
@ 2021-05-21 8:27 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-05-21 8:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:372d2944571906932fd1419bfc51a949d67b857e
commit 372d2944571906932fd1419bfc51a949d67b857e
Author: Martin Liska <mliska@suse.cz>
Date: Fri May 21 10:25:49 2021 +0200
LTO: add lto_priv suffixfor LTO_LINKER_OUTPUT_NOLTOREL.
gcc/lto/ChangeLog:
* lto-partition.c (privatize_symbol_name_1): Add random suffix
based on hash of the object file and -frandom-seed.
Diff:
---
gcc/lto/lto-partition.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 15761ac9eb5..fef48c869a2 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-fnsummary.h"
#include "lto-partition.h"
#include "sreal.h"
+#include "toplev.h"
vec<ltrans_partition> ltrans_partitions;
@@ -941,9 +942,23 @@ privatize_symbol_name_1 (symtab_node *node, tree decl)
name = maybe_rewrite_identifier (name);
unsigned &clone_number = lto_clone_numbers->get_or_insert (name);
- symtab->change_decl_assembler_name (decl,
- clone_function_name (
- name, "lto_priv", clone_number));
+
+ char *suffix = NULL;
+ if (flag_lto_linker_output == LTO_LINKER_OUTPUT_NOLTOREL)
+ {
+ hashval_t fnhash = 0;
+ if (node->lto_file_data != NULL)
+ fnhash = htab_hash_string (node->lto_file_data->file_name);
+ suffix = XNEWVEC (char, 128);
+ char sep = symbol_table::symbol_suffix_separator ();
+ sprintf (suffix, "lto_priv%c%u%c%" PRIu64, sep, fnhash, sep,
+ (unsigned HOST_WIDE_INT)get_random_seed (false));
+ }
+
+ tree clone
+ = clone_function_name (name, suffix ? suffix : "lto_priv", clone_number);
+ symtab->change_decl_assembler_name (decl, clone);
+ free (suffix);
clone_number++;
if (node->lto_file_data)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-21 8:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21 8:27 [gcc(refs/users/marxin/heads/lto_priv-partial-linking)] LTO: add lto_priv suffixfor LTO_LINKER_OUTPUT_NOLTOREL Martin Liska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).