Debian Codegraph @

gcc/testsuite/gcc.target/bpf/core-section-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O0 -gbtf -dA -mco-re" } */
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 };
16
17 __attribute__((section("foo_sec"), used))
18 int foo_func (struct T *t)
19 {
20 t->u.c = 5;
21 return __builtin_preserve_access_index (t->u.v.e[3]);
22 }
23
24 __attribute__((section("bar_sec"), used))
25 int bar_func (struct T *t)
26 {
27 int *x = __builtin_preserve_access_index (&(t->u.v.f));
28 int old = *x;
29 *x = 4;
30 return old;
31 }
32
33 /* { dg-final { scan-assembler-times "ascii \"0:2:1:1:3.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
34 /* { dg-final { scan-assembler-times "ascii \"0:2:1:2.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
35 /* { dg-final { scan-assembler-times "ascii \"foo_sec.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
36 /* { dg-final { scan-assembler-times "ascii \"bar_sec.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
37 /* { dg-final { scan-assembler-times "bpfcr_type" 2 } } */
38 /* { dg-final { scan-assembler-times "CoreInfo entry size" 1 } } */