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

From: [email-masked]
Date: Tue, 27 Sep 2022 19:16:47 +0100

Hi all,

FIXME: Add owner of second tree to To:
       Add author(s)/SOB of conflicting commits.

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

  Makefile

between commit:

  0cc1b22fa606e ("kbuild: list sub-directories in ./Kbuild")
  ca5f20da2ffcb ("kbuild: move .vmlinux.objs rule to Makefile.modpost")

from the kbuild tree and commit:

  d64ddbd68af8f ("Kbuild: add Rust support")

from the rust tree.

I fixed it up (see 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.

diff --cc Makefile
index 2b4980490ecb2,c759ee3152544..0000000000000
--- a/Makefile
+++ b/Makefile
@@@ -789,7 -862,11 +861,10 @@@ KBUILD_CFLAGS += $(stackp-flags-y
  
  KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
  KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
 -KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
  
+ KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
+ KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
+ 
  ifdef CONFIG_CC_IS_CLANG
  KBUILD_CPPFLAGS += -Qunused-arguments
  # The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
@@@ -1098,9 -1182,16 +1179,8 @@@ export MODORDER := $(extmod_prefix)modu
  export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
  
  ifeq ($(KBUILD_EXTMOD),)
 -core-y			+= kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
 -core-$(CONFIG_BLOCK)	+= block/
 -core-$(CONFIG_IO_URING)	+= io_uring/
 -core-$(CONFIG_RUST)	+= rust/
 -
 -vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, \
 -		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
 -		     $(libs-y) $(libs-m)))
--
 -vmlinux-alldirs	:= $(sort $(vmlinux-dirs) Documentation \
 +build-dir	:= .
 +clean-dirs	:= $(sort . Documentation \
  		     $(patsubst %/,%,$(filter %/, $(core-) \
  			$(drivers-) $(libs-))))
  
@@@ -1497,7 -1585,7 +1581,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          \
diff --git a/Kbuild b/Kbuild
index 8a37584d1fd6b..5f4a23fc87b63 100644
--- a/Kbuild
+++ b/Kbuild
@@ -91,6 +91,7 @@ obj-$(CONFIG_BLOCK)	+= block/
 obj-$(CONFIG_IO_URING)	+= io_uring/
 obj-y			+= $(ARCH_LIB)
 obj-y			+= drivers/
+obj-$(CONFIG_RUST)	+= rust/
 obj-y			+= sound/
 obj-$(CONFIG_SAMPLES)	+= samples/
 obj-$(CONFIG_NET)	+= net/