summaryrefslogtreecommitdiffstats
path: root/gcc/varasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 95ac3775136..b73c6542231 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -4956,8 +4956,8 @@ default_binds_local_p_1 (tree exp, int shlib)
/* Static variables are always local. */
else if (! TREE_PUBLIC (exp))
local_p = true;
- /* A variable is local if the user tells us so. */
- else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
+ /* A variable is local if the user explicitly tells us so. */
+ else if (DECL_VISIBILITY_SPECIFIED (exp) && DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
local_p = true;
/* Otherwise, variables defined outside this object may not be local. */
else if (DECL_EXTERNAL (exp))
@@ -4965,6 +4965,9 @@ default_binds_local_p_1 (tree exp, int shlib)
/* Linkonce and weak data are never local. */
else if (DECL_ONE_ONLY (exp) || DECL_WEAK (exp))
local_p = false;
+ /* If none of the above and visibility is not default, make local. */
+ else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
+ local_p = true;
/* If PIC, then assume that any global name can be overridden by
symbols resolved from other modules. */
else if (shlib)
OpenPOWER on IntegriCloud