mipsel-native-endianness
authorClint Adams <clint@debian.org>
Fri, 1 Jun 2012 01:04:49 +0000 (01:04 +0000)
committerClint Adams <clint@debian.org>
Fri, 1 Jun 2012 01:04:49 +0000 (01:04 +0000)
[MIPS] Fix little-endian build with non-ELDK toolchains

We've been in trouble for a long time when cross compiling with non-ELDK
toolchains.  This is caused by -EB passed to CPPFLAGS incorrectly, by the
lack of an endian specifier to LDFLAGS, and by wrong OUTPUT_FORMATs.

We're going to implement two workarounds.  One is the endianness specifier
bugfix not to pass -EB / -EL to CPPFLAGS unless ELDK toolchain is used.
Note that ELDK and non-ELDK toolchains know their default endianness, so
the endianness specifier may not be necessary in principle.

The other is removal of OUTPUT_FORMAT in *.lds files.  If we have this,
it doesn't work unless an endianness specifier is added to LDFLAGS.  As
we haven't added that to LDFLAGS so far, it must have not worked properly,
except ELDK; I don't know why and how ELDK works, though.

With these two changes, all objects will be generated and linked in the
toolchain's default endianness.  Then MAKEALL mips_el will work even with
non-ELDK toolchain.

Note that Linux/MIPS kernel has CONFIG_CPU_BIG_ENDIAN and
CONFIG_CPU_LITTLE_ENDIAN alternatives to allow users to compile kernels
with a toolchain for the other endianness. But U-Boot does not have such
feature for now, and it's another story.

Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
Gbp-Pq: Name mipsel-native-endianness.diff

arch/mips/config.mk
arch/mips/cpu/mips32/config.mk
board/dbau1x00/u-boot.lds
board/gth2/u-boot.lds
board/incaip/u-boot.lds
board/pb1x00/u-boot.lds
board/qemu-mips/u-boot.lds
examples/standalone/mips.lds

index 6ab8acdb17b4cef1affce9760f6329b0c83b6cd5..77efd2ae6aefa80f880e063bf4ca5c28ec3caecd 100644 (file)
@@ -21,7 +21,7 @@
 # MA 02111-1307 USA
 #
 
-CROSS_COMPILE ?= mips_4KC-
+#CROSS_COMPILE ?= mips_4KC-
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T mips.lds
 
index a1cd590a00414c5f368af190103882440fbdd971..4350690cd0ffdfca6af0aadde040c3b0469fdbbd 100644 (file)
@@ -45,5 +45,4 @@ endif
 # Default to EB if no endianess is configured
 ENDIANNESS ?= -EB
 
-PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANNESS)
-PLATFORM_LDFLAGS += $(ENDIANNESS)
+PLATFORM_CPPFLAGS += $(MIPSFLAGS)
index 4a59cea80f86aa0b7d1de31e28b7bf1cefd2939d..87541849ee05d0bb9b276cb0b5b63bf52e3d9201 100644 (file)
  * MA 02111-1307 USA
  */
 
-/*
-OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
-*/
-OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")
 OUTPUT_ARCH(mips)
 ENTRY(_start)
 SECTIONS
index 9fc417f3bca4994268541d729617779713f249e4..a7d8e1f9916742291625e8e178eb0281ce577e96 100644 (file)
  * MA 02111-1307 USA
  */
 
-/*
-OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
-*/
-OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")
 OUTPUT_ARCH(mips)
 ENTRY(_start)
 SECTIONS
index 4a59cea80f86aa0b7d1de31e28b7bf1cefd2939d..87541849ee05d0bb9b276cb0b5b63bf52e3d9201 100644 (file)
  * MA 02111-1307 USA
  */
 
-/*
-OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
-*/
-OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")
 OUTPUT_ARCH(mips)
 ENTRY(_start)
 SECTIONS
index bd0dee1efb9a8798d749332478fb6bb1ef49bcaa..87541849ee05d0bb9b276cb0b5b63bf52e3d9201 100644 (file)
  * MA 02111-1307 USA
  */
 
-/*
-OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
-*/
-OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips", "elf32-tradlittlemips")
 OUTPUT_ARCH(mips)
 ENTRY(_start)
 SECTIONS
index 9460b2010cc6f5643a336220bd42c9df3ac19f03..df751ac19e0e4d1390926d583e48cbf34f64a623 100644 (file)
  * MA 02111-1307 USA
  */
 
-/*
-OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
-*/
-OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")
 OUTPUT_ARCH(mips)
 ENTRY(_start)
 SECTIONS
index 5f766ed37815c0d841de4ba216389d72f0a3f047..164d7d15ba5088af01a413b3cd46670a216d1add 100644 (file)
  * MA 02111-1307 USA
  */
 
-/*
-OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
-*/
-OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips")
 OUTPUT_ARCH(mips)
 SECTIONS
 {