From: "Laszlo Ersek" <lersek@redhat.com>
To: Ard Biesheuvel <ardb+git@google.com>, devel@edk2.groups.io
Cc: kraxel@redhat.com, gaoliming@byosoft.com.cn,
Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [edk2-devel] [PATCH] OvmfPkg/Sec: Use correct prototype of ProcessLibraryConstructorList()
Date: Mon, 5 Feb 2024 01:44:20 +0100 [thread overview]
Message-ID: <1278eb3e-9194-1f39-db24-87cef500f042@redhat.com> (raw)
In-Reply-To: <20240202182455.1535328-1-ardb+git@google.com>
Hello Ard,
On 2/2/24 19:24, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
>
> The prototype of ProcessLibraryConstructorList(), which is generated by
> the build tools, depends on the boot phase, and SEC and PEI differ in
> this regard. However, OVMF's SEC implemention includes PeimEntryPoint.h
> and calls the PEI version of the protoype (passing NULL arguments),
> whereas the actual implementation observed by the compiler follows the
> SEC version, which takes VOID.
>
> The compiler usually doesn't spot the difference, but the LTO linker
> does, and throws an error:
>
> MdePkg/Include/Library/PeimEntryPoint.h:74:1: error: type of 'ProcessLibraryConstructorList' does not match original declaration [-Werror=lto-type-mismatch]
> 74 | ProcessLibraryConstructorList (
> | ^
> Build/OvmfX64/RELEASE_GCC5/X64/OvmfPkg/Sec/SecMain/DEBUG/AutoGen.c:310:1: note: type mismatch in parameter 1
> 310 | ProcessLibraryConstructorList (
> | ^
> Build/OvmfX64/RELEASE_GCC5/X64/OvmfPkg/Sec/SecMain/DEBUG/AutoGen.c:310:1: note: type 'void' should match type 'void *'
> Build/OvmfX64/RELEASE_GCC5/X64/OvmfPkg/Sec/SecMain/DEBUG/AutoGen.c:310:1: note: 'ProcessLibraryConstructorList' was previously declared here
>
> Fix this by dropping the #include, and providing a declaration of
> ProcessLibraryConstructorList() in SecMain.c
>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4643
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> OvmfPkg/Sec/SecMain.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
This issue was reported 5+ years ago:
https://bugzilla.tianocore.org/show_bug.cgi?id=990
I asked for a general solution in BaseTools:
https://bugzilla.tianocore.org/show_bug.cgi?id=991
Liming recommended that BaseTools should generate a proper declaration
in "AutoGen.h":
https://bugzilla.tianocore.org/show_bug.cgi?id=991#c2
But nothing happened.
>
> diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
> index 31da5d0ace51..7b7d4793984c 100644
> --- a/OvmfPkg/Sec/SecMain.c
> +++ b/OvmfPkg/Sec/SecMain.c
> @@ -11,7 +11,6 @@
>
> #include <PiPei.h>
>
> -#include <Library/PeimEntryPoint.h>
> #include <Library/BaseLib.h>
> #include <Library/DebugLib.h>
> #include <Library/BaseMemoryLib.h>
> @@ -39,6 +38,12 @@ typedef struct _SEC_IDT_TABLE {
> IA32_IDT_GATE_DESCRIPTOR IdtTable[SEC_IDT_ENTRY_COUNT];
> } SEC_IDT_TABLE;
>
> +VOID
> +EFIAPI
> +ProcessLibraryConstructorList (
> + VOID
> + );
> +
This is my problem right here.
Why do 10+ files have to do this individually? See the above BZs for
details.
Well, whatever.
What a terrible project.
*shrug*
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> VOID
> EFIAPI
> SecStartupPhase2 (
> @@ -844,7 +849,7 @@ SecCoreStartupWithStack (
> InitializeCpuExceptionHandlers (NULL);
> }
>
> - ProcessLibraryConstructorList (NULL, NULL);
> + ProcessLibraryConstructorList ();
>
> if (!SevEsIsEnabled ()) {
> //
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115089): https://edk2.groups.io/g/devel/message/115089
Mute This Topic: https://groups.io/mt/104167522/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-02-05 0:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 18:24 [edk2-devel] [PATCH] OvmfPkg/Sec: Use correct prototype of ProcessLibraryConstructorList() Ard Biesheuvel via groups.io
2024-02-05 0:44 ` Laszlo Ersek [this message]
2024-02-06 22:52 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1278eb3e-9194-1f39-db24-87cef500f042@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox