| 1 |
/* { dg-do compile { target *-*-linux* } } */ |
| 2 |
/* { dg-options "-O2 -fpic" } */ |
| 3 |
/* { dg-require-effective-target fpic } */ |
| 4 |
|
| 5 |
__attribute__((visibility("protected"))) |
| 6 |
int n_common; |
| 7 |
|
| 8 |
__attribute__((weak, visibility("protected"))) |
| 9 |
int n_weak_common; |
| 10 |
|
| 11 |
__attribute__((visibility("protected"))) |
| 12 |
int n_init = -1; |
| 13 |
|
| 14 |
__attribute__((weak, visibility("protected"))) |
| 15 |
int n_weak_init = -1; |
| 16 |
|
| 17 |
int |
| 18 |
f1 () |
| 19 |
{ |
| 20 |
/* { dg-final { scan-assembler ":got(page_lo15)?:n_common" } } */ |
| 21 |
return n_common; |
| 22 |
} |
| 23 |
|
| 24 |
int |
| 25 |
f2 () |
| 26 |
{ |
| 27 |
/* { dg-final { scan-assembler ":got(page_lo15)?:n_weak_common" } } */ |
| 28 |
return n_weak_common; |
| 29 |
} |
| 30 |
|
| 31 |
int |
| 32 |
f3 () |
| 33 |
{ |
| 34 |
/* { dg-final { scan-assembler ":got(page_lo15)?:n_init" } } */ |
| 35 |
return n_init; |
| 36 |
} |
| 37 |
|
| 38 |
int |
| 39 |
f4 () |
| 40 |
{ |
| 41 |
/* { dg-final { scan-assembler ":got(page_lo15)?:n_weak_init" } } */ |
| 42 |
return n_weak_init; |
| 43 |
} |