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 C164C9403DA for ; Mon, 5 Feb 2024 00:54:51 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=MFGKBoCU368pGK8OXOtnGF1uVMc1P3xry0nxfQDVCqQ=; c=relaxed/simple; d=groups.io; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1707094490; v=1; b=ttsECFApdBRSptzkLlXoonR5MSw8mA//AnckXmjiJnRNQe3sbOL4K/iJecgO6fMD+quxbdJ/ 6jlsDf1REk4tQhzHUbvjEOkRLoKLHHnNQPSFak1TKw2rIz4xgMVlmnRRX+9awaF7ThG/XKO6axb xCJOA1WUTLQRrSEOWb6QEMok= X-Received: by 127.0.0.2 with SMTP id XlfXYY7687511xTNTtJoLpJk; Sun, 04 Feb 2024 16:54:50 -0800 X-Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by mx.groups.io with SMTP id smtpd.web10.2908.1706898311424262439 for ; Fri, 02 Feb 2024 10:25:11 -0800 X-Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-40ef989f0f1so12619255e9.3 for ; Fri, 02 Feb 2024 10:25:11 -0800 (PST) X-Gm-Message-State: sTlTEb9xb6o9txZvMyo7QxKox7686176AA= X-Google-Smtp-Source: AGHT+IF7uBkLoNKNIvANrkWgnj/l58wwu4gNp7EZ0PLXhb1EsCIHbs+jbvCiYK9VpG0aaUTrE5vKg8b3 X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:600c:1d8d:b0:40f:c631:de7a with SMTP id p13-20020a05600c1d8d00b0040fc631de7amr41775wms.7.1706898309861; Fri, 02 Feb 2024 10:25:09 -0800 (PST) Date: Fri, 2 Feb 2024 19:24:55 +0100 Mime-Version: 1.0 Message-ID: <20240202182455.1535328-1-ardb+git@google.com> Subject: [edk2-devel] [PATCH] OvmfPkg/Sec: Use correct prototype of ProcessLibraryConstructorList() From: "Ard Biesheuvel via groups.io" To: devel@edk2.groups.io Cc: lersek@redhat.com, kraxel@redhat.com, gaoliming@byosoft.com.cn, Ard Biesheuvel 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,ardb+git@google.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ttsECFAp; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Ard Biesheuvel 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 --- OvmfPkg/Sec/SecMain.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 -#include #include #include #include @@ -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 + ); + VOID EFIAPI SecStartupPhase2 ( @@ -844,7 +849,7 @@ SecCoreStartupWithStack ( InitializeCpuExceptionHandlers (NULL); } - ProcessLibraryConstructorList (NULL, NULL); + ProcessLibraryConstructorList (); if (!SevEsIsEnabled ()) { // -- 2.43.0.594.gd9cf4e227d-goog -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115091): https://edk2.groups.io/g/devel/message/115091 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] -=-=-=-=-=-=-=-=-=-=-=-