public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4974] Fix can_be_discarded_p wrt partitioned functions. Date: Sat, 6 Nov 2021 22:36:57 +0000 (GMT) [thread overview] Message-ID: <20211106223657.ACBF13858401@sourceware.org> (raw) https://gcc.gnu.org/g:6078eb7452aa89cb9aeecac30932b58967389459 commit r12-4974-g6078eb7452aa89cb9aeecac30932b58967389459 Author: Jan Hubicka <hubicka@ucw.cz> Date: Sat Nov 6 23:36:08 2021 +0100 Fix can_be_discarded_p wrt partitioned functions. gcc/ChangeLog: * cgraph.h (cgraph_node::can_be_discarded_p): Do not return true on functions from other partition. gcc/lto/ChangeLog: PR ipa/103070 PR ipa/103058 * lto-partition.c (must_not_rename): Update comment. (promote_symbol): Set resolution to LDPR_PREVAILING_DEF_IRONLY. Diff: --- gcc/cgraph.h | 3 ++- gcc/lto/lto-partition.c | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 4cdb3738b4d..0a1f7c8960e 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -404,7 +404,8 @@ public: inline bool can_be_discarded_p (void) { - return (DECL_EXTERNAL (decl) + return ((DECL_EXTERNAL (decl) + && !in_other_partition) || ((get_comdat_group () || DECL_COMMON (decl) || (DECL_SECTION_NAME (decl) && DECL_WEAK (decl))) diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 15761ac9eb5..bee40218159 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -852,7 +852,9 @@ must_not_rename (symtab_node *node, const char *name) /* Avoid mangling of already mangled clones. ??? should have a flag whether a symbol has a 'private' name already, since we produce some symbols like that i.e. for global constructors - that are not really clones. */ + that are not really clones. + ??? it is what unique_name means. We only need to set it when doing + private symbols. */ if (node->unique_name) { if (dump_file) @@ -995,6 +997,10 @@ promote_symbol (symtab_node *node) defined by the non-LTO part. */ privatize_symbol_name (node); TREE_PUBLIC (node->decl) = 1; + /* After privatization the node should not conflict with any other symbol, + so it is prevailing. This is important to keep binds_to_current_def_p + to work across partitions. */ + node->resolution = LDPR_PREVAILING_DEF_IRONLY; DECL_VISIBILITY (node->decl) = VISIBILITY_HIDDEN; DECL_VISIBILITY_SPECIFIED (node->decl) = true; if (dump_file)
reply other threads:[~2021-11-06 22:36 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=20211106223657.ACBF13858401@sourceware.org \ --to=hubicka@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).