Commit | Line | Data |
---|---|---|
82838bd6 CC |
1 | // plugin_layout_with_alignment.cc -- a test case for gold |
2 | ||
b3adc24a | 3 | // Copyright (C) 2016-2020 Free Software Foundation, Inc. |
82838bd6 CC |
4 | // Written by Than McIntosh <thanm@google.com>. |
5 | ||
6 | // This file is part of gold. | |
7 | ||
8 | // This program is free software; you can redistribute it and/or modify | |
9 | // it under the terms of the GNU General Public License as published by | |
10 | // the Free Software Foundation; either version 3 of the License, or | |
11 | // (at your option) any later version. | |
12 | ||
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | ||
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
21 | // MA 02110-1301, USA. | |
22 | ||
23 | // Verify that plugin interfaces for section size and alignment work | |
24 | // correctly, and that section ordering via plugins is working | |
25 | // for .bss/.rodata/.data sections. | |
26 | ||
27 | // --- Initialized .rodata items | |
28 | ||
1275dd72 | 29 | __attribute__ ((section(".rodata.v1_a2"), aligned(2))) |
82838bd6 CC |
30 | const short rodata_item1 = 101; |
31 | ||
1275dd72 | 32 | __attribute__ ((section(".rodata.v2_a1"), aligned(1))) |
82838bd6 CC |
33 | const char rodata_item2 = 'a'; |
34 | ||
1275dd72 | 35 | __attribute__ ((section(".rodata.v3_a8"), aligned(8))) |
82838bd6 CC |
36 | const double rodata_item3 = 777.777; |
37 | ||
1275dd72 | 38 | __attribute__ ((section(".rodata.v4_a1"), aligned(1))) |
82838bd6 CC |
39 | const char rodata_item4[7] = {'1', '2', '3', '4', '5', '6', '7'}; |
40 | ||
41 | // --- Initialized .data items | |
42 | ||
1275dd72 | 43 | __attribute__ ((section(".data.v1_a2"), aligned(2))) |
82838bd6 CC |
44 | short rwdata_item1 = 101; |
45 | ||
1275dd72 | 46 | __attribute__ ((section(".data.v2_a1"), aligned(1))) |
82838bd6 CC |
47 | char rwdata_item2 = 'a'; |
48 | ||
1275dd72 | 49 | __attribute__ ((section(".data.v3_a8"), aligned(8))) |
82838bd6 CC |
50 | double rwdata_item3 = 'b'; |
51 | ||
1275dd72 | 52 | __attribute__ ((section(".data.v4_a1"), aligned(1))) |
82838bd6 CC |
53 | char rwdata_item4[3] = {'a', 'b', 'c'}; |
54 | ||
55 | // --- Uninitialized .data items | |
56 | ||
1275dd72 | 57 | __attribute__ ((section(".bss.v1_a2"), aligned(2))) |
82838bd6 CC |
58 | short bss_item1; |
59 | ||
1275dd72 | 60 | __attribute__ ((section(".bss.v2_a1"), aligned(1))) |
82838bd6 CC |
61 | char bss_item2; |
62 | ||
1275dd72 | 63 | __attribute__ ((section(".bss.v3_a8"), aligned(8))) |
82838bd6 CC |
64 | struct blah { union { double d; char c; } u; } bss_item3; |
65 | ||
1275dd72 | 66 | __attribute__ ((section(".bss.v4_a1"), aligned(1))) |
82838bd6 CC |
67 | char bss_item4[3]; |
68 | ||
fd91f002 | 69 | int main (void) |
82838bd6 CC |
70 | { |
71 | return 0; | |
72 | } |