]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gold/testsuite/plugin_layout_with_alignment.sh
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gold / testsuite / plugin_layout_with_alignment.sh
1 #!/bin/sh
2
3 # plugin_layout_with_alignment.sh -- test
4
5 # Copyright (C) 2016-2021 Free Software Foundation, Inc.
6 # Written by Than McIntosh <thanm@google.com>.
7
8 # This file is part of gold.
9
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or
13 # (at your option) any later version.
14
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
19
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
23 # MA 02110-1301, USA.
24
25 # The goal of this program is to verify plugin alignment and size
26 # interfaces and working correctly in combination with section ordering.
27 # intended. File plugin_layout_with_alignment.cc is in this test.
28
29
30 set -e
31
32 check()
33 {
34 awk "
35 BEGIN { saw1 = 0; saw2 = 0; saw3 = 0; saw4 = 0; counter = 1; err = 0; ord = \"\"; }
36 /.*$2\$/ { saw1 = counter; counter = counter + 1; ord = ord \" $2\"; }
37 /.*$3\$/ { saw2 = counter; counter = counter + 1; ord = ord \" $3\"; }
38 /.*$4\$/ { saw3 = counter; counter = counter + 1; ord = ord \" $4\"; }
39 /.*$5\$/ { saw4 = counter; counter = counter + 1; ord = ord \" $5\"; }
40 END {
41 if (!saw1) {
42 printf \"did not see $2\\n\";
43 exit 1;
44 }
45 if (!saw2) {
46 printf \"did not see $3\\n\";
47 exit 1;
48 }
49 if (!saw3) {
50 printf \"did not see $4\\n\";
51 exit 1;
52 }
53 if (!saw4) {
54 printf \"did not see $5\\n\";
55 exit 1;
56 }
57 if (saw1 != 1 || saw2 != 2 || saw3 != 3 || saw4 != 4) {
58 printf \"incorrect ordering:\\nwas:%s\\nshould have been: $2 $3 $4 $5\\n\", ord;
59 exit 1;
60 }
61 }" $1
62 }
63
64 check plugin_layout_with_alignment.stdout "bss_item3" "bss_item1" "bss_item4" "bss_item2"
65 check plugin_layout_with_alignment.stdout "rwdata_item2" "rwdata_item4" "rwdata_item1" "rwdata_item3"
66 check plugin_layout_with_alignment.stdout "rodata_item3" "rodata_item1" "rodata_item2" "rodata_item4"