mirror of https://github.com/acidanthera/audk.git
BaseTools: Fixed '-D EDK2_REDUCE_FW_SIZE' build option.
This commit is contained in:
parent
d1bb53b31e
commit
1c0e3d05c1
|
@ -588,6 +588,12 @@ ToolImageEmitPeFile (
|
||||||
SizeOfPeHeaders = SectionHeadersOffset + SectionHeadersSize;
|
SizeOfPeHeaders = SectionHeadersOffset + SectionHeadersSize;
|
||||||
SizeOfHeaders = sizeof (mDosHdr) + SizeOfPeHeaders;
|
SizeOfHeaders = sizeof (mDosHdr) + SizeOfPeHeaders;
|
||||||
AlignedSizeOfHeaders = ALIGN_VALUE (SizeOfHeaders, FileAlignment);
|
AlignedSizeOfHeaders = ALIGN_VALUE (SizeOfHeaders, FileAlignment);
|
||||||
|
//
|
||||||
|
// Necessary adjustment for '-D EDK2_REDUCE_FW_SIZE' build option.
|
||||||
|
//
|
||||||
|
if (AlignedSizeOfHeaders < Image->SegmentInfo.Segments[0].ImageAddress) {
|
||||||
|
AlignedSizeOfHeaders = (uint32_t)Image->SegmentInfo.Segments[0].ImageAddress;
|
||||||
|
}
|
||||||
|
|
||||||
PeOffset = ImageToolBufferAppendReserve (
|
PeOffset = ImageToolBufferAppendReserve (
|
||||||
Buffer,
|
Buffer,
|
||||||
|
@ -623,7 +629,7 @@ ToolImageEmitPeFile (
|
||||||
PeHdr->ImageBase = (EFI_IMAGE_NT_BASE_ADDRESS)Image->HeaderInfo.BaseAddress;
|
PeHdr->ImageBase = (EFI_IMAGE_NT_BASE_ADDRESS)Image->HeaderInfo.BaseAddress;
|
||||||
PeHdr->SectionAlignment = Image->SegmentInfo.SegmentAlignment;
|
PeHdr->SectionAlignment = Image->SegmentInfo.SegmentAlignment;
|
||||||
PeHdr->FileAlignment = FileAlignment;
|
PeHdr->FileAlignment = FileAlignment;
|
||||||
PeHdr->SizeOfImage = ALIGN_VALUE (SizeOfHeaders, PeHdr->SectionAlignment);
|
PeHdr->SizeOfImage = AlignedSizeOfHeaders;
|
||||||
PeHdr->SizeOfHeaders = AlignedSizeOfHeaders;
|
PeHdr->SizeOfHeaders = AlignedSizeOfHeaders;
|
||||||
PeHdr->Subsystem = Image->HeaderInfo.Subsystem;
|
PeHdr->Subsystem = Image->HeaderInfo.Subsystem;
|
||||||
PeHdr->NumberOfRvaAndSizes = EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
|
PeHdr->NumberOfRvaAndSizes = EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES;
|
||||||
|
|
Loading…
Reference in New Issue