1#! /bin/sh
2# Copyright (C) 2015 Red Hat, Inc.
3# This file is part of elfutils.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# elfutils is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18. $srcdir/test-subr.sh
19
20# = funcs.s =
21# .globl testfunc
22# testfunc:
23# 	nop
24# 	ret
25# .type testfunc, @function
26# .size testfunc, .-testfunc
27#
28# .globl testfunc2
29# testfunc2:
30# 	call testfunc
31# 	nop
32# 	nop
33# 	ret
34# .type testfunc2, @function
35# .size testfunc2, .-testfunc2
36#
37# .globl functest3
38# functest3:
39# 	jmp local
40# 	nop
41# 	nop
42# local:
43# 	call testfunc2
44# 	ret
45# .type functest3, @function
46# .size functest3, .-functest3
47
48# = start.s =
49# .global _start
50# _start:
51# 	call functest3
52# 	nop
53# 	nop
54# 	nop
55# 	nop
56# 	nop
57# 	nop
58# 	nop
59# 	nop
60# 	nop
61# 	nop
62# 	nop
63# 	nop
64# 	nop
65# 	nop
66# 	nop
67# 	nop
68# 	ret
69# .type _start, @function
70# .size _start, .-_start
71
72# gas --compress-debug-sections=zlib-gnu -32 -g -o start.o start.s
73# gas --compress-debug-sections=zlib-gnu -32 -g -o funcs.o funcs.s
74# ld --compress-debug-sections=zlib-gnu -melf_i386 -g -o zgnu32 funcs.o start.o
75
76# gas --compress-debug-sections=zlib-gnu -64 -g -o start.o start.s
77# gas --compress-debug-sections=zlib-gnu -64 -g -o funcs.o funcs.s
78# ld --compress-debug-sections=zlib-gnu -g -o zgnu32 funcs.o start.o
79
80testfiles testfile-zgnu64
81testrun_compare ${abs_top_builddir}/tests/dwelfgnucompressed testfile-zgnu64 <<\EOF
82section 2: GNU Compressed size: 60
83section 3: GNU Compressed size: aa
84section 5: GNU Compressed size: 8d
85EOF
86
87testfiles testfile-zgnu64be
88testrun_compare ${abs_top_builddir}/tests/dwelfgnucompressed testfile-zgnu64be <<\EOF
89section 3: GNU Compressed size: 60
90section 4: GNU Compressed size: 7e
91section 6: GNU Compressed size: 8d
92EOF
93
94testfiles testfile-zgnu32
95testrun_compare ${abs_top_builddir}/tests/dwelfgnucompressed testfile-zgnu32 <<\EOF
96section 2: GNU Compressed size: 40
97section 3: GNU Compressed size: 9a
98section 5: GNU Compressed size: 85
99EOF
100
101testfiles testfile-zgnu32be
102testrun_compare ${abs_top_builddir}/tests/dwelfgnucompressed testfile-zgnu32be <<\EOF
103section 3: GNU Compressed size: 40
104section 4: GNU Compressed size: 6e
105section 6: GNU Compressed size: 85
106EOF
107
108exit 0
109