aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-01-26 02:08:01 +0000
committerAlan Modra <amodra@gmail.com>2013-01-26 02:08:01 +0000
commitc9ba0c87bf3595762506825b30f0ebcb9da53129 (patch)
tree9de13a5457cd32f950d7d63cf1b2bb0fc000779b /bfd/elfcode.h
parent39c88814382afb7476b342dc3e1333171d72a144 (diff)
downloadgdb-c9ba0c87bf3595762506825b30f0ebcb9da53129.zip
gdb-c9ba0c87bf3595762506825b30f0ebcb9da53129.tar.gz
gdb-c9ba0c87bf3595762506825b30f0ebcb9da53129.tar.bz2
* bfd.c (struct bfd_preserve, bfd_preserve_save, bfd_preserve_restore,
bfd_preserve_finish): Move to.. * format.c: ..here, splitting out.. (bfd_reinit): ..this. New function. (bfd_check_format_matches): Use bfd_preserve_save/restore to keep bfd state for a match. * elfcode.h (elf_object_p): Don't use bfd_preserve_save/restore. * elfcore.h (elf_core_file_p): Likewise. * mach-o.c (bfd_mach_o_header_p): Likewise. * pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise. * xsym.c (bfd_sym_object_p): Likewise. * mmo.c (mmo_scan): Clear abfd->symcount. * opncls.c (_bfd_new_bfd): Use a smaller section hash table. * section.c (bfd_section_list_clear): Clear section_htab.count. * bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h20
1 files changed, 0 insertions, 20 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 30bda73..298ba35 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -495,13 +495,10 @@ elf_object_p (bfd *abfd)
Elf_Internal_Shdr *i_shdrp; /* Section header table, internal form */
unsigned int shindex;
const struct elf_backend_data *ebd;
- struct bfd_preserve preserve;
asection *s;
bfd_size_type amt;
const bfd_target *target;
- preserve.marker = NULL;
-
/* Read in the ELF header in external format. */
if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
@@ -539,9 +536,6 @@ elf_object_p (bfd *abfd)
goto got_wrong_format_error;
}
- if (!bfd_preserve_save (abfd, &preserve))
- goto got_no_match;
-
target = abfd->xvec;
/* Allocate an instance of the elf_obj_tdata structure and hook it up to
@@ -549,7 +543,6 @@ elf_object_p (bfd *abfd)
if (! (*target->_bfd_set_format[bfd_object]) (abfd))
goto got_no_match;
- preserve.marker = elf_tdata (abfd);
/* Now that we know the byte order, swap in the rest of the header */
i_ehdrp = elf_elfheader (abfd);
@@ -842,25 +835,12 @@ elf_object_p (bfd *abfd)
s->flags |= SEC_DEBUGGING;
}
}
-
- bfd_preserve_finish (abfd, &preserve);
return target;
got_wrong_format_error:
- /* There is way too much undoing of half-known state here. The caller,
- bfd_check_format_matches, really shouldn't iterate on live bfd's to
- check match/no-match like it does. We have to rely on that a call to
- bfd_default_set_arch_mach with the previously known mach, undoes what
- was done by the first bfd_default_set_arch_mach (with mach 0) here.
- For this to work, only elf-data and the mach may be changed by the
- target-specific elf_backend_object_p function. Note that saving the
- whole bfd here and restoring it would be even worse; the first thing
- you notice is that the cached bfd file position gets out of sync. */
bfd_set_error (bfd_error_wrong_format);
got_no_match:
- if (preserve.marker != NULL)
- bfd_preserve_restore (abfd, &preserve);
return NULL;
}