aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/bpf/core-attr-1.c
blob: 1af9dc5ea6de990b1232f815a7ce85fde2fee03d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Basic test for struct __attribute__((preserve_access_index))
   for BPF CO-RE support.  */

/* { dg-do compile } */
/* { dg-options "-O0 -dA -gbtf -mco-re" } */

struct S {
  int a;
  int b;
  int c;
} __attribute__((preserve_access_index));

void
func (struct S * s)
{
  /* 0:2 */
  int *x = &(s->c);

  *x = 4;
}

/* { dg-final { scan-assembler-times "ascii \"0:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
/* { dg-final { scan-assembler-times "bpfcr_type" 1 } } */