]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gold/testsuite/retain.sh
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gold / testsuite / retain.sh
1 #!/bin/sh
2
3 # retain.sh -- Tests for SHF_GNU_RETAIN.
4
5 # Copyright (C) 2020-2021 Free Software Foundation, Inc.
6
7 # This file is part of gold.
8
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 # MA 02110-1301, USA.
23
24 set -e
25
26 check()
27 {
28 number_of_occurrence=`egrep "$2" ./$1 -o | wc -l`
29 if [ $number_of_occurrence != $3 ]
30 then
31 echo "$1: \"$2\" $3: Failed"
32 status=1
33 fi
34 }
35
36 status=0
37 check retain_1.out " T fnretain1" 1
38 check retain_1.out " b lsretain0.2" 1
39 check retain_1.out " b lsretain1.1" 1
40 check retain_1.out " d lsretain2.0" 1
41 check retain_1.out " B retain0" 1
42 check retain_1.out " B retain1" 1
43 check retain_1.out " D retain2" 1
44 check retain_1.out " b sretain0" 1
45 check retain_1.out " b sretain1" 1
46 check retain_1.out " d sretain2" 1
47 if grep discard retain_1.out
48 then
49 echo "retain_1.out: Garbage collection failed"
50 status=1
51 fi
52
53 check retain_2.out " \(PREINIT_ARRAY\)" 1
54 check retain_2.out " \(PREINIT_ARRAYSZ\)" 1
55 check retain_2.out " \(INIT_ARRAY\)" 1
56 check retain_2.out " \(INIT_ARRAYSZ\)" 1
57 check retain_2.out " \(FINI_ARRAY\)" 1
58 check retain_2.out " \(FINI_ARRAYSZ\)" 1
59
60 exit $status