1 # Copyright (C) 2010-2017 Free Software Foundation, Inc.
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.
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.
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.
17 # Test compressed .debug section.
19 if { [is_remote host] || ![is_elf_format] } then {
23 set testfile tmpdir/dw2-1
24 set compressedfile tmpdir/dw2-1-compressed
25 set copyfile tmpdir/dw2-copy
26 set compressedfile2 tmpdir/dw2-2-compressed
27 set libfile tmpdir/libdw2
28 set compressedcopyfile tmpdir/dw2-copy-compressed
29 set testfile3 tmpdir/dw2-3
30 set compressedfile3 tmpdir/dw2-3-compressed
32 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${testfile}.o --nocompress-debug-sections] } then {
33 unsupported "compressed debug sections"
37 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}.o --compress-debug-sections] } then {
38 unsupported "compressed debug sections"
42 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gnu.o --compress-debug-sections=zlib-gnu] } then {
43 unsupported "compressed debug sections with zlib-gnu"
47 set got [remote_exec host "cmp ${testfile}.o ${compressedfile}gnu.o"]
48 # Use it to set up xfail.
49 set exec_output [lindex $got 1]
50 if [string match "" $exec_output] then {
51 set compression_used ""
53 set compression_used "yes"
56 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}.o --compress-debug-sections] } then {
57 unsupported "compressed debug sections"
61 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${testfile3}.o --nocompress-debug-sections] } then {
62 unsupported "compressed debug sections"
66 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}.o --compress-debug-sections] } then {
67 unsupported "compressed debug sections"
71 remote_file host delete ${libfile}.a
72 set got [binutils_run $AR "rc ${libfile}.a ${compressedfile}.o ${compressedfile2}.o ${compressedfile3}.o"]
73 if ![string match "" $got] then {
74 fail "compressed debug sections"
78 set testname "objcopy compress debug sections"
79 set got [binutils_run $OBJCOPY "--compress-debug-sections ${testfile}.o ${copyfile}.o"]
80 if ![string match "" $got] then {
81 fail "objcopy ($testname)"
83 send_log "cmp ${compressedfile}.o ${copyfile}.o\n"
84 verbose "cmp ${compressedfile}.o ${copyfile}.o"
85 set src1 ${compressedfile}.o
86 set src2 ${copyfile}.o
87 set status [remote_exec build cmp "${src1} ${src2}"]
88 set exec_output [lindex $status 1]
89 set exec_output [prune_warnings $exec_output]
91 if [string match "" $exec_output] then {
92 pass "objcopy ($testname)"
94 send_log "$exec_output\n"
95 verbose "$exec_output" 1
96 fail "objcopy ($testname)"
100 set testname "objcopy decompress compressed debug sections"
101 set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile}.o ${copyfile}.o"]
102 if ![string match "" $got] then {
103 fail "objcopy ($testname)"
105 send_log "cmp ${testfile}.o ${copyfile}.o\n"
106 verbose "cmp ${testfile}.o ${copyfile}.o"
107 set src1 ${testfile}.o
108 set src2 ${copyfile}.o
109 set status [remote_exec build cmp "${src1} ${src2}"]
110 set exec_output [lindex $status 1]
111 set exec_output [prune_warnings $exec_output]
113 if [string match "" $exec_output] then {
114 pass "objcopy ($testname)"
116 send_log "$exec_output\n"
117 verbose "$exec_output" 1
118 fail "objcopy ($testname)"
122 set testname "objcopy decompress debug sections in archive"
123 set got [binutils_run $OBJCOPY "--decompress-debug-sections ${libfile}.a ${copyfile}.a"]
124 if ![string match "" $got] then {
125 fail "objcopy ($testname)"
127 set got [remote_exec host "$READELF -S --wide ${copyfile}.a" "" "/dev/null" "tmpdir/libdw2.out"]
129 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
130 fail "$testname (reason: unexpected output)"
135 if { [regexp_diff tmpdir/libdw2.out $srcdir/$subdir/libdw2.out] } then {
142 # Xfail this test if there are no compressed sections.
143 setup_xfail "$compression_used$target_triplet"
144 set testname "objcopy compress debug sections in archive with zlib-gnu"
145 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${copyfile}.a ${compressedcopyfile}.a"]
146 if ![string match "" $got] then {
147 fail "objcopy ($testname)"
149 set got [remote_exec host "$OBJDUMP -s -j .zdebug_line ${compressedcopyfile}.a" "" "/dev/null" "tmpdir/libdw2-compressed.out"]
151 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
152 fail "$testname (reason: unexpected output)"
157 setup_xfail "$compression_used$target_triplet"
158 if { [regexp_diff tmpdir/libdw2-compressed.out $srcdir/$subdir/libdw2-compressed.out] } then {
165 setup_xfail "nds32*-*-*"
166 set testname "objdump compress debug sections"
167 set got [remote_exec host "$OBJDUMP -W ${compressedfile}.o" "" "/dev/null" "objdump.out"]
168 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
172 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-1.W] } then {
178 setup_xfail "nds32*-*-*"
179 set testname "objdump compress debug sections 3"
180 set got [remote_exec host "$OBJDUMP -W ${compressedfile3}.o" "" "/dev/null" "objdump.out"]
181 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
185 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
191 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-empty.S ${testfile}empty.o --nocompress-debug-sections] } then {
192 unsupported "compressed debug sections"
196 set testname "objcopy compress empty debug sections"
197 set got [binutils_run $OBJCOPY "--compress-debug-sections ${testfile}empty.o ${copyfile}empty.o"]
198 if ![string match "" $got] then {
199 fail "objcopy ($testname)"
201 send_log "cmp ${testfile}empty.o ${copyfile}empty.o\n"
202 verbose "cmp ${testfile}empty.o ${copyfile}empty.o"
203 set src1 ${testfile}empty.o
204 set src2 ${copyfile}empty.o
205 set status [remote_exec build cmp "${src1} ${src2}"]
206 set exec_output [lindex $status 1]
207 set exec_output [prune_warnings $exec_output]
209 if [string match "" $exec_output] then {
210 pass "objcopy ($testname)"
212 send_log "$exec_output\n"
213 verbose "$exec_output" 1
214 fail "objcopy ($testname)"
218 if ![is_remote host] {
219 set tempfile tmpdir/debug_str.o
220 set copyfile tmpdir/debug_str.copy
222 set tempfile [remote_download host tmpdir/debug_str.o]
223 set copyfile debug_str.copy
226 run_dump_test "debug_str"
228 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gabi.o --compress-debug-sections=zlib-gabi] } then {
229 fail "compressed debug sections with zlib-gabi"
233 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gnu.o --compress-debug-sections=zlib-gnu] } then {
234 fail "compressed debug sections with zlib-gnu"
238 set src1 ${compressedfile}gabi.o
239 set src2 ${compressedfile}.o
240 set status [remote_exec build cmp "${src1} ${src2}"]
241 set exec_output [lindex $status 1]
242 set exec_output [prune_warnings $exec_output]
243 if ![string match "" $exec_output] then {
244 fail "compressed debug sections with zlib-gabi"
248 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gabi.o --compress-debug-sections=zlib-gabi] } then {
249 fail "compressed debug sections with zlib-gabi"
253 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gnu.o --compress-debug-sections=zlib-gnu] } then {
254 fail "compressed debug sections with zlib-gnu"
258 set src1 ${compressedfile2}gabi.o
259 set src2 ${compressedfile2}.o
260 set status [remote_exec build cmp "${src1} ${src2}"]
261 set exec_output [lindex $status 1]
262 set exec_output [prune_warnings $exec_output]
263 if ![string match "" $exec_output] then {
264 fail "compressed debug sections with zlib-gabi"
268 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gabi.o --compress-debug-sections=zlib-gabi] } then {
269 fail "compressed debug sections with zlib-gabi"
273 set testname "readelf -t zlib-gabi compress debug sections"
274 set got [remote_exec host "$READELF -t --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rt"]
275 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
276 fail "$testname (reason: unexpected output)"
279 if { [regexp_diff tmpdir/dw2-3.rt $srcdir/$subdir/dw2-3.rt] } then {
285 set testname "readelf -S zlib-gabi compress debug sections"
286 set got [remote_exec host "$READELF -S --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rS"]
287 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
288 fail "$testname (reason: unexpected output)"
291 if { [regexp_diff tmpdir/dw2-3.rS $srcdir/$subdir/dw2-3.rS] } then {
297 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gnu.o --compress-debug-sections=zlib-gnu] } then {
298 fail "compressed debug sections with zlib-gnu"
302 set src1 ${compressedfile3}gabi.o
303 set src2 ${compressedfile3}.o
304 set status [remote_exec build cmp "${src1} ${src2}"]
305 set exec_output [lindex $status 1]
306 set exec_output [prune_warnings $exec_output]
307 if ![string match "" $exec_output] then {
308 fail "compressed debug sections with zlib-gabi"
312 remote_file host delete ${libfile}gabi.a
313 set got [binutils_run $AR "rc ${libfile}gabi.a ${compressedfile}gabi.o ${compressedfile2}gabi.o ${compressedfile3}gabi.o"]
314 if ![string match "" $got] then {
315 fail "compressed debug sections"
319 set testname "objcopy compress debug sections with zlib-gabi"
320 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile}.o ${copyfile}gabi.o"]
321 if ![string match "" $got] then {
322 fail "objcopy ($testname)"
325 send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n"
326 verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o"
327 set src1 ${compressedfile}gabi.o
328 set src2 ${copyfile}gabi.o
329 set status [remote_exec build cmp "${src1} ${src2}"]
330 set exec_output [lindex $status 1]
331 set exec_output [prune_warnings $exec_output]
332 if ![string match "" $exec_output] then {
333 send_log "$exec_output\n"
334 verbose "$exec_output" 1
335 fail "objcopy ($testname)"
337 pass "objcopy ($testname)"
340 set testname "objcopy decompress compressed debug sections with zlib-gabi"
341 set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile}gabi.o ${copyfile}gabi.o"]
342 if ![string match "" $got] then {
343 fail "objcopy ($testname)"
346 send_log "cmp ${testfile}.o ${copyfile}gabi.o\n"
347 verbose "cmp ${testfile}.o ${copyfile}gabi.o"
348 set src1 ${testfile}.o
349 set src2 ${copyfile}gabi.o
350 set status [remote_exec build cmp "${src1} ${src2}"]
351 set exec_output [lindex $status 1]
352 set exec_output [prune_warnings $exec_output]
353 if ![string match "" $exec_output] then {
354 send_log "$exec_output\n"
355 verbose "$exec_output" 1
356 fail "objcopy ($testname)"
358 pass "objcopy ($testname)"
361 set testname "objcopy zlib-gnu compress debug sections with zlib-gabi"
362 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile}.o ${copyfile}gabi.o"]
363 if ![string match "" $got] then {
364 fail "objcopy ($testname)"
367 send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n"
368 verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o"
369 set src1 ${compressedfile}gabi.o
370 set src2 ${copyfile}gabi.o
371 set status [remote_exec build cmp "${src1} ${src2}"]
372 set exec_output [lindex $status 1]
373 set exec_output [prune_warnings $exec_output]
374 if ![string match "" $exec_output] then {
375 send_log "$exec_output\n"
376 verbose "$exec_output" 1
377 fail "objcopy ($testname)"
379 pass "objcopy ($testname)"
382 set testname "objcopy zlib-gabi compress debug sections with zlib-gnu"
383 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile}gabi.o ${copyfile}gnu.o"]
384 if ![string match "" $got] then {
385 fail "objcopy ($testname)"
388 send_log "cmp ${compressedfile}gnu.o ${copyfile}gnu.o\n"
389 verbose "cmp ${compressedfile}gnu.o ${copyfile}gnu.o"
390 set src1 ${compressedfile}gnu.o
391 set src2 ${copyfile}gnu.o
392 set status [remote_exec build cmp "${src1} ${src2}"]
393 set exec_output [lindex $status 1]
394 set exec_output [prune_warnings $exec_output]
395 if ![string match "" $exec_output] then {
396 send_log "$exec_output\n"
397 verbose "$exec_output" 1
398 fail "objcopy ($testname)"
400 pass "objcopy ($testname)"
403 set testname "objcopy compress debug sections 3 with zlib-gabi"
404 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile3}.o ${copyfile}gabi.o"]
405 if ![string match "" $got] then {
406 fail "objcopy ($testname)"
409 send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n"
410 verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o"
411 set src1 ${compressedfile3}gabi.o
412 set src2 ${copyfile}gabi.o
413 set status [remote_exec build cmp "${src1} ${src2}"]
414 set exec_output [lindex $status 1]
415 set exec_output [prune_warnings $exec_output]
416 if ![string match "" $exec_output] then {
417 send_log "$exec_output\n"
418 verbose "$exec_output" 1
419 fail "objcopy ($testname)"
421 pass "objcopy ($testname)"
424 set testname "objcopy decompress compressed debug sections 3 with zlib-gabi"
425 set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile3}gabi.o ${copyfile}gabi.o"]
426 if ![string match "" $got] then {
427 fail "objcopy ($testname)"
430 send_log "cmp ${testfile3}.o ${copyfile}gabi.o\n"
431 verbose "cmp ${testfile3}.o ${copyfile}gabi.o"
432 set src1 ${testfile3}.o
433 set src2 ${copyfile}gabi.o
434 set status [remote_exec build cmp "${src1} ${src2}"]
435 set exec_output [lindex $status 1]
436 set exec_output [prune_warnings $exec_output]
437 if ![string match "" $exec_output] then {
438 send_log "$exec_output\n"
439 verbose "$exec_output" 1
440 fail "objcopy ($testname)"
442 pass "objcopy ($testname)"
445 set testname "objcopy zlib-gnu compress debug sections 3 with zlib-gabi"
446 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile3}.o ${copyfile}gabi.o"]
447 if ![string match "" $got] then {
448 fail "objcopy ($testname)"
451 send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n"
452 verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o"
453 set src1 ${compressedfile3}gabi.o
454 set src2 ${copyfile}gabi.o
455 set status [remote_exec build cmp "${src1} ${src2}"]
456 set exec_output [lindex $status 1]
457 set exec_output [prune_warnings $exec_output]
458 if ![string match "" $exec_output] then {
459 send_log "$exec_output\n"
460 verbose "$exec_output" 1
461 fail "objcopy ($testname)"
463 pass "objcopy ($testname)"
466 set testname "objcopy zlib-gabi compress debug sections 3 with zlib-gnu"
467 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile3}gabi.o ${copyfile}gnu.o"]
468 if ![string match "" $got] then {
469 fail "objcopy ($testname)"
472 send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
473 verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
474 set src1 ${compressedfile3}gnu.o
475 set src2 ${copyfile}gnu.o
476 set status [remote_exec build cmp "${src1} ${src2}"]
477 set exec_output [lindex $status 1]
478 set exec_output [prune_warnings $exec_output]
479 if ![string match "" $exec_output] then {
480 send_log "$exec_output\n"
481 verbose "$exec_output" 1
482 fail "objcopy ($testname)"
484 pass "objcopy ($testname)"
487 set testname "objcopy zlib-gnu compress debug sections 3"
488 set got [binutils_run $OBJCOPY "${compressedfile3}gnu.o ${copyfile}gnu.o"]
489 if ![string match "" $got] then {
490 fail "objcopy ($testname)"
493 send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
494 verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
495 set src1 ${compressedfile3}gnu.o
496 set src2 ${copyfile}gnu.o
497 set status [remote_exec build cmp "${src1} ${src2}"]
498 set exec_output [lindex $status 1]
499 set exec_output [prune_warnings $exec_output]
500 if ![string match "" $exec_output] then {
501 send_log "$exec_output\n"
502 verbose "$exec_output" 1
503 fail "objcopy ($testname)"
505 pass "objcopy ($testname)"
508 set testname "objcopy zlib-gnu compress debug sections 3"
509 set got [binutils_run $OBJCOPY "${compressedfile3}gnu.o ${copyfile}gnu.o"]
510 if ![string match "" $got] then {
511 fail "objcopy ($testname)"
514 send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
515 verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
516 set src1 ${compressedfile3}gnu.o
517 set src2 ${copyfile}gnu.o
518 set status [remote_exec build cmp "${src1} ${src2}"]
519 set exec_output [lindex $status 1]
520 set exec_output [prune_warnings $exec_output]
521 if ![string match "" $exec_output] then {
522 send_log "$exec_output\n"
523 verbose "$exec_output" 1
524 fail "objcopy ($testname)"
526 pass "objcopy ($testname)"
529 set testname "objcopy decompress debug sections in archive with zlib-gabi"
530 set got [binutils_run $OBJCOPY "--decompress-debug-sections ${libfile}gabi.a ${copyfile}gabi.a"]
531 if ![string match "" $got] then {
532 fail "objcopy ($testname)"
534 set got [remote_exec host "$READELF -S --wide ${copyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2.out"]
536 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
537 fail "$testname (reason: unexpected output)"
542 if { [regexp_diff tmpdir/libdw2.out $srcdir/$subdir/libdw2.out] } then {
549 setup_xfail "nds32*-*-*"
550 set testname "objcopy compress debug sections in archive with zlib-gabi"
551 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${copyfile}gabi.a ${compressedcopyfile}gabi.a"]
552 if ![string match "" $got] then {
553 fail "objcopy ($testname)"
555 set got [remote_exec host "$OBJDUMP -W ${compressedcopyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2-compressedgabi.out"]
557 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
558 fail "$testname (reason: unexpected output)"
563 if { [regexp_diff tmpdir/libdw2-compressedgabi.out $srcdir/$subdir/libdw2-compressedgabi.out] } then {
570 setup_xfail "nds32*-*-*"
571 set testname "objdump compress debug sections 3 with zlib-gabi"
572 set got [remote_exec host "$OBJDUMP -W ${compressedfile3}gabi.o" "" "/dev/null" "objdump.out"]
573 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
577 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3gabi.W] } then {
583 proc convert_test { testname as_flags objcop_flags } {
591 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${testfile3}.o "$as_flags"] } then {
592 unresolved "$testname"
596 set got [binutils_run $OBJCOPY "$objcop_flags ${testfile3}.o ${copyfile}.o"]
597 if ![string match "" $got] then {
598 fail "objcopy ($testname)"
602 set got [remote_exec host "$OBJDUMP -W ${copyfile}.o" "" "/dev/null" "objdump.out"]
604 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
605 fail "$testname (reason: unexpected output)"
611 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
618 if { ([istarget "x86_64-*-elf*"]
619 || [istarget "x86_64-*-linux*"]) } {
620 set testname "Convert x86-64 object with zlib-gabi to x32 (1)"
621 convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64"
623 set testname "Convert x86-64 object with zlib-gabi to x32 (2)"
624 convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gnu"
626 set testname "Convert x86-64 object with zlib-gabi to x32 (3)"
627 convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64 --decompress-debug-sections"
629 set testname "Convert x86-64 object with zlib-gnu to x32 (1)"
630 convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64"
632 set testname "Convert x86-64 object with zlib-gnu to x32 (2)"
633 convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gabi"
635 set testname "Convert x86-64 object with zlib-gnu to x32 (3)"
636 convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64 --decompress-debug-sections"
638 set testname "Convert x86-64 object to x32 (1)"
639 convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64"
641 set testname "Convert x86-64 object to x32 (2)"
642 convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gabi"
644 set testname "Convert x86-64 object to x32 (3)"
645 convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gnu"
648 set testname "Convert x32 object with zlib-gabi to x86-64 (1)"
649 convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64"
651 set testname "Convert x32 object with zlib-gabi to x86-64 (2)"
652 convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu"
654 set testname "Convert x32 object with zlib-gabi to x86-64 (3)"
655 convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64 --decompress-debug-sections"
657 set testname "Convert x32 object with zlib-gnu to x86-64 (1)"
658 convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64"
660 set testname "Convert x32 object with zlib-gnu to x86-64 (2)"
661 convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gabi"
663 set testname "Convert x32 object with zlib-gnu to x86-64 (3)"
664 convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64 --decompress-debug-sections"
666 set testname "Convert x32 object to x86-64 (1)"
667 convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64"
669 set testname "Convert x32 object to x86-64 (2)"
670 convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gabi"
672 set testname "Convert x32 object to x86-64 (3)"
673 convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu"
676 proc test_gnu_debuglink {} {
685 set test "gnu-debuglink"
686 if {![info exists CC_FOR_TARGET]} {
687 set CC_FOR_TARGET $env(CC)
689 if { $CC_FOR_TARGET == "" } {
694 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog exectuable debug] != "" } {
698 set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.dump"]
699 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
700 fail "$test (objcopy dump)"
703 if { [binutils_run $STRIP "--strip-debug --remove-section=.comment --remove-section=.note tmpdir/testprog -o tmpdir/testprog.strip"] != "" } {
707 if { [binutils_run $OBJCOPY "--only-keep-debug --decompress-debug-sections tmpdir/testprog tmpdir/testprog.decompress"] != "" } {
708 fail "$test (objcopy decompress)"
711 if { [binutils_run $OBJCOPY "--only-keep-debug --compress-debug-sections tmpdir/testprog tmpdir/testprog.compress"] != "" } {
712 fail "$test (objcopy compress)"
715 if { [binutils_run $OBJCOPY "--add-gnu-debuglink=tmpdir/testprog.decompress tmpdir/testprog.strip tmpdir/testprog"] != "" } {
716 fail "$test (objcopy link decompress)"
719 set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.decompress.dump"]
720 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
721 fail "$test (objcopy dump decompress)"
724 if { [binutils_run $OBJCOPY "--add-gnu-debuglink=tmpdir/testprog.compress tmpdir/testprog.strip tmpdir/testprog"] != "" } {
725 fail "$test (objcopy link compress)"
728 set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.compress.dump"]
729 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
730 fail "$test (objcopy dump compress)"
734 set src1 tmpdir/testprog.dump
735 set src2 tmpdir/testprog.compress.dump
736 send_log "cmp ${src1} ${src2}\n"
737 verbose "cmp ${src1} ${src2}"
738 set status [remote_exec build cmp "${src1} ${src2}"]
739 set exec_output [lindex $status 1]
740 set exec_output [prune_warnings $exec_output]
741 if ![string match "" $exec_output] then {
742 send_log "$exec_output\n"
743 verbose "$exec_output" 1
744 fail "$test (objdump 1)"
746 pass "$test (objdump 1)"
749 set src1 tmpdir/testprog.decompress.dump
750 set src2 tmpdir/testprog.compress.dump
751 send_log "cmp ${src1} ${src2}\n"
752 verbose "cmp ${src1} ${src2}"
753 set status [remote_exec build cmp "${src1} ${src2}"]
754 set exec_output [lindex $status 1]
755 set exec_output [prune_warnings $exec_output]
756 if ![string match "" $exec_output] then {
757 send_log "$exec_output\n"
758 verbose "$exec_output" 1
759 fail "$test (objdump 2)"
761 pass "$test (objdump 2)"
765 if {[isnative] && [is_elf_format]} then {