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

From: Stephen Rothwell <[email-masked]>
Date: Mon, 29 Mar 2021 18:32:52 +1100

Hi all,

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

  Makefile

between commit:

  b0600f0d9b54 ("kbuild: check the minimum assembler version in Kconfig")

from the kbuild tree and commit:

  98898dfbdf72 ("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.

-- 
Cheers,
Stephen Rothwell

diff --cc Makefile
index 072e7a6a1a75,62b3bba38635..f86d011caedf
--- a/Makefile
+++ b/Makefile
@@@ -263,11 -270,7 +270,11 @@@ no-dot-config-targets := $(clean-target
  			 cscope gtags TAGS tags help% %docs check% coccicheck \
  			 $(version_h) headers headers_% archheaders archscripts \
  			 %asm-generic kernelversion %src-pkg dt_binding_check \
- 			 outputmakefile
+ 			 outputmakefile rustfmt rustfmtcheck
 +# Installation targets should not require compiler. Unfortunately, vdso_install
 +# is an exception where build artifacts may be updated. This must be fixed.
 +no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
 +			headers_install modules_install kernelrelease image_name
  no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
  			  image_name
  single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
@@@ -567,24 -588,31 +596,29 @@@ ifdef building_out_of_srctre
  	{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
  endif
  
- # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
- # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
- # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
- # and from include/config/auto.conf.cmd to detect the compiler upgrade.
- CC_VERSION_TEXT = $(subst $(pound),,$(shell $(CC) --version 2>/dev/null | head -n 1))
+ TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option
  
- ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
  ifneq ($(CROSS_COMPILE),)
- CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
+ TENTATIVE_CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
 -GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
 -TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
 -GCC_TOOLCHAIN	:= $(realpath $(GCC_TOOLCHAIN_DIR)/..)
 -endif
 -ifneq ($(GCC_TOOLCHAIN),)
 -TENTATIVE_CLANG_FLAGS	+= --gcc-toolchain=$(GCC_TOOLCHAIN)
  endif
 -ifneq ($(LLVM_IAS),1)
 +ifeq ($(LLVM_IAS),1)
- CLANG_FLAGS	+= -integrated-as
++TENTATIVE_CLANG_FLAGS	+= -integrated-as
 +else
- CLANG_FLAGS	+= -no-integrated-as
+ TENTATIVE_CLANG_FLAGS	+= -no-integrated-as
 +GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
- CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
++TENTATIVE_CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
  endif
- CLANG_FLAGS	+= -Werror=unknown-warning-option
+ 
+ export TENTATIVE_CLANG_FLAGS
+ 
+ # The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
+ # Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
+ # CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
+ # and from include/config/auto.conf.cmd to detect the compiler upgrade.
+ CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1 | sed 's/\#//g')
+ 
+ ifneq ($(findstring clang,$(CC_VERSION_TEXT)),)
+ CLANG_FLAGS	+= $(TENTATIVE_CLANG_FLAGS)
  KBUILD_CFLAGS	+= $(CLANG_FLAGS)
  KBUILD_AFLAGS	+= $(CLANG_FLAGS)
  export CLANG_FLAGS