
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
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.