Hi all, Today's linux-next merge of the rust tree got a conflict in: Makefile between commit: 6f5b41a2f5a6 ("Makefile: move initial clang flag handling into scripts/Makefile.clang") 231ad7f409f1 ("Makefile: infer --target from ARCH for CC=clang") f12b034afeb3 ("scripts/Makefile.clang: default to LLVM_IAS=1") from the kbuild tree and commit: e17f1b1f3e01 ("Makefile: generate `CLANG_FLAGS` even in GCC builds") from the rust tree. I fixed it up (Makefile fix up at the bottom, plus the following patch) 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: Wed, 11 Aug 2021 17:18:36 +1000 Subject: [PATCH] fixup for rust integration with Makefile.clang creation Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> --- Makefile | 17 ----------------- scripts/Makefile.clang | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 5d504a1dcb06..3638ce07f208 100644 --- a/Makefile +++ b/Makefile @@ -625,24 +625,7 @@ endif # and from include/config/auto.conf.cmd to detect the compiler upgrade. CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1)) -TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option - -ifneq ($(CROSS_COMPILE),) -TENTATIVE_CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) -endif -ifeq ($(LLVM_IAS),1) -TENTATIVE_CLANG_FLAGS += -integrated-as -else -TENTATIVE_CLANG_FLAGS += -no-integrated-as -GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) -TENTATIVE_CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) -endif - -export TENTATIVE_CLANG_FLAGS - -ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) include $(srctree)/scripts/Makefile.clang -endif # Include this also for config targets because some architectures need # cc-cross-prefix to determine CROSS_COMPILE. diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang index 3ae63bd35582..555b5255d9b3 100644 --- a/scripts/Makefile.clang +++ b/scripts/Makefile.clang @@ -12,24 +12,31 @@ CLANG_TARGET_FLAGS_s390 := s390x-linux-gnu CLANG_TARGET_FLAGS_x86 := x86_64-linux-gnu CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(SRCARCH)) +TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option + ifeq ($(CROSS_COMPILE),) ifeq ($(CLANG_TARGET_FLAGS),) $(error Specify CROSS_COMPILE or add '--target=' option to scripts/Makefile.clang) else -CLANG_FLAGS += --target=$(CLANG_TARGET_FLAGS) +TENTATIVE_CLANG_FLAGS += --target=$(CLANG_TARGET_FLAGS) endif # CLANG_TARGET_FLAGS else -CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) +TENTATIVE_CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) endif # CROSS_COMPILE ifeq ($(LLVM_IAS),0) -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)) else -CLANG_FLAGS += -integrated-as +TENTATIVE_CLANG_FLAGS += -integrated-as endif -CLANG_FLAGS += -Werror=unknown-warning-option + +export TENTATIVE_CLANG_FLAGS + +ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) +CLANG_FLAGS += $(TENTATIVE_CLANG_FLAGS) KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_AFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS +endif -- 2.30.2 -- Cheers, Stephen Rothwell diff --cc Makefile index fcda81da6c20,c814b209b6c9..000000000000 --- a/Makefile +++ b/Makefile @@@ -581,10 -613,28 +623,25 @@@ endi # 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)) +CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1)) + TENTATIVE_CLANG_FLAGS := -Werror=unknown-warning-option + + ifneq ($(CROSS_COMPILE),) + TENTATIVE_CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) + endif + ifeq ($(LLVM_IAS),1) + TENTATIVE_CLANG_FLAGS += -integrated-as + else + TENTATIVE_CLANG_FLAGS += -no-integrated-as + GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) + TENTATIVE_CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) + endif + + export TENTATIVE_CLANG_FLAGS + ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) -CLANG_FLAGS += $(TENTATIVE_CLANG_FLAGS) -KBUILD_CFLAGS += $(CLANG_FLAGS) -KBUILD_AFLAGS += $(CLANG_FLAGS) -export CLANG_FLAGS +include $(srctree)/scripts/Makefile.clang endif # Include this also for config targets because some architectures need @@@ -713,12 -763,11 +770,12 @@@ $(KCONFIG_CONFIG) # This exploits the 'multi-target pattern rule' trick. # The syncconfig should be executed only once to make all the targets. # (Note: use the grouped target '&:' when we bump to GNU Make 4.3) -quiet_cmd_syncconfig = SYNC $@ - cmd_syncconfig = $(MAKE) -f $(srctree)/Makefile syncconfig - +# +# Do not use $(call cmd,...) here. That would suppress prompts from syncconfig, +# so you cannot notice that Kconfig is waiting for the user input. - %/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h: $(KCONFIG_CONFIG) + %/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h %/generated/rustc_cfg: $(KCONFIG_CONFIG) - +$(call cmd,syncconfig) + $(Q)$(kecho) " SYNC $@" + $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig else # !may-sync-config # External modules and some install targets need include/generated/autoconf.h # and include/config/auto.conf but do not care if they are up-to-date. @@@ -848,8 -926,13 +939,13 @@@ els DEBUG_CFLAGS += -g endif -ifneq ($(LLVM_IAS),1) +ifndef CONFIG_AS_IS_LLVM KBUILD_AFLAGS += -Wa,-gdwarf-2 + ifdef CONFIG_DEBUG_INFO_REDUCED + DEBUG_RUSTFLAGS += -Cdebuginfo=1 + else + DEBUG_RUSTFLAGS += -Cdebuginfo=2 + endif endif ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT @@@ -1201,9 -1327,12 +1305,12 @@@ archprepare: outputmakefile archheader prepare0: archprepare $(Q)$(MAKE) $(build)=scripts/mod $(Q)$(MAKE) $(build)=. + ifdef CONFIG_RUST + $(Q)$(MAKE) $(build)=rust + endif # All the preparing.. -prepare: prepare0 prepare-objtool prepare-resolve_btfids +prepare: prepare0 PHONY += remove-stale-files remove-stale-files:
Attachment:
pgpznQDzkvgdH.pgp
Description: OpenPGP digital signature