1 // plugin_layout_with_alignment.cc -- a test case for gold
3 // Copyright (C) 2016-2019 Free Software Foundation, Inc.
4 // Written by Than McIntosh <thanm@google.com>.
6 // This file is part of gold.
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.
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.
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.
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.
27 // --- Initialized .rodata items
29 __attribute__ ((section(".rodata.v1_a2"), aligned(2)))
30 const short rodata_item1
= 101;
32 __attribute__ ((section(".rodata.v2_a1"), aligned(1)))
33 const char rodata_item2
= 'a';
35 __attribute__ ((section(".rodata.v3_a8"), aligned(8)))
36 const double rodata_item3
= 777.777;
38 __attribute__ ((section(".rodata.v4_a1"), aligned(1)))
39 const char rodata_item4
[7] = {'1', '2', '3', '4', '5', '6', '7'};
41 // --- Initialized .data items
43 __attribute__ ((section(".data.v1_a2"), aligned(2)))
44 short rwdata_item1
= 101;
46 __attribute__ ((section(".data.v2_a1"), aligned(1)))
47 char rwdata_item2
= 'a';
49 __attribute__ ((section(".data.v3_a8"), aligned(8)))
50 double rwdata_item3
= 'b';
52 __attribute__ ((section(".data.v4_a1"), aligned(1)))
53 char rwdata_item4
[3] = {'a', 'b', 'c'};
55 // --- Uninitialized .data items
57 __attribute__ ((section(".bss.v1_a2"), aligned(2)))
60 __attribute__ ((section(".bss.v2_a1"), aligned(1)))
63 __attribute__ ((section(".bss.v3_a8"), aligned(8)))
64 struct blah
{ union { double d
; char c
; } u
; } bss_item3
;
66 __attribute__ ((section(".bss.v4_a1"), aligned(1)))