aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c
blob: 77df88648c54ded6f9d06649f3dad8dc826ee253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* BTF generation of BTF_KIND_DATASEC records.

   We expect 3 DATASEC records: one for each of .data, .rodata and .bss.
   .rodata: the consts; c,e,my_cstruct
   .bss:    a,b,bigarr
   .data:   d

   The type IDs of the variables placed in each section are not deterministic
   so we cannot check them.
 */

/* { dg-do compile )  */
/* { dg-options "-O0 -gbtf -dA" } */
/* { dg-options "-O0 -gbtf -dA -msdata=none" { target { { powerpc*-*-* } && ilp32 } } } */
/* { dg-options "-O0 -gbtf -dA -msmall-data-limit=0" { target { riscv*-*-* } } } */
/* { dg-options "-O0 -gbtf -dA -G0" { target { nios2-*-* } } } */

/* Check for two DATASEC entries with vlen 3, and one with vlen 1.  */
/* { dg-final { scan-assembler-times "0xf000003\[\t \]+\[^\n\]*btt_info" 2 } } */
/* { dg-final { scan-assembler-times "0xf000001\[\t \]+\[^\n\]*btt_info" 1 } } */

/* The offset entry for each variable in a DATSEC should be 0 at compile time.  */
/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 7 } } */

/* Check that strings for each DATASEC have been added to the BTF string table.  */
/* { dg-final { scan-assembler-times "ascii \".data.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
/* { dg-final { scan-assembler-times "ascii \".rodata.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
/* { dg-final { scan-assembler-times "ascii \".bss.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */

int a;
long long b;
const long unsigned int c;

int d = 137;

const int e = -55;

int bigarr[20][10];

struct c_struct {
  long x;
  char c;
};

const struct c_struct my_cstruct = {
  99,
  '?'
};