Skip to content

Commit 25a5d23

Browse files
committed
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)
2 parents a7d3e63 + bb3f38c commit 25a5d23

File tree

6 files changed

+28
-24
lines changed

6 files changed

+28
-24
lines changed

Documentation/kbuild/makefiles.txt

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,14 +1108,6 @@ When kbuild executes, the following steps are followed (roughly):
11081108
ld
11091109
Link target. Often, LDFLAGS_$@ is used to set specific options to ld.
11101110

1111-
objcopy
1112-
Copy binary. Uses OBJCOPYFLAGS usually specified in
1113-
arch/$(ARCH)/Makefile.
1114-
OBJCOPYFLAGS_$@ may be used to set additional options.
1115-
1116-
gzip
1117-
Compress target. Use maximum compression to compress target.
1118-
11191111
Example:
11201112
#arch/x86/boot/Makefile
11211113
LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
@@ -1139,6 +1131,19 @@ When kbuild executes, the following steps are followed (roughly):
11391131
resulting in the target file being recompiled for no
11401132
obvious reason.
11411133

1134+
objcopy
1135+
Copy binary. Uses OBJCOPYFLAGS usually specified in
1136+
arch/$(ARCH)/Makefile.
1137+
OBJCOPYFLAGS_$@ may be used to set additional options.
1138+
1139+
gzip
1140+
Compress target. Use maximum compression to compress target.
1141+
1142+
Example:
1143+
#arch/x86/boot/compressed/Makefile
1144+
$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
1145+
$(call if_changed,gzip)
1146+
11421147
dtc
11431148
Create flattened device tree blob object suitable for linking
11441149
into vmlinux. Device tree blobs linked into vmlinux are placed
@@ -1219,7 +1224,7 @@ When kbuild executes, the following steps are followed (roughly):
12191224
that may be shared between individual architectures.
12201225
The recommended approach how to use a generic header file is
12211226
to list the file in the Kbuild file.
1222-
See "7.3 generic-y" for further info on syntax etc.
1227+
See "7.2 generic-y" for further info on syntax etc.
12231228

12241229
--- 6.11 Post-link pass
12251230

@@ -1254,13 +1259,13 @@ A Kbuild file may be defined under arch/<arch>/include/uapi/asm/ and
12541259
arch/<arch>/include/asm/ to list asm files coming from asm-generic.
12551260
See subsequent chapter for the syntax of the Kbuild file.
12561261

1257-
--- 7.1 no-export-headers
1262+
--- 7.1 no-export-headers
12581263

12591264
no-export-headers is essentially used by include/uapi/linux/Kbuild to
12601265
avoid exporting specific headers (e.g. kvm.h) on architectures that do
12611266
not support it. It should be avoided as much as possible.
12621267

1263-
--- 7.2 generic-y
1268+
--- 7.2 generic-y
12641269

12651270
If an architecture uses a verbatim copy of a header from
12661271
include/asm-generic then this is listed in the file
@@ -1287,7 +1292,7 @@ See subsequent chapter for the syntax of the Kbuild file.
12871292
Example: termios.h
12881293
#include <asm-generic/termios.h>
12891294

1290-
--- 7.3 generated-y
1295+
--- 7.3 generated-y
12911296

12921297
If an architecture generates other header files alongside generic-y
12931298
wrappers, generated-y specifies them.
@@ -1299,7 +1304,7 @@ See subsequent chapter for the syntax of the Kbuild file.
12991304
#arch/x86/include/asm/Kbuild
13001305
generated-y += syscalls_32.h
13011306

1302-
--- 7.5 mandatory-y
1307+
--- 7.4 mandatory-y
13031308

13041309
mandatory-y is essentially used by include/uapi/asm-generic/Kbuild.asm
13051310
to define the minimum set of headers that must be exported in

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ endif
130130
ifneq ($(KBUILD_OUTPUT),)
131131
# check that the output directory actually exists
132132
saved-output := $(KBUILD_OUTPUT)
133-
$(shell [ -d $(KBUILD_OUTPUT) ] || mkdir -p $(KBUILD_OUTPUT))
134-
KBUILD_OUTPUT := $(realpath $(KBUILD_OUTPUT))
133+
KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
134+
&& /bin/pwd)
135135
$(if $(KBUILD_OUTPUT),, \
136136
$(error failed to create output directory "$(saved-output)"))
137137

@@ -697,11 +697,11 @@ KBUILD_CFLAGS += $(stackp-flag)
697697

698698
ifeq ($(cc-name),clang)
699699
ifneq ($(CROSS_COMPILE),)
700-
CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%))
700+
CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%))
701701
GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..)
702702
endif
703703
ifneq ($(GCC_TOOLCHAIN),)
704-
CLANG_GCC_TC := -gcc-toolchain $(GCC_TOOLCHAIN)
704+
CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN)
705705
endif
706706
KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
707707
KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
@@ -1399,7 +1399,7 @@ help:
13991399
@echo ' Build, install, and boot kernel before'
14001400
@echo ' running kselftest on it'
14011401
@echo ' kselftest-clean - Remove all generated kselftest files'
1402-
@echo ' kselftest-merge - Merge all the config dependencies of kselftest to existed'
1402+
@echo ' kselftest-merge - Merge all the config dependencies of kselftest to existing'
14031403
@echo ' .config.'
14041404
@echo ''
14051405
@echo 'Userspace tools targets:'

init/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ endif
10331033

10341034
choice
10351035
prompt "Compiler optimization level"
1036-
default CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
1036+
default CC_OPTIMIZE_FOR_PERFORMANCE
10371037

10381038
config CC_OPTIMIZE_FOR_PERFORMANCE
10391039
bool "Optimize for performance"

scripts/Makefile.modpost

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ vmlinux.o: FORCE
9797
$(call cmd,kernel-mod)
9898

9999
# Declare generated files as targets for modpost
100-
$(symverfile): __modpost ;
101100
$(modules:.ko=.mod.c): __modpost ;
102101

103102

tools/power/cpupower/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif
2626

2727
ifneq ($(OUTPUT),)
2828
# check that the output directory actually exists
29-
OUTDIR := $(realpath $(OUTPUT))
29+
OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
3030
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
3131
endif
3232

tools/scripts/Makefile.include

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ifneq ($(O),)
22
ifeq ($(origin O), command line)
3-
ABSOLUTE_O := $(realpath $(O))
4-
dummy := $(if $(ABSOLUTE_O),,$(error O=$(O) does not exist))
3+
dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),)
4+
ABSOLUTE_O := $(shell cd $(O) ; pwd)
55
OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
66
COMMAND_O := O=$(ABSOLUTE_O)
77
ifeq ($(objtree),)
@@ -12,7 +12,7 @@ endif
1212

1313
# check that the output directory actually exists
1414
ifneq ($(OUTPUT),)
15-
OUTDIR := $(realpath $(OUTPUT))
15+
OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
1616
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
1717
endif
1818

0 commit comments

Comments
 (0)