aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/btf/btf-variables-3.c
blob: 8cae22123af997fc036365d35b3f5d480004bf1e (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
/* Test BTF generation for static versus global variables.

   BTF_KIND_VAR types represeting variables are followed by a 32-bit
   "linkage", which can take one of currently two valid values:
      0 = static
      1 = global

   In this test, make a few static and a few global variables, and ensure
   they are noted with the correct "linkage" values.  */

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

/* Expect 6 variables.  */
/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 6 } } */

/* 3 global, 3 static.  */
/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*btv_linkage" 3 } } */
/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*btv_linkage" 3 } } */

int a;

static long b;

struct foo {
  int x;
  int y;
};

struct foo g_foo;

static struct foo s_foo;

static unsigned int s_arr [10][5];

unsigned int g_arr [20];