summaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2013-01-26 02:07:58 +0000
committerAlan Modra <amodra@bigpond.net.au>2013-01-26 02:07:58 +0000
commite154936b0f3f585c60f3a74a8470ad4db0281d2e (patch)
tree26e2d84e3f36a6d23a87b16563cdeab2206c7f37 /bfd/elfcode.h
parent7d2d8c86556f824332c6132b186681a2b5248b74 (diff)
downloadbinutils-redhat-e154936b0f3f585c60f3a74a8470ad4db0281d2e.tar.gz
* 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 30bda73d86..298ba3526d 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;
}