[patch] endianness fixes for the ld testsuite

Matt Hiller hiller@redhat.com
Tue Feb 27 14:15:00 GMT 2001


	The following patch fixes problems in the ld testsuite which were
leading the testsuite to invoke ld without necessary endianness flags.

	I do not have write access to this repository; if my changes are
acceptable someone else will have to commit them.

-- 

Matt Hiller
GCC Engineer, Red Hat, Inc., Sunnyvale office
hiller@redhat.com

2001-02-26  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 and -EL.
	(default_ld_link): Set flags to [big_or_little_endian] only if
	-oformat srec isn't in the objects.
	(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 -p -r1.3 crossref.exp
--- testsuite/ld-scripts/crossref.exp	2000/10/02 10:18:14	1.3
+++ testsuite/ld-scripts/crossref.exp	2001/02/27 22:05:27
@@ -17,7 +17,7 @@ if { ![ld_compile $CC "$srcdir/$subdir/c
     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 -p -r1.5 undefined.exp
--- testsuite/ld-undefined/undefined.exp	2000/08/30 22:01:47	1.5
+++ testsuite/ld-undefined/undefined.exp	2001/02/27 22:05:27
@@ -39,12 +39,14 @@ if ![ld_compile "$CC -g" $srcdir/$subdir
 
 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 -p -r1.6 ld-lib.exp
--- testsuite/lib/ld-lib.exp	2000/06/05 20:43:18	1.6
+++ testsuite/lib/ld-lib.exp	2001/02/27 22:05:27
@@ -59,11 +59,11 @@ proc big_or_little_endian {} {
 
 	foreach x $tmp_flags {
 	    case $x in {
-		{*big*endian eb EB} {
+		{*big*endian eb EB -EB} {
 		    set flags " -EB"
 		    return $flags
 		}
-		{*little*endian el EL} {
+		{*little*endian el EL -EL} {
 		    set flags " -EL"
 		    return $flags
 		}
@@ -94,9 +94,12 @@ proc default_ld_link { ld target objects
 	perror "$ld does not exist"
 	return 0
     }
-    
-    set flags [big_or_little_endian]
-    
+
+    if [string match "*-oformat srec*" $objects] then {
+	set flags ""
+    } else {
+	set flags [big_or_little_endian]
+    }
     verbose -log "$ld $HOSTING_EMU $flags -o $target $objs $libs"
     
     catch "exec $ld $HOSTING_EMU $flags -o $target $objs $libs" link_output
@@ -122,7 +125,11 @@ proc default_ld_simple_link { ld target 
 	return 0
     }
     
-    set flags [big_or_little_endian]
+    if [string match "*-oformat srec*" $objects] then {
+	set flags ""
+    } else {
+	set flags [big_or_little_endian]
+    }
     
     verbose -log "$ld $flags -o $target $objects"
     



More information about the Binutils mailing list