Test for misaligned sections, and fail if we find one
authorIan Lynagh <igloo@earth.li>
Mon, 7 May 2012 14:18:57 +0000 (15:18 +0100)
committerIan Lynagh <igloo@earth.li>
Mon, 7 May 2012 14:18:57 +0000 (15:18 +0100)
rts/Linker.c

index 2899ee1..62096e6 100644 (file)
@@ -3628,6 +3628,10 @@ ocGetNames_PEi386 ( ObjectCode* oc )
       }
 
       if (kind != SECTIONKIND_OTHER && end >= start) {
+          if ((((size_t)(start)) % (size_t)sizeof(void *)) != 0) {
+              barf("Misaligned section: %p", start);
+          }
+
          addSection(oc, kind, start, end);
          addProddableBlock(oc, start, end - start + 1);
       }