From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.12343.1676288717795497388 for ; Mon, 13 Feb 2023 03:45:17 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pCVCREK+; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1F59360FDE for ; Mon, 13 Feb 2023 11:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86CC3C4339C for ; Mon, 13 Feb 2023 11:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676288716; bh=ciHrVFrcPtlVRmh+GLMRzuiHafQkaJKK11KD6F7SDYo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=pCVCREK+HOGhYzBJWdOeGUPJnlZwEVT/qjghBabIupqT5JvtOmHTAD32KjGZ6Ee8O g8iseqlE4Yazm7SEXo8pMJb9zJlY0G2/ZA9UfILgFD5h/ts5c5Q0Irg+yOSd4EwVbv LJaFq9E3wZqmjXSMT5RVRCZV0RFnISTxKeosgkVFnhI6bCMlnj7j9pYmmMozJi7oYx w8UQ5D2pgeEiqcMtTVMUlzscq9OD1FfFFd6/fgRAx4RK981yCDldtI0Km4AGu0An05 Mn6ddnhMsV014YrPRT1b8ViF5tq18naV7dckcnUZh0MsWL1+WMU9OfVEk5YjcY/Qin /BDZdU3aomSZg== Received: by mail-lf1-f41.google.com with SMTP id j17so18506441lfr.3 for ; Mon, 13 Feb 2023 03:45:16 -0800 (PST) X-Gm-Message-State: AO0yUKVbHPdqW0AHMxLNfvbZUwnoe6rTrBZcnAKEHLektDaKnalMwB1J KSOxfa3zN17BWGH4cQpcqv7VC2+i83e6VhZiGQM= X-Google-Smtp-Source: AK7set+R7D+o4/eA0/pvkRImVtf42+1Ffu55qpgLZnxYMxObRcM7UcZtGiPPgAtm8jasEAwZVJUnf2xHbmPSM2K7tt4= X-Received: by 2002:ac2:4905:0:b0:4d5:8b87:b9a3 with SMTP id n5-20020ac24905000000b004d58b87b9a3mr3670631lfi.64.1676288714594; Mon, 13 Feb 2023 03:45:14 -0800 (PST) MIME-Version: 1.0 References: <20230209102648.2291743-1-kraxel@redhat.com> <20230210084157.s35f5j4rzkr6ibl7@sirius.home.kraxel.org> <20230213113910.mjxt276su2eeqixt@sirius.home.kraxel.org> In-Reply-To: <20230213113910.mjxt276su2eeqixt@sirius.home.kraxel.org> From: "Ard Biesheuvel" Date: Mon, 13 Feb 2023 12:45:03 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v2 00/10] OvmfPkg: add Crypto Driver support To: devel@edk2.groups.io, kraxel@redhat.com Cc: Pawel Polawski , Guomin Jiang , Tom Lendacky , Jiewen Yao , Xiaoyu Lu , Jordan Justen , Min Xu , Jian J Wang , Michael Roth , Oliver Steffen , James Bottomley , Erdem Aktas , Ard Biesheuvel Content-Type: text/plain; charset="UTF-8" On Mon, 13 Feb 2023 at 12:39, Gerd Hoffmann wrote: > > On Fri, Feb 10, 2023 at 02:46:34PM +0100, Ard Biesheuvel wrote: > > On Fri, 10 Feb 2023 at 14:42, Ard Biesheuvel wrote: > > > > > > > Can LTO be enabled for the NOOPT build? Or depends that on > > > > optimizations being turned on? > > Turns out: kind of. The crypto driver effectively does > > if (fixed.pcd.bit) > call libcrypt / libopenssl > else > throw error > > With optimizations turned off altogether gcc will not notice it can > evaluate the PCD config bits at compile time, which in turn leads to > everything being compiled in no matter whenever the features are > enabled or not ... > > take care, > Gerd > > From e0a080ead544813445f731eef137747ff805a5cd Mon Sep 17 00:00:00 2001 > From: Gerd Hoffmann > Date: Mon, 13 Feb 2023 10:21:50 +0100 > Subject: [PATCH 1/1] CryptoPkg/Driver: enable moderate optimizations for NOOPT > builds > > With optimizations turned off altogether gcc will not evaluate the > (constant) configuration PCDs at compile time (see CALL_BASECRYPTLIB > macro). Which renders LTO ineffective and leads to huge amounts of > dead code being included in the crypto driver builds. > > Turn on optimizations for GCC, lowest level (-O1), to fix this. > > FIXME: visual studio needs that too. > > Signed-off-by: Gerd Hoffmann > --- > CryptoPkg/Driver/CryptoDxe.inf | 3 +++ > CryptoPkg/Driver/CryptoPei.inf | 3 +++ > CryptoPkg/Driver/CryptoSmm.inf | 3 +++ > 3 files changed, 9 insertions(+) > > diff --git a/CryptoPkg/Driver/CryptoDxe.inf b/CryptoPkg/Driver/CryptoDxe.inf > index 0d08f3a190c8..44921c1fdaa8 100644 > --- a/CryptoPkg/Driver/CryptoDxe.inf > +++ b/CryptoPkg/Driver/CryptoDxe.inf > @@ -47,3 +47,6 @@ [Pcd] > > [Depex] > TRUE > + > +[BuildOptions] > + GCC:NOOPT_*_*_CC_FLAGS = -O1 Could we use -Og instead? > diff --git a/CryptoPkg/Driver/CryptoPei.inf b/CryptoPkg/Driver/CryptoPei.inf > index dfa1ab58b16f..45704f5f9e42 100644 > --- a/CryptoPkg/Driver/CryptoPei.inf > +++ b/CryptoPkg/Driver/CryptoPei.inf > @@ -49,3 +49,6 @@ [Pcd] > > [Depex] > TRUE > + > +[BuildOptions] > + GCC:NOOPT_*_*_CC_FLAGS = -O1 > diff --git a/CryptoPkg/Driver/CryptoSmm.inf b/CryptoPkg/Driver/CryptoSmm.inf > index 9fe8718823d2..906cf06006f4 100644 > --- a/CryptoPkg/Driver/CryptoSmm.inf > +++ b/CryptoPkg/Driver/CryptoSmm.inf > @@ -47,3 +47,6 @@ [Pcd] > > [Depex] > TRUE > + > +[BuildOptions] > + GCC:NOOPT_*_*_CC_FLAGS = -O1 > -- > 2.39.1 > > > > > >