xref: /aosp_15_r20/external/elfutils/tests/run-unstrip-n.sh (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1*7304104dSAndroid Build Coastguard Worker#! /bin/sh
2*7304104dSAndroid Build Coastguard Worker# Copyright (C) 2012 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# https://bugzilla.redhat.com/show_bug.cgi?id=805447
21*7304104dSAndroid Build Coastguard Worker# eu-unstrip emits garbage for librt.so.1
22*7304104dSAndroid Build Coastguard Worker#
23*7304104dSAndroid Build Coastguard Worker# #include <stdio.h>
24*7304104dSAndroid Build Coastguard Worker# #include <sys/mman.h>
25*7304104dSAndroid Build Coastguard Worker#
26*7304104dSAndroid Build Coastguard Worker# int main(int argc, char **argv)
27*7304104dSAndroid Build Coastguard Worker# {
28*7304104dSAndroid Build Coastguard Worker#  // Yes, this crashes... That is the point.
29*7304104dSAndroid Build Coastguard Worker#  return shm_open(argv[1], 0, 0);
30*7304104dSAndroid Build Coastguard Worker# }
31*7304104dSAndroid Build Coastguard Worker#
32*7304104dSAndroid Build Coastguard Worker# gcc -m32 -o rt_crash -lrt rt_crash.c
33*7304104dSAndroid Build Coastguard Worker
34*7304104dSAndroid Build Coastguard Workertestfiles testcore-rtlib testcore-rtlib-ppc
35*7304104dSAndroid Build Coastguard Worker
36*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/src/unstrip -n --core=testcore-rtlib <<\EOF
37*7304104dSAndroid Build Coastguard Worker0x8048000+0x2000 f1c600bc36cb91bf01f9a63a634ecb79aa4c3199@0x8048178 . - [exe]
38*7304104dSAndroid Build Coastguard Worker0xf75e9000+0x1a000 29a103420abe341e92072fb14274e250e4072148@0xf75e9164 - - libpthread.so.0
39*7304104dSAndroid Build Coastguard Worker0xf7603000+0x1b0000 0b9bf374699e141e5dfc14757ff42b8c2373b4de@0xf7603184 - - libc.so.6
40*7304104dSAndroid Build Coastguard Worker0xf77b3000+0x9000 c6c5b5e35ab9589d4762ac85b4bd56b1b2720e37@0xf77b3164 - - librt.so.1
41*7304104dSAndroid Build Coastguard Worker0xf77d6000+0x1000 676560b1b765cde9c2e53f134f4ee354ea894747@0xf77d6210 . - linux-gate.so.1
42*7304104dSAndroid Build Coastguard Worker0xf77d7000+0x21000 6d2cb32650054f1c176d01d48713a4a5e5e84c1a@0xf77d7124 - - ld-linux.so.2
43*7304104dSAndroid Build Coastguard WorkerEOF
44*7304104dSAndroid Build Coastguard Worker
45*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/src/unstrip -n --core=testcore-rtlib-ppc <<\EOF
46*7304104dSAndroid Build Coastguard Worker0x100000+0x10000 708b900b05176964512a6b0fe90c2a0c9d73d726@0x100334 . - linux-vdso32.so.1
47*7304104dSAndroid Build Coastguard Worker0xfd50000+0x30000 3f7d21508470322d2f47acddc20ab10516edba99@0xfd50164 . - librt.so.1
48*7304104dSAndroid Build Coastguard Worker0xfdb0000+0x40000 f6ee91d4c629bc7dacc10534cb30056914e7e0b5@0xfdb0164 - - libpthread.so.0
49*7304104dSAndroid Build Coastguard Worker0xfdf0000+0x1c0000 edf3dd232e09d01b90683889bd16b9406c52d4de@0xfdf0184 - - libc.so.6
50*7304104dSAndroid Build Coastguard Worker0xffb0000+0x50000 edec437a85026a1cf8cda94003706202733130c1@0xffb0124 - - ld.so.1
51*7304104dSAndroid Build Coastguard Worker0x10000000+0x20000 979b7a26747cc09bd84a42b311b5288c704baea5@0x10000174 . - [exe]
52*7304104dSAndroid Build Coastguard WorkerEOF
53*7304104dSAndroid Build Coastguard Worker
54*7304104dSAndroid Build Coastguard Worker# FAIL was 0x7f67f2caf000 for test-core-lib.so .
55*7304104dSAndroid Build Coastguard Worker# /lib64/libc.so.6 and /lib64/ld-linux-x86-64.so.2 from link map
56*7304104dSAndroid Build Coastguard Worker# do not have ELF header stored in the core file.
57*7304104dSAndroid Build Coastguard Worker# ELF headers in the core file:
58*7304104dSAndroid Build Coastguard Worker# Offset   VirtAddr
59*7304104dSAndroid Build Coastguard Worker# 0x014000 0x00007f67f2caf000 ./test-core-lib.so
60*7304104dSAndroid Build Coastguard Worker# 0x03a000 0x00007fff1596c000 linux-vdso.so.1
61*7304104dSAndroid Build Coastguard Workertestfiles test-core.core test-core.exec
62*7304104dSAndroid Build Coastguard Workerrm -f test-core-lib.so
63*7304104dSAndroid Build Coastguard Workeroutfile=test-core.out
64*7304104dSAndroid Build Coastguard Workertestrun_out $outfile ${abs_top_builddir}/src/unstrip -n -e test-core.exec --core=test-core.core
65*7304104dSAndroid Build Coastguard Workeroutfile2=test-core.out2
66*7304104dSAndroid Build Coastguard Workerremove_files="$remove_files $outfile2"
67*7304104dSAndroid Build Coastguard Workergrep -v libc.so.6 $outfile | sort >$outfile2
68*7304104dSAndroid Build Coastguard Workerdiff -u $outfile2 - <<EOF
69*7304104dSAndroid Build Coastguard Worker0x400000+0x202038 - test-core.exec - test-core.exec
70*7304104dSAndroid Build Coastguard Worker0x7f67f2aaf000+0x202000 - . - /home/jkratoch/redhat/elfutils-libregr/test-core-lib.so
71*7304104dSAndroid Build Coastguard Worker0x7fff1596c000+0x1000 a9cf37f53897b5468ee018655760be61b8633d3c@0x7fff1596c340 . - linux-vdso.so.1
72*7304104dSAndroid Build Coastguard WorkerEOF
73*7304104dSAndroid Build Coastguard Worker
74*7304104dSAndroid Build Coastguard Workertest_cleanup
75*7304104dSAndroid Build Coastguard Worker
76*7304104dSAndroid Build Coastguard Workerexit 0
77