Message ID | 20221114114344.18650-15-jirislaby@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097745wru; Mon, 14 Nov 2022 03:48:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf6NRNOx+cRp0pdZ5wEoE43GZeoC4SI+33FOT1yANofokzKD20DiDihh5XTnodGj4j/SE83X X-Received: by 2002:a17:906:f8d6:b0:7ad:a0cb:f79e with SMTP id lh22-20020a170906f8d600b007ada0cbf79emr9492673ejb.458.1668426482787; Mon, 14 Nov 2022 03:48:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426482; cv=none; d=google.com; s=arc-20160816; b=vY/q96Jz0H95vSwLWBLGZeS6OkzKbwydhUyKU8VGxMgvrGUU0vE2+245WIhAESDdoL 772Ix8LNbrHEoOqplh8b5WDqy30+Ca6GQD64G8vOWdFvZdzEwwFbdh9Dkp6mtRMDuQNt iTClcnF1t16MyzAuEE07x75YAOzp6ZzufSCYMy+zc6gx0JI0ja4G5BviwlGcrRVW0L8I vxhfWFRVS2N7Mdj1U1NfqyosFW0zsyxwmz8HXQPm6EFI1SxruI/lH7drD8Cptc1uyp9I 1gplUSco4jo6GFQTfCH0HL5EhMdEHTo35rtM77vyelSJBWb09jQevpr7U3o7BsedNXhJ WP6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=avcaAbn+KcTS6R234U15OIZOl7eYOQ/oaTd2IOBdeeE=; b=JC2D2sM4Ow1m1XmNJAPVcbJRq1XBPX347vdxpELQRVhQzlXRxZyZmVyJ4FqZlp4Yal s/x8BzC03kEM7g9a2h6F/8MafrxP8EmVHkEbvEYLB+3fYGeE4VVewhx2Nq7xddBXeD6Z nqzxcvDlCd8R57idbi+/Z9rgL/evJjFb/Q46xINIklCWaL1ZDBq5GR3h6c+qgfjZKI6o I1JBe/wxLOkz55KGMPbpqya+eH5Dde4+cWlBe2GGn0S/cUM64Vc6kn6n8FBOIYnNw4ro VOMStpiqU429JkZSpVnza0r4ixbxMzDe7JhzxslQSrseuYvNMS4FnvypMk5+cRMWRIV5 GRqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=euCEXuDs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh19-20020a1709076e9300b007ae9abf1994si3485588ejc.837.2022.11.14.03.47.39; Mon, 14 Nov 2022 03:48:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=euCEXuDs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbiKNLpT (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Mon, 14 Nov 2022 06:45:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235943AbiKNLop (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 06:44:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 581CA20F6A for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 03:44:29 -0800 (PST) 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 E8B1261088 for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 11:44:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61EC1C433D7; Mon, 14 Nov 2022 11:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426268; bh=HZIastRykGq/xA5rtpb1Bg85h070mlpSsyGBDMBXEYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=euCEXuDs57Jkz5ICAd7/3gZCT/G6I99Z03/IWwv//Gs5dT1Q7RhHBZKC40XVCMoro S0GZfmJuacnIqqifElnRHBZ9CKJ6WBZbuxtrXV7Fe7JWFm/r+azYpU5QsFeZrd50x3 0Fs9sf9UBFMv6nU68ownp6Zd/CWEKRKp0FoNrO+UP9PIsP9coM+LGVrLFjWwoGfER6 bRQxYHnLBed9kAHfQ4XIxZ4rVSxHohsLn+Soy+WoYhluTx8NlGegiiYacAdk3Kbm8G Q+b9jE3WWQ/dxjeryS/Ry63V0RBudfusZiZoU4djSocIn90a48aRk98o/7vxQCn3S/ N69aEfUo7K0PQ== From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> To: linux-kernel@vger.kernel.org Cc: Martin Liska <mliska@suse.cz>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, "H. Peter Anvin" <hpa@zytor.com>, x86@kernel.org, Jiri Slaby <jslaby@suse.cz> Subject: [PATCH 14/46] x86/sev, lto: Mark cpuid_table_copy as __visible_on_lto Date: Mon, 14 Nov 2022 12:43:12 +0100 Message-Id: <20221114114344.18650-15-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471967848321131?= X-GMAIL-MSGID: =?utf-8?q?1749471967848321131?= |
Series |
gcc-LTO support for the kernel
|
|
Commit Message
Jiri Slaby
Nov. 14, 2022, 11:43 a.m. UTC
From: Martin Liska <mliska@suse.cz> Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark cpuid_table_copy as __visible_on_lto. [js] use __visible_on_lto Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: x86@kernel.org Signed-off-by: Martin Liska <mliska@suse.cz> Signed-off-by: Jiri Slaby <jslaby@suse.cz> --- arch/x86/kernel/sev-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Nov 14, 2022 at 12:43:12PM +0100, Jiri Slaby (SUSE) wrote: > From: Martin Liska <mliska@suse.cz> > > Symbols referenced from assembler (either directly or e.f. from > DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because > they could end up in a different object file than the assembler. This > can lead to linker errors without this patch. > > So mark cpuid_table_copy as __visible_on_lto. > > [js] use __visible_on_lto > > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: Borislav Petkov <bp@alien8.de> > Cc: Dave Hansen <dave.hansen@linux.intel.com> > Cc: "H. Peter Anvin" <hpa@zytor.com> > Cc: x86@kernel.org > Signed-off-by: Martin Liska <mliska@suse.cz> > Signed-off-by: Jiri Slaby <jslaby@suse.cz> > --- > arch/x86/kernel/sev-shared.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c > index 3a5b0c9c4fcc..554da8aabfc7 100644 > --- a/arch/x86/kernel/sev-shared.c > +++ b/arch/x86/kernel/sev-shared.c > @@ -64,7 +64,7 @@ struct snp_cpuid_table { > static u16 ghcb_version __ro_after_init; > > /* Copy of the SNP firmware's CPUID page. */ > -static struct snp_cpuid_table cpuid_table_copy __ro_after_init; > +__visible_on_lto struct snp_cpuid_table cpuid_table_copy __ro_after_init; Same again, address is taken (and passed into inline asm). Must not be eliminated.
diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c index 3a5b0c9c4fcc..554da8aabfc7 100644 --- a/arch/x86/kernel/sev-shared.c +++ b/arch/x86/kernel/sev-shared.c @@ -64,7 +64,7 @@ struct snp_cpuid_table { static u16 ghcb_version __ro_after_init; /* Copy of the SNP firmware's CPUID page. */ -static struct snp_cpuid_table cpuid_table_copy __ro_after_init; +__visible_on_lto struct snp_cpuid_table cpuid_table_copy __ro_after_init; /* * These will be initialized based on CPUID table so that non-present