diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-01-15 11:13:40 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-01-15 11:13:40 +0000 |
commit | 5b664244561a6d697d1814e7c525cc6013863caf (patch) | |
tree | dfb7e5435cf6ce0431d735368aa2e3d81c1528a9 /Tools/CCode/Source/GenTEImage | |
parent | 591ee27e8495b232e4b68d9df90c4a478a00f991 (diff) | |
download | edk2-platforms-5b664244561a6d697d1814e7c525cc6013863caf.tar.xz |
Correct TeImage file format and Clean up PeiRebase tool to remove unused code and only relocate image.
Move two EFI_DEP_REPLACE_TRUE and DEPEX_STACK_SIZE_INCREMENT macros from MdePkg to EdkModule/DxeMain module, because these two macros are specific implementation, not defined in spec.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2249 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/CCode/Source/GenTEImage')
-rw-r--r-- | Tools/CCode/Source/GenTEImage/GenTEImage.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Tools/CCode/Source/GenTEImage/GenTEImage.c b/Tools/CCode/Source/GenTEImage/GenTEImage.c index 39b83326e2..665498ac2c 100644 --- a/Tools/CCode/Source/GenTEImage/GenTEImage.c +++ b/Tools/CCode/Source/GenTEImage/GenTEImage.c @@ -272,6 +272,7 @@ Returns: //
// Double-check the file to make sure it's what we expect it to be
//
+
if (CheckPE32File (InFileName, InFptr, &MachineType, &SubSystem) != STATUS_SUCCESS) {
goto Finish;
}
@@ -372,7 +373,7 @@ Returns: TEImageHeader.Subsystem = (UINT8) OptionalHeader32.Subsystem;
TEImageHeader.BaseOfCode = OptionalHeader32.BaseOfCode;
- TEImageHeader.ImageBase = (UINT64) (OptionalHeader32.ImageBase + TEImageHeader.StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
+ TEImageHeader.ImageBase = (UINT64) (OptionalHeader32.ImageBase);
if (OptionalHeader32.NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = OptionalHeader32.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = OptionalHeader32.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
@@ -413,7 +414,7 @@ Returns: TEImageHeader.Subsystem = (UINT8) OptionalHeader64.Subsystem;
TEImageHeader.BaseOfCode = OptionalHeader32.BaseOfCode;
- TEImageHeader.ImageBase = (UINT64) (OptionalHeader64.ImageBase + TEImageHeader.StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
+ TEImageHeader.ImageBase = (UINT64) (OptionalHeader64.ImageBase);
if (OptionalHeader64.NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress = OptionalHeader64.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size = OptionalHeader64.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
@@ -620,6 +621,17 @@ Returns: goto Finish;
}
+ //
+ // Check FileAlginment and SectionAlignment match or not
+ // Because TeImage header doesn't record filealginment and sectionalignment info,
+ // TeImage is used for PEIM and PeiCore XIP module.
+ // So, check alignment match before generate TeImage to check.
+ //
+ if (OptionalHdr.SectionAlignment != OptionalHdr.FileAlignment) {
+ Error (NULL, 0, 0, FileName, "Section-Alignment and File-Alignment does not match");
+ goto Finish;
+ }
+
*SubSystem = OptionalHdr.Subsystem;
if (mOptions.Verbose) {
fprintf (stdout, " Got subsystem = 0x%X from image\n", (int) *SubSystem);
|