History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

The only slightly tricky merge conflict was the netdevsim because the mutex locking fix overlapped a lot of driver reload reorganization. The rest were (relatively) trivial in nature.

David S. Miller committed 7 years ago

Commit d31e9552 parents c23fcbb 1204c70623 files · +5913 −3528Browse files

Showing the changes to scripts (4 of 623 files). Show all

Unified · Split

4 files
  1. scripts/mod/modpost.c +40 −19
  2. scripts/mod/modpost.h +1 −0
  3. scripts/nsdeps +1 −1
  4. scripts/setlocalversion +1 −1
scripts/mod/modpost.c+40−19
@@ -348,26 +348,38 @@ static enum export export_from_sec(struct elf_info *elf, unsigned int sec) · 347 unmodified lines
348348 return export_unknown;
349349 }
350350
351−static char *sym_extract_namespace(const char **symname)
351+static const char *namespace_from_kstrtabns(struct elf_info *info,
352+ Elf_Sym *kstrtabns)
352353 {
353− char *namespace = NULL;
354− char *ns_separator;
354+ char *value = info->ksymtab_strings + kstrtabns->st_value;
355+ return value[0] ? value : NULL;
356+}
357+
358+static void sym_update_namespace(const char *symname, const char *namespace)
359+{
360+ struct symbol *s = find_symbol(symname);
355361
356− ns_separator = strchr(*symname, '.');
357− if (ns_separator) {
358− namespace = NOFAIL(strndup(*symname, ns_separator - *symname));
359− *symname = ns_separator + 1;
362+ /*
363+ * That symbol should have been created earlier and thus this is
364+ * actually an assertion.
365+ */
366+ if (!s) {
367+ merror("Could not update namespace(%s) for symbol %s\n",
368+ namespace, symname);
369+ return;
360370 }
361371
362− return namespace;
372+ free(s->namespace);
373+ s->namespace =
374+ namespace && namespace[0] ? NOFAIL(strdup(namespace)) : NULL;
363375 }
364376
365377 /**
366378 * Add an exported symbol - it may have already been added without a
367379 * CRC, in this case just update the CRC
368380 **/
369−static struct symbol *sym_add_exported(const char *name, const char *namespace,
370− struct module *mod, enum export export)
381+static struct symbol *sym_add_exported(const char *name, struct module *mod,
382+ enum export export)
371383 {
372384 struct symbol *s = find_symbol(name);
373385
@@ -383,8 +395,6 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace, · 9 unmodified lines
383395 s->module = mod;
384396 }
385397 }
386− free(s->namespace);
387− s->namespace = namespace ? strdup(namespace) : NULL;
388398 s->preloaded = 0;
389399 s->vmlinux = is_vmlinux(mod->name);
390400 s->kernel = 0;
@@ -583,6 +593,10 @@ static int parse_elf(struct elf_info *info, const char *filename) · 192 unmodified lines
583593 info->export_unused_gpl_sec = i;
584594 else if (strcmp(secname, "__ksymtab_gpl_future") == 0)
585595 info->export_gpl_future_sec = i;
596+ else if (strcmp(secname, "__ksymtab_strings") == 0)
597+ info->ksymtab_strings = (void *)hdr +
598+ sechdrs[i].sh_offset -
599+ sechdrs[i].sh_addr;
586600
587601 if (sechdrs[i].sh_type == SHT_SYMTAB) {
588602 unsigned int sh_link_idx;
@@ -672,7 +686,6 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 83 unmodified lines
672686 enum export export;
673687 bool is_crc = false;
674688 const char *name;
675− char *namespace;
676689
677690 if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
678691 strstarts(symname, "__ksymtab"))
@@ -745,9 +758,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 66 unmodified lines
745758 /* All exported symbols */
746759 if (strstarts(symname, "__ksymtab_")) {
747760 name = symname + strlen("__ksymtab_");
748− namespace = sym_extract_namespace(&name);
749− sym_add_exported(name, namespace, mod, export);
750− free(namespace);
761+ sym_add_exported(name, mod, export);
751762 }
752763 if (strcmp(symname, "init_module") == 0)
753764 mod->has_init = 1;
@@ -2043,6 +2054,16 @@ static void read_symbols(const char *modname) · 1289 unmodified lines
20432054 handle_moddevtable(mod, &info, sym, symname);
20442055 }
20452056
2057+ /* Apply symbol namespaces from __kstrtabns_<symbol> entries. */
2058+ for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
2059+ symname = remove_dot(info.strtab + sym->st_name);
2060+
2061+ if (strstarts(symname, "__kstrtabns_"))
2062+ sym_update_namespace(symname + strlen("__kstrtabns_"),
2063+ namespace_from_kstrtabns(&info,
2064+ sym));
2065+ }
2066+
20462067 // check for static EXPORT_SYMBOL_* functions && global vars
20472068 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
20482069 unsigned char bind = ELF_ST_BIND(sym->st_info);
@@ -2196,7 +2217,7 @@ static int check_exports(struct module *mod) · 147 unmodified lines
21962217 else
21972218 basename = mod->name;
21982219
2199− if (exp->namespace && exp->namespace[0]) {
2220+ if (exp->namespace) {
22002221 add_namespace(&mod->required_namespaces,
22012222 exp->namespace);
22022223
@@ -2454,12 +2475,12 @@ static void read_dump(const char *fname, unsigned int kernel) · 251 unmodified lines
24542475 mod = new_module(modname);
24552476 mod->skip = 1;
24562477 }
2457− s = sym_add_exported(symname, namespace, mod,
2458− export_no(export));
2478+ s = sym_add_exported(symname, mod, export_no(export));
24592479 s->kernel = kernel;
24602480 s->preloaded = 1;
24612481 s->is_static = 0;
24622482 sym_update_crc(symname, mod, crc, export_no(export));
2483+ sym_update_namespace(symname, namespace);
24632484 }
24642485 release_file(file, size);
24652486 return;
scripts/mod/modpost.h+1−0
@@ -143,6 +143,7 @@ struct elf_info { · 142 unmodified lines
143143 Elf_Section export_gpl_sec;
144144 Elf_Section export_unused_gpl_sec;
145145 Elf_Section export_gpl_future_sec;
146+ char *ksymtab_strings;
146147 char *strtab;
147148 char *modinfo;
148149 unsigned int modinfo_len;
scripts/nsdeps+1−1
@@ -33,7 +33,7 @@ generate_deps() { · 32 unmodified lines
3333 if [ ! -f "$ns_deps_file" ]; then return; fi
3434 local mod_source_files=`cat $mod_file | sed -n 1p \
3535 | sed -e 's/\.o/\.c/g' \
36− | sed "s/[^ ]* */${srctree}\/&/g"`
36+ | sed "s|[^ ]* *|${srctree}/&|g"`
3737 for ns in `cat $ns_deps_file`; do
3838 echo "Adding namespace $ns to module $mod_name (if needed)."
3939 generate_deps_for_ns $ns $mod_source_files
scripts/setlocalversion+1−1
@@ -93,7 +93,7 @@ scm_version() · 92 unmodified lines
9393 # Check for mercurial and a mercurial repo.
9494 if test -d .hg && hgid=`hg id 2>/dev/null`; then
9595 # Do we have an tagged version? If so, latesttagdistance == 1
96− if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
96+ if [ "`hg log -r . --template '{latesttagdistance}'`" = "1" ]; then
9797 id=`hg log -r . --template '{latesttag}'`
9898 printf '%s%s' -hg "$id"
9999 else

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t