From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 0D66F940F1A for ; Sun, 25 Feb 2024 03:32:26 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=+RKnrvc9nViZpx7Hw9oWrRVIn6FkIMFwwiHP7FVT9ZY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Thread-Index:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding:Content-Language; s=20140610; t=1708831945; v=1; b=CIHrVEWsTMe9L0XZiose3zB2m0IZS/vl8hRzQYt69uc2jiypVxoxuPA/yr9bREAYcoZQKP7W Lz0s/zg9VZTiMgaOGv1+Q+BAxLDcr7ZOoMpNBTWYfyHwJGoSlkQE/ohUTo7eRaHUpSZ/Q89Tfa7 ekfWWR5oDyCJEJ3TVPdAT6uU= X-Received: by 127.0.0.2 with SMTP id clA6YY7687511xEqvfpXHIWQ; Sat, 24 Feb 2024 19:32:25 -0800 X-Received: from cxsh.intel-email.com (cxsh.intel-email.com [121.46.250.151]) by mx.groups.io with SMTP id smtpd.web11.33665.1708831943691221778 for ; Sat, 24 Feb 2024 19:32:24 -0800 X-Received: from cxsh.intel-email.com (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id CD421DDA78A for ; Sun, 25 Feb 2024 11:32:21 +0800 (CST) X-Received: from localhost (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id C6689DDA784 for ; Sun, 25 Feb 2024 11:32:21 +0800 (CST) X-Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by cxsh.intel-email.com (Postfix) with SMTP id DC5D1DDA78B for ; Sun, 25 Feb 2024 11:32:18 +0800 (CST) X-Received: from DESKTOPS6D0PVI ([114.93.194.54]) (envelope-sender ) by 192.168.6.13 with ESMTP(SSL) for ; Sun, 25 Feb 2024 11:32:12 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 114.93.194.54 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming via groups.io" To: "'Laszlo Ersek'" , "'edk2-devel-groups-io'" Cc: "'Bob Feng'" , "'Michael D Kinney'" , "'Rebecca Cran'" , "'Yuwei Chen'" References: <5e147cee-9fed-a1c8-7358-1162fdaf8f12@redhat.com> <20240224210504.41873-1-lersek@redhat.com> In-Reply-To: <20240224210504.41873-1-lersek@redhat.com> Subject: =?UTF-8?B?W2VkazItZGV2ZWxdIOWbnuWkjTogW1BBVENIXSBCYXNlVG9vbHMvQXV0b0dlbjogZGVjbGFyZSBQcm9jZXNzTGlicmFyeUNvbnN0cnVjdG9yTGlzdCgpIGZvciBTRUMgbW9kdWxlcw==?= Date: Sun, 25 Feb 2024 11:32:12 +0800 Message-ID: <011301da679b$38a2b4f0$a9e81ed0$@byosoft.com.cn> MIME-Version: 1.0 Thread-Index: AQJi4MjGOSAJM/ZLvn7KDne0frrKtgH9yTMDr/mGORA= Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,gaoliming@byosoft.com.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: aeXR6EA6oQZ3nKhmjrxHW6m5x7686176AA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=CIHrVEWs; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Laszlo: Thanks for your work to make sure this issue be fixed. I agree this chang= e. Reviewed-by: Liming Gao Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: Laszlo Ersek > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2024=E5=B9=B42=E6=9C=8825=E6=97=A5 = 5:05 > =E6=94=B6=E4=BB=B6=E4=BA=BA: edk2-devel-groups-io > =E6=8A=84=E9=80=81: Bob Feng ; Liming Gao > ; Michael D Kinney > ; Rebecca Cran ; Yuwei > Chen > =E4=B8=BB=E9=A2=98: [PATCH] BaseTools/AutoGen: declare ProcessLibraryCons= tructorList() > for SEC modules >=20 > Most module types have standardized entry point function prototypes. They > are declared in headers like >=20 > - MdePkg/Include/Library/PeiCoreEntryPoint.h > - MdePkg/Include/Library/PeimEntryPoint.h > - MdePkg/Include/Library/DxeCoreEntryPoint.h > - MdePkg/Include/Library/UefiDriverEntryPoint.h > - MdePkg/Include/Library/UefiApplicationEntryPoint.h >=20 > These header files also declare matching ProcessLibraryConstructorList() > prototypes. >=20 > The SEC module type does not have a standardized entry point prototype > (aka parameter list), therefore no header file like the above ones exists > for SEC. Consequently, no header file *declares* > ProcessLibraryConstructorList() for SEC modules, even though AutoGen > always *defines* ProcessLibraryConstructorList() with the same, empty, > parameter list (i.e., just (VOID)). >=20 > The lack of a central declaration is a problem because in SEC code, > ProcessLibraryConstructorList() needs to be called manually, and those > calls need a prototype. Most SEC modules in edk2 get around this by > declaring ProcessLibraryConstructorList() manually, while some others use > an incorrect (PEIM) prototype. >=20 > Liming suggested in > that AutoGen > provide the declaration as well; implement that in this patch. >=20 > Mike suggested that the feature be gated with INF_VERSION, for > compatibility reasons. (INF_VERSION >=3D 1.30) reflects that the latest > (draft) version of the INF specification, as of this writing, is commit > a31e3c842bee / version 1.29. >=20 > For example, if we modify "OvmfPkg/Sec/SecMain.inf" as follows: >=20 > > diff --git a/OvmfPkg/Sec/SecMain.inf b/OvmfPkg/Sec/SecMain.inf > > index 3c47a664a95d..dca932a474ee 100644 > > --- a/OvmfPkg/Sec/SecMain.inf > > +++ b/OvmfPkg/Sec/SecMain.inf > > @@ -8,7 +8,7 @@ > > ## > > > > [Defines] > > - INF_VERSION =3D 0x00010005 > > + INF_VERSION =3D 1.30 > > BASE_NAME =3D SecMain > > FILE_GUID =3D > df1ccef6-f301-4a63-9661-fc6030dcc880 > > MODULE_TYPE =3D SEC >=20 > then the patch produces the following difference in > "Build/OvmfX64/NOOPT_GCC5/X64/OvmfPkg/Sec/SecMain/DEBUG/AutoGe > n.h": >=20 > > --- AutoGen.h.orig 2024-02-06 23:10:23.469535345 +0100 > > +++ AutoGen.h 2024-02-07 00:00:57.361294055 +0100 > > @@ -220,6 +220,13 @@ > > > > // Definition of PCDs used in libraries is in AutoGen.c > > > > +// ProcessLibraryConstructorList() declared here because SEC has no > standard entry point. > > +VOID > > +EFIAPI > > +ProcessLibraryConstructorList ( > > + VOID > > + ); > > + > > > > #ifdef __cplusplus > > } >=20 > which presently (as of edk2 commit edc6681206c1) triggers the following > build error: >=20 > > In file included from OvmfPkg/Sec/SecMain.c:14: > > MdePkg/Include/Library/PeimEntryPoint.h:74:1: error: conflicting types = for > > =E2=80=98ProcessLibraryConstructorList=E2=80=99; have =E2=80=98void(voi= d *, const > > EFI_PEI_SERVICES **)=E2=80=99 {aka =E2=80=98void(void *, const struct _= EFI_PEI_SERVICES > > **)=E2=80=99} > > 74 | ProcessLibraryConstructorList ( > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > In file included from : > > > Build/OvmfX64/NOOPT_GCC5/X64/OvmfPkg/Sec/SecMain/DEBUG/AutoGen. > h:226:1: note: > > previous declaration of =E2=80=98ProcessLibraryConstructorList=E2=80=99= with type > > =E2=80=98void(void)=E2=80=99 > > 226 | ProcessLibraryConstructorList ( > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > That's a genuine bug in OvmfPkg that needs to be fixed, but we keep > compatibility with existent SEC modules until/unless they upgrade > INF_VERSION to 1.30+. >=20 > Cc: Bob Feng > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Rebecca Cran > Cc: Yuwei Chen > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D991 > Suggested-by: Liming Gao > Suggested-by: Michael D Kinney > Signed-off-by: Laszlo Ersek > --- >=20 > Notes: > v2: >=20 > - CI run: >=20 > - port to edk2-basetools: > >=20 > - depend on INF_VERSION >=3D 1.30 [Mike] >=20 > - extend commit message with INF_VERSION dependency >=20 > - extend commit message with example build error due to preexistent > broken ProcessLibraryConstructorList() declaration in OvmfPkg, now > caught by the auto-generated prototype >=20 > BaseTools/Source/Python/AutoGen/GenC.py | 8 ++++++++ > 1 file changed, 8 insertions(+) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenC.py > b/BaseTools/Source/Python/AutoGen/GenC.py > index a2053d548521..5ad10cee2898 100755 > --- a/BaseTools/Source/Python/AutoGen/GenC.py > +++ b/BaseTools/Source/Python/AutoGen/GenC.py > @@ -1371,6 +1371,14 @@ def CreateLibraryConstructorCode(Info, > AutoGenC, AutoGenH): > else: > if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, > SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]: >=20 > AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict)) > + if Info.ModuleType =3D=3D SUP_MODULE_SEC and > Info.AutoGenVersion >=3D 0x0001001E: > + AutoGenH.Append(("\n" > + "// ProcessLibraryConstructorList() > declared here because SEC has no standard entry point.\n" > + "VOID\n" > + "EFIAPI\n" > + "ProcessLibraryConstructorList (\n" > + " VOID\n" > + " );\n")) > elif Info.ModuleType in SUP_MODULE_SET_PEI: > AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) > elif Info.ModuleType in [SUP_MODULE_DXE_CORE, > SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, > SUP_MODULE_DXE_RUNTIME_DRIVER, >=20 > base-commit: edc6681206c1a8791981a2f911d2fb8b3d2f5768 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115920): https://edk2.groups.io/g/devel/message/115920 Mute This Topic: https://groups.io/mt/104558376/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-