]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove bfdwin.c
authorAlan Modra <amodra@gmail.com>
Thu, 11 Apr 2024 02:26:50 +0000 (11:56 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 11 Apr 2024 07:35:16 +0000 (17:05 +0930)
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.

39 files changed:
bfd/Makefile.am
bfd/Makefile.in
bfd/aout-target.h
bfd/aoutx.h
bfd/bfd-in2.h
bfd/bfdwin.c [deleted file]
bfd/binary.c
bfd/coff-aarch64.c
bfd/coff-alpha.c
bfd/coff-mips.c
bfd/coff-rs6000.c
bfd/coff-sh.c
bfd/coff64-rs6000.c
bfd/doc/bfdint.texi
bfd/doc/local.mk
bfd/elfxx-target.h
bfd/i386msdos.c
bfd/ihex.c
bfd/libaout.h
bfd/libbfd-in.h
bfd/libbfd.c
bfd/libbfd.h
bfd/libcoff-in.h
bfd/libcoff.h
bfd/mach-o-target.c
bfd/mmo.c
bfd/pdb.c
bfd/pdp11.c
bfd/pef.c
bfd/plugin.c
bfd/po/SRC-POTFILES.in
bfd/ppcboot.c
bfd/som.c
bfd/srec.c
bfd/targets.c
bfd/tekhex.c
bfd/verilog.c
bfd/vms-alpha.c
bfd/xsym.c

index 4f67b59585d756686cf38b81f39694080828b305..0dc733eaba956f44c49ce6439b12e48f9f79d428 100644 (file)
@@ -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
 
index 3092bff29356ed37bad0fa798f022684f131ed38..b3d97d478eacc03769bbbb73384cc0d039ec6792 100644 (file)
@@ -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@
index 47fe49fe04a2efcce522dba9e9695a9185e5db64..2a5300772c69f25b3edccfacb2065b90349aa3c1 100644 (file)
@@ -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
index d98ba61a3396f7a73182189bb62b28b01a6cef37..4c5be61b72281f897f009323583f0452dcc32d97 100644 (file)
@@ -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;
index d107a22f27e0fc8a23946cc39c6ac6a17c845a56..109de767a398ef25f75c37c864dadff7e58bf743 100644 (file)
@@ -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 (file)
index 0ef7b14..0000000
+++ /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 */
index a99d5d8f587318e0a6db99fa10914de18c717647..4cc51a60884492ad509f33475088160264b414b0 100644 (file)
@@ -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 =
index 06c22fc58fa26d5c2b4fe2cc5adc75a34d46c9d3..3f6a608b728b316e7ace991f44931101768d7efd 100644 (file)
@@ -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
index aaffe103541daab7f9e37b19364c35e344c88cf6..38d2c10ade3951069206a32b778de6cfdb7adb74 100644 (file)
@@ -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
 
index ed2722bebdbcb659fecbce15e7bee2c4b6fd548d..ae7b6e0024effca1191b206f7cf7b874faa2a485 100644 (file)
@@ -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
 
index 7d04739c8a9ea7a53c79fd23a88e17c43b938717..09d868bcf826a8a5d49106fccf21e4df11bc59c5 100644 (file)
@@ -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 \
index b37a80a2a5426b268a3cdcff501dcd3ee084bd30..cac29b6129da228ff95a4dba65913db14cd097c1 100644 (file)
@@ -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;
 
index 0f8d9e08783181a84d3433b6fa12fccc6f9a2d5a..850a63c18b4430f48f883851e8470e8e1f901a1e 100644 (file)
@@ -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,
index 94aa8402f5ff57ac4d66fd00459efc0350117b1d..e63d2d91d718be1105a63c826d3a74ae9c9b3f26 100644 (file)
@@ -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
index d18bbf0850c5367257540d66b2c9103d43c3b9aa..5e8f486f200fe630c32b4cd1d8652636aa21dade 100644 (file)
@@ -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
 
index e52ec54e34fda0865c1260b3fe5eca6205005278..6e9b3f8d0a3193491890814282f44029d58808e2 100644 (file)
@@ -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
index eeee3c913e6221cb3e07f3dc7c0801ed9dd38a8d..5d4a614c883e260b7a22522551bb549231e3ee17 100644 (file)
@@ -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
index ece4cd907b760c9122b8867fb01f097370eafd89..41eeb2334725711ace1f3e3d37f7493bc9c10412 100644 (file)
@@ -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
index 91033d4649f586e0d89786ffb11d0179f2f6d330..05b5e13bcd837841bf62ec400b69ca5e92605c5a 100644 (file)
@@ -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)
 
index 81898d406abc2231d0cbabb65e74743971336228..f7f5773510b7cbd3fce3961fe55279023afa5eb5 100644 (file)
@@ -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).  */
index 2f5ddcaf3b8626a34d92290e9e673f06ea4e5a23..747b69ec2c64220a70a96b439dc8a222ebec46a9 100644 (file)
@@ -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
index bfe3c6f176282acd29e3a6d288a24346b787868d..5f5ad2daace8fe39a7b2f6783ceec1bc8d3ac72d 100644 (file)
@@ -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;
 
index fe60bba660ced6020f69e9370fcdde5b5ff243ed..8d331805aee8bff388712825b6673cfd2e1b434e 100644 (file)
@@ -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
index 50b3959234afa26018b4a16206151ff9d93f80e5..5fc87e6bfa68fafb682d741fd2034fd60d9d8165 100644 (file)
@@ -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
index 6edb09f43479842e06bc8e2b8d396411a5d85200..d21f94c46a049518e2bb50b973ef2f3c091a3d62 100644 (file)
@@ -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
index 528de1d10e0d1c3b68a35b058f8463a0dea2684c..8018fc7bfb486a75b20b3fd83665b178d36be4ce 100644 (file)
--- 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
index 2d347d0c76985436dedc279b6ac7e9c15f7cfe5f..b0455b06c45f340e0d7db1748655945cba9bcb2e 100644 (file)
--- 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
index b20c39659db8f4f28ea59dc7d87dc869fbd64682..ef86400e842f507bc8addfb64859474b5ff17b72 100644 (file)
@@ -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;
index 345f451332ba42e8ae9009a8071b853445d0f6a8..f330b92e82103e15cee3c77805400f99ab7b71a8 100644 (file)
--- 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
index 8226c264733d72b11c9c4e8a142a54ca2c0ab477..026654fd9d375cc336bdcbb388cc29bbde04bd87 100644 (file)
@@ -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
index ec12c869216481d0e61295bdc84aabb61d2118a8..ccc2dcbe54d936bfd33ebcb833126ce0111879ce 100644 (file)
@@ -12,7 +12,6 @@ archive64.c
 archures.c
 bfd.c
 bfdio.c
-bfdwin.c
 binary.c
 cache.c
 cf-i386lynx.c
index 2e9477798857e60368c0516c2d7b42709f9dad0f..1a986075bb9622b2e3967642f8c36a9758817fb4 100644 (file)
@@ -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
index dc641e7857b906c62ad1afcff05aad07db551d84..3a3cbd3dfd70aef6d01631bfb40241bbe4d55ce9 100644 (file)
--- 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
index ccc258ce23512b2c238bfdb60635c047ed3d2a32..1534c81ca599ac40e9efe432965b3f2e40da744f 100644 (file)
@@ -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
index f94992d031d0f5612c6779f403f4b4a06e3f2f70..532b6465a610b71e8bc45e78001ba77fc5a10c3d 100644 (file)
@@ -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) \
index a498073c8dad1f11f116742b1393bb90422a52e6..96022c585ab252c05891a6686f91eb7bcfcb2edf 100644 (file)
@@ -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 =
index fbf3fd9a00320b1c58d66d37cfe1573907720033..465264dd7baa007b9610aa3dd4486591a01c3b25 100644 (file)
@@ -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
index ace5a24c631a269bac84cab9b68ac584cc1d030f..6b896d0f4ee949d590d8f9fafe5a1bb2f01236e3 100644 (file)
@@ -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
index 887272a5672964fbde6d5e2f21d5fde6eebbdb2a..070ba4a231856875b5fa7a18c62e407443cfbb0c 100644 (file)
@@ -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;