1  /* Test BTF generation of DATASEC records for extern functions.
       2  
       3     Only functions declared extern should have entries in DATASEC records.  */
       4  
       5  /* { dg-do compile } */
       6  /* { dg-options "-O0 -gbtf -dA" } */
       7  
       8  /* Expect one DATASEC with vlen=1 (.foo_sec) and one with vlen=2 (.bar_sec) */
       9  /* { dg-final { scan-assembler-times "0xf000002\[\t \]+\[^\n\]*btt_info" 1 } } */
      10  /* { dg-final { scan-assembler-times "0xf000001\[\t \]+\[^\n\]*btt_info" 1 } } */
      11  
      12  /* Function entries should have offset and size of 0 at compile time.  */
      13  /* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 3 } } */
      14  /* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_size" 3 } } */
      15  
      16  extern int foo (int a) __attribute__((section(".foo_sec")));
      17  
      18  
      19  extern int bar (int b) __attribute__((section(".bar_sec")));
      20  extern void chacha (void) __attribute__((section(".bar_sec")));
      21  
      22  __attribute__((section(".foo_sec")))
      23  void baz (int *x)
      24  {
      25    chacha ();
      26  
      27    *x = foo (bar (*x));
      28  }