1 # Copyright (C) 2010-2021 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 set testname "objdump compress debug sections"
166 set got [remote_exec host "$OBJDUMP -W ${compressedfile}.o" "" "/dev/null" "objdump.out"]
167 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
171 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-1.W] } then {
177 set testname "objdump compress debug sections 3"
178 set got [remote_exec host "$OBJDUMP -W ${compressedfile3}.o" "" "/dev/null" "objdump.out"]
179 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
183 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
189 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-empty.S ${testfile}empty.o --nocompress-debug-sections] } then {
190 unsupported "compressed debug sections"
194 set testname "objcopy compress empty debug sections"
195 set got [binutils_run $OBJCOPY "--compress-debug-sections ${testfile}empty.o ${copyfile}empty.o"]
196 if ![string match "" $got] then {
197 fail "objcopy ($testname)"
199 send_log "cmp ${testfile}empty.o ${copyfile}empty.o\n"
200 verbose "cmp ${testfile}empty.o ${copyfile}empty.o"
201 set src1 ${testfile}empty.o
202 set src2 ${copyfile}empty.o
203 set status [remote_exec build cmp "${src1} ${src2}"]
204 set exec_output [lindex $status 1]
205 set exec_output [prune_warnings $exec_output]
207 if [string match "" $exec_output] then {
208 pass "objcopy ($testname)"
210 send_log "$exec_output\n"
211 verbose "$exec_output" 1
212 fail "objcopy ($testname)"
216 if ![is_remote host] {
217 set tempfile tmpdir/debug_str.o
218 set copyfile tmpdir/debug_str.copy
220 set tempfile [remote_download host tmpdir/debug_str.o]
221 set copyfile debug_str.copy
224 run_dump_test "debug_str"
226 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gabi.o --compress-debug-sections=zlib-gabi] } then {
227 fail "compressed debug sections with zlib-gabi"
231 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gnu.o --compress-debug-sections=zlib-gnu] } then {
232 fail "compressed debug sections with zlib-gnu"
236 set src1 ${compressedfile}gabi.o
237 set src2 ${compressedfile}.o
238 set status [remote_exec build cmp "${src1} ${src2}"]
239 set exec_output [lindex $status 1]
240 set exec_output [prune_warnings $exec_output]
241 if ![string match "" $exec_output] then {
242 fail "compressed debug sections with zlib-gabi"
246 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gabi.o --compress-debug-sections=zlib-gabi] } then {
247 fail "compressed debug sections with zlib-gabi"
251 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gnu.o --compress-debug-sections=zlib-gnu] } then {
252 fail "compressed debug sections with zlib-gnu"
256 set src1 ${compressedfile2}gabi.o
257 set src2 ${compressedfile2}.o
258 set status [remote_exec build cmp "${src1} ${src2}"]
259 set exec_output [lindex $status 1]
260 set exec_output [prune_warnings $exec_output]
261 if ![string match "" $exec_output] then {
262 fail "compressed debug sections with zlib-gabi"
266 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gabi.o --compress-debug-sections=zlib-gabi] } then {
267 fail "compressed debug sections with zlib-gabi"
271 set testname "readelf -t zlib-gabi compress debug sections"
272 set got [remote_exec host "$READELF -t --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rt"]
273 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
274 fail "$testname (reason: unexpected output)"
277 if { [regexp_diff tmpdir/dw2-3.rt $srcdir/$subdir/dw2-3.rt] } then {
283 set testname "readelf -S zlib-gabi compress debug sections"
284 set got [remote_exec host "$READELF -S --wide ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/dw2-3.rS"]
285 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
286 fail "$testname (reason: unexpected output)"
289 if { [regexp_diff tmpdir/dw2-3.rS $srcdir/$subdir/dw2-3.rS] } then {
295 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gnu.o --compress-debug-sections=zlib-gnu] } then {
296 fail "compressed debug sections with zlib-gnu"
300 set src1 ${compressedfile3}gabi.o
301 set src2 ${compressedfile3}.o
302 set status [remote_exec build cmp "${src1} ${src2}"]
303 set exec_output [lindex $status 1]
304 set exec_output [prune_warnings $exec_output]
305 if ![string match "" $exec_output] then {
306 fail "compressed debug sections with zlib-gabi"
310 remote_file host delete ${libfile}gabi.a
311 set got [binutils_run $AR "rc ${libfile}gabi.a ${compressedfile}gabi.o ${compressedfile2}gabi.o ${compressedfile3}gabi.o"]
312 if ![string match "" $got] then {
313 fail "compressed debug sections"
317 set testname "objcopy compress debug sections with zlib-gabi"
318 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile}.o ${copyfile}gabi.o"]
319 if ![string match "" $got] then {
320 fail "objcopy ($testname)"
323 send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n"
324 verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o"
325 set src1 ${compressedfile}gabi.o
326 set src2 ${copyfile}gabi.o
327 set status [remote_exec build cmp "${src1} ${src2}"]
328 set exec_output [lindex $status 1]
329 set exec_output [prune_warnings $exec_output]
330 if ![string match "" $exec_output] then {
331 send_log "$exec_output\n"
332 verbose "$exec_output" 1
333 fail "objcopy ($testname)"
335 pass "objcopy ($testname)"
338 set testname "objcopy decompress compressed debug sections with zlib-gabi"
339 set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile}gabi.o ${copyfile}gabi.o"]
340 if ![string match "" $got] then {
341 fail "objcopy ($testname)"
344 send_log "cmp ${testfile}.o ${copyfile}gabi.o\n"
345 verbose "cmp ${testfile}.o ${copyfile}gabi.o"
346 set src1 ${testfile}.o
347 set src2 ${copyfile}gabi.o
348 set status [remote_exec build cmp "${src1} ${src2}"]
349 set exec_output [lindex $status 1]
350 set exec_output [prune_warnings $exec_output]
351 if ![string match "" $exec_output] then {
352 send_log "$exec_output\n"
353 verbose "$exec_output" 1
354 fail "objcopy ($testname)"
356 pass "objcopy ($testname)"
359 set testname "objcopy zlib-gnu compress debug sections with zlib-gabi"
360 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile}.o ${copyfile}gabi.o"]
361 if ![string match "" $got] then {
362 fail "objcopy ($testname)"
365 send_log "cmp ${compressedfile}gabi.o ${copyfile}gabi.o\n"
366 verbose "cmp ${compressedfile}gabi.o ${copyfile}gabi.o"
367 set src1 ${compressedfile}gabi.o
368 set src2 ${copyfile}gabi.o
369 set status [remote_exec build cmp "${src1} ${src2}"]
370 set exec_output [lindex $status 1]
371 set exec_output [prune_warnings $exec_output]
372 if ![string match "" $exec_output] then {
373 send_log "$exec_output\n"
374 verbose "$exec_output" 1
375 fail "objcopy ($testname)"
377 pass "objcopy ($testname)"
380 set testname "objcopy zlib-gabi compress debug sections with zlib-gnu"
381 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile}gabi.o ${copyfile}gnu.o"]
382 if ![string match "" $got] then {
383 fail "objcopy ($testname)"
386 send_log "cmp ${compressedfile}gnu.o ${copyfile}gnu.o\n"
387 verbose "cmp ${compressedfile}gnu.o ${copyfile}gnu.o"
388 set src1 ${compressedfile}gnu.o
389 set src2 ${copyfile}gnu.o
390 set status [remote_exec build cmp "${src1} ${src2}"]
391 set exec_output [lindex $status 1]
392 set exec_output [prune_warnings $exec_output]
393 if ![string match "" $exec_output] then {
394 send_log "$exec_output\n"
395 verbose "$exec_output" 1
396 fail "objcopy ($testname)"
398 pass "objcopy ($testname)"
401 set testname "objcopy compress debug sections 3 with zlib-gabi"
402 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${testfile3}.o ${copyfile}gabi.o"]
403 if ![string match "" $got] then {
404 fail "objcopy ($testname)"
407 send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n"
408 verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o"
409 set src1 ${compressedfile3}gabi.o
410 set src2 ${copyfile}gabi.o
411 set status [remote_exec build cmp "${src1} ${src2}"]
412 set exec_output [lindex $status 1]
413 set exec_output [prune_warnings $exec_output]
414 if ![string match "" $exec_output] then {
415 send_log "$exec_output\n"
416 verbose "$exec_output" 1
417 fail "objcopy ($testname)"
419 pass "objcopy ($testname)"
422 set testname "objcopy decompress compressed debug sections 3 with zlib-gabi"
423 set got [binutils_run $OBJCOPY "--decompress-debug-sections ${compressedfile3}gabi.o ${copyfile}gabi.o"]
424 if ![string match "" $got] then {
425 fail "objcopy ($testname)"
428 send_log "cmp ${testfile3}.o ${copyfile}gabi.o\n"
429 verbose "cmp ${testfile3}.o ${copyfile}gabi.o"
430 set src1 ${testfile3}.o
431 set src2 ${copyfile}gabi.o
432 set status [remote_exec build cmp "${src1} ${src2}"]
433 set exec_output [lindex $status 1]
434 set exec_output [prune_warnings $exec_output]
435 if ![string match "" $exec_output] then {
436 send_log "$exec_output\n"
437 verbose "$exec_output" 1
438 fail "objcopy ($testname)"
440 pass "objcopy ($testname)"
443 set testname "objcopy zlib-gnu compress debug sections 3 with zlib-gabi"
444 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${compressedfile3}.o ${copyfile}gabi.o"]
445 if ![string match "" $got] then {
446 fail "objcopy ($testname)"
449 send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n"
450 verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o"
451 set src1 ${compressedfile3}gabi.o
452 set src2 ${copyfile}gabi.o
453 set status [remote_exec build cmp "${src1} ${src2}"]
454 set exec_output [lindex $status 1]
455 set exec_output [prune_warnings $exec_output]
456 if ![string match "" $exec_output] then {
457 send_log "$exec_output\n"
458 verbose "$exec_output" 1
459 fail "objcopy ($testname)"
461 pass "objcopy ($testname)"
464 set testname "objcopy zlib-gabi compress debug sections 3 with zlib-gnu"
465 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${compressedfile3}gabi.o ${copyfile}gnu.o"]
466 if ![string match "" $got] then {
467 fail "objcopy ($testname)"
470 send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
471 verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
472 set src1 ${compressedfile3}gnu.o
473 set src2 ${copyfile}gnu.o
474 set status [remote_exec build cmp "${src1} ${src2}"]
475 set exec_output [lindex $status 1]
476 set exec_output [prune_warnings $exec_output]
477 if ![string match "" $exec_output] then {
478 send_log "$exec_output\n"
479 verbose "$exec_output" 1
480 fail "objcopy ($testname)"
482 pass "objcopy ($testname)"
485 set testname "objcopy zlib-gnu compress debug sections 3"
486 set got [binutils_run $OBJCOPY "${compressedfile3}gnu.o ${copyfile}gnu.o"]
487 if ![string match "" $got] then {
488 fail "objcopy ($testname)"
491 send_log "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o\n"
492 verbose "cmp ${compressedfile3}gnu.o ${copyfile}gnu.o"
493 set src1 ${compressedfile3}gnu.o
494 set src2 ${copyfile}gnu.o
495 set status [remote_exec build cmp "${src1} ${src2}"]
496 set exec_output [lindex $status 1]
497 set exec_output [prune_warnings $exec_output]
498 if ![string match "" $exec_output] then {
499 send_log "$exec_output\n"
500 verbose "$exec_output" 1
501 fail "objcopy ($testname)"
503 pass "objcopy ($testname)"
506 set testname "objcopy zlib-gabi compress debug sections 3"
507 set got [binutils_run $OBJCOPY "${compressedfile3}gabi.o ${copyfile}gabi.o"]
508 if ![string match "" $got] then {
509 fail "objcopy ($testname)"
512 send_log "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o\n"
513 verbose "cmp ${compressedfile3}gabi.o ${copyfile}gabi.o"
514 set src1 ${compressedfile3}gabi.o
515 set src2 ${copyfile}gabi.o
516 set status [remote_exec build cmp "${src1} ${src2}"]
517 set exec_output [lindex $status 1]
518 set exec_output [prune_warnings $exec_output]
519 if ![string match "" $exec_output] then {
520 send_log "$exec_output\n"
521 verbose "$exec_output" 1
522 fail "objcopy ($testname)"
524 pass "objcopy ($testname)"
527 set testname "objcopy decompress debug sections in archive with zlib-gabi"
528 set got [binutils_run $OBJCOPY "--decompress-debug-sections ${libfile}gabi.a ${copyfile}gabi.a"]
529 if ![string match "" $got] then {
530 fail "objcopy ($testname)"
532 set got [remote_exec host "$READELF -S --wide ${copyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2.out"]
534 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
535 fail "$testname (reason: unexpected output)"
540 if { [regexp_diff tmpdir/libdw2.out $srcdir/$subdir/libdw2.out] } then {
547 set testname "objcopy compress debug sections in archive with zlib-gabi"
548 set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gabi ${copyfile}gabi.a ${compressedcopyfile}gabi.a"]
549 if ![string match "" $got] then {
550 fail "objcopy ($testname)"
552 set got [remote_exec host "$OBJDUMP -W ${compressedcopyfile}gabi.a" "" "/dev/null" "tmpdir/libdw2-compressedgabi.out"]
554 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
555 fail "$testname (reason: unexpected output)"
560 if { [regexp_diff tmpdir/libdw2-compressedgabi.out $srcdir/$subdir/libdw2-compressedgabi.out] } then {
567 set testname "objdump compress debug sections 3 with zlib-gabi"
568 set got [remote_exec host "$OBJDUMP -W ${compressedfile3}gabi.o" "" "/dev/null" "objdump.out"]
569 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
573 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3gabi.W] } then {
579 proc convert_test { testname as_flags objcop_flags } {
587 if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${testfile3}.o "$as_flags"] } then {
588 unsupported "$testname"
592 set got [binutils_run $OBJCOPY "$objcop_flags ${testfile3}.o ${copyfile}.o"]
593 if ![string match "" $got] then {
594 fail "objcopy ($testname)"
598 set got [remote_exec host "$OBJDUMP -W ${copyfile}.o" "" "/dev/null" "objdump.out"]
600 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
601 fail "$testname (reason: unexpected output)"
607 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
614 if { ([istarget "x86_64-*-elf*"]
615 || [istarget "x86_64-*-linux*"]) } {
616 set testname "Convert x86-64 object with zlib-gabi to x32 (1)"
617 convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64"
619 set testname "Convert x86-64 object with zlib-gabi to x32 (2)"
620 convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gnu"
622 set testname "Convert x86-64 object with zlib-gabi to x32 (3)"
623 convert_test "$testname" "--compress-debug-sections=zlib-gabi --64" "-O elf32-x86-64 --decompress-debug-sections"
625 set testname "Convert x86-64 object with zlib-gnu to x32 (1)"
626 convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64"
628 set testname "Convert x86-64 object with zlib-gnu to x32 (2)"
629 convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gabi"
631 set testname "Convert x86-64 object with zlib-gnu to x32 (3)"
632 convert_test "$testname" "--compress-debug-sections=zlib-gnu --64" "-O elf32-x86-64 --decompress-debug-sections"
634 set testname "Convert x86-64 object to x32 (1)"
635 convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64"
637 set testname "Convert x86-64 object to x32 (2)"
638 convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gabi"
640 set testname "Convert x86-64 object to x32 (3)"
641 convert_test "$testname" "--nocompress-debug-sections --64" "-O elf32-x86-64 --compress-debug-sections=zlib-gnu"
644 set testname "Convert x32 object with zlib-gabi to x86-64 (1)"
645 convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64"
647 set testname "Convert x32 object with zlib-gabi to x86-64 (2)"
648 convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu"
650 set testname "Convert x32 object with zlib-gabi to x86-64 (3)"
651 convert_test "$testname" "--compress-debug-sections=zlib-gabi --x32" "-O elf64-x86-64 --decompress-debug-sections"
653 set testname "Convert x32 object with zlib-gnu to x86-64 (1)"
654 convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64"
656 set testname "Convert x32 object with zlib-gnu to x86-64 (2)"
657 convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gabi"
659 set testname "Convert x32 object with zlib-gnu to x86-64 (3)"
660 convert_test "$testname" "--compress-debug-sections=zlib-gnu --x32" "-O elf64-x86-64 --decompress-debug-sections"
662 set testname "Convert x32 object to x86-64 (1)"
663 convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64"
665 set testname "Convert x32 object to x86-64 (2)"
666 convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gabi"
668 set testname "Convert x32 object to x86-64 (3)"
669 convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu"
672 proc test_gnu_debuglink {} {
681 set test "gnu-debuglink"
683 # Use the newly built assembler and linker.
685 if { [istarget *-*-linux*]
686 || [istarget *-*-gnu*] } {
687 foreach i $gcc_gas_flag {
688 set flags "additional_flags=$i $flags"
691 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable $flags] != "" } {
692 unsupported "$test (build)"
695 set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.dump"]
696 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
697 fail "$test (objcopy dump)"
700 if { [binutils_run $STRIP "--strip-debug --remove-section=.comment --remove-section=.note tmpdir/testprog -o tmpdir/testprog.strip"] != "" } {
704 if { [binutils_run $OBJCOPY "--only-keep-debug --decompress-debug-sections tmpdir/testprog tmpdir/testprog.decompress"] != "" } {
705 fail "$test (objcopy decompress)"
708 if { [binutils_run $OBJCOPY "--only-keep-debug --compress-debug-sections tmpdir/testprog tmpdir/testprog.compress"] != "" } {
709 fail "$test (objcopy compress)"
712 if { [binutils_run $OBJCOPY "--add-gnu-debuglink=tmpdir/testprog.decompress tmpdir/testprog.strip tmpdir/testprog"] != "" } {
713 fail "$test (objcopy link decompress)"
716 set got [remote_exec host "$OBJDUMP -S -WN tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.decompress.dump"]
717 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
718 fail "$test (objcopy dump decompress)"
721 if { [binutils_run $OBJCOPY "--add-gnu-debuglink=tmpdir/testprog.compress tmpdir/testprog.strip tmpdir/testprog"] != "" } {
722 fail "$test (objcopy link compress)"
725 set got [remote_exec host "$OBJDUMP -S -WN tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.compress.dump"]
726 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
727 fail "$test (objcopy dump compress)"
731 set src1 tmpdir/testprog.dump
732 set src2 tmpdir/testprog.compress.dump
733 send_log "cmp ${src1} ${src2}\n"
734 verbose "cmp ${src1} ${src2}"
735 set status [remote_exec build cmp "${src1} ${src2}"]
736 set exec_output [lindex $status 1]
737 set exec_output [prune_warnings $exec_output]
738 if ![string match "" $exec_output] then {
739 send_log "$exec_output\n"
740 verbose "$exec_output" 1
741 fail "$test (objdump 1)"
743 pass "$test (objdump 1)"
746 set src1 tmpdir/testprog.decompress.dump
747 set src2 tmpdir/testprog.compress.dump
748 send_log "cmp ${src1} ${src2}\n"
749 verbose "cmp ${src1} ${src2}"
750 set status [remote_exec build cmp "${src1} ${src2}"]
751 set exec_output [lindex $status 1]
752 set exec_output [prune_warnings $exec_output]
753 if ![string match "" $exec_output] then {
754 send_log "$exec_output\n"
755 verbose "$exec_output" 1
756 fail "$test (objdump 2)"
758 pass "$test (objdump 2)"
762 if {[is_elf_format]} then {