Commit | Line | Data |
---|---|---|
b90efa5b | 1 | # Copyright (C) 2010-2015 Free Software Foundation, Inc. |
4a114e3e L |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
65951855 | 7 | # |
4a114e3e L |
8 | # This program is distributed in the hope that it will be useful, |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
65951855 | 12 | # |
4a114e3e L |
13 | # You should have received a copy of the GNU General Public License |
14 | # along with this program; if not, write to the Free Software | |
15 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. | |
16 | ||
17 | # Test compressed .debug section. | |
18 | ||
dae148f3 | 19 | if { [is_remote host] || ![is_elf_format] } then { |
4a114e3e L |
20 | return |
21 | } | |
22 | ||
e268c0a6 L |
23 | set testfile tmpdir/dw2-1 |
24 | set compressedfile tmpdir/dw2-1-compressed | |
4a114e3e | 25 | set copyfile tmpdir/dw2-copy |
e268c0a6 L |
26 | set compressedfile2 tmpdir/dw2-2-compressed |
27 | set libfile tmpdir/libdw2 | |
4a114e3e | 28 | set compressedcopyfile tmpdir/dw2-copy-compressed |
e268c0a6 L |
29 | set testfile3 tmpdir/dw2-3 |
30 | set compressedfile3 tmpdir/dw2-3-compressed | |
4a114e3e | 31 | |
e268c0a6 | 32 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${testfile}.o --nocompress-debug-sections] } then { |
6dbf72d7 | 33 | unsupported "compressed debug sections" |
4a114e3e L |
34 | return |
35 | } | |
36 | ||
e268c0a6 | 37 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}.o --compress-debug-sections] } then { |
4a114e3e L |
38 | unsupported "compressed debug sections" |
39 | return | |
40 | } | |
41 | ||
fd5136e5 | 42 | set got [remote_exec host "cmp ${testfile}.o ${compressedfile}.o"] |
317974f6 L |
43 | # Use it to set up xfail. |
44 | set exec_output [lindex $got 1] | |
45 | if [string match "" $exec_output] then { | |
46 | set compression_used "" | |
47 | } else { | |
48 | set compression_used "yes" | |
49 | } | |
50 | ||
e268c0a6 | 51 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}.o --compress-debug-sections] } then { |
4a114e3e L |
52 | unsupported "compressed debug sections" |
53 | return | |
54 | } | |
55 | ||
e268c0a6 L |
56 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${testfile3}.o --nocompress-debug-sections] } then { |
57 | unsupported "compressed debug sections" | |
58 | return | |
59 | } | |
60 | ||
61 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}.o --compress-debug-sections] } then { | |
62 | unsupported "compressed debug sections" | |
63 | return | |
64 | } | |
65 | ||
66 | remote_file host delete ${libfile}.a | |
67 | set got [binutils_run $AR "rc ${libfile}.a ${compressedfile}.o ${compressedfile2}.o ${compressedfile3}.o"] | |
4a114e3e L |
68 | if ![string match "" $got] then { |
69 | fail "compressed debug sections" | |
70 | return | |
71 | } | |
72 | ||
73 | set testname "objcopy compress debug sections" | |
e268c0a6 | 74 | set got [binutils_run $OBJCOPY "--compress-debug-sections ${testfile}.o ${copyfile}.o"] |
4a114e3e L |
75 | if ![string match "" $got] then { |
76 | fail "objcopy ($testname)" | |
77 | } else { | |
e268c0a6 L |
78 | send_log "cmp ${compressedfile}.o ${copyfile}.o\n" |
79 | verbose "cmp ${compressedfile}.o ${copyfile}.o" | |
80 | set src1 ${compressedfile}.o | |
4a114e3e L |
81 | set src2 ${copyfile}.o |
82 | set status [remote_exec build cmp "${src1} ${src2}"] | |
83 | set exec_output [lindex $status 1] | |
84 | set exec_output [prune_warnings $exec_output] | |
85 | ||
86 | if [string match "" $exec_output] then { | |
87 | pass "objcopy ($testname)" | |
88 | } else { | |
89 | send_log "$exec_output\n" | |
90 | verbose "$exec_output" 1 | |
91 | fail "objcopy ($testname)" | |
92 | } | |
93 | } | |
94 | ||
95 | set testname "objcopy decompress compressed debug sections" | |
e268c0a6 | 96 | set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile}.o ${copyfile}.o"] |
4a114e3e L |
97 | if ![string match "" $got] then { |
98 | fail "objcopy ($testname)" | |
99 | } else { | |
e268c0a6 L |
100 | send_log "cmp ${testfile}.o ${copyfile}.o\n" |
101 | verbose "cmp ${testfile}.o ${copyfile}.o" | |
102 | set src1 ${testfile}.o | |
4a114e3e L |
103 | set src2 ${copyfile}.o |
104 | set status [remote_exec build cmp "${src1} ${src2}"] | |
105 | set exec_output [lindex $status 1] | |
106 | set exec_output [prune_warnings $exec_output] | |
107 | ||
108 | if [string match "" $exec_output] then { | |
109 | pass "objcopy ($testname)" | |
110 | } else { | |
111 | send_log "$exec_output\n" | |
112 | verbose "$exec_output" 1 | |
113 | fail "objcopy ($testname)" | |
114 | } | |
115 | } | |
116 | ||
117 | set testname "objcopy decompress debug sections in archive" | |
e268c0a6 | 118 | set got [binutils_run $OBJCOPY "--decompress-debug-sections ${libfile}.a ${copyfile}.a"] |
4a114e3e L |
119 | if ![string match "" $got] then { |
120 | fail "objcopy ($testname)" | |
121 | } else { | |
122 | set got [remote_exec host "$READELF -S --wide ${copyfile}.a" "" "/dev/null" "tmpdir/libdw2.out"] | |
123 | ||
124 | if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
125 | fail "$testname (reason: unexpected output)" | |
126 | send_log $got | |
127 | send_log "\n" | |
128 | } | |
129 | ||
130 | if { [regexp_diff tmpdir/libdw2.out $srcdir/$subdir/libdw2.out] } then { | |
131 | fail "$testname" | |
132 | } else { | |
133 | pass "$testname" | |
134 | } | |
135 | } | |
136 | ||
317974f6 L |
137 | # Xfail this test if there are no compressed sections. |
138 | setup_xfail "$compression_used$target_triplet" | |
4a114e3e L |
139 | set testname "objcopy compress debug sections in archive" |
140 | set got [binutils_run $OBJCOPY "--compress-debug-sections ${copyfile}.a ${compressedcopyfile}.a"] | |
141 | if ![string match "" $got] then { | |
142 | fail "objcopy ($testname)" | |
143 | } else { | |
144 | set got [remote_exec host "$OBJDUMP -s -j .zdebug_line ${compressedcopyfile}.a" "" "/dev/null" "tmpdir/libdw2-compressed.out"] | |
145 | ||
146 | if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
147 | fail "$testname (reason: unexpected output)" | |
148 | send_log $got | |
149 | send_log "\n" | |
150 | } | |
151 | ||
317974f6 | 152 | setup_xfail "$compression_used$target_triplet" |
4a114e3e L |
153 | if { [regexp_diff tmpdir/libdw2-compressed.out $srcdir/$subdir/libdw2-compressed.out] } then { |
154 | fail "$testname" | |
155 | } else { | |
156 | pass "$testname" | |
157 | } | |
158 | } | |
5a5ed5b0 | 159 | |
a9481b58 | 160 | set testname "objdump compress debug sections" |
e268c0a6 | 161 | set got [remote_exec host "$OBJDUMP -W ${compressedfile}.o" "" "/dev/null" "objdump.out"] |
a9481b58 L |
162 | if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { |
163 | fail "$testname" | |
164 | send_log "$got\n" | |
165 | } | |
166 | if { [regexp_diff objdump.out $srcdir/$subdir/dw2-1.W] } then { | |
167 | fail "$testname" | |
168 | } else { | |
169 | pass "$testname" | |
170 | } | |
171 | ||
e268c0a6 L |
172 | set testname "objdump compress debug sections 3" |
173 | set got [remote_exec host "$OBJDUMP -W ${compressedfile3}.o" "" "/dev/null" "objdump.out"] | |
174 | if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
175 | fail "$testname" | |
176 | send_log "$got\n" | |
177 | } | |
178 | if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then { | |
179 | fail "$testname" | |
180 | } else { | |
181 | pass "$testname" | |
182 | } | |
5a5ed5b0 | 183 | |
e268c0a6 | 184 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-empty.S ${testfile}empty.o --nocompress-debug-sections] } then { |
5a5ed5b0 L |
185 | unsupported "compressed debug sections" |
186 | return | |
187 | } | |
188 | ||
189 | set testname "objcopy compress empty debug sections" | |
e268c0a6 | 190 | set got [binutils_run $OBJCOPY "--compress-debug-sections ${testfile}empty.o ${copyfile}empty.o"] |
5a5ed5b0 L |
191 | if ![string match "" $got] then { |
192 | fail "objcopy ($testname)" | |
193 | } else { | |
e268c0a6 L |
194 | send_log "cmp ${testfile}empty.o ${copyfile}empty.o\n" |
195 | verbose "cmp ${testfile}empty.o ${copyfile}empty.o" | |
196 | set src1 ${testfile}empty.o | |
197 | set src2 ${copyfile}empty.o | |
5a5ed5b0 L |
198 | set status [remote_exec build cmp "${src1} ${src2}"] |
199 | set exec_output [lindex $status 1] | |
200 | set exec_output [prune_warnings $exec_output] | |
201 | ||
202 | if [string match "" $exec_output] then { | |
203 | pass "objcopy ($testname)" | |
204 | } else { | |
205 | send_log "$exec_output\n" | |
206 | verbose "$exec_output" 1 | |
207 | fail "objcopy ($testname)" | |
208 | } | |
209 | } | |
a953eec9 NC |
210 | |
211 | if ![is_remote host] { | |
212 | set tempfile tmpdir/debug_str.o | |
213 | set copyfile tmpdir/debug_str.copy | |
214 | } else { | |
215 | set tempfile [remote_download host tmpdir/debug_str.o] | |
216 | set copyfile debug_str.copy | |
217 | } | |
218 | ||
219 | run_dump_test "debug_str" | |
151411f8 L |
220 | |
221 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gabi.o --compress-debug-sections=zlib-gabi] } then { | |
222 | fail "compressed debug sections with zlib-gabi" | |
223 | return | |
224 | } | |
225 | ||
226 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gnu.o --compress-debug-sections=zlib-gnu] } then { | |
227 | fail "compressed debug sections with zlib-gnu" | |
228 | return | |
229 | } | |
230 | ||
231 | set src1 ${compressedfile}gnu.o | |
232 | set src2 ${compressedfile}.o | |
233 | set status [remote_exec build cmp "${src1} ${src2}"] | |
234 | set exec_output [lindex $status 1] | |
235 | set exec_output [prune_warnings $exec_output] | |
236 | if ![string match "" $exec_output] then { | |
237 | fail "compressed debug sections with zlib-gnu" | |
238 | return | |
239 | } | |
240 | ||
241 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gabi.o --compress-debug-sections=zlib-gabi] } then { | |
242 | fail "compressed debug sections with zlib-gabi" | |
243 | return | |
244 | } | |
245 | ||
246 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gnu.o --compress-debug-sections=zlib-gnu] } then { | |
247 | fail "compressed debug sections with zlib-gnu" | |
248 | return | |
249 | } | |
250 | ||
251 | set src1 ${compressedfile2}gnu.o | |
252 | set src2 ${compressedfile2}.o | |
253 | set status [remote_exec build cmp "${src1} ${src2}"] | |
254 | set exec_output [lindex $status 1] | |
255 | set exec_output [prune_warnings $exec_output] | |
256 | if ![string match "" $exec_output] then { | |
257 | fail "compressed debug sections with zlib-gnu" | |
258 | return | |
259 | } | |
260 | ||
261 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gabi.o --compress-debug-sections=zlib-gabi] } then { | |
262 | fail "compressed debug sections with zlib-gabi" | |
263 | return | |
264 | } | |
265 | ||
266 | set testname "readelf -t zlib-gabi compress debug sections" | |
267 | set got [remote_exec host "$READELF -t --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rt"] | |
268 | if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
269 | fail "$testname (reason: unexpected output)" | |
270 | send_log "$got\n" | |
271 | } | |
272 | if { [regexp_diff tmpdir/dw2-3.rt $srcdir/$subdir/dw2-3.rt] } then { | |
273 | fail "$testname" | |
274 | } else { | |
275 | pass "$testname" | |
276 | } | |
277 | ||
278 | set testname "readelf -S zlib-gabi compress debug sections" | |
279 | set got [remote_exec host "$READELF -S --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rS"] | |
280 | if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
281 | fail "$testname (reason: unexpected output)" | |
282 | send_log "$got\n" | |
283 | } | |
284 | if { [regexp_diff tmpdir/dw2-3.rS $srcdir/$subdir/dw2-3.rS] } then { | |
285 | fail "$testname" | |
286 | } else { | |
287 | pass "$testname" | |
288 | } | |
289 | ||
290 | if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gnu.o --compress-debug-sections=zlib-gnu] } then { | |
291 | fail "compressed debug sections with zlib-gnu" | |
292 | return | |
293 | } | |
294 | ||
295 | set src1 ${compressedfile3}gnu.o | |
296 | set src2 ${compressedfile3}.o | |
297 | set status [remote_exec build cmp "${src1} ${src2}"] | |
298 | set exec_output [lindex $status 1] | |
299 | set exec_output [prune_warnings $exec_output] | |
300 | if ![string match "" $exec_output] then { | |
301 | fail "compressed debug sections with zlib-gnu" | |
302 | return | |
303 | } | |
304 | ||
305 | remote_file host delete ${libfile}gabi.a | |
306 | set got [binutils_run $AR "rc ${libfile}gabi.a ${compressedfile}gabi.o ${compressedfile2}gabi.o ${compressedfile3}gabi.o"] | |
307 | if ![string match "" $got] then { | |
308 | fail "compressed debug sections" | |
309 | return | |
310 | } | |
311 | ||
312 | set testname "objcopy compress debug sections with zlib-gabi" | |
313 | set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile}.o ${copyfile}gabi.o"] | |
314 | if ![string match "" $got] then { | |
315 | fail "objcopy ($testname)" | |
316 | return | |
317 | } | |
318 | send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n" | |
319 | verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o" | |
320 | set src1 ${compressedfile}gabi.o | |
321 | set src2 ${copyfile}gabi.o | |
322 | set status [remote_exec build cmp "${src1} ${src2}"] | |
323 | set exec_output [lindex $status 1] | |
324 | set exec_output [prune_warnings $exec_output] | |
325 | if ![string match "" $exec_output] then { | |
326 | send_log "$exec_output\n" | |
327 | verbose "$exec_output" 1 | |
328 | fail "objcopy ($testname)" | |
329 | } else { | |
330 | pass "objcopy ($testname)" | |
331 | } | |
332 | ||
333 | set testname "objcopy decompress compressed debug sections with zlib-gabi" | |
334 | set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile}gabi.o ${copyfile}gabi.o"] | |
335 | if ![string match "" $got] then { | |
336 | fail "objcopy ($testname)" | |
337 | return | |
338 | } | |
339 | send_log "cmp ${testfile}.o ${copyfile}gabi.o\n" | |
340 | verbose "cmp ${testfile}.o ${copyfile}gabi.o" | |
341 | set src1 ${testfile}.o | |
342 | set src2 ${copyfile}gabi.o | |
343 | set status [remote_exec build cmp "${src1} ${src2}"] | |
344 | set exec_output [lindex $status 1] | |
345 | set exec_output [prune_warnings $exec_output] | |
346 | if ![string match "" $exec_output] then { | |
347 | send_log "$exec_output\n" | |
348 | verbose "$exec_output" 1 | |
349 | fail "objcopy ($testname)" | |
350 | } else { | |
351 | pass "objcopy ($testname)" | |
352 | } | |
353 | ||
354 | set testname "objcopy zlib-gnu compress debug sections with zlib-gabi" | |
355 | set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile}.o ${copyfile}gabi.o"] | |
356 | if ![string match "" $got] then { | |
357 | fail "objcopy ($testname)" | |
358 | return | |
359 | } | |
360 | send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n" | |
361 | verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o" | |
362 | set src1 ${compressedfile}gabi.o | |
363 | set src2 ${copyfile}gabi.o | |
364 | set status [remote_exec build cmp "${src1} ${src2}"] | |
365 | set exec_output [lindex $status 1] | |
366 | set exec_output [prune_warnings $exec_output] | |
367 | if ![string match "" $exec_output] then { | |
368 | send_log "$exec_output\n" | |
369 | verbose "$exec_output" 1 | |
370 | fail "objcopy ($testname)" | |
371 | } else { | |
372 | pass "objcopy ($testname)" | |
373 | } | |
374 | ||
375 | set testname "objcopy zlib-gabi compress debug sections with zlib-gnu" | |
376 | set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile}gabi.o ${copyfile}gnu.o"] | |
377 | if ![string match "" $got] then { | |
378 | fail "objcopy ($testname)" | |
379 | return | |
380 | } | |
381 | send_log "cmp ${compressedfile}gnu.o ${copyfile}gnu.o\n" | |
382 | verbose "cmp ${compressedfile}gnu.o ${copyfile}gnu.o" | |
383 | set src1 ${compressedfile}gnu.o | |
384 | set src2 ${copyfile}gnu.o | |
385 | set status [remote_exec build cmp "${src1} ${src2}"] | |
386 | set exec_output [lindex $status 1] | |
387 | set exec_output [prune_warnings $exec_output] | |
388 | if ![string match "" $exec_output] then { | |
389 | send_log "$exec_output\n" | |
390 | verbose "$exec_output" 1 | |
391 | fail "objcopy ($testname)" | |
392 | } else { | |
393 | pass "objcopy ($testname)" | |
394 | } | |
395 | ||
396 | set testname "objcopy compress debug sections 3 with zlib-gabi" | |
397 | set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile3}.o ${copyfile}gabi.o"] | |
398 | if ![string match "" $got] then { | |
399 | fail "objcopy ($testname)" | |
400 | return | |
401 | } | |
402 | send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n" | |
403 | verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o" | |
404 | set src1 ${compressedfile3}gabi.o | |
405 | set src2 ${copyfile}gabi.o | |
406 | set status [remote_exec build cmp "${src1} ${src2}"] | |
407 | set exec_output [lindex $status 1] | |
408 | set exec_output [prune_warnings $exec_output] | |
409 | if ![string match "" $exec_output] then { | |
410 | send_log "$exec_output\n" | |
411 | verbose "$exec_output" 1 | |
412 | fail "objcopy ($testname)" | |
413 | } else { | |
414 | pass "objcopy ($testname)" | |
415 | } | |
416 | ||
417 | set testname "objcopy decompress compressed debug sections 3 with zlib-gabi" | |
418 | set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile3}gabi.o ${copyfile}gabi.o"] | |
419 | if ![string match "" $got] then { | |
420 | fail "objcopy ($testname)" | |
421 | return | |
422 | } | |
423 | send_log "cmp ${testfile3}.o ${copyfile}gabi.o\n" | |
424 | verbose "cmp ${testfile3}.o ${copyfile}gabi.o" | |
425 | set src1 ${testfile3}.o | |
426 | set src2 ${copyfile}gabi.o | |
427 | set status [remote_exec build cmp "${src1} ${src2}"] | |
428 | set exec_output [lindex $status 1] | |
429 | set exec_output [prune_warnings $exec_output] | |
430 | if ![string match "" $exec_output] then { | |
431 | send_log "$exec_output\n" | |
432 | verbose "$exec_output" 1 | |
433 | fail "objcopy ($testname)" | |
434 | } else { | |
435 | pass "objcopy ($testname)" | |
436 | } | |
437 | ||
438 | set testname "objcopy zlib-gnu compress debug sections 3 with zlib-gabi" | |
439 | set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile3}.o ${copyfile}gabi.o"] | |
440 | if ![string match "" $got] then { | |
441 | fail "objcopy ($testname)" | |
442 | return | |
443 | } | |
444 | send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n" | |
445 | verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o" | |
446 | set src1 ${compressedfile3}gabi.o | |
447 | set src2 ${copyfile}gabi.o | |
448 | set status [remote_exec build cmp "${src1} ${src2}"] | |
449 | set exec_output [lindex $status 1] | |
450 | set exec_output [prune_warnings $exec_output] | |
451 | if ![string match "" $exec_output] then { | |
452 | send_log "$exec_output\n" | |
453 | verbose "$exec_output" 1 | |
454 | fail "objcopy ($testname)" | |
455 | } else { | |
456 | pass "objcopy ($testname)" | |
457 | } | |
458 | ||
459 | set testname "objcopy zlib-gabi compress debug sections 3 with zlib-gnu" | |
460 | set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile3}gabi.o ${copyfile}gnu.o"] | |
461 | if ![string match "" $got] then { | |
462 | fail "objcopy ($testname)" | |
463 | return | |
464 | } | |
465 | send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n" | |
466 | verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o" | |
467 | set src1 ${compressedfile3}gnu.o | |
468 | set src2 ${copyfile}gnu.o | |
469 | set status [remote_exec build cmp "${src1} ${src2}"] | |
470 | set exec_output [lindex $status 1] | |
471 | set exec_output [prune_warnings $exec_output] | |
472 | if ![string match "" $exec_output] then { | |
473 | send_log "$exec_output\n" | |
474 | verbose "$exec_output" 1 | |
475 | fail "objcopy ($testname)" | |
476 | } else { | |
477 | pass "objcopy ($testname)" | |
478 | } | |
479 | ||
480 | set testname "objcopy zlib-gnu compress debug sections 3" | |
481 | set got [binutils_run $OBJCOPY "${compressedfile3}gnu.o ${copyfile}gnu.o"] | |
482 | if ![string match "" $got] then { | |
483 | fail "objcopy ($testname)" | |
484 | return | |
485 | } | |
486 | send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n" | |
487 | verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o" | |
488 | set src1 ${compressedfile3}gnu.o | |
489 | set src2 ${copyfile}gnu.o | |
490 | set status [remote_exec build cmp "${src1} ${src2}"] | |
491 | set exec_output [lindex $status 1] | |
492 | set exec_output [prune_warnings $exec_output] | |
493 | if ![string match "" $exec_output] then { | |
494 | send_log "$exec_output\n" | |
495 | verbose "$exec_output" 1 | |
496 | fail "objcopy ($testname)" | |
497 | } else { | |
498 | pass "objcopy ($testname)" | |
499 | } | |
500 | ||
501 | set testname "objcopy zlib-gnu compress debug sections 3" | |
502 | set got [binutils_run $OBJCOPY "${compressedfile3}gnu.o ${copyfile}gnu.o"] | |
503 | if ![string match "" $got] then { | |
504 | fail "objcopy ($testname)" | |
505 | return | |
506 | } | |
507 | send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n" | |
508 | verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o" | |
509 | set src1 ${compressedfile3}gnu.o | |
510 | set src2 ${copyfile}gnu.o | |
511 | set status [remote_exec build cmp "${src1} ${src2}"] | |
512 | set exec_output [lindex $status 1] | |
513 | set exec_output [prune_warnings $exec_output] | |
514 | if ![string match "" $exec_output] then { | |
515 | send_log "$exec_output\n" | |
516 | verbose "$exec_output" 1 | |
517 | fail "objcopy ($testname)" | |
518 | } else { | |
519 | pass "objcopy ($testname)" | |
520 | } | |
521 | ||
522 | set testname "objcopy decompress debug sections in archive with zlib-gabi" | |
523 | set got [binutils_run $OBJCOPY "--decompress-debug-sections ${libfile}gabi.a ${copyfile}gabi.a"] | |
524 | if ![string match "" $got] then { | |
525 | fail "objcopy ($testname)" | |
526 | } else { | |
527 | set got [remote_exec host "$READELF -S --wide ${copyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2.out"] | |
528 | ||
529 | if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
530 | fail "$testname (reason: unexpected output)" | |
531 | send_log $got | |
532 | send_log "\n" | |
533 | } | |
534 | ||
535 | if { [regexp_diff tmpdir/libdw2.out $srcdir/$subdir/libdw2.out] } then { | |
536 | fail "$testname" | |
537 | } else { | |
538 | pass "$testname" | |
539 | } | |
540 | } | |
541 | ||
542 | set testname "objcopy compress debug sections in archive with zlib-gabi" | |
543 | set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${copyfile}gabi.a ${compressedcopyfile}gabi.a"] | |
544 | if ![string match "" $got] then { | |
545 | fail "objcopy ($testname)" | |
546 | } else { | |
547 | set got [remote_exec host "$OBJDUMP -s -j .debug_info | |
548 | ${compressedcopyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2-compressedgabi.out"] | |
549 | ||
550 | if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
551 | fail "$testname (reason: unexpected output)" | |
552 | send_log $got | |
553 | send_log "\n" | |
554 | } | |
555 | ||
556 | if { [regexp_diff tmpdir/libdw2-compressedgabi.out $srcdir/$subdir/libdw2-compressedgabi.out] } then { | |
557 | fail "$testname" | |
558 | } else { | |
559 | pass "$testname" | |
560 | } | |
561 | } | |
562 | ||
563 | set testname "objdump compress debug sections 3 with zlib-gabi" | |
564 | set got [remote_exec host "$OBJDUMP -W ${compressedfile3}gabi.o" "" "/dev/null" "objdump.out"] | |
565 | if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
566 | fail "$testname" | |
567 | send_log "$got\n" | |
568 | } | |
569 | if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then { | |
570 | fail "$testname" | |
571 | } else { | |
572 | pass "$testname" | |
573 | } |