gcc compiled to default to little endian, but is producing some big-endian load/stores. Specific problem was fixed by specifiing "-EL" compiler flag. Assembler code showed: 1fc8: ffa20030 sd v0,48(sp) ... 1fe4: dfa20008 ld v0,8(sp) 1fe8: 0002103e dsrl32 v0,v0,0x0 ... 1ffc: dfa30008 ld v1,8(sp) 2000: 8fa20030 lw v0,52(sp) <- error here, should be 48(sp) 2004: 00431016 dsrlv v0,v1,v0 Release: gcc version 3.2 Environment: x86 host, mips64el-l4-elf-gcc crosscompiler Configured with: ./configure --target=mips64el-l4-elf --enable-64-bit-bfd --enable-languages=c --with-gnu-as --with-gnu-ld : (reconfigured) ./configure --target=mips64el-l4-elf --enable-64-bit-bfd --enable-languages=c --with-gnu-as --with-gnu-ld --prefix=/usr/local/mips : (reconfigured) ./configure --target=mips64el-l4-elf --enable-64-bit-bfd --enable-languages=c --with-gnu-as --with-gnu-ld --prefix=/usr/local/mips : (reconfigured) ./configure --target=mips64el-l4-elf --enable-64-bit-bfd --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --prefix=/usr/local/mips How-To-Repeat: with no optimizations, the extracted code would be equivalent to: word_t = unsigned long int word_t i = 32; printf("x = %x\n", (word_t) vaddr >> 32); printf("x = %x %x\n", (word_t) vaddr >> i, i);
Hello, would it be possible for you to check whether this problem is still present in gcc 3.3? Also, a testcase of pre-processed source would be very much appreciated (makes it possible to reproduce bugs on cross compilers without target headers). Thanks, Dara
See Dara's question.
Eric, sorry to bother you with yet another MIPS bug report. This one looks pretty straightforward though. Any insights? Thanks, Dara
Subject: Re: [mips] GCC 3.2 MIPS64 endian issues > > sorry to bother you with yet another MIPS bug report. This one looks pretty straightforward > though. Any insights? Thanks, I think we should suspend this one pending more info. There's nothing that -EL should do that configuring for mipsel shouldn't. I think we need the more information that was asked (a complete testcase would be nice). -eric
Still waiting for confirmation. Could the original submitter please try to reproduce this with gcc 3.3, and if that fails, send a testcase? Dara (I think waiting is more appropriate than suspended, since that's what this bug's doing right now...)
No feedback in three months. Test case seems to be compiled correctly by CVS head.