public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/lto_priv-partial-linking)] LTO: add lto_priv suffixfor LTO_LINKER_OUTPUT_NOLTOREL. Date: Fri, 21 May 2021 08:27:26 +0000 (GMT) [thread overview] Message-ID: <20210521082726.2347E3857C44@sourceware.org> (raw) 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)
reply other threads:[~2021-05-21 8:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210521082726.2347E3857C44@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).