# 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 \
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 \
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
"$(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
# 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 \
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 \
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
doc/bfdio.texi \
doc/bfdt.texi \
doc/bfdver.texi \
- doc/bfdwin.texi \
doc/cache.texi \
doc/coffcode.texi \
doc/corefile.texi \
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 \
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
@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@
#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
/* 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;
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;
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;
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);
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;
}
#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
{
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;
/* 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.
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);
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 *);
/* 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) \
+++ /dev/null
-/* 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 */
#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 =
#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
#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
#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
#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 \
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;
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,
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,
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
%D%/bfdio.texi \
%D%/bfdt.texi \
%D%/bfdver.texi \
- %D%/bfdwin.texi \
%D%/cache.texi \
%D%/coffcode.texi \
%D%/corefile.texi \
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 \
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
#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
#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
#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
/* 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. */
#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)
(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). */
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
/* 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*.
(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). */
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;
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
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
#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
#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
#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
/* 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;
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;
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;
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);
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;
}
#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
{
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;
_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
#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
#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
archures.c
bfd.c
bfdio.c
-bfdwin.c
binary.c
cache.c
cf-i386lynx.c
_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
#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
#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
. 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 *);
. {* 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) \
#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 =
#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
#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
_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;