aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c
new file mode 100644
index 000000000..413cdf381
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c
@@ -0,0 +1,17 @@
+/* Check that GOTPCREL is used to access glob_a. */
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-require-effective-target pie_copyreloc } */
+/* { dg-options "-O2 -fpie" } */
+
+extern int glob_a __attribute__((weak));
+
+int foo ()
+{
+ if (&glob_a != 0)
+ return glob_a;
+ else
+ return 0;
+}
+
+/* weak glob_a should be accessed with a GOTPCREL. */
+/* { dg-final { scan-assembler "glob_a@GOTPCREL" { target { ! ia32 } } } } */