Message ID | 20220218143416.34475-3-roger.pau@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <xen-devel-bounces@lists.xenproject.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC456C433FE for <xen-devel@archiver.kernel.org>; Fri, 18 Feb 2022 14:35:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.275511.471436 (Exim 4.92) (envelope-from <xen-devel-bounces@lists.xenproject.org>) id 1nL4LH-0000aX-Ve; Fri, 18 Feb 2022 14:34:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 275511.471436; Fri, 18 Feb 2022 14:34:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from <xen-devel-bounces@lists.xenproject.org>) id 1nL4LH-0000aQ-SW; Fri, 18 Feb 2022 14:34:39 +0000 Received: by outflank-mailman (input) for mailman id 275511; Fri, 18 Feb 2022 14:34:38 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from <SRS0=YtLv=TB=citrix.com=prvs=0411da6ea=roger.pau@srs-se1.protection.inumbo.net>) id 1nL4LG-0000ZM-Q1 for xen-devel@lists.xenproject.org; Fri, 18 Feb 2022 14:34:38 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e499195e-90c7-11ec-8eb8-a37418f5ba1a; Fri, 18 Feb 2022 15:34:37 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion <xen-devel.lists.xenproject.org> List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=unsubscribe> List-Post: <mailto:xen-devel@lists.xenproject.org> List-Help: <mailto:xen-devel-request@lists.xenproject.org?subject=help> List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=subscribe> Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" <xen-devel-bounces@lists.xenproject.org> X-Inumbo-ID: e499195e-90c7-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1645194877; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=7VTNoFVDNGcjQfdLiA7ylnRk9qV10cync6xBOedRTiw=; b=QAHd+gsoAw/iMz+t84iot3A745iHxzYdbqmthlOJvVu7WZUG5fX8gOhB XJHJof/AGucrSBrXURnrrQoH0yLhU5KoJEy/NihkHRnlObo+tMqV5MQY0 49IZd+SiNwJPHPTuXssIVbOQzbNzYx+NSfMxQwRWEp4S0QoCK8H4dqVF2 s=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com X-SBRS: 5.1 X-MesageID: 64417970 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:q3HvnaKNiG8yTkHxFE+RxpUlxSXFcZb7ZxGr2PjKsXjdYENS3jAOm GQXWmnXOPiKM2SgL4pzOt+zoEwD7cLTzoUyGVNlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokf0/0vrav67xZVF/fngqoDUUYYoAQgsA180IMsdoUg7wbRh2Nc42YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE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V0gJ1XYGNu/xKDwQeOApP+tdKH LKjfA32AZINE5nJfiTNz0gZazuttfLnJXpbVovAAMm0hCHiXeN5KThGxaV8x8CW3cXqI1SvF Ttokjc3OGOovu7whjT2yv66IlXosLozp9mCNaXgsYYBz3wgkKDZZhnWZeFoDcpydvfomoCoZ 3pmVMNLs5z43TeciWcpgbs4RDp1HIU53rr2Taj8A3eiP28YAh/J9tKhIpffBecwVEnpstA3K VC2H/cn4ZLDDvb9R6NqeTgZlVPrA6ZsHAimekcgzh0So0FcoJcqoQZ4Qd8DIoAJiTn84oqed MeQ/003MwmMW9yUkqp/VWGmLeXLzYO91a9MwQ/U/WuonlrdCsT9Tpc+CQd9k1wg67VBaM0o9 gsCZ4Y542mePVmGZ6VNN1xMfdfNVa9My4kSFjiWWgPNJt3ck4l+KSHqInc2omRCek1Jd0J6d P8bG8= X-IronPort-AV: E=Sophos;i="5.88,379,1635220800"; d="scan'208";a="64417970" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=af74N8QXH5MqPxnqegTCdHwz1KfVlQYKl/XzcAuBz2/MJLVnuQ0agrWyM9qDgklh55++k3WdNOU6m2OFrmMX7UsLITenguiduGXcFd7cSFgXbSqQxln2pQ5iXFW4hb5lFlmEqDoQ9txbyISkYi+GwxQbE/Gd5sGz0O5icr2ZqJblgRRA94tECSAd3Nff5BeeY2cGWTktXQy2HNKdf7aEW/XQxSlC54PfTsn3zmC4XGENysXgevQIUa0zlX36IwA53IBHPT8+TlJj3MbhJy5/4RbDfo2zRM3NXJfdH/DftWS0nqCSM1PfQ3DH1M9B6teostxVfQFJSAEAn+G+H4vhbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nv6gW1Mlt7VQSuRHTBBB8hz+ff/2S3H03ut9wK9Gkqs=; b=kpzao6FfhQcuy/b+7ONocd+T5NG8jtvpAitOq7L7WyqC3XwvxAfWxPCa/3MY0NGVQ4RjkIVtt+VEsNEsaJuEywTaaDC4VbZ44XwSd6R2K99e30yK4h34DvTeq+5VLD0Mo+sY6wI5NZw64W+PbbS7EzotrfoJ6NUNoe8kl44MeRBeMvjDwGjlv9esJuSNsu8sO5d5zJHYf3ZR0Nqjgs8QfZ1ybSPRHLfkCUkDCd7C6ji2ca+u/oQYdhKMSQzlYvEt5RVYmF6tCjbWaevHvy1hlTOaYBiWO5a5n/dXHoFrOpCFx8EquPR8GRkAscBO7+SbOzWFmZuIGAY9niCtHEfJ/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nv6gW1Mlt7VQSuRHTBBB8hz+ff/2S3H03ut9wK9Gkqs=; b=wiO8WYATf5WL+xKwB+hhSYdeF16pHxycMC0cnrJvzFUVI6cfVBL916dGEd771LEzy6YMl9aVAolB0zvXDyJ1Zzk6sEWYeIJY2n9KGg4jFlq5dgbm88TEJ5fioVHMJlG4auMw9excVLvfp0zp+yRw3hde8l4FBVqFAGVqHMMmSBI= From: Roger Pau Monne <roger.pau@citrix.com> To: <xen-devel@lists.xenproject.org> CC: Roger Pau Monne <roger.pau@citrix.com>, Jan Beulich <jbeulich@suse.com>, Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org> Subject: [PATCH v3 2/3] x86/clang: add retpoline support Date: Fri, 18 Feb 2022 15:34:15 +0100 Message-ID: <20220218143416.34475-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220218143416.34475-1-roger.pau@citrix.com> References: <20220218143416.34475-1-roger.pau@citrix.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0299.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:196::16) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb99fa3f-f0f6-4ab6-9992-08d9f2ebc6b8 X-MS-TrafficTypeDiagnostic: DS7PR03MB5543:EE_ X-Microsoft-Antispam-PRVS: <DS7PR03MB55434A4956237A22A3AD4C308F379@DS7PR03MB5543.namprd03.prod.outlook.com> X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: afrksBiQhL2DSkJ+wcpQZ6SYNWJCdbFz2QXClNnywRbQt3SDSU8DqUJOMt4xAg84JocBim3vzsNlsE9hQmQ+ibaxOBGC1NjJr2X4+hO5F7jEdx+MbUOTxqn8bODZQnHPdq3OWbkL6IEA3dAzaCLUhBFRqC6Ip3tSaKXnXm7x+T7f+CxRx9RCwnUR4mJ90L+6CwUtMflYPUAyoKIV/7SJ71uCezF87vEKcrd2yQ3rL8iHI64gZ3ZTDU67QtxkFHMvS1rI/FWm5FXRUgsYKaCOKauT93j+ZLIJnuSioKitLUEMuzZ8w8R8/YF8tIxMx8It7Pw3lMECPgrZ7uTLdIrml4TaRUrD0d4D+4PMN/BfdoIu2iq4jgnAWImyQTV3JNmGg4TqFPe82iCFo9188mZ2ZMktm/1iOkEmwuGBvOMcxOGWl4b2K0JojEOowMA0L3fUMI1Rprg5YI+zdnqMFbrEiRfJlFDmymwgY9WGs/WeLj1fNd181WFZLfz+I1Yzq14sYyg5FdXLQtgJNrIK53SUCQcG/yxaqB/YCUeM1LycAxUt5J6v7hZzoYS8IIVOlnBRVE4vve7Dc8bKzKKuKTRfrrhsS3S/5BPq2dIHn3EfaRtEFnl+WFjsAeO4lDsUUwKt732q3Efwm251ZH5tsFuJWw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(86362001)(6512007)(36756003)(82960400001)(8936002)(26005)(1076003)(6486002)(8676002)(6666004)(6916009)(2616005)(66946007)(5660300002)(2906002)(54906003)(66476007)(316002)(66556008)(83380400001)(4326008)(508600001)(6506007)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?MkgEfadS5LBzI/XpwEpcH5oi2N6A?= =?utf-8?q?Cyn4BMr7giSLfCZyfNawhtRiGXk91kNy/TRonq+Ge/EjPMO7b9hQta3QoB8oE5vmT?= =?utf-8?q?qUG+yWQZawafCTFQRIglDSLxtaV9zG0FhPs9YqnXTrt0HaNy/BOZTFnllqYcYP+XF?= =?utf-8?q?svs8uw2KB4u5CRYskJ8C/DrS18apRvzwgyr7yDGt31Or8YBrQei2MW/6y8ggMWj89?= =?utf-8?q?j4FhwaCIdeJxicNuVgtcvkWtX9HmbntdqXhtSC+6bVQ5dWyk3y7kubCoRslkCr87I?= =?utf-8?q?X+CQUO3Xd1m+143/Ko4DN6zmj7KDLGI5za6Yx4RJ+GkPSBKF+awb5zrARNSZ2/Pup?= =?utf-8?q?52wcR6dB00Tqp9fMkWvzRsvghvNO1Eob/pr70zL1cTIlFHLZ2D9gG/aOnWZV7y9tx?= =?utf-8?q?bUw7z2M9BFuhe0efTh9oxdAkIbc3SrUaLVNuR4sjFkyx/AjZFgZaP1X5jhRoI7Czr?= =?utf-8?q?3sUpP8NTqVvGQiSoiuykod5yQk5iHLc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jYzWA3+GdQ+Mfzm0rREBa/3S2?= =?utf-8?q?O/6s48nFnIRANxUAsohC61im2cQdrhrS6PwN0/C5Yit8MgwrtbE3kLaaQ6MX4PV40?= =?utf-8?q?mLSENRDGO4ewLfaT2vpBhKnW3EW5JlsxeC91BEbsX8a47yIal1B/LB9koR/ultWOj?= =?utf-8?q?6tG4+3Zerb+Cz2vECwDo92907fAiSyJtIKq6xAPMDC3jJRlBxxrCb7M=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: fb99fa3f-f0f6-4ab6-9992-08d9f2ebc6b8 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2022 14:34:31.6421 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IJpOkLrqsXkA6RLDZT+oEdkAjcvwZ7v4mVJTBmDqS4LrebmlAU3dJqfW5Qw5FkdLCS/2iufT62x+xbFJtMFXhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR03MB5543 X-OriginatorOrg: citrix.com |
Series | retpoline: add clang support + Kconfig selectable | expand |
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index a1a90da4fc..f8dca4dc85 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -33,7 +33,9 @@ config ARCH_DEFCONFIG default "arch/x86/configs/x86_64_defconfig" config CC_INDIRECT_THUNK - def_bool $(cc-option,-mindirect-branch-register) + def_bool $(cc-option,-mindirect-branch-register) || \ + $(cc-option,-mretpoline-external-thunk) + config INDIRECT_THUNK def_bool y diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index 6388b1d93f..066d749ba0 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -47,6 +47,9 @@ ifeq ($(CONFIG_INDIRECT_THUNK),y) CFLAGS-$(CONFIG_CC_IS_GCC) += -mindirect-branch=thunk-extern CFLAGS-$(CONFIG_CC_IS_GCC) += -mindirect-branch-register CFLAGS-$(CONFIG_CC_IS_GCC) += -fno-jump-tables + +# Enable clang retpoline support if available. +CFLAGS-$(CONFIG_CC_IS_CLANG) += -mretpoline-external-thunk endif # If supported by the compiler, reduce stack alignment to 8 bytes. But allow
Detect whether the compiler supports clang retpoline option and enable by default if available, just like it's done for gcc. Note clang already disables jump tables when retpoline is enabled, so there's no need to also pass the fno-jump-tables parameter. Also clang already passes the return address on a register always on amd64, so there's no need for any equivalent mindirect-branch-register parameter. Reported-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- xen/arch/x86/Kconfig | 4 +++- xen/arch/x86/arch.mk | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-)