[U-Boot-Users] Re: MIPS LE build problems

Matej Kupljen matej.kupljen at ultra.si
Thu Aug 18 10:42:57 CEST 2005


Hi

> So is there a clever way to "ask" gcc which endianess it's using? 
> I tried to come up with one but failed so far...

I am searching how to do that.
How about if the config.mk runs a little test program, like
configure does?

For example:

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
	unsigned int data = 0x01234567;
	char *ptr = (char *)&data;
	if (ptr[0] == 0x01 && ptr[1] == 0x23 && ptr[2] == 0x45 && ptr[3] == 0x67)
		printf("big\n");
	else if (ptr[3] == 0x01 && ptr[2] == 0x23 && ptr[1] == 0x45 && ptr[0] == 0x67)
		printf("little\n");
	else
		printf("unknown\n");
	return 0;
}

And then check the output of this program and decides to pass the -EL or -EB 
to LDFLAGS.

Oh, do you know why I have to use the:
 -Wa,-allow_branch_to_undefined
instead of:
 -Wa,-mips_allow_branch_to_undefined
even though (I guess) I use the same patch as you do?

And why don't you accept the patch that eliminates this patch to
binutils?

BR,
Matej





More information about the U-Boot mailing list