| 1 |
/* PR debug/112849 |
| 2 |
Test that we do not incorrectly create BTF_KIND_DATASEC entries for |
| 3 |
extern decls with no known section. */ |
| 4 |
|
| 5 |
/* { dg-do compile } */ |
| 6 |
/* { dg-options "-O0 -gbtf -dA" } */ |
| 7 |
|
| 8 |
extern int VERSION __attribute__((section (".version"))); |
| 9 |
|
| 10 |
extern int ext1; |
| 11 |
extern int ext2; |
| 12 |
|
| 13 |
int var1 __attribute__((section (".sec_a"))); |
| 14 |
int var2 __attribute__((section (".sec_b"))) = 2; |
| 15 |
|
| 16 |
int |
| 17 |
foo (void) |
| 18 |
{ |
| 19 |
ext2 = VERSION; |
| 20 |
return ext1 + var1 + var2; |
| 21 |
} |
| 22 |
|
| 23 |
/* There should be 3 DATASEC entries total. Of the extern decls, only VERSION |
| 24 |
has a known section; entries are not created for the other two. */ |
| 25 |
/* { dg-final { scan-assembler-times "bts_type" 3 } } */ |
| 26 |
/* { dg-final { scan-assembler-times "bts_type: \\(BTF_KIND_VAR 'VERSION'\\)" 1 } } */ |
| 27 |
/* { dg-final { scan-assembler-not "bts_type: \\(BTF_KIND_VAR 'ext1'\\)" } } */ |
| 28 |
/* { dg-final { scan-assembler-not "bts_type: \\(BTF_KIND_VAR 'ext2'\\)" } } */ |