summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/mips-sdata-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/mips-sdata-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/torture/mips-sdata-1.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/mips-sdata-1.c b/gcc/testsuite/gcc.dg/torture/mips-sdata-1.c
new file mode 100644
index 000000000..8ffd4d848
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/mips-sdata-1.c
@@ -0,0 +1,10 @@
+/* Check that sdata-accesses are applied regardless of size or ABI. */
+/* { dg-options -mexplicit-relocs } */
+/* { dg-do compile { target mips*-*-elf* } } */
+
+struct s { int x[4]; };
+struct s my_struct __attribute__((__section__(".sdata")));
+
+int f() { return my_struct.x[0]; }
+
+/* { dg-final { scan-assembler {gp_?rel\(my_struct} } } */