summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2005-10-19 20:49:03 +0000
committerH.J. Lu <hjl.tools@gmail.com>2005-10-19 20:49:03 +0000
commit64bb95af3d14f93bd2e199570bd5ce1bae40a4db (patch)
tree4c8773e7f60619debb8e308e72eba88eb2388af9
parent290248614c6058e929e4403124d2cc106d130c83 (diff)
downloadbinutils-gdb-64bb95af3d14f93bd2e199570bd5ce1bae40a4db.tar.gz
binutils/testsuite/
2005-10-19 H.J. Lu <hongjiu.lu@intel.com> PR binutils/1487 * binutils-all/objcopy.exp (objcopy_test): New procedure. Use it to test simple copy, ia64 link order and ELF unknown section type. * binutils-all/unknown.s: New file. ld/testsuite/ 2005-10-19 H.J. Lu <hongjiu.lu@intel.com> PR binutils/1487 * ld-elf/unknown.d: New file.
-rw-r--r--binutils/testsuite/ChangeLog9
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp152
-rw-r--r--binutils/testsuite/binutils-all/unknown.s4
-rw-r--r--ld/testsuite/ChangeLog5
4 files changed, 86 insertions, 84 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index cb93df2a702..5cf8bfa8244 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,5 +1,14 @@
2005-10-19 H.J. Lu <hongjiu.lu@intel.com>
+ PR binutils/1487
+ * binutils-all/objcopy.exp (objcopy_test): New procedure.
+ Use it to test simple copy, ia64 link order and ELF unknown
+ section type.
+
+ * binutils-all/unknown.s: New file.
+
+2005-10-19 H.J. Lu <hongjiu.lu@intel.com>
+
PR binutils/1321
* binutils-all/link-order.s: New.
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index cb4c0c18c2f..87be6893303 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -30,12 +30,6 @@ if ![is_remote host] {
send_user "Version [binutil_version $OBJCOPY]"
-if {![binutils_assemble $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
- perror "unresolved 1"
- unresolved "objcopy (simple copy)"
- return
-}
-
if ![is_remote host] {
set tempfile tmpdir/bintest.o
set copyfile tmpdir/copy
@@ -46,61 +40,79 @@ if ![is_remote host] {
# Test that objcopy does not modify a file when copying it.
-set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile ${copyfile}.o"]
+proc objcopy_test {testname srcfile} {
+ global OBJCOPY
+ global OBJCOPYFLAGS
+ global srcdir
+ global subdir
+ global tempfile
+ global copyfile
-if ![string match "" $got] then {
- fail "objcopy (simple copy)"
-} else {
- send_log "cmp $tempfile ${copyfile}.o\n"
- verbose "cmp $tempfile ${copyfile}.o"
- if [is_remote host] {
- set src1 tmpdir/bintest.o
- set src2 tmpdir/copy.o
- remote_upload host $tempfile $src1
- remote_upload host ${copyfile}.o $src2
- } else {
- set src1 ${tempfile}
- set src2 ${copyfile}.o
+ if {![binutils_assemble $srcdir/$subdir/${srcfile} tmpdir/bintest.o]} then {
+ perror "unresolved $testname"
+ unresolved "objcopy ($testname)"
+ return
}
- set status [remote_exec build cmp "${src1} ${src2}"]
- set exec_output [lindex $status 1]
- set exec_output [prune_warnings $exec_output]
-
- # On some systems the result of objcopy will not be identical.
- # Usually this is just because gas isn't using bfd to write the files
- # in the first place, and may order things a little differently.
- # Those systems should use setup_xfail here.
-
- setup_xfail "h8300-*-rtems*" "h8300-*-coff"
- setup_xfail "h8500-*-rtems*" "h8500-*-coff"
- setup_xfail "hppa*-*-*"
- setup_xfail "i960-*"
- setup_xfail "m68*-*-*coff" "m68*-*-hpux*" "m68*-*-lynxos*"
- setup_xfail "m68*-*-sysv*" "m68*-apple-aux*"
- setup_xfail "m8*-*"
- setup_xfail "or32-*-rtems*" "or32-*-coff"
- setup_xfail "sh-*-coff*" "sh-*-rtems*"
- setup_xfail "tic4x-*-*" "tic80-*-*" "w65-*"
-
- clear_xfail "hppa*64*-*-hpux*" "hppa*-*-linux*" "hppa*-*-lites*"
- clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-rtems*" "*-*-*elf*" "m68*-*-sysv4*"
- if [string match "" $exec_output] then {
- pass "objcopy (simple copy)"
+ set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile ${copyfile}.o"]
+
+ if ![string match "" $got] then {
+ fail "objcopy ($testname)"
} else {
- send_log "$exec_output\n"
- verbose "$exec_output" 1
+ send_log "cmp $tempfile ${copyfile}.o\n"
+ verbose "cmp $tempfile ${copyfile}.o"
+ if [is_remote host] {
+ set src1 tmpdir/bintest.o
+ set src2 tmpdir/copy.o
+ remote_upload host $tempfile $src1
+ remote_upload host ${copyfile}.o $src2
+ } else {
+ set src1 ${tempfile}
+ set src2 ${copyfile}.o
+ }
+ set status [remote_exec build cmp "${src1} ${src2}"]
+ set exec_output [lindex $status 1]
+ set exec_output [prune_warnings $exec_output]
+
+ # On some systems the result of objcopy will not be identical.
+ # Usually this is just because gas isn't using bfd to write the
+ # files in the first place, and may order things a little
+ # differently. Those systems should use setup_xfail here.
+
+ setup_xfail "h8300-*-rtems*" "h8300-*-coff"
+ setup_xfail "h8500-*-rtems*" "h8500-*-coff"
+ setup_xfail "hppa*-*-*"
+ setup_xfail "i960-*"
+ setup_xfail "m68*-*-*coff" "m68*-*-hpux*" "m68*-*-lynxos*"
+ setup_xfail "m68*-*-sysv*" "m68*-apple-aux*"
+ setup_xfail "m8*-*"
+ setup_xfail "or32-*-rtems*" "or32-*-coff"
+ setup_xfail "sh-*-coff*" "sh-*-rtems*"
+ setup_xfail "tic4x-*-*" "tic80-*-*" "w65-*"
+
+ clear_xfail "hppa*64*-*-hpux*" "hppa*-*-linux*" "hppa*-*-lites*"
+ clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-rtems*" "*-*-*elf*"
+ clear_xfail "m68*-*-sysv4*"
+
+ if [string match "" $exec_output] then {
+ pass "objcopy ($testname)"
+ } else {
+ send_log "$exec_output\n"
+ verbose "$exec_output" 1
- # On OSF/1, this succeeds with gas and fails with /bin/as.
- setup_xfail "alpha*-*-osf*"
+ # On OSF/1, this succeeds with gas and fails with /bin/as.
+ setup_xfail "alpha*-*-osf*"
- # This fails for COFF i960-vxworks targets.
- setup_xfail "i960-*-vxworks*"
+ # This fails for COFF i960-vxworks targets.
+ setup_xfail "i960-*-vxworks*"
- fail "objcopy (simple copy)"
+ fail "objcopy ($testname)"
+ }
}
}
+objcopy_test "simple copy" bintest.s
+
# Test generating S records.
# We make the srec filename 8.3 compatible. Note that the header string
@@ -652,38 +664,10 @@ switch [copy_setup] {
# ia64 specific tests
if { ([istarget "ia64-*-elf*"]
|| [istarget "ia64-*-linux*"]) } {
- if {![binutils_assemble $srcdir/$subdir/link-order.s tmpdir/bintest.o]} then {
- perror "unresolved ia64 link order."
- unresolved "objcopy (ia64 link order)"
- } else {
- # Test that objcopy does not modify a file with link order bit
- # when copying it.
-
- set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile ${copyfile}.o"]
-
- if ![string match "" $got] then {
- fail "objcopy (ia64 link order)"
- } else {
- send_log "cmp $tempfile ${copyfile}.o\n"
- verbose "cmp $tempfile ${copyfile}.o"
- if [is_remote host] {
- set src1 tmpdir/bintest.o
- set src2 tmpdir/copy.o
- remote_upload host $tempfile $src1
- remote_upload host ${copyfile}.o $src2
- } else {
- set src1 ${tempfile}
- set src2 ${copyfile}.o
- }
- set status [remote_exec build cmp "${src1} ${src2}"]
- set exec_output [lindex $status 1]
- set exec_output [prune_warnings $exec_output]
+ objcopy_test "ia64 link order" link-order.s
+}
- if [string match "" $exec_output] then {
- pass "objcopy (ia64 link order)"
- } else {
- fail "objcopy (ia64 link order)"
- }
- }
- }
+# ELF specific tests
+if [is_elf_format] {
+ objcopy_test "ELF unknown section type" unknown.s
}
diff --git a/binutils/testsuite/binutils-all/unknown.s b/binutils/testsuite/binutils-all/unknown.s
new file mode 100644
index 00000000000..e1b53c01665
--- /dev/null
+++ b/binutils/testsuite/binutils-all/unknown.s
@@ -0,0 +1,4 @@
+ .section .foo,"a","note"
+ .global _start
+_start:
+ .long 0
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index c39343d1615..5ba4799f92b 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2005-10-19 H.J. Lu <hongjiu.lu@intel.com>
+ PR binutils/1487
+ * ld-elf/unknown.d: New file.
+
+2005-10-19 H.J. Lu <hongjiu.lu@intel.com>
+
* ld-ia64/ia64.exp: Check link order for ld -r.
2005-10-18 Alan Modra <amodra@bigpond.net.au>