aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 757294b4f322..a07f91aac920 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)
@@ -721,7 +736,7 @@ static int check_section(const char *modname, const char *sec)
721 /* consume all digits */ 736 /* consume all digits */
722 while (*e && e != sec && isdigit(*e)) 737 while (*e && e != sec && isdigit(*e))
723 e--; 738 e--;
724 if (*e == '.') { 739 if (*e == '.' && !strstr(sec, ".linkonce")) {
725 warn("%s (%s): unexpected section name.\n" 740 warn("%s (%s): unexpected section name.\n"
726 "The (.[number]+) following section name are " 741 "The (.[number]+) following section name are "
727 "ld generated and not expected.\n" 742 "ld generated and not expected.\n"