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.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index cd104afcc5f2..413c53693e62 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -420,11 +420,10 @@ static int parse_elf(struct elf_info *info, const char *filename)
420 return 0; 420 return 0;
421 } 421 }
422 422
423 if (hdr->e_shnum == 0) { 423 if (hdr->e_shnum == SHN_UNDEF) {
424 /* 424 /*
425 * There are more than 64k sections, 425 * There are more than 64k sections,
426 * read count from .sh_size. 426 * read count from .sh_size.
427 * note: it doesn't need shndx2secindex()
428 */ 427 */
429 info->num_sections = TO_NATIVE(sechdrs[0].sh_size); 428 info->num_sections = TO_NATIVE(sechdrs[0].sh_size);
430 } 429 }
@@ -432,8 +431,7 @@ static int parse_elf(struct elf_info *info, const char *filename)
432 info->num_sections = hdr->e_shnum; 431 info->num_sections = hdr->e_shnum;
433 } 432 }
434 if (hdr->e_shstrndx == SHN_XINDEX) { 433 if (hdr->e_shstrndx == SHN_XINDEX) {
435 info->secindex_strings = 434 info->secindex_strings = TO_NATIVE(sechdrs[0].sh_link);
436 shndx2secindex(TO_NATIVE(sechdrs[0].sh_link));
437 } 435 }
438 else { 436 else {
439 info->secindex_strings = hdr->e_shstrndx; 437 info->secindex_strings = hdr->e_shstrndx;
@@ -489,7 +487,7 @@ static int parse_elf(struct elf_info *info, const char *filename)
489 sechdrs[i].sh_offset; 487 sechdrs[i].sh_offset;
490 info->symtab_stop = (void *)hdr + 488 info->symtab_stop = (void *)hdr +
491 sechdrs[i].sh_offset + sechdrs[i].sh_size; 489 sechdrs[i].sh_offset + sechdrs[i].sh_size;
492 sh_link_idx = shndx2secindex(sechdrs[i].sh_link); 490 sh_link_idx = sechdrs[i].sh_link;
493 info->strtab = (void *)hdr + 491 info->strtab = (void *)hdr +
494 sechdrs[sh_link_idx].sh_offset; 492 sechdrs[sh_link_idx].sh_offset;
495 } 493 }
@@ -516,11 +514,9 @@ static int parse_elf(struct elf_info *info, const char *filename)
516 514
517 if (symtab_shndx_idx != ~0U) { 515 if (symtab_shndx_idx != ~0U) {
518 Elf32_Word *p; 516 Elf32_Word *p;
519 if (symtab_idx != 517 if (symtab_idx != sechdrs[symtab_shndx_idx].sh_link)
520 shndx2secindex(sechdrs[symtab_shndx_idx].sh_link))
521 fatal("%s: SYMTAB_SHNDX has bad sh_link: %u!=%u\n", 518 fatal("%s: SYMTAB_SHNDX has bad sh_link: %u!=%u\n",
522 filename, 519 filename, sechdrs[symtab_shndx_idx].sh_link,
523 shndx2secindex(sechdrs[symtab_shndx_idx].sh_link),
524 symtab_idx); 520 symtab_idx);
525 /* Fix endianness */ 521 /* Fix endianness */
526 for (p = info->symtab_shndx_start; p < info->symtab_shndx_stop; 522 for (p = info->symtab_shndx_start; p < info->symtab_shndx_stop;
@@ -1446,7 +1442,7 @@ static unsigned int *reloc_location(struct elf_info *elf,
1446 Elf_Shdr *sechdr, Elf_Rela *r) 1442 Elf_Shdr *sechdr, Elf_Rela *r)
1447{ 1443{
1448 Elf_Shdr *sechdrs = elf->sechdrs; 1444 Elf_Shdr *sechdrs = elf->sechdrs;
1449 int section = shndx2secindex(sechdr->sh_info); 1445 int section = sechdr->sh_info;
1450 1446
1451 return (void *)elf->hdr + sechdrs[section].sh_offset + 1447 return (void *)elf->hdr + sechdrs[section].sh_offset +
1452 r->r_offset; 1448 r->r_offset;