]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - bfd/coffcode.h
_bfd_free_cached_info
authorAlan Modra <amodra@gmail.com>
Wed, 7 Jun 2023 04:46:06 +0000 (14:16 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 7 Jun 2023 04:46:06 +0000 (14:16 +0930)
commitba75d1c55cb42114e3bb5c8abe37e5c2bd657a02
tree7e5342433baeaf8305f7a9b08ab58cfc521b4dd4
parent0a22a8f27df7d092620dfa1f0135a2dd7b44528a
_bfd_free_cached_info

doc/bfdint.texi and comments in the aout and som code about this
function are just wrong, and its name is not very apt.  Better would
be _bfd_mostly_destroy, and we certainly should not be saying anything
about the possibility of later recreating anything lost by this
function.  What's more, if _bfd_free_cached_info is called when
creating an archive map to reduce memory usage by throwing away
symbols, the target _close_and_cleanup function won't have access to
tdata or section bfd_user_data to tidy memory.  This means most of the
target _close_and_cleanup function won't do anything, and therefore
sometimes will result in memory leaks.

This patch fixes the documentation problems and moves most of the
target _close_and_cleanup code to target _bfd_free_cached_info.
Another notable change is that bfd_generic_bfd_free_cached_info is now
defined as _bfd_free_cached_info rather than _bfd_bool_bfd_true,
ie. the default now frees objalloc memory.
31 files changed:
bfd/aout-target.h
bfd/aoutx.h
bfd/coff-rs6000.c
bfd/coff64-rs6000.c
bfd/coffcode.h
bfd/coffgen.c
bfd/doc/bfdint.texi
bfd/ecoff.c
bfd/elf-bfd.h
bfd/elf.c
bfd/elf32-mips.c
bfd/elf64-alpha.c
bfd/elf64-ia64-vms.c
bfd/elf64-mips.c
bfd/elf64-ppc.c
bfd/elfn32-mips.c
bfd/elfnn-aarch64.c
bfd/elfxx-mips.c
bfd/elfxx-mips.h
bfd/elfxx-target.h
bfd/libbfd-in.h
bfd/libbfd.h
bfd/libcoff-in.h
bfd/libcoff.h
bfd/libecoff.h
bfd/mach-o-target.c
bfd/mach-o.c
bfd/mach-o.h
bfd/pdp11.c
bfd/som.c
bfd/vms-alpha.c