| 1 |
/* Test BTF generation for extern variable with both non-defining and |
| 2 |
defining declarations. |
| 3 |
|
| 4 |
In this case, only a single variable record should be emitted, |
| 5 |
with 'global' linkage. However two array types will be generated. */ |
| 6 |
|
| 7 |
/* { dg-do compile } */ |
| 8 |
/* { dg-options "-O0 -gbtf -dA" } */ |
| 9 |
|
| 10 |
/* Expect 1 variable with global (1) linkage. */ |
| 11 |
/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 1 } } */ |
| 12 |
/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*btv_linkage" 1 } } */ |
| 13 |
|
| 14 |
/* Expect 2 array types, one of which is unsized. For BPF target, -gprune-btf |
| 15 |
is the default and will remove the unsized array type. */ |
| 16 |
/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*bta_nelems" 1 } } */ |
| 17 |
/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*bta_nelems" 1 { target { !bpf-*-* } } } } */ |
| 18 |
/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*bta_nelems" 0 { target { bpf-*-* } } } } */ |
| 19 |
|
| 20 |
extern const char FOO[]; |
| 21 |
const char FOO[] = "foo"; |