Skip to content

Commit afa6026

Browse files
authored
Merge pull request torvalds#694 from ojeda/target
rust: generate target specification files on the fly
2 parents 78e2b26 + afba78e commit afa6026

File tree

17 files changed

+338
-276
lines changed

17 files changed

+338
-276
lines changed

Documentation/kbuild/makefiles.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,9 @@ When kbuild executes, the following steps are followed (roughly):
12051205

12061206
Often, the KBUILD_RUSTFLAGS variable depends on the configuration.
12071207

1208+
Note that target specification file generation (for ``--target``)
1209+
is handled in ``scripts/generate_rust_target.rs``.
1210+
12081211
KBUILD_AFLAGS_KERNEL
12091212
Assembler options specific for built-in
12101213

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
551551
-Werror=return-type -Wno-format-security \
552552
-std=gnu89
553553
KBUILD_CPPFLAGS := -D__KERNEL__
554-
KBUILD_RUST_TARGET := $(srctree)/arch/$(SRCARCH)/rust/target.json
555554
KBUILD_RUSTFLAGS := $(rust_common_flags) \
556555
-Cpanic=abort -Cembed-bitcode=n -Clto=n -Crpath=n \
557556
-Cforce-unwind-tables=n -Ccodegen-units=1 \
@@ -592,7 +591,7 @@ export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
592591

593592
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
594593
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
595-
export KBUILD_RUST_TARGET KBUILD_RUSTFLAGS RUSTFLAGS_KERNEL RUSTFLAGS_MODULE
594+
export KBUILD_RUSTFLAGS RUSTFLAGS_KERNEL RUSTFLAGS_MODULE
596595
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
597596
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_RUSTFLAGS_MODULE KBUILD_LDFLAGS_MODULE
598597
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL KBUILD_RUSTFLAGS_KERNEL
@@ -1578,7 +1577,7 @@ MRPROPER_FILES += include/config include/generated \
15781577
certs/x509.genkey \
15791578
vmlinux-gdb.py \
15801579
*.spec \
1581-
rust/libmacros.so
1580+
rust/target.json rust/libmacros.so
15821581

15831582
# clean - Delete most, but leave enough to build external modules
15841583
#

arch/arm/rust/target.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

arch/arm64/rust/target.json

Lines changed: 0 additions & 34 deletions
This file was deleted.

arch/powerpc/rust/target.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

arch/riscv/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ riscv-march-$(toolchain-need-zicsr-zifencei) := $(riscv-march-y)_zicsr_zifencei
5858

5959
KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y))
6060
KBUILD_AFLAGS += -march=$(riscv-march-y)
61-
KBUILD_RUST_TARGET := $(srctree)/arch/riscv/rust/$(subst fd,,$(riscv-march-y)).json
6261

6362
KBUILD_CFLAGS += -mno-save-restore
6463
KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET)

arch/riscv/rust/rv32ima.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

arch/riscv/rust/rv32imac.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

arch/riscv/rust/rv64ima.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

arch/riscv/rust/rv64imac.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)