Alan Modra f656f9c77c pe_ILF_object_p and bfd_check_format_matches
If pe_ILF_object_p succeeds, pe_ILF_build_a_bfd will have changed the
bfd from being file backed to in-memory.  This can have unfortunate
results for targets checked by bfd_check_format_matches after that
point as they will be matching against the created in-memory image
rather than the file.  bfd_preserve_restore also has a problem if it
flips the BFD_IN_MEMORY flag, because the flag affects iostream
meaning and should be set if using _bfd_memory_iovec.  To fix these
problems, save and restore iostream and iovec along with flags, and
modify bfd_reinit to make the bfd file backed again.  Restoring the
iovec and iostream allows the hack in bfd_reinit keeping BFD_IN_MEMORY
(part of BFD_FLAGS_SAVED) to be removed.
One more detail: If restoring from file backed to in-memory then the
bfd needs to be forcibly removed from the cache lru list, since after
the bfd becomes in-memory a bfd_close will delete the bfd's memory
leaving the lru list pointing into freed memory.

	* cache.c (bfd_cache_init): Clear BFD_CLOSED_BY_CACHE here..
	(bfd_cache_lookup_worker): ..rather than here.
	(bfd_cache_close): Comment.
	* format.c (struct bfd_preserve): Add iovec and iostream fields.
	(bfd_preserve_save): Save them..
	(bfd_preserve_restore): ..and restore them, calling
	bfd_cache_close if the iovec differs.
	(bfd_reinit): Add preserve param.  If the bfd has been flipped
	to in-memory, reopen the file.  Restore flags.
	* peicode.h (pe_ILF_cleanup): New function.
	(pe_ILF_object_p): Return it.
	* bfd.c (BFD_FLAGS_SAVED): Delete.
	* bfd-in2.h: Regenerate.
2023-04-12 09:40:13 +09:30
..
2023-02-28 11:06:41 +10:30
2023-01-02 14:03:22 +10:30
2023-01-10 23:05:31 +10:30
2023-01-06 21:06:16 +10:30
2023-01-12 17:20:21 +10:30
2023-01-06 21:06:15 +10:30
2023-02-09 20:07:55 +10:30
2023-01-06 21:06:15 +10:30
2023-01-10 09:15:51 +10:30
2023-01-20 14:58:04 +01:00
2023-01-20 14:58:04 +01:00
2023-01-20 14:58:04 +01:00
2023-03-24 21:01:43 +10:30
2023-03-27 21:58:46 +10:30
2023-03-20 15:35:21 +00:00
2023-03-24 21:01:43 +10:30
2023-04-11 17:47:31 -04:00
2023-01-10 09:15:51 +10:30
2023-01-06 21:06:15 +10:30
2023-01-10 09:15:51 +10:30
2023-01-31 15:18:04 +10:30
2023-02-10 20:30:24 +10:30
2023-03-29 12:56:46 +10:30
2023-03-16 09:11:09 +00:00
2023-02-15 10:27:34 -07:00
2023-01-02 14:03:22 +10:30
2023-04-12 00:00:16 +00:00

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 in BFD to https://sourceware.org/bugzilla/

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-2023 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.