]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gold/testsuite/pr23016_1.sh
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gold / testsuite / pr23016_1.sh
CommitLineData
bce5a025
CC
1#!/bin/sh
2
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.
5
d87bef3a 6# Copyright (C) 2018-2023 Free Software Foundation, Inc.
bce5a025
CC
7# Written by Cary Coutant <ccoutant@gmail.com>.
8
9# This file is part of gold.
10
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.
15
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.
20
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.
25
26set -e
27
28check() {
29 awk -v "FILE=$1" '
30 BEGIN {
31 progbits = 0;
32 unwind = 0;
33 ehframe_rel = 0;
34 relocx = 0;
35 relocy = 0;
36 }
37 /\.eh_frame *PROGBITS/ {
38 progbits++;
39 }
40 /\.eh_frame *X86_64_UNWIND/ {
41 unwind++;
42 }
43 /^Relocation section .\.rela\.eh_frame/ {
44 ehframe_rel++;
45 }
46 /R_X86_64_64.*x \+ 0/ {
47 relocx++;
48 }
49 /R_X86_64_64.*y \+ 0/ {
50 relocy++;
51 }
52 END {
53 errs = 0;
54 if (progbits != 0)
55 {
56 printf "%s: There should be no .eh_frame sections of type PROGBITS.\n", FILE;
57 errs++;
58 }
59 if (unwind != 1)
60 {
61 printf "%s: There should be exactly one .eh_frame section of type X86_64_UNWIND.\n", FILE;
62 errs++;
63 }
64 if (ehframe_rel != 1)
65 {
66 printf "%s: There should be exactly one .rela.eh_frame relocation section.\n", FILE;
67 errs++;
68 }
69 if (relocx != 1)
70 {
71 printf "%s: There should be exactly one relocation for x.\n", FILE;
72 errs++;
73 }
74 if (relocy != 1)
75 {
76 printf "%s: There should be exactly one relocation for y.\n", FILE;
77 errs++;
78 }
79 exit errs;
80 }
81 ' $1
82}
83
84check pr23016_1.stdout
85check pr23016_1r.stdout
86
87exit 0