| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -dA -gbtf -masm=normal" } */ |
| 3 |
|
| 4 |
struct T { |
| 5 |
int a; |
| 6 |
int b; |
| 7 |
struct U { |
| 8 |
int c; |
| 9 |
struct V { |
| 10 |
int d; |
| 11 |
int e[4]; |
| 12 |
int f; |
| 13 |
} v; |
| 14 |
} u; |
| 15 |
} __attribute__((preserve_access_index)); |
| 16 |
|
| 17 |
__attribute__((section("foo_sec"), used)) |
| 18 |
int foo_func (struct T *t) |
| 19 |
{ |
| 20 |
t->u.c = 5; |
| 21 |
return t->u.v.e[3]; |
| 22 |
} |
| 23 |
|
| 24 |
__attribute__((section("bar_sec"), used)) |
| 25 |
int bar_func (struct T *t) |
| 26 |
{ |
| 27 |
int *x = &(t->u.v.f); |
| 28 |
int old = *x; |
| 29 |
*x = 4; |
| 30 |
return old; |
| 31 |
} |
| 32 |
|
| 33 |
/* { dg-final { scan-assembler-times "FuncInfo section string for foo_sec" 1 } } */ |
| 34 |
/* { dg-final { scan-assembler-times "FuncInfo section string for bar_sec" 1 } } */ |
| 35 |
/* { dg-final { scan-assembler-times "label for function foo_func" 1 } } */ |
| 36 |
/* { dg-final { scan-assembler-times "label for function bar_func" 1 } } */ |
| 37 |
|
| 38 |
/* { dg-final { scan-assembler-times "ascii \"foo_sec.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 39 |
/* { dg-final { scan-assembler-times "ascii \"bar_sec.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 40 |
/* { dg-final { scan-assembler-times "FuncInfo entry size" 1 } } */ |
| 41 |
|
| 42 |
/* { dg-final { scan-assembler-times ".4byte\t0x1\t# Number of entries" 3 } } */ |
| 43 |
/* { dg-final { scan-assembler-times ".4byte\t0x2\t# Number of entries" 1 } } */ |
| 44 |
/* { dg-final { scan-assembler-times "Required padding" 1 } } */ |