Debian Codegraph @

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

raw
1 /* BTF generation of BTF_KIND_DATASEC records.
2
3 We expect 3 DATASEC records: one for each of .data, .rodata and .bss.
4 .rodata: the consts; c,e,my_cstruct
5 .bss: a,b,bigarr
6 .data: d
7
8 The type IDs of the variables placed in each section are not deterministic
9 so we cannot check them.
10 */
11
12 /* { dg-do compile } */
13 /* { dg-options "-O0 -gbtf -dA" } */
14 /* { dg-additional-options "-msdata=none" { target { { powerpc*-*-* } && ilp32 } } } */
15 /* { dg-additional-options "-msmall-data-limit=0" { target { riscv*-*-* } } } */
16
17 /* Check for two DATASEC entries with vlen 3, and one with vlen 1. */
18 /* { dg-final { scan-assembler-times "0xf000003\[\t \]+\[^\n\]*btt_info" 2 } } */
19 /* { dg-final { scan-assembler-times "0xf000001\[\t \]+\[^\n\]*btt_info" 1 } } */
20
21 /* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 7 { target { ! bpf-*-* } } } } */
22
23 /* For BPF target the offset entry for each variable in a DATSEC should contain a label. */
24 /* { dg-final { scan-assembler-times ".4byte\[\t \]\[a-e\]\[\t \]+\[^\n\]*bts_offset" 5 { target bpf-*-* } } } */
25 /* { dg-final { scan-assembler-times "my_cstruct\[\t \]+\[^\n\]*bts_offset" 1 { target bpf-*-* } } } */
26 /* { dg-final { scan-assembler-times "bigarr\[\t \]+\[^\n\]*bts_offset" 1 { target bpf-*-* } } } */
27
28 /* Check that strings for each DATASEC have been added to the BTF string table. */
29 /* { dg-final { scan-assembler-times "ascii \".data.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
30 /* { dg-final { scan-assembler-times "ascii \".rodata.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
31 /* { dg-final { scan-assembler-times "ascii \".bss.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
32
33 int a;
34 long long b;
35 const long unsigned int c;
36
37 int d = 137;
38
39 const int e = -55;
40
41 int bigarr[20][10];
42
43 struct c_struct {
44 long x;
45 char c;
46 };
47
48 const struct c_struct my_cstruct = {
49 99,
50 '?'
51 };