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