(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
debug/
btf/
btf-datasec-1.c
       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-options "-O0 -gbtf -dA -msdata=none" { target { { powerpc*-*-* } && ilp32 } } } */
      15  /* { dg-options "-O0 -gbtf -dA -msmall-data-limit=0" { target { riscv*-*-* } } } */
      16  /* { dg-options "-O0 -gbtf -dA -G0" { target { nios2-*-* } } } */
      17  
      18  /* Check for two DATASEC entries with vlen 3, and one with vlen 1.  */
      19  /* { dg-final { scan-assembler-times "0xf000003\[\t \]+\[^\n\]*btt_info" 2 } } */
      20  /* { dg-final { scan-assembler-times "0xf000001\[\t \]+\[^\n\]*btt_info" 1 } } */
      21  
      22  /* The offset entry for each variable in a DATSEC should be 0 at compile time.  */
      23  /* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 7 } } */
      24  
      25  /* Check that strings for each DATASEC have been added to the BTF string table.  */
      26  /* { dg-final { scan-assembler-times "ascii \".data.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
      27  /* { dg-final { scan-assembler-times "ascii \".rodata.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
      28  /* { dg-final { scan-assembler-times "ascii \".bss.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
      29  
      30  int a;
      31  long long b;
      32  const long unsigned int c;
      33  
      34  int d = 137;
      35  
      36  const int e = -55;
      37  
      38  int bigarr[20][10];
      39  
      40  struct c_struct {
      41    long x;
      42    char c;
      43  };
      44  
      45  const struct c_struct my_cstruct = {
      46    99,
      47    '?'
      48  };