From: Markos Chandras Date: Mon, 14 Oct 2013 09:52:25 +0000 (+0100) Subject: ext-toolchain: MIPS: Select correct endianness for the target X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f3a2b806dee5e642077ca3fafd67e3b17e09b669;p=buildroot.git ext-toolchain: MIPS: Select correct endianness for the target Previously, an external-toolchain on a mipsel/mips64el target didn't select the appriopriate endianness but it asked the user to set the correct CFLAGS on his/her own. We fix this by appending "-EL" to the toolchain wrapper options if the user has selected a mipsel/mips64el target. [Thomas: remove unneeded test on BR2_ENDIAN, since mipsel and mips64el are always little-endian, and add the corresponding big endian case.] Signed-off-by: Markos Chandras Signed-off-by: Thomas Petazzoni --- diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in index 48b5865103..646f918be2 100644 --- a/toolchain/toolchain-external/Config.in +++ b/toolchain/toolchain-external/Config.in @@ -213,12 +213,10 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201305 - MIPS32 O32 little endian glibc Select a MIPS generic core Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS64 little endian glibc Select a MIPS64 generic core Select the n64 ABI Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS32 big endian soft float glibc Select a MIPS generic core Select BR2_SOFT_FLOAT @@ -229,12 +227,10 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201305 - MIPS32 little endian soft float glibc Select a MIPS generic core Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS64 little endian soft float glibc Select a MIPS64 generic core Select the n64 ABI Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS32 big endian microMIPS glibc Select a MIPS generic core Disable BR2_SOFT_FLOAT @@ -242,7 +238,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201305 - MIPS32 little endian microMIPS glibc Select a MIPS generic core Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL -mips16 + Set BR2_TARGET_OPTIMIZATION to -mips16 - MIPS32 big endian soft float microMIPS glibc Select a MIPS generic core Select BR2_SOFT_FLOAT @@ -250,7 +246,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201305 - MIPS32 little endian soft float microMIPS glibc Select a MIPS generic core Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL -mips16 + Set BR2_TARGET_OPTIMIZATION to -mips16 - MIPS32 big endian uclibc Not usable in Buildroot yet. - MIPS32 little endian uclibc @@ -284,12 +280,10 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201209 - MIPS32 O32 little endian glibc Select a MIPS generic core Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS64 little endian glibc Select a MIPS generic core Select the n64 ABI Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS32 big endian soft float glibc Select a MIPS generic core Select BR2_SOFT_FLOAT @@ -300,12 +294,10 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201209 - MIPS32 little endian soft float glibc Select a MIPS generic core Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS64 little endian soft float glibc Select a MIPS generic core Select the n64 ABI Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS32 big endian microMIPS glibc Select a MIPS generic core Disable BR2_SOFT_FLOAT @@ -313,7 +305,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201209 - MIPS32 little endian microMIPS glibc Select a MIPS generic core Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL -mips16 + Set BR2_TARGET_OPTIMIZATION to -mips16 - MIPS32 big endian soft float microMIPS glibc Select a MIPS generic core Select BR2_SOFT_FLOAT @@ -321,7 +313,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201209 - MIPS32 little endian soft float microMIPS glibc Select a MIPS generic core Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL -mips16 + Set BR2_TARGET_OPTIMIZATION to -mips16 - MIPS32 big endian uclibc Not usable in Buildroot yet. - MIPS32 little endian uclibc @@ -355,12 +347,10 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201203 - MIPS32 O32 little endian glibc Select a MIPS generic core Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS64 little endian glibc Select a MIPS generic core Select the n64 ABI Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS32 big endian soft float glibc Select a MIPS generic core Select BR2_SOFT_FLOAT @@ -371,12 +361,10 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201203 - MIPS32 little endian soft float glibc Select a MIPS generic core Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS64 little endian soft float glibc Select a MIPS generic core Select the n64 ABI Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL - MIPS32 big endian microMIPS glibc Select a MIPS generic core Disable BR2_SOFT_FLOAT @@ -384,7 +372,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201203 - MIPS32 little endian microMIPS glibc Select a MIPS generic core Disable BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL -mips16 + Set BR2_TARGET_OPTIMIZATION to -mips16 - MIPS32 big endian soft float microMIPS glibc Select a MIPS generic core Select BR2_SOFT_FLOAT @@ -392,7 +380,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201203 - MIPS32 little endian soft float microMIPS glibc Select a MIPS generic core Select BR2_SOFT_FLOAT - Set BR2_TARGET_OPTIMIZATION to -EL -mips16 + Set BR2_TARGET_OPTIMIZATION to -mips16 - MIPS32 big endian uclibc Not usable in Buildroot yet. - MIPS32 little endian uclibc diff --git a/toolchain/toolchain-external/ext-toolchain-wrapper.c b/toolchain/toolchain-external/ext-toolchain-wrapper.c index 727e322196..d54f1f5db6 100644 --- a/toolchain/toolchain-external/ext-toolchain-wrapper.c +++ b/toolchain/toolchain-external/ext-toolchain-wrapper.c @@ -63,6 +63,12 @@ static char *predef_args[] = { #ifdef BR_BINFMT_FLAT "-Wl,-elf2flt", #endif +#ifdef BR_MIPS_TARGET_LITTLE_ENDIAN + "-EL", +#endif +#ifdef BR_MIPS_TARGET_BIG_ENDIAN + "-EB", +#endif #ifdef BR_ADDITIONAL_CFLAGS BR_ADDITIONAL_CFLAGS #endif diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index d41cc7cfcb..d658d4f745 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -207,7 +207,14 @@ ifeq ($(BR2_BINFMT_FLAT),y) TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_BINFMT_FLAT endif - +ifeq ($(BR2_mipsel)$(BR2_mips64el),y) +TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_MIPS_TARGET_LITTLE_ENDIAN +TOOLCHAIN_EXTERNAL_CFLAGS += -EL +endif +ifeq ($(BR2_mips)$(BR2_mips64),y) +TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_MIPS_TARGET_BIG_ENDIAN +TOOLCHAIN_EXTERNAL_CFLAGS += -EB +endif ifneq ($(BR2_TARGET_OPTIMIZATION),) TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION)) # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each