mirror of https://github.com/acidanthera/audk.git
Do not update the ImageBase in the PE/COFF header if Adjust is 0.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9341 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
ce422d36a8
commit
2816e216c2
|
@ -572,7 +572,9 @@ PeCoffLoaderRelocateImage (
|
|||
// Use PE32 offset
|
||||
//
|
||||
Adjust = (UINT64)BaseAddress - Hdr.Pe32->OptionalHeader.ImageBase;
|
||||
if (Adjust != 0) {
|
||||
Hdr.Pe32->OptionalHeader.ImageBase = (UINT32)BaseAddress;
|
||||
}
|
||||
|
||||
NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
|
||||
RelocDir = &Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
|
||||
|
@ -581,7 +583,9 @@ PeCoffLoaderRelocateImage (
|
|||
// Use PE32+ offset
|
||||
//
|
||||
Adjust = (UINT64) BaseAddress - Hdr.Pe32Plus->OptionalHeader.ImageBase;
|
||||
if (Adjust != 0) {
|
||||
Hdr.Pe32Plus->OptionalHeader.ImageBase = (UINT64)BaseAddress;
|
||||
}
|
||||
|
||||
NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
|
||||
RelocDir = &Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
|
||||
|
@ -612,7 +616,9 @@ PeCoffLoaderRelocateImage (
|
|||
} else {
|
||||
Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
|
||||
Adjust = (UINT64) (BaseAddress - Hdr.Te->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->ImageBase);
|
||||
if (Adjust != 0) {
|
||||
Hdr.Te->ImageBase = (UINT64) (BaseAddress - Hdr.Te->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER));
|
||||
}
|
||||
|
||||
//
|
||||
// Find the relocation block
|
||||
|
|
Loading…
Reference in New Issue