-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
| Bugzilla Link | 2724 |
| Resolution | FIXED |
| Resolved on | Apr 24, 2010 07:06 |
| Version | trunk |
| OS | Windows XP |
| Reporter | LLVM Bugzilla Contributor |
| CC | @bcardosolopes,@jayfoad |
Extended Description
Consider this code:
$ cat bf.c
struct {
unsigned char a:4;
unsigned char b:4;
} foo = { 15, 0 };
If I compile it with GCC 4.2.1 built for mips-elf, in both big- and little-endian modes, I get this:
$ objdir-4.2.1-mips/gcc/cc1 -meb -quiet -o - bf.c | grep -A1 ^foo
foo:
.byte 240
$ objdir-4.2.1-mips/gcc/cc1 -mel -quiet -o - bf.c | grep -A1 ^foo
foo:
.byte 15
So in big-endian mode the first field in the structure occupies the most significant bits in the byte; in little-endian mode it occupies the least significant bits.
However, using llvm-gcc (built from svn at revision 55368), I get this:
$ ~/llvm/objdir-gcc-svn-mips/gcc/cc1 -meb -quiet -o - bf.c | grep -A1 ^foo
foo:
.byte 15 # 0xF
$ ~/llvm/objdir-gcc-svn-mips/gcc/cc1 -mel -quiet -o - bf.c | grep -A1 ^foo
foo:
.byte 15 # 0xF
This means that big-endian MIPS code built with llvm-gcc won't interwork with code built with GCC.