summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-19 21:15:12 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-02-19 21:15:12 +0000
commit2d9d874040c91b62611daff710053146dc4dfd76 (patch)
tree6b9e0f3d522152d29df1b4e4be0bfcb62ab812a4 /gcc/c-common.c
parent7cbd63f1331eb73468b833ae6bb7f100ac27bd87 (diff)
downloadgcc-2d9d874040c91b62611daff710053146dc4dfd76.tar.gz
PR target/39175
* c-common.c (c_determine_visibility): If visibility changed and DECL_RTL has been already set, call make_decl_rtl to update symbol flags. * decl2.c (determine_visibility): If visibility changed and DECL_RTL has been already set, call make_decl_rtl to update symbol flags. * gcc.dg/visibility-20.c: New test. * g++.dg/ext/visibility/visibility-11.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144305 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index e7b90674d50..f19976b4af1 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1,6 +1,7 @@
/* Subroutines shared by all languages that are variants of C.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -6249,8 +6250,18 @@ c_determine_visibility (tree decl)
visibility_specified depending on #pragma GCC visibility. */
if (!DECL_VISIBILITY_SPECIFIED (decl))
{
- DECL_VISIBILITY (decl) = default_visibility;
- DECL_VISIBILITY_SPECIFIED (decl) = visibility_options.inpragma;
+ if (visibility_options.inpragma
+ || DECL_VISIBILITY (decl) != default_visibility)
+ {
+ DECL_VISIBILITY (decl) = default_visibility;
+ DECL_VISIBILITY_SPECIFIED (decl) = visibility_options.inpragma;
+ /* If visibility changed and DECL already has DECL_RTL, ensure
+ symbol flags are updated. */
+ if (((TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
+ || TREE_CODE (decl) == FUNCTION_DECL)
+ && DECL_RTL_SET_P (decl))
+ make_decl_rtl (decl);
+ }
}
return false;
}