linux-next: manual merge of the rust tree with the kbuild tree

From: Stephen Rothwell
Date: Mon Sep 12 2022 - 03:41:28 EST


Hi all,

Today's linux-next merge of the rust tree got a conflict in:

Makefile

between commits:

d0d7e9163953 ("kbuild: move .vmlinux.objs rule to Makefile.modpost")
1e9657fb4b8f ("kbuild: move core-y and drivers-y to ./Kbuild")

from the kbuild tree and commit:

4f6a738b5c34 ("Kbuild: add Rust support")

from the rust tree.

I fixed it up (see at the end and the merge fix patch below) and can
carry the fix as necessary. This is now fixed as far as linux-next is
concerned, but any non trivial conflicts should be mentioned to your
upstream maintainer when your tree is submitted for merging. You may
also want to consider cooperating with the maintainer of the
conflicting tree to minimise any particularly complex conflicts.

From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Date: Mon, 12 Sep 2022 17:38:35 +1000
Subject: [PATCH] rust: fix up for "kbuild: move core-y and drivers-y to ./Kbuild"

Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
---
Kbuild | 1 +
1 file changed, 1 insertion(+)

diff --git a/Kbuild b/Kbuild
index 8854e88e0619..253e9f789cf6 100644
--- a/Kbuild
+++ b/Kbuild
@@ -89,6 +89,7 @@ obj-y += security/
obj-y += crypto/
obj-$(CONFIG_BLOCK) += block/
obj-$(CONFIG_IO_URING) += io_uring/
+obj-$(CONFIG_RUST) += rust/
obj-y += drivers/
obj-y += sound/
obj-$(CONFIG_SAMPLES) += samples/
--
2.35.1

--
Cheers,
Stephen Rothwell

diff --cc Makefile
index f8413c411923,a105cb893b4c..000000000000
--- a/Makefile
+++ b/Makefile
@@@ -757,10 -819,20 +821,17 @@@ KBUILD_CFLAGS += $(call cc-disable-warn

ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
KBUILD_CFLAGS += -O2
+ KBUILD_RUSTFLAGS += -Copt-level=2
-else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
-KBUILD_CFLAGS += -O3
-KBUILD_RUSTFLAGS += -Copt-level=3
else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
+ KBUILD_RUSTFLAGS += -Copt-level=s
endif

+ # Always set `debug-assertions` and `overflow-checks` because their default
+ # depends on `opt-level` and `debug-assertions`, respectively.
+ KBUILD_RUSTFLAGS += -Cdebug-assertions=$(if $(CONFIG_RUST_DEBUG_ASSERTIONS),y,n)
+ KBUILD_RUSTFLAGS += -Coverflow-checks=$(if $(CONFIG_RUST_OVERFLOW_CHECKS),y,n)
+
# Tell gcc to never replace conditional load with a non-conditional one
ifdef CONFIG_CC_IS_GCC
# gcc-10 renamed --param=allow-store-data-races=0 to
@@@ -1505,7 -1576,7 +1589,8 @@@ endif # CONFIG_MODULE
# Directories & files removed with 'make clean'
CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
modules.builtin modules.builtin.modinfo modules.nsdeps \
- compile_commands.json .thinlto-cache .vmlinux.objs
- compile_commands.json .thinlto-cache rust/test rust/doc
++ compile_commands.json .thinlto-cache .vmlinux.objs \
++ rust/test rust/doc

# Directories & files removed with 'make mrproper'
MRPROPER_FILES += include/config include/generated \

Attachment: pgpM6Up0uHXQY.pgp
Description: OpenPGP digital signature