diff options
author | Alan Modra <amodra@gmail.com> | 2024-04-11 11:56:50 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-04-11 17:05:16 +0930 |
commit | af925905211930677751678183f43c1bda13e013 (patch) | |
tree | 4003f40a03ceebde7ac611aa9d7a1dc0dcd72d8a /bfd/libbfd.c | |
parent | de9dc65bd45c118d56600bbf1786322284fde795 (diff) | |
download | gdb-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/libbfd.c')
-rw-r--r-- | bfd/libbfd.c | 57 |
1 files changed, 0 insertions, 57 deletions
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 |