Debian Codegraph @

gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c

raw
1 /* Test BTF generation of DATASEC records for extern functions.
2
3 Only functions declared extern should have entries in DATASEC records. */
4
5 /* { dg-do compile } */
6 /* { dg-options "-O0 -gbtf -dA" } */
7
8 /* Expect one DATASEC with vlen=1 (.foo_sec) and one with vlen=2 (.bar_sec) */
9 /* { dg-final { scan-assembler-times " BTF_KIND_DATASEC '.foo_sec'\[\\r\\n\]+\[^\\r\\n\]*0xf000001\[\t \]+\[^\n\]*btt_info" 1 } } */
10 /* { dg-final { scan-assembler-times " BTF_KIND_DATASEC '.bar_sec'\[\\r\\n\]+\[^\\r\\n\]*0xf000002\[\t \]+\[^\n\]*btt_info" 1 } } */
11
12 /* Function entries should have offset with a label and size of 0 at compile time. */
13 /* { dg-final { scan-assembler-times "chacha\[\t \]+\[^\n\]*bts_offset" 1 { target { bpf-*-* } }} } */
14 /* { dg-final { scan-assembler-times "bar\[\t \]+\[^\n\]*bts_offset" 1 { target { bpf-*-* } } } } */
15 /* { dg-final { scan-assembler-times "foo\[\t \]+\[^\n\]*bts_offset" 1 { target { bpf-*-* } } } } */
16 /* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 3 { target { ! bpf-*-* } } } } */
17
18 /* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_size" 3 } } */
19
20 extern int foo (int a) __attribute__((section(".foo_sec")));
21
22
23 extern int bar (int b) __attribute__((section(".bar_sec")));
24 extern void chacha (void) __attribute__((section(".bar_sec")));
25
26 __attribute__((section(".foo_sec")))
27 void baz (int *x)
28 {
29 chacha ();
30
31 *x = foo (bar (*x));
32 }