summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2007-10-26 09:28:29 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2007-10-26 09:28:29 +0000
commit9626a87e43394aa49a6d077d161428646b84dec3 (patch)
tree7fea6d09346f687cb2bdcdd30f4d0446eb1c1f2c /MdeModulePkg
parenta72eca845920cc079dc81057085f64e16f1f19c8 (diff)
downloadedk2-platforms-9626a87e43394aa49a6d077d161428646b84dec3.tar.xz
Add one judge whether TeImage or PeImage has reloc section when relocate TeImage or PeImage into memory.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4224 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Pei/Image/Image.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c
index c9805f5311..c38fa56705 100644
--- a/MdeModulePkg/Core/Pei/Image/Image.c
+++ b/MdeModulePkg/Core/Pei/Image/Image.c
@@ -238,6 +238,13 @@ Returns:
return Status;
}
//
+ // When Image has no reloc section, it can't be relocated into memory.
+ //
+ if (ImageContext.RelocationsStripped) {
+ DEBUG ((EFI_D_ERROR, "The image at 0x%08x without reloc section can't be loaded into memory", (UINTN) Pe32Data));
+ return EFI_INVALID_PARAMETER;
+ }
+ //
// Allocate Memory for the image
//
ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) ImageContext.ImageSize));