| 1 |
/* Test -mno-pic-data-is-text-relative option. No relative addressing |
| 2 |
of elements in .data and .bss are allowed with that option. */ |
| 3 |
|
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-O3 -fno-optimize-sibling-calls -fpic -mno-pic-data-is-text-relative -march=z10 -mtune=z9-109 -mzarch" } */ |
| 6 |
|
| 7 |
static int a = 3; |
| 8 |
|
| 9 |
/* With -mno-pic-data-is-text-relative these must be addressed via |
| 10 |
GOT. */ |
| 11 |
|
| 12 |
int __attribute__((noinline,noclone)) |
| 13 |
foo () |
| 14 |
{ |
| 15 |
return a; |
| 16 |
} |
| 17 |
|
| 18 |
/* Just to make a potentially modified. */ |
| 19 |
|
| 20 |
void |
| 21 |
bar (int b) |
| 22 |
{ |
| 23 |
a = b; |
| 24 |
} |
| 25 |
|
| 26 |
/* { dg-final { scan-assembler-times "\\.LANCHOR\\d+@GOTENT" 2 } } */ |
| 27 |
|
| 28 |
/* The exrl target is a label_ref which should not be affected at |
| 29 |
all. */ |
| 30 |
|
| 31 |
void |
| 32 |
mymemcpy (char *dst, char *src, long size) |
| 33 |
{ |
| 34 |
__builtin_memcpy (dst, src, size); |
| 35 |
} |
| 36 |
|
| 37 |
/* { dg-final { scan-assembler "exrl" } } */ |
| 38 |
|
| 39 |
|
| 40 |
/* PLT slots can still be addressed relatively. */ |
| 41 |
|
| 42 |
int |
| 43 |
callfoo () |
| 44 |
{ |
| 45 |
return foo (); |
| 46 |
} |
| 47 |
|
| 48 |
/* { dg-final { scan-assembler-times "foo@PLT" 1 } } */ |
| 49 |
|
| 50 |
|
| 51 |
/* GOT entries can still be addressed relatively. */ |
| 52 |
|
| 53 |
void * |
| 54 |
fooptr () |
| 55 |
{ |
| 56 |
return &foo; |
| 57 |
} |
| 58 |
|
| 59 |
/* { dg-final { scan-assembler-times "foo@GOTENT" 1 } } */ |