From patchwork Tue Jun 6 14:56:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamie Cunliffe X-Patchwork-Id: 13269333 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 708B7C7EE24 for ; Tue, 6 Jun 2023 14:57:12 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ArTXoOao7ELk08hC2xfSavjoH7l8fHs9CvXCOtkaQW0=; b=b0tXkgn/OR9PFx pY5UKSLOIhyHGzaNmlvTtPU/AcKo32ioyFSKKIFNYOvhstI1LjUF8l7FNq2zDWCkjoQhBsU+zl9T5 +/1cDv2fcQFoZeaXqEUKlU7gen36KTd8PM1UEA/Y0/p6hCPbINZEjkJZ211YPPGII6Lm3DmFI4Znp wW85Asi7uSUfUb7KCGd3qcDWZZanrVsgN9ld5xZNmtvr94dAiOr1oaaja2PcPYBdn+cSWYoYD8r9B riGSreWZdWoKGdVH8vO1BbrICuSQM7FHe0kAFDHtM+Peqbhvhm4MTDJCI0f+Cbwbj3aqw2mmN+GYB +bqUh1PMNV7AeLbgT/1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6Y78-0027ac-2j; Tue, 06 Jun 2023 14:56:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6Y76-0027VV-14 for linux-arm-kernel@lists.infradead.org; Tue, 06 Jun 2023 14:56:50 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2EAB32F4; Tue, 6 Jun 2023 07:57:24 -0700 (PDT) Received: from capper-ampere.manchester.arm.com (capper-ampere.manchester.arm.com [10.32.100.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 966523F6C4; Tue, 6 Jun 2023 07:56:37 -0700 (PDT) From: Jamie Cunliffe To: linux-arm-kernel@lists.infradead.org, rust-for-linux@vger.kernel.org Cc: Miguel Ojeda , Catalin Marinas , Will Deacon , steve.capper@arm.com, Asahi Lina Subject: [PATCH v2 0/3] Rust enablement for AArch64 Date: Tue, 6 Jun 2023 15:56:03 +0100 Message-Id: <20230606145606.1153715-1-Jamie.Cunliffe@arm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230606_075648_436384_A2C4D657 X-CRM114-Status: GOOD ( 14.38 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable Rust support for the AArch64 architecture. The first patch enables the basic building of Rust for AArch64. Since v1 this has been rewritten to avoid the use of a target.json file for AArch64 and use the upstream rustc target definition. x86-64 still uses the target.json approach though. The second patch enables the PAC ret and BTI options in the Rust build flags to match the options that are used when building C. The third patch disables Rust support when building for big endian. Currently there is no `aarch64_be-unknown-none` target which would allow this. Support for this can come at a later time either by using the target.json approach, or upstreaming a new target definition to rustc (preferred). We also might be able to use the `aarch64_be-unknown-linux-gnu` target, however, this can be done at a later time. It's worth noting that in Makefile.clang, it's recommended for arch/{arch}/Makefile to set the endianness based on arguments rather than the target triple. It's currently not possible to do this with rustc, a different target triple has to be used. Jamie Cunliffe (3): arm64: rust: Enable Rust support for AArch64 arm64: rust: Enable PAC support for Rust. arm64: Restrict Rust support to little endian only. Documentation/rust/arch-support.rst | 1 + Makefile | 1 - arch/arm64/Kconfig | 1 + arch/arm64/Makefile | 4 ++++ arch/x86/Makefile | 1 + rust/Makefile | 6 +++++- scripts/Makefile | 5 +++-- scripts/generate_rust_target.rs | 4 +++- 8 files changed, 18 insertions(+), 5 deletions(-) Tested-by: Boqun Feng