]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 3 Jan 2019 12:06:17 +0000 (13:06 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 4 Jan 2019 08:42:17 +0000 (09:42 +0100)
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>
BaseTools/Source/Python/GenFds/EfiSection.py
BaseTools/Source/Python/GenFds/FdfParser.py
BaseTools/Source/Python/GenFds/FfsInfStatement.py

index f8573b5c7d1b03bfcef1e0843744967055358a69..0be176ec8ae19129511a8053508dcd0030cf663b 100644 (file)
@@ -68,7 +68,7 @@ class EfiSection (EfiSectionClassObject):
             StringData = FfsInf.__ExtendMacro__(self.StringData)\r
             ModuleNameStr = FfsInf.__ExtendMacro__('$(MODULE_NAME)')\r
             NoStrip = True\r
-            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):\r
+            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):\r
                 if FfsInf.KeepReloc is not None:\r
                     NoStrip = FfsInf.KeepReloc\r
                 elif FfsInf.KeepRelocFromRule is not None:\r
index e000228d2f6c6ff091efcce0ddc787bf056f5475..de0b166030e7b7fc99a3c01e944c3051411d35fb 100644 (file)
@@ -2589,7 +2589,7 @@ class FdfParser:
     #\r
     @staticmethod\r
     def _FileCouldHaveRelocFlag (FileType):\r
-        if FileType in {SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, 'PEI_DXE_COMBO'}:\r
+        if FileType in {SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_MM_CORE_STANDALONE, 'PEI_DXE_COMBO'}:\r
             return True\r
         else:\r
             return False\r
index c1073c96e9aa3ac9c524cba1a5864a4a1192cc42..d4c61c0749636a0e1375bd8a2c29c6112ab814e5 100644 (file)
@@ -901,7 +901,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #   @retval string       File name of the generated section file\r
     #\r
     def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, IsMakefile = False):\r
-        if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):\r
+        if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_MM_CORE_STANDALONE):\r
             if Rule.KeepReloc is not None:\r
                 self.KeepRelocFromRule = Rule.KeepReloc\r
         SectFiles = []\r