xref: /aosp_15_r20/external/elfutils/tests/run-strip-version.sh (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1*7304104dSAndroid Build Coastguard Worker#! /bin/sh
2*7304104dSAndroid Build Coastguard Worker# Copyright (C) 2018 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# Generated on s390x with an older gas (2.29.1) that generates
21*7304104dSAndroid Build Coastguard Worker# badly aligned version notes.
22*7304104dSAndroid Build Coastguard Worker#
23*7304104dSAndroid Build Coastguard Worker# = testfile-version.s =
24*7304104dSAndroid Build Coastguard Worker#
25*7304104dSAndroid Build Coastguard Worker#	.section ".extra"
26*7304104dSAndroid Build Coastguard Worker#	.byte 42
27*7304104dSAndroid Build Coastguard Worker#
28*7304104dSAndroid Build Coastguard Worker#	.version "Sliding Snow"
29*7304104dSAndroid Build Coastguard Worker#	.version "Hurr durr 3.1"
30*7304104dSAndroid Build Coastguard Worker#
31*7304104dSAndroid Build Coastguard Worker#        .globl  _start
32*7304104dSAndroid Build Coastguard Worker#_start:
33*7304104dSAndroid Build Coastguard Worker#
34*7304104dSAndroid Build Coastguard Worker# gcc -nostartfiles -nodefaultlibs -o testfile-version testfile-version.s
35*7304104dSAndroid Build Coastguard Worker
36*7304104dSAndroid Build Coastguard Workertestfiles testfile-version
37*7304104dSAndroid Build Coastguard Workertempfiles debug.out elf.out
38*7304104dSAndroid Build Coastguard Worker
39*7304104dSAndroid Build Coastguard Workertestrun ${abs_top_builddir}/src/strip -o elf.out -f debug.out \
40*7304104dSAndroid Build Coastguard Worker	testfile-version
41*7304104dSAndroid Build Coastguard Worker
42*7304104dSAndroid Build Coastguard Workertestrun ${abs_top_builddir}/src/elflint --gnu elf.out
43*7304104dSAndroid Build Coastguard Workertestrun ${abs_top_builddir}/src/elflint --gnu --debug debug.out
44*7304104dSAndroid Build Coastguard Worker
45*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/src/readelf -n debug.out <<\EOF
46*7304104dSAndroid Build Coastguard Worker
47*7304104dSAndroid Build Coastguard WorkerNote section [ 1] '.note.gnu.build-id' of 36 bytes at offset 0xb0:
48*7304104dSAndroid Build Coastguard Worker  Owner          Data size  Type
49*7304104dSAndroid Build Coastguard Worker  GNU                   20  GNU_BUILD_ID
50*7304104dSAndroid Build Coastguard Worker    Build ID: d3c84c0b307c06f50a37c6c0f59c82c4cb10720b
51*7304104dSAndroid Build Coastguard Worker
52*7304104dSAndroid Build Coastguard WorkerNote section [ 3] '.note' of 56 bytes at offset 0xd5:
53*7304104dSAndroid Build Coastguard Worker  Owner          Data size  Type
54*7304104dSAndroid Build Coastguard Worker  Sliding Snow           0  VERSION
55*7304104dSAndroid Build Coastguard Worker  Hurr durr 3.1          0  VERSION
56*7304104dSAndroid Build Coastguard WorkerEOF
57*7304104dSAndroid Build Coastguard Worker
58*7304104dSAndroid Build Coastguard Workerexit 0
59