summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/s390/nodatarel-1.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2017-07-31 14:43:24 +0200
committerMartin Jambor <mjambor@suse.cz>2017-07-31 14:43:24 +0200
commitb32f12dece884f1fa0f04c643a77105aff6ce8bc (patch)
treecdab5f10806561fc198f907299b0e55eb5701ef0 /gcc/testsuite/gcc.target/s390/nodatarel-1.c
parent166bec868d991fdf71f9a66f994e5977fcab4aa2 (diff)
parenta168a775e93ec31ae743ad282d8e60fa1c116891 (diff)
downloadgcc-b32f12dece884f1fa0f04c643a77105aff6ce8bc.tar.gz
Merge branch 'master' into gcngcn
Diffstat (limited to 'gcc/testsuite/gcc.target/s390/nodatarel-1.c')
-rw-r--r--gcc/testsuite/gcc.target/s390/nodatarel-1.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/s390/nodatarel-1.c b/gcc/testsuite/gcc.target/s390/nodatarel-1.c
new file mode 100644
index 00000000000..1d589a10947
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nodatarel-1.c
@@ -0,0 +1,83 @@
+/* Test -mno-pic-data-is-text-relative option. No relative addressing
+ of elements in .data and .bss are allowed with that option. */
+
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-optimize-sibling-calls -fpic -mno-pic-data-is-text-relative -march=z10 -mtune=z9-109 -mzarch" } */
+
+static int a = 3;
+
+/* With -mno-pic-data-is-text-relative these must be addressed via
+ GOT. */
+
+int __attribute__((noinline,noclone))
+foo ()
+{
+ return a;
+}
+
+static int __attribute__((noinline,noclone))
+foostatic (void)
+{
+ return a;
+}
+
+/* Just to make a potentially modified. */
+
+void
+bar (int b)
+{
+ a = b;
+}
+
+/* { dg-final { scan-assembler-times "a@GOTENT" 3 } } */
+
+/* The exrl target is a label_ref which should not be affected at
+ all. */
+
+void
+mymemcpy (char *dst, char *src, long size)
+{
+ __builtin_memcpy (dst, src, size);
+}
+
+/* { dg-final { scan-assembler "exrl" } } */
+
+
+/* PLT slots can still be addressed relatively. */
+
+int
+callfoo ()
+{
+ return foo ();
+}
+
+/* { dg-final { scan-assembler-times "foo@PLT" 1 } } */
+
+
+/* GOT entries can still be addressed relatively. */
+
+void *
+fooptr ()
+{
+ return &foo;
+}
+
+/* { dg-final { scan-assembler-times "foo@GOTENT" 1 } } */
+
+
+/* A static function can be addressed relatively. */
+
+int
+callfoostatic ()
+{
+ return foostatic ();
+}
+
+void *
+foostaticptr ()
+{
+ return &foostatic;
+}
+
+
+/* { dg-final { scan-assembler-not "foostatic@" } } */