strip_test_with_saving_a_symbol
+# Test stripping an archive.
+
+proc strip_test_archive { } {
+ global AR
+ global CC
+ global STRIP
+ global srcdir
+ global subdir
+
+ set test "strip -g on archive"
+
+ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
+ untested $test
+ return
+ }
+
+ set stripobjfile tmpdir/striptestprog.o
+ set stripobjarchive testprog.o
+ if [is_remote host] {
+ set archive libstrip.a
+ set objfile [remote_download host tmpdir/testprog.o]
+ remote_file host delete $archive
+ remote_file host delete $stripobjfile
+ remote_file host delete $stripobjarchive
+ } else {
+ set archive tmpdir/libstrip.a
+ set objfile tmpdir/testprog.o
+ remote_file build delete $stripobjfile
+ remote_file build delete $stripobjarchive
+ }
+
+ remote_file build delete tmpdir/libstrip.a
+
+ set exec_output [binutils_run $STRIP "-g -o $stripobjfile $objfile"]
+ set exec_output [prune_warnings $exec_output]
+ if ![string equal "" $exec_output] {
+ fail $test
+ return
+ }
+
+ set exec_output [binutils_run $AR "rc $archive ${objfile}"]
+ set exec_output [prune_warnings $exec_output]
+ if ![string equal "" $exec_output] {
+ fail $test
+ return
+ }
+
+ set exec_output [binutils_run $STRIP "-g $archive"]
+ set exec_output [prune_warnings $exec_output]
+ if ![string equal "" $exec_output] {
+ fail $test
+ return
+ }
+
+ set exec_output [binutils_run $AR "x $archive"]
+ set exec_output [prune_warnings $exec_output]
+ if ![string equal "" $exec_output] {
+ fail $test
+ return
+ }
+
+ if [is_remote host] {
+ set stripobjfile [remote_download host $stripobjfile]
+ set stripobjarchive [remote_download host $stripobjarchive]
+ }
+
+ send_log "cmp $stripobjarchive $stripobjfile\n"
+ verbose "cmp $stripobjarchive $stripobjfile"
+ set status [remote_exec build cmp "$stripobjarchive $stripobjfile"]
+ set exec_output [lindex $status 1]
+ set exec_output [prune_warnings $exec_output]
+
+ if [string equal "" $exec_output] then {
+ pass $test
+ } else {
+ fail $test
+ }
+}
+
+strip_test_archive
+
# Build a final executable.
set exe [exeext]