summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2019-01-03 13:06:17 +0100
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2019-01-04 09:42:17 +0100
commit8ef653aa5aad4ec994f1c0bc16e2fde266b0eb6b (patch)
treeb33227944aaf8b7160d7ab6b48ec54f15aaf7453
parent672601cfcc6f9905dd5fe8cdd7949cfb7f91fed1 (diff)
downloadedk2-8ef653aa5aad4ec994f1c0bc16e2fde266b0eb6b.tar.gz
edk2-8ef653aa5aad4ec994f1c0bc16e2fde266b0eb6b.tar.bz2
edk2-8ef653aa5aad4ec994f1c0bc16e2fde266b0eb6b.zip
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>
-rw-r--r--BaseTools/Source/Python/GenFds/EfiSection.py2
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py2
-rw-r--r--BaseTools/Source/Python/GenFds/FfsInfStatement.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py
index f8573b5c7d..0be176ec8a 100644
--- a/BaseTools/Source/Python/GenFds/EfiSection.py
+++ b/BaseTools/Source/Python/GenFds/EfiSection.py
@@ -68,7 +68,7 @@ class EfiSection (EfiSectionClassObject):
StringData = FfsInf.__ExtendMacro__(self.StringData)
ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')
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:
NoStrip = FfsInf.KeepReloc
elif FfsInf.KeepRelocFromRule is not None:
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index e000228d2f..de0b166030 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -2589,7 +2589,7 @@ class FdfParser:
#
@staticmethod
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
else:
return False
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index c1073c96e9..d4c61c0749 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -901,7 +901,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
# @retval string File name of the generated section file
#
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:
self.KeepRelocFromRule = Rule.KeepReloc
SectFiles = []