BaseTools/GenFw: align RVA of debug

SVN commit r18077 ("BaseTools/GenFw: move .debug contents to .data to
save space") removed the separate .debug section after moving its
contents into .text or .data. However, this change does not take into
account that some of these contents need to appear at a 32-bit aligned
offset. So align the debug data RVA to 32 bits.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18443 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ard Biesheuvel 2015-09-11 07:07:06 +00:00 committed by abiesheuvel
parent 5abc2a70da
commit 4f7d5c6792
2 changed files with 22 additions and 4 deletions

View File

@ -218,6 +218,15 @@ CoffAlign (
return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1);
}
STATIC
UINT32
DebugRvaAlign (
UINT32 Offset
)
{
return (Offset + 3) & ~3;
}
//
// filter functions
//
@ -365,7 +374,7 @@ ScanSections32 (
assert (FALSE);
}
mDebugOffset = mCoffOffset;
mDebugOffset = DebugRvaAlign(mCoffOffset);
if (mEhdr->e_machine != EM_ARM) {
mCoffOffset = CoffAlign(mCoffOffset);
@ -423,7 +432,7 @@ ScanSections32 (
// section alignment.
//
if (SectionCount > 0) {
mDebugOffset = mCoffOffset;
mDebugOffset = DebugRvaAlign(mCoffOffset);
}
mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) +
sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) +

View File

@ -211,6 +211,15 @@ CoffAlign (
return (Offset + mCoffAlignment - 1) & ~(mCoffAlignment - 1);
}
STATIC
UINT32
DebugRvaAlign (
UINT32 Offset
)
{
return (Offset + 3) & ~3;
}
//
// filter functions
//
@ -359,7 +368,7 @@ ScanSections64 (
assert (FALSE);
}
mDebugOffset = mCoffOffset;
mDebugOffset = DebugRvaAlign(mCoffOffset);
if (mEhdr->e_machine != EM_ARM) {
mCoffOffset = CoffAlign(mCoffOffset);
@ -412,7 +421,7 @@ ScanSections64 (
// section alignment.
//
if (SectionCount > 0) {
mDebugOffset = mCoffOffset;
mDebugOffset = DebugRvaAlign(mCoffOffset);
}
mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) +
sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) +