This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Set little endian flag when linking SH arch tests for little endian multilibs


Nick Clifton wrote:
  I am applying the small patch below to make the SH specific linker
  tests set the appropriate endian flag when linking the arch tests.
  Without this, testing little endian SH multilibs was producing lots
  of unexpected failures and untested tests because the linker and
  assembler disagreed about endianness.

As it happens I was just in the process of preparing that exact same patch (right down to the character - spooky).


I also had an issue with default_ld_assemble in lib/ld-lib.exp. It tries to apply linker endian flags to the assembler. I have attached the patch I was using. Did you not see this issue?

There is also an issue because not all SH architectures have a little endian variant, and therefore not all instructions and relocations are implemented in both endians.

Andrew Stubbs
Index: src/ld/testsuite/lib/ld-lib.exp
===================================================================
--- src.orig/ld/testsuite/lib/ld-lib.exp	2006-07-05 12:28:54.000000000 +0100
+++ src/ld/testsuite/lib/ld-lib.exp	2006-07-05 14:24:10.000000000 +0100
@@ -276,6 +276,10 @@ proc default_ld_assemble { as source obj
     if ![info exists ASFLAGS] { set ASFLAGS "" }
 
     set flags [big_or_little_endian]
+    if {[istarget sh*-*-*] || [istarget pj*-*-*]} {
+	regsub -- {-EB} $flags {-big} flags
+	regsub -- {-EL} $flags {-little} flags
+    }
 
     verbose -log "$as $flags $ASFLAGS -o $object $source"
 
Index: src/ld/testsuite/ld-sh/arch/arch.exp
===================================================================
--- src.orig/ld/testsuite/ld-sh/arch/arch.exp	2005-05-12 08:32:08.000000000 +0100
+++ src/ld/testsuite/ld-sh/arch/arch.exp	2006-07-05 16:25:05.000000000 +0100
@@ -76,9 +76,11 @@ proc test_arch { file1 file2 arch result
     set name2 [file tail $file2]
     set rootname2 [file rootname $name2]
 
+    set flags [big_or_little_endian]
+
     # This must use -r to prevent LD trying to relocate the (unrealistic) file
-    send_log "$LD -r -o ${rootname1}_${rootname2}.o $file1 $file2\n"
-    catch "exec $LD -r -o ${rootname1}_${rootname2}.o $file1 $file2" ld_output
+    send_log "$LD $flags -r -o ${rootname1}_${rootname2}.o $file1 $file2\n"
+    catch "exec $LD $flags -r -o ${rootname1}_${rootname2}.o $file1 $file2" ld_output
     send_log $ld_output
 
     if {[string equal $ld_output ""] == 1} then {
@@ -117,9 +119,11 @@ proc test_arch_error { file1 file2 resul
     set name2 [file tail $file2]
     set rootname2 [file rootname $name2]
 
+    set flags [big_or_little_endian]
+
     # This must use -r to prevent LD trying to relocate the (unrealistic) file
-    send_log "$LD -r -o ${rootname1}_${rootname2}.o $file1 $file2\n"
-    catch "exec $LD -r -o ${rootname1}_${rootname2}.o $file1 $file2" ld_output
+    send_log "$LD $flags -r -o ${rootname1}_${rootname2}.o $file1 $file2\n"
+    catch "exec $LD $flags -r -o ${rootname1}_${rootname2}.o $file1 $file2" ld_output
     send_log $ld_output
 
     if {[string equal $ld_output ""] == 1} then {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]