Line 404... |
Line 404... |
global STRIPFLAGS
|
global STRIPFLAGS
|
global NM
|
global NM
|
global NMFLAGS
|
global NMFLAGS
|
global srcdir
|
global srcdir
|
global subdir
|
global subdir
|
|
global READELF
|
|
|
set test "strip"
|
set test "strip"
|
|
|
if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
|
if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
|
untested $test
|
untested $test
|
return
|
return
|
}
|
}
|
|
|
|
set osabi_fail "false"
|
|
if [is_elf_format] {
|
|
verbose -log "$READELF -a tmpdir/testprog.o > tmpdir/osabi.in"
|
|
set exec_output [remote_exec host "$READELF -h tmpdir/testprog.o" "" "/dev/null" "tmpdir/osabi.in"]
|
|
if { [lindex $exec_output 0] != 0 } then {
|
|
unresolved "$test preserving OS/ABI"
|
|
set osabi_fail "true"
|
|
} else {
|
|
verbose -log "grep OS/ABI tmpdir/osabi.in"
|
|
catch "exec grep OS/ABI tmpdir/osabi.in" osabi_in
|
|
}
|
|
}
|
|
|
if [is_remote host] {
|
if [is_remote host] {
|
set archive libstrip.a
|
set archive libstrip.a
|
set objfile [remote_download host tmpdir/testprog.o]
|
set objfile [remote_download host tmpdir/testprog.o]
|
remote_file host delete $archive
|
remote_file host delete $archive
|
} else {
|
} else {
|
Line 426... |
Line 440... |
remote_file build delete tmpdir/libstrip.a
|
remote_file build delete tmpdir/libstrip.a
|
|
|
set exec_output [binutils_run $AR "rc $archive ${objfile}"]
|
set exec_output [binutils_run $AR "rc $archive ${objfile}"]
|
if ![string match "" $exec_output] {
|
if ![string match "" $exec_output] {
|
fail $test
|
fail $test
|
|
unresolved "$test preserving OS/ABI"
|
return
|
return
|
}
|
}
|
|
|
set exec_output [binutils_run $STRIP "-g $archive"]
|
set exec_output [binutils_run $STRIP "-g $archive"]
|
if ![string match "" $exec_output] {
|
if ![string match "" $exec_output] {
|
fail $test
|
fail $test
|
|
unresolved "$test preserving OS/ABI"
|
return
|
return
|
}
|
}
|
|
|
set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
|
set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
|
if ![string match "" $exec_output] {
|
if ![string match "" $exec_output] {
|
fail $test
|
fail $test
|
|
unresolved "$test preserving OS/ABI"
|
return
|
return
|
}
|
}
|
|
|
|
if { $osabi_fail != "true" && [is_elf_format] } {
|
|
verbose -log "$READELF -a tmpdir/testprog.o > tmpdir/osabi.out"
|
|
set exec_output [remote_exec host "$READELF -h tmpdir/testprog.o" "" "/dev/null" "tmpdir/osabi.out"]
|
|
if { [lindex $exec_output 0] != 0 } then {
|
|
unresolved "$test preserving OS/ABI"
|
|
} else {
|
|
verbose -log "grep OS/ABI tmpdir/osabi.out"
|
|
catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out
|
|
if { "$osabi_in" == "$osabi_out" } {
|
|
pass "$test preserving OS/ABI"
|
|
} else {
|
|
fail "$test preserving OS/ABI"
|
|
}
|
|
}
|
|
}
|
|
|
if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
|
if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
|
untested $test
|
untested $test
|
return
|
return
|
}
|
}
|
|
|
Line 529... |
Line 562... |
global host_triplet
|
global host_triplet
|
|
|
set res [build_wrapper testglue.o]
|
set res [build_wrapper testglue.o]
|
set flags { debug }
|
set flags { debug }
|
|
|
if { [istarget *-*-uclinux*] } {
|
if { [istarget *-*-uclinux*] && ![istarget tic6x-*-*] } {
|
return 1
|
return 1
|
}
|
}
|
|
|
if { $res != "" } {
|
if { $res != "" } {
|
lappend flags "additional_flags=[lindex $res 1]"
|
lappend flags "additional_flags=[lindex $res 1]"
|
Line 647... |
Line 680... |
# Test stripping an executable
|
# Test stripping an executable
|
|
|
proc strip_executable { prog flags test } {
|
proc strip_executable { prog flags test } {
|
global NM
|
global NM
|
global NMFLAGS
|
global NMFLAGS
|
|
global READELF
|
global host_triplet
|
global host_triplet
|
|
|
remote_file build delete tmpdir/striprog
|
remote_file build delete tmpdir/striprog
|
remote_download build tmpdir/copyprog tmpdir/striprog
|
remote_download build tmpdir/copyprog tmpdir/striprog
|
if [is_remote host] {
|
if [is_remote host] {
|
set copyfile [remote_download host tmpdir/striprog]
|
set copyfile [remote_download host tmpdir/striprog]
|
} else {
|
} else {
|
set copyfile tmpdir/striprog
|
set copyfile tmpdir/striprog
|
}
|
}
|
|
|
|
set osabi_fail "false"
|
|
if [is_elf_format] {
|
|
verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.in"
|
|
set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.in"]
|
|
if { [lindex $exec_output 0] != 0 } then {
|
|
unresolved "$test preserving OS/ABI"
|
|
set osabi_fail "true"
|
|
} else {
|
|
verbose -log "grep OS/ABI tmpdir/osabi.in"
|
|
catch "exec grep OS/ABI tmpdir/osabi.in" osabi_in
|
|
}
|
|
}
|
|
|
set exec_output [binutils_run $prog "$flags ${copyfile}"]
|
set exec_output [binutils_run $prog "$flags ${copyfile}"]
|
if ![string match "" $exec_output] {
|
if ![string match "" $exec_output] {
|
fail $test
|
fail $test
|
return
|
return
|
}
|
}
|
Line 677... |
Line 724... |
if { $status != "pass" } {
|
if { $status != "pass" } {
|
fail $test
|
fail $test
|
return
|
return
|
}
|
}
|
|
|
|
if { $osabi_fail != "true" && [is_elf_format] } {
|
|
verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.out"
|
|
set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.out"]
|
|
if { [lindex $exec_output 0] != 0 } then {
|
|
unresolved "$test preserving OS/ABI"
|
|
} else {
|
|
verbose -log "grep OS/ABI tmpdir/osabi.out"
|
|
catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out
|
|
if { "$osabi_in" == "$osabi_out" } {
|
|
pass "$test preserving OS/ABI"
|
|
} else {
|
|
fail "$test preserving OS/ABI"
|
|
}
|
|
}
|
|
}
|
|
|
set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
|
set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
|
if ![string match "*: no symbols*" $exec_output] {
|
if ![string match "*: no symbols*" $exec_output] {
|
fail $test
|
fail $test
|
return
|
return
|
}
|
}
|