| 1 |
/* Basic test for struct __attribute__((preserve_access_index)) |
| 2 |
for BPF CO-RE support. */ |
| 3 |
|
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-O0 -dA -gbtf -mco-re -masm=normal" } */ |
| 6 |
|
| 7 |
struct S { |
| 8 |
int a; |
| 9 |
int b; |
| 10 |
int c; |
| 11 |
} __attribute__((preserve_access_index)); |
| 12 |
|
| 13 |
void |
| 14 |
func (struct S * s) |
| 15 |
{ |
| 16 |
/* 0:2 */ |
| 17 |
int *x = &(s->c); |
| 18 |
|
| 19 |
*x = 4; |
| 20 |
} |
| 21 |
|
| 22 |
/* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ |
| 23 |
/* { dg-final { scan-assembler-times "bpfcr_type" 1 } } */ |