manual copyright year range of various GDB files to add 2023
[binutils-gdb.git] / gold / testsuite / pr23016_1.sh
blob076fcc913228e2bd75da18d0e8b2eec565cc2d96
1 #!/bin/sh
3 # pr23016_1.sh -- check that .eh_frame sections and their relocations
4 # are merged together even when mixing SHT_PROGBITS and SHT_X86_64_UNWIND.
6 # Copyright (C) 2018-2023 Free Software Foundation, Inc.
7 # Written by Cary Coutant <ccoutant@gmail.com>.
9 # This file is part of gold.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
24 # MA 02110-1301, USA.
26 set -e
28 check() {
29 awk -v "FILE=$1" '
30 BEGIN {
31 progbits = 0;
32 unwind = 0;
33 ehframe_rel = 0;
34 relocx = 0;
35 relocy = 0;
37 /\.eh_frame *PROGBITS/ {
38 progbits++;
40 /\.eh_frame *X86_64_UNWIND/ {
41 unwind++;
43 /^Relocation section .\.rela\.eh_frame/ {
44 ehframe_rel++;
46 /R_X86_64_64.*x \+ 0/ {
47 relocx++;
49 /R_X86_64_64.*y \+ 0/ {
50 relocy++;
52 END {
53 errs = 0;
54 if (progbits != 0)
56 printf "%s: There should be no .eh_frame sections of type PROGBITS.\n", FILE;
57 errs++;
59 if (unwind != 1)
61 printf "%s: There should be exactly one .eh_frame section of type X86_64_UNWIND.\n", FILE;
62 errs++;
64 if (ehframe_rel != 1)
66 printf "%s: There should be exactly one .rela.eh_frame relocation section.\n", FILE;
67 errs++;
69 if (relocx != 1)
71 printf "%s: There should be exactly one relocation for x.\n", FILE;
72 errs++;
74 if (relocy != 1)
76 printf "%s: There should be exactly one relocation for y.\n", FILE;
77 errs++;
79 exit errs;
81 ' $1
84 check pr23016_1.stdout
85 check pr23016_1r.stdout
87 exit 0