modpost: support objects with more than 64k sections
[pandora-kernel.git] / scripts / mod / file2alias.c
index 220213e..33f4363 100644 (file)
@@ -839,16 +839,16 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
        char *zeros = NULL;
 
        /* We're looking for a section relative symbol */
-       if (!sym->st_shndx || sym->st_shndx >= info->hdr->e_shnum)
+       if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections)
                return;
 
        /* Handle all-NULL symbols allocated into .bss */
-       if (info->sechdrs[sym->st_shndx].sh_type & SHT_NOBITS) {
+       if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {
                zeros = calloc(1, sym->st_size);
                symval = zeros;
        } else {
                symval = (void *)info->hdr
-                       + info->sechdrs[sym->st_shndx].sh_offset
+                       + info->sechdrs[get_secindex(info, sym)].sh_offset
                        + sym->st_value;
        }