xref: /aosp_15_r20/external/elfutils/tests/run-readelf-d.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# #include <stdio.h>
21*7304104dSAndroid Build Coastguard Worker#
22*7304104dSAndroid Build Coastguard Worker# __thread int i;
23*7304104dSAndroid Build Coastguard Worker#
24*7304104dSAndroid Build Coastguard Worker# void print_i ()
25*7304104dSAndroid Build Coastguard Worker# {
26*7304104dSAndroid Build Coastguard Worker#   printf("%d\n", i);
27*7304104dSAndroid Build Coastguard Worker# }
28*7304104dSAndroid Build Coastguard Worker#
29*7304104dSAndroid Build Coastguard Worker# gcc -fPIC -shared -o testlib_dynseg.so testlib_dynseg.c
30*7304104dSAndroid Build Coastguard Worker# With ld --version
31*7304104dSAndroid Build Coastguard Worker# GNU gold (GNU Binutils 2.22.52.20120402) 1.11
32*7304104dSAndroid Build Coastguard Worker
33*7304104dSAndroid Build Coastguard Workertestfiles testlib_dynseg.so
34*7304104dSAndroid Build Coastguard Worker
35*7304104dSAndroid Build Coastguard Workertestrun_compare ${abs_top_builddir}/src/readelf -d testlib_dynseg.so <<\EOF
36*7304104dSAndroid Build Coastguard Worker
37*7304104dSAndroid Build Coastguard WorkerDynamic segment contains 23 entries:
38*7304104dSAndroid Build Coastguard Worker Addr: 0x00000000000017e0  Offset: 0x0007e0  Link to section: [ 3] '.dynstr'
39*7304104dSAndroid Build Coastguard Worker  Type              Value
40*7304104dSAndroid Build Coastguard Worker  PLTGOT            0x00000000000019c8
41*7304104dSAndroid Build Coastguard Worker  PLTRELSZ          72 (bytes)
42*7304104dSAndroid Build Coastguard Worker  JMPREL            0x0000000000000568
43*7304104dSAndroid Build Coastguard Worker  PLTREL            RELA
44*7304104dSAndroid Build Coastguard Worker  RELA              0x00000000000004d8
45*7304104dSAndroid Build Coastguard Worker  RELASZ            144 (bytes)
46*7304104dSAndroid Build Coastguard Worker  RELAENT           24 (bytes)
47*7304104dSAndroid Build Coastguard Worker  RELACOUNT         1
48*7304104dSAndroid Build Coastguard Worker  SYMTAB            0x0000000000000228
49*7304104dSAndroid Build Coastguard Worker  SYMENT            24 (bytes)
50*7304104dSAndroid Build Coastguard Worker  STRTAB            0x0000000000000360
51*7304104dSAndroid Build Coastguard Worker  STRSZ             190 (bytes)
52*7304104dSAndroid Build Coastguard Worker  GNU_HASH          0x0000000000000420
53*7304104dSAndroid Build Coastguard Worker  NEEDED            Shared library: [libc.so.6]
54*7304104dSAndroid Build Coastguard Worker  NEEDED            Shared library: [ld-linux-x86-64.so.2]
55*7304104dSAndroid Build Coastguard Worker  INIT              0x00000000000005b0
56*7304104dSAndroid Build Coastguard Worker  FINI              0x0000000000000748
57*7304104dSAndroid Build Coastguard Worker  VERSYM            0x0000000000000460
58*7304104dSAndroid Build Coastguard Worker  VERDEF            0x000000000000047c
59*7304104dSAndroid Build Coastguard Worker  VERDEFNUM         1
60*7304104dSAndroid Build Coastguard Worker  VERNEED           0x0000000000000498
61*7304104dSAndroid Build Coastguard Worker  VERNEEDNUM        2
62*7304104dSAndroid Build Coastguard Worker  NULL
63*7304104dSAndroid Build Coastguard WorkerEOF
64*7304104dSAndroid Build Coastguard Worker
65*7304104dSAndroid Build Coastguard Workerexit 0
66