Эх сурвалжийг харах

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

Pull Kbuild fixes from Masahiro Yamada:

 - suppress sparse warnings about unknown attributes

 - fix typos and stale comments

 - fix build error of arch/sh

 - fix wrong use of ld-option vs cc-ldoption

 - remove redundant GCC_PLUGINS_CFLAGS assignment

 - fix another memory leak of Kconfig

 - fix line number in error messages of Kconfig

 - do not write confusing CONFIG_DEFCONFIG_LIST out to .config

 - add xstrdup() to Kconfig to handle memory shortage errors

 - show also a Debian package name if ncurses is missing

* tag 'kbuild-fixes-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  MAINTAINERS: take over Kconfig maintainership
  kconfig: fix line number in recursive inclusion error message
  Coccinelle: memdup: Fix typo in warning messages
  kconfig: Update ncurses package names for menuconfig
  kbuild/kallsyms: trivial typo fix
  kbuild: test --build-id linker flag by ld-option instead of cc-ldoption
  kbuild: drop superfluous GCC_PLUGINS_CFLAGS assignment
  kconfig: Don't leak choice names during parsing
  sh: fix build error for empty CONFIG_BUILTIN_DTB_SOURCE
  kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list
  kconfig: add xstrdup() helper
  kbuild: disable sparse warnings about unknown attributes
  Makefile: Fix lying comment re. silentoldconfig
Linus Torvalds 7 жил өмнө
parent
commit
0eb3412a68

+ 3 - 1
MAINTAINERS

@@ -7602,8 +7602,10 @@ F:	mm/kasan/
 F:	scripts/Makefile.kasan
 F:	scripts/Makefile.kasan
 
 
 KCONFIG
 KCONFIG
+M:	Masahiro Yamada <yamada.masahiro@socionext.com>
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig
 L:	linux-kbuild@vger.kernel.org
 L:	linux-kbuild@vger.kernel.org
-S:	Orphan
+S:	Maintained
 F:	Documentation/kbuild/kconfig-language.txt
 F:	Documentation/kbuild/kconfig-language.txt
 F:	scripts/kconfig/
 F:	scripts/kconfig/
 
 

+ 5 - 7
Makefile

@@ -388,7 +388,7 @@ PYTHON		= python
 CHECK		= sparse
 CHECK		= sparse
 
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-		  -Wbitwise -Wno-return-void $(CF)
+		  -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
 NOSTDINC_FLAGS  =
 NOSTDINC_FLAGS  =
 CFLAGS_MODULE   =
 CFLAGS_MODULE   =
 AFLAGS_MODULE   =
 AFLAGS_MODULE   =
@@ -584,10 +584,9 @@ ifeq ($(KBUILD_EXTMOD),)
 # To avoid any implicit rule to kick in, define an empty command
 # To avoid any implicit rule to kick in, define an empty command
 $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
 $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
 
 
-# If .config is newer than include/config/auto.conf, someone tinkered
-# with it and forgot to run make oldconfig.
-# if auto.conf.cmd is missing then we are probably in a cleaned tree so
-# we execute the config step to be sure to catch updated Kconfig files
+# The actual configuration files used during the build are stored in
+# include/generated/ and include/config/. Update them if .config is newer than
+# include/config/auto.conf (which mirrors .config).
 include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
 include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
 	$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
 	$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
 else
 else
@@ -862,8 +861,7 @@ KBUILD_AFLAGS   += $(ARCH_AFLAGS)   $(KAFLAGS)
 KBUILD_CFLAGS   += $(ARCH_CFLAGS)   $(KCFLAGS)
 KBUILD_CFLAGS   += $(ARCH_CFLAGS)   $(KCFLAGS)
 
 
 # Use --build-id when available.
 # Use --build-id when available.
-LDFLAGS_BUILD_ID := $(patsubst -Wl$(comma)%,%,\
-			      $(call cc-ldoption, -Wl$(comma)--build-id,))
+LDFLAGS_BUILD_ID := $(call ld-option, --build-id)
 KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
 KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
 LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
 LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
 
 

+ 3 - 1
arch/sh/boot/dts/Makefile

@@ -1 +1,3 @@
-obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
+ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"")
+obj-y += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
+endif

+ 2 - 2
scripts/coccinelle/api/memdup.cocci

@@ -56,10 +56,10 @@ statement S;
 p << r.p;
 p << r.p;
 @@
 @@
 
 
-coccilib.org.print_todo(p[0], "WARNING opportunity for kmemdep")
+coccilib.org.print_todo(p[0], "WARNING opportunity for kmemdup")
 
 
 @script:python depends on report@
 @script:python depends on report@
 p << r.p;
 p << r.p;
 @@
 @@
 
 
-coccilib.report.print_report(p[0], "WARNING opportunity for kmemdep")
+coccilib.report.print_report(p[0], "WARNING opportunity for kmemdup")

+ 1 - 1
scripts/kallsyms.c

@@ -595,7 +595,7 @@ static void optimize_result(void)
 		 * original char code */
 		 * original char code */
 		if (!best_table_len[i]) {
 		if (!best_table_len[i]) {
 
 
-			/* find the token with the breates profit value */
+			/* find the token with the best profit value */
 			best = find_best_token();
 			best = find_best_token();
 			if (token_profit[best] == 0)
 			if (token_profit[best] == 0)
 				break;
 				break;

+ 1 - 1
scripts/kconfig/confdata.c

@@ -178,7 +178,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
 	case S_HEX:
 	case S_HEX:
 	done:
 	done:
 		if (sym_string_valid(sym, p)) {
 		if (sym_string_valid(sym, p)) {
-			sym->def[def].val = strdup(p);
+			sym->def[def].val = xstrdup(p);
 			sym->flags |= def_flags;
 			sym->flags |= def_flags;
 		} else {
 		} else {
 			if (def != S_DEF_AUTO)
 			if (def != S_DEF_AUTO)

+ 1 - 1
scripts/kconfig/kxgettext.c

@@ -101,7 +101,7 @@ static struct message *message__new(const char *msg, char *option,
 	if (self->files == NULL)
 	if (self->files == NULL)
 		goto out_fail;
 		goto out_fail;
 
 
-	self->msg = strdup(msg);
+	self->msg = xstrdup(msg);
 	if (self->msg == NULL)
 	if (self->msg == NULL)
 		goto out_fail_msg;
 		goto out_fail_msg;
 
 

+ 1 - 0
scripts/kconfig/lkc.h

@@ -115,6 +115,7 @@ int file_write_dep(const char *name);
 void *xmalloc(size_t size);
 void *xmalloc(size_t size);
 void *xcalloc(size_t nmemb, size_t size);
 void *xcalloc(size_t nmemb, size_t size);
 void *xrealloc(void *p, size_t size);
 void *xrealloc(void *p, size_t size);
+char *xstrdup(const char *s);
 
 
 struct gstr {
 struct gstr {
 	size_t len;
 	size_t len;

+ 2 - 1
scripts/kconfig/lxdialog/check-lxdialog.sh

@@ -55,7 +55,8 @@ EOF
 	    echo " *** required header files."                            1>&2
 	    echo " *** required header files."                            1>&2
 	    echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
 	    echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
 	    echo " *** "                                                  1>&2
 	    echo " *** "                                                  1>&2
-	    echo " *** Install ncurses (ncurses-devel) and try again."    1>&2
+	    echo " *** Install ncurses (ncurses-devel or libncurses-dev " 1>&2
+	    echo " *** depending on your distribution) and try again."    1>&2
 	    echo " *** "                                                  1>&2
 	    echo " *** "                                                  1>&2
 	    exit 1
 	    exit 1
 	fi
 	fi

+ 1 - 0
scripts/kconfig/menu.c

@@ -212,6 +212,7 @@ void menu_add_option(int token, char *arg)
 			sym_defconfig_list = current_entry->sym;
 			sym_defconfig_list = current_entry->sym;
 		else if (sym_defconfig_list != current_entry->sym)
 		else if (sym_defconfig_list != current_entry->sym)
 			zconf_error("trying to redefine defconfig symbol");
 			zconf_error("trying to redefine defconfig symbol");
+		sym_defconfig_list->flags |= SYMBOL_AUTO;
 		break;
 		break;
 	case T_OPT_ENV:
 	case T_OPT_ENV:
 		prop_add_env(arg);
 		prop_add_env(arg);

+ 2 - 2
scripts/kconfig/symbol.c

@@ -183,7 +183,7 @@ static void sym_validate_range(struct symbol *sym)
 		sprintf(str, "%lld", val2);
 		sprintf(str, "%lld", val2);
 	else
 	else
 		sprintf(str, "0x%llx", val2);
 		sprintf(str, "0x%llx", val2);
-	sym->curr.val = strdup(str);
+	sym->curr.val = xstrdup(str);
 }
 }
 
 
 static void sym_set_changed(struct symbol *sym)
 static void sym_set_changed(struct symbol *sym)
@@ -849,7 +849,7 @@ struct symbol *sym_lookup(const char *name, int flags)
 				   : !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
 				   : !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
 				return symbol;
 				return symbol;
 		}
 		}
-		new_name = strdup(name);
+		new_name = xstrdup(name);
 	} else {
 	} else {
 		new_name = NULL;
 		new_name = NULL;
 		hash = 0;
 		hash = 0;

+ 11 - 0
scripts/kconfig/util.c

@@ -154,3 +154,14 @@ void *xrealloc(void *p, size_t size)
 	fprintf(stderr, "Out of memory.\n");
 	fprintf(stderr, "Out of memory.\n");
 	exit(1);
 	exit(1);
 }
 }
+
+char *xstrdup(const char *s)
+{
+	char *p;
+
+	p = strdup(s);
+	if (p)
+		return p;
+	fprintf(stderr, "Out of memory.\n");
+	exit(1);
+}

+ 4 - 8
scripts/kconfig/zconf.l

@@ -332,16 +332,12 @@ void zconf_nextfile(const char *name)
 				"Inclusion path:\n  current file : '%s'\n",
 				"Inclusion path:\n  current file : '%s'\n",
 				zconf_curname(), zconf_lineno(),
 				zconf_curname(), zconf_lineno(),
 				zconf_curname());
 				zconf_curname());
-			iter = current_file->parent;
-			while (iter && \
-			       strcmp(iter->name,current_file->name)) {
-				fprintf(stderr, "  included from: '%s:%d'\n",
-					iter->name, iter->lineno-1);
+			iter = current_file;
+			do {
 				iter = iter->parent;
 				iter = iter->parent;
-			}
-			if (iter)
 				fprintf(stderr, "  included from: '%s:%d'\n",
 				fprintf(stderr, "  included from: '%s:%d'\n",
-					iter->name, iter->lineno+1);
+					iter->name, iter->lineno - 1);
+			} while (strcmp(iter->name, current_file->name));
 			exit(1);
 			exit(1);
 		}
 		}
 	}
 	}

+ 2 - 1
scripts/kconfig/zconf.y

@@ -127,7 +127,7 @@ no_mainmenu_stmt: /* empty */
 	 * later regardless of whether it comes from the 'prompt' in
 	 * later regardless of whether it comes from the 'prompt' in
 	 * mainmenu_stmt or here
 	 * mainmenu_stmt or here
 	 */
 	 */
-	menu_add_prompt(P_MENU, strdup("Linux Kernel Configuration"), NULL);
+	menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL);
 };
 };
 
 
 
 
@@ -276,6 +276,7 @@ choice: T_CHOICE word_opt T_EOL
 	sym->flags |= SYMBOL_AUTO;
 	sym->flags |= SYMBOL_AUTO;
 	menu_add_entry(sym);
 	menu_add_entry(sym);
 	menu_add_expr(P_CHOICE, NULL, NULL);
 	menu_add_expr(P_CHOICE, NULL, NULL);
+	free($2);
 	printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
 	printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
 };
 };
 
 

+ 1 - 1
scripts/link-vmlinux.sh

@@ -246,7 +246,7 @@ else
 fi;
 fi;
 
 
 # final build of init/
 # final build of init/
-${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init GCC_PLUGINS_CFLAGS="${GCC_PLUGINS_CFLAGS}"
+${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init
 
 
 archive_builtin
 archive_builtin