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=bob.c.feng@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 31EDA208AE2D0 for ; Thu, 21 Feb 2019 18:51:26 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2019 18:51:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,397,1544515200"; d="scan'208";a="136264198" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 21 Feb 2019 18:51:25 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 21 Feb 2019 18:51:25 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 21 Feb 2019 18:51:24 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.190]) with mapi id 14.03.0415.000; Fri, 22 Feb 2019 10:51:22 +0800 From: "Feng, Bob C" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH V2] BaseTool/GenC: Fix build error when type is BASE or USER_DEFINED. Thread-Index: AQHUyYYVCS/hDGXU0kOJBNoe8AD/VaXrH5wA Date: Fri, 22 Feb 2019 02:51:22 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16008CABD@SHSMSX101.ccr.corp.intel.com> References: <20190221013737.22148-1-jiewen.yao@intel.com> In-Reply-To: <20190221013737.22148-1-jiewen.yao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH V2] 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: Fri, 22 Feb 2019 02:51:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng =20 -----Original Message----- From: Yao, Jiewen=20 Sent: Thursday, February 21, 2019 9:38 AM To: edk2-devel@lists.01.org Cc: Feng, Bob C ; Gao, Liming ;= Zhu, Yonghong Subject: [PATCH V2] BaseTool/GenC: Fix build error when type is BASE or USE= R_DEFINED. https://bugzilla.tianocore.org/show_bug.cgi?id=3D1544 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D V2: (Feedback from Liming) Add filter for 1) below: Only constructor/destructor with BASE type is included here. The constructor/destructor with PEI/DXE/SMM type is still excluded to keep = original behavior. Test: NT32 build and boot successfully. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 1) The GenC tool does not include the constructor/destructor for USER_DEFIN= ED module. It should be included. Only constructor/destructor with BASE type is included here. The constructor/destructor with PEI/DXE/SMM type is still excluded to keep = original behavior. 2) The GenC tool includes the UnloadImage code for BASE module. It should NOT be included. 3) The GenC tool uses EFI_STATUS and ASSERT_EFI_ERROR for BASE type. It should use RETURN_STATUS and ASSERT_RETURN_ERROR. 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. 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 | 56 ++++++++++---------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 9700bf8527..a922464f56 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/DebugLib.= h"], SUP_MODULE_SEC : ["PiPei.h", "Library/DebugLib.h"], SUP_MODULE_PEI_CORE : ["PiPei.h", "Library/DebugLib.h", "Li= brary/PeiCoreEntryPoint.h"], SUP_MODULE_PEIM : ["PiPei.h", "Library/DebugLib.h", "Li= brary/PeimEntryPoint.h"], @@ -782,7 +782,7 @@ gModuleTypeHeaderFile =3D { SUP_MODULE_SMM_CORE : ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiDriverEntryPoint.h"], SUP_MODULE_MM_STANDALONE : ["PiMm.h", "Library/BaseLib.h", "Libr= ary/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"], SUP_MODULE_MM_CORE_STANDALONE : ["PiMm.h", "Library/BaseLib.h", "Libr= ary/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"], - SUP_MODULE_USER_DEFINED : [gBasicHeaderFile] + SUP_MODULE_USER_DEFINED : [gBasicHeaderFile, "Library/DebugLib.= h"] } =20 ## Autogen internal worker macro to define DynamicEx PCD name includes bot= h the TokenSpaceGuidName @@ -1345,16 +1345,17 @@ def CreateLibraryConstruct= orCode(Info, AutoGenC, AutoGenH): if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: ConstructorPrototypeString.Append(gLibraryStructorPrototype[SU= P_MODULE_BASE].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODUL= E_BASE].Replace(Dict)) - elif Lib.ModuleType in SUP_MODULE_SET_PEI: - ConstructorPrototypeString.Append(gLibraryStructorPrototype['P= EI'].Replace(Dict)) - ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Re= place(Dict)) - elif Lib.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER= , SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, - SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI= _DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]: - ConstructorPrototypeString.Append(gLibraryStructorPrototype['D= XE'].Replace(Dict)) - ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Re= place(Dict)) - elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CO= RE_STANDALONE]: - ConstructorPrototypeString.Append(gLibraryStructorPrototype['M= M'].Replace(Dict)) - ConstructorCallingString.Append(gLibraryStructorCall['MM'].Rep= lace(Dict)) + if Info.ModuleType not in [SUP_MODULE_BASE, SUP_MODULE_USER_DEFINE= D]: + if Lib.ModuleType in SUP_MODULE_SET_PEI: + ConstructorPrototypeString.Append(gLibraryStructorPrototyp= e['PEI'].Replace(Dict)) + ConstructorCallingString.Append(gLibraryStructorCall['PEI'= ].Replace(Dict)) + elif Lib.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DR= IVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_= UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]: + ConstructorPrototypeString.Append(gLibraryStructorPrototyp= e['DXE'].Replace(Dict)) + ConstructorCallingString.Append(gLibraryStructorCall['DXE'= ].Replace(Dict)) + elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE, SUP_MODULE_M= M_CORE_STANDALONE]: + ConstructorPrototypeString.Append(gLibraryStructorPrototyp= e['MM'].Replace(Dict)) + =20 + ConstructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dic + t)) =20 if str(ConstructorPrototypeString) =3D=3D '': ConstructorPrototypeList =3D [] @@ -1373,7 +1374,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Auto= GenH): 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_MODULE= _USER_DEFINED]: AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict)) elif Info.ModuleType in SUP_MODULE_SET_PEI: AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) @@ -1407,16 +1408,17 @@ def CreateLibraryDestructorCode(Info, AutoGenC, Aut= oGenH): if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP= _MODULE_BASE].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE= _BASE].Replace(Dict)) - elif Lib.ModuleType in SUP_MODULE_SET_PEI: - DestructorPrototypeString.Append(gLibraryStructorPrototype['PE= I'].Replace(Dict)) - DestructorCallingString.Append(gLibraryStructorCall['PEI'].Rep= lace(Dict)) - elif Lib.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER= , SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, - SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI= _DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]: - DestructorPrototypeString.Append(gLibraryStructorPrototype['DX= E'].Replace(Dict)) - DestructorCallingString.Append(gLibraryStructorCall['DXE'].Rep= lace(Dict)) - elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CO= RE_STANDALONE]: - DestructorPrototypeString.Append(gLibraryStructorPrototype['MM= '].Replace(Dict)) - DestructorCallingString.Append(gLibraryStructorCall['MM'].Repl= ace(Dict)) + if Info.ModuleType not in [SUP_MODULE_BASE, SUP_MODULE_USER_DEFINE= D]: + if Lib.ModuleType in SUP_MODULE_SET_PEI: + DestructorPrototypeString.Append(gLibraryStructorPrototype= ['PEI'].Replace(Dict)) + DestructorCallingString.Append(gLibraryStructorCall['PEI']= .Replace(Dict)) + elif Lib.ModuleType in [SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DR= IVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_= UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]: + DestructorPrototypeString.Append(gLibraryStructorPrototype= ['DXE'].Replace(Dict)) + DestructorCallingString.Append(gLibraryStructorCall['DXE']= .Replace(Dict)) + elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE, SUP_MODULE_M= M_CORE_STANDALONE]: + DestructorPrototypeString.Append(gLibraryStructorPrototype= ['MM'].Replace(Dict)) + =20 + DestructorCallingString.Append(gLibraryStructorCall['MM'].Replace(Dict + )) =20 if str(DestructorPrototypeString) =3D=3D '': DestructorPrototypeList =3D [] @@ -1435,7 +1437,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoG= enH): 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_MODULE= _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 +1535,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): # @param AutoGenH The TemplateString object for header file # def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_= MODULE_SEC]: + if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_= MODULE_BASE, SUP_MODULE_SEC]: return # # Unload Image Handlers -- 2.19.2.windows.1