aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c44
-rw-r--r--scripts/mod/mk_elfconfig.c2
-rw-r--r--scripts/mod/modpost.c30
3 files changed, 59 insertions, 17 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index cea4a790e1e9..4c9890ec2528 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -304,6 +304,14 @@ static int do_ap_entry(const char *filename,
304 return 1; 304 return 1;
305} 305}
306 306
307/* looks like: "css:tN" */
308static int do_css_entry(const char *filename,
309 struct css_device_id *id, char *alias)
310{
311 sprintf(alias, "css:t%01X", id->type);
312 return 1;
313}
314
307/* Looks like: "serio:tyNprNidNexN" */ 315/* Looks like: "serio:tyNprNidNexN" */
308static int do_serio_entry(const char *filename, 316static int do_serio_entry(const char *filename,
309 struct serio_device_id *id, char *alias) 317 struct serio_device_id *id, char *alias)
@@ -332,11 +340,24 @@ static int do_acpi_entry(const char *filename,
332} 340}
333 341
334/* looks like: "pnp:dD" */ 342/* looks like: "pnp:dD" */
335static int do_pnp_entry(const char *filename, 343static void do_pnp_device_entry(void *symval, unsigned long size,
336 struct pnp_device_id *id, char *alias) 344 struct module *mod)
337{ 345{
338 sprintf(alias, "pnp:d%s*", id->id); 346 const unsigned long id_size = sizeof(struct pnp_device_id);
339 return 1; 347 const unsigned int count = (size / id_size)-1;
348 const struct pnp_device_id *devs = symval;
349 unsigned int i;
350
351 device_id_check(mod->name, "pnp", size, id_size, symval);
352
353 for (i = 0; i < count; i++) {
354 const char *id = (char *)devs[i].id;
355
356 buf_printf(&mod->dev_table_buf,
357 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
358 buf_printf(&mod->dev_table_buf,
359 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
360 }
340} 361}
341 362
342/* looks like: "pnp:dD" for every device of the card */ 363/* looks like: "pnp:dD" for every device of the card */
@@ -380,9 +401,12 @@ static void do_pnp_card_entries(void *symval, unsigned long size,
380 } 401 }
381 402
382 /* add an individual alias for every device entry */ 403 /* add an individual alias for every device entry */
383 if (!dup) 404 if (!dup) {
384 buf_printf(&mod->dev_table_buf, 405 buf_printf(&mod->dev_table_buf,
385 "MODULE_ALIAS(\"pnp:d%s*\");\n", id); 406 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
407 buf_printf(&mod->dev_table_buf,
408 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
409 }
386 } 410 }
387 } 411 }
388} 412}
@@ -605,7 +629,7 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
605 return 1; 629 return 1;
606} 630}
607 631
608/* Ignore any prefix, eg. v850 prepends _ */ 632/* Ignore any prefix, eg. some architectures prepend _ */
609static inline int sym_is(const char *symbol, const char *name) 633static inline int sym_is(const char *symbol, const char *name)
610{ 634{
611 const char *match; 635 const char *match;
@@ -680,6 +704,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
680 do_table(symval, sym->st_size, 704 do_table(symval, sym->st_size,
681 sizeof(struct ap_device_id), "ap", 705 sizeof(struct ap_device_id), "ap",
682 do_ap_entry, mod); 706 do_ap_entry, mod);
707 else if (sym_is(symname, "__mod_css_device_table"))
708 do_table(symval, sym->st_size,
709 sizeof(struct css_device_id), "css",
710 do_css_entry, mod);
683 else if (sym_is(symname, "__mod_serio_device_table")) 711 else if (sym_is(symname, "__mod_serio_device_table"))
684 do_table(symval, sym->st_size, 712 do_table(symval, sym->st_size,
685 sizeof(struct serio_device_id), "serio", 713 sizeof(struct serio_device_id), "serio",
@@ -689,9 +717,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
689 sizeof(struct acpi_device_id), "acpi", 717 sizeof(struct acpi_device_id), "acpi",
690 do_acpi_entry, mod); 718 do_acpi_entry, mod);
691 else if (sym_is(symname, "__mod_pnp_device_table")) 719 else if (sym_is(symname, "__mod_pnp_device_table"))
692 do_table(symval, sym->st_size, 720 do_pnp_device_entry(symval, sym->st_size, mod);
693 sizeof(struct pnp_device_id), "pnp",
694 do_pnp_entry, mod);
695 else if (sym_is(symname, "__mod_pnp_card_device_table")) 721 else if (sym_is(symname, "__mod_pnp_card_device_table"))
696 do_pnp_card_entries(symval, sym->st_size, mod); 722 do_pnp_card_entries(symval, sym->st_size, mod);
697 else if (sym_is(symname, "__mod_pcmcia_device_table")) 723 else if (sym_is(symname, "__mod_pcmcia_device_table"))
diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c
index db3881f14c2d..6a96d47bd1e6 100644
--- a/scripts/mod/mk_elfconfig.c
+++ b/scripts/mod/mk_elfconfig.c
@@ -55,7 +55,7 @@ main(int argc, char **argv)
55 else 55 else
56 exit(1); 56 exit(1);
57 57
58 if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0) 58 if ((strcmp(argv[1], "h8300") == 0)
59 || (strcmp(argv[1], "blackfin") == 0)) 59 || (strcmp(argv[1], "blackfin") == 0))
60 printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); 60 printf("#define MODULE_SYMBOL_PREFIX \"_\"\n");
61 else 61 else
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 508c5895c680..418cd7dbbc93 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -467,6 +467,25 @@ static void parse_elf_finish(struct elf_info *info)
467 release_file(info->hdr, info->size); 467 release_file(info->hdr, info->size);
468} 468}
469 469
470static int ignore_undef_symbol(struct elf_info *info, const char *symname)
471{
472 /* ignore __this_module, it will be resolved shortly */
473 if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
474 return 1;
475 /* ignore global offset table */
476 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
477 return 1;
478 if (info->hdr->e_machine == EM_PPC)
479 /* Special register function linked on all modules during final link of .ko */
480 if (strncmp(symname, "_restgpr_", sizeof("_restgpr_") - 1) == 0 ||
481 strncmp(symname, "_savegpr_", sizeof("_savegpr_") - 1) == 0 ||
482 strncmp(symname, "_rest32gpr_", sizeof("_rest32gpr_") - 1) == 0 ||
483 strncmp(symname, "_save32gpr_", sizeof("_save32gpr_") - 1) == 0)
484 return 1;
485 /* Do not ignore this symbol */
486 return 0;
487}
488
470#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_" 489#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_"
471#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_" 490#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_"
472 491
@@ -493,11 +512,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
493 if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL && 512 if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
494 ELF_ST_BIND(sym->st_info) != STB_WEAK) 513 ELF_ST_BIND(sym->st_info) != STB_WEAK)
495 break; 514 break;
496 /* ignore global offset table */ 515 if (ignore_undef_symbol(info, symname))
497 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
498 break;
499 /* ignore __this_module, it will be resolved shortly */
500 if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
501 break; 516 break;
502/* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */ 517/* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */
503#if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER) 518#if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER)
@@ -1453,7 +1468,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
1453 * marked __initdata will be discarded when the module has been intialized. 1468 * marked __initdata will be discarded when the module has been intialized.
1454 * Likewise for modules used built-in the sections marked __exit 1469 * Likewise for modules used built-in the sections marked __exit
1455 * are discarded because __exit marked function are supposed to be called 1470 * are discarded because __exit marked function are supposed to be called
1456 * only when a moduel is unloaded which never happes for built-in modules. 1471 * only when a module is unloaded which never happens for built-in modules.
1457 * The check_sec_ref() function traverses all relocation records 1472 * The check_sec_ref() function traverses all relocation records
1458 * to find all references to a section that reference a section that will 1473 * to find all references to a section that reference a section that will
1459 * be discarded and warns about it. 1474 * be discarded and warns about it.
@@ -1977,7 +1992,8 @@ static void read_markers(const char *fname)
1977 mod->skip = 1; 1992 mod->skip = 1;
1978 } 1993 }
1979 1994
1980 add_marker(mod, marker, fmt); 1995 if (!mod->skip)
1996 add_marker(mod, marker, fmt);
1981 } 1997 }
1982 return; 1998 return;
1983fail: 1999fail: