git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4224
6f19259b-4bc3-4df7-8a09-
765794883524
return Status;\r
}\r
//\r
+ // When Image has no reloc section, it can't be relocated into memory.\r
+ //\r
+ if (ImageContext.RelocationsStripped) {\r
+ DEBUG ((EFI_D_ERROR, "The image at 0x%08x without reloc section can't be loaded into memory", (UINTN) Pe32Data));\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
// Allocate Memory for the image\r
//\r
ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) ImageContext.ImageSize));\r
//\r
if ((!(ImageContext->IsTeImage)) && ((Hdr.Pe32->FileHeader.Characteristics & EFI_IMAGE_FILE_RELOCS_STRIPPED) != 0)) {\r
ImageContext->RelocationsStripped = TRUE;\r
+ } else if ((ImageContext->IsTeImage) && (Hdr.Te->DataDirectory[0].Size == 0) && (Hdr.Te->DataDirectory[0].VirtualAddress == 0)) {\r
+ ImageContext->RelocationsStripped = TRUE;\r
} else {\r
ImageContext->RelocationsStripped = FALSE;\r
}\r