From 813af51f5d30a2da6a2523c08465f9726e51772e Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Mon, 12 Nov 2018 14:51:16 +1030 Subject: powerpc/boot: Set target when cross-compiling for clang Clang needs to be told which target it is building for when cross compiling. Link: https://github.com/ClangBuiltLinux/linux/issues/259 Signed-off-by: Joel Stanley Tested-by: Daniel Axtens # powerpc 64-bit BE Acked-by: Michael Ellerman Reviewed-by: Nick Desaulniers Signed-off-by: Masahiro Yamada --- arch/powerpc/boot/Makefile | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch') diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 39354365f54a..111f97b1ccec 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -55,6 +55,11 @@ BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc BOOTARFLAGS := -cr$(KBUILD_ARFLAGS) +ifdef CONFIG_CC_IS_CLANG +BOOTCFLAGS += $(CLANG_FLAGS) +BOOTAFLAGS += $(CLANG_FLAGS) +endif + ifdef CONFIG_DEBUG_INFO BOOTCFLAGS += -g endif -- cgit v1.2.3-59-g8ed1b From 65bba0423ecf89fb291d2269e0087707888a1cef Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 29 Nov 2018 11:58:50 +0900 Subject: kbuild: fix UML build error with CONFIG_GCC_PLUGINS UML fails to build with CONFIG_GCC_PLUGINS=y. $ make -s ARCH=um mrproper $ make -s ARCH=um allmodconfig $ make ARCH=um UPD include/generated/uapi/linux/version.h WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h WRAP arch/x86/include/generated/uapi/asm/poll.h WRAP arch/x86/include/generated/asm/dma-contiguous.h WRAP arch/x86/include/generated/asm/early_ioremap.h WRAP arch/x86/include/generated/asm/export.h WRAP arch/x86/include/generated/asm/mcs_spinlock.h WRAP arch/x86/include/generated/asm/mm-arch-hooks.h SYSTBL arch/x86/include/generated/asm/syscalls_32.h SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h SYSTBL arch/x86/include/generated/asm/syscalls_64.h SYSHDR arch/x86/include/generated/uapi/asm/unistd_32.h SYSHDR arch/x86/include/generated/uapi/asm/unistd_64.h SYSHDR arch/x86/include/generated/uapi/asm/unistd_x32.h HOSTCC scripts/unifdef CC arch/x86/um/user-offsets.s cc1: error: cannot load plugin ./scripts/gcc-plugins/cyc_complexity_plugin.so ./scripts/gcc-plugins/cyc_complexity_plugin.so: cannot open shared object file: No such file or directory cc1: error: cannot load plugin ./scripts/gcc-plugins/structleak_plugin.so ./scripts/gcc-plugins/structleak_plugin.so: cannot open shared object file: No such file or directory cc1: error: cannot load plugin ./scripts/gcc-plugins/latent_entropy_plugin.so ./scripts/gcc-plugins/latent_entropy_plugin.so: cannot open shared object file: No such file or directory cc1: error: cannot load plugin ./scripts/gcc-plugins/randomize_layout_plugin.so ./scripts/gcc-plugins/randomize_layout_plugin.so: cannot open shared object file: No such file or directory make[1]: *** [scripts/Makefile.build;119: arch/x86/um/user-offsets.s] Error 1 make: *** [arch/um/Makefile;152: arch/x86/um/user-offsets.s] Error 2 Reorder the preparation stage (with cleanups) to make sure gcc-plugins is built before descending to arch/x86/um/. Fixes: 6b90bd4ba40b ("GCC plugin infrastructure") Reported-by: kbuild test robot Signed-off-by: Masahiro Yamada --- Makefile | 4 ++-- arch/um/Makefile | 24 ++---------------------- arch/x86/um/Makefile | 4 +++- 3 files changed, 7 insertions(+), 25 deletions(-) (limited to 'arch') diff --git a/Makefile b/Makefile index b2519b9b3599..bfab340453c6 100644 --- a/Makefile +++ b/Makefile @@ -1110,9 +1110,9 @@ prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h macroprepare: prepare1 archmacros -archprepare: archheaders archscripts macroprepare scripts_basic +archprepare: archheaders archscripts macroprepare scripts_basic gcc-plugins -prepare0: archprepare gcc-plugins +prepare0: archprepare $(Q)$(MAKE) $(build)=. # All the preparing.. diff --git a/arch/um/Makefile b/arch/um/Makefile index ab1066c38944..c08035904849 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -116,7 +116,8 @@ endef archheaders: $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) asm-generic archheaders -archprepare: include/generated/user_constants.h +archprepare: + $(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib $(call cc-option, -no-pie) @@ -146,25 +147,4 @@ archclean: @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ -o -name '*.gcov' \) -type f -print | xargs rm -f -# Generated files - -$(HOST_DIR)/um/user-offsets.s: __headers FORCE - $(Q)$(MAKE) $(build)=$(HOST_DIR)/um $@ - -define filechk_gen-asm-offsets - (set -e; \ - echo "/*"; \ - echo " * DO NOT MODIFY."; \ - echo " *"; \ - echo " * This file was generated by arch/$(ARCH)/Makefile"; \ - echo " *"; \ - echo " */"; \ - echo ""; \ - sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" < $<; \ - echo ""; ) -endef - -include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s - $(call filechk,gen-asm-offsets) - export HEADER_ARCH SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH diff --git a/arch/x86/um/Makefile b/arch/x86/um/Makefile index c2d3d7c51e9e..17924646467c 100644 --- a/arch/x86/um/Makefile +++ b/arch/x86/um/Makefile @@ -36,10 +36,12 @@ subarch-$(CONFIG_MODULES) += ../kernel/module.o USER_OBJS := bugs_$(BITS).o ptrace_user.o fault.o -extra-y += user-offsets.s $(obj)/user-offsets.s: c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \ -Iarch/x86/include/generated +include/generated/user_constants.h: $(obj)/user-offsets.s + $(call filechk,offsets,__USER_CONSTANT_H__) + UNPROFILE_OBJS := stub_segv.o CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING) -- cgit v1.2.3-59-g8ed1b From 8e9b61b293d98f878cf1e6d1ae164e41c0219959 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 1 Dec 2018 09:27:15 +0900 Subject: kbuild: move .SECONDARY special target to Kbuild.include In commit 54a702f70589 ("kbuild: mark $(targets) as .SECONDARY and remove .PRECIOUS markers"), I missed one important feature of the .SECONDARY target: .SECONDARY with no prerequisites causes all targets to be treated as secondary. ... which agrees with the policy of Kbuild. Let's move it to scripts/Kbuild.include, with no prerequisites. Note: If an intermediate file is generated by $(call if_changed,...), you still need to add it to "targets" so its .*.cmd file is included. The arm/arm64 crypto files are generated by $(call cmd,shipped), so they do not need to be added to "targets", but need to be added to "clean-files" so "make clean" can properly clean them away. Signed-off-by: Masahiro Yamada --- arch/arm/crypto/Makefile | 2 +- arch/arm64/crypto/Makefile | 2 +- scripts/Kbuild.include | 3 +++ scripts/Makefile.build | 4 ---- 4 files changed, 5 insertions(+), 6 deletions(-) (limited to 'arch') diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile index bd5bceef0605..89f88abba698 100644 --- a/arch/arm/crypto/Makefile +++ b/arch/arm/crypto/Makefile @@ -65,4 +65,4 @@ $(src)/sha512-core.S_shipped: $(src)/sha512-armv4.pl $(call cmd,perl) endif -targets += sha256-core.S sha512-core.S +clean-files += sha256-core.S sha512-core.S diff --git a/arch/arm64/crypto/Makefile b/arch/arm64/crypto/Makefile index f476fede09ba..860d9312ccf9 100644 --- a/arch/arm64/crypto/Makefile +++ b/arch/arm64/crypto/Makefile @@ -75,4 +75,4 @@ $(src)/sha512-core.S_shipped: $(src)/sha512-armv8.pl $(call cmd,perlasm) endif -targets += sha256-core.S sha512-core.S +clean-files += sha256-core.S sha512-core.S diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 87e188609ef7..4f138620865b 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -358,3 +358,6 @@ endef # delete partially updated (i.e. corrupted) files on error .DELETE_ON_ERROR: + +# do not delete intermediate files automatically +.SECONDARY: diff --git a/scripts/Makefile.build b/scripts/Makefile.build index ed9b6467ebde..aa05423c8418 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -529,8 +529,4 @@ $(shell mkdir -p $(obj-dirs)) endif endif -# Some files contained in $(targets) are intermediate artifacts. -# We never want them to be removed automatically. -.SECONDARY: $(targets) - .PHONY: $(PHONY) -- cgit v1.2.3-59-g8ed1b From 733f4ef46d3ea31e44cebfec851528089a783f0f Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 20 Dec 2018 18:27:26 +0900 Subject: um: remove unused filechk_gen_header in Makefile This is a leftover of commit ecba97d4aacf ("[PATCH] uml makefiles sanitized"). Signed-off-by: Masahiro Yamada --- arch/um/Makefile | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch') diff --git a/arch/um/Makefile b/arch/um/Makefile index c08035904849..273130cf91d1 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -23,8 +23,6 @@ OS := $(shell uname -s) # features. SHELL := /bin/bash -filechk_gen_header = $< - core-y += $(ARCH_DIR)/kernel/ \ $(ARCH_DIR)/drivers/ \ $(ARCH_DIR)/os-$(OS)/ -- cgit v1.2.3-59-g8ed1b From 4d4b5c2e3b6e6137c36cc13fe0d03404205afbd0 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 22 Dec 2018 18:50:33 +0900 Subject: treewide: remove explicit rules for *offsets.s These explicit rules are unneeded because scripts/Makefile.build provides a pattern rule to create %.s from %.c Signed-off-by: Masahiro Yamada --- Kbuild | 9 +-------- arch/arm/mach-at91/Makefile | 3 --- arch/arm/mach-omap2/Makefile | 3 --- arch/ia64/kernel/Makefile | 5 ----- drivers/memory/Makefile.asm-offsets | 3 --- samples/bpf/Makefile | 3 --- 6 files changed, 1 insertion(+), 25 deletions(-) (limited to 'arch') diff --git a/Kbuild b/Kbuild index 005304205482..b24210cb4dfe 100644 --- a/Kbuild +++ b/Kbuild @@ -16,10 +16,6 @@ bounds-file := include/generated/bounds.h always := $(bounds-file) targets := kernel/bounds.s -# We use internal kbuild rules to avoid the "is up to date" message from make -kernel/bounds.s: kernel/bounds.c FORCE - $(call if_changed_dep,cc_s_c) - $(obj)/$(bounds-file): kernel/bounds.s FORCE $(call filechk,offsets,__LINUX_BOUNDS_H__) @@ -50,10 +46,7 @@ offsets-file := include/generated/asm-offsets.h always += $(offsets-file) targets += arch/$(SRCARCH)/kernel/asm-offsets.s -# We use internal kbuild rules to avoid the "is up to date" message from make -arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \ - $(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE - $(call if_changed_dep,cc_s_c) +arch/$(SRCARCH)/kernel/asm-offsets.s: $(obj)/$(timeconst-file) $(obj)/$(bounds-file) $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE $(call filechk,offsets,__ASM_OFFSETS_H__) diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 7415f181907b..f87066b60836 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -19,9 +19,6 @@ ifeq ($(CONFIG_PM_DEBUG),y) CFLAGS_pm.o += -DDEBUG endif -arch/arm/mach-at91/pm_data-offsets.s: arch/arm/mach-at91/pm_data-offsets.c - $(call if_changed_dep,cc_s_c) - include/generated/at91_pm_data-offsets.h: arch/arm/mach-at91/pm_data-offsets.s FORCE $(call filechk,offsets,__PM_DATA_OFFSETS_H__) diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 01377c292db4..55c482c2bab1 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -236,9 +236,6 @@ obj-y += omap_phy_internal.o obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o -arch/arm/mach-omap2/pm-asm-offsets.s: arch/arm/mach-omap2/pm-asm-offsets.c - $(call if_changed_dep,cc_s_c) - include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s FORCE $(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__) diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile index d0c0ccdd656a..7372d994b44e 100644 --- a/arch/ia64/kernel/Makefile +++ b/arch/ia64/kernel/Makefile @@ -50,10 +50,5 @@ CFLAGS_traps.o += -mfixed-range=f2-f5,f16-f31 # The gate DSO image is built using a special linker script. include $(src)/Makefile.gate -# We use internal kbuild rules to avoid the "is up to date" message from make -arch/$(SRCARCH)/kernel/nr-irqs.s: arch/$(SRCARCH)/kernel/nr-irqs.c - $(Q)mkdir -p $(dir $@) - $(call if_changed_dep,cc_s_c) - include/generated/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s FORCE $(call filechk,offsets,__ASM_NR_IRQS_H__) diff --git a/drivers/memory/Makefile.asm-offsets b/drivers/memory/Makefile.asm-offsets index 843ff60ccb5a..f968dfa71d8e 100644 --- a/drivers/memory/Makefile.asm-offsets +++ b/drivers/memory/Makefile.asm-offsets @@ -1,5 +1,2 @@ -drivers/memory/emif-asm-offsets.s: drivers/memory/emif-asm-offsets.c - $(call if_changed_dep,cc_s_c) - include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s FORCE $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index be0a961450bc..100a49d35c77 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -227,9 +227,6 @@ $(LIBBPF): FORCE # Fix up variables inherited from Kbuild that tools/ build system won't like $(MAKE) -C $(dir $@) RM='rm -rf' LDFLAGS= srctree=$(BPF_SAMPLES_PATH)/../../ O= -$(obj)/syscall_nrs.s: $(src)/syscall_nrs.c - $(call if_changed_dep,cc_s_c) - $(obj)/syscall_nrs.h: $(obj)/syscall_nrs.s FORCE $(call filechk,offsets,__SYSCALL_NRS_H__) -- cgit v1.2.3-59-g8ed1b From 2c667d77fc02dd453c49b9c29d08a8bb55d60ebe Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 22 Dec 2018 18:50:34 +0900 Subject: treewide: add intermediate .s files to targets Avoid unneeded recreation of these in the incremental build. Signed-off-by: Masahiro Yamada --- arch/arm/mach-at91/Makefile | 2 ++ arch/arm/mach-omap2/Makefile | 2 ++ arch/ia64/kernel/Makefile | 2 ++ arch/x86/um/Makefile | 1 + drivers/memory/Makefile.asm-offsets | 2 ++ samples/bpf/Makefile | 1 + 6 files changed, 10 insertions(+) (limited to 'arch') diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index f87066b60836..31b61f0e1c07 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -23,3 +23,5 @@ include/generated/at91_pm_data-offsets.h: arch/arm/mach-at91/pm_data-offsets.s F $(call filechk,offsets,__PM_DATA_OFFSETS_H__) arch/arm/mach-at91/pm_suspend.o: include/generated/at91_pm_data-offsets.h + +targets += pm_data-offsets.s diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 55c482c2bab1..4afdf56964c9 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -240,3 +240,5 @@ include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s FORC $(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__) $(obj)/sleep33xx.o $(obj)/sleep43xx.o: include/generated/ti-pm-asm-offsets.h + +targets += pm-asm-offsets.s diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile index 7372d994b44e..4ba05140b249 100644 --- a/arch/ia64/kernel/Makefile +++ b/arch/ia64/kernel/Makefile @@ -52,3 +52,5 @@ include $(src)/Makefile.gate include/generated/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s FORCE $(call filechk,offsets,__ASM_NR_IRQS_H__) + +targets += nr-irqs.s diff --git a/arch/x86/um/Makefile b/arch/x86/um/Makefile index 17924646467c..2d686ae54681 100644 --- a/arch/x86/um/Makefile +++ b/arch/x86/um/Makefile @@ -38,6 +38,7 @@ USER_OBJS := bugs_$(BITS).o ptrace_user.o fault.o $(obj)/user-offsets.s: c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \ -Iarch/x86/include/generated +targets += user-offsets.s include/generated/user_constants.h: $(obj)/user-offsets.s $(call filechk,offsets,__USER_CONSTANT_H__) diff --git a/drivers/memory/Makefile.asm-offsets b/drivers/memory/Makefile.asm-offsets index f968dfa71d8e..0447e174c752 100644 --- a/drivers/memory/Makefile.asm-offsets +++ b/drivers/memory/Makefile.asm-offsets @@ -1,2 +1,4 @@ include/generated/ti-emif-asm-offsets.h: drivers/memory/emif-asm-offsets.s FORCE $(call filechk,offsets,__TI_EMIF_ASM_OFFSETS_H__) + +targets += emif-asm-offsets.s diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 100a49d35c77..82d5a3870460 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -230,6 +230,7 @@ $(LIBBPF): FORCE $(obj)/syscall_nrs.h: $(obj)/syscall_nrs.s FORCE $(call filechk,offsets,__SYSCALL_NRS_H__) +targets += syscall_nrs.s clean-files += syscall_nrs.h FORCE: -- cgit v1.2.3-59-g8ed1b