Skip to content

Commit 0eb3412

Browse files
committed
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
2 parents 7cf901b + 50186e1 commit 0eb3412

File tree

15 files changed

+40
-27
lines changed

15 files changed

+40
-27
lines changed

MAINTAINERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7602,8 +7602,10 @@ F: mm/kasan/
76027602
F: scripts/Makefile.kasan
76037603

76047604
KCONFIG
7605+
M: Masahiro Yamada <[email protected]>
7606+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig
76057607
7606-
S: Orphan
7608+
S: Maintained
76077609
F: Documentation/kbuild/kconfig-language.txt
76087610
F: scripts/kconfig/
76097611

Makefile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ PYTHON = python
388388
CHECK = sparse
389389

390390
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
391-
-Wbitwise -Wno-return-void $(CF)
391+
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
392392
NOSTDINC_FLAGS =
393393
CFLAGS_MODULE =
394394
AFLAGS_MODULE =
@@ -584,10 +584,9 @@ ifeq ($(KBUILD_EXTMOD),)
584584
# To avoid any implicit rule to kick in, define an empty command
585585
$(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
586586

587-
# If .config is newer than include/config/auto.conf, someone tinkered
588-
# with it and forgot to run make oldconfig.
589-
# if auto.conf.cmd is missing then we are probably in a cleaned tree so
590-
# we execute the config step to be sure to catch updated Kconfig files
587+
# The actual configuration files used during the build are stored in
588+
# include/generated/ and include/config/. Update them if .config is newer than
589+
# include/config/auto.conf (which mirrors .config).
591590
include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
592591
$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
593592
else
@@ -862,8 +861,7 @@ KBUILD_AFLAGS += $(ARCH_AFLAGS) $(KAFLAGS)
862861
KBUILD_CFLAGS += $(ARCH_CFLAGS) $(KCFLAGS)
863862

864863
# Use --build-id when available.
865-
LDFLAGS_BUILD_ID := $(patsubst -Wl$(comma)%,%,\
866-
$(call cc-ldoption, -Wl$(comma)--build-id,))
864+
LDFLAGS_BUILD_ID := $(call ld-option, --build-id)
867865
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
868866
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
869867

arch/sh/boot/dts/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
1+
ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"")
2+
obj-y += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
3+
endif

scripts/coccinelle/api/memdup.cocci

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ statement S;
5656
p << r.p;
5757
@@
5858
59-
coccilib.org.print_todo(p[0], "WARNING opportunity for kmemdep")
59+
coccilib.org.print_todo(p[0], "WARNING opportunity for kmemdup")
6060
6161
@script:python depends on report@
6262
p << r.p;
6363
@@
6464
65-
coccilib.report.print_report(p[0], "WARNING opportunity for kmemdep")
65+
coccilib.report.print_report(p[0], "WARNING opportunity for kmemdup")

scripts/kallsyms.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ static void optimize_result(void)
595595
* original char code */
596596
if (!best_table_len[i]) {
597597

598-
/* find the token with the breates profit value */
598+
/* find the token with the best profit value */
599599
best = find_best_token();
600600
if (token_profit[best] == 0)
601601
break;

scripts/kconfig/confdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
178178
case S_HEX:
179179
done:
180180
if (sym_string_valid(sym, p)) {
181-
sym->def[def].val = strdup(p);
181+
sym->def[def].val = xstrdup(p);
182182
sym->flags |= def_flags;
183183
} else {
184184
if (def != S_DEF_AUTO)

scripts/kconfig/kxgettext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static struct message *message__new(const char *msg, char *option,
101101
if (self->files == NULL)
102102
goto out_fail;
103103

104-
self->msg = strdup(msg);
104+
self->msg = xstrdup(msg);
105105
if (self->msg == NULL)
106106
goto out_fail_msg;
107107

scripts/kconfig/lkc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ int file_write_dep(const char *name);
115115
void *xmalloc(size_t size);
116116
void *xcalloc(size_t nmemb, size_t size);
117117
void *xrealloc(void *p, size_t size);
118+
char *xstrdup(const char *s);
118119

119120
struct gstr {
120121
size_t len;

scripts/kconfig/lxdialog/check-lxdialog.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ EOF
5555
echo " *** required header files." 1>&2
5656
echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
5757
echo " *** " 1>&2
58-
echo " *** Install ncurses (ncurses-devel) and try again." 1>&2
58+
echo " *** Install ncurses (ncurses-devel or libncurses-dev " 1>&2
59+
echo " *** depending on your distribution) and try again." 1>&2
5960
echo " *** " 1>&2
6061
exit 1
6162
fi

scripts/kconfig/menu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ void menu_add_option(int token, char *arg)
212212
sym_defconfig_list = current_entry->sym;
213213
else if (sym_defconfig_list != current_entry->sym)
214214
zconf_error("trying to redefine defconfig symbol");
215+
sym_defconfig_list->flags |= SYMBOL_AUTO;
215216
break;
216217
case T_OPT_ENV:
217218
prop_add_env(arg);

scripts/kconfig/symbol.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static void sym_validate_range(struct symbol *sym)
183183
sprintf(str, "%lld", val2);
184184
else
185185
sprintf(str, "0x%llx", val2);
186-
sym->curr.val = strdup(str);
186+
sym->curr.val = xstrdup(str);
187187
}
188188

189189
static void sym_set_changed(struct symbol *sym)
@@ -849,7 +849,7 @@ struct symbol *sym_lookup(const char *name, int flags)
849849
: !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
850850
return symbol;
851851
}
852-
new_name = strdup(name);
852+
new_name = xstrdup(name);
853853
} else {
854854
new_name = NULL;
855855
hash = 0;

scripts/kconfig/util.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,14 @@ void *xrealloc(void *p, size_t size)
154154
fprintf(stderr, "Out of memory.\n");
155155
exit(1);
156156
}
157+
158+
char *xstrdup(const char *s)
159+
{
160+
char *p;
161+
162+
p = strdup(s);
163+
if (p)
164+
return p;
165+
fprintf(stderr, "Out of memory.\n");
166+
exit(1);
167+
}

scripts/kconfig/zconf.l

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,12 @@ void zconf_nextfile(const char *name)
332332
"Inclusion path:\n current file : '%s'\n",
333333
zconf_curname(), zconf_lineno(),
334334
zconf_curname());
335-
iter = current_file->parent;
336-
while (iter && \
337-
strcmp(iter->name,current_file->name)) {
338-
fprintf(stderr, " included from: '%s:%d'\n",
339-
iter->name, iter->lineno-1);
335+
iter = current_file;
336+
do {
340337
iter = iter->parent;
341-
}
342-
if (iter)
343338
fprintf(stderr, " included from: '%s:%d'\n",
344-
iter->name, iter->lineno+1);
339+
iter->name, iter->lineno - 1);
340+
} while (strcmp(iter->name, current_file->name));
345341
exit(1);
346342
}
347343
}

scripts/kconfig/zconf.y

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ no_mainmenu_stmt: /* empty */
127127
* later regardless of whether it comes from the 'prompt' in
128128
* mainmenu_stmt or here
129129
*/
130-
menu_add_prompt(P_MENU, strdup("Linux Kernel Configuration"), NULL);
130+
menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL);
131131
};
132132

133133

@@ -276,6 +276,7 @@ choice: T_CHOICE word_opt T_EOL
276276
sym->flags |= SYMBOL_AUTO;
277277
menu_add_entry(sym);
278278
menu_add_expr(P_CHOICE, NULL, NULL);
279+
free($2);
279280
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
280281
};
281282

scripts/link-vmlinux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ else
246246
fi;
247247

248248
# final build of init/
249-
${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init GCC_PLUGINS_CFLAGS="${GCC_PLUGINS_CFLAGS}"
249+
${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init
250250

251251
archive_builtin
252252

0 commit comments

Comments
 (0)