summaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorBernd Schmidt <bernd.schmidt@analog.com>2011-06-30 21:41:04 +0000
committerBernd Schmidt <bernd.schmidt@analog.com>2011-06-30 21:41:04 +0000
commit242cef18d0bb8eae0295a7c8773c74af06d5f390 (patch)
tree2e7b157418d6be2d65065fb2804b31da0aff6160 /binutils
parent0b483a971d88ca2886de9759b51053abdecbd2e8 (diff)
downloadbinutils-redhat-242cef18d0bb8eae0295a7c8773c74af06d5f390.tar.gz
* binutils-all/objcopy.exp (strip_test, strip_executable):
On ELF targets, test that OS/ABI is preserved. (copy_setup): Do test on tic6x-*-uclinux.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/testsuite/ChangeLog6
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp65
2 files changed, 70 insertions, 1 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index d19d1b0f6e..7eb03615cb 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -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.
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index cf3535d2b9..7ad8497128 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -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