
Hi Shinya,
2011/3/15 Shinya Kuribayashi skuribay@pobox.com:
On 3/15/11 6:14 AM, daniel.schwierzeck@googlemail.com wrote:
Replace the current MIPSFLAGS code by cc-option macro and use -march=mips32r2 as default optimization level for all Mips32 CPUs. Replace the endianess determination code from toolchain prefix by a more generic one inspired by the Linux arch/mips/Makefile.
[...]
-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) -ENDIANNESS = -EL -else -ENDIANNESS = -EB -endif +# Optimization flags for all Mips32 CPUs +MIPSFLAGS = $(call cc-option,-march=mips32r2,-mips32r2 -Wa,-mips32r2)
-MIPSFLAGS += $(ENDIANNESS) +# Determine endianess from toolchain prefix +ENDIANESS = $(shell $(CC) -dumpmachine | \
- grep -q 'mips.*el-.*'&& echo -EL || echo -EB)
+PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANESS)
-PLATFORM_CPPFLAGS += $(MIPSFLAGS)
This trick can not work with the ELDK toolchain, which also I don't want to think about and be involved in discussion any more. See:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/81572/focus=81735
sorry, I missed that discussion
Users who need to dig into this area should install the ELDK first, build little-endian targets with it by yourself, then find a way to handle endianness appropriately which works for both the ELDK and non-ELDK toolchains.
Or I may miss something. If it's already verified with the ELDK, please let me know, thanks.
The following code works with ELDK (mips_4KC and mips_4KCle) and my non-ELDK BE toolchain.
ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) ENDIANESS = -EL else ifneq (,$(findstring 4KC,$(CROSS_COMPILE))) ENDIANESS = -EB else ENDIANESS = $(shell $(CC) -dumpmachine | \ grep -q 'mips.*el-.*' && echo -EL || echo -EB) endif
Do we need this endianess flag stuff at all? Each toolchain that is built with a specific endinaness does not really need the extra setting of -EB/-EL or am I miss something?
Daniel