Building uclibc for big-endian and little-endian target.

Steve Ellcey sellcey at mips.com
Tue Oct 15 17:30:41 UTC 2013


I have a question about endiness and uclibc.  I am trying to build
multiple versions of uclibc for MIPS, including big and little endian
versions.  What I notice is that in Rules.mak there are lines:

CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN) += -Wl,-EL
CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)    += -Wl,-EB

to add -EL or -EB to linker commands (this seems to be generic for all
architectures).

What I do not see is any generic (or MIPS specific) code to add -EL or -EB
to CPU_CFLAGS (or CPU_FLAGS-y to be exact).  I am wondering if there is a
specific reason for this?  Right now the uclibc build seems to assume that
the compiler I am using to build uclibc will always generate the correct
endiness without any flags.  I want to build big and little endian uclibc's
using a single cross compiler that is capable of generating both big and
little endian objects given a -EL or a -EB.

I know I can work around this by adding -EL or -EB to UCLIBC_EXTRA_CFLAGS
when building but I am wondering why Rules.mak doesn't have:

CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN) += -EL
CPU_CFLAGS-$(ARCH_BIG_ENDIAN)    += -EB

If not for all CPU's, at least for MIPS and other bi-endian architectures.

How do other architectures handle building multiple uclibc libraries with
different endiness settings?

Steve Ellcey
sellcey at mips.com




More information about the uClibc mailing list