aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-04-11 11:56:50 +0930
committerAlan Modra <amodra@gmail.com>2024-04-11 17:05:16 +0930
commitaf925905211930677751678183f43c1bda13e013 (patch)
tree4003f40a03ceebde7ac611aa9d7a1dc0dcd72d8a /bfd
parentde9dc65bd45c118d56600bbf1786322284fde795 (diff)
downloadgdb-af925905211930677751678183f43c1bda13e013.zip
gdb-af925905211930677751678183f43c1bda13e013.tar.gz
gdb-af925905211930677751678183f43c1bda13e013.tar.bz2
Remove bfdwin.c
In commit b86d3af60ffc and 0ab0435fe672 I fixed SIGBUS errors found by oss-fuzz now that --with-mmap defaults to enabled. It turns out there are further problems with the aout mmap code: aout_read_minisymbols returns the external symbol array, which is later freed by nm.c. If the array is mmaped you can't free it. Now this could be fixed by making aout minisymbols an array of pointers, but I figure there's not much point in expending effort on that. So delete the aout mmap support along with bfdwin.c and get_section_contents_in_window.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/Makefile.am8
-rw-r--r--bfd/Makefile.in18
-rw-r--r--bfd/aout-target.h3
-rw-r--r--bfd/aoutx.h90
-rw-r--r--bfd/bfd-in2.h37
-rw-r--r--bfd/bfdwin.c295
-rw-r--r--bfd/binary.c1
-rw-r--r--bfd/coff-aarch64.c1
-rw-r--r--bfd/coff-alpha.c4
-rw-r--r--bfd/coff-mips.c4
-rw-r--r--bfd/coff-rs6000.c2
-rw-r--r--bfd/coff-sh.c2
-rw-r--r--bfd/coff64-rs6000.c2
-rw-r--r--bfd/doc/bfdint.texi9
-rw-r--r--bfd/doc/local.mk5
-rw-r--r--bfd/elfxx-target.h3
-rw-r--r--bfd/i386msdos.c2
-rw-r--r--bfd/ihex.c1
-rw-r--r--bfd/libaout.h4
-rw-r--r--bfd/libbfd-in.h2
-rw-r--r--bfd/libbfd.c57
-rw-r--r--bfd/libbfd.h17
-rw-r--r--bfd/libcoff-in.h3
-rw-r--r--bfd/libcoff.h3
-rw-r--r--bfd/mach-o-target.c1
-rw-r--r--bfd/mmo.c2
-rw-r--r--bfd/pdb.c1
-rw-r--r--bfd/pdp11.c90
-rw-r--r--bfd/pef.c2
-rw-r--r--bfd/plugin.c1
-rw-r--r--bfd/po/SRC-POTFILES.in1
-rw-r--r--bfd/ppcboot.c2
-rw-r--r--bfd/som.c1
-rw-r--r--bfd/srec.c1
-rw-r--r--bfd/targets.c5
-rw-r--r--bfd/tekhex.c1
-rw-r--r--bfd/verilog.c1
-rw-r--r--bfd/vms-alpha.c1
-rw-r--r--bfd/xsym.c1
39 files changed, 55 insertions, 629 deletions
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 4f67b59..0dc733e 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -75,7 +75,7 @@ BFD_H = bfd.h
# need two copies of the executable, one to download and one for the
# debugger).
BFD32_LIBS = \
- archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo \
+ archive.lo archures.lo bfd.lo bfdio.lo cache.lo \
coff-bfd.lo compress.lo corefile.lo elf-properties.lo format.lo \
hash.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
@@ -84,7 +84,7 @@ BFD32_LIBS = \
BFD64_LIBS = archive64.lo
BFD32_LIBS_CFILES = \
- archive.c archures.c bfd.c bfdio.c bfdwin.c cache.c coff-bfd.c \
+ archive.c archures.c bfd.c bfdio.c cache.c coff-bfd.c \
compress.c corefile.c elf-properties.c format.c hash.c \
libbfd.c linker.c merge.c opncls.c reloc.c \
section.c simple.c stab-syms.c stabs.c syms.c targets.c \
@@ -928,12 +928,12 @@ stmp-bfd-h: bfd-in3.h
touch stmp-bfd-h
BFD_H_FILES = bfd-in.h libbfd.c hash.c section.c syms.c \
- archive.c archures.c bfd.c bfdio.c bfdwin.c \
+ archive.c archures.c bfd.c bfdio.c \
cache.c compress.c corefile.c format.c linker.c opncls.c \
reloc.c simple.c stab-syms.c stabs.c targets.c
BFD64_H_FILES = archive64.c
LIBBFD_H_FILES = libbfd-in.h libbfd.c bfd.c bfdio.c \
- archive.c archures.c bfdwin.c cache.c hash.c linker.c opncls.c \
+ archive.c archures.c cache.c hash.c linker.c opncls.c \
reloc.c section.c stabs.c targets.c
LIBCOFF_H_FILES = libcoff-in.h coffcode.h
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 3092bff..b3d97d4 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -179,8 +179,8 @@ am__installdirs = "$(DESTDIR)$(bfdlibdir)" "$(DESTDIR)$(infodir)" \
"$(DESTDIR)$(bfdincludedir)"
LTLIBRARIES = $(bfdlib_LTLIBRARIES) $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
-am__objects_1 = archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
- cache.lo coff-bfd.lo compress.lo corefile.lo elf-properties.lo \
+am__objects_1 = archive.lo archures.lo bfd.lo bfdio.lo cache.lo \
+ coff-bfd.lo compress.lo corefile.lo elf-properties.lo \
format.lo hash.lo libbfd.lo linker.lo merge.lo opncls.lo \
reloc.lo section.lo simple.lo stab-syms.lo stabs.lo syms.lo \
targets.lo binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
@@ -542,7 +542,7 @@ BFD_H = bfd.h
# need two copies of the executable, one to download and one for the
# debugger).
BFD32_LIBS = \
- archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo \
+ archive.lo archures.lo bfd.lo bfdio.lo cache.lo \
coff-bfd.lo compress.lo corefile.lo elf-properties.lo format.lo \
hash.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
@@ -550,7 +550,7 @@ BFD32_LIBS = \
BFD64_LIBS = archive64.lo
BFD32_LIBS_CFILES = \
- archive.c archures.c bfd.c bfdio.c bfdwin.c cache.c coff-bfd.c \
+ archive.c archures.c bfd.c bfdio.c cache.c coff-bfd.c \
compress.c corefile.c elf-properties.c format.c hash.c \
libbfd.c linker.c merge.c opncls.c reloc.c \
section.c simple.c stab-syms.c stabs.c syms.c targets.c \
@@ -1219,13 +1219,13 @@ EXTRA_libbfd_la_SOURCES = $(CFILES)
libbfd_la_DEPENDENCIES = $(OFILES) ofiles ../libsframe/libsframe.la
libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) ../libsframe/libsframe.la
BFD_H_FILES = bfd-in.h libbfd.c hash.c section.c syms.c \
- archive.c archures.c bfd.c bfdio.c bfdwin.c \
+ archive.c archures.c bfd.c bfdio.c \
cache.c compress.c corefile.c format.c linker.c opncls.c \
reloc.c simple.c stab-syms.c stabs.c targets.c
BFD64_H_FILES = archive64.c
LIBBFD_H_FILES = libbfd-in.h libbfd.c bfd.c bfdio.c \
- archive.c archures.c bfdwin.c cache.c hash.c linker.c opncls.c \
+ archive.c archures.c cache.c hash.c linker.c opncls.c \
reloc.c section.c stabs.c targets.c
LIBCOFF_H_FILES = libcoff-in.h coffcode.h
@@ -1258,7 +1258,6 @@ DOCFILES = \
doc/bfdio.texi \
doc/bfdt.texi \
doc/bfdver.texi \
- doc/bfdwin.texi \
doc/cache.texi \
doc/coffcode.texi \
doc/corefile.texi \
@@ -1282,7 +1281,6 @@ DOCFILES = \
SRCDOC = \
$(srcdir)/aoutx.h $(srcdir)/archive.c \
$(srcdir)/archures.c $(srcdir)/bfd.c \
- $(srcdir)/bfdio.c $(srcdir)/bfdwin.c \
$(srcdir)/cache.c $(srcdir)/coffcode.h \
$(srcdir)/corefile.c $(srcdir)/elf.c \
$(srcdir)/elfcode.h $(srcdir)/format.c \
@@ -1295,13 +1293,12 @@ SRCDOC = \
SRCPROT = $(srcdir)/archive.c $(srcdir)/archures.c \
$(srcdir)/bfd.c $(srcdir)/coffcode.h $(srcdir)/corefile.c \
$(srcdir)/format.c $(srcdir)/libbfd.c \
- $(srcdir)/bfdio.c $(srcdir)/bfdwin.c \
$(srcdir)/opncls.c $(srcdir)/reloc.c \
$(srcdir)/section.c $(srcdir)/syms.c \
$(srcdir)/targets.c
SRCIPROT = $(srcdir)/cache.c $(srcdir)/libbfd.c \
- $(srcdir)/bfdio.c $(srcdir)/bfdwin.c \
+ $(srcdir)/bfdio.c \
$(srcdir)/reloc.c $(srcdir)/cpu-h8300.c \
$(srcdir)/archures.c
@@ -1455,7 +1452,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/archures.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bfd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bfdio.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bfdwin.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binary.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cf-i386lynx.Plo@am__quote@
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 47fe49f..2a53007 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -432,9 +432,6 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
#ifndef MY_get_section_contents
#define MY_get_section_contents NAME (aout, get_section_contents)
#endif
-#ifndef MY_get_section_contents_in_window
-#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
-#endif
#ifndef MY_new_section_hook
#define MY_new_section_hook NAME (aout, new_section_hook)
#endif
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index d98ba61..4c5be61 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -559,11 +559,6 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
/* The default symbol entry size is that of traditional Unix. */
obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
-#ifdef USE_MMAP
- bfd_init_window (&obj_aout_sym_window (abfd));
- bfd_init_window (&obj_aout_string_window (abfd));
-#endif
-
if (! NAME (aout, make_sections) (abfd))
goto error_ret;
@@ -1301,10 +1296,6 @@ NAME (aout, set_section_contents) (bfd *abfd,
static bool
aout_get_external_symbols (bfd *abfd)
{
-#ifdef USE_MMAP
- ufile_ptr filesize = bfd_get_file_size (abfd);
-#endif
-
if (obj_aout_external_syms (abfd) == NULL)
{
bfd_size_type count;
@@ -1315,27 +1306,14 @@ aout_get_external_symbols (bfd *abfd)
if (count == 0)
return true;
-#ifdef USE_MMAP
- if (filesize >= (ufile_ptr) obj_sym_filepos (abfd)
- && filesize - obj_sym_filepos (abfd) >= amt)
- {
- if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), amt,
- &obj_aout_sym_window (abfd), true))
- return false;
- syms = obj_aout_sym_window (abfd).data;
- }
- else
-#endif
- {
- /* We allocate using malloc to make the values easy to free
- later on. If we put them on the objalloc it might not be
- possible to free them. */
- if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
- return false;
- syms = _bfd_malloc_and_read (abfd, amt, amt);
- if (syms == NULL)
- return false;
- }
+ /* We allocate using malloc to make the values easy to free
+ later on. If we put them on the objalloc it might not be
+ possible to free them. */
+ if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
+ return false;
+ syms = _bfd_malloc_and_read (abfd, amt, amt);
+ if (syms == NULL)
+ return false;
obj_aout_external_syms (abfd) = syms;
obj_aout_external_sym_count (abfd) = count;
@@ -1363,33 +1341,20 @@ aout_get_external_symbols (bfd *abfd)
return false;
}
-#ifdef USE_MMAP
- if (stringsize >= BYTES_IN_WORD
- && filesize >= (ufile_ptr) obj_str_filepos (abfd)
- && filesize - obj_str_filepos (abfd) >= stringsize + 1)
- {
- if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize + 1,
- &obj_aout_string_window (abfd), true))
- return false;
- strings = (char *) obj_aout_string_window (abfd).data;
- }
- else
-#endif
- {
- strings = (char *) bfd_malloc (stringsize + 1);
- if (strings == NULL)
- return false;
+ strings = (char *) bfd_malloc (stringsize + 1);
+ if (strings == NULL)
+ return false;
- if (stringsize >= BYTES_IN_WORD)
+ if (stringsize >= BYTES_IN_WORD)
+ {
+ amt = stringsize - BYTES_IN_WORD;
+ if (bfd_read (strings + BYTES_IN_WORD, amt, abfd) != amt)
{
- amt = stringsize - BYTES_IN_WORD;
- if (bfd_read (strings + BYTES_IN_WORD, amt, abfd) != amt)
- {
- free (strings);
- return false;
- }
+ free (strings);
+ return false;
}
}
+
/* Ensure that a zero index yields an empty string. */
if (stringsize >= BYTES_IN_WORD)
memset (strings, 0, BYTES_IN_WORD);
@@ -1816,11 +1781,7 @@ NAME (aout, slurp_symbol_table) (bfd *abfd)
if (old_external_syms == NULL
&& obj_aout_external_syms (abfd) != NULL)
{
-#ifdef USE_MMAP
- bfd_free_window (&obj_aout_sym_window (abfd));
-#else
free (obj_aout_external_syms (abfd));
-#endif
obj_aout_external_syms (abfd) = NULL;
}
@@ -2937,15 +2898,8 @@ NAME (aout, bfd_free_cached_info) (bfd *abfd)
#define BFCI_FREE(x) do { free (x); x = NULL; } while (0)
BFCI_FREE (adata (abfd).line_buf);
BFCI_FREE (obj_aout_symbols (abfd));
-#ifdef USE_MMAP
- obj_aout_external_syms (abfd) = 0;
- bfd_free_window (&obj_aout_sym_window (abfd));
- bfd_free_window (&obj_aout_string_window (abfd));
- obj_aout_external_strings (abfd) = 0;
-#else
BFCI_FREE (obj_aout_external_syms (abfd));
BFCI_FREE (obj_aout_external_strings (abfd));
-#endif
for (asection *o = abfd->sections; o != NULL; o = o->next)
BFCI_FREE (o->relocation);
#undef BFCI_FREE
@@ -3260,20 +3214,12 @@ aout_link_free_symbols (bfd *abfd)
{
if (obj_aout_external_syms (abfd) != NULL)
{
-#ifdef USE_MMAP
- bfd_free_window (&obj_aout_sym_window (abfd));
-#else
free ((void *) obj_aout_external_syms (abfd));
-#endif
obj_aout_external_syms (abfd) = NULL;
}
if (obj_aout_external_strings (abfd) != NULL)
{
-#ifdef USE_MMAP
- bfd_free_window (&obj_aout_string_window (abfd));
-#else
free ((void *) obj_aout_external_strings (abfd));
-#endif
obj_aout_external_strings (abfd) = NULL;
}
return true;
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index d107a22..109de76 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1,9 +1,8 @@
/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
generated from "bfd-in.h", "libbfd.c", "hash.c", "section.c",
- "syms.c", "archive.c", "archures.c", "bfd.c", "bfdio.c", "bfdwin.c",
- "cache.c", "compress.c", "corefile.c", "format.c", "linker.c",
- "opncls.c", "reloc.c", "simple.c", "stab-syms.c", "stabs.c" and
- "targets.c".
+ "syms.c", "archive.c", "archures.c", "bfd.c", "bfdio.c", "cache.c",
+ "compress.c", "corefile.c", "format.c", "linker.c", "opncls.c",
+ "reloc.c", "simple.c", "stab-syms.c", "stabs.c" and "targets.c".
Run "make headers" in your build bfd/ to regenerate. */
/* Main header file for the bfd library -- portable access to object files.
@@ -2812,31 +2811,6 @@ ATTRIBUTE_WARN_UNUSED_RESULT;
time_t bfd_get_current_time (time_t now);
-/* Extracted from bfdwin.c. */
-struct _bfd_window_internal;
-
-typedef struct _bfd_window
-{
- /* What the user asked for. */
- void *data;
- bfd_size_type size;
- /* The actual window used by BFD. Small user-requested read-only
- regions sharing a page may share a single window into the object
- file. Read-write versions shouldn't until I've fixed things to
- keep track of which portions have been claimed by the
- application; don't want to give the same region back when the
- application wants two writable copies! */
- struct _bfd_window_internal *i;
-}
-bfd_window;
-
-void bfd_init_window (bfd_window *);
-
-void bfd_free_window (bfd_window *);
-
-bool bfd_get_file_window
- (bfd *, file_ptr, bfd_size_type, bfd_window *, bool /*writable*/);
-
/* Extracted from cache.c. */
bool bfd_cache_close (bfd *abfd);
@@ -7703,8 +7677,7 @@ typedef struct bfd_target
NAME##_close_and_cleanup, \
NAME##_bfd_free_cached_info, \
NAME##_new_section_hook, \
- NAME##_get_section_contents, \
- NAME##_get_section_contents_in_window
+ NAME##_get_section_contents
/* Called when the BFD is being closed to do any necessary cleanup. */
bool (*_close_and_cleanup) (bfd *);
@@ -7715,8 +7688,6 @@ typedef struct bfd_target
/* Read the contents of a section. */
bool (*_bfd_get_section_contents) (bfd *, sec_ptr, void *, file_ptr,
bfd_size_type);
- bool (*_bfd_get_section_contents_in_window) (bfd *, sec_ptr, bfd_window *,
- file_ptr, bfd_size_type);
/* Entry points to copy private data. */
#define BFD_JUMP_TABLE_COPY(NAME) \
diff --git a/bfd/bfdwin.c b/bfd/bfdwin.c
deleted file mode 100644
index 0ef7b14..0000000
--- a/bfd/bfdwin.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/* Support for memory-mapped windows into a BFD.
- Copyright (C) 1995-2024 Free Software Foundation, Inc.
- Written by Cygnus Support.
-
- This file is part of BFD, the Binary File Descriptor library.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-
-#include "bfd.h"
-#include "libbfd.h"
-
-/* Currently, if USE_MMAP is undefined, none of the window stuff is
- used. Enabled by --with-mmap. */
-
-#ifdef USE_MMAP
-
-#undef HAVE_MPROTECT /* code's not tested yet */
-
-static int debug_windows;
-
-/* The idea behind the next and refcount fields is that one mapped
- region can suffice for multiple read-only windows or multiple
- non-overlapping read-write windows. It's not implemented yet
- though. */
-
-/*
-INTERNAL
-.typedef struct _bfd_window_internal
-.{
-. struct _bfd_window_internal *next;
-. void *data;
-. bfd_size_type size;
-. int refcount : 31; {* should be enough... *}
-. unsigned mapped : 1; {* 1 = mmap, 0 = malloc *}
-.}
-.bfd_window_internal;
-.
-
-EXTERNAL
-.struct _bfd_window_internal;
-.
-.typedef struct _bfd_window
-.{
-. {* What the user asked for. *}
-. void *data;
-. bfd_size_type size;
-. {* The actual window used by BFD. Small user-requested read-only
-. regions sharing a page may share a single window into the object
-. file. Read-write versions shouldn't until I've fixed things to
-. keep track of which portions have been claimed by the
-. application; don't want to give the same region back when the
-. application wants two writable copies! *}
-. struct _bfd_window_internal *i;
-.}
-.bfd_window;
-.
-*/
-
-/*
-FUNCTION
- bfd_init_window
-
-SYNOPSIS
- void bfd_init_window (bfd_window *);
-
-DESCRIPTION
- Initialise mmap window.
-*/
-
-void
-bfd_init_window (bfd_window *windowp)
-{
- windowp->data = 0;
- windowp->i = 0;
- windowp->size = 0;
-}
-
-/*
-FUNCTION
- bfd_free_window
-
-SYNOPSIS
- void bfd_free_window (bfd_window *);
-
-DESCRIPTION
- Finalise mmap window struct.
-*/
-
-void
-bfd_free_window (bfd_window *windowp)
-{
- bfd_window_internal *i = windowp->i;
- windowp->i = 0;
- windowp->data = 0;
- if (i == 0)
- return;
- i->refcount--;
- if (debug_windows)
- fprintf (stderr, "freeing window @%p<%p,%lx,%p>\n",
- windowp, windowp->data, (unsigned long) windowp->size, windowp->i);
- if (i->refcount != 0)
- return;
-
- if (i->mapped)
- {
- munmap (i->data, i->size);
- goto no_free;
- }
-#ifdef HAVE_MPROTECT
- mprotect (i->data, i->size, PROT_READ | PROT_WRITE);
-#endif
- free (i->data);
- no_free:
- i->data = 0;
- /* There should be no more references to i at this point. */
- free (i);
-}
-
-/*
-FUNCTION
- bfd_get_file_window
-
-SYNOPSIS
- bool bfd_get_file_window
- (bfd *, file_ptr, bfd_size_type, bfd_window *, bool {*writable*});
-
-DESCRIPTION
- mmap from a bfd's iostream.
-*/
-
-bool
-bfd_get_file_window (bfd *abfd,
- file_ptr offset,
- bfd_size_type size,
- bfd_window *windowp,
- bool writable)
-{
- static int ok_to_map = 1;
- size_t pagesize = _bfd_pagesize;
- bfd_window_internal *i = windowp->i;
- bfd_size_type size_to_alloc = size;
-
- if (debug_windows)
- fprintf (stderr, "bfd_get_file_window (%p, %6ld, %6ld, %p<%p,%lx,%p>, %d)",
- abfd, (long) offset, (long) size,
- windowp, windowp->data, (unsigned long) windowp->size,
- windowp->i, writable);
-
- if (i == NULL)
- {
- i = bfd_zmalloc (sizeof (bfd_window_internal));
- if (i == NULL)
- return false;
- i->data = NULL;
- }
- if (ok_to_map
- && (i->data == NULL || i->mapped == 1)
- && (abfd->flags & BFD_IN_MEMORY) == 0)
- {
- file_ptr file_offset, offset2;
- size_t real_size;
- int fd;
-
- /* Find the real file and the real offset into it. */
- while (abfd->my_archive != NULL
- && !bfd_is_thin_archive (abfd->my_archive))
- {
- offset += abfd->origin;
- abfd = abfd->my_archive;
- }
- offset += abfd->origin;
-
- /* Seek into the file, to ensure it is open if cacheable. */
- if (abfd->iostream == NULL
- && (abfd->iovec == NULL
- || abfd->iovec->bseek (abfd, offset, SEEK_SET) != 0))
- goto free_and_fail;
-
- fd = fileno ((FILE *) abfd->iostream);
- /* Compute offsets and size for mmap and for the user's data. */
- offset2 = offset % pagesize;
- if (offset2 < 0)
- abort ();
- file_offset = offset - offset2;
- real_size = offset + size - file_offset;
- real_size = real_size + pagesize - 1;
- real_size -= real_size % pagesize;
-
- /* If we're re-using a memory region, make sure it's big enough. */
- if (i->data != NULL && i->size < size)
- {
- munmap (i->data, i->size);
- i->data = NULL;
- }
- i->data = mmap (i->data, real_size,
- writable ? PROT_WRITE | PROT_READ : PROT_READ,
- (writable
- ? MAP_FILE | MAP_PRIVATE
- : MAP_FILE | MAP_SHARED),
- fd, file_offset);
- if (i->data == MAP_FAILED)
- {
- /* An error happened. Report it, or try using malloc, or
- something. */
- bfd_set_error (bfd_error_system_call);
- windowp->data = 0;
- if (debug_windows)
- fprintf (stderr, "\t\tmmap failed!\n");
- goto free_and_fail;
- }
- if (debug_windows)
- fprintf (stderr, "\n\tmapped %ld at %p, offset is %ld\n",
- (long) real_size, i->data, (long) offset2);
- i->size = real_size;
- windowp->data = (bfd_byte *) i->data + offset2;
- windowp->size = size;
- i->mapped = 1;
- i->refcount = 1;
- windowp->i = i;
- return true;
- }
- else if (debug_windows)
- {
- if (ok_to_map)
- fprintf (stderr, _("not mapping: data=%lx mapped=%d\n"),
- (unsigned long) i->data, (int) i->mapped);
- else
- fprintf (stderr, _("not mapping: env var not set\n"));
- }
-
-#ifdef HAVE_MPROTECT
- if (!writable)
- {
- size_to_alloc += pagesize - 1;
- size_to_alloc -= size_to_alloc % pagesize;
- }
-#endif
- if (debug_windows)
- fprintf (stderr, "\n\t%s(%6ld)",
- i->data ? "realloc" : " malloc", (long) size_to_alloc);
- i->data = bfd_realloc_or_free (i->data, size_to_alloc);
- if (debug_windows)
- fprintf (stderr, "\t-> %p\n", i->data);
- if (i->data == NULL)
- {
- if (size_to_alloc == 0)
- {
- windowp->i = i;
- return true;
- }
- goto free_and_fail;
- }
- i->refcount = 1;
- if (bfd_seek (abfd, offset, SEEK_SET) != 0)
- goto free_and_fail;
- i->size = bfd_read (i->data, size, abfd);
- if (i->size != size)
- goto free_and_fail;
- i->mapped = 0;
-#ifdef HAVE_MPROTECT
- if (!writable)
- {
- if (debug_windows)
- fprintf (stderr, "\tmprotect (%p, %ld, PROT_READ)\n", i->data,
- (long) i->size);
- mprotect (i->data, i->size, PROT_READ);
- }
-#endif
- windowp->data = i->data;
- windowp->size = i->size;
- windowp->i = i;
- return true;
-
- free_and_fail:
- /* We have a bfd_window_internal, but an error occurred. Free it. */
- free (i);
- return false;
-}
-
-#endif /* USE_MMAP */
diff --git a/bfd/binary.c b/bfd/binary.c
index a99d5d8..4cc51a6 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -320,7 +320,6 @@ binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define binary_bfd_final_link _bfd_generic_final_link
#define binary_bfd_link_split_section _bfd_generic_link_split_section
-#define binary_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define binary_bfd_link_check_relocs _bfd_generic_link_check_relocs
const bfd_target binary_vec =
diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c
index 06c22fc..3f6a608 100644
--- a/bfd/coff-aarch64.c
+++ b/bfd/coff-aarch64.c
@@ -939,7 +939,6 @@ coff_aarch64_new_section_hook (bfd *abfd, asection *section)
#define coff_aarch64_close_and_cleanup coff_close_and_cleanup
#define coff_aarch64_bfd_free_cached_info coff_bfd_free_cached_info
#define coff_aarch64_get_section_contents coff_get_section_contents
-#define coff_aarch64_get_section_contents_in_window coff_get_section_contents_in_window
/* Target vectors. */
const bfd_target
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index aaffe10..38d2c10 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -2440,10 +2440,6 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
#define _bfd_ecoff_bfd_get_relocated_section_contents \
alpha_ecoff_get_relocated_section_contents
-/* Handling file windows is generic. */
-#define _bfd_ecoff_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
/* Input section flag lookup is generic. */
#define _bfd_ecoff_bfd_lookup_section_flags bfd_generic_lookup_section_flags
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index ed2722b..ae7b6e0 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1396,10 +1396,6 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
#define _bfd_ecoff_bfd_get_relocated_section_contents \
bfd_generic_get_relocated_section_contents
-/* Handling file windows is generic. */
-#define _bfd_ecoff_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
/* Relaxing sections is MIPS specific. */
#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 7d04739..09d868b 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4467,8 +4467,6 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = {
#define _bfd_xcoff_bfd_free_cached_info coff_bfd_free_cached_info
#define _bfd_xcoff_new_section_hook coff_new_section_hook
#define _bfd_xcoff_get_section_contents _bfd_generic_get_section_contents
-#define _bfd_xcoff_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
/* For copy private data entry points. */
#define _bfd_xcoff_init_private_section_data \
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index b37a80a..cac29b6 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -3119,8 +3119,6 @@ static const bfd_coff_backend_data bfd_coff_small_swap_table =
coff_bfd_free_cached_info
#define coff_small_get_section_contents \
coff_get_section_contents
-#define coff_small_get_section_contents_in_window \
- coff_get_section_contents_in_window
extern const bfd_target sh_coff_small_le_vec;
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 0f8d9e0..850a63c 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -2627,7 +2627,6 @@ const bfd_target rs6000_xcoff64_vec =
coff_bfd_free_cached_info,
coff_new_section_hook,
_bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
@@ -2900,7 +2899,6 @@ const bfd_target rs6000_xcoff64_aix_vec =
coff_bfd_free_cached_info,
coff_new_section_hook,
_bfd_generic_get_section_contents,
- _bfd_generic_get_section_contents_in_window,
/* Copy */
_bfd_xcoff_copy_private_bfd_data,
diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi
index 94aa840..e63d2d9 100644
--- a/bfd/doc/bfdint.texi
+++ b/bfd/doc/bfdint.texi
@@ -527,15 +527,6 @@ based on the section's @samp{filepos} field and a @samp{bfd_read}. The
corresponding field in the target vector is named
@samp{_bfd_get_section_contents}.
-@item _get_section_contents_in_window
-Set a @samp{bfd_window} to hold the contents of a section. This is
-called from @samp{bfd_get_section_contents_in_window}. The
-@samp{bfd_window} idea never really caught on, and I don't think this is
-ever called. Pretty much all targets implement this as
-@samp{bfd_generic_get_section_contents_in_window}, which uses
-@samp{bfd_get_section_contents} to do the right thing. The
-corresponding field in the target vector is named
-@samp{_bfd_get_section_contents_in_window}.
@end table
@node BFD target vector copy
diff --git a/bfd/doc/local.mk b/bfd/doc/local.mk
index d18bbf0..5e8f486 100644
--- a/bfd/doc/local.mk
+++ b/bfd/doc/local.mk
@@ -24,7 +24,6 @@ DOCFILES = \
%D%/bfdio.texi \
%D%/bfdt.texi \
%D%/bfdver.texi \
- %D%/bfdwin.texi \
%D%/cache.texi \
%D%/coffcode.texi \
%D%/corefile.texi \
@@ -47,7 +46,6 @@ DOCFILES = \
SRCDOC = \
$(srcdir)/aoutx.h $(srcdir)/archive.c \
$(srcdir)/archures.c $(srcdir)/bfd.c \
- $(srcdir)/bfdio.c $(srcdir)/bfdwin.c \
$(srcdir)/cache.c $(srcdir)/coffcode.h \
$(srcdir)/corefile.c $(srcdir)/elf.c \
$(srcdir)/elfcode.h $(srcdir)/format.c \
@@ -60,13 +58,12 @@ SRCDOC = \
SRCPROT = $(srcdir)/archive.c $(srcdir)/archures.c \
$(srcdir)/bfd.c $(srcdir)/coffcode.h $(srcdir)/corefile.c \
$(srcdir)/format.c $(srcdir)/libbfd.c \
- $(srcdir)/bfdio.c $(srcdir)/bfdwin.c \
$(srcdir)/opncls.c $(srcdir)/reloc.c \
$(srcdir)/section.c $(srcdir)/syms.c \
$(srcdir)/targets.c
SRCIPROT = $(srcdir)/cache.c $(srcdir)/libbfd.c \
- $(srcdir)/bfdio.c $(srcdir)/bfdwin.c \
+ $(srcdir)/bfdio.c \
$(srcdir)/reloc.c $(srcdir)/cpu-h8300.c \
$(srcdir)/archures.c
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index e52ec54..6e9b3f8 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -91,9 +91,6 @@
#define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
#define bfd_elfNN_write_corefile_contents _bfd_elf_write_corefile_contents
-#define bfd_elfNN_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
#ifndef elf_backend_can_refcount
#define elf_backend_can_refcount 0
#endif
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index eeee3c9..5d4a614 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -219,8 +219,6 @@ msdos_set_section_contents (bfd *abfd,
#define msdos_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define msdos_new_section_hook _bfd_generic_new_section_hook
#define msdos_get_section_contents _bfd_generic_get_section_contents
-#define msdos_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
#define msdos_bfd_get_relocated_section_contents \
bfd_generic_get_relocated_section_contents
#define msdos_bfd_relax_section bfd_generic_relax_section
diff --git a/bfd/ihex.c b/bfd/ihex.c
index ece4cd9..41eeb23 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -931,7 +931,6 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define ihex_close_and_cleanup _bfd_generic_close_and_cleanup
#define ihex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define ihex_new_section_hook _bfd_generic_new_section_hook
-#define ihex_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define ihex_get_symtab_upper_bound _bfd_long_bfd_0
#define ihex_canonicalize_symtab _bfd_nosymbols_canonicalize_symtab
#define ihex_make_empty_symbol _bfd_generic_make_empty_symbol
diff --git a/bfd/libaout.h b/bfd/libaout.h
index 91033d4..05b5e13 100644
--- a/bfd/libaout.h
+++ b/bfd/libaout.h
@@ -408,10 +408,8 @@ struct aoutdata
/* The external symbol information. */
struct external_nlist *external_syms;
bfd_size_type external_sym_count;
- bfd_window sym_window;
char *external_strings;
bfd_size_type external_string_size;
- bfd_window string_window;
struct aout_link_hash_entry **sym_hashes;
/* A pointer for shared library information. */
@@ -442,10 +440,8 @@ struct aout_data_struct
#define obj_aout_subformat(bfd) (adata (bfd).subformat)
#define obj_aout_external_syms(bfd) (adata (bfd).external_syms)
#define obj_aout_external_sym_count(bfd) (adata (bfd).external_sym_count)
-#define obj_aout_sym_window(bfd) (adata (bfd).sym_window)
#define obj_aout_external_strings(bfd) (adata (bfd).external_strings)
#define obj_aout_external_string_size(bfd) (adata (bfd).external_string_size)
-#define obj_aout_string_window(bfd) (adata (bfd).string_window)
#define obj_aout_sym_hashes(bfd) (adata (bfd).sym_hashes)
#define obj_aout_dynamic_info(bfd) (adata (bfd).dynamic_info)
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 81898d4..f7f5773 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -262,8 +262,6 @@ extern bool _bfd_generic_new_section_hook
(bfd *, asection *) ATTRIBUTE_HIDDEN;
extern bool _bfd_generic_get_section_contents
(bfd *, asection *, void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
-extern bool _bfd_generic_get_section_contents_in_window
- (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
/* Generic routines to use for BFD_JUMP_TABLE_COPY. Use
BFD_JUMP_TABLE_COPY (_bfd_generic). */
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 2f5ddca..747b69e 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -1329,63 +1329,6 @@ _bfd_generic_get_section_contents (bfd *abfd,
return true;
}
-bool
-_bfd_generic_get_section_contents_in_window
- (bfd *abfd ATTRIBUTE_UNUSED,
- sec_ptr section ATTRIBUTE_UNUSED,
- bfd_window *w ATTRIBUTE_UNUSED,
- file_ptr offset ATTRIBUTE_UNUSED,
- bfd_size_type count ATTRIBUTE_UNUSED)
-{
-#ifdef USE_MMAP
- bfd_size_type sz;
-
- if (count == 0)
- return true;
- if (abfd->xvec->_bfd_get_section_contents
- != _bfd_generic_get_section_contents)
- {
- /* We don't know what changes the bfd's get_section_contents
- method may have to make. So punt trying to map the file
- window, and let get_section_contents do its thing. */
- /* @@ FIXME : If the internal window has a refcount of 1 and was
- allocated with malloc instead of mmap, just reuse it. */
- bfd_free_window (w);
- w->i = bfd_zmalloc (sizeof (bfd_window_internal));
- if (w->i == NULL)
- return false;
- w->i->data = bfd_malloc (count);
- if (w->i->data == NULL)
- {
- free (w->i);
- w->i = NULL;
- return false;
- }
- w->i->mapped = 0;
- w->i->refcount = 1;
- w->size = w->i->size = count;
- w->data = w->i->data;
- return bfd_get_section_contents (abfd, section, w->data, offset, count);
- }
- if (abfd->direction != write_direction && section->rawsize != 0)
- sz = section->rawsize;
- else
- sz = section->size;
- if (offset + count < count
- || offset + count > sz
- || (abfd->my_archive != NULL
- && !bfd_is_thin_archive (abfd->my_archive)
- && ((ufile_ptr) section->filepos + offset + count
- > arelt_size (abfd)))
- || ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
- true))
- return false;
- return true;
-#else
- abort ();
-#endif
-}
-
/* This generic function can only be used in implementations where creating
NEW sections is disallowed. It is useful in patching existing sections
in read-write files, though. See other set_section_contents functions
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index bfe3c6f..5f5ad2d 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1,7 +1,7 @@
/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
generated from "libbfd-in.h", "libbfd.c", "bfd.c", "bfdio.c",
- "archive.c", "archures.c", "bfdwin.c", "cache.c", "hash.c", "linker.c",
- "opncls.c", "reloc.c", "section.c", "stabs.c" and "targets.c".
+ "archive.c", "archures.c", "cache.c", "hash.c", "linker.c", "opncls.c",
+ "reloc.c", "section.c", "stabs.c" and "targets.c".
Run "make headers" in your build bfd/ to regenerate. */
/* libbfd.h -- Declarations used by bfd library *implementation*.
@@ -268,8 +268,6 @@ extern bool _bfd_generic_new_section_hook
(bfd *, asection *) ATTRIBUTE_HIDDEN;
extern bool _bfd_generic_get_section_contents
(bfd *, asection *, void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
-extern bool _bfd_generic_get_section_contents_in_window
- (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
/* Generic routines to use for BFD_JUMP_TABLE_COPY. Use
BFD_JUMP_TABLE_COPY (_bfd_generic). */
@@ -1032,17 +1030,6 @@ void *bfd_arch_default_fill (bfd_size_type count,
bool is_bigendian,
bool code) ATTRIBUTE_HIDDEN;
-/* Extracted from bfdwin.c. */
-typedef struct _bfd_window_internal
-{
- struct _bfd_window_internal *next;
- void *data;
- bfd_size_type size;
- int refcount : 31; /* should be enough... */
- unsigned mapped : 1; /* 1 = mmap, 0 = malloc */
-}
-bfd_window_internal;
-
/* Extracted from cache.c. */
bool bfd_cache_init (bfd *abfd) ATTRIBUTE_HIDDEN;
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index fe60bba..8d33180 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -635,9 +635,6 @@ extern bool bfd_coff_gc_sections
extern const char *bfd_coff_group_name
(bfd *, const asection *);
-#define coff_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
/* Functions in xcofflink.c. */
extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 50b3959..5fc87e6 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -639,9 +639,6 @@ extern bool bfd_coff_gc_sections
extern const char *bfd_coff_group_name
(bfd *, const asection *);
-#define coff_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
-
/* Functions in xcofflink.c. */
extern long _bfd_xcoff_get_dynamic_symtab_upper_bound
diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c
index 6edb09f..d21f94c 100644
--- a/bfd/mach-o-target.c
+++ b/bfd/mach-o-target.c
@@ -24,7 +24,6 @@
#ifndef MACH_O_TARGET_COMMON_DEFINED
#define MACH_O_TARGET_COMMON_DEFINED
-#define bfd_mach_o_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define bfd_mach_o_bfd_print_private_bfd_data bfd_mach_o_bfd_print_private_bfd_data
#define bfd_mach_o_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
#define bfd_mach_o_bfd_is_local_label_name bfd_generic_is_local_label_name
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 528de1d..8018fc7 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3323,8 +3323,6 @@ mmo_write_object_contents (bfd *abfd)
#define mmo_read_minisymbols _bfd_generic_read_minisymbols
#define mmo_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define mmo_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
#define mmo_bfd_get_relocated_section_contents \
bfd_generic_get_relocated_section_contents
#define mmo_bfd_gc_sections bfd_generic_gc_sections
diff --git a/bfd/pdb.c b/bfd/pdb.c
index 2d347d0..b0455b0 100644
--- a/bfd/pdb.c
+++ b/bfd/pdb.c
@@ -759,7 +759,6 @@ pdb_write_contents (bfd *abfd)
#define pdb_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define pdb_new_section_hook _bfd_generic_new_section_hook
#define pdb_get_section_contents _bfd_generic_get_section_contents
-#define pdb_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define pdb_close_and_cleanup _bfd_generic_close_and_cleanup
#define pdb_slurp_armap _bfd_noarchive_slurp_armap
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index b20c396..ef86400 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -594,11 +594,6 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
/* The default symbol entry size is that of traditional Unix. */
obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
-#ifdef USE_MMAP
- bfd_init_window (&obj_aout_sym_window (abfd));
- bfd_init_window (&obj_aout_string_window (abfd));
-#endif
-
if (! NAME (aout, make_sections) (abfd))
goto error_ret;
@@ -1276,10 +1271,6 @@ NAME (aout, set_section_contents) (bfd *abfd,
static bool
aout_get_external_symbols (bfd *abfd)
{
-#ifdef USE_MMAP
- ufile_ptr filesize = bfd_get_file_size (abfd);
-#endif
-
if (obj_aout_external_syms (abfd) == NULL)
{
bfd_size_type count;
@@ -1292,27 +1283,14 @@ aout_get_external_symbols (bfd *abfd)
if (count == 0)
return true;
-#ifdef USE_MMAP
- if (filesize >= (ufile_ptr) obj_sym_filepos (abfd)
- && filesize - obj_sym_filepos (abfd) >= amt)
- {
- if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), amt,
- &obj_aout_sym_window (abfd), true))
- return false;
- syms = obj_aout_sym_window (abfd).data;
- }
- else
-#endif
- {
- /* We allocate using malloc to make the values easy to free
- later on. If we put them on the objalloc it might not be
- possible to free them. */
- if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
- return false;
- syms = _bfd_malloc_and_read (abfd, amt, amt);
- if (syms == NULL)
- return false;
- }
+ /* We allocate using malloc to make the values easy to free
+ later on. If we put them on the objalloc it might not be
+ possible to free them. */
+ if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
+ return false;
+ syms = _bfd_malloc_and_read (abfd, amt, amt);
+ if (syms == NULL)
+ return false;
obj_aout_external_syms (abfd) = syms;
obj_aout_external_sym_count (abfd) = count;
@@ -1340,33 +1318,20 @@ aout_get_external_symbols (bfd *abfd)
return false;
}
-#ifdef USE_MMAP
- if (stringsize >= BYTES_IN_LONG
- && filesize >= (ufile_ptr) obj_str_filepos (abfd)
- && filesize - obj_str_filepos (abfd) >= stringsize + 1)
- {
- if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize + 1,
- &obj_aout_string_window (abfd), true))
- return false;
- strings = (char *) obj_aout_string_window (abfd).data;
- }
- else
-#endif
- {
- strings = (char *) bfd_malloc (stringsize + 1);
- if (strings == NULL)
- return false;
+ strings = (char *) bfd_malloc (stringsize + 1);
+ if (strings == NULL)
+ return false;
- if (stringsize >= BYTES_IN_LONG)
+ if (stringsize >= BYTES_IN_LONG)
+ {
+ amt = stringsize - BYTES_IN_LONG;
+ if (bfd_read (strings + BYTES_IN_LONG, amt, abfd) != amt)
{
- amt = stringsize - BYTES_IN_LONG;
- if (bfd_read (strings + BYTES_IN_LONG, amt, abfd) != amt)
- {
- free (strings);
- return false;
- }
+ free (strings);
+ return false;
}
}
+
/* Ensure that a zero index yields an empty string. */
if (stringsize >= BYTES_IN_WORD)
memset (strings, 0, BYTES_IN_LONG);
@@ -1685,11 +1650,7 @@ NAME (aout, slurp_symbol_table) (bfd *abfd)
if (old_external_syms == NULL
&& obj_aout_external_syms (abfd) != NULL)
{
-#ifdef USE_MMAP
- bfd_free_window (&obj_aout_sym_window (abfd));
-#else
free (obj_aout_external_syms (abfd));
-#endif
obj_aout_external_syms (abfd) = NULL;
}
@@ -2567,15 +2528,8 @@ NAME (aout, bfd_free_cached_info) (bfd *abfd)
#define BFCI_FREE(x) do { free (x); x = NULL; } while (0)
BFCI_FREE (adata (abfd).line_buf);
BFCI_FREE (obj_aout_symbols (abfd));
-#ifdef USE_MMAP
- obj_aout_external_syms (abfd) = 0;
- bfd_free_window (&obj_aout_sym_window (abfd));
- bfd_free_window (&obj_aout_string_window (abfd));
- obj_aout_external_strings (abfd) = 0;
-#else
BFCI_FREE (obj_aout_external_syms (abfd));
BFCI_FREE (obj_aout_external_strings (abfd));
-#endif
for (asection *o = abfd->sections; o != NULL; o = o->next)
BFCI_FREE (o->relocation);
#undef BFCI_FREE
@@ -2654,21 +2608,13 @@ aout_link_free_symbols (bfd *abfd)
{
if (obj_aout_external_syms (abfd) != NULL)
{
-#ifdef USE_MMAP
- bfd_free_window (&obj_aout_sym_window (abfd));
-#else
free ((void *) obj_aout_external_syms (abfd));
-#endif
obj_aout_external_syms (abfd) = NULL;
}
if (obj_aout_external_strings (abfd) != NULL)
{
-#ifdef USE_MMAP
- bfd_free_window (&obj_aout_string_window (abfd));
-#else
free ((void *) obj_aout_external_strings (abfd));
-#endif
obj_aout_external_strings (abfd) = NULL;
}
return true;
diff --git a/bfd/pef.c b/bfd/pef.c
index 345f451..f330b92 100644
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -70,7 +70,6 @@
_bfd_generic_copy_link_hash_symbol_type
#define bfd_pef_bfd_final_link _bfd_generic_final_link
#define bfd_pef_bfd_link_split_section _bfd_generic_link_split_section
-#define bfd_pef_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define bfd_pef_bfd_link_check_relocs _bfd_generic_link_check_relocs
static int
@@ -1063,7 +1062,6 @@ const bfd_target pef_vec =
#define bfd_pef_xlib_new_section_hook _bfd_generic_new_section_hook
#define bfd_pef_xlib_get_section_contents _bfd_generic_get_section_contents
#define bfd_pef_xlib_set_section_contents _bfd_generic_set_section_contents
-#define bfd_pef_xlib_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define bfd_pef_xlib_set_section_contents_in_window _bfd_generic_set_section_contents_in_window
static int
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 8226c26..026654f 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -73,7 +73,6 @@ dlerror (void)
#define bfd_plugin_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define bfd_plugin_new_section_hook _bfd_generic_new_section_hook
#define bfd_plugin_get_section_contents _bfd_generic_get_section_contents
-#define bfd_plugin_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define bfd_plugin_init_private_section_data _bfd_generic_init_private_section_data
#define bfd_plugin_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#define bfd_plugin_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in
index ec12c86..ccc2dcb 100644
--- a/bfd/po/SRC-POTFILES.in
+++ b/bfd/po/SRC-POTFILES.in
@@ -12,7 +12,6 @@ archive64.c
archures.c
bfd.c
bfdio.c
-bfdwin.c
binary.c
cache.c
cf-i386lynx.c
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index 2e94777..1a98607 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -470,8 +470,6 @@ ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg)
_bfd_generic_copy_link_hash_symbol_type
#define ppcboot_bfd_final_link _bfd_generic_final_link
#define ppcboot_bfd_link_split_section _bfd_generic_link_split_section
-#define ppcboot_get_section_contents_in_window \
- _bfd_generic_get_section_contents_in_window
#define ppcboot_bfd_link_check_relocs _bfd_generic_link_check_relocs
#define ppcboot_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
diff --git a/bfd/som.c b/bfd/som.c
index dc641e7..3a3cbd3 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6762,7 +6762,6 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
#define som_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define som_read_minisymbols _bfd_generic_read_minisymbols
#define som_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define som_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define som_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define som_bfd_relax_section bfd_generic_relax_section
#define som_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
diff --git a/bfd/srec.c b/bfd/srec.c
index ccc258c..1534c81 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1257,7 +1257,6 @@ srec_print_symbol (bfd *abfd,
#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define srec_read_minisymbols _bfd_generic_read_minisymbols
#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define srec_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define srec_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define srec_bfd_relax_section bfd_generic_relax_section
#define srec_bfd_gc_sections bfd_generic_gc_sections
diff --git a/bfd/targets.c b/bfd/targets.c
index f94992d..532b646 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -266,8 +266,7 @@ BFD_JUMP_TABLE macros.
. NAME##_close_and_cleanup, \
. NAME##_bfd_free_cached_info, \
. NAME##_new_section_hook, \
-. NAME##_get_section_contents, \
-. NAME##_get_section_contents_in_window
+. NAME##_get_section_contents
.
. {* Called when the BFD is being closed to do any necessary cleanup. *}
. bool (*_close_and_cleanup) (bfd *);
@@ -278,8 +277,6 @@ BFD_JUMP_TABLE macros.
. {* Read the contents of a section. *}
. bool (*_bfd_get_section_contents) (bfd *, sec_ptr, void *, file_ptr,
. bfd_size_type);
-. bool (*_bfd_get_section_contents_in_window) (bfd *, sec_ptr, bfd_window *,
-. file_ptr, bfd_size_type);
.
. {* Entry points to copy private data. *}
.#define BFD_JUMP_TABLE_COPY(NAME) \
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index a498073..96022c5 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -991,7 +991,6 @@ tekhex_print_symbol (bfd *abfd,
#define tekhex_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type
#define tekhex_bfd_final_link _bfd_generic_final_link
#define tekhex_bfd_link_split_section _bfd_generic_link_split_section
-#define tekhex_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define tekhex_bfd_link_check_relocs _bfd_generic_link_check_relocs
const bfd_target tekhex_vec =
diff --git a/bfd/verilog.c b/bfd/verilog.c
index fbf3fd9..465264d 100644
--- a/bfd/verilog.c
+++ b/bfd/verilog.c
@@ -391,7 +391,6 @@ verilog_mkobject (bfd *abfd)
#define verilog_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define verilog_read_minisymbols _bfd_generic_read_minisymbols
#define verilog_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
-#define verilog_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define verilog_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define verilog_bfd_relax_section bfd_generic_relax_section
#define verilog_bfd_gc_sections bfd_generic_gc_sections
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index ace5a24..6b896d0 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -10159,7 +10159,6 @@ bfd_vms_get_data (bfd *abfd)
#define alpha_vms_bfd_free_cached_info _bfd_bool_bfd_true
#define alpha_vms_new_section_hook vms_new_section_hook
#define alpha_vms_set_section_contents _bfd_vms_set_section_contents
-#define alpha_vms_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define alpha_vms_bfd_get_relocated_section_contents \
bfd_generic_get_relocated_section_contents
diff --git a/bfd/xsym.c b/bfd/xsym.c
index 887272a..070ba4a 100644
--- a/bfd/xsym.c
+++ b/bfd/xsym.c
@@ -61,7 +61,6 @@
_bfd_generic_copy_link_hash_symbol_type
#define bfd_sym_bfd_final_link _bfd_generic_final_link
#define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section
-#define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define bfd_sym_bfd_link_check_relocs _bfd_generic_link_check_relocs
extern const bfd_target sym_vec;