]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gold/testsuite/retain.sh
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gold / testsuite / retain.sh
CommitLineData
ff4bc37d
CC
1#!/bin/sh
2
3# retain.sh -- Tests for SHF_GNU_RETAIN.
4
250d07de 5# Copyright (C) 2020-2021 Free Software Foundation, Inc.
ff4bc37d
CC
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
24set -e
25
26check()
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
36status=0
37check retain_1.out " T fnretain1" 1
38check retain_1.out " b lsretain0.2" 1
39check retain_1.out " b lsretain1.1" 1
40check retain_1.out " d lsretain2.0" 1
41check retain_1.out " B retain0" 1
42check retain_1.out " B retain1" 1
43check retain_1.out " D retain2" 1
44check retain_1.out " b sretain0" 1
45check retain_1.out " b sretain1" 1
46check retain_1.out " d sretain2" 1
47if grep discard retain_1.out
48then
49 echo "retain_1.out: Garbage collection failed"
50 status=1
51fi
52
53check retain_2.out " \(PREINIT_ARRAY\)" 1
54check retain_2.out " \(PREINIT_ARRAYSZ\)" 1
55check retain_2.out " \(INIT_ARRAY\)" 1
56check retain_2.out " \(INIT_ARRAYSZ\)" 1
57check retain_2.out " \(FINI_ARRAY\)" 1
58check retain_2.out " \(FINI_ARRAYSZ\)" 1
59
60exit $status