Skip to content

Commit be9160a

Browse files
committed
Merge tag 'kbuild-fixes-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada: - fix -gz=zlib compiler option test for CONFIG_DEBUG_INFO_COMPRESSED - improve cc-option in scripts/Kbuild.include to clean up temp files - improve cc-option in scripts/Kconfig.include for more reliable compile option test - do not copy modules.builtin by 'make install' because it would break existing systems - use 'userprogs' syntax for watch_queue sample * tag 'kbuild-fixes-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: samples: watch_queue: build sample program for target architecture Revert "Makefile: install modules.builtin even if CONFIG_MODULES=n" scripts: Fix typo in headers_install.sh kconfig: unify cc-option and as-option kbuild: improve cc-option to clean up all temporary files Makefile: Improve compressed debug info support detection
2 parents 7561393 + 214377e commit be9160a

File tree

8 files changed

+18
-34
lines changed

8 files changed

+18
-34
lines changed

Makefile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ endif
828828

829829
ifdef CONFIG_DEBUG_INFO_COMPRESSED
830830
DEBUG_CFLAGS += -gz=zlib
831-
KBUILD_AFLAGS += -Wa,--compress-debug-sections=zlib
831+
KBUILD_AFLAGS += -gz=zlib
832832
KBUILD_LDFLAGS += --compress-debug-sections=zlib
833833
endif
834834

@@ -1336,16 +1336,6 @@ dt_binding_check: scripts_dtc
13361336
# ---------------------------------------------------------------------------
13371337
# Modules
13381338

1339-
# install modules.builtin regardless of CONFIG_MODULES
1340-
PHONY += _builtin_inst_
1341-
_builtin_inst_:
1342-
@mkdir -p $(MODLIB)/
1343-
@cp -f modules.builtin $(MODLIB)/
1344-
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
1345-
1346-
PHONY += install
1347-
install: _builtin_inst_
1348-
13491339
ifdef CONFIG_MODULES
13501340

13511341
# By default, build modules as well
@@ -1389,7 +1379,7 @@ PHONY += modules_install
13891379
modules_install: _modinst_ _modinst_post
13901380

13911381
PHONY += _modinst_
1392-
_modinst_: _builtin_inst_
1382+
_modinst_:
13931383
@rm -rf $(MODLIB)/kernel
13941384
@rm -f $(MODLIB)/source
13951385
@mkdir -p $(MODLIB)/kernel
@@ -1399,6 +1389,8 @@ _modinst_: _builtin_inst_
13991389
ln -s $(CURDIR) $(MODLIB)/build ; \
14001390
fi
14011391
@sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
1392+
@cp -f modules.builtin $(MODLIB)/
1393+
@cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
14021394
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
14031395

14041396
# This depmod is only for convenience to give the initial

arch/arm64/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,7 +1564,7 @@ config CC_HAS_SIGN_RETURN_ADDRESS
15641564
def_bool $(cc-option,-msign-return-address=all)
15651565

15661566
config AS_HAS_PAC
1567-
def_bool $(as-option,-Wa$(comma)-march=armv8.3-a)
1567+
def_bool $(cc-option,-Wa$(comma)-march=armv8.3-a)
15681568

15691569
config AS_HAS_CFI_NEGATE_RA_STATE
15701570
def_bool $(as-instr,.cfi_startproc\n.cfi_negate_ra_state\n.cfi_endproc\n)

lib/Kconfig.debug

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ config DEBUG_INFO_COMPRESSED
229229
bool "Compressed debugging information"
230230
depends on DEBUG_INFO
231231
depends on $(cc-option,-gz=zlib)
232-
depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
233232
depends on $(ld-option,--compress-debug-sections=zlib)
234233
help
235234
Compress the debug information using zlib. Requires GCC 5.0+ or Clang

samples/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ config SAMPLE_WATCHDOG
211211

212212
config SAMPLE_WATCH_QUEUE
213213
bool "Build example /dev/watch_queue notification consumer"
214-
depends on HEADERS_INSTALL
214+
depends on CC_CAN_LINK && HEADERS_INSTALL
215215
help
216216
Build example userspace program to use the new mount_notify(),
217217
sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function.

samples/watch_queue/Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# List of programs to build
2-
hostprogs := watch_test
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
userprogs := watch_test
3+
always-y := $(userprogs)
34

4-
# Tell kbuild to always build the programs
5-
always-y := $(hostprogs)
6-
7-
HOSTCFLAGS_watch_test.o += -I$(objtree)/usr/include
5+
userccflags += -I usr/include

scripts/Kbuild.include

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,21 @@ cc-cross-prefix = $(firstword $(foreach c, $(1), \
8686
$(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
8787

8888
# output directory for tests below
89-
TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
89+
TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
9090

9191
# try-run
9292
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
9393
# Exit code chooses option. "$$TMP" serves as a temporary file and is
9494
# automatically cleaned up.
9595
try-run = $(shell set -e; \
96-
TMP="$(TMPOUT).$$$$.tmp"; \
97-
TMPO="$(TMPOUT).$$$$.o"; \
96+
TMP=$(TMPOUT)/tmp; \
97+
TMPO=$(TMPOUT)/tmp.o; \
98+
mkdir -p $(TMPOUT); \
99+
trap "rm -rf $(TMPOUT)" EXIT; \
98100
if ($(1)) >/dev/null 2>&1; \
99101
then echo "$(2)"; \
100102
else echo "$(3)"; \
101-
fi; \
102-
rm -f "$$TMP" "$$TMPO")
103+
fi)
103104

104105
# as-option
105106
# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)

scripts/Kconfig.include

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,12 @@ failure = $(if-success,$(1),n,y)
2525

2626
# $(cc-option,<flag>)
2727
# Return y if the compiler supports <flag>, n otherwise
28-
cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /dev/null)
28+
cc-option = $(success,mkdir .tmp_$$$$; trap "rm -rf .tmp_$$$$" EXIT; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$$$/tmp.o)
2929

3030
# $(ld-option,<flag>)
3131
# Return y if the linker supports <flag>, n otherwise
3232
ld-option = $(success,$(LD) -v $(1))
3333

34-
# $(as-option,<flag>)
35-
# /dev/zero is used as output instead of /dev/null as some assembler cribs when
36-
# both input and output are same. Also both of them have same write behaviour so
37-
# can be easily substituted.
38-
as-option = $(success, $(CC) $(CLANG_FLAGS) $(1) -c -x assembler /dev/null -o /dev/zero)
39-
4034
# $(as-instr,<instr>)
4135
# Return y if the assembler supports <instr>, n otherwise
4236
as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler -o /dev/null -)

scripts/headers_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ then
1111
echo "asm/inline/volatile keywords."
1212
echo
1313
echo "INFILE: header file to operate on"
14-
echo "OUTFILE: output file which the processed header is writen to"
14+
echo "OUTFILE: output file which the processed header is written to"
1515

1616
exit 1
1717
fi

0 commit comments

Comments
 (0)