Debian Codegraph @

gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c

raw
1 /* Test BTF generation for extern const void symbols.
2 BTF_KIND_VAR records should be emitted for such symbols if they are used,
3 as well as a corresponding entry in the appropriate DATASEC record. */
4
5 /* { dg-do compile } */
6 /* { dg-options "-O0 -gbtf -dA" } */
7
8 /* Expect 1 variable record only for foo, with 'extern' (2) linkage. */
9 /* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 1 } } */
10 /* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*btv_linkage" 1 } } */
11
12 /* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */
13
14 /* { dg-final { scan-assembler-times "foo\[\t \]+\[^\n\]*bts_offset" 1 { target { bpf-*-* } } } } */
15 /* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 1 { target { ! bpf-*-* } } } } */
16 /* { dg-final { scan-assembler-times "1\[\t \]+\[^\n\]*bts_size" 1 } } */
17
18 extern const void foo __attribute__((weak)) __attribute__((section (".ksyms")));
19 extern const void bar __attribute__((weak)) __attribute__((section (".ksyms")));
20
21 __UINTPTR_TYPE__ func () {
22 __UINTPTR_TYPE__ x = (__UINTPTR_TYPE__) &foo;
23
24 return x;
25 }
26