
On 05/03/2018 01:36 AM, Ivan Gorinov wrote:
Instead of difference between preferred and actual image base, the actual base is added to the fields specified in the .reloc section.
Use ImageBase from PE optional header to compute the delta, exit early if the image is loaded at the preferred address.
Signed-off-by: Ivan Gorinov ivan.gorinov@intel.com
The PE spec has this sentence: "To apply a base relocation, the difference is calculated between the preferred base address and the base where the image is actually loaded."
The spec further defines ImageBase as "The preferred address of the first byte of image when loaded into memory."
EDK2 also calculates the relocations offset as: BaseAddress - OptionalHeader.ImageBase in MdePkg/Library/BasePeCoffLib/BasePeCoff.c and in DuetPkg/EfiLdr/PeLoader.c
Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de