From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 DE797211CAF4A for ; Wed, 20 Feb 2019 06:14:23 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2019 06:14:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,391,1544515200"; d="scan'208";a="145035643" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 20 Feb 2019 06:14:22 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 20 Feb 2019 06:14:22 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.102]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.172]) with mapi id 14.03.0415.000; Wed, 20 Feb 2019 22:14:20 +0800 From: "Gao, Liming" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH] BaseTool/GenC: Fix build error when type is BASE or USER_DEFINED. Thread-Index: AQHUyRMte2PpFxo6QkmZLQOZ8AhGcqXougpw Date: Wed, 20 Feb 2019 14:14:19 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3E2A11@SHSMSX104.ccr.corp.intel.com> References: <20190220115502.12272-1-jiewen.yao@intel.com> In-Reply-To: <20190220115502.12272-1-jiewen.yao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGNlYjY1MmItYTA2Ni00OGEyLWIwYTQtNDQ3MGNmZjBmM2YxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTHlkQkdzMUJvV3pIcG45ZGRXUjRMNHQ1U2FNT2ZxZ3F1SzRXRUh3KzNla2dZSmN0V1pLcXNNUERzejdjVGwzbSJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTool/GenC: Fix build error when type is BASE or USER_DEFINED. 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: Wed, 20 Feb 2019 14:14:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jiewen: This change causes NT32 SecMain build failure. For USER_DEFINED and BASE = type, they only consumes Constructor() from the library instance with BASE = type. They don't use PEIM or DXE type Constructor(), because they have no P= eiService pointer or ImageHandle.=20 Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ji= ewen Yao > Sent: Wednesday, February 20, 2019 7:55 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [edk2] [PATCH] BaseTool/GenC: Fix build error when type is BASE = or USER_DEFINED. >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1544 >=20 > 1) The GenC tool does not include the constructor/destructor for > USER_DEFINED module. It should be included. >=20 > 2) The GenC tool includes the UnloadImage code for BASE module. > It should NOT be included. >=20 > 3) The GenC tool uses EFI_STATUS and ASSERT_EFI_ERROR for BASE type. > It should use RETURN_STATUS and ASSERT_RETURN_ERROR. >=20 > 4) The GenC tool miss DebugLib.h for BASE or USER_DEFINED module > AutoGen.c. Only Base.h is there. It should add Library/DebugLib.h. >=20 > Cc: Bob Feng > Cc: Liming Gao > Cc: Yonghong Zhu > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jiewen Yao > --- > BaseTools/Source/Python/AutoGen/GenC.py | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/P= ython/AutoGen/GenC.py > index 9700bf8527..c4bba8da17 100644 > --- a/BaseTools/Source/Python/AutoGen/GenC.py > +++ b/BaseTools/Source/Python/AutoGen/GenC.py > @@ -684,7 +684,7 @@ ${Function} ( > gLibraryStructorCall =3D { > SUP_MODULE_BASE : TemplateString("""${BEGIN} > Status =3D ${Function} (); > - ASSERT_EFI_ERROR (Status);${END} > + ASSERT_RETURN_ERROR (Status);${END} > """), >=20 > 'PEI' : TemplateString("""${BEGIN} > @@ -714,7 +714,7 @@ ProcessLibrary${Type}List ( > VOID > ) > { > -${BEGIN} EFI_STATUS Status; > +${BEGIN} RETURN_STATUS Status; > ${FunctionCall}${END} > } > """), > @@ -768,7 +768,7 @@ ${FunctionCall}${END} > gBasicHeaderFile =3D "Base.h" >=20 > gModuleTypeHeaderFile =3D { > - SUP_MODULE_BASE : [gBasicHeaderFile], > + SUP_MODULE_BASE : [gBasicHeaderFile, "Library/DebugLi= b.h"], > SUP_MODULE_SEC : ["PiPei.h", "Library/DebugLib.h"], > SUP_MODULE_PEI_CORE : ["PiPei.h", "Library/DebugLib.h", "= Library/PeiCoreEntryPoint.h"], > SUP_MODULE_PEIM : ["PiPei.h", "Library/DebugLib.h", "= Library/PeimEntryPoint.h"], > @@ -782,7 +782,7 @@ gModuleTypeHeaderFile =3D { > SUP_MODULE_SMM_CORE : ["PiDxe.h", "Library/BaseLib.h", "L= ibrary/DebugLib.h", "Library/UefiDriverEntryPoint.h"], > SUP_MODULE_MM_STANDALONE : ["PiMm.h", "Library/BaseLib.h", "Li= brary/DebugLib.h", > "Library/StandaloneMmDriverEntryPoint.h"], > SUP_MODULE_MM_CORE_STANDALONE : ["PiMm.h", "Library/BaseLib.h", "Li= brary/DebugLib.h", > "Library/StandaloneMmCoreEntryPoint.h"], > - SUP_MODULE_USER_DEFINED : [gBasicHeaderFile] > + SUP_MODULE_USER_DEFINED : [gBasicHeaderFile, "Library/DebugLi= b.h"] > } >=20 > ## Autogen internal worker macro to define DynamicEx PCD name includes b= oth the TokenSpaceGuidName > @@ -1373,7 +1373,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Au= toGenH): > if Info.IsLibrary: > AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) > else: > - if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: > + if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODU= LE_USER_DEFINED]: > AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict= )) > elif Info.ModuleType in SUP_MODULE_SET_PEI: > AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) > @@ -1435,7 +1435,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, Aut= oGenH): > if Info.IsLibrary: > AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) > else: > - if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: > + if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODU= LE_USER_DEFINED]: > AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict= )) > elif Info.ModuleType in SUP_MODULE_SET_PEI: > AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) > @@ -1533,7 +1533,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, Auto= GenH): > # @param AutoGenH The TemplateString object for header file > # > def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): > - if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SU= P_MODULE_SEC]: > + if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SU= P_MODULE_BASE, SUP_MODULE_SEC]: > return > # > # Unload Image Handlers > -- > 2.19.2.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel