Document setting experimental on release branch.
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / objcopy.exp
CommitLineData
219d1afa 1# Copyright (C) 1994-2018 Free Software Foundation, Inc.
252b5132
RH
2
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
32866df7 5# the Free Software Foundation; either version 3 of the License, or
252b5132 6# (at your option) any later version.
21c40443 7#
252b5132
RH
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.
21c40443 12#
252b5132
RH
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
b43b5d5f 15# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
252b5132
RH
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-dejagnu@prep.ai.mit.edu
19
20# Written by Ian Lance Taylor <ian@cygnus.com>
21
22if ![is_remote host] {
23 if {[which $OBJCOPY] == 0} then {
24 perror "$OBJCOPY does not exist"
25 return
26 }
27}
28
29send_user "Version [binutil_version $OBJCOPY]"
30
252b5132 31if ![is_remote host] {
8d263650
BE
32 set tempfile tmpdir/bintest.o
33 set copyfile tmpdir/copy
252b5132
RH
34} else {
35 set tempfile [remote_download host tmpdir/bintest.o]
36 set copyfile copy
37}
38
39# Test that objcopy does not modify a file when copying it.
40
64bb95af
L
41proc objcopy_test {testname srcfile} {
42 global OBJCOPY
43 global OBJCOPYFLAGS
44 global srcdir
45 global subdir
46 global tempfile
47 global copyfile
252b5132 48
96037eb0 49 if {![binutils_assemble $srcdir/$subdir/${srcfile} $tempfile]} then {
64bb95af 50 unresolved "objcopy ($testname)"
96037eb0 51 remote_file host delete $tempfile
64bb95af 52 return
252b5132 53 }
252b5132 54
64bb95af
L
55 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile ${copyfile}.o"]
56
21c40443 57 if ![string equal "" $got] then {
64bb95af 58 fail "objcopy ($testname)"
252b5132 59 } else {
64bb95af
L
60 send_log "cmp $tempfile ${copyfile}.o\n"
61 verbose "cmp $tempfile ${copyfile}.o"
62 if [is_remote host] {
63 set src1 tmpdir/bintest.o
64 set src2 tmpdir/copy.o
65 remote_upload host $tempfile $src1
66 remote_upload host ${copyfile}.o $src2
67 } else {
68 set src1 ${tempfile}
69 set src2 ${copyfile}.o
70 }
71 set status [remote_exec build cmp "${src1} ${src2}"]
72 set exec_output [lindex $status 1]
73 set exec_output [prune_warnings $exec_output]
74
75 # On some systems the result of objcopy will not be identical.
76 # Usually this is just because gas isn't using bfd to write the
77 # files in the first place, and may order things a little
78 # differently. Those systems should use setup_xfail here.
79
64bb95af 80 setup_xfail "hppa*-*-*"
64bb95af 81 setup_xfail "m8*-*"
b0a0c50a 82 setup_xfail "sh-*-coff*"
a9a4b302 83 setup_xfail "tic80-*-*"
64bb95af
L
84
85 clear_xfail "hppa*64*-*-hpux*" "hppa*-*-linux*" "hppa*-*-lites*"
86 clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-rtems*" "*-*-*elf*"
64bb95af 87
21c40443 88 if [string equal "" $exec_output] then {
64bb95af
L
89 pass "objcopy ($testname)"
90 } else {
91 send_log "$exec_output\n"
92 verbose "$exec_output" 1
252b5132 93
64bb95af
L
94 # On OSF/1, this succeeds with gas and fails with /bin/as.
95 setup_xfail "alpha*-*-osf*"
252b5132 96
64bb95af
L
97 fail "objcopy ($testname)"
98 }
252b5132
RH
99 }
100}
101
64bb95af
L
102objcopy_test "simple copy" bintest.s
103
96037eb0
NC
104if { [file exists $tempfile] } {
105 # Test reversing bytes in a section.
9e48b4c6 106
96037eb0
NC
107 set reversed ${tempfile}-reversed
108 set sect_names [get_standard_section_names]
109 if { $sect_names != "" } {
110 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j [lindex $sect_names 1] --reverse-bytes=4 $tempfile $reversed"]
111 } else {
112 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j .data --reverse-bytes=4 $tempfile $reversed"]
9e48b4c6
NC
113 }
114
96037eb0
NC
115 if ![string equal "" $got] then {
116 fail "objcopy --reverse-bytes"
117 } else {
118 if [is_remote host] {
119 remote_upload host ${reversed} tmpdir/copy-reversed.o
120 set reversed tmpdir/copy-reversed.o
121 }
9e48b4c6 122
96037eb0
NC
123 set origdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $tempfile"]
124 set revdata [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s -j .data $reversed"]
9e48b4c6 125
96037eb0
NC
126 set want "^ \[0-9\]+ (\[0-9\]+)"
127 set found_orig [regexp -lineanchor $want $origdata -> origdata]
128 set found_rev [regexp -lineanchor $want $revdata -> revdata]
8941d5e8 129
96037eb0
NC
130 if {$found_orig == 0 || $found_rev == 0} then {
131 # som doesn't have a .data section
132 setup_xfail "hppa*-*-hpux*"
133 clear_xfail "hppa*64*-*-hpux*"
9e48b4c6 134
96037eb0
NC
135 fail "objcopy --reverse-bytes"
136 } else {
137 scan $origdata "%2x%2x%2x%2x" b1 b2 b3 b4
138 scan $revdata "%2x%2x%2x%2x" c4 c3 c2 c1
139
140 if {$b1 == $c1 && $b2 == $c2 && $b3 == $c3 && $b4 == $c4} then {
141 pass "objcopy --reverse-bytes"
142 } else {
143 fail "objcopy --reverse-bytes"
144 }
145 }
9e48b4c6
NC
146 }
147}
148
b7dd81f7
NC
149# Test interleaved copy of multiple byte width
150
151set sequence_file sequence_file
152set file [open ${sequence_file} w]
153puts ${file} "12345678"
154close ${file}
155
156if [is_remote host] {
157 remote_upload host ${sequence_file} tmpdir/sequence_file
158 set sequence_file tmpdir/sequence_file
159}
160
161set got [binutils_run $OBJCOPY "-I binary -i 4 -b 0 --interleave-width 2 ${sequence_file} ${copyfile}"]
162
21c40443 163if ![string equal "" $got] then {
b7dd81f7
NC
164 fail "objcopy -i --interleave-width"
165} else {
166 if [is_remote host] {
167 remote_upload host ${copyfile} tmpdir/interleave_output
168 set interleave_output tmpdir/interleave_output
169 } else {
170 set interleave_output ${copyfile}
171 }
172
173 set file [open ${interleave_output} r]
174 gets $file line
175 send_log "$line\n"
176 verbose $line
177
21c40443 178 if ![string equal "1256" $line] then {
b7dd81f7
NC
179 fail "objcopy -i --interleave-width"
180 }
181 pass "objcopy -i --interleave-width"
182
183 close $file
184}
185
252b5132
RH
186# Test generating S records.
187
96037eb0
NC
188if { [file exists $tempfile] } {
189 # We make the srec filename 8.3 compatible. Note that the header string
190 # matched against depends on the name of the file. Ugh.
252b5132 191
252b5132 192 if [is_remote host] {
96037eb0
NC
193 set srecfile copy.sre
194 set header_string S00B0000636F70792E737265C1
195 } else {
196 set srecfile ${copyfile}.srec
197 set header_string S0130000746D706469722F636F70792E7372656397
252b5132 198 }
252b5132 199
96037eb0
NC
200 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"]
201
202 if ![string equal "" $got] then {
252b5132
RH
203 fail "objcopy -O srec"
204 } else {
96037eb0
NC
205 if [is_remote host] {
206 remote_upload host ${srecfile} tmpdir/copy.srec
207 set srecfile tmpdir/copy.srec
252b5132 208 }
96037eb0
NC
209 set file [open ${srecfile} r]
210
211 # The first S record is fixed by the file name we are using.
212 gets $file line
252b5132
RH
213 send_log "$line\n"
214 verbose $line
96037eb0
NC
215 if ![regexp "$header_string.*" $line] {
216 send_log "bad header\n"
252b5132
RH
217 fail "objcopy -O srec"
218 } else {
96037eb0
NC
219 while {[gets $file line] != -1 \
220 && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} {
252b5132
RH
221 send_log "$line\n"
222 verbose $line
96037eb0
NC
223 set line "**EOF**"
224 }
225 send_log "$line\n"
226 verbose $line
227 if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then {
228 send_log "bad trailer\n"
252b5132
RH
229 fail "objcopy -O srec"
230 } else {
96037eb0
NC
231 if {[gets $file line] != -1} then {
232 send_log "garbage at end\n"
233 send_log "$line\n"
234 verbose $line
252b5132
RH
235 fail "objcopy -O srec"
236 } else {
96037eb0
NC
237 set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${srecfile}"]
238 if ![regexp "file format srec" $got] then {
239 send_log "objdump failed\n"
240 fail "objcopy -O srec"
241 } else {
242 pass "objcopy -O srec"
243 }
252b5132
RH
244 }
245 }
246 }
252b5132 247
96037eb0
NC
248 close $file
249 }
252b5132
RH
250}
251
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.
256
257set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f $tempfile"]
258if ![regexp "start address (\[0-9a-fA-FxX\]+)" $got all origstart] then {
259 perror "objdump can not recognize bintest.o"
260 set origstart ""
261} else {
627fe3fb 262 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --set-start 0x7654 $tempfile ${copyfile}.srec"]
21c40443 263 if ![string equal "" $got] then {
252b5132
RH
264 fail "objcopy --set-start"
265 } else {
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"
269 } else {
270 if {$srecstart != 0x7654} then {
271 send_log "$srecstart != 0x7654\n"
272 fail "objcopy --set-start"
273 } else {
274 pass "objcopy --set-start"
275 }
276 }
277 }
278
627fe3fb 279 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-start 0x123 $tempfile ${copyfile}.srec"]
21c40443 280 if ![string equal "" $got] then {
252b5132
RH
281 fail "objcopy --adjust-start"
282 } else {
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"
286 } else {
287 if {$srecstart != $origstart + 0x123} then {
288 send_log "$srecstart != $origstart + 0x123\n"
289 fail "objcopy --adjust-start"
290 } else {
291 pass "objcopy --adjust-start"
292 }
293 }
294 }
295}
296
297# Test adjusting the overall VMA, and adjusting the VMA of a
298# particular section. We again only test this when generating S
299# records.
300
301set low ""
302set lowname ""
303
304set headers [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h $tempfile"]
305
306set headers_regexp "\[ 0-9\]+(\[^ \]+)\[ \]*(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+(\[0-9a-fA-F\]+)\[ \]+\[0-9a-fA-F\]+\[ \]+2\[*\]\[*\]\[0-9\]+(.*)"
307
308set got $headers
309while {[regexp $headers_regexp $got all name size vma rest]} {
310 set vma 0x$vma
311 set size 0x$size
312 if {$size != 0} {
313 if {$low == "" || $vma < $low} {
314 set low $vma
315 set lowname $name
316 }
317 }
318 set got $rest
319}
320
321if {$low == "" || $origstart == ""} then {
322 perror "objdump can not recognize bintest.o"
323} else {
627fe3fb 324 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-vma 0x123 $tempfile ${copyfile}.srec"]
21c40443 325 if ![string equal "" $got] then {
252b5132
RH
326 fail "objcopy --adjust-vma"
327 } else {
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"
332 } else {
333 set vma 0x$vma
334 if {$vma != $low + 0x123} then {
335 send_log "$vma != $low + 0x123\n"
336 fail "objcopy --adjust-vma"
337 } else {
338 if {$start != $origstart + 0x123} then {
339 send_log "$start != $origstart + 0x123\n"
340 fail "objcopy --adjust-vma"
341 } else {
342 pass "objcopy --adjust-vma"
343 }
344 }
345 }
346 }
347
348 set arg ""
349 set got $headers
350 while {[regexp $headers_regexp $got all name size vma rest]} {
351 set vma 0x$vma
352 if {$vma == $low} then {
353 set arg "$arg --adjust-section-vma $name+4"
354 }
355 set got $rest
356 }
357
627fe3fb 358 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $arg $tempfile ${copyfile}.srec"]
21c40443 359 if ![string equal "" $got] then {
252b5132
RH
360 fail "objcopy --adjust-section-vma +"
361 } else {
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 +"
366 } else {
367 set vma 0x$vma
368 if {$vma != $low + 4} then {
369 send_log "$vma != $low + 4\n"
370 fail "objcopy --adjust-section-vma +"
371 } else {
372 pass "objcopy --adjust-section-vma +"
373 }
374 }
375 }
376
377 regsub -all "\\+4" $arg "=[expr $low + 4]" argeq
627fe3fb 378 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $argeq $tempfile ${copyfile}.srec"]
21c40443 379 if ![string equal "" $got] then {
252b5132
RH
380 fail "objcopy --adjust-section-vma ="
381 } else {
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 ="
386 } else {
387 set vma 0x$vma
388 if {$vma != $low + 4} then {
389 send_log "$vma != $low + 4\n"
390 fail "objcopy --adjust-section-vma ="
391 } else {
392 pass "objcopy --adjust-section-vma ="
393 }
394 }
395 }
396}
397
398# Test stripping an object.
399
400proc strip_test { } {
1983fbac 401 global AR
252b5132
RH
402 global CC
403 global STRIP
404 global STRIPFLAGS
405 global NM
406 global NMFLAGS
407 global srcdir
408 global subdir
28902555 409 global READELF
252b5132
RH
410
411 set test "strip"
412
413 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
414 untested $test
415 return
416 }
417
28902555
BS
418 set osabi_fail "false"
419 if [is_elf_format] {
420 verbose -log "$READELF -a tmpdir/testprog.o > tmpdir/osabi.in"
421 set exec_output [remote_exec host "$READELF -h tmpdir/testprog.o" "" "/dev/null" "tmpdir/osabi.in"]
422 if { [lindex $exec_output 0] != 0 } then {
21c40443 423 unresolved "$test preserving OS/ABI"
28902555
BS
424 set osabi_fail "true"
425 } else {
426 verbose -log "grep OS/ABI tmpdir/osabi.in"
427 catch "exec grep OS/ABI tmpdir/osabi.in" osabi_in
428 }
429 }
430
252b5132 431 if [is_remote host] {
1983fbac 432 set archive libstrip.a
8d263650 433 set objfile [remote_download host tmpdir/testprog.o]
1983fbac
L
434 remote_file host delete $archive
435 } else {
436 set archive tmpdir/libstrip.a
437 set objfile tmpdir/testprog.o
438 }
439
440 remote_file build delete tmpdir/libstrip.a
441
442 set exec_output [binutils_run $AR "rc $archive ${objfile}"]
21c40443 443 if ![string equal "" $exec_output] {
1983fbac 444 fail $test
21c40443 445 unresolved "$test preserving OS/ABI"
1983fbac
L
446 return
447 }
448
8648f88f 449 set exec_output [binutils_run $STRIP "-g $archive"]
21c40443 450 if ![string equal "" $exec_output] {
8648f88f 451 fail $test
21c40443 452 unresolved "$test preserving OS/ABI"
8648f88f
L
453 return
454 }
455
1983fbac 456 set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
21c40443 457 if ![string equal "" $exec_output] {
1983fbac 458 fail $test
21c40443 459 unresolved "$test preserving OS/ABI"
1983fbac
L
460 return
461 }
462
28902555
BS
463 if { $osabi_fail != "true" && [is_elf_format] } {
464 verbose -log "$READELF -a tmpdir/testprog.o > tmpdir/osabi.out"
465 set exec_output [remote_exec host "$READELF -h tmpdir/testprog.o" "" "/dev/null" "tmpdir/osabi.out"]
466 if { [lindex $exec_output 0] != 0 } then {
21c40443 467 unresolved "$test preserving OS/ABI"
28902555
BS
468 } else {
469 verbose -log "grep OS/ABI tmpdir/osabi.out"
470 catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out
471 if { "$osabi_in" == "$osabi_out" } {
472 pass "$test preserving OS/ABI"
473 } else {
474 fail "$test preserving OS/ABI"
475 }
476 }
477 }
478
1983fbac
L
479 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
480 untested $test
481 return
482 }
483
484 if [is_remote host] {
8d263650 485 set objfile [remote_download host tmpdir/testprog.o]
252b5132
RH
486 } else {
487 set objfile tmpdir/testprog.o
488 }
489
490 set exec_output [binutils_run $STRIP "$STRIPFLAGS $objfile"]
21c40443 491 if ![string equal "" $exec_output] {
252b5132
RH
492 fail $test
493 return
494 }
495
496 set exec_output [binutils_run $NM "-a $NMFLAGS $objfile"]
68a4c073 497 if ![string match "*: no symbols*" $exec_output] {
252b5132
RH
498 fail $test
499 return
500 }
501
502 pass $test
503}
504
505strip_test
506
507# Test stripping an object file with saving a symbol
508
509proc strip_test_with_saving_a_symbol { } {
510 global CC
511 global STRIP
512 global STRIPFLAGS
513 global NM
514 global NMFLAGS
515 global srcdir
516 global subdir
517
518 set test "strip with saving a symbol"
519
520 if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
521 untested $test
522 return
523 }
524
525 if [is_remote host] {
8d263650 526 set objfile [remote_download host tmpdir/testprog.o]
252b5132
RH
527 } else {
528 set objfile tmpdir/testprog.o
529 }
530
531 set exec_output [binutils_run $STRIP "$STRIPFLAGS -K main -K _main $objfile"]
21c40443 532 if ![string equal "" $exec_output] {
252b5132
RH
533 fail $test
534 return
535 }
536
537 set exec_output [binutils_run $NM "$NMFLAGS $objfile"]
195fe636 538 if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
252b5132
RH
539 && ![regexp {^([0-9a-fA-F]+)?[ ]+T _main} $exec_output]} {
540 fail $test
541 return
542 }
543
544 pass $test
545}
546
547strip_test_with_saving_a_symbol
548
549# Build a final executable.
550
99ad8390 551if { [istarget *-*-cygwin] || [istarget *-*-mingw*] } {
f8a7038a
NC
552 set test_prog "testprog.exe"
553} else {
554 set test_prog "testprog"
555}
556
252b5132
RH
557proc copy_setup { } {
558 global srcdir
559 global subdir
9a580d9a 560 global gcc_gas_flag
f8a7038a 561 global test_prog
72d4c02f 562 global host_triplet
21c40443 563
8d263650
BE
564 set res [build_wrapper testglue.o]
565 set flags { debug }
21c40443 566
f1ac0afe 567 if { [istarget *-*-uclinux*] && ![istarget tic6x-*-*] && ![istarget arm*-*-uclinuxfdpiceabi] } {
903b1f5b
NS
568 return 1
569 }
21c40443 570
252b5132 571 if { $res != "" } {
8d263650
BE
572 lappend flags "additional_flags=[lindex $res 1]"
573 set add_libs "testglue.o"
252b5132 574 } else {
8d263650 575 set add_libs ""
252b5132
RH
576 }
577
5940a93c
TS
578 if { [istarget *-*-linux*]
579 || [istarget *-*-gnu*] } {
9a580d9a
L
580 foreach i $gcc_gas_flag {
581 set flags "additional_flags=$i $flags"
582 }
583 }
f8a7038a 584 if { [target_compile "$srcdir/$subdir/testprog.c $add_libs" tmpdir/$test_prog executable $flags] != "" } {
252b5132
RH
585 return 2
586 }
587
8d263650
BE
588 set result [remote_load target tmpdir/$test_prog]
589 set status [lindex $result 0]
252b5132
RH
590
591 if { $status != "pass" } {
72d4c02f 592 send_log "cannot run executable, status = ${status} on ${host_triplet}\n"
21c40443 593 return 3
252b5132
RH
594 }
595
596 return 0
597}
598
599# Test copying an executable.
600
601proc copy_executable { prog flags test1 test2 } {
f8a7038a 602 global test_prog
252b5132
RH
603
604 if [is_remote host] {
8d263650 605 set testfile [remote_download host tmpdir/$test_prog]
252b5132
RH
606 set testcopy copyprog
607 } else {
f8a7038a 608 set testfile tmpdir/$test_prog
252b5132
RH
609 set testcopy tmpdir/copyprog
610 }
8d263650 611 remote_file host delete $testcopy
252b5132
RH
612
613 set exec_output [binutils_run $prog "$flags $testfile $testcopy"]
614
21c40443 615 if ![string equal "" $exec_output] {
252b5132 616 fail $test1
21c40443 617 if [string equal "" $test2] {
0d063f63
AM
618 return
619 }
252b5132
RH
620 fail $test2
621 return
622 }
623
624 if [is_remote host] {
625 remote_upload host $testcopy tmpdir/copyprog
626 }
627
f8a7038a 628 set status [remote_exec build "cmp" "tmpdir/$test_prog tmpdir/copyprog"]
8d263650 629 set exec_output [lindex $status 1]
252b5132 630
21c40443 631 if [string equal "" $exec_output] then {
252b5132
RH
632 pass $test1
633 } else {
634 send_log "$exec_output\n"
635 verbose "$exec_output"
636
637 # This will fail for many reasons. For example, it will most
638 # likely fail if a non-GNU linker is used. Therefore, we do
639 # not insist that it pass. If you are using an assembler and
640 # linker based on the same BFD as objcopy, it is worth
641 # investigating to see why this failure occurs. If we are
642 # cross compiling, we assume that a GNU linker is being used,
643 # and expect it to succeed.
644 if {[isnative]} then {
645 setup_xfail "*-*-*"
646 }
647
9cc0123f 648 # This also fails for some mips targets. See elf32-mips.c
252b5132 649 # mips_elf_sym_is_global.
9cc0123f
AM
650 if { [is_bad_symtab] } then {
651 setup_xfail "*-*-*"
652 }
252b5132 653
11d47adc 654 setup_xfail "arm*-*-pe"
88f14853 655 setup_xfail "*-*-mingw*"
899396fe 656 setup_xfail "*-*-cygwin*"
21c40443 657
252b5132
RH
658 fail $test1
659 }
660
21c40443 661 if [string equal "" $test2] {
0d063f63
AM
662 return
663 }
664
252b5132 665 set output [remote_load target tmpdir/copyprog]
8d263650 666 set status [lindex $output 0]
252b5132
RH
667 if { $status != "pass" } {
668 fail $test2
669 } else {
670 pass $test2
671 }
672}
673
674# Test stripping an executable
675
21c40443 676proc strip_executable { prog flags test1 test2 } {
252b5132
RH
677 global NM
678 global NMFLAGS
28902555 679 global READELF
252b5132 680
0fcc17f8 681 remote_file build delete tmpdir/striprog
252b5132
RH
682 remote_download build tmpdir/copyprog tmpdir/striprog
683 if [is_remote host] {
8d263650 684 set copyfile [remote_download host tmpdir/striprog]
252b5132
RH
685 } else {
686 set copyfile tmpdir/striprog
687 }
688
28902555
BS
689 set osabi_fail "false"
690 if [is_elf_format] {
691 verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.in"
692 set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.in"]
693 if { [lindex $exec_output 0] != 0 } then {
21c40443 694 unresolved "$test1 preserving OS/ABI"
28902555
BS
695 set osabi_fail "true"
696 } else {
697 verbose -log "grep OS/ABI tmpdir/osabi.in"
698 catch "exec grep OS/ABI tmpdir/osabi.in" osabi_in
699 }
700 }
701
252b5132 702 set exec_output [binutils_run $prog "$flags ${copyfile}"]
21c40443
AM
703 if ![string equal "" $exec_output] {
704 fail $test1
705 if [string equal "" $test2] {
706 return
707 }
708 fail $test2
252b5132
RH
709 return
710 }
711
712 if [is_remote host] {
8d263650 713 remote_upload host ${copyfile} tmpdir/striprog
252b5132
RH
714 }
715
28902555
BS
716 if { $osabi_fail != "true" && [is_elf_format] } {
717 verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.out"
718 set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.out"]
719 if { [lindex $exec_output 0] != 0 } then {
21c40443 720 unresolved "$test1 preserving OS/ABI"
28902555
BS
721 } else {
722 verbose -log "grep OS/ABI tmpdir/osabi.out"
723 catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out
724 if { "$osabi_in" == "$osabi_out" } {
21c40443 725 pass "$test1 preserving OS/ABI"
28902555 726 } else {
21c40443 727 fail "$test1 preserving OS/ABI"
28902555
BS
728 }
729 }
730 }
731
252b5132 732 set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
68a4c073 733 if ![string match "*: no symbols*" $exec_output] {
21c40443 734 fail $test1
252b5132
RH
735 return
736 }
21c40443
AM
737
738 if [string equal "" $test2] {
739 return
740 }
741
742 set result [remote_load target tmpdir/striprog]
743 set status [lindex $result 0]
744 if { $status != "pass" } {
745 fail $test2
746 return
747 }
748
749 pass $test2
252b5132
RH
750}
751
752# Test stripping an executable with saving a symbol
753
21c40443 754proc strip_executable_with_saving_a_symbol { prog flags test1 test2 } {
252b5132
RH
755 global NM
756 global NMFLAGS
757
0fcc17f8 758 remote_file build delete tmpdir/striprog
252b5132
RH
759 remote_download build tmpdir/copyprog tmpdir/striprog
760 if [is_remote host] {
8d263650 761 set copyfile [remote_download host tmpdir/striprog]
252b5132
RH
762 } else {
763 set copyfile tmpdir/striprog
764 }
765
766 set exec_output [binutils_run $prog "$flags ${copyfile}"]
21c40443
AM
767 if ![string equal "" $exec_output] {
768 fail $test1
769 if [string equal "" $test2] {
770 return
771 }
772 fail $test2
252b5132
RH
773 return
774 }
775
252b5132 776 set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
edc45ab9
HPN
777 if { [istarget mmix-knuth-mmixware] } {
778 # Whenever there's a symbol in the mmo format, there's the symbol
779 # Main, so remove it manually from the expected output for sake of
780 # this test.
781
782 # Using "" not {} to get the \n and \r translated.
783 regsub "^\[0-9a-fA-F\]+\[ \]+T Main\[\n\r\]+" $exec_output "" exec_output
784 }
785
adacfc81
JJ
786 if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
787 && ![regexp {^([0-9a-fA-F]+)?[ ]+[TD] _main} $exec_output]} {
21c40443 788 fail $test1
252b5132
RH
789 return
790 }
21c40443
AM
791
792 if [string equal "" $test2] {
793 return
794 }
795
796 if [is_remote host] {
797 remote_upload host ${copyfile} tmpdir/striprog
798 }
799
800 set result [remote_load target tmpdir/striprog]
801 set status [lindex $result 0]
802 if { $status != "pass" } {
803 fail $test2
804 return
805 }
806
807 pass $test2
252b5132
RH
808}
809
11701589
JK
810# Test keeping only debug symbols of an executable
811
812proc keep_debug_symbols_and_test_copy { prog1 flags1 test1 prog2 flags2 test2 } {
0fcc17f8 813 remote_file build delete tmpdir/striprog
11701589
JK
814 remote_download build tmpdir/copyprog tmpdir/striprog
815 if [is_remote host] {
816 set copyfile [remote_download host tmpdir/striprog]
817 } else {
818 set copyfile tmpdir/striprog
819 }
820
821 set exec_output [binutils_run $prog1 "$flags1 ${copyfile}"]
21c40443 822 if ![string equal "" $exec_output] {
11701589
JK
823 fail $test1
824 return
825 }
826 pass $test1
827
828 set exec_output [binutils_run $prog2 "$flags2 ${copyfile}"]
21c40443 829 if ![string equal "" $exec_output] {
11701589
JK
830 fail $test2
831 return
832 }
833 pass $test2
834}
835
63b9bbb7 836# Tests that in a debug only copy of a file the sections
de194d85 837# headers whose types have been changed to NOBITS still
63b9bbb7
NC
838# retain their sh_link fields.
839
840proc keep_debug_symbols_and_check_links { prog flags test } {
841 global READELF
842
843 remote_file build delete tmpdir/striprog
844 remote_download build tmpdir/copyprog tmpdir/striprog
845 if [is_remote host] {
846 set copyfile [remote_download host tmpdir/striprog]
847 } else {
848 set copyfile tmpdir/striprog
849 }
850
851 set exec_output [binutils_run $prog "$flags ${copyfile}"]
21c40443 852 if ![string equal "" $exec_output] {
63b9bbb7
NC
853 fail $test
854 return
855 }
856
857 set got [binutils_run $READELF "-S --wide ${copyfile}"]
858
859 set fails 0
860 # Regexp to match a section with NOBITS type and extract its name and sh_link fields
861 while {[regexp \
862 {[^a-zA-Z]+([a-zA-Z0-9_\.]+)[ ]+NOBITS[ ]+[0-9a-fA-F]+ [0-9a-fA-F]+ [0-9a-fA-F]+ [0-9]+[ A]+([0-9]+)(.*)} \
863 $got all name link rest]} {
864 set sh_link 0x$link
865 if {$sh_link == 0} {
866 # Only some NOBITS sections should have a non-zero sh_link field.
867 # Look for them by name.
868 verbose "NOBITS section .$name has a 0 sh_link field\n"
869 switch $name {
870 "rela.*" { set fails 1 ; send_log "Expected non-zero sh_link for .$name\n" }
871 "rel.*" { set fails 1 ; send_log "Expected non-zero sh_link for .$name\n" }
872 "hash" { set fails 1 ; send_log "Expected non-zero sh_link for .$name\n" }
873 "gnu_version" { set fails 1 ; send_log "Expected non-zero sh_link for .$name\n" }
874 "dynsym" { set fails 1 ; send_log "Expected non-zero sh_link for .$name\n" }
875 "gnu.version_r" { set fails 1 ; send_log "Expected non-zero sh_link for .$name\n" }
876 "dynamic" { set fails 1 ; send_log "Expected non-zero sh_link for .$name\n" }
877 "symtab" { set fails 1 ; send_log "Expected non-zero sh_link for .$name\n" }
878 }
879 }
880 set got $rest
881 }
882
883 if {$fails == 0} {
884 pass $test
885 } else {
886 fail $test
887 }
888}
889
890
252b5132 891set test1 "simple objcopy of executable"
21c40443
AM
892set test1r "run objcopy of executable"
893set test2 "strip executable"
894set test2r "run stripped executable"
895set test3 "strip executable with saving a symbol"
896set test3r "run stripped executable with saving a symbol"
897set test4 "keep only debug data"
898set test5 "simple objcopy of debug data"
63b9bbb7 899if [is_elf_format] {
21c40443 900 set test6 "NOBITS sections retain sh_link field"
63b9bbb7 901}
252b5132
RH
902
903switch [copy_setup] {
904 "1" {
905 # do nothing
906 }
907 "2" {
908 untested $test1
21c40443 909 untested $test1r
252b5132 910 untested $test2
21c40443 911 untested $test2r
252b5132 912 untested $test3
21c40443 913 untested $test3r
252b5132 914 untested $test4
11701589 915 untested $test5
63b9bbb7 916 if [is_elf_format] {
21c40443 917 untested $test6
63b9bbb7 918 }
252b5132
RH
919 }
920 "3" {
0d063f63 921 copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" ""
21c40443
AM
922 unsupported $test1r
923 strip_executable "$STRIP" "$STRIPFLAGS" "$test2" ""
924 unsupported $test2r
925 strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test3" ""
926 unsupported $test3r
927 keep_debug_symbols_and_test_copy "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test4" \
928 "$OBJCOPY" "$OBJCOPYFLAGS" "$test5"
63b9bbb7 929 if [is_elf_format] {
21c40443 930 keep_debug_symbols_and_check_links "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test6"
63b9bbb7 931 }
252b5132
RH
932 }
933 "0" {
21c40443
AM
934 copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test1r"
935 strip_executable "$STRIP" "$STRIPFLAGS" "$test2" "$test2r"
936 strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test3" "$test3r"
937 keep_debug_symbols_and_test_copy "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test4" \
938 "$OBJCOPY" "$OBJCOPYFLAGS" "$test5"
63b9bbb7 939 if [is_elf_format] {
21c40443 940 keep_debug_symbols_and_check_links "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test6"
63b9bbb7 941 }
252b5132
RH
942 }
943}
ad2fb2cd 944
6a0d0afd
L
945proc objcopy_test_readelf {testname srcfile} {
946 global OBJCOPY
947 global OBJCOPYFLAGS
948 global READELF
949 global srcdir
950 global subdir
951
952 if {![binutils_assemble $srcdir/$subdir/${srcfile} tmpdir/bintest.o]} then {
953 unresolved "objcopy ($testname)"
954 return
955 }
956
957 verbose -log "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"
7f6a71ff
JM
958 set exec_output [remote_exec host "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"]
959 if { [lindex $exec_output 0] != 0
21c40443 960 || ![string equal "" [lindex $exec_output 1]] } then {
6a0d0afd 961 fail "objcopy ($testname)"
004314cc 962 return
6a0d0afd
L
963 }
964
965 verbose -log "$READELF -a tmpdir/bintest.o > tmpdir/bintest.o.out"
7f6a71ff
JM
966 set exec_output [remote_exec host "$READELF -a tmpdir/bintest.o" "" "/dev/null" "tmpdir/bintest.o.out"]
967 if { [lindex $exec_output 0] != 0 } then {
968 unresolved "objcopy ($testname)"
969 return
970 }
971 set exec_output [prune_warnings [lindex $exec_output 1]]
21c40443 972 if ![string equal "" $exec_output] then {
6a0d0afd
L
973 unresolved "objcopy ($testname)"
974 return
975 }
976
977 verbose -log "$READELF -a tmpdir/copy.o > tmpdir/copy.o.out"
7f6a71ff
JM
978 set exec_output [remote_exec host "$READELF -a tmpdir/copy.o" "" "/dev/null" "tmpdir/copy.o.out"]
979 if { [lindex $exec_output 0] != 0 } then {
980 unresolved "objcopy ($testname)"
981 return
982 }
983 set exec_output [prune_warnings [lindex $exec_output 1]]
21c40443 984 if ![string equal "" $exec_output] then {
6a0d0afd
L
985 unresolved "objcopy ($testname)"
986 return
987 }
988
989 verbose -log "diff tmpdir/bintest.o.out tmpdir/copy.o.out"
990 catch "exec diff tmpdir/bintest.o.out tmpdir/copy.o.out" exec_output
991 set exec_output [prune_warnings $exec_output]
992
21c40443 993 if [string equal "" $exec_output] then {
6a0d0afd
L
994 pass "objcopy ($testname)"
995 } else {
996 fail "objcopy ($testname)"
997 }
998}
999
0b45135e
AB
1000proc objcopy_test_symbol_manipulation {} {
1001 global srcdir
1002 global subdir
1003
1004 set test_list [lsort [glob -nocomplain $srcdir/$subdir/symbols-*.d]]
1005 foreach t $test_list {
1006 # We need to strip the ".d", but can leave the dirname.
1007 verbose [file rootname $t]
1008 run_dump_test [file rootname $t]
1009 }
1010}
1011
b8871f35
L
1012proc objcopy_test_elf_common_symbols {} {
1013 global srcdir
1014 global subdir
1015
1016 # hpux has a non-standard common directive.
1017 if { [istarget "*-*-hpux*"] } then {
1018 return
1019 }
1020
1021 set test_list [lsort [glob -nocomplain $srcdir/$subdir/common-*.d]]
1022 foreach t $test_list {
1023 # We need to strip the ".d", but can leave the dirname.
1024 verbose [file rootname $t]
1025 run_dump_test [file rootname $t]
1026 }
1027}
1028
ad2fb2cd
L
1029# ia64 specific tests
1030if { ([istarget "ia64-*-elf*"]
1031 || [istarget "ia64-*-linux*"]) } {
64bb95af
L
1032 objcopy_test "ia64 link order" link-order.s
1033}
ad2fb2cd 1034
64bb95af 1035# ELF specific tests
506b86a4 1036set elf64 ""
64bb95af 1037if [is_elf_format] {
0b45135e 1038 objcopy_test_symbol_manipulation
b8871f35 1039 objcopy_test_elf_common_symbols
64bb95af 1040 objcopy_test "ELF unknown section type" unknown.s
6a0d0afd 1041 objcopy_test_readelf "ELF group" group.s
eb3980ce 1042 objcopy_test_readelf "ELF group" group-2.s
f206e905 1043 objcopy_test_readelf "ELF group" group-3.s
e1e87d1e 1044 objcopy_test_readelf "ELF group" group-4.s
a91e1603 1045 objcopy_test_readelf "GNU_MBIND section" mbind1.s
b2fc24d4 1046 run_dump_test "group-5"
4c8e8a7e 1047 run_dump_test "group-6"
6e5e9d58
AM
1048 run_dump_test "group-7a"
1049 run_dump_test "group-7b"
1050 run_dump_test "group-7c"
85d7f0b9 1051 run_dump_test "copy-1"
0930eddd 1052 run_dump_test "note-1"
506b86a4 1053 # Use bintest.o from the note-1 test to determine ELF32 or ELF64
9ef920e9 1054 if [is_elf64 tmpdir/bintest.o] {
506b86a4 1055 set elf64 "--defsym ELF64=1"
9ef920e9 1056 run_dump_test "note-2-64"
714da62f 1057 run_dump_test "note-3-64"
6f156d7a 1058 run_dump_test "note-4-64"
9ef920e9
NC
1059 } else {
1060 run_dump_test "note-2-32"
714da62f 1061 run_dump_test "note-3-32"
6f156d7a 1062 run_dump_test "note-4-32"
9ef920e9 1063 }
0df8ad28 1064 run_dump_test "note-5"
ad2fb2cd 1065}
af3c5dea 1066
af3c5dea 1067run_dump_test "copy-2"
81fc501a 1068run_dump_test "copy-3"
0691f7af 1069run_dump_test "copy-4"
506b86a4
AM
1070# Use bintest.o from the copy-4 test to determine ELF reloc type
1071set reloc_format rel
1072if { [is_elf_format] && [is_rela tmpdir/bintest.o] } {
1073 set reloc_format rela
1074}
cbd44e24
L
1075run_dump_test "pr19020a"
1076run_dump_test "pr19020b"
d58c2e3a
RS
1077
1078if [is_elf_format] {
748fc5e9
L
1079 run_dump_test "strip-1"
1080 run_dump_test "strip-2"
1aa9ef63 1081 run_dump_test "strip-3"
eb3980ce
L
1082 run_dump_test "strip-4"
1083 run_dump_test "strip-5"
f206e905
L
1084 run_dump_test "strip-6"
1085 run_dump_test "strip-7"
e1e87d1e
L
1086 run_dump_test "strip-8"
1087 run_dump_test "strip-9"
d4ac1f87 1088 run_dump_test "strip-12"
2f8ceb38
MR
1089
1090 if { [istarget "mips64*-*-openbsd*"] } {
1091 set reloc_format mips64
2f8ceb38 1092 }
506b86a4
AM
1093 # A relocation type not supported by any target
1094 set reloc 215
1095 run_dump_test "strip-13" [list \
1096 [list source strip-13${reloc_format}.s] \
1097 [list as "${elf64} --defsym RELOC=${reloc}"]]
3f97ba9f
MR
1098 # Select a relocation number that corresponds to one actually
1099 # supported by the target and ABI being tested.
1100 if { [istarget "aarch64*-*"] } {
1101 set reloc 259
1102 } elseif { [istarget "ia64*-*"] \
1103 || [istarget "m32r*-*"] \
d4ae1932 1104 || [istarget "nds32*-*"] \
3f97ba9f
MR
1105 || [istarget "v850*-*"] } {
1106 set reloc 50
d4ae1932
AM
1107 } elseif { [istarget "pru-*"] } {
1108 set reloc 11
3f97ba9f
MR
1109 } else {
1110 set reloc 1
1111 }
1112 run_dump_test "strip-14" [list \
506b86a4
AM
1113 [list source strip-14${reloc_format}.s] \
1114 [list as "${elf64} --defsym RELOC=${reloc}"]]
d52e3d06 1115 run_dump_test "strip-15" [list \
506b86a4
AM
1116 [list source strip-15${reloc_format}.s] \
1117 [list as "${elf64} --defsym RELOC=${reloc}"]]
f3185997 1118
a43942db
MR
1119 # This requires STB_GNU_UNIQUE support with OSABI set to GNU.
1120 if { [supports_gnu_unique] } {
4cd28456
AM
1121 run_dump_test "strip-10"
1122 }
211dc24b 1123 run_dump_test "strip-11"
312aaa3c 1124
b8b6abe0
AM
1125 if { [istarget "i*86-*"] || [istarget "x86_64-*-*"] } {
1126 # Check to make sure we don't strip a symbol named in relocations.
1127 set test "objcopy keeps symbols needed by relocs"
312aaa3c 1128
b8b6abe0 1129 set srcfile $srcdir/$subdir/needed-by-reloc.s
312aaa3c 1130
b8b6abe0
AM
1131 if {![binutils_assemble $srcfile tmpdir/bintest.o]} then {
1132 unresolved $test
1133 } else {
1134 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-symbol=foo tmpdir/bintest.o ${copyfile}.o"]
312aaa3c 1135
b8b6abe0
AM
1136 if [regexp "not stripping symbol `foo' because it is named in a relocation" $got] {
1137 pass $test
1138 } else {
1139 fail $test
1140 }
1141 }
312aaa3c 1142 }
b8b6abe0 1143
8560e02a
HPN
1144 # The symbol table for some MIPS targets is sorted differently than
1145 # the ELF canonical order, so the regexps in localize-hidden-1.d fail
9cc0123f
AM
1146 # to match.
1147 if { [is_bad_symtab] } then {
1148 setup_xfail "*-*-*"
8560e02a 1149 }
b8b6abe0 1150 run_dump_test "localize-hidden-1"
afeb3d7f
L
1151 run_dump_test "testranges"
1152 run_dump_test "testranges-ia64"
500ee42e
ILT
1153
1154 run_dump_test "add-section"
2b35fb28 1155 run_dump_test "add-symbol"
500ee42e 1156 run_dump_test "add-empty-section"
18ae9cc1
L
1157
1158 run_dump_test "exclude-1a"
1159 run_dump_test "exclude-1b"
e511c9b1
AB
1160
1161 run_dump_test "only-section-01"
1162 run_dump_test "remove-section-01"
d3e5f6c8
AB
1163
1164 # Test the remove relocation functionality
1165 set test_list [lsort [glob -nocomplain $srcdir/$subdir/remove-relocs-*.d]]
1166 foreach t $test_list {
1167 # We need to strip the ".d", but can leave the dirname.
1168 verbose [file rootname $t]
1169 run_dump_test [file rootname $t]
1170 }
312aaa3c 1171}
b8b6abe0 1172run_dump_test "localize-hidden-2"
14f2c699
L
1173
1174# Test objcopying an object file without global symbol
1175
1176proc objcopy_test_without_global_symbol { } {
1177 global OBJCOPY
1178 global OBJCOPYFLAGS
1179 global OBJDUMP
1180 global OBJDUMPFLAGS
1181 global srcdir
1182 global subdir
1183
1184 set test "strip without global symbol "
1185
1186 if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object debug] != "" } {
1187 untested $test
1188 return
1189 }
1190
1191 if [is_remote host] {
1192 set objfile [remote_download host tmpdir/pr19547.o]
1193 } else {
1194 set objfile tmpdir/pr19547.o
1195 }
1196
1197 set exec_output [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-unneeded $objfile"]
1198 if ![string equal "" $exec_output] {
1199 fail $test
1200 return
1201 }
1202
1203 set exec_output [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t $objfile"]
1204 if {![regexp "no symbols" $exec_output]} {
1205 fail $test
1206 return
1207 }
1208
1209 pass $test
1210}
1211
41699fa4
NC
1212# The AArch64 and ARM targets preserve mapping symbols
1213# in object files, so they will fail this test.
1214setup_xfail aarch64*-*-* arm*-*-*
1215
14f2c699 1216objcopy_test_without_global_symbol
This page took 0.800765 seconds and 4 git commands to generate.