Debian Codegraph @

gcc/testsuite/gcc.c-torture/compile/attr-used-retain-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-require-effective-target R_flag_in_section } */
3 /* { dg-final { scan-assembler-not ".text.*,\"axR\"" } } */
4 /* { dg-final { scan-assembler-not ".bss.*,\"awR\"" } } */
5 /* { dg-final { scan-assembler-not ".data.*,\"awR\"" } } */
6 /* { dg-final { scan-assembler-not ".rodata.*,\"aR\"" } } */
7 /* { dg-final { scan-assembler-not ".data.used_foo_sec,\"awR\"" } } */
8
9 void __attribute__((used)) used_fn (void) { }
10 void unused_fn (void) { }
11 void __attribute__((hot,used)) used_hot_fn (void) { }
12 void __attribute__((hot)) unused_hot_fn (void) { }
13 void __attribute__((cold,used)) used_cold_fn (void) { }
14 void __attribute__((cold)) unused_cold_fn (void) { }
15 int __attribute__((used)) used_bss = 0;
16 int __attribute__((used)) used_data = 1;
17 const int __attribute__((used)) used_rodata = 2;
18 int __attribute__((used)) used_comm;
19 static int __attribute__((used)) used_lcomm;
20
21 int unused_bss = 0;
22 int unused_data = 1;
23 const int unused_rodata = 2;
24 int unused_comm;
25 static int unused_lcomm;
26
27 /* Test switching back to the retained sections. */
28 void __attribute__((used)) used_fn2 (void) { }
29 int __attribute__((used)) used_bss2 = 0;
30 int __attribute__((used)) used_data2 = 1;
31 const int __attribute__((used)) used_rodata2 = 2;
32 int __attribute__((used)) used_comm2;
33 static int __attribute__((used)) used_lcomm2;
34
35 int __attribute__((used,section(".data.used_foo_sec"))) used_foo = 2;