aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/nios2
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2017-10-26 16:49:48 -0400
committerSandra Loosemore <sandra@gcc.gnu.org>2017-10-26 16:49:48 -0400
commitde10fca02a806c8c323041c5e904abaaef510fc0 (patch)
treef40537de19218fb2bcb55461d96038ae8d100d5d /gcc/testsuite/gcc.target/nios2
parent31498bee1acc00d89ea82c9c8614aa65f1eff2e8 (diff)
downloadgcc-de10fca02a806c8c323041c5e904abaaef510fc0.zip
gcc-de10fca02a806c8c323041c5e904abaaef510fc0.tar.gz
gcc-de10fca02a806c8c323041c5e904abaaef510fc0.tar.bz2
nios2.c: Include xregex.h.
2017-10-26 Sandra Loosemore <sandra@codesourcery.com> gcc/ * config/nios2/nios2.c: Include xregex.h. (nios2_gprel_sec_regex): New. (nios2_option_overide): Initialize it. Don't allow GP-relative addressing with PIC. (nios2_small_section_name_p): Check for regex match. * config/nios2/nios2.opt (mgprel-sec=): New option. * doc/invoke.texi (Option Summary): Add -mgprel-sec. (Nios II Options): Document -mgprel-sec. gcc/testsuite/ * gcc.target/nios2/gpopt-gprel-sec.c: New. From-SVN: r254123
Diffstat (limited to 'gcc/testsuite/gcc.target/nios2')
-rw-r--r--gcc/testsuite/gcc.target/nios2/gpopt-gprel-sec.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/nios2/gpopt-gprel-sec.c b/gcc/testsuite/gcc.target/nios2/gpopt-gprel-sec.c
new file mode 100644
index 0000000..1083fe6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nios2/gpopt-gprel-sec.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mgpopt=local -mgprel-sec=\\.frog.+" } */
+
+extern int a __attribute__ ((section (".frog1")));
+static volatile int b __attribute__ ((section (".frog2"))) = 1;
+extern int c __attribute__ ((section (".data")));
+static volatile int d __attribute__ ((section (".data"))) = 2;
+
+extern int e;
+static volatile int f = 3;
+
+volatile int g __attribute__ ((weak)) = 4;
+
+extern int h[100];
+static int i[100];
+static int j[100] __attribute__ ((section (".sdata")));
+
+typedef int (*ftype) (int);
+extern int foo (int);
+
+extern int bar (int, int*, int*, int*, ftype);
+
+int baz (void)
+{
+ return bar (a + b + c + d + e + f + g, h, i, j, foo);
+}
+
+/* { dg-final { scan-assembler "%gprel\\(a\\)" } } */
+/* { dg-final { scan-assembler "%gprel\\(b\\)" } } */
+/* { dg-final { scan-assembler-not "%gprel\\(c\\)" } } */
+/* { dg-final { scan-assembler-not "%gprel\\(d\\)" } } */
+/* { dg-final { scan-assembler-not "%gprel\\(e\\)" } } */
+/* { dg-final { scan-assembler "%gprel\\(f\\)" } } */
+/* { dg-final { scan-assembler-not "%gprel\\(g\\)" } } */
+/* { dg-final { scan-assembler-not "%gprel\\(h\\)" } } */
+/* { dg-final { scan-assembler-not "%gprel\\(i\\)" } } */
+/* { dg-final { scan-assembler "%gprel\\(j\\)" } } */
+/* { dg-final { scan-assembler-not "%gprel\\(foo\\)" } } */