Debian Codegraph @

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

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