Automatic date update in version.in
[binutils-gdb.git] / gold / testsuite / plugin_layout_with_alignment.sh
blobc6a95d823df8b3aaa67a8c933cadb2306e009994
1 #!/bin/sh
3 # plugin_layout_with_alignment.sh -- test
5 # Copyright (C) 2016-2024 Free Software Foundation, Inc.
6 # Written by Than McIntosh <thanm@google.com>.
8 # This file is part of gold.
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.
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.
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.
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.
30 set -e
32 check()
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;
45 if (!saw2) {
46 printf \"did not see $3\\n\";
47 exit 1;
49 if (!saw3) {
50 printf \"did not see $4\\n\";
51 exit 1;
53 if (!saw4) {
54 printf \"did not see $5\\n\";
55 exit 1;
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;
61 }" $1
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"