1 # Copyright (C) 1993-2020 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 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-dejagnu@prep.ai.mit.edu
20 # This file was written by Rob Savoye <rob@cygnus.com>
21 # and rewritten by Ian Lance Taylor <ian@cygnus.com>
23 if ![is_remote host] {
24 if {[which $OBJDUMP] == 0} then {
25 perror "$OBJDUMP does not exist"
30 send_user "Version [binutil_version $OBJDUMP]"
32 # Simple test of objdump -i
34 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"]
36 set cpus_expected [list]
37 lappend cpus_expected aarch64 alpha am33-2 arc ARC700 ARCv2 arm cris
38 lappend cpus_expected d10v d30v fr30 fr500 fr550 h8 hppa i386 iamcu ip2022
39 lappend cpus_expected m16c m32c m32r m68hc11 m68hc12 m68k MCore mep c5 h1 MicroBlaze
40 lappend cpus_expected mips mn10200 mn10300 ms1 msp MSP430 nds32 n1h_v3 ns32k
41 lappend cpus_expected or1k or1knd pj powerpc pyramid riscv romp rs6000 s390 sh sparc
42 lappend cpus_expected tic54x tilegx tms320c30 tms320c4x tms320c54x
43 lappend cpus_expected v850 vax x86-64 xscale xtensa z8k z8001 z8002
45 # Make sure the target CPU shows up in the list.
46 lappend cpus_expected ${target_cpu}
49 set cpus_regex "([join $cpus_expected | ])"
51 verbose -log "CPU regex: $cpus_regex"
53 set want "BFD header file version.*srec\[^\n\]*\n\[^\n\]*header \[^\n\]*endian\[^\n\]*, data \[^\n\]*endian.*$cpus_regex"
55 if [regexp $want $got] then {
62 if { [istarget "*-*-vms"] } then {
66 # The remaining tests require a test file.
68 if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.${obj}]} then {
69 fail "objdump (assembling bintest.s)"
72 if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest2.${obj}]} then {
73 fail "objdump (assembling)"
77 set testfile [remote_download host tmpdir/bintest.${obj}]
78 set testfile2 [remote_download host tmpdir/bintest2.${obj}]
80 set testfile tmpdir/bintest.${obj}
81 set testfile2 tmpdir/bintest2.${obj}
84 # $testarchive exists only if it is supported.
85 set testarchive tmpdir/bintest.a
86 remote_file host file delete $testarchive
87 set got [binutils_run $AR "rc tmpdir/bintest.a $testfile2"]
88 if ![string match "" $got] then {
90 remote_file host delete tmpdir/bintest.a
91 } elseif [is_remote host] {
92 set testarchive [remote_download host tmpdir/bintest.a]
94 remote_file host delete tmpdir/bintest2.${obj}
98 proc test_objdump_f { testfile dumpfile } {
103 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $testfile"]
105 set want "${dumpfile}.*:\[ \]*file format.*architecture:\[ \]*${cpus_regex}.*HAS_RELOC.*HAS_SYMS"
107 if ![regexp $want $got] then {
108 fail "objdump -f ($testfile, $dumpfile)"
110 pass "objdump -f ($testfile, $dumpfile)"
114 test_objdump_f $testfile $testfile
115 if { [ remote_file host exists $testarchive ] } then {
116 test_objdump_f $testarchive bintest2.${obj}
121 proc test_objdump_h { testfile dumpfile } {
125 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $testfile"]
127 set want "${dumpfile}.*:\[ \]*file format.*Sections.*\[0-9\]+\[ \]+\[^ \]*(text|TEXT|P|\\\$CODE\\\$)\[^ \]*\[ \]*(\[0-9a-fA-F\]+).*\[0-9\]+\[ \]+\[^ \]*(\\.data|DATA|D_1)\[^ \]*\[ \]*(\[0-9a-fA-F\]+)"
129 if ![regexp $want $got all text_name text_size data_name data_size] then {
130 fail "objdump -h ($testfile, $dumpfile)"
132 verbose "text name is $text_name size is $text_size"
133 verbose "data name is $data_name size is $data_size"
136 # The [ti]c4x target has the property sizeof(char)=sizeof(long)=1
137 if [istarget *c4x*-*-*] then {
141 # c54x section sizes are in bytes, not octets; adjust accordingly
142 if [istarget *c54x*-*-*] then {
146 if {[expr "0x$text_size"] < $ets || [expr "0x$data_size"] < $eds} then {
147 send_log "sizes too small\n"
148 fail "objdump -h ($testfile, $dumpfile)"
150 pass "objdump -h ($testfile, $dumpfile)"
155 test_objdump_h $testfile $testfile
156 if { [ remote_file host exists $testarchive ] } then {
157 test_objdump_h $testarchive bintest2.${obj}
162 proc test_objdump_t { testfile} {
166 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t $testfile"]
168 if [info exists vars] then { unset vars }
169 while {[regexp "(\[a-z\]*_symbol)(.*)" $got all symbol rest]} {
174 if {![info exists vars(text_symbol)] \
175 || ![info exists vars(data_symbol)] \
176 || ![info exists vars(common_symbol)] \
177 || ![info exists vars(external_symbol)]} then {
178 fail "objdump -t ($testfile)"
180 pass "objdump -t ($testfile)"
184 test_objdump_t $testfile
185 if { [ remote_file host exists $testarchive ] } then {
186 test_objdump_t $testarchive
191 proc test_objdump_r { testfile dumpfile } {
195 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r $testfile"]
197 set want "${dumpfile}.*:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|P|\\\$CODE\\\$)\[^\]\]*\\\].*external_symbol"
199 if [regexp $want $got] then {
200 pass "objdump -r ($testfile, $dumpfile)"
202 fail "objdump -r ($testfile, $dumpfile)"
206 test_objdump_r $testfile $testfile
207 if { [ remote_file host exists $testarchive ] } then {
208 test_objdump_r $testarchive bintest2.${obj}
212 proc test_objdump_d { testfile dumpfile } {
216 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -d $testfile"]
218 set want "${dumpfile}.*:.*Disassembly of section"
219 if ![regexp $want $got] then {
220 fail "objdump -d $testfile: No disassembly title"
224 set want "${dumpfile}.*:.*00+0 <text_symbol>"
225 if ![regexp $want $got] then {
226 fail "objdump -d $testfile: Missing symbol name and address"
230 set want "${dumpfile}.*:.*00+. <text_symbol2>"
231 if ![regexp $want $got] then {
232 fail "objdump -d $testfile: Missing second symbol"
236 set want "${dumpfile}.*:.*00+. <text_symbol3>"
237 if ![regexp $want $got] then {
238 fail "objdump -d $testfile: Missing third symbol"
242 pass "objdump -d $testfile"
245 test_objdump_d $testfile $testfile
246 if { [ remote_file host exists $testarchive ] } then {
247 test_objdump_d $testarchive bintest2.${obj}
250 # Test objdump --disassemble=<symbol>
251 proc test_objdump_d_sym { testfile dumpfile } {
255 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble=text_symbol2 $testfile"]
257 set want "$dumpfile:.*Disassembly of section"
258 if ![regexp $want $got] then {
259 fail "objdump --disassemble=text_symbol2 $testfile: No disassembly title"
263 set want "$dumpfile:.*00+0 <text_symbol>"
264 if [regexp $want $got] then {
265 fail "objdump --disassemble=text_symbol2 $testfile: First symbol displayed, when it should be absent"
269 set want "$dumpfile:.*00+. <text_symbol2>"
270 if ![regexp $want $got] then {
271 fail "objdump --disassemble=text_symbol2 $testfile: Missing second symbol"
275 set want "$dumpfile:.*00+. <text_symbol3>"
276 if [regexp $want $got] then {
277 fail "objdump --disassemble=text_symbol2 $testfile: Third symbol displayed when it should be absent"
281 pass "objdump --disassemble=text_symbol2 $testfile"
284 test_objdump_d_sym $testfile $testfile
286 proc test_objdump_d_func_sym { testfile dumpfile } {
290 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble=func --disassemble-zeroes $testfile"]
292 set want "$dumpfile:.*Disassembly of section"
293 if ![regexp $want $got] then {
294 fail "objdump --disassemble=func $testfile: No disassembly title"
298 set want "$dumpfile:.*00+0 <start_of_text>"
299 if [regexp $want $got] then {
300 fail "objdump --disassemble=func $testfile: First symbol displayed, when it should be absent"
304 set want "$dumpfile:.*00+. <func>"
305 if ![regexp $want $got] then {
306 fail "objdump --disassemble=func $testfile: Disassembly does not start at function symbol"
310 set want "$dumpfile:.*00+. <global_non_func_sym>"
311 if ![regexp $want $got] then {
312 fail "objdump --disassemble=func $testfile: Non function symbol not displayed"
316 set want "$dumpfile:.*00+. <next_func>"
317 if [regexp $want $got] then {
318 fail "objdump --disassemble=func $testfile: Disassembly did not stop at the next function"
322 pass "objdump --disassemble=func $testfile"
325 proc test_objdump_d_non_func_sym { testfile dumpfile } {
329 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble=global_non_func_sym $testfile"]
331 set want "$dumpfile:.*Disassembly of section"
332 if ![regexp $want $got] then {
333 fail "objdump --disassemble=non_func $testfile: No disassembly title"
337 set want "$dumpfile:.*00+0 <start_of_text>"
338 if [regexp $want $got] then {
339 fail "objdump --disassemble=non_func $testfile: First symbol displayed, when it should be absent"
343 set want "$dumpfile:.*00+. <global_non_func_sym>"
344 if ![regexp $want $got] then {
345 fail "objdump --disassemble=non_func $testfile: Non function symbol not displayed"
349 set want "$dumpfile:.*00+. <local_non_func_sym>"
350 if [regexp $want $got] then {
351 fail "objdump --disassemble=non_func $testfile: Disassembly did not stop at the next symbol"
355 pass "objdump --disassemble=non_func $testfile"
358 # Extra test for ELF format - check that --disassemble=func disassembles
359 # all of func, and does not stop at the next symbol.
360 if { [is_elf_format] } then {
362 if {![binutils_assemble $srcdir/$subdir/disasm.s tmpdir/disasm.${obj}]} then {
363 fail "objdump --disassemble=func (assembling disasm.s)"
365 if [is_remote host] {
366 set elftestfile [remote_download host tmpdir/disasm.${obj}]
368 set elftestfile tmpdir/disasm.${obj}
371 test_objdump_d_func_sym $elftestfile $elftestfile
372 test_objdump_d_non_func_sym $elftestfile $elftestfile
379 proc test_objdump_s { testfile dumpfile } {
383 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s $testfile"]
385 set want "${dumpfile}.*:\[ \]*file format.*Contents.*(text|TEXT|P|\\\$CODE\\\$)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000|00000100).*Contents.*(data|DATA|D_1)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000|00000200)"
387 if [regexp $want $got] then {
388 pass "objdump -s ($testfile, $dumpfile)"
390 fail "objdump -s ($testfile, $dumpfile)"
394 test_objdump_s $testfile $testfile
395 if { [ remote_file host exists $testarchive ] } then {
396 test_objdump_s $testarchive bintest2.${obj}
399 # Test objdump -s on a file that contains a compressed .debug section
401 if { ![is_elf_format] } then {
402 unsupported "objdump compressed debug"
403 } elseif { ![binutils_assemble $srcdir/$subdir/dw2-compressed.S tmpdir/dw2-compressed.${obj}] } then {
404 fail "objdump compressed debug"
406 if [is_remote host] {
407 set compressed_testfile [remote_download host tmpdir/dw2-compressed.${obj}]
409 set compressed_testfile tmpdir/dw2-compressed.${obj}
412 set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -s -j .zdebug_abbrev $compressed_testfile" "" "/dev/null" "objdump.out"]
414 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
415 fail "objdump -s -j .zdebug_abbrev (reason: unexpected output)"
420 if { [regexp_diff objdump.out $srcdir/$subdir/objdump.s] } then {
421 fail "objdump -s -j .zdebug_abbrev"
423 pass "objdump -s -j .zdebug_abbrev"
426 # Test objdump -W on a file that contains some compressed .debug sections
428 set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -W $compressed_testfile" "" "/dev/null" "objdump.out"]
430 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
431 fail "objdump -W (reason: unexpected output)"
436 if { [regexp_diff objdump.out $srcdir/$subdir/objdump.W] } then {
443 # Test objdump -WL on a file that contains line information for multiple files and search directories.
444 # Not supported on mcore and moxie targets because they do not (yet) support the generation
445 # of DWARF2 line debug information.
447 if { ![is_elf_format]
448 || [istarget "hppa64*-*-hpux*"]
449 || [istarget "ia64*-*-*"]
450 || [istarget "mcore-*-*"]
451 || [istarget "moxie-*-*"]
453 unsupported "objump decode line"
455 if { [istarget "or1k*-*-*"] } then {
456 set decodedline_testsrc $srcdir/$subdir/dw2-decodedline-1.S
458 set decodedline_testsrc $srcdir/$subdir/dw2-decodedline.S
460 if { ![binutils_assemble $decodedline_testsrc tmpdir/dw2-decodedline.${obj}] } then {
461 fail "objdump decoded line"
464 if [is_remote host] {
465 set decodedline_testfile [remote_download host tmpdir/dw2-decodedline.${obj}]
467 set decodedline_testfile tmpdir/dw2-decodedline.${obj}
470 set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -WL $decodedline_testfile" "" "/dev/null" "objdump.out"]
472 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
473 fail "objdump -WL (reason: unexpected output)"
478 if { [regexp_diff objdump.out $srcdir/$subdir/objdump.WL] } then {
485 # Test objdump -W on a file containing debug_ranges information.
487 if { ![is_elf_format] } then {
488 unsupported "objdump debug_ranges test"
489 } elseif { ![binutils_assemble $srcdir/$subdir/dw2-ranges.S tmpdir/dw2-ranges.${obj}] } then {
490 fail "objdump debug_ranges test"
492 if [is_remote host] {
493 set ranges_testfile [remote_download host tmpdir/dw2-ranges.${obj}]
495 set ranges_testfile tmpdir/dw2-ranges.${obj}
498 set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS --dwarf=Ranges $ranges_testfile" "" "/dev/null" "objdump.out"]
500 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
501 fail "objdump -W for debug_ranges (reason: unexpected output)"
506 setup_xfail "msp430-*-*" "nds32*-*-*"
507 if { [regexp_diff objdump.out $srcdir/$subdir/dw2-ranges.W] } then {
508 fail "objdump -W for debug_ranges"
510 pass "objdump -W for debug_ranges"
514 proc test_build_id_debuglink {} {
521 global CFLAGS_FOR_TARGET
523 set test "build-id-debuglink"
525 # Use a fixed build-id.
526 if { [info exists CFLAGS_FOR_TARGET] } {
527 set save_CFLAGS_FOR_TARGET $CFLAGS_FOR_TARGET
529 set CFLAGS_FOR_TARGET "-g -Wl,--build-id=0x12345678abcdef01"
531 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable debug] != "" } {
532 unsupported "$test (build)"
536 if { [info exists save_CFLAGS_FOR_TARGET] } {
537 set CFLAGS_FOR_TARGET $save_CFLAGS_FOR_TARGET
539 unset CFLAGS_FOR_TARGET
542 if { [binutils_run $STRIP "--strip-debug --remove-section=.comment tmpdir/testprog -o tmpdir/testprog.strip"] != "" } {
543 fail "$test (strip debug info)"
547 if { [binutils_run $OBJCOPY "--only-keep-debug tmpdir/testprog tmpdir/testprog.debug"] != "" } {
548 fail "$test (create separate debug info file)"
552 set got [remote_exec host "mkdir -p .build-id/12" ]
553 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
554 fail "$test (make debug directory)"
558 set got [remote_exec host "cp tmpdir/testprog.debug .build-id/12/345678abcdef01.debug"]
559 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
560 fail "$test (copy debug info into debug directory)"
564 set got [remote_exec host "$OBJDUMP -Sl tmpdir/testprog.strip" "" "/dev/null" "tmpdir/testprog.strip.dump"]
565 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
566 fail "$test (post strip dump)"
570 set src2 tmpdir/testprog.strip.dump
571 verbose " grep -e testprog.c ${src2}"
572 set status [remote_exec build grep "-e testprog.c ${src2}"]
573 set exec_output [lindex $status 1]
574 set exec_output [prune_warnings $exec_output]
575 if [string match "" $exec_output] then {
576 send_log "$exec_output\n"
577 verbose "$exec_output" 1
578 fail "$test (grepping for source file name in disassembly output)"
582 set got [remote_exec host "rm .build-id/12/345678abcdef01.debug"]
583 set got [remote_exec host "rmdir -p .build-id/12" ]
584 set got [remote_exec host "rm tmpdir/testprog.strip.dump"]
585 set got [remote_exec host "rm tmpdir/testprog.debug"]
586 set got [remote_exec host "rm tmpdir/testprog.strip"]
590 if {[is_elf_format]} then {
591 test_build_id_debuglink
594 # Test objdump -Wk on a file containing debug links.
596 if { [is_elf_format] } then {
597 set testsrc $srcdir/$subdir/debuglink.s
599 if { ![binutils_assemble $testsrc tmpdir/debuglink.${obj}] } then {
600 fail "objdump -Wk (reason: could not assemble source)"
603 if [is_remote host] {
604 set testfile [remote_download host tmpdir/debuglink.${obj}]
606 set testfile tmpdir/debuglink.${obj}
609 set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Wk $testfile" "" "/dev/null" "objdump.out"]
611 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
612 fail "objdump -Wk (reason: unexpected output)"
617 if { [regexp_diff objdump.out $srcdir/$subdir/objdump.Wk] } then {
625 # Very similar to proc test_build_id_debuglink except this time we
626 # display some of the contents of the separate debug info file.
628 proc test_follow_debuglink { options dumpfile } {
634 set test "follow-debuglink ($options)"
636 if {![binutils_assemble $srcdir/$subdir/debuglink.s tmpdir/debuglink.${obj}]} then {
637 fail "$test (reason: assemble first source file)"
641 if {![binutils_assemble $srcdir/$subdir/linkdebug.s tmpdir/linkdebug.debug]} then {
642 fail "$test (reason: assemble second source file)"
646 if ![is_remote host] {
647 set tempfile tmpdir/debuglink.${obj}
649 set tempfile [remote_download host tmpdir/linkdebug.debug]
650 set tempfile [remote_download host tmpdir/debuglink.${obj}]
653 set got [remote_exec host "$OBJDUMP $options $tempfile" "" "/dev/null" "tmpdir/objdump.out"]
654 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
655 fail "$test (reason: unexpected error output from objdump)"
659 if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/$dumpfile] } then {
661 verbose "output is \n[file_contents objdump.out]" 2
668 set got [remote_exec host "rm tmpdir/objdump.out"]
669 set got [remote_exec host "rm $tempfile"]
670 set got [remote_exec host "rm tmpdir/linkdebug.debug"]
673 if {[is_elf_format]} then {
674 test_follow_debuglink "--dwarf=follow-links --dwarf=info --dwarf=str" objdump.WK2
675 test_follow_debuglink "--dwarf=follow-links --headers --wide" objdump.WK3
678 # Test objdump output with start and stop address limits for the specified
681 proc test_objdump_limited { testfile dopt want start stop } {
685 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS $dopt --start-address 0x$start --stop-address 0x$stop $testfile"]
687 if [regexp $want $got] then {
688 pass "objdump $dopt --start-address 0x$start --stop-address 0x$stop ($testfile)"
690 fail "objdump $dopt --start-address 0x$start --stop-address 0x$stop ($testfile)"
694 # Test objdump -d --start-address M --stop-address N
696 proc test_objdump_disas_limited { testfile text start stop } {
697 set want "$testfile:\[ \]*file format.*Disassembly of section $text:\n.*\[ \]*$start:.*"
698 test_objdump_limited $testfile -d $want $start $stop
701 # Test objdump -s --start-address M --stop-address N
703 proc test_objdump_content_limited { testfile text start stop } {
704 set want "$testfile:\[ \]*file format.*Contents of section $text:\n\[ \]*$start .*"
705 test_objdump_limited $testfile -s $want $start $stop
708 # Test objdump with --start-address and --stop-address options for higher
709 # address ranges which may be sign-extended on targets that treat addresses
710 # as signed. We only check that objdump produces some dump output at the
711 # specified start address as a proxy for correct enforcement of the
714 if {[is_elf_format]} then {
715 set sect_names [get_standard_section_names]
716 if { $sect_names != "" } {
717 set text [lindex $sect_names 0]
721 # generate a copy of the test object with .text repositioned
722 if { [binutils_run $OBJCOPY "--change-section-address $text=0x80000000 tmpdir/bintest.${obj} tmpdir/bintest_signed.${obj}"] != "" } {
723 fail "Failed to reposition $text to 0x80000000 (tmpdir/bintest.${obj} -> tmpdir/bintest_signed.${obj})"
727 if [is_remote host] {
728 set testfile3 [remote_download host tmpdir/bintest_signed.${obj}]
730 set testfile3 tmpdir/bintest_signed.${obj}
733 test_objdump_content_limited $testfile3 $text "80000004" "80000008"
734 test_objdump_disas_limited $testfile3 $text "80000004" "80000008"
735 remote_file host delete $testfile3
738 # Test objdump on .NET assemblies (PE files)
740 proc test_objdump_dotnet_assemblies {} {
744 set test "dotnet-assemblies"
746 set got [binutils_run "$base_dir/testsuite/gentestdlls" "tmpdir pei-i386 pei-x86-64"]
747 set want "wrote linux-pei-x86-64.dll"
748 # The test program is hardcoded to generate valid dlls on any target
749 if ![regexp $want $got] then {
753 # First test an ordinary x86 PE format DLL.
754 set test "dotnet-assemblies (ordinary x86 DLL)"
755 set want "file format pei-i386"
756 set got [binutils_run $OBJDUMP "-x tmpdir/simple-pei-i386.dll"]
757 if ![regexp $want $got] then {
758 if [regexp "file format not recognized" $got] then {
759 # If the target does not recognize vanilla x86 PE format files
760 # then it cannot be expected to recognize .NET assemblies. But
761 # this means that these tests are unsupported, rather than failures.
766 # In either case, if cannot pass this test, then
767 # there is no point in running any further tests.
772 # Next check a 32-bit .NET DLL.
773 set test "dotnet-assemblies (32-bit .NET)"
774 set got [binutils_run $OBJDUMP "-x tmpdir/linux-pei-i386.dll"]
775 if ![regexp $want $got] then {
781 # Next check an ordrinary x86_64 PE format DLL.
782 set test "dotnet-assemblies (ordinary x86_64 DLL)"
783 set want "file format pei-x86-64"
784 set got [binutils_run $OBJDUMP "-x tmpdir/simple-pei-x86-64.dll"]
785 if ![regexp $want $got] then {
786 if [regexp "file format not recognized" $got] then {
787 # If the target does not support 64-bit PE format
788 # files, then the following tests are unsupported.
797 # Finally check a 64-bit .NET DLL.
798 set test "dotnet-assemblies (64-bit)"
799 set got [binutils_run $OBJDUMP "-x tmpdir/linux-pei-x86-64.dll"]
800 if ![regexp $want $got] then {
807 test_objdump_dotnet_assemblies
811 proc test_objdump_S { } {
817 set test "objdump -S"
819 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog executable debug] != "" } {
820 unsupported "$test (build)"
824 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -D -S tmpdir/testprog"]
826 set want "static int local = 2"
828 if [regexp $want $got] then {
834 set test "objdump --source-comment"
836 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS --disassemble-all --source-comment=// tmpdir/testprog"]
838 set want "//static int local = 2"
840 if [regexp $want $got] then {
849 # Options which are not tested: -a -D -R -T -x -l --stabs
850 # I don't see any generic way to test any of these other than -a.
851 # Tests could be written for specific targets, and that should be done
852 # if specific problems are found.