aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-2.c
blob: d6f3358d6fb02f31b868a65f40d98f3b71dadf25 (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
/* Test BTF generation of DATASEC records for extern functions.

   Only functions declared extern should have entries in DATASEC records.  */

/* { dg-do compile } */
/* { dg-options "-O0 -gbtf -dA" } */

/* Expect one DATASEC with vlen=1 (.foo_sec) and one with vlen=2 (.bar_sec) */
/* { dg-final { scan-assembler-times " BTF_KIND_DATASEC '.foo_sec'\[\\r\\n\]+\[^\\r\\n\]*0xf000001\[\t \]+\[^\n\]*btt_info" 1 } } */
/* { dg-final { scan-assembler-times " BTF_KIND_DATASEC '.bar_sec'\[\\r\\n\]+\[^\\r\\n\]*0xf000002\[\t \]+\[^\n\]*btt_info" 1 } } */

/* Function entries should have offset and size of 0 at compile time.  */
/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 3 } } */
/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_size" 3 } } */

extern int foo (int a) __attribute__((section(".foo_sec")));


extern int bar (int b) __attribute__((section(".bar_sec")));
extern void chacha (void) __attribute__((section(".bar_sec")));

__attribute__((section(".foo_sec")))
void baz (int *x)
{
  chacha ();

  *x = foo (bar (*x));
}