Hmm ... actually there *is* code in the Mozilla sources to attempt to
ensure proper alignment, in jsstr.cpp:

#ifdef __SUNPRO_CC
#pragma pack(8)
#else
#pragma pack(push, 8)
#endif

JSString JSString::unitStringTable[]
#ifdef __GNUC__
__attribute__ ((aligned (8)))
#endif
= {
    U(0x00), U(0x01), U(0x02), U(0x03), U(0x04), U(0x05), U(0x06), U(0x07),

However, the compiler does not respect the attribute.

Minimal test case is:

struct JSString
{
  unsigned int mLength;
  static JSString unitStringTable[];
};

#pragma pack(push, 8)
JSString JSString::unitStringTable[] __attribute__ ((aligned (8))) = { 1 };
#pragma pack(pop)

Building this with g++ -S results in:

        .global _ZN8JSString15unitStringTableE
        .data
        .align  2
        .type   _ZN8JSString15unitStringTableE, %object
        .size   _ZN8JSString15unitStringTableE, 4
_ZN8JSString15unitStringTableE:
        .word   1

.align 2 is wrong; this should be .align 3.   Vanilla FSF GCC 4.4.4 gets
this correct, so it does look like a Linaro GCC bug after all.

Interestingly enough, the bug only happens with C++ class static
variables; for "normal" global variables, the alignment attribute is
respected correctly.  Looking into GCC now ...

-- 
firefox fails to build from source with Linaro toolchain
https://bugs.launchpad.net/bugs/604874
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to