From 5e8d780d745c1619aba81fe7166c5a4b5cad2b84 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 1 Jul 2006 09:58:02 +0200 Subject: kbuild: fix ia64 breakage after introducing make -rR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kbuild used $ยค(*F to get filename of target without extension. This was used in several places all over kbuild, but introducing make -rR broke his for all cases where we specified full path to target/prerequsite. It is assumed that make -rR disables old style suffix-rules which is why is suddenly failed. ia64 was impacted by this change because several div* routines in arch/ia64/lib are build using explicit paths and then kbuild failed. Thanks to David Mosberger-Tang for an explanation what was the root-cause and for testing on ia64. This patch also fixes two uses of $(*F) in arch/um Signed-off-by: Sam Ravnborg --- scripts/Kbuild.include | 4 ++++ scripts/Makefile.build | 2 +- scripts/Makefile.host | 6 ++++-- scripts/Makefile.lib | 6 +++--- scripts/Makefile.modpost | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index b0d067be739..2180c88cfe8 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -12,6 +12,10 @@ space := $(empty) $(empty) # contain a comma depfile = $(subst $(comma),_,$(@D)/.$(@F).d) +### +# filename of target with directory and extension stripped +basetarget = $(basename $(notdir $@)) + ### # Escape single quote for use in echo statements escsq = $(subst $(squote),'\$(squote)',$1) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 02a7eea5fdb..3cb445cc743 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -117,7 +117,7 @@ $(real-objs-m:.o=.lst): quiet_modtag := [M] $(obj-m) : quiet_modtag := [M] # Default for not multi-part modules -modname = $(*F) +modname = $(basetarget) $(multi-objs-m) : modname = $(modname-multi) $(multi-objs-m:.o=.i) : modname = $(modname-multi) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 2b066d12af2..18ecd4d5df7 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -80,8 +80,10 @@ obj-dirs += $(host-objdirs) ##### # Handle options to gcc. Support building with separate output directory -_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o) -_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) +_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ + $(HOSTCFLAGS_$(basetarget).o) +_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ + $(HOSTCXXFLAGS_$(basetarget).o) ifeq ($(KBUILD_SRC),) __hostc_flags = $(_hostc_flags) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 2cb4935e85d..fc498fee68e 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -82,12 +82,12 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) # than one module. In that case KBUILD_MODNAME will be set to foo_bar, # where foo and bar are the name of the modules. name-fix = $(subst $(comma),_,$(subst -,_,$1)) -basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(*F)))" +basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" modname_flags = $(if $(filter 1,$(words $(modname))),\ -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") -_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) -_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) +_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o) +_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) _cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) # If building the kernel in a separate objtree expand all occurrences diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 576cce5e387..a49550205dc 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -72,7 +72,7 @@ $(modules:.ko=.mod.c): __modpost ; # Step 5), compile all *.mod.c files # modname is set to make c_flags define KBUILD_MODNAME -modname = $(*F) +modname = $(notdir $(@:.mod.o=)) quiet_cmd_cc_o_c = CC $@ cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \ -- cgit v1.2.3-18-g5258 From 66392c4f2246641c13b5dc60d15b09a71e09276f Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 30 Jun 2006 02:18:50 -0700 Subject: kconfig: enhancing accessibility of lxdialog Some fix that I forgot for good accessibility of lxdialog (the cursor should always be left at the focus location): Have the checklist display the currently highlighted entry last, for having the cursor left on it (rather than on the last line of the list). Signed-off-by: Samuel Thibault Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- scripts/kconfig/lxdialog/checklist.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c index be0200e9cda..79886413b6d 100644 --- a/scripts/kconfig/lxdialog/checklist.c +++ b/scripts/kconfig/lxdialog/checklist.c @@ -187,9 +187,12 @@ int dialog_checklist(const char *title, const char *prompt, int height, /* Print the list */ for (i = 0; i < max_choice; i++) { - print_item(list, items[(scroll + i) * 3 + 1], - status[i + scroll], i, i == choice); + if (i != choice) + print_item(list, items[(scroll + i) * 3 + 1], + status[i + scroll], i, 0); } + print_item(list, items[(scroll + choice) * 3 + 1], + status[choice + scroll], choice, 1); print_arrows(dialog, choice, item_no, scroll, box_y, box_x + check_x + 5, list_height); -- cgit v1.2.3-18-g5258 From 534b89a9f6a86a28300cd71619112c4bbca7c0ae Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 1 Jul 2006 10:10:19 +0200 Subject: kbuild: fix segv in modpost Parsing an old Modules.symvers file casued modpost to SEGV. Signed-off-by: Sam Ravnborg --- scripts/mod/modpost.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 0dd16177642..65411665e13 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -205,6 +205,8 @@ static const char *export_str(enum export ex) static enum export export_no(const char * s) { int i; + if (!s) + return export_unknown; for (i = 0; export_list[i].export != export_unknown; i++) { if (strcmp(export_list[i].str, s) == 0) return export_list[i].export; @@ -1271,7 +1273,7 @@ static void write_if_changed(struct buffer *b, const char *fname) } /* parse Module.symvers file. line format: - * 0x12345678symbolmodule[export] + * 0x12345678symbolmodule[[export]something] **/ static void read_dump(const char *fname, unsigned int kernel) { @@ -1284,7 +1286,7 @@ static void read_dump(const char *fname, unsigned int kernel) return; while ((line = get_next_line(&pos, file, size))) { - char *symname, *modname, *d, *export; + char *symname, *modname, *d, *export, *end; unsigned int crc; struct module *mod; struct symbol *s; @@ -1297,7 +1299,8 @@ static void read_dump(const char *fname, unsigned int kernel) *modname++ = '\0'; if ((export = strchr(modname, '\t')) != NULL) *export++ = '\0'; - + if (export && ((end = strchr(export, '\t')) != NULL)) + *end = '\0'; crc = strtoul(line, &d, 16); if (*symname == '\0' || *modname == '\0' || *d != '\0') goto fail; -- cgit v1.2.3-18-g5258 From c96fca213737a5b4bc569e1d9a0ef6adeff661e9 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 1 Jul 2006 11:44:23 +0200 Subject: kbuild: warn when a moduled uses a symbol marked UNUSED We now have infrastructure in place to mark an EXPORTed symbol as unused. So the natural next step is to warn during buildtime when a module uses a symbol marked UNUSED. Signed-off-by: Sam Ravnborg --- scripts/mod/modpost.c | 85 +++++++++++++++++++++++++++++++++++++-------------- scripts/mod/modpost.h | 2 ++ 2 files changed, 64 insertions(+), 23 deletions(-) (limited to 'scripts') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 65411665e13..dfde0e87a76 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -24,7 +24,10 @@ static int all_versions = 0; /* If we are modposting external module set to 1 */ static int external_module = 0; /* How a symbol is exported */ -enum export {export_plain, export_gpl, export_gpl_future, export_unknown}; +enum export { + export_plain, export_unused, export_gpl, + export_unused_gpl, export_gpl_future, export_unknown +}; void fatal(const char *fmt, ...) { @@ -191,7 +194,9 @@ static struct { enum export export; } export_list[] = { { .str = "EXPORT_SYMBOL", .export = export_plain }, + { .str = "EXPORT_UNUSED_SYMBOL", .export = export_unused }, { .str = "EXPORT_SYMBOL_GPL", .export = export_gpl }, + { .str = "EXPORT_UNUSED_SYMBOL_GPL", .export = export_unused_gpl }, { .str = "EXPORT_SYMBOL_GPL_FUTURE", .export = export_gpl_future }, { .str = "(unknown)", .export = export_unknown }, }; @@ -218,8 +223,12 @@ static enum export export_from_sec(struct elf_info *elf, Elf_Section sec) { if (sec == elf->export_sec) return export_plain; + else if (sec == elf->export_unused_sec) + return export_unused; else if (sec == elf->export_gpl_sec) return export_gpl; + else if (sec == elf->export_unused_gpl_sec) + return export_unused_gpl; else if (sec == elf->export_gpl_future_sec) return export_gpl_future; else @@ -368,8 +377,12 @@ static void parse_elf(struct elf_info *info, const char *filename) info->modinfo_len = sechdrs[i].sh_size; } else if (strcmp(secname, "__ksymtab") == 0) info->export_sec = i; + else if (strcmp(secname, "__ksymtab_unused") == 0) + info->export_unused_sec = i; else if (strcmp(secname, "__ksymtab_gpl") == 0) info->export_gpl_sec = i; + else if (strcmp(secname, "__ksymtab_unused_gpl") == 0) + info->export_unused_gpl_sec = i; else if (strcmp(secname, "__ksymtab_gpl_future") == 0) info->export_gpl_future_sec = i; @@ -1087,38 +1100,64 @@ void buf_write(struct buffer *buf, const char *s, int len) buf->pos += len; } -void check_license(struct module *mod) +static void check_for_gpl_usage(enum export exp, const char *m, const char *s) +{ + const char *e = is_vmlinux(m) ?"":".ko"; + + switch (exp) { + case export_gpl: + fatal("modpost: GPL-incompatible module %s%s " + "uses GPL-only symbol '%s'\n", m, e, s); + break; + case export_unused_gpl: + fatal("modpost: GPL-incompatible module %s%s " + "uses GPL-only symbol marked UNUSED '%s'\n", m, e, s); + break; + case export_gpl_future: + warn("modpost: GPL-incompatible module %s%s " + "uses future GPL-only symbol '%s'\n", m, e, s); + break; + case export_plain: + case export_unused: + case export_unknown: + /* ignore */ + break; + } +} + +static void check_for_unused(enum export exp, const char* m, const char* s) +{ + const char *e = is_vmlinux(m) ?"":".ko"; + + switch (exp) { + case export_unused: + case export_unused_gpl: + warn("modpost: module %s%s " + "uses symbol '%s' marked UNUSED\n", m, e, s); + break; + default: + /* ignore */ + break; + } +} + +static void check_exports(struct module *mod) { struct symbol *s, *exp; for (s = mod->unres; s; s = s->next) { const char *basename; - if (mod->gpl_compatible == 1) { - /* GPL-compatible modules may use all symbols */ - continue; - } exp = find_symbol(s->name); if (!exp || exp->module == mod) continue; basename = strrchr(mod->name, '/'); if (basename) basename++; - switch (exp->export) { - case export_gpl: - fatal("modpost: GPL-incompatible module %s " - "uses GPL-only symbol '%s'\n", - basename ? basename : mod->name, - exp->name); - break; - case export_gpl_future: - warn("modpost: GPL-incompatible module %s " - "uses future GPL-only symbol '%s'\n", - basename ? basename : mod->name, - exp->name); - break; - case export_plain: /* ignore */ break; - case export_unknown: /* ignore */ break; - } + else + basename = mod->name; + if (!mod->gpl_compatible) + check_for_gpl_usage(exp->export, basename, exp->name); + check_for_unused(exp->export, basename, exp->name); } } @@ -1399,7 +1438,7 @@ int main(int argc, char **argv) for (mod = modules; mod; mod = mod->next) { if (mod->skip) continue; - check_license(mod); + check_exports(mod); } for (mod = modules; mod; mod = mod->next) { diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 2b00c606284..d398c61e55e 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -117,7 +117,9 @@ struct elf_info { Elf_Sym *symtab_start; Elf_Sym *symtab_stop; Elf_Section export_sec; + Elf_Section export_unused_sec; Elf_Section export_gpl_sec; + Elf_Section export_unused_gpl_sec; Elf_Section export_gpl_future_sec; const char *strtab; char *modinfo; -- cgit v1.2.3-18-g5258