Commit 214c0eea authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

kbuild: add $(objtree)/ prefix to some in-kernel build artifacts



$(objtree) refers to the top of the output directory of kernel builds.

This commit adds the explicit $(objtree)/ prefix to build artifacts
needed for building external modules.

This change has no immediate impact, as the top-level Makefile
currently defines:

  objtree         := .

This commit prepares for supporting the building of external modules
in a different directory.

Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
parent 0afd73c5
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -354,7 +354,7 @@ else # !mixed-build
include $(srctree)/scripts/Kbuild.include

# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(call read-file, include/config/kernel.release)
KERNELRELEASE = $(call read-file, $(objtree)/include/config/kernel.release)
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION

@@ -720,7 +720,7 @@ endif
export KBUILD_MODULES KBUILD_BUILTIN

ifdef need-config
include include/config/auto.conf
include $(objtree)/include/config/auto.conf
endif

ifeq ($(KBUILD_EXTMOD),)
@@ -783,13 +783,13 @@ else # !may-sync-config
# and include/config/auto.conf but do not care if they are up-to-date.
# Use auto.conf to show the error message

checked-configs := include/generated/autoconf.h include/generated/rustc_cfg include/config/auto.conf
checked-configs := $(addprefix $(objtree)/, include/generated/autoconf.h include/generated/rustc_cfg include/config/auto.conf)
missing-configs := $(filter-out $(wildcard $(checked-configs)), $(checked-configs))

ifdef missing-configs
PHONY += include/config/auto.conf
PHONY += $(objtree)/include/config/auto.conf

include/config/auto.conf:
$(objtree)/include/config/auto.conf:
	@echo   >&2 '***'
	@echo   >&2 '***  ERROR: Kernel configuration is invalid. The following files are missing:'
	@printf >&2 '***    - %s\n' $(missing-configs)
+2 −2
Original line number Diff line number Diff line
@@ -264,13 +264,13 @@ stack_protector_prepare: prepare0
		-mstack-protector-guard=tls \
		-mstack-protector-guard-offset=$(shell	\
			awk '{if ($$2 == "TSK_STACK_CANARY") print $$3;}'\
				include/generated/asm-offsets.h))
				$(objtree)/include/generated/asm-offsets.h))
else
stack_protector_prepare: prepare0
	$(eval SSP_PLUGIN_CFLAGS := \
		-fplugin-arg-arm_ssp_per_task_plugin-offset=$(shell	\
			awk '{if ($$2 == "TSK_STACK_CANARY") print $$3;}'\
				include/generated/asm-offsets.h))
				$(objtree)/include/generated/asm-offsets.h))
	$(eval KBUILD_CFLAGS += $(SSP_PLUGIN_CFLAGS))
	$(eval GCC_PLUGINS_CFLAGS += $(SSP_PLUGIN_CFLAGS))
endif
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ stack_protector_prepare: prepare0
				-mstack-protector-guard-reg=sp_el0	  \
				-mstack-protector-guard-offset=$(shell	  \
			awk '{if ($$2 == "TSK_STACK_CANARY") print $$3;}' \
					include/generated/asm-offsets.h))
				$(objtree)/include/generated/asm-offsets.h))
endif

ifeq ($(CONFIG_ARM64_BTI_KERNEL),y)
+2 −2
Original line number Diff line number Diff line
@@ -402,9 +402,9 @@ prepare: stack_protector_prepare
PHONY += stack_protector_prepare
stack_protector_prepare: prepare0
ifdef CONFIG_PPC64
	$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
	$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' $(objtree)/include/generated/asm-offsets.h))
else
	$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
	$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' $(objtree)/include/generated/asm-offsets.h))
endif
endif

+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ stack_protector_prepare: prepare0
				-mstack-protector-guard-reg=tp		  \
				-mstack-protector-guard-offset=$(shell	  \
			awk '{if ($$2 == "TSK_STACK_CANARY") print $$3;}' \
					include/generated/asm-offsets.h))
				$(objtree)/include/generated/asm-offsets.h))
endif

# arch specific predefines for sparse
Loading