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.
This commit is contained in:
Joel Dice 2010-12-09 21:09:48 -07:00
parent 3d49173b0b
commit 2d0ff83653

View File

@ -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<int64_t>(code), &location);
uintptr_t offset = value - code;
if (flat) {
offset |= BootFlatConstant;