summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/s390/nodatarel-1.c
blob: 1d589a109472292e57525d2da31720faebb743d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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@" } } */