From 2d0ff83653eb4c346048a6a86fe2b7b3fb4e3255 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 9 Dec 2010 21:09:48 -0700 Subject: [PATCH] fix assertion abort when generating boot image In makeCodeImage, we were passing zero to Promise::Listener::resolve, which would lead to an assertion error if the address of the code image was further from the base of the address space (i.e. zero) than could be spanned by a jump on the target architecture. Since, in this context, we immediately overwrite the value stored, we may pass whatever we want to this function (we're only calling it so we can retrieve the location of the value in the image), and the code image pointer is a better choice for the above reason. --- src/bootimage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bootimage.cpp b/src/bootimage.cpp index d19bbf81df..252028dd79 100644 --- a/src/bootimage.cpp +++ b/src/bootimage.cpp @@ -170,7 +170,8 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code, assert(t, value >= code); void* location; - bool flat = addresses->listener->resolve(0, &location); + bool flat = addresses->listener->resolve + (reinterpret_cast(code), &location); uintptr_t offset = value - code; if (flat) { offset |= BootFlatConstant;