summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/GenFw/Elf32Convert.c
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/C/GenFw/Elf32Convert.c')
-rw-r--r--BaseTools/Source/C/GenFw/Elf32Convert.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index e1b92ebd71..4b330a6166 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -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) +