rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	rust-for-linux@vger.kernel.org, Miguel Ojeda <ojeda@kernel.org>,
	Will Deacon <will@kernel.org>,
	steve.capper@arm.com, Asahi Lina <lina@asahilina.net>,
	boqun.feng@gmail.com, andrew@lunn.ch,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH v4 1/2] rust: Refactor the build target to allow the use of builtin targets
Date: Sun, 22 Oct 2023 11:55:03 +0100	[thread overview]
Message-ID: <ZTT/h5wKL7STeOhC@arm.com> (raw)
In-Reply-To: <20231020155056.3495121-2-Jamie.Cunliffe@arm.com>

On Fri, Oct 20, 2023 at 04:50:55PM +0100, Jamie Cunliffe wrote:
> Eventually we want all architectures to be using the target as defined
> by rustc. However currently some architectures can't do that and are
> using the target.json specification. This puts in place the foundation
> to allow the use of the builtin target definition or a target.json
> specification.
> 
> Signed-off-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
> ---
>  Makefile          | 1 -
>  arch/x86/Makefile | 1 +
>  rust/Makefile     | 5 ++++-
>  scripts/Makefile  | 4 +++-
>  4 files changed, 8 insertions(+), 3 deletions(-)

Adding the x86 maintainers - no functional change for x86, any objection
to this patch going in via the arm64 tree (part of the two-patch series
enabling Rust for arm64)?

Thanks.

(keeping the rest of the patch below for your reference)

> diff --git a/Makefile b/Makefile
> index 88ebf6547964..23100f193da3 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -566,7 +566,6 @@ KBUILD_CFLAGS += -fno-strict-aliasing
>  
>  KBUILD_CPPFLAGS := -D__KERNEL__
>  KBUILD_RUSTFLAGS := $(rust_common_flags) \
> -		    --target=$(objtree)/scripts/target.json \
>  		    -Cpanic=abort -Cembed-bitcode=n -Clto=n \
>  		    -Cforce-unwind-tables=n -Ccodegen-units=1 \
>  		    -Csymbol-mangling-version=v0 \
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 5bfe5caaa444..0f339d4abd40 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -68,6 +68,7 @@ export BITS
>  #    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383
>  #
>  KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx
> +KBUILD_RUSTFLAGS += --target=$(objtree)/scripts/target.json
>  KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2
>  
>  ifeq ($(CONFIG_X86_KERNEL_IBT),y)
> diff --git a/rust/Makefile b/rust/Makefile
> index 87958e864be0..8d75a6ffe951 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -428,8 +428,11 @@ $(obj)/core.o: private skip_clippy = 1
>  $(obj)/core.o: private skip_flags = -Dunreachable_pub
>  $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym))
>  $(obj)/core.o: private rustc_target_flags = $(core-cfgs)
> -$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs scripts/target.json FORCE
> +$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
>  	$(call if_changed_dep,rustc_library)
> +ifdef CONFIG_X86_64
> +$(obj)/core.o: scripts/target.json
> +endif
>  
>  $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
>  $(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE
> diff --git a/scripts/Makefile b/scripts/Makefile
> index 576cf64be667..c85d130a4125 100644
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -11,12 +11,14 @@ hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT)		+= sign-file
>  hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE)	+= insert-sys-cert
>  hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS)		+= rustdoc_test_builder
>  hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS)		+= rustdoc_test_gen
> -always-$(CONFIG_RUST)					+= target.json
>  
> +ifdef CONFIG_X86_64
> +always-$(CONFIG_RUST)					+= target.json
>  filechk_rust_target = $< < include/config/auto.conf
>  
>  $(obj)/target.json: scripts/generate_rust_target include/config/auto.conf FORCE
>  	$(call filechk,rust_target)
> +endif
>  
>  hostprogs += generate_rust_target
>  generate_rust_target-rust := y
> -- 
> 2.30.2

  reply	other threads:[~2023-10-22 10:55 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 15:50 [PATCH v4 0/2] Rust enablement for AArch64 Jamie Cunliffe
2023-10-20 15:50 ` [PATCH v4 1/2] rust: Refactor the build target to allow the use of builtin targets Jamie Cunliffe
2023-10-22 10:55   ` Catalin Marinas [this message]
2023-10-22 11:07     ` Ingo Molnar
2023-10-31  0:24       ` Trevor Gross
2023-10-31 11:58         ` Catalin Marinas
2023-10-31 19:01           ` Trevor Gross
2023-12-12 16:47           ` Will Deacon
2024-01-22  9:17   ` Trevor Gross
2024-01-25  3:19     ` WANG Rui
2024-01-26 19:37       ` Masahiro Yamada
2024-01-27  5:08         ` WANG Rui
2024-01-27 17:31           ` Miguel Ojeda
2024-01-22  9:29   ` Alice Ryhl
2024-01-24  9:12   ` Masahiro Yamada
2023-10-20 15:50 ` [PATCH v4 2/2] arm64: rust: Enable Rust support for AArch64 Jamie Cunliffe
2023-10-20 16:45   ` Catalin Marinas
2023-10-21 13:40     ` Miguel Ojeda
2023-10-22 10:48       ` Catalin Marinas
2023-10-22 12:14         ` Miguel Ojeda
2023-10-20 17:21   ` Andrew Lunn
2023-10-20 18:33     ` Boqun Feng
2023-10-20 18:47       ` Andrew Lunn
2023-10-21 12:50       ` Alice Ryhl
2023-10-21 13:41       ` Miguel Ojeda
2023-10-21 16:03         ` Andrew Lunn
2023-10-22 12:57           ` Miguel Ojeda
2023-10-24  0:57       ` Stephen Boyd
2023-10-25 23:55         ` Boqun Feng
2023-11-01 15:04       ` Linus Walleij
2023-10-31 18:31   ` Matthew Maurer
2023-11-28 18:29     ` Boqun Feng
2023-12-13 19:00     ` Miguel Ojeda
2024-01-22  2:01   ` Fabien Parent
2024-01-22  5:27   ` Behme Dirk (CM/ESO2)
2024-01-22  9:30   ` Alice Ryhl
2024-02-09 17:38 ` [PATCH v4 0/2] Rust enablement " Catalin Marinas
2024-02-09 21:41   ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZTT/h5wKL7STeOhC@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=Jamie.Cunliffe@arm.com \
    --cc=andrew@lunn.ch \
    --cc=boqun.feng@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=lina@asahilina.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mingo@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=steve.capper@arm.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).