1#!/usr/local/bin/bash
2# Copyright (C) 2005, 2007, 2008, 2015 Red Hat, Inc.
3# This file is part of elfutils.
4# Written by Ulrich Drepper <drepper@redhat.com>, 2005.
5#
6# This file is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# elfutils is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19. $srcdir/test-subr.sh
20
21testfiles testfile18
22
23testrun_compare ${abs_top_builddir}/src/elflint --gnu-ld testfile18 <<\EOF
24section [ 8] '.rela.dyn': relocation 1: copy relocation against symbol of type FUNC
25EOF
26
27testfiles testfile32
28testrun ${abs_top_builddir}/src/elflint -q testfile32
29
30testfiles testfile33
31testrun ${abs_top_builddir}/src/elflint -q testfile33
32
33testfiles testfile42
34testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testfile42
35
36# Contains debuginfo, compress it, recheck
37tempfiles testfile42z
38testrun ${abs_top_builddir}/src/elfcompress -f -q -o testfile42z testfile42
39testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testfile42z
40
41testfiles testfile46
42testrun ${abs_top_builddir}/src/elflint -q testfile46
43
44# see also run-readelf-d.sh
45testfiles testlib_dynseg.so
46testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testlib_dynseg.so
47
48# s390x has SHT_HASH with sh_entsize 8 (really should be 4, but see common.h)
49# This was wrongly checked when comparing .gnu.hash and .hash.
50# Simple "int main (int argc, char **argv) { return 0; }"
51# gcc -Xlinker --hash-style=both -o testfile-s390x-hash-both s390x-hash-both.c
52testfiles testfile-s390x-hash-both
53testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testfile-s390x-hash-both
54
55# Compress the symtab/strtab just because and recheck
56tempfiles testfile-s390x-hash-bothz
57testrun ${abs_top_builddir}/src/elfcompress -f -q --name='.s??tab' -o testfile-s390x-hash-bothz testfile-s390x-hash-both
58testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testfile-s390x-hash-bothz
59
60exit 0
61