public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries
@ 2019-01-03 12:13 Ard Biesheuvel
  2019-01-03 16:05 ` Carsey, Jaben
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2019-01-03 12:13 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ard Biesheuvel, Bob Feng, Liming Gao, Jagadeesh Ujja

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.
Combined with the FIXED attribute (which enables an optimization
in GenFfs that strips redundant padding) and a TE type binary, this
gets rid of all the needless padding around the standalone MM core
binary.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jagadeesh Ujja <jagadeesh.ujja@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 BaseTools/Source/Python/GenFds/EfiSection.py      | 2 +-
 BaseTools/Source/Python/GenFds/FdfParser.py       | 2 +-
 BaseTools/Source/Python/GenFds/FfsInfStatement.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py
index f8573b5c7d1b..0be176ec8ae1 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 e000228d2f6c..de0b166030e7 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 c1073c96e9aa..d4c61c074963 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 = []
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries
  2019-01-03 12:13 [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries Ard Biesheuvel
@ 2019-01-03 16:05 ` Carsey, Jaben
  2019-01-04  8:43   ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Carsey, Jaben @ 2019-01-03 16:05 UTC (permalink / raw)
  To: Ard Biesheuvel, edk2-devel@lists.01.org; +Cc: Gao, Liming

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Ard Biesheuvel
> Sent: Thursday, January 03, 2019 4:13 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [PATCH] 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.
> Combined with the FIXED attribute (which enables an optimization
> in GenFfs that strips redundant padding) and a TE type binary, this
> gets rid of all the needless padding around the standalone MM core
> binary.
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Jagadeesh Ujja <jagadeesh.ujja@arm.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  BaseTools/Source/Python/GenFds/EfiSection.py      | 2 +-
>  BaseTools/Source/Python/GenFds/FdfParser.py       | 2 +-
>  BaseTools/Source/Python/GenFds/FfsInfStatement.py | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py
> b/BaseTools/Source/Python/GenFds/EfiSection.py
> index f8573b5c7d1b..0be176ec8ae1 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 e000228d2f6c..de0b166030e7 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 c1073c96e9aa..d4c61c074963 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 = []
> --
> 2.17.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries
  2019-01-03 18:28 [PATCH 0/6] implement standalone MM versions of the variable runtime drivers Ard Biesheuvel
@ 2019-01-03 18:28 ` Ard Biesheuvel
  2019-01-04  5:51   ` Feng, Bob C
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2019-01-03 18:28 UTC (permalink / raw)
  To: edk2-devel
  Cc: Ard Biesheuvel, Laszlo Ersek, Leif Lindholm, Michael D Kinney,
	Liming Gao, Jian J Wang, Hao Wu, Jagadeesh Ujja, Achin Gupta,
	Thomas Panakamattam Abraham, Sami Mujawar, Bob Feng

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.
Combined with the FIXED attribute (which enables an optimization
in GenFfs that strips redundant padding) and a TE type binary, this
gets rid of all the needless padding around the standalone MM core
binary.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jagadeesh Ujja <jagadeesh.ujja@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 BaseTools/Source/Python/GenFds/EfiSection.py      | 2 +-
 BaseTools/Source/Python/GenFds/FdfParser.py       | 2 +-
 BaseTools/Source/Python/GenFds/FfsInfStatement.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py
index f8573b5c7d1b..0be176ec8ae1 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 e000228d2f6c..de0b166030e7 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 c1073c96e9aa..d4c61c074963 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 = []
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries
  2019-01-03 18:28 ` [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries Ard Biesheuvel
@ 2019-01-04  5:51   ` Feng, Bob C
  0 siblings, 0 replies; 5+ messages in thread
From: Feng, Bob C @ 2019-01-04  5:51 UTC (permalink / raw)
  To: Ard Biesheuvel, edk2-devel@lists.01.org
  Cc: Laszlo Ersek, Leif Lindholm, Kinney, Michael D, Gao, Liming,
	Wang, Jian J, Wu, Hao A, Jagadeesh Ujja, Achin Gupta,
	Thomas Panakamattam Abraham, Sami Mujawar

Reviewed-by: Bob Feng <bob.c.feng@intel.com> 

-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] 
Sent: Friday, January 4, 2019 2:28 AM
To: edk2-devel@lists.01.org
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Laszlo Ersek <lersek@redhat.com>; Leif Lindholm <leif.lindholm@linaro.org>; Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Jagadeesh Ujja <jagadeesh.ujja@arm.com>; Achin Gupta <Achin.Gupta@arm.com>; Thomas Panakamattam Abraham <thomas.abraham@arm.com>; Sami Mujawar <Sami.Mujawar@arm.com>; Feng, Bob C <bob.c.feng@intel.com>
Subject: [PATCH] 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.
Combined with the FIXED attribute (which enables an optimization in GenFfs that strips redundant padding) and a TE type binary, this gets rid of all the needless padding around the standalone MM core binary.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jagadeesh Ujja <jagadeesh.ujja@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 BaseTools/Source/Python/GenFds/EfiSection.py      | 2 +-
 BaseTools/Source/Python/GenFds/FdfParser.py       | 2 +-
 BaseTools/Source/Python/GenFds/FfsInfStatement.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py
index f8573b5c7d1b..0be176ec8ae1 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 e000228d2f6c..de0b166030e7 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 c1073c96e9aa..d4c61c074963 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 = []
--
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries
  2019-01-03 16:05 ` Carsey, Jaben
@ 2019-01-04  8:43   ` Ard Biesheuvel
  0 siblings, 0 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2019-01-04  8:43 UTC (permalink / raw)
  To: Carsey, Jaben, Feng, Bob C; +Cc: edk2-devel@lists.01.org, Gao, Liming

On Thu, 3 Jan 2019 at 17:05, Carsey, Jaben <jaben.carsey@intel.com> wrote:
>
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
>
>

Thanks all

Pushed as 672601cfcc6f..8ef653aa5aad

> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> > Ard Biesheuvel
> > Sent: Thursday, January 03, 2019 4:13 AM
> > To: edk2-devel@lists.01.org
> > Cc: Gao, Liming <liming.gao@intel.com>
> > Subject: [edk2] [PATCH] 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.
> > Combined with the FIXED attribute (which enables an optimization
> > in GenFfs that strips redundant padding) and a TE type binary, this
> > gets rid of all the needless padding around the standalone MM core
> > binary.
> >
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Cc: Jagadeesh Ujja <jagadeesh.ujja@arm.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> >  BaseTools/Source/Python/GenFds/EfiSection.py      | 2 +-
> >  BaseTools/Source/Python/GenFds/FdfParser.py       | 2 +-
> >  BaseTools/Source/Python/GenFds/FfsInfStatement.py | 2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py
> > b/BaseTools/Source/Python/GenFds/EfiSection.py
> > index f8573b5c7d1b..0be176ec8ae1 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 e000228d2f6c..de0b166030e7 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 c1073c96e9aa..d4c61c074963 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 = []
> > --
> > 2.17.1
> >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-04  8:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-03 12:13 [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries Ard Biesheuvel
2019-01-03 16:05 ` Carsey, Jaben
2019-01-04  8:43   ` Ard Biesheuvel
  -- strict thread matches above, loose matches on Subject: below --
2019-01-03 18:28 [PATCH 0/6] implement standalone MM versions of the variable runtime drivers Ard Biesheuvel
2019-01-03 18:28 ` [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries Ard Biesheuvel
2019-01-04  5:51   ` Feng, Bob C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox