This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patch] endianness fixes for the ld testsuite
- To: binutils at sources dot redhat dot com
- Subject: Re: [patch] endianness fixes for the ld testsuite
- From: Matt Hiller <hiller at redhat dot com>
- Date: Wed, 28 Feb 2001 17:55:45 -0800 (PST)
This version of the patch fixes the problems in
testsuite/lib/ld-lib.exp that Nick pointed out earlier.
2001-02-28 Matt Hiller <hiller@redhat.com>
* testsuite/ld-scripts/crossref.exp: Initialize flags to
[big_or_little_endian].
* testsuite/ld-undefined/undefined.exp: Ditto, and include $flags
in ld invocations.
* testsuite/lib/ld-lib.exp (big_or_little_endian): Recognize
-EB, -eb, -EL and -el.
(is_endian_output_format): New function.
(default_ld_link): Set flags to [big_or_little_endian] only if
ld is being invoked such that the output format being used is
of known endianness.
(default_ld_simple_link): Ditto.
Index: testsuite/ld-scripts/crossref.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/crossref.exp,v
retrieving revision 1.3
diff -u -r1.3 crossref.exp
--- crossref.exp 2000/10/02 10:18:14 1.3
+++ crossref.exp 2001/03/01 01:49:54
@@ -17,7 +17,7 @@
return
}
-set flags ""
+set flags [big_or_little_endian]
# The a29k compiled code calls V_SPILL and V_FILL. Since we don't
# need to run this code, but we don't have definitions for those
Index: testsuite/ld-undefined/undefined.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-undefined/undefined.exp,v
retrieving revision 1.5
diff -u -r1.5 undefined.exp
--- undefined.exp 2000/08/30 22:01:47 1.5
+++ undefined.exp 2001/03/01 01:49:54
@@ -39,12 +39,14 @@
catch "exec rm -f tmpdir/undefined" exec_output
+set flags [big_or_little_endian]
+
# Using -e start prevents the SunOS linker from trying to build a
# shared library.
-send_log "$ld -e start -o tmpdir/undefined tmpdir/undefined.o\n"
-verbose "$ld -e start -o tmpdir/undefined tmpdir/undefined.o"
+send_log "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o\n"
+verbose "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o"
-catch "exec $ld -e start -o tmpdir/undefined tmpdir/undefined.o" exec_output
+catch "exec $ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o" exec_output
send_log "$exec_output\n"
verbose "$exec_output"
Index: testsuite/lib/ld-lib.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/lib/ld-lib.exp,v
retrieving revision 1.6
diff -u -r1.6 ld-lib.exp
--- ld-lib.exp 2000/06/05 20:43:18 1.6
+++ ld-lib.exp 2001/03/01 01:49:54
@@ -43,6 +43,23 @@
}
}
+# Check to see if ld is being invoked with a non-endian output format
+
+proc is_endian_output_format { object_flags } {
+
+ if {[string match "*-oformat binary*" $object_flags] || \
+ [string match "*-oformat ieee*" $object_flags] || \
+ [string match "*-oformat ihex*" $object_flags] || \
+ [string match "*-oformat netbsd-core*" $object_flags] || \
+ [string match "*-oformat srec*" $object_flags] || \
+ [string match "*-oformat tekhex*" $object_flags] || \
+ [string match "*-oformat trad-core*" $object_flags] } then {
+ return 0
+ } else {
+ return 1
+ }
+}
+
# Look for big-endian or little-endian switches in the multlib
# options and translate these into a -EB or -EL switch. Note
# we cannot rely upon proc process_multilib_options to do this
@@ -59,11 +76,11 @@
foreach x $tmp_flags {
case $x in {
- {*big*endian eb EB} {
+ {*big*endian eb EB -eb -EB} {
set flags " -EB"
return $flags
}
- {*little*endian el EL} {
+ {*little*endian el EL -el -EL} {
set flags " -EL"
return $flags
}
@@ -94,9 +111,12 @@
perror "$ld does not exist"
return 0
}
-
- set flags [big_or_little_endian]
-
+
+ if [is_endian_output_format $objects] then {
+ set flags [big_or_little_endian]
+ } else {
+ set flags ""
+ }
verbose -log "$ld $HOSTING_EMU $flags -o $target $objs $libs"
catch "exec $ld $HOSTING_EMU $flags -o $target $objs $libs" link_output
@@ -122,7 +142,11 @@
return 0
}
- set flags [big_or_little_endian]
+ if [is_endian_output_format $objects] then {
+ set flags [big_or_little_endian]
+ } else {
+ set flags ""
+ }
verbose -log "$ld $flags -o $target $objects"