BaseTools: Check elf sections alignment with MAX_COFF_ALIGNMENT

Add the logic to check whether mCoffAlignment is larger than
MAX_COFF_ALIGNMENT, and report error for it.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yunhua Feng 2018-06-04 16:12:28 +08:00 committed by Yonghong Zhu
parent d69e8a7b79
commit 3f02180031
2 changed files with 19 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/** @file
Elf32 Convert solution
Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
@ -383,6 +383,14 @@ ScanSections32 (
}
}
//
// Check if mCoffAlignment is larger than MAX_COFF_ALIGNMENT
//
if (mCoffAlignment > MAX_COFF_ALIGNMENT) {
Error (NULL, 0, 3000, "Invalid", "Section alignment is larger than MAX_COFF_ALIGNMENT.");
assert (FALSE);
}
//
// Move the PE/COFF header right before the first section. This will help us
// save space when converting to TE.

View File

@ -1,7 +1,7 @@
/** @file
Elf64 convert solution
Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
@ -376,6 +376,15 @@ ScanSections64 (
}
}
//
// Check if mCoffAlignment is larger than MAX_COFF_ALIGNMENT
//
if (mCoffAlignment > MAX_COFF_ALIGNMENT) {
Error (NULL, 0, 3000, "Invalid", "Section alignment is larger than MAX_COFF_ALIGNMENT.");
assert (FALSE);
}
//
// Move the PE/COFF header right before the first section. This will help us
// save space when converting to TE.