diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2000-09-27 07:52:24 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@axis.com> | 2000-09-27 07:52:24 +0000 |
commit | a17cc40f09977d61e9e77adf9c799059be3d4979 (patch) | |
tree | adad70951a3736e99bf59dd120f3cfd65a279deb /bfd/elfcode.h | |
parent | 3028b4c011d1fe85d381b04a310c400742a2e6f3 (diff) | |
download | gdb-a17cc40f09977d61e9e77adf9c799059be3d4979.zip gdb-a17cc40f09977d61e9e77adf9c799059be3d4979.tar.gz gdb-a17cc40f09977d61e9e77adf9c799059be3d4979.tar.bz2 |
* elfcode.h (elf_object_p): Preserve and clear abfd section
information. Restore at error.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r-- | bfd/elfcode.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 92bb336..b94f74b 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -500,9 +500,16 @@ elf_object_p (abfd) char *shstrtab; /* Internal copy of section header stringtab */ struct elf_backend_data *ebd; struct elf_obj_tdata *preserved_tdata = elf_tdata (abfd); + struct sec *preserved_sections = abfd->sections; + unsigned int preserved_section_count = abfd->section_count; struct elf_obj_tdata *new_tdata = NULL; asection *s; + /* Clear section information, since there might be a recognized bfd that + we now check if we can replace, and we don't want to append to it. */ + abfd->sections = NULL; + abfd->section_count = 0; + /* Read in the ELF header in external format. */ if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr)) @@ -745,6 +752,8 @@ elf_object_p (abfd) if (new_tdata != NULL) bfd_release (abfd, new_tdata); elf_tdata (abfd) = preserved_tdata; + abfd->sections = preserved_sections; + abfd->section_count = preserved_section_count; return (NULL); } |