blob: 6dbd2f144bdfe9cb29e26d24b8b217cfb454d047 [file] [log] [blame]
Mark Wielaardb7105b42015-10-16 22:21:23 +02001#! /bin/sh
2# Copyright (C) 2015 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# See run-elfgetchdr.sh for testfiles.
21
22testfiles testfile-zgnu64
23testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgnu64 <<\EOF
24There are 9 section headers, starting at offset 0x3e0:
25
26Section Headers:
27[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
28 [Compression Size Al]
29[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0
30[ 1] .text PROGBITS 0000000000400078 00000078 0000002a 0 AX 0 0 1
31[ 2] .zdebug_aranges PROGBITS 0000000000000000 00000260 00000032 0 0 0 16
32 [GNU ZLIB 00000060 ]
33[ 3] .zdebug_info PROGBITS 0000000000000000 00000292 0000006f 0 0 0 1
34 [GNU ZLIB 000000aa ]
35[ 4] .debug_abbrev PROGBITS 0000000000000000 00000301 00000028 0 0 0 1
36[ 5] .zdebug_line PROGBITS 0000000000000000 00000329 0000005b 0 0 0 1
37 [GNU ZLIB 0000008d ]
38[ 6] .shstrtab STRTAB 0000000000000000 00000384 00000059 0 0 0 1
39[ 7] .symtab SYMTAB 0000000000000000 000000a8 00000168 24 8 8 8
40[ 8] .strtab STRTAB 0000000000000000 00000210 0000004b 0 0 0 1
41
42EOF
43
44testfiles testfile-zgnu64be
45testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgnu64be <<\EOF
46There are 10 section headers, starting at offset 0x438:
47
48Section Headers:
49[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
50 [Compression Size Al]
51[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0
52[ 1] .text PROGBITS 0000000010000078 00000078 00000074 0 AX 0 0 8
53[ 2] .eh_frame PROGBITS 00000000100000ec 000000ec 00000000 0 A 0 0 4
54[ 3] .zdebug_aranges PROGBITS 0000000000000000 000002c0 00000034 0 0 0 16
55 [GNU ZLIB 00000060 ]
56[ 4] .zdebug_info PROGBITS 0000000000000000 000002f4 00000059 0 0 0 1
57 [GNU ZLIB 0000007e ]
58[ 5] .debug_abbrev PROGBITS 0000000000000000 0000034d 00000028 0 0 0 1
59[ 6] .zdebug_line PROGBITS 0000000000000000 00000375 0000005b 0 0 0 1
60 [GNU ZLIB 0000008d ]
61[ 7] .shstrtab STRTAB 0000000000000000 000003d0 00000063 0 0 0 1
62[ 8] .symtab SYMTAB 0000000000000000 000000f0 00000180 24 9 9 8
63[ 9] .strtab STRTAB 0000000000000000 00000270 00000044 0 0 0 1
64
65EOF
66
67testfiles testfile-zgabi64
68testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgabi64 <<\EOF
69There are 9 section headers, starting at offset 0x400:
70
71Section Headers:
72[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
73 [Compression Size Al]
74[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0
75[ 1] .text PROGBITS 0000000000400078 00000078 0000002a 0 AX 0 0 1
76[ 2] .debug_aranges PROGBITS 0000000000000000 00000260 0000003e 0 C 0 0 16
77 [ELF ZLIB (1) 00000060 16]
78[ 3] .debug_info PROGBITS 0000000000000000 0000029e 0000007b 0 C 0 0 1
79 [ELF ZLIB (1) 000000aa 1]
80[ 4] .debug_abbrev PROGBITS 0000000000000000 00000319 00000028 0 0 0 1
81[ 5] .debug_line PROGBITS 0000000000000000 00000341 00000067 0 C 0 0 1
82 [ELF ZLIB (1) 0000008d 1]
83[ 6] .shstrtab STRTAB 0000000000000000 000003a8 00000056 0 0 0 1
84[ 7] .symtab SYMTAB 0000000000000000 000000a8 00000168 24 8 8 8
85[ 8] .strtab STRTAB 0000000000000000 00000210 0000004b 0 0 0 1
86
87EOF
88
89testfiles testfile-zgabi64be
90testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgabi64be <<\EOF
91There are 10 section headers, starting at offset 0x458:
92
93Section Headers:
94[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
95 [Compression Size Al]
96[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0
97[ 1] .text PROGBITS 0000000010000078 00000078 00000074 0 AX 0 0 8
98[ 2] .eh_frame PROGBITS 00000000100000ec 000000ec 00000000 0 A 0 0 4
99[ 3] .debug_aranges PROGBITS 0000000000000000 000002c0 00000040 0 C 0 0 16
100 [ELF ZLIB (1) 00000060 16]
101[ 4] .debug_info PROGBITS 0000000000000000 00000300 00000065 0 C 0 0 1
102 [ELF ZLIB (1) 0000007e 1]
103[ 5] .debug_abbrev PROGBITS 0000000000000000 00000365 00000028 0 0 0 1
104[ 6] .debug_line PROGBITS 0000000000000000 0000038d 00000067 0 C 0 0 1
105 [ELF ZLIB (1) 0000008d 1]
106[ 7] .shstrtab STRTAB 0000000000000000 000003f4 00000060 0 0 0 1
107[ 8] .symtab SYMTAB 0000000000000000 000000f0 00000180 24 9 9 8
108[ 9] .strtab STRTAB 0000000000000000 00000270 00000044 0 0 0 1
109
110EOF
111
112testfiles testfile-zgnu32
113testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgnu32 <<\EOF
114There are 9 section headers, starting at offset 0x33c:
115
116Section Headers:
117[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
118 [Compression Size Al]
119[ 0] NULL 00000000 000000 000000 0 0 0 0
120[ 1] .text PROGBITS 08048054 000054 00002a 0 AX 0 0 1
121[ 2] .zdebug_aranges PROGBITS 00000000 0001c0 000031 0 0 0 8
122 [GNU ZLIB 000040 ]
123[ 3] .zdebug_info PROGBITS 00000000 0001f1 00006f 0 0 0 1
124 [GNU ZLIB 00009a ]
125[ 4] .debug_abbrev PROGBITS 00000000 000260 000028 0 0 0 1
126[ 5] .zdebug_line PROGBITS 00000000 000288 00005a 0 0 0 1
127 [GNU ZLIB 000085 ]
128[ 6] .shstrtab STRTAB 00000000 0002e2 000059 0 0 0 1
129[ 7] .symtab SYMTAB 00000000 000080 0000f0 16 8 8 4
130[ 8] .strtab STRTAB 00000000 000170 00004b 0 0 0 1
131
132EOF
133
134testfiles testfile-zgnu32be
135testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgnu32be <<\EOF
136There are 10 section headers, starting at offset 0x390:
137
138Section Headers:
139[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
140 [Compression Size Al]
141[ 0] NULL 00000000 000000 000000 0 0 0 0
142[ 1] .text PROGBITS 01800054 000054 000074 0 AX 0 0 1
143[ 2] .eh_frame PROGBITS 018000c8 0000c8 000000 0 A 0 0 4
144[ 3] .zdebug_aranges PROGBITS 00000000 000220 000033 0 0 0 8
145 [GNU ZLIB 000040 ]
146[ 4] .zdebug_info PROGBITS 00000000 000253 000058 0 0 0 1
147 [GNU ZLIB 00006e ]
148[ 5] .debug_abbrev PROGBITS 00000000 0002ab 000028 0 0 0 1
149[ 6] .zdebug_line PROGBITS 00000000 0002d3 000059 0 0 0 1
150 [GNU ZLIB 000085 ]
151[ 7] .shstrtab STRTAB 00000000 00032c 000063 0 0 0 1
152[ 8] .symtab SYMTAB 00000000 0000c8 000110 16 9 9 4
153[ 9] .strtab STRTAB 00000000 0001d8 000045 0 0 0 1
154
155EOF
156
157testfiles testfile-zgabi32
158testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgabi32 <<\EOF
159There are 9 section headers, starting at offset 0x338:
160
161Section Headers:
162[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
163 [Compression Size Al]
164[ 0] NULL 00000000 000000 000000 0 0 0 0
165[ 1] .text PROGBITS 08048054 000054 00002a 0 AX 0 0 1
166[ 2] .debug_aranges PROGBITS 00000000 0001c0 000031 0 C 0 0 8
167 [ELF ZLIB (1) 000040 8]
168[ 3] .debug_info PROGBITS 00000000 0001f1 00006f 0 C 0 0 1
169 [ELF ZLIB (1) 00009a 1]
170[ 4] .debug_abbrev PROGBITS 00000000 000260 000028 0 0 0 1
171[ 5] .debug_line PROGBITS 00000000 000288 00005a 0 C 0 0 1
172 [ELF ZLIB (1) 000085 1]
173[ 6] .shstrtab STRTAB 00000000 0002e2 000056 0 0 0 1
174[ 7] .symtab SYMTAB 00000000 000080 0000f0 16 8 8 4
175[ 8] .strtab STRTAB 00000000 000170 00004b 0 0 0 1
176
177EOF
178
179testfiles testfile-zgabi32be
180testrun_compare ${abs_top_builddir}/src/readelf -z -S testfile-zgabi32be <<\EOF
181There are 10 section headers, starting at offset 0x38c:
182
183Section Headers:
184[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
185 [Compression Size Al]
186[ 0] NULL 00000000 000000 000000 0 0 0 0
187[ 1] .text PROGBITS 01800054 000054 000074 0 AX 0 0 1
188[ 2] .eh_frame PROGBITS 018000c8 0000c8 000000 0 A 0 0 4
189[ 3] .debug_aranges PROGBITS 00000000 000220 000033 0 C 0 0 8
190 [ELF ZLIB (1) 000040 8]
191[ 4] .debug_info PROGBITS 00000000 000253 000058 0 C 0 0 1
192 [ELF ZLIB (1) 00006e 1]
193[ 5] .debug_abbrev PROGBITS 00000000 0002ab 000028 0 0 0 1
194[ 6] .debug_line PROGBITS 00000000 0002d3 000059 0 C 0 0 1
195 [ELF ZLIB (1) 000085 1]
196[ 7] .shstrtab STRTAB 00000000 00032c 000060 0 0 0 1
197[ 8] .symtab SYMTAB 00000000 0000c8 000110 16 9 9 4
198[ 9] .strtab STRTAB 00000000 0001d8 000045 0 0 0 1
199
200EOF
201
202exit 0