summaryrefslogtreecommitdiff
path: root/extra/libxi/XExtInt-align-classes-n32.diff
blob: dc5cc4db3b0412bd19df30cf1206dd4a055541cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- src/XExtInt.c.orig	2011-06-14 20:46:50.254164713 +0200
+++ src/XExtInt.c	2011-06-14 22:08:38.173047738 +0200
@@ -1419,6 +1419,13 @@
     for (i = 0; i < nclasses; i++)
     {
         int l = 0;
+#ifdef _ABIN32
+        /* On MIPS n32 doubles must be 8 byte aligned, but longs take
+           4 bytes, so next_block could make this structure
+           unaligned. */
+        if(len % 8 != 0)
+          len += 8 - len % 8;
+#endif
         any_wire = (xXIAnyInfo*)ptr_wire;
         switch(any_wire->type)
         {
@@ -1467,6 +1474,14 @@
 
     for (i = 0; i < nclasses; i++)
     {
+#ifdef _ABIN32
+      /* On MIPS n32 doubles must be 8 byte aligned, but longs take
+         4 bytes, so next_block could make this structure
+         unaligned. */
+      if(((size_t) ptr_lib) % 8 != 0)
+        ptr_lib += 8 - ((size_t) ptr_lib) % 8;
+#endif
+
         any_lib = (XIAnyClassInfo*)ptr_lib;
         any_wire = (xXIAnyInfo*)ptr_wire;