[webkit-dev] Alignment issues in MIPS

Alex Vazquez alexvazquezfente at gmail.com
Tue Apr 6 00:21:08 PDT 2010

Hello list,

I'm cross-compiling WebKit (revision 40084) for a MIPS board using DirectFB

While executing in the target, libwebkit is causing SIGBUS errors due to
misaligned double data. The errors raise when loading a misaligned double in
the FPU using the ldc1 instruction (it is stated in the MIPS documentation
that data loaded in the FPU must be 8-byte aligned to avoid an address
error). I know that the kernel can be configured to manage misaligned
accesses but i prefer not to mess with that by the moment.

After some debugging, i found out that the offending variable is the
attribute m_nextFireTime in the TimerBase class, which sometimes is not
aligned to an 8-byte boundary. As a test, i tried compiling with
-msoft-float (emulate FPU by software) and checked that the dissassembled
code does not use the FPU but, in that case, webkit does not render
anything. I also tried using the "__attribute__ aligned" directive without
any success.

Finally, i made an ugly patch to avoid the load from an unaligned address
and it worked fine but i don't know if there are other places in the code
whith the same problem.

I have 2 questions:

1) Has anyone found similar alignment problems compiling webkit for MIPS? If
so, how were they fixed?

2) Is there any standard way of forcing alignment of doubles to 8 bytes
boundary through compiler options (i'm using gcc 4.3.2)?


Alejandro Vazquez Fente
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100406/f4039f0e/attachment.html>

More information about the webkit-dev mailing list