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 "0\[\t \]+\[^\n\]*bts_offset" 1 } } */
      15  /* { dg-final { scan-assembler-times "1\[\t \]+\[^\n\]*bts_size" 1 } } */
      16  
      17  extern const void foo __attribute__((weak)) __attribute__((section (".ksyms")));
      18  extern const void bar __attribute__((weak)) __attribute__((section (".ksyms")));
      19  
      20  unsigned long func () {
      21    unsigned long x = (unsigned long) &foo;
      22  
      23    return x;
      24  }
      25