diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mod/file2alias.c | 4 | ||||
-rw-r--r-- | scripts/mod/mk_elfconfig.c | 4 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 70 | ||||
-rw-r--r-- | scripts/mod/modpost.h | 8 |
4 files changed, 43 insertions, 43 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 1346223f7809..e7b5350b65ce 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -34,7 +34,7 @@ typedef uint16_t __u16; | |||
34 | typedef unsigned char __u8; | 34 | typedef unsigned char __u8; |
35 | 35 | ||
36 | /* Big exception to the "don't include kernel headers into userspace, which | 36 | /* Big exception to the "don't include kernel headers into userspace, which |
37 | * even potentially has different endianness and word sizes, since | 37 | * even potentially has different endianness and word sizes, since |
38 | * we handle those differences explicitly below */ | 38 | * we handle those differences explicitly below */ |
39 | #include "../../include/linux/mod_devicetable.h" | 39 | #include "../../include/linux/mod_devicetable.h" |
40 | #include "../../include/linux/input.h" | 40 | #include "../../include/linux/input.h" |
@@ -228,7 +228,7 @@ static int do_pci_entry(const char *filename, | |||
228 | return 1; | 228 | return 1; |
229 | } | 229 | } |
230 | 230 | ||
231 | /* looks like: "ccw:tNmNdtNdmN" */ | 231 | /* looks like: "ccw:tNmNdtNdmN" */ |
232 | static int do_ccw_entry(const char *filename, | 232 | static int do_ccw_entry(const char *filename, |
233 | struct ccw_device_id *id, char *alias) | 233 | struct ccw_device_id *id, char *alias) |
234 | { | 234 | { |
diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c index de2aabf89fb3..3c92c83733f4 100644 --- a/scripts/mod/mk_elfconfig.c +++ b/scripts/mod/mk_elfconfig.c | |||
@@ -6,7 +6,7 @@ | |||
6 | int | 6 | int |
7 | main(int argc, char **argv) | 7 | main(int argc, char **argv) |
8 | { | 8 | { |
9 | unsigned char ei[EI_NIDENT]; | 9 | unsigned char ei[EI_NIDENT]; |
10 | union { short s; char c[2]; } endian_test; | 10 | union { short s; char c[2]; } endian_test; |
11 | 11 | ||
12 | if (argc != 2) { | 12 | if (argc != 2) { |
@@ -57,7 +57,7 @@ main(int argc, char **argv) | |||
57 | 57 | ||
58 | if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0)) | 58 | if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0)) |
59 | printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); | 59 | printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); |
60 | else | 60 | else |
61 | printf("#define MODULE_SYMBOL_PREFIX \"\"\n"); | 61 | printf("#define MODULE_SYMBOL_PREFIX \"\"\n"); |
62 | 62 | ||
63 | return 0; | 63 | return 0; |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 663b1eff757b..5de3c63091e9 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -85,7 +85,7 @@ static struct module *new_module(char *modname) | |||
85 | { | 85 | { |
86 | struct module *mod; | 86 | struct module *mod; |
87 | char *p, *s; | 87 | char *p, *s; |
88 | 88 | ||
89 | mod = NOFAIL(malloc(sizeof(*mod))); | 89 | mod = NOFAIL(malloc(sizeof(*mod))); |
90 | memset(mod, 0, sizeof(*mod)); | 90 | memset(mod, 0, sizeof(*mod)); |
91 | p = NOFAIL(strdup(modname)); | 91 | p = NOFAIL(strdup(modname)); |
@@ -320,9 +320,9 @@ static void parse_elf(struct elf_info *info, const char *filename) | |||
320 | continue; | 320 | continue; |
321 | 321 | ||
322 | info->symtab_start = (void *)hdr + sechdrs[i].sh_offset; | 322 | info->symtab_start = (void *)hdr + sechdrs[i].sh_offset; |
323 | info->symtab_stop = (void *)hdr + sechdrs[i].sh_offset | 323 | info->symtab_stop = (void *)hdr + sechdrs[i].sh_offset |
324 | + sechdrs[i].sh_size; | 324 | + sechdrs[i].sh_size; |
325 | info->strtab = (void *)hdr + | 325 | info->strtab = (void *)hdr + |
326 | sechdrs[sechdrs[i].sh_link].sh_offset; | 326 | sechdrs[sechdrs[i].sh_link].sh_offset; |
327 | } | 327 | } |
328 | if (!info->symtab_start) { | 328 | if (!info->symtab_start) { |
@@ -387,15 +387,15 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
387 | /* Ignore register directives. */ | 387 | /* Ignore register directives. */ |
388 | if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) | 388 | if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) |
389 | break; | 389 | break; |
390 | if (symname[0] == '.') { | 390 | if (symname[0] == '.') { |
391 | char *munged = strdup(symname); | 391 | char *munged = strdup(symname); |
392 | munged[0] = '_'; | 392 | munged[0] = '_'; |
393 | munged[1] = toupper(munged[1]); | 393 | munged[1] = toupper(munged[1]); |
394 | symname = munged; | 394 | symname = munged; |
395 | } | 395 | } |
396 | } | 396 | } |
397 | #endif | 397 | #endif |
398 | 398 | ||
399 | if (memcmp(symname, MODULE_SYMBOL_PREFIX, | 399 | if (memcmp(symname, MODULE_SYMBOL_PREFIX, |
400 | strlen(MODULE_SYMBOL_PREFIX)) == 0) | 400 | strlen(MODULE_SYMBOL_PREFIX)) == 0) |
401 | mod->unres = alloc_symbol(symname + | 401 | mod->unres = alloc_symbol(symname + |
@@ -458,13 +458,13 @@ static char *get_modinfo(void *modinfo, unsigned long modinfo_len, | |||
458 | static int strrcmp(const char *s, const char *sub) | 458 | static int strrcmp(const char *s, const char *sub) |
459 | { | 459 | { |
460 | int slen, sublen; | 460 | int slen, sublen; |
461 | 461 | ||
462 | if (!s || !sub) | 462 | if (!s || !sub) |
463 | return 1; | 463 | return 1; |
464 | 464 | ||
465 | slen = strlen(s); | 465 | slen = strlen(s); |
466 | sublen = strlen(sub); | 466 | sublen = strlen(sub); |
467 | 467 | ||
468 | if ((slen == 0) || (sublen == 0)) | 468 | if ((slen == 0) || (sublen == 0)) |
469 | return 1; | 469 | return 1; |
470 | 470 | ||
@@ -485,7 +485,7 @@ static int strrcmp(const char *s, const char *sub) | |||
485 | * tosec = .init.data | 485 | * tosec = .init.data |
486 | * fromsec = .data | 486 | * fromsec = .data |
487 | * atsym =__param* | 487 | * atsym =__param* |
488 | * | 488 | * |
489 | * Pattern 2: | 489 | * Pattern 2: |
490 | * Many drivers utilise a *_driver container with references to | 490 | * Many drivers utilise a *_driver container with references to |
491 | * add, remove, probe functions etc. | 491 | * add, remove, probe functions etc. |
@@ -508,7 +508,7 @@ static int secref_whitelist(const char *tosec, const char *fromsec, | |||
508 | "_probe_one", | 508 | "_probe_one", |
509 | NULL | 509 | NULL |
510 | }; | 510 | }; |
511 | 511 | ||
512 | /* Check for pattern 1 */ | 512 | /* Check for pattern 1 */ |
513 | if (strcmp(tosec, ".init.data") != 0) | 513 | if (strcmp(tosec, ".init.data") != 0) |
514 | f1 = 0; | 514 | f1 = 0; |
@@ -521,7 +521,7 @@ static int secref_whitelist(const char *tosec, const char *fromsec, | |||
521 | return f1; | 521 | return f1; |
522 | 522 | ||
523 | /* Check for pattern 2 */ | 523 | /* Check for pattern 2 */ |
524 | if ((strcmp(tosec, ".init.text") != 0) && | 524 | if ((strcmp(tosec, ".init.text") != 0) && |
525 | (strcmp(tosec, ".exit.text") != 0)) | 525 | (strcmp(tosec, ".exit.text") != 0)) |
526 | f2 = 0; | 526 | f2 = 0; |
527 | if (strcmp(fromsec, ".data") != 0) | 527 | if (strcmp(fromsec, ".data") != 0) |
@@ -570,7 +570,7 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr, | |||
570 | Elf_Addr afterdiff = ~0; | 570 | Elf_Addr afterdiff = ~0; |
571 | const char *secstrings = (void *)hdr + | 571 | const char *secstrings = (void *)hdr + |
572 | elf->sechdrs[hdr->e_shstrndx].sh_offset; | 572 | elf->sechdrs[hdr->e_shstrndx].sh_offset; |
573 | 573 | ||
574 | *before = NULL; | 574 | *before = NULL; |
575 | *after = NULL; | 575 | *after = NULL; |
576 | 576 | ||
@@ -614,7 +614,7 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec, | |||
614 | const char *secstrings = (void *)hdr + | 614 | const char *secstrings = (void *)hdr + |
615 | sechdrs[hdr->e_shstrndx].sh_offset; | 615 | sechdrs[hdr->e_shstrndx].sh_offset; |
616 | const char *secname = secstrings + sechdrs[sym->st_shndx].sh_name; | 616 | const char *secname = secstrings + sechdrs[sym->st_shndx].sh_name; |
617 | 617 | ||
618 | find_symbols_between(elf, r.r_offset, fromsec, &before, &after); | 618 | find_symbols_between(elf, r.r_offset, fromsec, &before, &after); |
619 | 619 | ||
620 | refsym = find_elf_symbol(elf, r.r_addend, sym); | 620 | refsym = find_elf_symbol(elf, r.r_addend, sym); |
@@ -622,10 +622,10 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec, | |||
622 | refsymname = elf->strtab + refsym->st_name; | 622 | refsymname = elf->strtab + refsym->st_name; |
623 | 623 | ||
624 | /* check whitelist - we may ignore it */ | 624 | /* check whitelist - we may ignore it */ |
625 | if (before && | 625 | if (before && |
626 | secref_whitelist(secname, fromsec, elf->strtab + before->st_name)) | 626 | secref_whitelist(secname, fromsec, elf->strtab + before->st_name)) |
627 | return; | 627 | return; |
628 | 628 | ||
629 | if (before && after) { | 629 | if (before && after) { |
630 | warn("%s - Section mismatch: reference to %s:%s from %s " | 630 | warn("%s - Section mismatch: reference to %s:%s from %s " |
631 | "between '%s' (at offset 0x%llx) and '%s'\n", | 631 | "between '%s' (at offset 0x%llx) and '%s'\n", |
@@ -636,13 +636,13 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec, | |||
636 | } else if (before) { | 636 | } else if (before) { |
637 | warn("%s - Section mismatch: reference to %s:%s from %s " | 637 | warn("%s - Section mismatch: reference to %s:%s from %s " |
638 | "after '%s' (at offset 0x%llx)\n", | 638 | "after '%s' (at offset 0x%llx)\n", |
639 | modname, secname, refsymname, fromsec, | 639 | modname, secname, refsymname, fromsec, |
640 | elf->strtab + before->st_name, | 640 | elf->strtab + before->st_name, |
641 | (long long)r.r_offset); | 641 | (long long)r.r_offset); |
642 | } else if (after) { | 642 | } else if (after) { |
643 | warn("%s - Section mismatch: reference to %s:%s from %s " | 643 | warn("%s - Section mismatch: reference to %s:%s from %s " |
644 | "before '%s' (at offset -0x%llx)\n", | 644 | "before '%s' (at offset -0x%llx)\n", |
645 | modname, secname, refsymname, fromsec, | 645 | modname, secname, refsymname, fromsec, |
646 | elf->strtab + before->st_name, | 646 | elf->strtab + before->st_name, |
647 | (long long)r.r_offset); | 647 | (long long)r.r_offset); |
648 | } else { | 648 | } else { |
@@ -676,7 +676,7 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
676 | Elf_Shdr *sechdrs = elf->sechdrs; | 676 | Elf_Shdr *sechdrs = elf->sechdrs; |
677 | const char *secstrings = (void *)hdr + | 677 | const char *secstrings = (void *)hdr + |
678 | sechdrs[hdr->e_shstrndx].sh_offset; | 678 | sechdrs[hdr->e_shstrndx].sh_offset; |
679 | 679 | ||
680 | /* Walk through all sections */ | 680 | /* Walk through all sections */ |
681 | for (i = 0; i < hdr->e_shnum; i++) { | 681 | for (i = 0; i < hdr->e_shnum; i++) { |
682 | Elf_Rela *rela; | 682 | Elf_Rela *rela; |
@@ -724,13 +724,13 @@ static int init_section(const char *name) | |||
724 | 724 | ||
725 | /** | 725 | /** |
726 | * Identify sections from which references to a .init section is OK. | 726 | * Identify sections from which references to a .init section is OK. |
727 | * | 727 | * |
728 | * Unfortunately references to read only data that referenced .init | 728 | * Unfortunately references to read only data that referenced .init |
729 | * sections had to be excluded. Almost all of these are false | 729 | * sections had to be excluded. Almost all of these are false |
730 | * positives, they are created by gcc. The downside of excluding rodata | 730 | * positives, they are created by gcc. The downside of excluding rodata |
731 | * is that there really are some user references from rodata to | 731 | * is that there really are some user references from rodata to |
732 | * init code, e.g. drivers/video/vgacon.c: | 732 | * init code, e.g. drivers/video/vgacon.c: |
733 | * | 733 | * |
734 | * const struct consw vga_con = { | 734 | * const struct consw vga_con = { |
735 | * con_startup: vgacon_startup, | 735 | * con_startup: vgacon_startup, |
736 | * | 736 | * |
@@ -769,10 +769,10 @@ static int init_section_ref_ok(const char *name) | |||
769 | for (s = namelist1; *s; s++) | 769 | for (s = namelist1; *s; s++) |
770 | if (strcmp(*s, name) == 0) | 770 | if (strcmp(*s, name) == 0) |
771 | return 1; | 771 | return 1; |
772 | for (s = namelist2; *s; s++) | 772 | for (s = namelist2; *s; s++) |
773 | if (strncmp(*s, name, strlen(*s)) == 0) | 773 | if (strncmp(*s, name, strlen(*s)) == 0) |
774 | return 1; | 774 | return 1; |
775 | for (s = namelist3; *s; s++) | 775 | for (s = namelist3; *s; s++) |
776 | if (strstr(*s, name) != NULL) | 776 | if (strstr(*s, name) != NULL) |
777 | return 1; | 777 | return 1; |
778 | return 0; | 778 | return 0; |
@@ -792,12 +792,12 @@ static int exit_section(const char *name) | |||
792 | if (strcmp(name, ".exit.data") == 0) | 792 | if (strcmp(name, ".exit.data") == 0) |
793 | return 1; | 793 | return 1; |
794 | return 0; | 794 | return 0; |
795 | 795 | ||
796 | } | 796 | } |
797 | 797 | ||
798 | /* | 798 | /* |
799 | * Identify sections from which references to a .exit section is OK. | 799 | * Identify sections from which references to a .exit section is OK. |
800 | * | 800 | * |
801 | * [OPD] Keith Ownes <kaos@sgi.com> commented: | 801 | * [OPD] Keith Ownes <kaos@sgi.com> commented: |
802 | * For our future {in}sanity, add a comment that this is the ppc .opd | 802 | * For our future {in}sanity, add a comment that this is the ppc .opd |
803 | * section, not the ia64 .opd section. | 803 | * section, not the ia64 .opd section. |
@@ -829,14 +829,14 @@ static int exit_section_ref_ok(const char *name) | |||
829 | ".unwind", /* Sample: IA_64.unwind.exit.text */ | 829 | ".unwind", /* Sample: IA_64.unwind.exit.text */ |
830 | NULL | 830 | NULL |
831 | }; | 831 | }; |
832 | 832 | ||
833 | for (s = namelist1; *s; s++) | 833 | for (s = namelist1; *s; s++) |
834 | if (strcmp(*s, name) == 0) | 834 | if (strcmp(*s, name) == 0) |
835 | return 1; | 835 | return 1; |
836 | for (s = namelist2; *s; s++) | 836 | for (s = namelist2; *s; s++) |
837 | if (strncmp(*s, name, strlen(*s)) == 0) | 837 | if (strncmp(*s, name, strlen(*s)) == 0) |
838 | return 1; | 838 | return 1; |
839 | for (s = namelist3; *s; s++) | 839 | for (s = namelist3; *s; s++) |
840 | if (strstr(*s, name) != NULL) | 840 | if (strstr(*s, name) != NULL) |
841 | return 1; | 841 | return 1; |
842 | return 0; | 842 | return 0; |
@@ -900,7 +900,7 @@ void __attribute__((format(printf, 2, 3))) buf_printf(struct buffer *buf, | |||
900 | char tmp[SZ]; | 900 | char tmp[SZ]; |
901 | int len; | 901 | int len; |
902 | va_list ap; | 902 | va_list ap; |
903 | 903 | ||
904 | va_start(ap, fmt); | 904 | va_start(ap, fmt); |
905 | len = vsnprintf(tmp, SZ, fmt, ap); | 905 | len = vsnprintf(tmp, SZ, fmt, ap); |
906 | if (buf->size - buf->pos < len + 1) { | 906 | if (buf->size - buf->pos < len + 1) { |
@@ -1129,7 +1129,7 @@ static int dump_sym(struct symbol *sym) | |||
1129 | return 0; | 1129 | return 0; |
1130 | return 1; | 1130 | return 1; |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | static void write_dump(const char *fname) | 1133 | static void write_dump(const char *fname) |
1134 | { | 1134 | { |
1135 | struct buffer buf = { }; | 1135 | struct buffer buf = { }; |
@@ -1141,7 +1141,7 @@ static void write_dump(const char *fname) | |||
1141 | while (symbol) { | 1141 | while (symbol) { |
1142 | if (dump_sym(symbol)) | 1142 | if (dump_sym(symbol)) |
1143 | buf_printf(&buf, "0x%08x\t%s\t%s\n", | 1143 | buf_printf(&buf, "0x%08x\t%s\t%s\n", |
1144 | symbol->crc, symbol->name, | 1144 | symbol->crc, symbol->name, |
1145 | symbol->module->name); | 1145 | symbol->module->name); |
1146 | symbol = symbol->next; | 1146 | symbol = symbol->next; |
1147 | } | 1147 | } |
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 3b5319dd937f..b14255c72a37 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h | |||
@@ -13,8 +13,8 @@ | |||
13 | 13 | ||
14 | #if KERNEL_ELFCLASS == ELFCLASS32 | 14 | #if KERNEL_ELFCLASS == ELFCLASS32 |
15 | 15 | ||
16 | #define Elf_Ehdr Elf32_Ehdr | 16 | #define Elf_Ehdr Elf32_Ehdr |
17 | #define Elf_Shdr Elf32_Shdr | 17 | #define Elf_Shdr Elf32_Shdr |
18 | #define Elf_Sym Elf32_Sym | 18 | #define Elf_Sym Elf32_Sym |
19 | #define Elf_Addr Elf32_Addr | 19 | #define Elf_Addr Elf32_Addr |
20 | #define Elf_Section Elf32_Section | 20 | #define Elf_Section Elf32_Section |
@@ -26,8 +26,8 @@ | |||
26 | #define ELF_R_TYPE ELF32_R_TYPE | 26 | #define ELF_R_TYPE ELF32_R_TYPE |
27 | #else | 27 | #else |
28 | 28 | ||
29 | #define Elf_Ehdr Elf64_Ehdr | 29 | #define Elf_Ehdr Elf64_Ehdr |
30 | #define Elf_Shdr Elf64_Shdr | 30 | #define Elf_Shdr Elf64_Shdr |
31 | #define Elf_Sym Elf64_Sym | 31 | #define Elf_Sym Elf64_Sym |
32 | #define Elf_Addr Elf64_Addr | 32 | #define Elf_Addr Elf64_Addr |
33 | #define Elf_Section Elf64_Section | 33 | #define Elf_Section Elf64_Section |