Files
binutils-gdb/bfd
Alan Modra cb001c0d28 bfd_cleanup for object_p
The object_p (and archive_p, core_file_p) functions are not supposed
to have any target specific malloc'd memory attached to the bfd on
their return.  This should be obvious on a failure return, but it's
also true for a successful return.  The reason is that even though the
object_p recognises the file, that particular target may not be used
and thus the bfd won't be closed calling close_and_cleanup for the
target that allocated the memory.

It turns out that the object_p bfd_target* return value isn't needed.
In all cases except ld/plugin.c the target is abfd->xvec and with
ld/plugin.c the target isn't used.  So this patch returns a cleanup
function from object_p instead, called in bfd_check_format_matches to
tidy the bfd before trying a different target match.  The only cleanup
that does anything at this stage is the alpha-vms one.

bfd/
	* targets.c (bfd_cleanup): New typedef.
	(struct bfd <_bfd_check_format>): Return a bfd_cleanup.
	* libbfd-in.h (_bfd_no_cleanup): Define.
	* format.c (bfd_reinit): Add cleanup parameter, call it.
	(bfd_check_format_matches): Set cleanup from _bfd_check_format
	call and pass to bfd_reinit.  Delete temp, use abfd->xvec instead.
	* aout-target.h (callback, object_p): Return bfd_cleanup.
	* aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise.
	* archive.c (bfd_generic_archive_p): Likewise.
	* binary.c (binary_object_p): Likewise.
	* coff-alpha.c (alpha_ecoff_object_p): Likewise.
	* coff-ia64.c (ia64coff_object_p): Likewise.
	* coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise.
	* coff-sh.c (coff_small_object_p): Likewise.
	* coff-stgo32.c (go32_check_format): Likewise.
	* coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p),
	(xcoff64_core_p): Likewise.
	* coffgen.c (coff_real_object_p, coff_object_p): Likewise.
	* elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p),
	(bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise.
	* elfcode.h (elf_object_p): Likewise.
	* elfcore.h (elf_core_file_p): Likewise.
	* i386msdos.c (msdos_object_p): Likewise.
	* ihex.c (ihex_object_p): Likewise.
	* libaout.h (some_aout_object_p): Likewise.
	* libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target),
	(_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise.
	* libbfd.c (_bfd_dummy_target): Likewise.
	* libcoff-in.h (coff_object_p): Likewise.
	* mach-o-aarch64.c (bfd_mach_o_arm64_object_p),
	(bfd_mach_o_arm64_core_p): Likewise.
	* mach-o-arm.c (bfd_mach_o_arm_object_p),
	(bfd_mach_o_arm_core_p): Likewise.
	* mach-o-i386.c (bfd_mach_o_i386_object_p),
	(bfd_mach_o_i386_core_p): Likewise.
	* mach-o-x86-64.c (bfd_mach_o_x86_64_object_p),
	(bfd_mach_o_x86_64_core_p): Likewise.
	* mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p),
	(bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise.
	* mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p),
	(bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise.
	* mmo.c (mmo_object_p): Likewise.
	* pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise.
	* peicode.h (coff_real_object_p, pe_ILF_object_p),
	(pe_bfd_object_p): Likewise.
	* plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise.
	* ppcboot.c (ppcboot_object_p): Likewise.
	* rs6000-core.c (rs6000coff_core_p): Likewise.
	* som.c (som_object_setup, som_object_p): Likewise.
	* srec.c (srec_object_p, symbolsrec_object_p): Likewise.
	* tekhex.c (tekhex_object_p): Likewise.
	* vms-alpha.c (alpha_vms_object_p): Likewise.
	* vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p),
	(_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise.
	* wasm-module.c (wasm_object_p): Likewise.
	* xsym.c (bfd_sym_object_p): Likewise.
	* xsym.h (bfd_sym_object_p): Likewise.
	* aoutx.h (some_aout_object_p): Likewise, and callback parameter
	return type.
	* pdp11.c (some_aout_object_p): Likewise.
	* plugin.c (register_ld_plugin_object_p): Update object_p
	parameter type.
	* plugin.h (register_ld_plugin_object_p): Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* libcoff.h: Regenerate.
ld/
	* plugin.c (plugin_object_p): Return a bfd_cleanup.
	(plugin_cleanup): New function.
2020-03-02 19:30:48 +10:30
..
2020-01-27 14:31:29 +01:00
2020-02-19 13:12:00 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 19:30:48 +10:30
2020-02-27 17:04:55 +10:30
2020-02-26 10:37:13 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-01-01 18:12:08 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 11:36:19 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 11:36:19 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-02-19 17:46:10 +00:00
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 11:36:19 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-02-26 10:37:25 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 14:00:55 +10:30
2020-03-02 11:36:19 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 11:36:19 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 11:36:19 +10:30
2020-02-26 10:37:25 +10:30
2020-02-19 14:00:55 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 11:36:19 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 11:36:19 +10:30
2020-03-02 11:36:19 +10:30
2020-02-19 14:00:55 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 11:36:19 +10:30
2020-01-22 17:14:08 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 14:00:55 +10:30
2020-02-26 10:37:25 +10:30
2020-02-19 13:14:05 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-02-26 10:37:25 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-02-26 10:37:25 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 11:36:19 +10:30
2020-02-19 13:11:17 +10:30
2020-01-22 16:45:04 -08:00
2020-02-26 10:37:25 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 14:00:55 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-01-31 10:47:46 +10:30
2020-01-31 10:47:46 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-02-19 13:15:06 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-02-26 10:37:25 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-01-17 12:34:03 -06:00
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 13:12:00 +10:30
2020-03-02 00:00:22 +00:00
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30
2020-01-14 11:02:28 +10:30
2020-03-02 19:30:48 +10:30
2020-02-19 14:00:55 +10:30
2020-03-02 19:30:48 +10:30
2020-03-02 19:30:48 +10:30

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

BFD is an object file library.  It permits applications to use the
same routines to process object files regardless of their format.

BFD is used by the GNU debugger, assembler, linker, and the binary
utilities.

The documentation on using BFD is scanty and may be occasionally
incorrect.  Pointers to documentation problems, or an entirely
rewritten manual, would be appreciated.

There is some BFD internals documentation in doc/bfdint.texi which may
help programmers who want to modify BFD.

BFD is normally built as part of another package.  See the build
instructions for that package, probably in a README file in the
appropriate directory.

BFD supports the following configure options:

  --target=TARGET
	The default target for which to build the library.  TARGET is
	a configuration target triplet, such as sparc-sun-solaris.
  --enable-targets=TARGET,TARGET,TARGET...
	Additional targets the library should support.  To include
	support for all known targets, use --enable-targets=all.
  --enable-64-bit-bfd
	Include support for 64 bit targets.  This is automatically
	turned on if you explicitly request a 64 bit target, but not
	for --enable-targets=all.  This requires a compiler with a 64
	bit integer type, such as gcc.
  --enable-shared
	Build BFD as a shared library.
  --with-mmap
	Use mmap when accessing files.  This is faster on some hosts,
	but slower on others.  It may not work on all hosts.

Report bugs with BFD to bug-binutils@gnu.org.

Patches are encouraged.  When sending patches, always send the output
of diff -u or diff -c from the original file to the new file.  Do not
send default diff output.  Do not make the diff from the new file to
the original file.  Remember that any patch must not break other
systems.  Remember that BFD must support cross compilation from any
host to any target, so patches which use ``#ifdef HOST'' are not
acceptable.  Please also read the ``Reporting Bugs'' section of the
gcc manual.

Bug reports without patches will be remembered, but they may never get
fixed until somebody volunteers to fix them.

Copyright (C) 2012-2020 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.