endianess in rules.mk for mips

Amker.Cheng amker.cheng at gmail.com
Thu Jul 16 01:31:14 UTC 2009


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?

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?
Please notice if I am wrong, Thanks
>
>>
>> since -EB/-EL are standard GNU ld options rather than target-specific, we
>> should probably add these for everyone rather than doing it for only some
>> targets.
>
> I think it is in common parts on trunk already.
>
>> -mike
>
>
>
>> _______________________________________________
>> uClibc mailing list
>> uClibc at uclibc.org
>> http://lists.busybox.net/mailman/listinfo/uclibc
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc
>



-- 
Best Regards.


More information about the uClibc mailing list