[U-Boot] [PATCH] [mips] add $(ENDIANNESS) option when link hello_world example

Shinya Kuribayashi skuribay at pobox.com
Tue Jul 27 00:00:34 CEST 2010


On 7/27/10 12:06 AM, Xiangfu Liu wrote:
> what about split this patch to two:
> one is all *.lds files,
> the other one is for the argument,

Sounds good.

> I have one question here. if we decete the board cpu by
> CONFIG_CPU_LITTLE_ENDIAN.
> why we need check the toolchina again.

The answer is described right above:

+# We explicitly add the endianness specifier if needed, this allows
+# to compile kernels with a toolchain for the other endianness. We
+# carefully avoid to add it redundantly because gcc 3.3/3.4 complains
+# when fed the toolchain default!
+#
+# Certain gcc versions upto gcc 4.1.1 (probably 4.2-subversion as of
+# 2006-10-10 don't properly change the predefined symbols if -EB / -EL
+# are used, so we kludge that here.  A bug has been filed at
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29413.

This part is copied from Linux/MIPS kernel, and has been working
with the wide range of GCC versions for years.

> the original U-Boot is detect -EL/-EB by toolchain name. maybe the
> CONFIG_CPU_LITTLE_ENDIAN option is better.

True.  CONFIG_CPU_LITTLE_ENDIAN (and CONFIG_CPU_BIG_ENDIAN) configs
are also derived from Linux/MIPS kernel, and IMO they're right steps
toward cross-endian build support.  U-Boot, however, tends to think
it less important, so don't hold your breath about this  approach to
be accepted.  Cross-endian build is common practice for MIPS people,
but might be uncommon for other architectures.

Note that CONFIG_CPU_LITTLE_ENDIAN works not only for cross-endian
builds, but also toolchain default endian builds with non-ELDK tools.
If CONFIG_CPU_LITTLE_ENDIAN is not accepted, we have to think an
alternative way.


More information about the U-Boot mailing list