1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
#! /bin/sh
# Copyright (C) 2015 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# elfutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. $srcdir/test-subr.sh
# See run-elfgetchdr.sh for testfiles.
testfiles testfile-zgnu64
testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgnu64 <<\EOF
There are 9 section headers, starting at offset 0x3e0:
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[Compression Size Al]
[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0
[ 1] .text PROGBITS 0000000000400078 00000078 0000002a 0 AX 0 0 1
[ 2] .zdebug_aranges PROGBITS 0000000000000000 00000260 00000032 0 0 0 16
[GNU ZLIB 00000060 ]
[ 3] .zdebug_info PROGBITS 0000000000000000 00000292 0000006f 0 0 0 1
[GNU ZLIB 000000aa ]
[ 4] .debug_abbrev PROGBITS 0000000000000000 00000301 00000028 0 0 0 1
[ 5] .zdebug_line PROGBITS 0000000000000000 00000329 0000005b 0 0 0 1
[GNU ZLIB 0000008d ]
[ 6] .shstrtab STRTAB 0000000000000000 00000384 00000059 0 0 0 1
[ 7] .symtab SYMTAB 0000000000000000 000000a8 00000168 24 8 8 8
[ 8] .strtab STRTAB 0000000000000000 00000210 0000004b 0 0 0 1
EOF
testfiles testfile-zgnu64be
testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgnu64be <<\EOF
There are 10 section headers, starting at offset 0x438:
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[Compression Size Al]
[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0
[ 1] .text PROGBITS 0000000010000078 00000078 00000074 0 AX 0 0 8
[ 2] .eh_frame PROGBITS 00000000100000ec 000000ec 00000000 0 A 0 0 4
[ 3] .zdebug_aranges PROGBITS 0000000000000000 000002c0 00000034 0 0 0 16
[GNU ZLIB 00000060 ]
[ 4] .zdebug_info PROGBITS 0000000000000000 000002f4 00000059 0 0 0 1
[GNU ZLIB 0000007e ]
[ 5] .debug_abbrev PROGBITS 0000000000000000 0000034d 00000028 0 0 0 1
[ 6] .zdebug_line PROGBITS 0000000000000000 00000375 0000005b 0 0 0 1
[GNU ZLIB 0000008d ]
[ 7] .shstrtab STRTAB 0000000000000000 000003d0 00000063 0 0 0 1
[ 8] .symtab SYMTAB 0000000000000000 000000f0 00000180 24 9 9 8
[ 9] .strtab STRTAB 0000000000000000 00000270 00000044 0 0 0 1
EOF
testfiles testfile-zgabi64
testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgabi64 <<\EOF
There are 9 section headers, starting at offset 0x400:
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[Compression Size Al]
[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0
[ 1] .text PROGBITS 0000000000400078 00000078 0000002a 0 AX 0 0 1
[ 2] .debug_aranges PROGBITS 0000000000000000 00000260 0000003e 0 C 0 0 16
[ELF ZLIB (1) 00000060 16]
[ 3] .debug_info PROGBITS 0000000000000000 0000029e 0000007b 0 C 0 0 1
[ELF ZLIB (1) 000000aa 1]
[ 4] .debug_abbrev PROGBITS 0000000000000000 00000319 00000028 0 0 0 1
[ 5] .debug_line PROGBITS 0000000000000000 00000341 00000067 0 C 0 0 1
[ELF ZLIB (1) 0000008d 1]
[ 6] .shstrtab STRTAB 0000000000000000 000003a8 00000056 0 0 0 1
[ 7] .symtab SYMTAB 0000000000000000 000000a8 00000168 24 8 8 8
[ 8] .strtab STRTAB 0000000000000000 00000210 0000004b 0 0 0 1
EOF
testfiles testfile-zgabi64be
testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgabi64be <<\EOF
There are 10 section headers, starting at offset 0x458:
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[Compression Size Al]
[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0
[ 1] .text PROGBITS 0000000010000078 00000078 00000074 0 AX 0 0 8
[ 2] .eh_frame PROGBITS 00000000100000ec 000000ec 00000000 0 A 0 0 4
[ 3] .debug_aranges PROGBITS 0000000000000000 000002c0 00000040 0 C 0 0 16
[ELF ZLIB (1) 00000060 16]
[ 4] .debug_info PROGBITS 0000000000000000 00000300 00000065 0 C 0 0 1
[ELF ZLIB (1) 0000007e 1]
[ 5] .debug_abbrev PROGBITS 0000000000000000 00000365 00000028 0 0 0 1
[ 6] .debug_line PROGBITS 0000000000000000 0000038d 00000067 0 C 0 0 1
[ELF ZLIB (1) 0000008d 1]
[ 7] .shstrtab STRTAB 0000000000000000 000003f4 00000060 0 0 0 1
[ 8] .symtab SYMTAB 0000000000000000 000000f0 00000180 24 9 9 8
[ 9] .strtab STRTAB 0000000000000000 00000270 00000044 0 0 0 1
EOF
testfiles testfile-zgnu32
testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgnu32 <<\EOF
There are 9 section headers, starting at offset 0x33c:
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[Compression Size Al]
[ 0] NULL 00000000 000000 000000 0 0 0 0
[ 1] .text PROGBITS 08048054 000054 00002a 0 AX 0 0 1
[ 2] .zdebug_aranges PROGBITS 00000000 0001c0 000031 0 0 0 8
[GNU ZLIB 000040 ]
[ 3] .zdebug_info PROGBITS 00000000 0001f1 00006f 0 0 0 1
[GNU ZLIB 00009a ]
[ 4] .debug_abbrev PROGBITS 00000000 000260 000028 0 0 0 1
[ 5] .zdebug_line PROGBITS 00000000 000288 00005a 0 0 0 1
[GNU ZLIB 000085 ]
[ 6] .shstrtab STRTAB 00000000 0002e2 000059 0 0 0 1
[ 7] .symtab SYMTAB 00000000 000080 0000f0 16 8 8 4
[ 8] .strtab STRTAB 00000000 000170 00004b 0 0 0 1
EOF
testfiles testfile-zgnu32be
testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgnu32be <<\EOF
There are 10 section headers, starting at offset 0x390:
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[Compression Size Al]
[ 0] NULL 00000000 000000 000000 0 0 0 0
[ 1] .text PROGBITS 01800054 000054 000074 0 AX 0 0 1
[ 2] .eh_frame PROGBITS 018000c8 0000c8 000000 0 A 0 0 4
[ 3] .zdebug_aranges PROGBITS 00000000 000220 000033 0 0 0 8
[GNU ZLIB 000040 ]
[ 4] .zdebug_info PROGBITS 00000000 000253 000058 0 0 0 1
[GNU ZLIB 00006e ]
[ 5] .debug_abbrev PROGBITS 00000000 0002ab 000028 0 0 0 1
[ 6] .zdebug_line PROGBITS 00000000 0002d3 000059 0 0 0 1
[GNU ZLIB 000085 ]
[ 7] .shstrtab STRTAB 00000000 00032c 000063 0 0 0 1
[ 8] .symtab SYMTAB 00000000 0000c8 000110 16 9 9 4
[ 9] .strtab STRTAB 00000000 0001d8 000045 0 0 0 1
EOF
testfiles testfile-zgabi32
testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgabi32 <<\EOF
There are 9 section headers, starting at offset 0x338:
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[Compression Size Al]
[ 0] NULL 00000000 000000 000000 0 0 0 0
[ 1] .text PROGBITS 08048054 000054 00002a 0 AX 0 0 1
[ 2] .debug_aranges PROGBITS 00000000 0001c0 000031 0 C 0 0 8
[ELF ZLIB (1) 000040 8]
[ 3] .debug_info PROGBITS 00000000 0001f1 00006f 0 C 0 0 1
[ELF ZLIB (1) 00009a 1]
[ 4] .debug_abbrev PROGBITS 00000000 000260 000028 0 0 0 1
[ 5] .debug_line PROGBITS 00000000 000288 00005a 0 C 0 0 1
[ELF ZLIB (1) 000085 1]
[ 6] .shstrtab STRTAB 00000000 0002e2 000056 0 0 0 1
[ 7] .symtab SYMTAB 00000000 000080 0000f0 16 8 8 4
[ 8] .strtab STRTAB 00000000 000170 00004b 0 0 0 1
EOF
testfiles testfile-zgabi32be
testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgabi32be <<\EOF
There are 10 section headers, starting at offset 0x38c:
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[Compression Size Al]
[ 0] NULL 00000000 000000 000000 0 0 0 0
[ 1] .text PROGBITS 01800054 000054 000074 0 AX 0 0 1
[ 2] .eh_frame PROGBITS 018000c8 0000c8 000000 0 A 0 0 4
[ 3] .debug_aranges PROGBITS 00000000 000220 000033 0 C 0 0 8
[ELF ZLIB (1) 000040 8]
[ 4] .debug_info PROGBITS 00000000 000253 000058 0 C 0 0 1
[ELF ZLIB (1) 00006e 1]
[ 5] .debug_abbrev PROGBITS 00000000 0002ab 000028 0 0 0 1
[ 6] .debug_line PROGBITS 00000000 0002d3 000059 0 C 0 0 1
[ELF ZLIB (1) 000085 1]
[ 7] .shstrtab STRTAB 00000000 00032c 000060 0 0 0 1
[ 8] .symtab SYMTAB 00000000 0000c8 000110 16 9 9 4
[ 9] .strtab STRTAB 00000000 0001d8 000045 0 0 0 1
EOF
exit 0
|