1#! /bin/sh
2# Copyright (C) 2012 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
33testfiles testlib_dynseg.so
34
35testrun_compare ${abs_top_builddir}/src/readelf -d testlib_dynseg.so <<\EOF
36
37Dynamic segment contains 28 entries:
38 Addr: 0x00000000000017e0  Offset: 0x0007e0  Link to section: [ 3] '.dynstr'
39  Type              Value
40  PLTGOT            0x00000000000019c8
41  PLTRELSZ          72 (bytes)
42  JMPREL            0x0000000000000568
43  PLTREL            RELA
44  RELA              0x00000000000004d8
45  RELASZ            144 (bytes)
46  RELAENT           24 (bytes)
47  RELACOUNT         1
48  SYMTAB            0x0000000000000228
49  SYMENT            24 (bytes)
50  STRTAB            0x0000000000000360
51  STRSZ             190 (bytes)
52  GNU_HASH          0x0000000000000420
53  NEEDED            Shared library: [libc.so.6]
54  NEEDED            Shared library: [ld-linux-x86-64.so.2]
55  INIT              0x00000000000005b0
56  FINI              0x0000000000000748
57  VERSYM            0x0000000000000460
58  VERDEF            0x000000000000047c
59  VERDEFNUM         1
60  VERNEED           0x0000000000000498
61  VERNEEDNUM        2
62  NULL
63  NULL
64  NULL
65  NULL
66  NULL
67  NULL
68EOF
69
70exit 0
71