Commit a8773769d1a1e08d0ca15f890515401ab3860637
Committed by
Rusty Russell
1 parent
9e1b9b8072
Exists in
master
and in
39 other branches
Kbuild: clear marker out of modpost
Remove the unnecessary functions and variables. Signed-off-by: Wenji Huang <wenji.huang@oracle.com> Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Showing 2 changed files with 0 additions and 167 deletions Side-by-side Diff
scripts/mod/modpost.c
... | ... | @@ -460,8 +460,6 @@ |
460 | 460 | info->export_unused_gpl_sec = i; |
461 | 461 | else if (strcmp(secname, "__ksymtab_gpl_future") == 0) |
462 | 462 | info->export_gpl_future_sec = i; |
463 | - else if (strcmp(secname, "__markers_strings") == 0) | |
464 | - info->markers_strings_sec = i; | |
465 | 463 | |
466 | 464 | if (sechdrs[i].sh_type != SHT_SYMTAB) |
467 | 465 | continue; |
... | ... | @@ -1518,62 +1516,6 @@ |
1518 | 1516 | } |
1519 | 1517 | } |
1520 | 1518 | |
1521 | -static void get_markers(struct elf_info *info, struct module *mod) | |
1522 | -{ | |
1523 | - const Elf_Shdr *sh = &info->sechdrs[info->markers_strings_sec]; | |
1524 | - const char *strings = (const char *) info->hdr + sh->sh_offset; | |
1525 | - const Elf_Sym *sym, *first_sym, *last_sym; | |
1526 | - size_t n; | |
1527 | - | |
1528 | - if (!info->markers_strings_sec) | |
1529 | - return; | |
1530 | - | |
1531 | - /* | |
1532 | - * First count the strings. We look for all the symbols defined | |
1533 | - * in the __markers_strings section named __mstrtab_*. For | |
1534 | - * these local names, the compiler puts a random .NNN suffix on, | |
1535 | - * so the names don't correspond exactly. | |
1536 | - */ | |
1537 | - first_sym = last_sym = NULL; | |
1538 | - n = 0; | |
1539 | - for (sym = info->symtab_start; sym < info->symtab_stop; sym++) | |
1540 | - if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT && | |
1541 | - sym->st_shndx == info->markers_strings_sec && | |
1542 | - !strncmp(info->strtab + sym->st_name, | |
1543 | - "__mstrtab_", sizeof "__mstrtab_" - 1)) { | |
1544 | - if (first_sym == NULL) | |
1545 | - first_sym = sym; | |
1546 | - last_sym = sym; | |
1547 | - ++n; | |
1548 | - } | |
1549 | - | |
1550 | - if (n == 0) | |
1551 | - return; | |
1552 | - | |
1553 | - /* | |
1554 | - * Now collect each name and format into a line for the output. | |
1555 | - * Lines look like: | |
1556 | - * marker_name vmlinux marker %s format %d | |
1557 | - * The format string after the second \t can use whitespace. | |
1558 | - */ | |
1559 | - mod->markers = NOFAIL(malloc(sizeof mod->markers[0] * n)); | |
1560 | - mod->nmarkers = n; | |
1561 | - | |
1562 | - n = 0; | |
1563 | - for (sym = first_sym; sym <= last_sym; sym++) | |
1564 | - if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT && | |
1565 | - sym->st_shndx == info->markers_strings_sec && | |
1566 | - !strncmp(info->strtab + sym->st_name, | |
1567 | - "__mstrtab_", sizeof "__mstrtab_" - 1)) { | |
1568 | - const char *name = strings + sym->st_value; | |
1569 | - const char *fmt = strchr(name, '\0') + 1; | |
1570 | - char *line = NULL; | |
1571 | - asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt); | |
1572 | - NOFAIL(line); | |
1573 | - mod->markers[n++] = line; | |
1574 | - } | |
1575 | -} | |
1576 | - | |
1577 | 1519 | static void read_symbols(char *modname) |
1578 | 1520 | { |
1579 | 1521 | const char *symname; |
... | ... | @@ -1629,8 +1571,6 @@ |
1629 | 1571 | get_src_version(modname, mod->srcversion, |
1630 | 1572 | sizeof(mod->srcversion)-1); |
1631 | 1573 | |
1632 | - get_markers(&info, mod); | |
1633 | - | |
1634 | 1574 | parse_elf_finish(&info); |
1635 | 1575 | |
1636 | 1576 | /* Our trick to get versioning for module struct etc. - it's |
... | ... | @@ -1985,96 +1925,6 @@ |
1985 | 1925 | write_if_changed(&buf, fname); |
1986 | 1926 | } |
1987 | 1927 | |
1988 | -static void add_marker(struct module *mod, const char *name, const char *fmt) | |
1989 | -{ | |
1990 | - char *line = NULL; | |
1991 | - asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt); | |
1992 | - NOFAIL(line); | |
1993 | - | |
1994 | - mod->markers = NOFAIL(realloc(mod->markers, ((mod->nmarkers + 1) * | |
1995 | - sizeof mod->markers[0]))); | |
1996 | - mod->markers[mod->nmarkers++] = line; | |
1997 | -} | |
1998 | - | |
1999 | -static void read_markers(const char *fname) | |
2000 | -{ | |
2001 | - unsigned long size, pos = 0; | |
2002 | - void *file = grab_file(fname, &size); | |
2003 | - char *line; | |
2004 | - | |
2005 | - if (!file) /* No old markers, silently ignore */ | |
2006 | - return; | |
2007 | - | |
2008 | - while ((line = get_next_line(&pos, file, size))) { | |
2009 | - char *marker, *modname, *fmt; | |
2010 | - struct module *mod; | |
2011 | - | |
2012 | - marker = line; | |
2013 | - modname = strchr(marker, '\t'); | |
2014 | - if (!modname) | |
2015 | - goto fail; | |
2016 | - *modname++ = '\0'; | |
2017 | - fmt = strchr(modname, '\t'); | |
2018 | - if (!fmt) | |
2019 | - goto fail; | |
2020 | - *fmt++ = '\0'; | |
2021 | - if (*marker == '\0' || *modname == '\0') | |
2022 | - goto fail; | |
2023 | - | |
2024 | - mod = find_module(modname); | |
2025 | - if (!mod) { | |
2026 | - mod = new_module(modname); | |
2027 | - mod->skip = 1; | |
2028 | - } | |
2029 | - if (is_vmlinux(modname)) { | |
2030 | - have_vmlinux = 1; | |
2031 | - mod->skip = 0; | |
2032 | - } | |
2033 | - | |
2034 | - if (!mod->skip) | |
2035 | - add_marker(mod, marker, fmt); | |
2036 | - } | |
2037 | - release_file(file, size); | |
2038 | - return; | |
2039 | -fail: | |
2040 | - fatal("parse error in markers list file\n"); | |
2041 | -} | |
2042 | - | |
2043 | -static int compare_strings(const void *a, const void *b) | |
2044 | -{ | |
2045 | - return strcmp(*(const char **) a, *(const char **) b); | |
2046 | -} | |
2047 | - | |
2048 | -static void write_markers(const char *fname) | |
2049 | -{ | |
2050 | - struct buffer buf = { }; | |
2051 | - struct module *mod; | |
2052 | - size_t i; | |
2053 | - | |
2054 | - for (mod = modules; mod; mod = mod->next) | |
2055 | - if ((!external_module || !mod->skip) && mod->markers != NULL) { | |
2056 | - /* | |
2057 | - * Sort the strings so we can skip duplicates when | |
2058 | - * we write them out. | |
2059 | - */ | |
2060 | - qsort(mod->markers, mod->nmarkers, | |
2061 | - sizeof mod->markers[0], &compare_strings); | |
2062 | - for (i = 0; i < mod->nmarkers; ++i) { | |
2063 | - char *line = mod->markers[i]; | |
2064 | - buf_write(&buf, line, strlen(line)); | |
2065 | - while (i + 1 < mod->nmarkers && | |
2066 | - !strcmp(mod->markers[i], | |
2067 | - mod->markers[i + 1])) | |
2068 | - free(mod->markers[i++]); | |
2069 | - free(mod->markers[i]); | |
2070 | - } | |
2071 | - free(mod->markers); | |
2072 | - mod->markers = NULL; | |
2073 | - } | |
2074 | - | |
2075 | - write_if_changed(&buf, fname); | |
2076 | -} | |
2077 | - | |
2078 | 1928 | struct ext_sym_list { |
2079 | 1929 | struct ext_sym_list *next; |
2080 | 1930 | const char *file; |
... | ... | @@ -2086,8 +1936,6 @@ |
2086 | 1936 | struct buffer buf = { }; |
2087 | 1937 | char *kernel_read = NULL, *module_read = NULL; |
2088 | 1938 | char *dump_write = NULL; |
2089 | - char *markers_read = NULL; | |
2090 | - char *markers_write = NULL; | |
2091 | 1939 | int opt; |
2092 | 1940 | int err; |
2093 | 1941 | struct ext_sym_list *extsym_iter; |
... | ... | @@ -2131,12 +1979,6 @@ |
2131 | 1979 | case 'w': |
2132 | 1980 | warn_unresolved = 1; |
2133 | 1981 | break; |
2134 | - case 'M': | |
2135 | - markers_write = optarg; | |
2136 | - break; | |
2137 | - case 'K': | |
2138 | - markers_read = optarg; | |
2139 | - break; | |
2140 | 1982 | default: |
2141 | 1983 | exit(1); |
2142 | 1984 | } |
... | ... | @@ -2190,12 +2032,6 @@ |
2190 | 2032 | "To see full details build your kernel with:\n" |
2191 | 2033 | "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", |
2192 | 2034 | sec_mismatch_count); |
2193 | - | |
2194 | - if (markers_read) | |
2195 | - read_markers(markers_read); | |
2196 | - | |
2197 | - if (markers_write) | |
2198 | - write_markers(markers_write); | |
2199 | 2035 | |
2200 | 2036 | return err; |
2201 | 2037 | } |
scripts/mod/modpost.h
... | ... | @@ -112,8 +112,6 @@ |
112 | 112 | int has_init; |
113 | 113 | int has_cleanup; |
114 | 114 | struct buffer dev_table_buf; |
115 | - char **markers; | |
116 | - size_t nmarkers; | |
117 | 115 | char srcversion[25]; |
118 | 116 | }; |
119 | 117 | |
... | ... | @@ -128,7 +126,6 @@ |
128 | 126 | Elf_Section export_gpl_sec; |
129 | 127 | Elf_Section export_unused_gpl_sec; |
130 | 128 | Elf_Section export_gpl_future_sec; |
131 | - Elf_Section markers_strings_sec; | |
132 | 129 | const char *strtab; |
133 | 130 | char *modinfo; |
134 | 131 | unsigned int modinfo_len; |