Automatic date update in version.in
[binutils-gdb.git] / gold / testsuite / retain.sh
blob6e8a6f1ac7b1098913a0f174160bdbb59519ce73
1 #!/bin/sh
3 # retain.sh -- Tests for SHF_GNU_RETAIN.
5 # Copyright (C) 2020-2022 Free Software Foundation, Inc.
7 # This file is part of gold.
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.
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.
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.
24 set -e
26 check()
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
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
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
60 exit $status