From patchwork Tue Sep 7 14:28:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Spec DECL_VISIBILITY_SPECIFIED for whopr partitioning X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 64025 Message-Id: <20100907142806.GE21528@kam.mff.cuni.cz> To: gcc-patches@gcc.gnu.org, rguenther@suse.de Date: Tue, 7 Sep 2010 16:28:06 +0200 From: Jan Hubicka List-Id: Hi, unless DECL_VISIBILITY_SPECIFIED is set, we ignore visibilities for external symbols (to make -fvisibility work). Setting the flag in WHOPR partitioning makes locally_bound_p and friends to trust the visibility and improves PIC codegen. Boostrapped/regtested x86_64-linux, OK? Honza * lto/lto.c (promote_var): Set DECL_VISIBILITY_SPECIFIED. Index: lto/lto.c =================================================================== --- lto/lto.c (revision 163947) +++ lto/lto.c (working copy) @@ -914,6 +914,7 @@ promote_var (struct varpool_node *vnode) gcc_assert (flag_wpa); TREE_PUBLIC (vnode->decl) = 1; DECL_VISIBILITY (vnode->decl) = VISIBILITY_HIDDEN; + DECL_VISIBILITY_SPECIFIED (vnode->decl) = true; if (cgraph_dump_file) fprintf (cgraph_dump_file, "Promoting var as hidden: %s\n", varpool_node_name (vnode)); @@ -930,6 +931,7 @@ promote_fn (struct cgraph_node *node) return false; TREE_PUBLIC (node->decl) = 1; DECL_VISIBILITY (node->decl) = VISIBILITY_HIDDEN; + DECL_VISIBILITY_SPECIFIED (node->decl) = true; if (node->same_body) { struct cgraph_node *alias; @@ -938,6 +940,7 @@ promote_fn (struct cgraph_node *node) { TREE_PUBLIC (alias->decl) = 1; DECL_VISIBILITY (alias->decl) = VISIBILITY_HIDDEN; + DECL_VISIBILITY_SPECIFIED (alias->decl) = true; } } if (cgraph_dump_file)