BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries
The standalone MM core is executed in place, and resides in a separate execution context which may be space constrained. Since code and data may be mapped with different attributes for security reasons, the PE/COFF binary could have a section alignment of 4 KB. This means that any relocation data is not only useless, but it will also take up 4 KB of valuable space. So add support for the RELOCS_STRIPPED attribute on FFS files of this type, so that we can get rid of the .reloc section altogether. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
@ -68,7 +68,7 @@ class EfiSection (EfiSectionClassObject):
|
|||||||
StringData = FfsInf.__ExtendMacro__(self.StringData)
|
StringData = FfsInf.__ExtendMacro__(self.StringData)
|
||||||
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
|
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
|
||||||
NoStrip = True
|
NoStrip = True
|
||||||
if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM) and SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
|
if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_MM_CORE_STANDALONE) and SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32):
|
||||||
if FfsInf.KeepReloc is not None:
|
if FfsInf.KeepReloc is not None:
|
||||||
NoStrip = FfsInf.KeepReloc
|
NoStrip = FfsInf.KeepReloc
|
||||||
elif FfsInf.KeepRelocFromRule is not None:
|
elif FfsInf.KeepRelocFromRule is not None:
|
||||||
|
@ -2589,7 +2589,7 @@ class FdfParser:
|
|||||||
#
|
#
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _FileCouldHaveRelocFlag (FileType):
|
def _FileCouldHaveRelocFlag (FileType):
|
||||||
if FileType in {SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, 'PEI_DXE_COMBO'}:
|
if FileType in {SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_MM_CORE_STANDALONE, 'PEI_DXE_COMBO'}:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
@ -901,7 +901,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||||||
# @retval string File name of the generated section file
|
# @retval string File name of the generated section file
|
||||||
#
|
#
|
||||||
def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):
|
def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):
|
||||||
if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):
|
if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_MM_CORE_STANDALONE):
|
||||||
if Rule.KeepReloc is not None:
|
if Rule.KeepReloc is not None:
|
||||||
self.KeepRelocFromRule = Rule.KeepReloc
|
self.KeepRelocFromRule = Rule.KeepReloc
|
||||||
SectFiles = []
|
SectFiles = []
|
||||||
|
Reference in New Issue
Block a user