From 287c73a07314bf81f3f360bac9d447fd5b729929 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Fri, 1 Jun 2012 01:04:49 +0000 Subject: [PATCH] mipsel-native-endianness [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 Gbp-Pq: Name mipsel-native-endianness.diff --- arch/mips/config.mk | 2 +- arch/mips/cpu/mips32/config.mk | 3 +-- board/dbau1x00/u-boot.lds | 4 ---- board/gth2/u-boot.lds | 4 ---- board/incaip/u-boot.lds | 4 ---- board/pb1x00/u-boot.lds | 4 ---- board/qemu-mips/u-boot.lds | 4 ---- examples/standalone/mips.lds | 4 ---- 8 files changed, 2 insertions(+), 27 deletions(-) diff --git a/arch/mips/config.mk b/arch/mips/config.mk index 6ab8acdb1..77efd2ae6 100644 --- a/arch/mips/config.mk +++ b/arch/mips/config.mk @@ -21,7 +21,7 @@ # MA 02111-1307 USA # -CROSS_COMPILE ?= mips_4KC- +#CROSS_COMPILE ?= mips_4KC- CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T mips.lds diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk index a1cd590a0..4350690cd 100644 --- a/arch/mips/cpu/mips32/config.mk +++ b/arch/mips/cpu/mips32/config.mk @@ -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) diff --git a/board/dbau1x00/u-boot.lds b/board/dbau1x00/u-boot.lds index 4a59cea80..87541849e 100644 --- a/board/dbau1x00/u-boot.lds +++ b/board/dbau1x00/u-boot.lds @@ -21,10 +21,6 @@ * 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 diff --git a/board/gth2/u-boot.lds b/board/gth2/u-boot.lds index 9fc417f3b..a7d8e1f99 100644 --- a/board/gth2/u-boot.lds +++ b/board/gth2/u-boot.lds @@ -21,10 +21,6 @@ * 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 diff --git a/board/incaip/u-boot.lds b/board/incaip/u-boot.lds index 4a59cea80..87541849e 100644 --- a/board/incaip/u-boot.lds +++ b/board/incaip/u-boot.lds @@ -21,10 +21,6 @@ * 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 diff --git a/board/pb1x00/u-boot.lds b/board/pb1x00/u-boot.lds index bd0dee1ef..87541849e 100644 --- a/board/pb1x00/u-boot.lds +++ b/board/pb1x00/u-boot.lds @@ -21,10 +21,6 @@ * 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 diff --git a/board/qemu-mips/u-boot.lds b/board/qemu-mips/u-boot.lds index 9460b2010..df751ac19 100644 --- a/board/qemu-mips/u-boot.lds +++ b/board/qemu-mips/u-boot.lds @@ -21,10 +21,6 @@ * 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 diff --git a/examples/standalone/mips.lds b/examples/standalone/mips.lds index 5f766ed37..164d7d15b 100644 --- a/examples/standalone/mips.lds +++ b/examples/standalone/mips.lds @@ -21,10 +21,6 @@ * MA 02111-1307 USA */ -/* -OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips") -*/ -OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips") OUTPUT_ARCH(mips) SECTIONS { -- 2.30.2