Skip to content

Commit 95dcf83

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes: kbuild: ignore powerpc specific symbols in modpost
2 parents 5a1603b + 4d7365d commit 95dcf83

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

scripts/mod/modpost.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,25 @@ static void parse_elf_finish(struct elf_info *info)
467467
release_file(info->hdr, info->size);
468468
}
469469

470+
static 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+
470489
#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_"
471490
#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_"
472491

@@ -493,11 +512,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
493512
if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
494513
ELF_ST_BIND(sym->st_info) != STB_WEAK)
495514
break;
496-
/* ignore global offset table */
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)
515+
if (ignore_undef_symbol(info, symname))
501516
break;
502517
/* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */
503518
#if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER)

0 commit comments

Comments
 (0)