aboutsummaryrefslogtreecommitdiffstats
path: root/main/gcc/PR32219.patch
blob: d30a53b99176007b1b3bb54be54247b1a87bb0ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- /dev/null
+++ gcc-4.6.0/gcc/testsuite/gcc.dg/visibility-21.c
@@ -0,0 +1,14 @@
+/* PR target/32219 */
+/* { dg-do run } */
+/* { dg-require-visibility "" } */
+/* { dg-options "-fPIC" { target fpic } } */
+
+extern void f() __attribute__((weak,visibility("hidden")));
+extern int puts( char const* );
+int main()
+{
+	if (f)
+		f();
+	return 0;
+}
+
--- gcc-4.6.0.orig/gcc/varasm.c
+++ gcc-4.6.0/gcc/varasm.c
@@ -6754,6 +6754,10 @@
   /* Static variables are always local.  */
   else if (! TREE_PUBLIC (exp))
     local_p = true;
+  /* Weak data can be overridden by a strong symbol
+     in another module and so are not local.  */
+  else if (DECL_WEAK (exp))
+    local_p = false;
   /* A variable is local if the user has said explicitly that it will
      be.  */
   else if ((DECL_VISIBILITY_SPECIFIED (exp)
@@ -6767,11 +6771,6 @@
      local.  */
   else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT)
     local_p = true;
-  /* Default visibility weak data can be overridden by a strong symbol
-     in another module and so are not local.  */
-  else if (DECL_WEAK (exp)
-	   && !resolved_locally)
-    local_p = false;
   /* If PIC, then assume that any global name can be overridden by
      symbols resolved from other modules.  */
   else if (shlib)