Kbuild fixes for v4.14 (2nd)

- fix O= building on dash
 
 - remove unused dependency in Makefile
 
 - fix default of a choice in Kconfig
 
 - fix typos and documentation style
 
 - fix command options unrecognized by sparse
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJZ9KBpAAoJED2LAQed4NsG85AP/RNrH/uyiLsBWfmicpTOt6Vx
 tHik2cn3TN5TBKcLcdh214zSBCPiJSp/dIvjOmIEssOqxJS001O+jlrnbB938hCn
 xVNs3aeBOx1StNB6DOplRtVe/pEIhSMMsXbIilz5a0kAn1mud73FqWmdXSRVA8zT
 JjI9gCl4pQTkv32Pz9w5HRWI8fweMnvbHfMUJhCaYcIIyN/hqfEzupPAeww4sKkg
 P5z60iif1OMlGgB9ZdWI+giblgLJOV+KoaUh181YEICenpsaf6rpdroP3X879N7i
 Y/le65xLVtc3rUZXoggNcGj04nZ7seSBHDbmicgWu0Fbj8+4nQ9mplVr1g1fLCVc
 Ml3joe24XO0PwXOrOTxCHQHRjqWSRv6cn8X9qIQqSLHkJgryxhZ5DiCGqQRxExLN
 gbKQ82UZSc4jNsOhcfcZ3ls7Ve5ao7rSUueL97acdDRhm+t0OWLmF9cQrX+eBzpj
 NOMaPvym+ucPNSRrhEgwFxDjB8dzVfO8tuYTuwX8HxQc7v5SUWuwsnurAXc3fKF2
 2D+VsU8EHk9IKDmQMIlvlj6R4bSr0bjecedA6czcRLMr83h1fCxvQxBw4UIQIzY0
 4y6QIUX7paMAo/OOqqOm10mBJM6Sr+y2JiGvL4gFhiGbCi3+xvOa7P4hRgPCe2Lq
 +FGPIdh+skAypoc/1VfA
 =0Rbk
 -----END PGP SIGNATURE-----

Merge tag 'kbuild-fixes-v4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - fix O= building on dash

 - remove unused dependency in Makefile

 - fix default of a choice in Kconfig

 - fix typos and documentation style

 - fix command options unrecognized by sparse

* tag 'kbuild-fixes-v4.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: clang: fix build failures with sparse check
  kbuild doc: a bundle of fixes on makefiles.txt
  Makefile: kselftest: fix grammar typo
  kbuild: Fix optimization level choice default
  kbuild: drop unused symverfile in Makefile.modpost
  kbuild: revert $(realpath ...) to $(shell cd ... && /bin/pwd)
This commit is contained in:
Linus Torvalds 2017-10-28 11:01:57 -07:00
commit 25a5d23b47
6 changed files with 28 additions and 24 deletions

View file

@ -1108,14 +1108,6 @@ When kbuild executes, the following steps are followed (roughly):
ld ld
Link target. Often, LDFLAGS_$@ is used to set specific options to ld. Link target. Often, LDFLAGS_$@ is used to set specific options to ld.
objcopy
Copy binary. Uses OBJCOPYFLAGS usually specified in
arch/$(ARCH)/Makefile.
OBJCOPYFLAGS_$@ may be used to set additional options.
gzip
Compress target. Use maximum compression to compress target.
Example: Example:
#arch/x86/boot/Makefile #arch/x86/boot/Makefile
LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
@ -1139,6 +1131,19 @@ When kbuild executes, the following steps are followed (roughly):
resulting in the target file being recompiled for no resulting in the target file being recompiled for no
obvious reason. obvious reason.
objcopy
Copy binary. Uses OBJCOPYFLAGS usually specified in
arch/$(ARCH)/Makefile.
OBJCOPYFLAGS_$@ may be used to set additional options.
gzip
Compress target. Use maximum compression to compress target.
Example:
#arch/x86/boot/compressed/Makefile
$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,gzip)
dtc dtc
Create flattened device tree blob object suitable for linking Create flattened device tree blob object suitable for linking
into vmlinux. Device tree blobs linked into vmlinux are placed into vmlinux. Device tree blobs linked into vmlinux are placed
@ -1219,7 +1224,7 @@ When kbuild executes, the following steps are followed (roughly):
that may be shared between individual architectures. that may be shared between individual architectures.
The recommended approach how to use a generic header file is The recommended approach how to use a generic header file is
to list the file in the Kbuild file. to list the file in the Kbuild file.
See "7.3 generic-y" for further info on syntax etc. See "7.2 generic-y" for further info on syntax etc.
--- 6.11 Post-link pass --- 6.11 Post-link pass
@ -1299,7 +1304,7 @@ See subsequent chapter for the syntax of the Kbuild file.
#arch/x86/include/asm/Kbuild #arch/x86/include/asm/Kbuild
generated-y += syscalls_32.h generated-y += syscalls_32.h
--- 7.5 mandatory-y --- 7.4 mandatory-y
mandatory-y is essentially used by include/uapi/asm-generic/Kbuild.asm mandatory-y is essentially used by include/uapi/asm-generic/Kbuild.asm
to define the minimum set of headers that must be exported in to define the minimum set of headers that must be exported in

View file

@ -130,8 +130,8 @@ endif
ifneq ($(KBUILD_OUTPUT),) ifneq ($(KBUILD_OUTPUT),)
# check that the output directory actually exists # check that the output directory actually exists
saved-output := $(KBUILD_OUTPUT) saved-output := $(KBUILD_OUTPUT)
$(shell [ -d $(KBUILD_OUTPUT) ] || mkdir -p $(KBUILD_OUTPUT)) KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
KBUILD_OUTPUT := $(realpath $(KBUILD_OUTPUT)) && /bin/pwd)
$(if $(KBUILD_OUTPUT),, \ $(if $(KBUILD_OUTPUT),, \
$(error failed to create output directory "$(saved-output)")) $(error failed to create output directory "$(saved-output)"))
@ -697,11 +697,11 @@ KBUILD_CFLAGS += $(stackp-flag)
ifeq ($(cc-name),clang) ifeq ($(cc-name),clang)
ifneq ($(CROSS_COMPILE),) ifneq ($(CROSS_COMPILE),)
CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%)) CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%))
GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..) GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..)
endif endif
ifneq ($(GCC_TOOLCHAIN),) ifneq ($(GCC_TOOLCHAIN),)
CLANG_GCC_TC := -gcc-toolchain $(GCC_TOOLCHAIN) CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN)
endif endif
KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
@ -1399,7 +1399,7 @@ help:
@echo ' Build, install, and boot kernel before' @echo ' Build, install, and boot kernel before'
@echo ' running kselftest on it' @echo ' running kselftest on it'
@echo ' kselftest-clean - Remove all generated kselftest files' @echo ' kselftest-clean - Remove all generated kselftest files'
@echo ' kselftest-merge - Merge all the config dependencies of kselftest to existed' @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existing'
@echo ' .config.' @echo ' .config.'
@echo '' @echo ''
@echo 'Userspace tools targets:' @echo 'Userspace tools targets:'

View file

@ -1033,7 +1033,7 @@ endif
choice choice
prompt "Compiler optimization level" prompt "Compiler optimization level"
default CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE default CC_OPTIMIZE_FOR_PERFORMANCE
config CC_OPTIMIZE_FOR_PERFORMANCE config CC_OPTIMIZE_FOR_PERFORMANCE
bool "Optimize for performance" bool "Optimize for performance"

View file

@ -97,7 +97,6 @@ vmlinux.o: FORCE
$(call cmd,kernel-mod) $(call cmd,kernel-mod)
# Declare generated files as targets for modpost # Declare generated files as targets for modpost
$(symverfile): __modpost ;
$(modules:.ko=.mod.c): __modpost ; $(modules:.ko=.mod.c): __modpost ;

View file

@ -26,7 +26,7 @@ endif
ifneq ($(OUTPUT),) ifneq ($(OUTPUT),)
# check that the output directory actually exists # check that the output directory actually exists
OUTDIR := $(realpath $(OUTPUT)) OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
endif endif

View file

@ -1,7 +1,7 @@
ifneq ($(O),) ifneq ($(O),)
ifeq ($(origin O), command line) ifeq ($(origin O), command line)
ABSOLUTE_O := $(realpath $(O)) dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
dummy := $(if $(ABSOLUTE_O),,$(error O=$(O) does not exist)) ABSOLUTE_O := $(shell cd $(O) ; pwd)
OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
COMMAND_O := O=$(ABSOLUTE_O) COMMAND_O := O=$(ABSOLUTE_O)
ifeq ($(objtree),) ifeq ($(objtree),)
@ -12,7 +12,7 @@ endif
# check that the output directory actually exists # check that the output directory actually exists
ifneq ($(OUTPUT),) ifneq ($(OUTPUT),)
OUTDIR := $(realpath $(OUTPUT)) OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
endif endif