]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gold/testsuite/plugin_layout_with_alignment.c
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gold / testsuite / plugin_layout_with_alignment.c
1 // plugin_layout_with_alignment.cc -- a test case for gold
2
3 // Copyright (C) 2016-2021 Free Software Foundation, Inc.
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
29 __attribute__ ((section(".rodata.v1_a2"), aligned(2)))
30 const short rodata_item1 = 101;
31
32 __attribute__ ((section(".rodata.v2_a1"), aligned(1)))
33 const char rodata_item2 = 'a';
34
35 __attribute__ ((section(".rodata.v3_a8"), aligned(8)))
36 const double rodata_item3 = 777.777;
37
38 __attribute__ ((section(".rodata.v4_a1"), aligned(1)))
39 const char rodata_item4[7] = {'1', '2', '3', '4', '5', '6', '7'};
40
41 // --- Initialized .data items
42
43 __attribute__ ((section(".data.v1_a2"), aligned(2)))
44 short rwdata_item1 = 101;
45
46 __attribute__ ((section(".data.v2_a1"), aligned(1)))
47 char rwdata_item2 = 'a';
48
49 __attribute__ ((section(".data.v3_a8"), aligned(8)))
50 double rwdata_item3 = 'b';
51
52 __attribute__ ((section(".data.v4_a1"), aligned(1)))
53 char rwdata_item4[3] = {'a', 'b', 'c'};
54
55 // --- Uninitialized .data items
56
57 __attribute__ ((section(".bss.v1_a2"), aligned(2)))
58 short bss_item1;
59
60 __attribute__ ((section(".bss.v2_a1"), aligned(1)))
61 char bss_item2;
62
63 __attribute__ ((section(".bss.v3_a8"), aligned(8)))
64 struct blah { union { double d; char c; } u; } bss_item3;
65
66 __attribute__ ((section(".bss.v4_a1"), aligned(1)))
67 char bss_item4[3];
68
69 int main (void)
70 {
71 return 0;
72 }