* binutils-all/objcopy.exp (strip_test, strip_executable):

On ELF targets, test that OS/ABI is preserved.
	(copy_setup): Do test on tic6x-*-uclinux.
This commit is contained in:
Bernd Schmidt 2011-06-30 21:41:05 +00:00
parent dc076558e2
commit 28902555d0
2 changed files with 70 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2011-06-30 Bernd Schmidt <bernds@codesourcery.com>
* binutils-all/objcopy.exp (strip_test, strip_executable):
On ELF targets, test that OS/ABI is preserved.
(copy_setup): Do test on tic6x-*-uclinux.
2011-06-19 H.J. Lu <hongjiu.lu@intel.com>
* binutils-all/elfedit-1.d: Updated for x32.

View File

@ -406,6 +406,7 @@ proc strip_test { } {
global NMFLAGS
global srcdir
global subdir
global READELF
set test "strip"
@ -414,6 +415,19 @@ proc strip_test { } {
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] {
set archive libstrip.a
set objfile [remote_download host tmpdir/testprog.o]
@ -428,21 +442,40 @@ proc strip_test { } {
set exec_output [binutils_run $AR "rc $archive ${objfile}"]
if ![string match "" $exec_output] {
fail $test
unresolved "$test preserving OS/ABI"
return
}
set exec_output [binutils_run $STRIP "-g $archive"]
if ![string match "" $exec_output] {
fail $test
unresolved "$test preserving OS/ABI"
return
}
set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
if ![string match "" $exec_output] {
fail $test
unresolved "$test preserving OS/ABI"
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] != "" } {
untested $test
return
@ -531,7 +564,7 @@ proc copy_setup { } {
set res [build_wrapper testglue.o]
set flags { debug }
if { [istarget *-*-uclinux*] } {
if { [istarget *-*-uclinux*] && ![istarget tic6x-*-*] } {
return 1
}
@ -649,6 +682,7 @@ proc copy_executable { prog flags test1 test2 } {
proc strip_executable { prog flags test } {
global NM
global NMFLAGS
global READELF
global host_triplet
remote_file build delete tmpdir/striprog
@ -659,6 +693,19 @@ proc strip_executable { prog flags test } {
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}"]
if ![string match "" $exec_output] {
fail $test
@ -679,6 +726,22 @@ proc strip_executable { prog flags test } {
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}"]
if ![string match "*: no symbols*" $exec_output] {
fail $test