| 1 |
/* Test BTF generation for static versus global variables. |
| 2 |
|
| 3 |
BTF_KIND_VAR types represeting variables are followed by a 32-bit |
| 4 |
"linkage", which can take one of currently two valid values: |
| 5 |
0 = static |
| 6 |
1 = global |
| 7 |
|
| 8 |
In this test, make a few static and a few global variables, and ensure |
| 9 |
they are noted with the correct "linkage" values. */ |
| 10 |
|
| 11 |
/* { dg-do compile } */ |
| 12 |
/* { dg-options "-O0 -gbtf -dA" } */ |
| 13 |
|
| 14 |
/* Expect 6 variables. */ |
| 15 |
/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 6 } } */ |
| 16 |
|
| 17 |
/* 3 global, 3 static. */ |
| 18 |
/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*btv_linkage" 3 } } */ |
| 19 |
/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*btv_linkage" 3 } } */ |
| 20 |
|
| 21 |
int a; |
| 22 |
|
| 23 |
static long b; |
| 24 |
|
| 25 |
struct foo { |
| 26 |
int x; |
| 27 |
int y; |
| 28 |
}; |
| 29 |
|
| 30 |
struct foo g_foo; |
| 31 |
|
| 32 |
static struct foo s_foo; |
| 33 |
|
| 34 |
static unsigned int s_arr [10][5]; |
| 35 |
|
| 36 |
unsigned int g_arr [20]; |