Commit 0e40da3e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'kbuild-fixes-v5.1' of...

Merge tag 'kbuild-fixes-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Remove harmful -Oz option of Clang

 - Get back the original behavior (no recursion for in-tree build) for
   GNU Make 4.x

 - Some minor fixes for coccinelle patches

 - Do not overwrite .gitignore in the output directory in case it is
   version-controlled

 - Fix missed record-mcount bug for dynamic ftrace

 - Fix endianness bug in modversions for relative CRC

 - Cater to '^H' key code in Kconfig ncurses programs

* tag 'kbuild-fixes-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig/[mn]conf: handle backspace (^H) key
  kbuild: modversions: Fix relative CRC byte order interpretation
  scripts: coccinelle: Fix description of badty.cocci
  kbuild: strip whitespace in cmd_record_mcount findstring
  kbuild: do not overwrite .gitignore in output directory
  kbuild: skip parsing pre sub-make code for recursion
  coccinelle: put_device: reduce false positives
  kbuild: skip sub-make for in-tree build with GNU Make 4.x
  Revert "kbuild: use -Oz instead of -Os when using clang"
parents ffb8e45c 9c38f1f0
...@@ -31,26 +31,12 @@ _all: ...@@ -31,26 +31,12 @@ _all:
# descending is started. They are now explicitly listed as the # descending is started. They are now explicitly listed as the
# prepare rule. # prepare rule.
# Ugly workaround for Debian make-kpkg: ifneq ($(sub_make_done),1)
# make-kpkg directly includes the top Makefile of Linux kernel. In such a case,
# skip sub-make to support debian_* targets in ruleset/kernel_version.mk, but
# displays warning to discourage such abusage.
ifneq ($(word 2, $(MAKEFILE_LIST)),)
$(warning Do not include top Makefile of Linux Kernel)
sub-make-done := 1
MAKEFLAGS += -rR
endif
ifneq ($(sub-make-done),1)
# Do not use make's built-in rules and variables # Do not use make's built-in rules and variables
# (this increases performance and avoids hard-to-debug behaviour) # (this increases performance and avoids hard-to-debug behaviour)
MAKEFLAGS += -rR MAKEFLAGS += -rR
# 'MAKEFLAGS += -rR' does not become immediately effective for old
# GNU Make versions. Cancel implicit rules for this Makefile.
$(lastword $(MAKEFILE_LIST)): ;
# Avoid funny character set dependencies # Avoid funny character set dependencies
unexport LC_ALL unexport LC_ALL
LC_COLLATE=C LC_COLLATE=C
...@@ -153,6 +139,7 @@ $(if $(KBUILD_OUTPUT),, \ ...@@ -153,6 +139,7 @@ $(if $(KBUILD_OUTPUT),, \
# 'sub-make' below. # 'sub-make' below.
MAKEFLAGS += --include-dir=$(CURDIR) MAKEFLAGS += --include-dir=$(CURDIR)
need-sub-make := 1
else else
# Do not print "Entering directory ..." at all for in-tree build. # Do not print "Entering directory ..." at all for in-tree build.
...@@ -160,6 +147,18 @@ MAKEFLAGS += --no-print-directory ...@@ -160,6 +147,18 @@ MAKEFLAGS += --no-print-directory
endif # ifneq ($(KBUILD_OUTPUT),) endif # ifneq ($(KBUILD_OUTPUT),)
ifneq ($(filter 3.%,$(MAKE_VERSION)),)
# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
# We need to invoke sub-make to avoid implicit rules in the top Makefile.
need-sub-make := 1
# Cancel implicit rules for this Makefile.
$(lastword $(MAKEFILE_LIST)): ;
endif
export sub_make_done := 1
ifeq ($(need-sub-make),1)
PHONY += $(MAKECMDGOALS) sub-make PHONY += $(MAKECMDGOALS) sub-make
$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
...@@ -167,12 +166,15 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make ...@@ -167,12 +166,15 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
# Invoke a second make in the output directory, passing relevant variables # Invoke a second make in the output directory, passing relevant variables
sub-make: sub-make:
$(Q)$(MAKE) sub-make-done=1 \ $(Q)$(MAKE) \
$(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \ $(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \
-f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
else # sub-make-done endif # need-sub-make
endif # sub_make_done
# We process the rest of the Makefile if this is the final invocation of make # We process the rest of the Makefile if this is the final invocation of make
ifeq ($(need-sub-make),)
# Do not print "Entering directory ...", # Do not print "Entering directory ...",
# but we want to display it when entering to the output directory # but we want to display it when entering to the output directory
...@@ -497,7 +499,8 @@ outputmakefile: ...@@ -497,7 +499,8 @@ outputmakefile:
ifneq ($(KBUILD_SRC),) ifneq ($(KBUILD_SRC),)
$(Q)ln -fsn $(srctree) source $(Q)ln -fsn $(srctree) source
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
$(Q){ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore $(Q)test -e .gitignore || \
{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
endif endif
ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
...@@ -677,7 +680,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) ...@@ -677,7 +680,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) KBUILD_CFLAGS += -Os
else else
KBUILD_CFLAGS += -O2 KBUILD_CFLAGS += -O2
endif endif
...@@ -1757,7 +1760,7 @@ existing-targets := $(wildcard $(sort $(targets))) ...@@ -1757,7 +1760,7 @@ existing-targets := $(wildcard $(sort $(targets)))
endif # ifeq ($(config-targets),1) endif # ifeq ($(config-targets),1)
endif # ifeq ($(mixed-targets),1) endif # ifeq ($(mixed-targets),1)
endif # sub-make-done endif # need-sub-make
PHONY += FORCE PHONY += FORCE
FORCE: FORCE:
......
...@@ -199,11 +199,8 @@ sub_cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ ...@@ -199,11 +199,8 @@ sub_cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
"$(if $(part-of-module),1,0)" "$(@)"; "$(if $(part-of-module),1,0)" "$(@)";
recordmcount_source := $(srctree)/scripts/recordmcount.pl recordmcount_source := $(srctree)/scripts/recordmcount.pl
endif # BUILD_C_RECORDMCOUNT endif # BUILD_C_RECORDMCOUNT
cmd_record_mcount = \ cmd_record_mcount = $(if $(findstring $(strip $(CC_FLAGS_FTRACE)),$(_c_flags)), \
if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" = \ $(sub_cmd_record_mcount))
"$(CC_FLAGS_FTRACE)" ]; then \
$(sub_cmd_record_mcount) \
fi
endif # CC_USING_RECORD_MCOUNT endif # CC_USING_RECORD_MCOUNT
endif # CONFIG_FTRACE_MCOUNT_RECORD endif # CONFIG_FTRACE_MCOUNT_RECORD
......
...@@ -32,6 +32,7 @@ if (id == NULL || ...) { ... return ...; } ...@@ -32,6 +32,7 @@ if (id == NULL || ...) { ... return ...; }
( id ( id
| (T2)dev_get_drvdata(&id->dev) | (T2)dev_get_drvdata(&id->dev)
| (T3)platform_get_drvdata(id) | (T3)platform_get_drvdata(id)
| &id->dev
); );
| [email protected] ...; | [email protected] ...;
) )
......
/// Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element /// Correct the size argument to alloc functions
/// ///
//# This makes an effort to find cases where the argument to sizeof is wrong //# This makes an effort to find cases where the argument to sizeof is wrong
//# in memory allocation functions by checking the type of the allocated memory //# in memory allocation functions by checking the type of the allocated memory
......
...@@ -113,7 +113,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width ...@@ -113,7 +113,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
case KEY_DOWN: case KEY_DOWN:
break; break;
case KEY_BACKSPACE: case KEY_BACKSPACE:
case 127: case 8: /* ^H */
case 127: /* ^? */
if (pos) { if (pos) {
wattrset(dialog, dlg.inputbox.atr); wattrset(dialog, dlg.inputbox.atr);
if (input_x == 0) { if (input_x == 0) {
......
...@@ -1048,7 +1048,7 @@ static int do_match(int key, struct match_state *state, int *ans) ...@@ -1048,7 +1048,7 @@ static int do_match(int key, struct match_state *state, int *ans)
state->match_direction = FIND_NEXT_MATCH_UP; state->match_direction = FIND_NEXT_MATCH_UP;
*ans = get_mext_match(state->pattern, *ans = get_mext_match(state->pattern,
state->match_direction); state->match_direction);
} else if (key == KEY_BACKSPACE || key == 127) { } else if (key == KEY_BACKSPACE || key == 8 || key == 127) {
state->pattern[strlen(state->pattern)-1] = '\0'; state->pattern[strlen(state->pattern)-1] = '\0';
adj_match_dir(&state->match_direction); adj_match_dir(&state->match_direction);
} else } else
......
...@@ -439,7 +439,8 @@ int dialog_inputbox(WINDOW *main_window, ...@@ -439,7 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
case KEY_F(F_EXIT): case KEY_F(F_EXIT):
case KEY_F(F_BACK): case KEY_F(F_BACK):
break; break;
case 127: case 8: /* ^H */
case 127: /* ^? */
case KEY_BACKSPACE: case KEY_BACKSPACE:
if (cursor_position > 0) { if (cursor_position > 0) {
memmove(&result[cursor_position-1], memmove(&result[cursor_position-1],
......
...@@ -639,7 +639,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, ...@@ -639,7 +639,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
info->sechdrs[sym->st_shndx].sh_offset - info->sechdrs[sym->st_shndx].sh_offset -
(info->hdr->e_type != ET_REL ? (info->hdr->e_type != ET_REL ?
info->sechdrs[sym->st_shndx].sh_addr : 0); info->sechdrs[sym->st_shndx].sh_addr : 0);
crc = *crcp; crc = TO_NATIVE(*crcp);
} }
sym_update_crc(symname + strlen("__crc_"), mod, crc, sym_update_crc(symname + strlen("__crc_"), mod, crc,
export); export);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment