xref: /aosp_15_r20/external/elfutils/tests/run-readelf-Dd.sh (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1#! /bin/sh
2# Copyright (C) 2022 Red Hat, Inc.
3# This file is part of elfutils.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# elfutils is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18. $srcdir/test-subr.sh
19
20# #include <stdio.h>
21#
22# __thread int i;
23#
24# void print_i ()
25# {
26#   printf("%d\n", i);
27# }
28#
29# gcc -fPIC -shared -o testlib_dynseg.so testlib_dynseg.c
30# With ld --version
31# GNU gold (GNU Binutils 2.22.52.20120402) 1.11
32
33# The same testfile is used in run-readelf-d.sh
34testfiles testlib_dynseg.so
35
36testrun_compare ${abs_top_builddir}/src/readelf -Dd testlib_dynseg.so <<\EOF
37
38Dynamic segment contains 23 entries:
39 Addr: 0x00000000000017e0  Offset: 0x0007e0
40  Type              Value
41  PLTGOT            0x00000000000019c8
42  PLTRELSZ          72 (bytes)
43  JMPREL            0x0000000000000568
44  PLTREL            RELA
45  RELA              0x00000000000004d8
46  RELASZ            144 (bytes)
47  RELAENT           24 (bytes)
48  RELACOUNT         1
49  SYMTAB            0x0000000000000228
50  SYMENT            24 (bytes)
51  STRTAB            0x0000000000000360
52  STRSZ             190 (bytes)
53  GNU_HASH          0x0000000000000420
54  NEEDED            Shared library: [libc.so.6]
55  NEEDED            Shared library: [ld-linux-x86-64.so.2]
56  INIT              0x00000000000005b0
57  FINI              0x0000000000000748
58  VERSYM            0x0000000000000460
59  VERDEF            0x000000000000047c
60  VERDEFNUM         1
61  VERNEED           0x0000000000000498
62  VERNEEDNUM        2
63  NULL
64EOF
65
66exit 0
67