From ac63d084505cd14cbb2828a3fd93207d6a7eaf1b Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sun, 4 Mar 2012 11:38:12 -0700 Subject: [PATCH] fix bootimage field offset calculation for derived classes There was a subtle bug in that we were not considering alignment padding for fields defined in superclasses when calculating field offsets for a derived class when the superclass(es) were visited by the bootimage generator before the derived class. --- src/bootimage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bootimage.cpp b/src/bootimage.cpp index 28f45dd382..3d75f4401c 100644 --- a/src/bootimage.cpp +++ b/src/bootimage.cpp @@ -435,6 +435,10 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code, memberFields[memberIndex] = *f; + while (targetMemberOffset % f->targetSize) { + ++ targetMemberOffset; + } + targetMemberOffset += f->targetSize; ++ memberIndex;