From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1981F2119FF32 for ; Thu, 3 Jan 2019 08:05:51 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jan 2019 08:05:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,435,1539673200"; d="scan'208";a="132679787" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga004.fm.intel.com with ESMTP; 03 Jan 2019 08:05:50 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 3 Jan 2019 08:05:49 -0800 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.197]) by fmsmsx111.amr.corp.intel.com ([169.254.12.42]) with mapi id 14.03.0415.000; Thu, 3 Jan 2019 08:05:49 -0800 From: "Carsey, Jaben" To: Ard Biesheuvel , "edk2-devel@lists.01.org" CC: "Gao, Liming" Thread-Topic: [edk2] [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries Thread-Index: AQHUo128F2tH8EnkIkaZnz+jdjeSK6WdtYbQ Date: Thu, 3 Jan 2019 16:05:48 +0000 Message-ID: References: <20190103121315.19416-1-ard.biesheuvel@linaro.org> In-Reply-To: <20190103121315.19416-1-ard.biesheuvel@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjlmMmRiODctNDkyZi00MmU1LWFmN2UtYzA0ZGJmZGI0OTNhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiak9WMEpUSmFTc3VoUHVnajNRYjl2aXcwd2l2NFZIOUtFWEoxSUNLbUgxTlNwQU5VdEcyNTA0WSszb3VRXC93T3EifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.1.200.108] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools/GenFds: permit stripped MM_CORE_STANDALONE binaries X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2019 16:05:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey > -----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 > Subject: [edk2] [PATCH] BaseTools/GenFds: permit stripped > MM_CORE_STANDALONE binaries >=20 > 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. >=20 > This means that any relocation data is not only useless, but it > will also take up 4 KB of valuable space. >=20 > 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. >=20 > Cc: Bob Feng > Cc: Liming Gao > Cc: Jagadeesh Ujja > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > 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(-) >=20 > 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 =3D FfsInf.__ExtendMacro__(self.StringData) > ModuleNameStr =3D FfsInf.__ExtendMacro__('$(MODULE_NAME)') > NoStrip =3D 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 =3D 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 =3D 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 =3D Rule.KeepReloc > SectFiles =3D [] > -- > 2.17.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel