endianess in rules.mk for mips

Mike Frysinger vapier at gentoo.org
Thu Jul 16 03:07:21 UTC 2009


On Wednesday 15 July 2009 21:31:14 Amker.Cheng wrote:
> On Wed, Jul 15, 2009 at 11:57 PM, Khem Raj<raj.khem at gmail.com> wrote:
> > On (15/07/09 10:32), Mike Frysinger wrote:
> >> On Tuesday 14 July 2009 22:35:17 Amker.Cheng wrote:
> >> >     I just found that there mybe something wrong about setting
> >> > endianess in Rules.mk for mips.
> >> > around line Rules.mk:337, there are no codes like:
> >> >
> >> >         CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-Wl,-EL
> >> >         CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-Wl,-EB
> >> >
> >> > So, by default big-endian object files will be generated even I set
> >> > little-endian in make config(for mips).
> >> >
> >> > Is it a bug or I have missed anything?
> >
> > actually they are CPU_LDFLAGS not CPU_CFLAGS
> > ARCH_LITTLE_ENDIAN and ARCH_BIG_ENDIAN should be mutually exclusive
> > and only one of those will be used depending upon what you selected in
> > your config file.
>
> Yes, There are CPU_LDFLAGS like:
> 	CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN)+=-Wl,-EL
> 	CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)+=-Wl,-EB
> But it has nothing to do with compiling, true?
> IMHO, there are two phases for building the lib: first compiling, then
> linking, CPU_LDFLAGS
> sets the endianess for linking phase. without CPU_CFLAGS, the compiler will
> gen object files by default. Is this right?

yes, but -Wl are linking flags, so it doesnt matter if you stick them into 
CPU_CFLAGS

> I noticed the arm part, it uses :
> 	CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN)+=-Wl,-EL
> 	CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)+=-Wl,-EB
> 	CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian
> 	CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian
> should mips act like this either?

-m{little,big}-endian flags are not common gcc options.  you have to find the 
ones for mips (assuming there are any at all).  mips gcc-4.1 doesnt respect 
those flags.  looks like -EL/-EB only works for mips for the opposite endian, 
not all the time

CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN) += $(call check_gcc,-EL,)
CPU_CFLAGS-$(ARCH_BIG_ENDIAN) += $(call check_gcc,-EB,)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20090715/18ede118/attachment-0001.pgp>


More information about the uClibc mailing list