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 zgnu64 funcs.o start.o 79*7304104dSAndroid Build Coastguard Worker 80*7304104dSAndroid Build Coastguard Worker# gas --compress-debug-sections=zlib-gabi -32 -g -o start.o start.s 81*7304104dSAndroid Build Coastguard Worker# gas --compress-debug-sections=zlib-gabi -32 -g -o funcs.o funcs.s 82*7304104dSAndroid Build Coastguard Worker# ld --compress-debug-sections=zlib-gabi -melf_i386 -g -o zgabi32 funcs.o start.o 83*7304104dSAndroid Build Coastguard Worker 84*7304104dSAndroid Build Coastguard Worker# gas --compress-debug-sections=zlib-gabi -64 -g -o start.o start.s 85*7304104dSAndroid Build Coastguard Worker# gas --compress-debug-sections=zlib-gabi -64 -g -o funcs.o funcs.s 86*7304104dSAndroid Build Coastguard Worker# ld --compress-debug-sections=zlib-gabi -g -o zgabi64 funcs.o start.o 87*7304104dSAndroid Build Coastguard Worker 88*7304104dSAndroid Build Coastguard Workertestfiles testfile-zgnu64 89*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu64 <<\EOF 90*7304104dSAndroid Build Coastguard Workersection 1: NOT Compressed 91*7304104dSAndroid Build Coastguard Workersection 2: GNU Compressed size: 60 92*7304104dSAndroid Build Coastguard Workersection 3: GNU Compressed size: aa 93*7304104dSAndroid Build Coastguard Workersection 4: NOT Compressed 94*7304104dSAndroid Build Coastguard Workersection 5: GNU Compressed size: 8d 95*7304104dSAndroid Build Coastguard Workersection 6: NOT Compressed 96*7304104dSAndroid Build Coastguard Workersection 7: NOT Compressed 97*7304104dSAndroid Build Coastguard Workersection 8: NOT Compressed 98*7304104dSAndroid Build Coastguard WorkerEOF 99*7304104dSAndroid Build Coastguard Worker 100*7304104dSAndroid Build Coastguard Workertestfiles testfile-zgabi64 101*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi64 <<\EOF 102*7304104dSAndroid Build Coastguard Workersection 1: NOT Compressed 103*7304104dSAndroid Build Coastguard Workersection 2: ELF Compressed ch_type: 1, ch_size: 60, ch_addralign: 10 104*7304104dSAndroid Build Coastguard Workersection 3: ELF Compressed ch_type: 1, ch_size: aa, ch_addralign: 1 105*7304104dSAndroid Build Coastguard Workersection 4: NOT Compressed 106*7304104dSAndroid Build Coastguard Workersection 5: ELF Compressed ch_type: 1, ch_size: 8d, ch_addralign: 1 107*7304104dSAndroid Build Coastguard Workersection 6: NOT Compressed 108*7304104dSAndroid Build Coastguard Workersection 7: NOT Compressed 109*7304104dSAndroid Build Coastguard Workersection 8: NOT Compressed 110*7304104dSAndroid Build Coastguard WorkerEOF 111*7304104dSAndroid Build Coastguard Worker 112*7304104dSAndroid Build Coastguard Workertestfiles testfile-zgnu32 113*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu32 <<\EOF 114*7304104dSAndroid Build Coastguard Workersection 1: NOT Compressed 115*7304104dSAndroid Build Coastguard Workersection 2: GNU Compressed size: 40 116*7304104dSAndroid Build Coastguard Workersection 3: GNU Compressed size: 9a 117*7304104dSAndroid Build Coastguard Workersection 4: NOT Compressed 118*7304104dSAndroid Build Coastguard Workersection 5: GNU Compressed size: 85 119*7304104dSAndroid Build Coastguard Workersection 6: NOT Compressed 120*7304104dSAndroid Build Coastguard Workersection 7: NOT Compressed 121*7304104dSAndroid Build Coastguard Workersection 8: NOT Compressed 122*7304104dSAndroid Build Coastguard WorkerEOF 123*7304104dSAndroid Build Coastguard Worker 124*7304104dSAndroid Build Coastguard Workertestfiles testfile-zgabi32 125*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi32 <<\EOF 126*7304104dSAndroid Build Coastguard Workersection 1: NOT Compressed 127*7304104dSAndroid Build Coastguard Workersection 2: ELF Compressed ch_type: 1, ch_size: 40, ch_addralign: 8 128*7304104dSAndroid Build Coastguard Workersection 3: ELF Compressed ch_type: 1, ch_size: 9a, ch_addralign: 1 129*7304104dSAndroid Build Coastguard Workersection 4: NOT Compressed 130*7304104dSAndroid Build Coastguard Workersection 5: ELF Compressed ch_type: 1, ch_size: 85, ch_addralign: 1 131*7304104dSAndroid Build Coastguard Workersection 6: NOT Compressed 132*7304104dSAndroid Build Coastguard Workersection 7: NOT Compressed 133*7304104dSAndroid Build Coastguard Workersection 8: NOT Compressed 134*7304104dSAndroid Build Coastguard WorkerEOF 135*7304104dSAndroid Build Coastguard Worker 136*7304104dSAndroid Build Coastguard Workertestfiles testfile-zgnu64be 137*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu64be <<\EOF 138*7304104dSAndroid Build Coastguard Workersection 1: NOT Compressed 139*7304104dSAndroid Build Coastguard Workersection 2: NOT Compressed 140*7304104dSAndroid Build Coastguard Workersection 3: GNU Compressed size: 60 141*7304104dSAndroid Build Coastguard Workersection 4: GNU Compressed size: 7e 142*7304104dSAndroid Build Coastguard Workersection 5: NOT Compressed 143*7304104dSAndroid Build Coastguard Workersection 6: GNU Compressed size: 8d 144*7304104dSAndroid Build Coastguard Workersection 7: NOT Compressed 145*7304104dSAndroid Build Coastguard Workersection 8: NOT Compressed 146*7304104dSAndroid Build Coastguard Workersection 9: NOT Compressed 147*7304104dSAndroid Build Coastguard WorkerEOF 148*7304104dSAndroid Build Coastguard Worker 149*7304104dSAndroid Build Coastguard Workertestfiles testfile-zgabi64be 150*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi64be <<\EOF 151*7304104dSAndroid Build Coastguard Workersection 1: NOT Compressed 152*7304104dSAndroid Build Coastguard Workersection 2: NOT Compressed 153*7304104dSAndroid Build Coastguard Workersection 3: ELF Compressed ch_type: 1, ch_size: 60, ch_addralign: 10 154*7304104dSAndroid Build Coastguard Workersection 4: ELF Compressed ch_type: 1, ch_size: 7e, ch_addralign: 1 155*7304104dSAndroid Build Coastguard Workersection 5: NOT Compressed 156*7304104dSAndroid Build Coastguard Workersection 6: ELF Compressed ch_type: 1, ch_size: 8d, ch_addralign: 1 157*7304104dSAndroid Build Coastguard Workersection 7: NOT Compressed 158*7304104dSAndroid Build Coastguard Workersection 8: NOT Compressed 159*7304104dSAndroid Build Coastguard Workersection 9: NOT Compressed 160*7304104dSAndroid Build Coastguard WorkerEOF 161*7304104dSAndroid Build Coastguard Worker 162*7304104dSAndroid Build Coastguard Workertestfiles testfile-zgnu32be 163*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu32be <<\EOF 164*7304104dSAndroid Build Coastguard Workersection 1: NOT Compressed 165*7304104dSAndroid Build Coastguard Workersection 2: NOT Compressed 166*7304104dSAndroid Build Coastguard Workersection 3: GNU Compressed size: 40 167*7304104dSAndroid Build Coastguard Workersection 4: GNU Compressed size: 6e 168*7304104dSAndroid Build Coastguard Workersection 5: NOT Compressed 169*7304104dSAndroid Build Coastguard Workersection 6: GNU Compressed size: 85 170*7304104dSAndroid Build Coastguard Workersection 7: NOT Compressed 171*7304104dSAndroid Build Coastguard Workersection 8: NOT Compressed 172*7304104dSAndroid Build Coastguard Workersection 9: NOT Compressed 173*7304104dSAndroid Build Coastguard WorkerEOF 174*7304104dSAndroid Build Coastguard Worker 175*7304104dSAndroid Build Coastguard Workertestfiles testfile-zgabi32be 176*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi32be <<\EOF 177*7304104dSAndroid Build Coastguard Workersection 1: NOT Compressed 178*7304104dSAndroid Build Coastguard Workersection 2: NOT Compressed 179*7304104dSAndroid Build Coastguard Workersection 3: ELF Compressed ch_type: 1, ch_size: 40, ch_addralign: 8 180*7304104dSAndroid Build Coastguard Workersection 4: ELF Compressed ch_type: 1, ch_size: 6e, ch_addralign: 1 181*7304104dSAndroid Build Coastguard Workersection 5: NOT Compressed 182*7304104dSAndroid Build Coastguard Workersection 6: ELF Compressed ch_type: 1, ch_size: 85, ch_addralign: 1 183*7304104dSAndroid Build Coastguard Workersection 7: NOT Compressed 184*7304104dSAndroid Build Coastguard Workersection 8: NOT Compressed 185*7304104dSAndroid Build Coastguard Workersection 9: NOT Compressed 186*7304104dSAndroid Build Coastguard WorkerEOF 187*7304104dSAndroid Build Coastguard Worker 188*7304104dSAndroid Build Coastguard Workerexit 0 189