* readelf.c (dump_relocations): Print "bad symbol index" if
symtab == NULL with non-zero symtab_index. (process_relocs): Don't bomb if reloc section has no symsec.
This commit is contained in:
parent
866b34001a
commit
af3fc3bcb3
2 changed files with 46 additions and 35 deletions
|
@ -1,3 +1,9 @@
|
|||
2001-06-25 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* readelf.c (dump_relocations): Print "bad symbol index" if
|
||||
symtab == NULL with non-zero symtab_index.
|
||||
(process_relocs): Don't bomb if reloc section has no symsec.
|
||||
|
||||
2001-06-24 H.J. Lu <hjl@gnu.org>
|
||||
|
||||
* objcopy.c (strip_main): Revert the change made on 2001-05-30
|
||||
|
|
|
@ -964,9 +964,7 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
|
|||
|
||||
if (symtab_index)
|
||||
{
|
||||
if (symtab != NULL)
|
||||
{
|
||||
if (symtab_index >= nsyms)
|
||||
if (symtab == NULL || symtab_index >= nsyms)
|
||||
printf (" bad symbol index: %08lx", (unsigned long) symtab_index);
|
||||
else
|
||||
{
|
||||
|
@ -990,7 +988,6 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
|
|||
printf (" + %lx", (unsigned long) relas [i].r_addend);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (is_rela)
|
||||
{
|
||||
printf ("%*c", is_32bit_elf ? 34 : 26, ' ');
|
||||
|
@ -3073,7 +3070,6 @@ process_relocs (file)
|
|||
if (rel_size)
|
||||
{
|
||||
Elf32_Internal_Shdr * strsec;
|
||||
Elf32_Internal_Shdr * symsec;
|
||||
Elf_Internal_Sym * symtab;
|
||||
char * strtab;
|
||||
int is_rela;
|
||||
|
@ -3089,8 +3085,14 @@ process_relocs (file)
|
|||
printf (_(" at offset 0x%lx contains %lu entries:\n"),
|
||||
rel_offset, (unsigned long) (rel_size / section->sh_entsize));
|
||||
|
||||
symsec = section_headers + section->sh_link;
|
||||
symtab = NULL;
|
||||
strtab = NULL;
|
||||
nsyms = 0;
|
||||
if (section->sh_link)
|
||||
{
|
||||
Elf32_Internal_Shdr * symsec;
|
||||
|
||||
symsec = section_headers + section->sh_link;
|
||||
nsyms = symsec->sh_size / symsec->sh_entsize;
|
||||
symtab = GET_ELF_SYMBOLS (file, symsec->sh_offset, nsyms);
|
||||
|
||||
|
@ -3101,12 +3103,15 @@ process_relocs (file)
|
|||
|
||||
GET_DATA_ALLOC (strsec->sh_offset, strsec->sh_size, strtab,
|
||||
char *, "string table");
|
||||
|
||||
}
|
||||
is_rela = section->sh_type == SHT_RELA;
|
||||
|
||||
dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela);
|
||||
dump_relocations (file, rel_offset, rel_size,
|
||||
symtab, nsyms, strtab, is_rela);
|
||||
|
||||
if (strtab)
|
||||
free (strtab);
|
||||
if (symtab)
|
||||
free (symtab);
|
||||
|
||||
found = 1;
|
||||
|
|
Loading…
Reference in a new issue