1 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 # 2004, 2006, 2007, 2009, 2010, 2011
3 # Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
19 # Please email any bugs, comments, and/or additions to this file to:
20 # bug-dejagnu@prep.ai.mit.edu
22 # Written by Ian Lance Taylor <ian@cygnus.com>
24 if ![is_remote host] {
25 if {[which $OBJCOPY] == 0} then {
26 perror "$OBJCOPY does not exist"
31 send_user "Version [binutil_version $OBJCOPY]"
33 if ![is_remote host] {
34 set tempfile tmpdir/bintest.o
35 set copyfile tmpdir/copy
37 set tempfile [remote_download host tmpdir/bintest.o]
41 # Test that objcopy does not modify a file when copying it.
43 proc objcopy_test {testname srcfile} {
51 if {![binutils_assemble $srcdir/$subdir/${srcfile} tmpdir/bintest.o]} then {
52 perror "unresolved $testname"
53 unresolved "objcopy ($testname)"
57 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile ${copyfile}.o"]
59 if ![string match "" $got] then {
60 fail "objcopy ($testname)"
62 send_log "cmp $tempfile ${copyfile}.o\n"
63 verbose "cmp $tempfile ${copyfile}.o"
65 set src1 tmpdir/bintest.o
66 set src2 tmpdir/copy.o
67 remote_upload host $tempfile $src1
68 remote_upload host ${copyfile}.o $src2
71 set src2 ${copyfile}.o
73 set status [remote_exec build cmp "${src1} ${src2}"]
74 set exec_output [lindex $status 1]
75 set exec_output [prune_warnings $exec_output]
77 # On some systems the result of objcopy will not be identical.
78 # Usually this is just because gas isn't using bfd to write the
79 # files in the first place, and may order things a little
80 # differently. Those systems should use setup_xfail here.
82 setup_xfail "h8300-*-coff"
83 setup_xfail "h8500-*-rtems*" "h8500-*-coff"
84 setup_xfail "hppa*-*-*"
86 setup_xfail "m68*-*-*coff" "m68*-*-hpux*" "m68*-*-lynxos*"
87 setup_xfail "m68*-*-sysv*" "m68*-apple-aux*"
89 setup_xfail "or32-*-rtems*" "or32-*-coff"
90 setup_xfail "sh-*-coff*"
91 setup_xfail "tic80-*-*" "w65-*"
93 clear_xfail "hppa*64*-*-hpux*" "hppa*-*-linux*" "hppa*-*-lites*"
94 clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-rtems*" "*-*-*elf*"
95 clear_xfail "m68*-*-sysv4*"
97 if [string match "" $exec_output] then {
98 pass "objcopy ($testname)"
100 send_log "$exec_output\n"
101 verbose "$exec_output" 1
103 # On OSF/1, this succeeds with gas and fails with /bin/as.
104 setup_xfail "alpha*-*-osf*"
106 fail "objcopy ($testname)"
111 objcopy_test "simple copy" bintest.s
113 # Test reversing bytes in a section.
115 set reversed ${tempfile}-reversed
116 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j .data --reverse-bytes=4 $tempfile $reversed"]
118 if ![string match "" $got] then {
119 fail "objcopy --reverse-bytes"
121 if [is_remote host] {
122 remote_upload host ${reversed} tmpdir/copy-reversed.o
123 set reversed tmpdir/copy-reversed.o
126 set origdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $tempfile"]
127 set revdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $reversed"]
129 set want "^ \[0-9\]+ (\[0-9\]+)"
130 set found_orig [regexp -lineanchor $want $origdata -> origdata]
131 set found_rev [regexp -lineanchor $want $revdata -> revdata]
133 if {$found_orig == 0 || $found_rev == 0} then {
134 # som doesn't have a .data section
135 setup_xfail "hppa*-*-hpux*"
136 clear_xfail "hppa*64*-*-hpux*"
138 fail "objcopy --reverse-bytes"
140 scan $origdata "%2x%2x%2x%2x" b1 b2 b3 b4
141 scan $revdata "%2x%2x%2x%2x" c4 c3 c2 c1
143 if {$b1 == $c1 && $b2 == $c2 && $b3 == $c3 && $b4 == $c4} then {
144 pass "objcopy --reverse-bytes"
146 fail "objcopy --reverse-bytes"
151 # Test interleaved copy of multiple byte width
153 set sequence_file sequence_file
154 set file [open ${sequence_file} w]
155 puts ${file} "12345678"
158 if [is_remote host] {
159 remote_upload host ${sequence_file} tmpdir/sequence_file
160 set sequence_file tmpdir/sequence_file
163 set got [binutils_run $OBJCOPY "-I binary -i 4 -b 0 --interleave-width 2 ${sequence_file} ${copyfile}"]
165 if ![string match "" $got] then {
166 fail "objcopy -i --interleave-width"
168 if [is_remote host] {
169 remote_upload host ${copyfile} tmpdir/interleave_output
170 set interleave_output tmpdir/interleave_output
172 set interleave_output ${copyfile}
175 set file [open ${interleave_output} r]
180 if ![string match "1256" $line] then {
181 fail "objcopy -i --interleave-width"
183 pass "objcopy -i --interleave-width"
188 # Test generating S records.
190 # We make the srec filename 8.3 compatible. Note that the header string
191 # matched against depends on the name of the file. Ugh.
193 if [is_remote host] {
194 set srecfile copy.sre
195 set header_string S00B0000636F70792E737265C1
197 set srecfile ${copyfile}.srec
198 set header_string S0130000746D706469722F636F70792E7372656397
201 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"]
203 if ![string match "" $got] then {
204 fail "objcopy -O srec"
206 if [is_remote host] {
207 remote_upload host ${srecfile} tmpdir/copy.srec
208 set srecfile tmpdir/copy.srec
210 set file [open ${srecfile} r]
212 # The first S record is fixed by the file name we are using.
216 if ![regexp "$header_string.*" $line] {
217 send_log "bad header\n"
218 fail "objcopy -O srec"
220 while {[gets $file line] != -1 \
221 && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} {
228 if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then {
229 send_log "bad trailer\n"
230 fail "objcopy -O srec"
232 if {[gets $file line] != -1} then {
233 send_log "garbage at end\n"
236 fail "objcopy -O srec"
238 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${srecfile}"]
239 if ![regexp "file format srec" $got] then {
240 send_log "objdump failed\n"
241 fail "objcopy -O srec"
243 pass "objcopy -O srec"
252 # Test setting and adjusting the start address. We only test this
253 # while generating S records, because we may not be able to set the
254 # start address for other object file formats, and the S record case
255 # is the only useful one anyhow.
257 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $tempfile"]
258 if ![regexp "start address (\[0-9a-fA-FxX\]+)" $got all origstart] then {
259 perror "objdump can not recognize bintest.o"
262 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --set-start 0x7654 $tempfile ${copyfile}.srec"]
263 if ![string match "" $got] then {
264 fail "objcopy --set-start"
266 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"]
267 if ![regexp "file format srec.*start address (\[0-9a-fA-FxX\]+)" $got all srecstart] then {
268 fail "objcopy --set-start"
270 if {$srecstart != 0x7654} then {
271 send_log "$srecstart != 0x7654\n"
272 fail "objcopy --set-start"
274 pass "objcopy --set-start"
279 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-start 0x123 $tempfile ${copyfile}.srec"]
280 if ![string match "" $got] then {
281 fail "objcopy --adjust-start"
283 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"]
284 if ![regexp "file format srec.*start address (\[0-9a-fA-FxX\]+)" $got all srecstart] then {
285 fail "objcopy --adjust-start"
287 if {$srecstart != $origstart + 0x123} then {
288 send_log "$srecstart != $origstart + 0x123\n"
289 fail "objcopy --adjust-start"
291 pass "objcopy --adjust-start"
297 # Test adjusting the overall VMA, and adjusting the VMA of a
298 # particular section. We again only test this when generating S
304 set headers [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $tempfile"]
306 set headers_regexp "\[ 0-9\]+(\[^ \]+)\[ \]*(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+2\[*\]\[*\]\[0-9\]+(.*)"
309 while {[regexp $headers_regexp $got all name size vma rest]} {
313 if {$low == "" || $vma < $low} {
321 if {$low == "" || $origstart == ""} then {
322 perror "objdump can not recognize bintest.o"
324 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-vma 0x123 $tempfile ${copyfile}.srec"]
325 if ![string match "" $got] then {
326 fail "objcopy --adjust-vma"
328 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -fh ${copyfile}.srec"]
329 set want "file format srec.*start address\[ \]*(\[0-9a-fA-FxX\]+).*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)"
330 if ![regexp $want $got all start vma] then {
331 fail "objcopy --adjust-vma"
334 if {$vma != $low + 0x123} then {
335 send_log "$vma != $low + 0x123\n"
336 fail "objcopy --adjust-vma"
338 if {$start != $origstart + 0x123} then {
339 send_log "$start != $origstart + 0x123\n"
340 fail "objcopy --adjust-vma"
342 pass "objcopy --adjust-vma"
350 while {[regexp $headers_regexp $got all name size vma rest]} {
352 if {$vma == $low} then {
353 set arg "$arg --adjust-section-vma $name+4"
358 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $arg $tempfile ${copyfile}.srec"]
359 if ![string match "" $got] then {
360 fail "objcopy --adjust-section-vma +"
362 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"]
363 set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)"
364 if ![regexp $want $got all vma] then {
365 fail "objcopy --adjust-section-vma +"
368 if {$vma != $low + 4} then {
369 send_log "$vma != $low + 4\n"
370 fail "objcopy --adjust-section-vma +"
372 pass "objcopy --adjust-section-vma +"
377 regsub -all "\\+4" $arg "=[expr $low + 4]" argeq
378 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $argeq $tempfile ${copyfile}.srec"]
379 if ![string match "" $got] then {
380 fail "objcopy --adjust-section-vma ="
382 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"]
383 set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)"
384 if ![regexp $want $got all vma] then {
385 fail "objcopy --adjust-section-vma ="
388 if {$vma != $low + 4} then {
389 send_log "$vma != $low + 4\n"
390 fail "objcopy --adjust-section-vma ="
392 pass "objcopy --adjust-section-vma ="
398 # Test stripping an object.
400 proc strip_test { } {
412 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
417 if [is_remote host] {
418 set archive libstrip.a
419 set objfile [remote_download host tmpdir/testprog.o]
420 remote_file host delete $archive
422 set archive tmpdir/libstrip.a
423 set objfile tmpdir/testprog.o
426 remote_file build delete tmpdir/libstrip.a
428 set exec_output [binutils_run $AR "rc $archive ${objfile}"]
429 if ![string match "" $exec_output] {
434 set exec_output [binutils_run $STRIP "-g $archive"]
435 if ![string match "" $exec_output] {
440 set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
441 if ![string match "" $exec_output] {
446 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
451 if [is_remote host] {
452 set objfile [remote_download host tmpdir/testprog.o]
454 set objfile tmpdir/testprog.o
457 set exec_output [binutils_run $STRIP "$STRIPFLAGS $objfile"]
458 if ![string match "" $exec_output] {
463 set exec_output [binutils_run $NM "-a $NMFLAGS $objfile"]
464 if ![string match "*: no symbols*" $exec_output] {
474 # Test stripping an object file with saving a symbol
476 proc strip_test_with_saving_a_symbol { } {
485 set test "strip with saving a symbol"
487 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
492 if [is_remote host] {
493 set objfile [remote_download host tmpdir/testprog.o]
495 set objfile tmpdir/testprog.o
498 set exec_output [binutils_run $STRIP "$STRIPFLAGS -K main -K _main $objfile"]
499 if ![string match "" $exec_output] {
504 set exec_output [binutils_run $NM "$NMFLAGS $objfile"]
505 if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
506 && ![regexp {^([0-9a-fA-F]+)?[ ]+T _main} $exec_output]} {
514 strip_test_with_saving_a_symbol
516 # Build a final executable.
518 if { [istarget *-*-cygwin] || [istarget *-*-mingw*] } {
519 set test_prog "testprog.exe"
521 set test_prog "testprog"
524 proc copy_setup { } {
531 set res [build_wrapper testglue.o]
534 if { [istarget *-*-uclinux*] } {
539 lappend flags "additional_flags=[lindex $res 1]"
540 set add_libs "testglue.o"
545 if { [istarget *-*-linux*]
546 || [istarget *-*-gnu*] } {
547 foreach i $gcc_gas_flag {
548 set flags "additional_flags=$i $flags"
551 if { [target_compile "$srcdir/$subdir/testprog.c $add_libs" tmpdir/$test_prog executable $flags] != "" } {
555 set result [remote_load target tmpdir/$test_prog]
556 set status [lindex $result 0]
558 if { $status != "pass" } {
559 send_log "cannot run executable, status = ${status} on ${host_triplet}\n"
560 if { [istarget $host_triplet] } {
569 # Test copying an executable.
571 proc copy_executable { prog flags test1 test2 } {
575 if [is_remote host] {
576 set testfile [remote_download host tmpdir/$test_prog]
577 set testcopy copyprog
579 set testfile tmpdir/$test_prog
580 set testcopy tmpdir/copyprog
582 remote_file host delete $testcopy
584 set exec_output [binutils_run $prog "$flags $testfile $testcopy"]
586 if ![string match "" $exec_output] {
588 if [string match "" $test2] {
595 if [is_remote host] {
596 remote_upload host $testcopy tmpdir/copyprog
599 set status [remote_exec build "cmp" "tmpdir/$test_prog tmpdir/copyprog"]
600 set exec_output [lindex $status 1]
602 if [string match "" $exec_output] then {
605 send_log "$exec_output\n"
606 verbose "$exec_output"
608 # This will fail for many reasons. For example, it will most
609 # likely fail if a non-GNU linker is used. Therefore, we do
610 # not insist that it pass. If you are using an assembler and
611 # linker based on the same BFD as objcopy, it is worth
612 # investigating to see why this failure occurs. If we are
613 # cross compiling, we assume that a GNU linker is being used,
614 # and expect it to succeed.
615 if {[isnative]} then {
619 # This also fails for mips*-*-elf targets. See elf32-mips.c
620 # mips_elf_sym_is_global.
621 setup_xfail "mips*-*-elf"
623 setup_xfail "arm*-*-coff"
624 setup_xfail "arm*-*-pe"
625 setup_xfail "*-*-mingw*"
626 setup_xfail "*-*-cygwin*"
631 if [string match "" $test2] {
635 set output [remote_load target tmpdir/copyprog]
636 set status [lindex $output 0]
637 if { ![istarget $host_triplet] } {
640 if { $status != "pass" } {
647 # Test stripping an executable
649 proc strip_executable { prog flags test } {
654 remote_file build delete tmpdir/striprog
655 remote_download build tmpdir/copyprog tmpdir/striprog
656 if [is_remote host] {
657 set copyfile [remote_download host tmpdir/striprog]
659 set copyfile tmpdir/striprog
662 set exec_output [binutils_run $prog "$flags ${copyfile}"]
663 if ![string match "" $exec_output] {
668 if [is_remote host] {
669 remote_upload host ${copyfile} tmpdir/striprog
672 set result [remote_load target tmpdir/striprog]
673 set status [lindex $result 0]
674 if { ![istarget $host_triplet] } {
677 if { $status != "pass" } {
682 set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
683 if ![string match "*: no symbols*" $exec_output] {
690 # Test stripping an executable with saving a symbol
692 proc strip_executable_with_saving_a_symbol { prog flags test } {
697 remote_file build delete tmpdir/striprog
698 remote_download build tmpdir/copyprog tmpdir/striprog
699 if [is_remote host] {
700 set copyfile [remote_download host tmpdir/striprog]
702 set copyfile tmpdir/striprog
705 set exec_output [binutils_run $prog "$flags ${copyfile}"]
706 if ![string match "" $exec_output] {
711 if [is_remote host] {
712 remote_upload host ${copyfile} tmpdir/striprog
715 set result [remote_load target tmpdir/striprog]
716 set status [lindex $result 0]
717 if { ![istarget $host_triplet] } {
720 if { $status != "pass" } {
725 set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
726 if { [istarget mmix-knuth-mmixware] } {
727 # Whenever there's a symbol in the mmo format, there's the symbol
728 # Main, so remove it manually from the expected output for sake of
731 # Using "" not {} to get the \n and \r translated.
732 regsub "^\[0-9a-fA-F\]+\[ \]+T Main\[\n\r\]+" $exec_output "" exec_output
735 if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
736 && ![regexp {^([0-9a-fA-F]+)?[ ]+[TD] _main} $exec_output]} {
743 # Test keeping only debug symbols of an executable
745 proc keep_debug_symbols_and_test_copy { prog1 flags1 test1 prog2 flags2 test2 } {
749 remote_file build delete tmpdir/striprog
750 remote_download build tmpdir/copyprog tmpdir/striprog
751 if [is_remote host] {
752 set copyfile [remote_download host tmpdir/striprog]
754 set copyfile tmpdir/striprog
757 set exec_output [binutils_run $prog1 "$flags1 ${copyfile}"]
758 if ![string match "" $exec_output] {
764 set exec_output [binutils_run $prog2 "$flags2 ${copyfile}"]
765 if ![string match "" $exec_output] {
772 set test1 "simple objcopy of executable"
773 set test2 "run objcopy of executable"
774 set test3 "run stripped executable"
775 set test4 "run stripped executable with saving a symbol"
776 set test5 "keep only debug data"
777 set test6 "simple objcopy of debug data"
779 switch [copy_setup] {
792 copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" ""
800 copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test2"
801 strip_executable "$STRIP" "$STRIPFLAGS" "$test3"
802 strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test4"
803 keep_debug_symbols_and_test_copy "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test5" \
804 "$OBJCOPY" "$OBJCOPYFLAGS" "$test6"
808 proc objcopy_test_readelf {testname srcfile} {
815 if {![binutils_assemble $srcdir/$subdir/${srcfile} tmpdir/bintest.o]} then {
816 unresolved "objcopy ($testname)"
820 verbose -log "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"
821 set exec_output [remote_exec host "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"]
822 if { [lindex $exec_output 0] != 0
823 || ![string match "" [lindex $exec_output 1]] } then {
824 fail "objcopy ($testname)"
828 verbose -log "$READELF -a tmpdir/bintest.o > tmpdir/bintest.o.out"
829 set exec_output [remote_exec host "$READELF -a tmpdir/bintest.o" "" "/dev/null" "tmpdir/bintest.o.out"]
830 if { [lindex $exec_output 0] != 0 } then {
831 unresolved "objcopy ($testname)"
834 set exec_output [prune_warnings [lindex $exec_output 1]]
835 if ![string match "" $exec_output] then {
836 unresolved "objcopy ($testname)"
840 verbose -log "$READELF -a tmpdir/copy.o > tmpdir/copy.o.out"
841 set exec_output [remote_exec host "$READELF -a tmpdir/copy.o" "" "/dev/null" "tmpdir/copy.o.out"]
842 if { [lindex $exec_output 0] != 0 } then {
843 unresolved "objcopy ($testname)"
846 set exec_output [prune_warnings [lindex $exec_output 1]]
847 if ![string match "" $exec_output] then {
848 unresolved "objcopy ($testname)"
852 verbose -log "diff tmpdir/bintest.o.out tmpdir/copy.o.out"
853 catch "exec diff tmpdir/bintest.o.out tmpdir/copy.o.out" exec_output
854 set exec_output [prune_warnings $exec_output]
856 if [string match "" $exec_output] then {
857 pass "objcopy ($testname)"
859 fail "objcopy ($testname)"
863 # ia64 specific tests
864 if { ([istarget "ia64-*-elf*"]
865 || [istarget "ia64-*-linux*"]) } {
866 objcopy_test "ia64 link order" link-order.s
871 objcopy_test "ELF unknown section type" unknown.s
872 objcopy_test_readelf "ELF group" group.s
873 objcopy_test_readelf "ELF group" group-2.s
874 objcopy_test_readelf "ELF group" group-3.s
875 objcopy_test_readelf "ELF group" group-4.s
876 run_dump_test "group-5"
877 run_dump_test "copy-1"
878 run_dump_test "note-1"
881 run_dump_test "copy-2"
882 run_dump_test "copy-3"
883 run_dump_test "copy-4"
886 run_dump_test "strip-1"
887 run_dump_test "strip-2"
888 run_dump_test "strip-3"
889 run_dump_test "strip-4"
890 run_dump_test "strip-5"
891 run_dump_test "strip-6"
892 run_dump_test "strip-7"
893 run_dump_test "strip-8"
894 run_dump_test "strip-9"
895 if { ![istarget "*-*-hpux*"]
896 && ![istarget "msp*-*-*"] } {
897 run_dump_test "strip-10"
900 if { [istarget "i*86-*"] || [istarget "x86_64-*-*"] } {
901 # Check to make sure we don't strip a symbol named in relocations.
902 set test "objcopy keeps symbols needed by relocs"
904 set srcfile $srcdir/$subdir/needed-by-reloc.s
906 if {![binutils_assemble $srcfile tmpdir/bintest.o]} then {
909 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-symbol=foo tmpdir/bintest.o ${copyfile}.o"]
911 if [regexp "not stripping symbol `foo' because it is named in a relocation" $got] {
919 run_dump_test "localize-hidden-1"
920 run_dump_test "testranges"
921 run_dump_test "testranges-ia64"
923 run_dump_test "add-section"
924 run_dump_test "add-empty-section"
926 run_dump_test "exclude-1a"
927 run_dump_test "exclude-1b"
929 run_dump_test "localize-hidden-2"