diff options
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r-- | scripts/mod/modpost.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 1aa52a86c2cf..d0f86ed43f7a 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -700,6 +700,7 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
700 | const char *name = secstrings + sechdrs[i].sh_name; | 700 | const char *name = secstrings + sechdrs[i].sh_name; |
701 | const char *secname; | 701 | const char *secname; |
702 | Elf_Rela r; | 702 | Elf_Rela r; |
703 | unsigned int r_sym; | ||
703 | /* We want to process only relocation sections and not .init */ | 704 | /* We want to process only relocation sections and not .init */ |
704 | if (sechdrs[i].sh_type == SHT_RELA) { | 705 | if (sechdrs[i].sh_type == SHT_RELA) { |
705 | Elf_Rela *rela; | 706 | Elf_Rela *rela; |
@@ -711,9 +712,20 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
711 | 712 | ||
712 | for (rela = start; rela < stop; rela++) { | 713 | for (rela = start; rela < stop; rela++) { |
713 | r.r_offset = TO_NATIVE(rela->r_offset); | 714 | r.r_offset = TO_NATIVE(rela->r_offset); |
714 | r.r_info = TO_NATIVE(rela->r_info); | 715 | #if KERNEL_ELFCLASS == ELFCLASS64 |
716 | if (hdr->e_machine == EM_MIPS) { | ||
717 | r_sym = ELF64_MIPS_R_SYM(rela->r_info); | ||
718 | r_sym = TO_NATIVE(r_sym); | ||
719 | } else { | ||
720 | r.r_info = TO_NATIVE(rela->r_info); | ||
721 | r_sym = ELF_R_SYM(r.r_info); | ||
722 | } | ||
723 | #else | ||
724 | r.r_info = TO_NATIVE(rela->r_info); | ||
725 | r_sym = ELF_R_SYM(r.r_info); | ||
726 | #endif | ||
715 | r.r_addend = TO_NATIVE(rela->r_addend); | 727 | r.r_addend = TO_NATIVE(rela->r_addend); |
716 | sym = elf->symtab_start + ELF_R_SYM(r.r_info); | 728 | sym = elf->symtab_start + r_sym; |
717 | /* Skip special sections */ | 729 | /* Skip special sections */ |
718 | if (sym->st_shndx >= SHN_LORESERVE) | 730 | if (sym->st_shndx >= SHN_LORESERVE) |
719 | continue; | 731 | continue; |
@@ -734,9 +746,20 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
734 | 746 | ||
735 | for (rel = start; rel < stop; rel++) { | 747 | for (rel = start; rel < stop; rel++) { |
736 | r.r_offset = TO_NATIVE(rel->r_offset); | 748 | r.r_offset = TO_NATIVE(rel->r_offset); |
737 | r.r_info = TO_NATIVE(rel->r_info); | 749 | #if KERNEL_ELFCLASS == ELFCLASS64 |
750 | if (hdr->e_machine == EM_MIPS) { | ||
751 | r_sym = ELF64_MIPS_R_SYM(rel->r_info); | ||
752 | r_sym = TO_NATIVE(r_sym); | ||
753 | } else { | ||
754 | r.r_info = TO_NATIVE(rel->r_info); | ||
755 | r_sym = ELF_R_SYM(r.r_info); | ||
756 | } | ||
757 | #else | ||
758 | r.r_info = TO_NATIVE(rel->r_info); | ||
759 | r_sym = ELF_R_SYM(r.r_info); | ||
760 | #endif | ||
738 | r.r_addend = 0; | 761 | r.r_addend = 0; |
739 | sym = elf->symtab_start + ELF_R_SYM(r.r_info); | 762 | sym = elf->symtab_start + r_sym; |
740 | /* Skip special sections */ | 763 | /* Skip special sections */ |
741 | if (sym->st_shndx >= SHN_LORESERVE) | 764 | if (sym->st_shndx >= SHN_LORESERVE) |
742 | continue; | 765 | continue; |