|
@@ -420,11 +420,10 @@ static int parse_elf(struct elf_info *info, const char *filename)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
- if (hdr->e_shnum == 0) {
|
|
|
|
|
|
+ if (hdr->e_shnum == SHN_UNDEF) {
|
|
/*
|
|
/*
|
|
* There are more than 64k sections,
|
|
* There are more than 64k sections,
|
|
* read count from .sh_size.
|
|
* read count from .sh_size.
|
|
- * note: it doesn't need shndx2secindex()
|
|
|
|
*/
|
|
*/
|
|
info->num_sections = TO_NATIVE(sechdrs[0].sh_size);
|
|
info->num_sections = TO_NATIVE(sechdrs[0].sh_size);
|
|
}
|
|
}
|
|
@@ -432,8 +431,7 @@ static int parse_elf(struct elf_info *info, const char *filename)
|
|
info->num_sections = hdr->e_shnum;
|
|
info->num_sections = hdr->e_shnum;
|
|
}
|
|
}
|
|
if (hdr->e_shstrndx == SHN_XINDEX) {
|
|
if (hdr->e_shstrndx == SHN_XINDEX) {
|
|
- info->secindex_strings =
|
|
|
|
- shndx2secindex(TO_NATIVE(sechdrs[0].sh_link));
|
|
|
|
|
|
+ info->secindex_strings = TO_NATIVE(sechdrs[0].sh_link);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
info->secindex_strings = hdr->e_shstrndx;
|
|
info->secindex_strings = hdr->e_shstrndx;
|
|
@@ -489,7 +487,7 @@ static int parse_elf(struct elf_info *info, const char *filename)
|
|
sechdrs[i].sh_offset;
|
|
sechdrs[i].sh_offset;
|
|
info->symtab_stop = (void *)hdr +
|
|
info->symtab_stop = (void *)hdr +
|
|
sechdrs[i].sh_offset + sechdrs[i].sh_size;
|
|
sechdrs[i].sh_offset + sechdrs[i].sh_size;
|
|
- sh_link_idx = shndx2secindex(sechdrs[i].sh_link);
|
|
|
|
|
|
+ sh_link_idx = sechdrs[i].sh_link;
|
|
info->strtab = (void *)hdr +
|
|
info->strtab = (void *)hdr +
|
|
sechdrs[sh_link_idx].sh_offset;
|
|
sechdrs[sh_link_idx].sh_offset;
|
|
}
|
|
}
|
|
@@ -516,11 +514,9 @@ static int parse_elf(struct elf_info *info, const char *filename)
|
|
|
|
|
|
if (symtab_shndx_idx != ~0U) {
|
|
if (symtab_shndx_idx != ~0U) {
|
|
Elf32_Word *p;
|
|
Elf32_Word *p;
|
|
- if (symtab_idx !=
|
|
|
|
- shndx2secindex(sechdrs[symtab_shndx_idx].sh_link))
|
|
|
|
|
|
+ if (symtab_idx != sechdrs[symtab_shndx_idx].sh_link)
|
|
fatal("%s: SYMTAB_SHNDX has bad sh_link: %u!=%u\n",
|
|
fatal("%s: SYMTAB_SHNDX has bad sh_link: %u!=%u\n",
|
|
- filename,
|
|
|
|
- shndx2secindex(sechdrs[symtab_shndx_idx].sh_link),
|
|
|
|
|
|
+ filename, sechdrs[symtab_shndx_idx].sh_link,
|
|
symtab_idx);
|
|
symtab_idx);
|
|
/* Fix endianness */
|
|
/* Fix endianness */
|
|
for (p = info->symtab_shndx_start; p < info->symtab_shndx_stop;
|
|
for (p = info->symtab_shndx_start; p < info->symtab_shndx_stop;
|
|
@@ -1446,7 +1442,7 @@ static unsigned int *reloc_location(struct elf_info *elf,
|
|
Elf_Shdr *sechdr, Elf_Rela *r)
|
|
Elf_Shdr *sechdr, Elf_Rela *r)
|
|
{
|
|
{
|
|
Elf_Shdr *sechdrs = elf->sechdrs;
|
|
Elf_Shdr *sechdrs = elf->sechdrs;
|
|
- int section = shndx2secindex(sechdr->sh_info);
|
|
|
|
|
|
+ int section = sechdr->sh_info;
|
|
|
|
|
|
return (void *)elf->hdr + sechdrs[section].sh_offset +
|
|
return (void *)elf->hdr + sechdrs[section].sh_offset +
|
|
r->r_offset;
|
|
r->r_offset;
|