From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CD26C54E94 for ; Thu, 26 Jan 2023 16:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231506AbjAZQgP (ORCPT ); Thu, 26 Jan 2023 11:36:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231485AbjAZQgM (ORCPT ); Thu, 26 Jan 2023 11:36:12 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 819926D355 for ; Thu, 26 Jan 2023 08:36:01 -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 ams.source.kernel.org (Postfix) with ESMTPS id D0F65B81E89 for ; Thu, 26 Jan 2023 16:35:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36778C4339B; Thu, 26 Jan 2023 16:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674750958; bh=P9M1WsT0odFE4/D/lBcegMOzB3u3R3wwB2sqVG6VU2k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q3aIuP8h6z52pvcjG+2ycFtg6/aRR9hIQcg/5oPa43ql/5AAQg7qyl0oKqNtjUE7h 3fIS9WM0/vcJ2r1pCSmrE0zkbM508zeUdcDkZRC5a2OPkNtx517iUvg7qAvwyHpL5V /tiXmZmbbNW1l2HrvXeeO+EE3uJAbcD6RuhXsjVIzXQOQTLj/+WC/JeEPUfj0xKp3a EpIhDXtJs5edvb/jTQwgiKpVA9CHZKkeJhJQd4SgbAfwub4MrPmopV4NqMdpbBhTll +UreoPe4q4+CG4UE06GLVTH9Xjvu02ntvfaRypIC2XPjC5YHhmhKo9I5Mgfywjajp+ 1WJheJ4IWDOHg== Date: Thu, 26 Jan 2023 16:35:53 +0000 From: Will Deacon To: Jamie Cunliffe Cc: linux-arm-kernel@lists.infradead.org, rust-for-linux@vger.kernel.org, Miguel Ojeda , Catalin Marinas , steve.capper@arm.com Subject: Re: [PATCH 1/3] arm64: rust: Enable Rust support for AArch64 Message-ID: <20230126163552.GD29438@willie-the-truck> References: <20230125163739.3798252-1-Jamie.Cunliffe@arm.com> <20230125163739.3798252-2-Jamie.Cunliffe@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230125163739.3798252-2-Jamie.Cunliffe@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: rust-for-linux@vger.kernel.org On Wed, Jan 25, 2023 at 04:37:37PM +0000, Jamie Cunliffe wrote: > From: Miguel Ojeda > > This commit provides the build flags for Rust for AArch64. The core Rust > support already in the kernel does the rest. > > The Rust samples have been tested with this commit. > > [jcunliffe: Arm specific parts taken from Miguel's upstream tree] > > Signed-off-by: Miguel Ojeda > Co-developed-by: Jamie Cunliffe > Signed-off-by: Jamie Cunliffe > --- > Documentation/rust/arch-support.rst | 1 + > arch/arm64/Kconfig | 1 + > scripts/generate_rust_target.rs | 13 ++++++++++++- > 3 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst > index 6982b63775da..3776059a385a 100644 > --- a/Documentation/rust/arch-support.rst > +++ b/Documentation/rust/arch-support.rst > @@ -15,5 +15,6 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file. > ============ ================ ============================================== > Architecture Level of support Constraints > ============ ================ ============================================== > +``arm64`` Maintained None. > ``x86`` Maintained ``x86_64`` only. > ============ ================ ============================================== > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 03934808b2ed..fc3800e82802 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -209,6 +209,7 @@ config ARM64 > select HAVE_FUNCTION_ARG_ACCESS_API > select MMU_GATHER_RCU_TABLE_FREE > select HAVE_RSEQ > + select HAVE_RUST > select HAVE_STACKPROTECTOR > select HAVE_SYSCALL_TRACEPOINTS > select HAVE_KPROBES > diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs > index 3c6cbe2b278d..fe0e4ba54492 100644 > --- a/scripts/generate_rust_target.rs > +++ b/scripts/generate_rust_target.rs > @@ -148,7 +148,18 @@ fn main() { > let mut ts = TargetSpec::new(); > > // `llvm-target`s are taken from `scripts/Makefile.clang`. > - if cfg.has("X86_64") { > + if cfg.has("ARM64") { > + ts.push("arch", "aarch64"); > + ts.push( > + "data-layout", > + "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", > + ); > + ts.push("disable-redzone", true); > + ts.push("features", "+strict-align,+neon,+fp-armv8"); > + ts.push("llvm-target", "aarch64-linux-gnu"); > + ts.push("max-atomic-width", 128); > + ts.push("target-pointer-width", "64"); Why do we need to specify this stuff here? LLVM already knows about AArch64 and can compute the data-layout string in computeDataLayout(). Can we have the tools figure this out for us instead, please? Will From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 B67C8C54E94 for ; Thu, 26 Jan 2023 16:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U/O/4lTXnaA/34AYV1foiSQf2/+KYUMxaeP3jhweEhs=; b=O4m1UGW02ph/wj NXv12a+Sbo1D8m85ngyNyBOojBpTUpQgj7lH45b13ab9IsCpfRMuj0UA+Im2aSB/kr+jFuTJ5Gq8T 8wc96TnxaAncUu+31nhfxHsl6dRqQzhR++YQbDgli+hSCsfCKL8nUKMBVZVrsPBeFbLJ3a8310thx 9Ut7d/XHp0WQZwvdvEbbyeB3iKCeLZ1rdgQg8NR0rQkVgqFCwLAH4CpDfGuDKuYkdPrwL2NsaUCsL yEuBYfl6ohm0mkiI23yzLVLbpjqMnPrWlODa107EG+QEvdHjiZfE2O5Mrui7wfe83AUAGKYoL7VhI tTQkoVZR8kq4+rooYEpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pL5Q1-00BrWS-Si; Thu, 26 Jan 2023 16:48:11 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pL5EK-00Bnty-LE for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2023 16:36:06 +0000 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 884BF618EB; Thu, 26 Jan 2023 16:35:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36778C4339B; Thu, 26 Jan 2023 16:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674750958; bh=P9M1WsT0odFE4/D/lBcegMOzB3u3R3wwB2sqVG6VU2k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q3aIuP8h6z52pvcjG+2ycFtg6/aRR9hIQcg/5oPa43ql/5AAQg7qyl0oKqNtjUE7h 3fIS9WM0/vcJ2r1pCSmrE0zkbM508zeUdcDkZRC5a2OPkNtx517iUvg7qAvwyHpL5V /tiXmZmbbNW1l2HrvXeeO+EE3uJAbcD6RuhXsjVIzXQOQTLj/+WC/JeEPUfj0xKp3a EpIhDXtJs5edvb/jTQwgiKpVA9CHZKkeJhJQd4SgbAfwub4MrPmopV4NqMdpbBhTll +UreoPe4q4+CG4UE06GLVTH9Xjvu02ntvfaRypIC2XPjC5YHhmhKo9I5Mgfywjajp+ 1WJheJ4IWDOHg== Date: Thu, 26 Jan 2023 16:35:53 +0000 From: Will Deacon To: Jamie Cunliffe Cc: linux-arm-kernel@lists.infradead.org, rust-for-linux@vger.kernel.org, Miguel Ojeda , Catalin Marinas , steve.capper@arm.com Subject: Re: [PATCH 1/3] arm64: rust: Enable Rust support for AArch64 Message-ID: <20230126163552.GD29438@willie-the-truck> References: <20230125163739.3798252-1-Jamie.Cunliffe@arm.com> <20230125163739.3798252-2-Jamie.Cunliffe@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230125163739.3798252-2-Jamie.Cunliffe@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230126_083604_852409_D2ACACD7 X-CRM114-Status: GOOD ( 23.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jan 25, 2023 at 04:37:37PM +0000, Jamie Cunliffe wrote: > From: Miguel Ojeda > > This commit provides the build flags for Rust for AArch64. The core Rust > support already in the kernel does the rest. > > The Rust samples have been tested with this commit. > > [jcunliffe: Arm specific parts taken from Miguel's upstream tree] > > Signed-off-by: Miguel Ojeda > Co-developed-by: Jamie Cunliffe > Signed-off-by: Jamie Cunliffe > --- > Documentation/rust/arch-support.rst | 1 + > arch/arm64/Kconfig | 1 + > scripts/generate_rust_target.rs | 13 ++++++++++++- > 3 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/Documentation/rust/arch-support.rst b/Documentation/rust/arch-support.rst > index 6982b63775da..3776059a385a 100644 > --- a/Documentation/rust/arch-support.rst > +++ b/Documentation/rust/arch-support.rst > @@ -15,5 +15,6 @@ support corresponds to ``S`` values in the ``MAINTAINERS`` file. > ============ ================ ============================================== > Architecture Level of support Constraints > ============ ================ ============================================== > +``arm64`` Maintained None. > ``x86`` Maintained ``x86_64`` only. > ============ ================ ============================================== > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 03934808b2ed..fc3800e82802 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -209,6 +209,7 @@ config ARM64 > select HAVE_FUNCTION_ARG_ACCESS_API > select MMU_GATHER_RCU_TABLE_FREE > select HAVE_RSEQ > + select HAVE_RUST > select HAVE_STACKPROTECTOR > select HAVE_SYSCALL_TRACEPOINTS > select HAVE_KPROBES > diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs > index 3c6cbe2b278d..fe0e4ba54492 100644 > --- a/scripts/generate_rust_target.rs > +++ b/scripts/generate_rust_target.rs > @@ -148,7 +148,18 @@ fn main() { > let mut ts = TargetSpec::new(); > > // `llvm-target`s are taken from `scripts/Makefile.clang`. > - if cfg.has("X86_64") { > + if cfg.has("ARM64") { > + ts.push("arch", "aarch64"); > + ts.push( > + "data-layout", > + "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", > + ); > + ts.push("disable-redzone", true); > + ts.push("features", "+strict-align,+neon,+fp-armv8"); > + ts.push("llvm-target", "aarch64-linux-gnu"); > + ts.push("max-atomic-width", 128); > + ts.push("target-pointer-width", "64"); Why do we need to specify this stuff here? LLVM already knows about AArch64 and can compute the data-layout string in computeDataLayout(). Can we have the tools figure this out for us instead, please? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel