1 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2 # 2004, 2006, 2007, 2009, 2010
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-*-rtems*" "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*" "sh-*-rtems*"
91 setup_xfail "tic4x-*-*" "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 fail "objcopy --reverse-bytes"
136 scan $origdata "%2x%2x%2x%2x" b1 b2 b3 b4
137 scan $revdata "%2x%2x%2x%2x" c4 c3 c2 c1
139 if {$b1 == $c1 && $b2 == $c2 && $b3 == $c3 && $b4 == $c4} then {
140 pass "objcopy --reverse-bytes"
142 fail "objcopy --reverse-bytes"
147 # Test interleaved copy of multiple byte width
149 set sequence_file sequence_file
150 set file [open ${sequence_file} w]
151 puts ${file} "12345678"
154 if [is_remote host] {
155 remote_upload host ${sequence_file} tmpdir/sequence_file
156 set sequence_file tmpdir/sequence_file
159 set got [binutils_run $OBJCOPY "-I binary -i 4 -b 0 --interleave-width 2 ${sequence_file} ${copyfile}"]
161 if ![string match "" $got] then {
162 fail "objcopy -i --interleave-width"
164 if [is_remote host] {
165 remote_upload host ${copyfile} tmpdir/interleave_output
166 set interleave_output tmpdir/interleave_output
168 set interleave_output ${copyfile}
171 set file [open ${interleave_output} r]
176 if ![string match "1256" $line] then {
177 fail "objcopy -i --interleave-width"
179 pass "objcopy -i --interleave-width"
184 # Test generating S records.
186 # We make the srec filename 8.3 compatible. Note that the header string
187 # matched against depends on the name of the file. Ugh.
189 if [is_remote host] {
190 set srecfile copy.sre
191 set header_string S00B0000636F70792E737265C1
193 set srecfile ${copyfile}.srec
194 set header_string S0130000746D706469722F636F70792E7372656397
197 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"]
199 if ![string match "" $got] then {
200 fail "objcopy -O srec"
202 if [is_remote host] {
203 remote_upload host ${srecfile} tmpdir/copy.srec
204 set srecfile tmpdir/copy.srec
206 set file [open ${srecfile} r]
208 # The first S record is fixed by the file name we are using.
212 if ![regexp "$header_string.*" $line] {
213 send_log "bad header\n"
214 fail "objcopy -O srec"
216 while {[gets $file line] != -1 \
217 && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} {
224 if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then {
225 send_log "bad trailer\n"
226 fail "objcopy -O srec"
228 if {[gets $file line] != -1} then {
229 send_log "garbage at end\n"
232 fail "objcopy -O srec"
234 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${srecfile}"]
235 if ![regexp "file format srec" $got] then {
236 send_log "objdump failed\n"
237 fail "objcopy -O srec"
239 pass "objcopy -O srec"
248 # Test setting and adjusting the start address. We only test this
249 # while generating S records, because we may not be able to set the
250 # start address for other object file formats, and the S record case
251 # is the only useful one anyhow.
253 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $tempfile"]
254 if ![regexp "start address (\[0-9a-fA-FxX\]+)" $got all origstart] then {
255 perror "objdump can not recognize bintest.o"
258 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --set-start 0x7654 $tempfile ${copyfile}.srec"]
259 if ![string match "" $got] then {
260 fail "objcopy --set-start"
262 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"]
263 if ![regexp "file format srec.*start address (\[0-9a-fA-FxX\]+)" $got all srecstart] then {
264 fail "objcopy --set-start"
266 if {$srecstart != 0x7654} then {
267 send_log "$srecstart != 0x7654\n"
268 fail "objcopy --set-start"
270 pass "objcopy --set-start"
275 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-start 0x123 $tempfile ${copyfile}.srec"]
276 if ![string match "" $got] then {
277 fail "objcopy --adjust-start"
279 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"]
280 if ![regexp "file format srec.*start address (\[0-9a-fA-FxX\]+)" $got all srecstart] then {
281 fail "objcopy --adjust-start"
283 if {$srecstart != $origstart + 0x123} then {
284 send_log "$srecstart != $origstart + 0x123\n"
285 fail "objcopy --adjust-start"
287 pass "objcopy --adjust-start"
293 # Test adjusting the overall VMA, and adjusting the VMA of a
294 # particular section. We again only test this when generating S
300 set headers [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $tempfile"]
302 set headers_regexp "\[ 0-9\]+(\[^ \]+)\[ \]*(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+2\[*\]\[*\]\[0-9\]+(.*)"
305 while {[regexp $headers_regexp $got all name size vma rest]} {
309 if {$low == "" || $vma < $low} {
317 if {$low == "" || $origstart == ""} then {
318 perror "objdump can not recognize bintest.o"
320 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-vma 0x123 $tempfile ${copyfile}.srec"]
321 if ![string match "" $got] then {
322 fail "objcopy --adjust-vma"
324 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -fh ${copyfile}.srec"]
325 set want "file format srec.*start address\[ \]*(\[0-9a-fA-FxX\]+).*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)"
326 if ![regexp $want $got all start vma] then {
327 fail "objcopy --adjust-vma"
330 if {$vma != $low + 0x123} then {
331 send_log "$vma != $low + 0x123\n"
332 fail "objcopy --adjust-vma"
334 if {$start != $origstart + 0x123} then {
335 send_log "$start != $origstart + 0x123\n"
336 fail "objcopy --adjust-vma"
338 pass "objcopy --adjust-vma"
346 while {[regexp $headers_regexp $got all name size vma rest]} {
348 if {$vma == $low} then {
349 set arg "$arg --adjust-section-vma $name+4"
354 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $arg $tempfile ${copyfile}.srec"]
355 if ![string match "" $got] then {
356 fail "objcopy --adjust-section-vma +"
358 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"]
359 set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)"
360 if ![regexp $want $got all vma] then {
361 fail "objcopy --adjust-section-vma +"
364 if {$vma != $low + 4} then {
365 send_log "$vma != $low + 4\n"
366 fail "objcopy --adjust-section-vma +"
368 pass "objcopy --adjust-section-vma +"
373 regsub -all "\\+4" $arg "=[expr $low + 4]" argeq
374 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $argeq $tempfile ${copyfile}.srec"]
375 if ![string match "" $got] then {
376 fail "objcopy --adjust-section-vma ="
378 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"]
379 set want "file format srec.*sec1\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)"
380 if ![regexp $want $got all vma] then {
381 fail "objcopy --adjust-section-vma ="
384 if {$vma != $low + 4} then {
385 send_log "$vma != $low + 4\n"
386 fail "objcopy --adjust-section-vma ="
388 pass "objcopy --adjust-section-vma ="
394 # Test stripping an object.
396 proc strip_test { } {
408 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
413 if [is_remote host] {
414 set archive libstrip.a
415 set objfile [remote_download host tmpdir/testprog.o]
416 remote_file host delete $archive
418 set archive tmpdir/libstrip.a
419 set objfile tmpdir/testprog.o
422 remote_file build delete tmpdir/libstrip.a
424 set exec_output [binutils_run $AR "rc $archive ${objfile}"]
425 if ![string match "" $exec_output] {
430 set exec_output [binutils_run $STRIP "-g $archive"]
431 if ![string match "" $exec_output] {
436 set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
437 if ![string match "" $exec_output] {
442 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
447 if [is_remote host] {
448 set objfile [remote_download host tmpdir/testprog.o]
450 set objfile tmpdir/testprog.o
453 set exec_output [binutils_run $STRIP "$STRIPFLAGS $objfile"]
454 if ![string match "" $exec_output] {
459 set exec_output [binutils_run $NM "-a $NMFLAGS $objfile"]
460 if ![string match "*: no symbols*" $exec_output] {
470 # Test stripping an object file with saving a symbol
472 proc strip_test_with_saving_a_symbol { } {
481 set test "strip with saving a symbol"
483 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
488 if [is_remote host] {
489 set objfile [remote_download host tmpdir/testprog.o]
491 set objfile tmpdir/testprog.o
494 set exec_output [binutils_run $STRIP "$STRIPFLAGS -K main -K _main $objfile"]
495 if ![string match "" $exec_output] {
500 set exec_output [binutils_run $NM "$NMFLAGS $objfile"]
501 if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
502 && ![regexp {^([0-9a-fA-F]+)?[ ]+T _main} $exec_output]} {
510 strip_test_with_saving_a_symbol
512 # Build a final executable.
514 if { [istarget *-*-cygwin] || [istarget *-*-mingw*] } {
515 set test_prog "testprog.exe"
517 set test_prog "testprog"
520 proc copy_setup { } {
527 set res [build_wrapper testglue.o]
530 if { [istarget *-*-uclinux*] } {
535 lappend flags "additional_flags=[lindex $res 1]"
536 set add_libs "testglue.o"
541 if { [istarget *-*-linux*] } {
542 foreach i $gcc_gas_flag {
543 set flags "additional_flags=$i $flags"
546 if { [target_compile "$srcdir/$subdir/testprog.c $add_libs" tmpdir/$test_prog executable $flags] != "" } {
550 set result [remote_load target tmpdir/$test_prog]
551 set status [lindex $result 0]
553 if { $status != "pass" } {
554 send_log "cannot run executable, status = ${status} on ${host_triplet}\n"
555 if { [istarget $host_triplet] } {
564 # Test copying an executable.
566 proc copy_executable { prog flags test1 test2 } {
570 if [is_remote host] {
571 set testfile [remote_download host tmpdir/$test_prog]
572 set testcopy copyprog
574 set testfile tmpdir/$test_prog
575 set testcopy tmpdir/copyprog
577 remote_file host delete $testcopy
579 set exec_output [binutils_run $prog "$flags $testfile $testcopy"]
581 if ![string match "" $exec_output] {
583 if [string match "" $test2] {
590 if [is_remote host] {
591 remote_upload host $testcopy tmpdir/copyprog
594 set status [remote_exec build "cmp" "tmpdir/$test_prog tmpdir/copyprog"]
595 set exec_output [lindex $status 1]
597 if [string match "" $exec_output] then {
600 send_log "$exec_output\n"
601 verbose "$exec_output"
603 # This will fail for many reasons. For example, it will most
604 # likely fail if a non-GNU linker is used. Therefore, we do
605 # not insist that it pass. If you are using an assembler and
606 # linker based on the same BFD as objcopy, it is worth
607 # investigating to see why this failure occurs. If we are
608 # cross compiling, we assume that a GNU linker is being used,
609 # and expect it to succeed.
610 if {[isnative]} then {
614 # This also fails for mips*-*-elf targets. See elf32-mips.c
615 # mips_elf_sym_is_global.
616 setup_xfail "mips*-*-elf"
618 setup_xfail "*arm*-*-coff"
619 setup_xfail "xscale-*-coff"
620 setup_xfail "arm*-*-pe"
621 setup_xfail "thumb*-*-coff"
622 setup_xfail "thumb*-*-pe"
623 setup_xfail "*-*-mingw*"
624 setup_xfail "*-*-cygwin*"
629 if [string match "" $test2] {
633 set output [remote_load target tmpdir/copyprog]
634 set status [lindex $output 0]
635 if { ![istarget $host_triplet] } {
638 if { $status != "pass" } {
645 # Test stripping an executable
647 proc strip_executable { prog flags test } {
652 remote_file build delete tmpdir/striprog
653 remote_download build tmpdir/copyprog tmpdir/striprog
654 if [is_remote host] {
655 set copyfile [remote_download host tmpdir/striprog]
657 set copyfile tmpdir/striprog
660 set exec_output [binutils_run $prog "$flags ${copyfile}"]
661 if ![string match "" $exec_output] {
666 if [is_remote host] {
667 remote_upload host ${copyfile} tmpdir/striprog
670 set result [remote_load target tmpdir/striprog]
671 set status [lindex $result 0]
672 if { ![istarget $host_triplet] } {
675 if { $status != "pass" } {
680 set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
681 if ![string match "*: no symbols*" $exec_output] {
688 # Test stripping an executable with saving a symbol
690 proc strip_executable_with_saving_a_symbol { prog flags test } {
695 remote_file build delete tmpdir/striprog
696 remote_download build tmpdir/copyprog tmpdir/striprog
697 if [is_remote host] {
698 set copyfile [remote_download host tmpdir/striprog]
700 set copyfile tmpdir/striprog
703 set exec_output [binutils_run $prog "$flags ${copyfile}"]
704 if ![string match "" $exec_output] {
709 if [is_remote host] {
710 remote_upload host ${copyfile} tmpdir/striprog
713 set result [remote_load target tmpdir/striprog]
714 set status [lindex $result 0]
715 if { ![istarget $host_triplet] } {
718 if { $status != "pass" } {
723 set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
724 if { [istarget mmix-knuth-mmixware] } {
725 # Whenever there's a symbol in the mmo format, there's the symbol
726 # Main, so remove it manually from the expected output for sake of
729 # Using "" not {} to get the \n and \r translated.
730 regsub "^\[0-9a-fA-F\]+\[ \]+T Main\[\n\r\]+" $exec_output "" exec_output
733 if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
734 && ![regexp {^([0-9a-fA-F]+)?[ ]+[TD] _main} $exec_output]} {
741 # Test keeping only debug symbols of an executable
743 proc keep_debug_symbols_and_test_copy { prog1 flags1 test1 prog2 flags2 test2 } {
747 remote_file build delete tmpdir/striprog
748 remote_download build tmpdir/copyprog tmpdir/striprog
749 if [is_remote host] {
750 set copyfile [remote_download host tmpdir/striprog]
752 set copyfile tmpdir/striprog
755 set exec_output [binutils_run $prog1 "$flags1 ${copyfile}"]
756 if ![string match "" $exec_output] {
762 set exec_output [binutils_run $prog2 "$flags2 ${copyfile}"]
763 if ![string match "" $exec_output] {
770 set test1 "simple objcopy of executable"
771 set test2 "run objcopy of executable"
772 set test3 "run stripped executable"
773 set test4 "run stripped executable with saving a symbol"
774 set test5 "keep only debug data"
775 set test6 "simple objcopy of debug data"
777 switch [copy_setup] {
790 copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" ""
798 copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test2"
799 strip_executable "$STRIP" "$STRIPFLAGS" "$test3"
800 strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test4"
801 keep_debug_symbols_and_test_copy "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test5" \
802 "$OBJCOPY" "$OBJCOPYFLAGS" "$test6"
806 proc objcopy_test_readelf {testname srcfile} {
813 if {![binutils_assemble $srcdir/$subdir/${srcfile} tmpdir/bintest.o]} then {
814 unresolved "objcopy ($testname)"
818 verbose -log "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"
819 set exec_output [remote_exec host "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"]
820 if { [lindex $exec_output 0] != 0
821 || ![string match "" [lindex $exec_output 1]] } then {
822 fail "objcopy ($testname)"
826 verbose -log "$READELF -a tmpdir/bintest.o > tmpdir/bintest.o.out"
827 set exec_output [remote_exec host "$READELF -a tmpdir/bintest.o" "" "/dev/null" "tmpdir/bintest.o.out"]
828 if { [lindex $exec_output 0] != 0 } then {
829 unresolved "objcopy ($testname)"
832 set exec_output [prune_warnings [lindex $exec_output 1]]
833 if ![string match "" $exec_output] then {
834 unresolved "objcopy ($testname)"
838 verbose -log "$READELF -a tmpdir/copy.o > tmpdir/copy.o.out"
839 set exec_output [remote_exec host "$READELF -a tmpdir/copy.o" "" "/dev/null" "tmpdir/copy.o.out"]
840 if { [lindex $exec_output 0] != 0 } then {
841 unresolved "objcopy ($testname)"
844 set exec_output [prune_warnings [lindex $exec_output 1]]
845 if ![string match "" $exec_output] then {
846 unresolved "objcopy ($testname)"
850 verbose -log "diff tmpdir/bintest.o.out tmpdir/copy.o.out"
851 catch "exec diff tmpdir/bintest.o.out tmpdir/copy.o.out" exec_output
852 set exec_output [prune_warnings $exec_output]
854 if [string match "" $exec_output] then {
855 pass "objcopy ($testname)"
857 fail "objcopy ($testname)"
861 # ia64 specific tests
862 if { ([istarget "ia64-*-elf*"]
863 || [istarget "ia64-*-linux*"]) } {
864 objcopy_test "ia64 link order" link-order.s
869 objcopy_test "ELF unknown section type" unknown.s
870 objcopy_test_readelf "ELF group" group.s
871 objcopy_test_readelf "ELF group" group-2.s
872 objcopy_test_readelf "ELF group" group-3.s
873 objcopy_test_readelf "ELF group" group-4.s
874 run_dump_test "group-5"
875 run_dump_test "copy-1"
876 run_dump_test "note-1"
879 run_dump_test "copy-2"
880 run_dump_test "copy-3"
881 run_dump_test "copy-4"
884 run_dump_test "strip-1"
885 run_dump_test "strip-2"
886 run_dump_test "strip-3"
887 run_dump_test "strip-4"
888 run_dump_test "strip-5"
889 run_dump_test "strip-6"
890 run_dump_test "strip-7"
891 run_dump_test "strip-8"
892 run_dump_test "strip-9"
893 run_dump_test "strip-10"
895 if { [istarget "i*86-*"] || [istarget "x86_64-*-*"] } {
896 # Check to make sure we don't strip a symbol named in relocations.
897 set test "objcopy keeps symbols needed by relocs"
899 set srcfile $srcdir/$subdir/needed-by-reloc.s
901 if {![binutils_assemble $srcfile tmpdir/bintest.o]} then {
904 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-symbol=foo tmpdir/bintest.o ${copyfile}.o"]
906 if [regexp "not stripping symbol `foo' because it is named in a relocation" $got] {
914 run_dump_test "localize-hidden-1"
915 run_dump_test "testranges"
916 run_dump_test "testranges-ia64"
918 run_dump_test "add-section"
919 run_dump_test "add-empty-section"
921 run_dump_test "exclude-1a"
922 run_dump_test "exclude-1b"
924 run_dump_test "localize-hidden-2"