From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerry Van Baren Date: Thu, 18 Aug 2005 14:31:25 -0400 Subject: [U-Boot-Users] Re: MIPS LE build problems In-Reply-To: <1124354577.13487.4.camel@localhost.localdomain> References: <20050817080842.36E19353CFF@atlas.denx.de> <1124354577.13487.4.camel@localhost.localdomain> Message-ID: <4304D3FD.7080107@smiths-aerospace.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Matej Kupljen wrote: > 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 > #include > 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 As noted in other email in this thread, executing the above code won't work. What about simply compiling a file containing: constant int data = 0x01234567; objdumping the data section, and looking (grepping) to see if the data section has 0x12345678 or 0x78563412? Speculating ignorantly... gvb