aboutsummaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2010-05-26 07:37:36 +0000
committerTristan Gingold <gingold@adacore.com>2010-05-26 07:37:36 +0000
commit65077aa81507c722eb00b1ed594d2ee11c491cc6 (patch)
tree75d8659aa8c5316f037b548213fd304652139317 /bfd/opncls.c
parente49e5c9230523b20b6560022c5cdfd3665065d20 (diff)
downloadgdb-65077aa81507c722eb00b1ed594d2ee11c491cc6.zip
gdb-65077aa81507c722eb00b1ed594d2ee11c491cc6.tar.gz
gdb-65077aa81507c722eb00b1ed594d2ee11c491cc6.tar.bz2
2010-05-25 Tristan Gingold <gingold@adacore.com>
* bfdio.c: Declare and define _bfd_memory_iovec. (bfd_bread): Move code for BFD_IN_MEMORY... (bfd_bwrite): ... Ditto ... (bfd_tell): ... Ditto ... (bfd_flush): ... Ditto ... (bfd_stat): ... Ditto ... (bfd_seek): ... Ditto ... (bfd_get_size): ... Ditto ... (bfd_mmap): ... Ditto ... (memory_bread): ... to these new functions. (memory_bwrite): Ditto. (memory_btell): Ditto. (memory_bseek): Ditto. (memory_bflush): Ditto. (memory_bstat): Ditto. (memory_bmmap): Ditto. (memory_bclose): New function. * peicode.h (pe_ILF_build_a_bfd): Use BFD_IN_MEMORY. * xcofflink.c (bfd_xcoff_link_generate_rtinit): Ditto. * opncls.c (bfd_close): Do not handle BFD_IN_MEMORY case. (bfd_make_writable): Use _bfd_memory_iovec. * elfcode.h (bfd_from_remote_memory): Use _bfd_memory_iovec. * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Use _bfd_memory_iovec. (alpha_ecoff_openr_next_archived_file): Use proxy_origin instead of origin. * libbfd.h: Regenerate.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 8b3d2e1..79c3274 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -696,20 +696,7 @@ bfd_close (bfd *abfd)
if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
return FALSE;
- if ((abfd->flags & BFD_IN_MEMORY) != 0)
- {
- /* FIXME: cagney/2004-02-15: Need to implement a BFD_IN_MEMORY io
- vector.
- Until that's done, at least don't leak memory. */
- struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
-
- if (bim->buffer != NULL)
- free (bim->buffer);
- free (bim);
- ret = TRUE;
- }
- else
- ret = abfd->iovec->bclose (abfd);
+ ret = abfd->iovec->bclose (abfd);
if (ret)
_maybe_make_executable (abfd);
@@ -823,6 +810,8 @@ bfd_make_writable (bfd *abfd)
bim->buffer = 0;
abfd->flags |= BFD_IN_MEMORY;
+ abfd->iovec = &_bfd_memory_iovec;
+ abfd->origin = 0;
abfd->direction = write_direction;
abfd->where = 0;
@@ -861,7 +850,6 @@ bfd_make_readable (bfd *abfd)
if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
return FALSE;
-
abfd->arch_info = &bfd_default_arch_struct;
abfd->where = 0;