One embodiment of the present invention provides a system that facilitates
loading of an in-place executable file into a virtual machine. The system
operates by loading the in-place executable file into the virtual
machine, where the in-place executable file contains internal pointers
that point to memory locations within the in-place executable file, and a
target memory address that specifies a target location in memory where
the in-place executable file is configured to be loaded. The system then
determines an actual memory address at which the in-place executable file
is actually loaded. If the actual memory address and the target memory
address are different, the system generates an offset value, which is the
difference between the actual memory address and the target memory
address. Finally, the system adjusts each internal pointer within the
in-place executable file by the offset value so that the internal
pointers point to intended locations inside the in-place executable file.