aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr66912.c42
-rw-r--r--gcc/testsuite/gcc.target/arm/pr66912.c42
-rw-r--r--gcc/varasm.c5
5 files changed, 98 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7f5cbf0..e3206f4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-20 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ PR target/66912
+ * varasm.c (default_binds_local_p_2): Turn on extern_protected_data.
+
2015-10-20 Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
* doc/extend.texi: Update documentation WRT inline functions.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 51fb895..4415ac3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-10-20 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ PR target/66912
+ * gcc.target/aarch64/pr66912.c: New.
+ * gcc.target/arm/pr66912.c: New.
+
2015-10-19 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/pr67900.f90: New tests.
diff --git a/gcc/testsuite/gcc.target/aarch64/pr66912.c b/gcc/testsuite/gcc.target/aarch64/pr66912.c
new file mode 100644
index 0000000..b8aabcd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr66912.c
@@ -0,0 +1,42 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fpic" } */
+
+__attribute__((visibility("protected")))
+int n_common;
+
+__attribute__((weak, visibility("protected")))
+int n_weak_common;
+
+__attribute__((visibility("protected")))
+int n_init = -1;
+
+__attribute__((weak, visibility("protected")))
+int n_weak_init = -1;
+
+int
+f1 ()
+{
+ /* { dg-final { scan-assembler ":got(page_lo15)?:n_common" } } */
+ return n_common;
+}
+
+int
+f2 ()
+{
+ /* { dg-final { scan-assembler ":got(page_lo15)?:n_weak_common" } } */
+ return n_weak_common;
+}
+
+int
+f3 ()
+{
+ /* { dg-final { scan-assembler ":got(page_lo15)?:n_init" } } */
+ return n_init;
+}
+
+int
+f4 ()
+{
+ /* { dg-final { scan-assembler ":got(page_lo15)?:n_weak_init" } } */
+ return n_weak_init;
+}
diff --git a/gcc/testsuite/gcc.target/arm/pr66912.c b/gcc/testsuite/gcc.target/arm/pr66912.c
new file mode 100644
index 0000000..27e4c45
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr66912.c
@@ -0,0 +1,42 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fpic" } */
+
+__attribute__((visibility("protected")))
+int n_common;
+
+__attribute__((weak, visibility("protected")))
+int n_weak_common;
+
+__attribute__((visibility("protected")))
+int n_init = -1;
+
+__attribute__((weak, visibility("protected")))
+int n_weak_init = -1;
+
+int
+f1 ()
+{
+ /* { dg-final { scan-assembler "\\.word\\tn_common\\(GOT\\)" } } */
+ return n_common;
+}
+
+int
+f2 ()
+{
+ /* { dg-final { scan-assembler "\\.word\\tn_weak_common\\(GOT\\)" } } */
+ return n_weak_common;
+}
+
+int
+f3 ()
+{
+ /* { dg-final { scan-assembler "\\.word\\tn_init\\(GOT\\)" } } */
+ return n_init;
+}
+
+int
+f4 ()
+{
+ /* { dg-final { scan-assembler "\\.word\\tn_weak_init\\(GOT\\)" } } */
+ return n_weak_init;
+}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index f1564bc..ff9d271 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -6898,12 +6898,13 @@ default_binds_local_p (const_tree exp)
return default_binds_local_p_3 (exp, flag_shlib != 0, true, false, false);
}
-/* Similar to default_binds_local_p, but common symbol may be local. */
+/* Similar to default_binds_local_p, but common symbol may be local and
+ extern protected data is non-local. */
bool
default_binds_local_p_2 (const_tree exp)
{
- return default_binds_local_p_3 (exp, flag_shlib != 0, true, false,
+ return default_binds_local_p_3 (exp, flag_shlib != 0, true, true,
!flag_pic);
}