]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - 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
CommitLineData
82838bd6
CC
1// plugin_layout_with_alignment.cc -- a test case for gold
2
250d07de 3// Copyright (C) 2016-2021 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
30const short rodata_item1 = 101;
31
1275dd72 32__attribute__ ((section(".rodata.v2_a1"), aligned(1)))
82838bd6
CC
33const char rodata_item2 = 'a';
34
1275dd72 35__attribute__ ((section(".rodata.v3_a8"), aligned(8)))
82838bd6
CC
36const double rodata_item3 = 777.777;
37
1275dd72 38__attribute__ ((section(".rodata.v4_a1"), aligned(1)))
82838bd6
CC
39const 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
44short rwdata_item1 = 101;
45
1275dd72 46__attribute__ ((section(".data.v2_a1"), aligned(1)))
82838bd6
CC
47char rwdata_item2 = 'a';
48
1275dd72 49__attribute__ ((section(".data.v3_a8"), aligned(8)))
82838bd6
CC
50double rwdata_item3 = 'b';
51
1275dd72 52__attribute__ ((section(".data.v4_a1"), aligned(1)))
82838bd6
CC
53char rwdata_item4[3] = {'a', 'b', 'c'};
54
55// --- Uninitialized .data items
56
1275dd72 57__attribute__ ((section(".bss.v1_a2"), aligned(2)))
82838bd6
CC
58short bss_item1;
59
1275dd72 60__attribute__ ((section(".bss.v2_a1"), aligned(1)))
82838bd6
CC
61char bss_item2;
62
1275dd72 63__attribute__ ((section(".bss.v3_a8"), aligned(8)))
82838bd6
CC
64struct blah { union { double d; char c; } u; } bss_item3;
65
1275dd72 66__attribute__ ((section(".bss.v4_a1"), aligned(1)))
82838bd6
CC
67char bss_item4[3];
68
fd91f002 69int main (void)
82838bd6
CC
70{
71 return 0;
72}