Compare commits

..

96 Commits

Author SHA1 Message Date
Alibek Omarov b021dfea95 GDB with MCST patches (26.012) 2023-07-21 03:37:19 +03:00
Joel Brobecker 49526e9359 Bump GDB version number to 9.1.90.DATE-git.
gdb/ChangeLog:

	* version.in: Set GDB version number to 9.1.90.DATE-git.
2020-02-08 17:14:10 +04:00
Joel Brobecker 97bfc9ea88 Document the GDB 9.1 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 9.1 released.
2020-02-08 17:02:09 +04:00
Joel Brobecker 899016d49d Set GDB version number to 9.1.
gdb/ChangeLog:

	* version.in: Set GDB version number to 9.1.
2020-02-08 16:50:15 +04:00
GDB Administrator 2c8e4c9fba Automatic date update in version.in 2020-02-08 00:01:33 +00:00
Iain Buclaw f49692dff8 Make fputs_unfiltered use fputs_maybe_filtered
This patch redefines fputs_unfiltered in utils.c, with new behavior to
forward parameters to fputs_maybe_filtered.  This makes
fputs_unfiltered identical to fputs_filtered, except filtering is
disabled.

Some callers of fputs_unfiltered have been updated to use ui_file_puts
where they were using other ui_file_* functions anyway for IO.

This fixes the problem I saw with \032\032post-prompt annotation being
flushed to stdout in the wrong order.

gdb/ChangeLog
2020-02-05  Iain Buclaw  <ibuclaw@gdcproject.org>

	PR gdb/25190:
        * gdb/remote-sim.c (gdb_os_write_stderr): Update.
        * gdb/remote.c (remote_console_output): Update.
        * gdb/ui-file.c (fputs_unfiltered): Rename to...
        (ui_file_puts): ...this.
        * gdb/ui-file.h (ui_file_puts): Add declaration.
        * gdb/utils.c (emit_style_escape): Update.
        (flush_wrap_buffer): Update.
        (fputs_maybe_filtered): Update.
        (fputs_unfiltered): Add function.

Change-Id: I17ed5078f71208344f2f8ab634a6518b1af6e213
2020-02-07 13:23:51 -07:00
Iain Buclaw ff491e6bfc Make gdb_flush also flush the wrap buffer
This changes gdb_flush to also flush the internal wrap buffer.  A few
places needed to continue using the previous approach, so this also
introduces ui_file_flush for those.

gdb/ChangeLog
2020-02-05  Iain Buclaw  <ibuclaw@gdcproject.org>

        * gdb/event-loop.c (gdb_wait_for_event): Update.
        * gdb/printcmd.c (printf_command): Update.
        * gdb/remote-fileio.c (remote_fileio_func_write): Update.
        * gdb/remote-sim.c (gdb_os_flush_stdout): Update.
        (gdb_os_flush_stderr): Update.
        * gdb/remote.c (remote_console_output): Update.
        * gdb/ui-file.c (gdb_flush): Rename to...
        (ui_file_flush): ...this.
        (stderr_file::write): Update.
        (stderr_file::puts): Update.
        * gdb/ui-file.h (gdb_flush): Rename to...
        (ui_file_flush): ...this.
        * gdb/utils.c (gdb_flush): Add function.
        * gdb/utils.h (gdb_flush): Add declaration.

Change-Id: I7ca143d30f03dc39f218f6e880eb9bca9e15af39
2020-02-07 13:07:39 -07:00
Tom Tromey 76f5096cd4 Revert basenames_may_differ patch
Commit a0c1ffedc regressed certain cases coming from Eclipse.
See PR breakpoints/24915.

This patch reverts the commit for the gdb 9 release.

gdb/ChangeLog
2020-02-07  Tom Tromey  <tromey@adacore.com>

	PR breakpoints/24915:
	* source.c (find_and_open_source): Do not check basenames_may_differ.

gdb/testsuite/ChangeLog
2020-02-07  Tom Tromey  <tromey@adacore.com>

	PR breakpoints/24915:
	* gdb.base/annotate-symlink.exp: Use setup_xfail.

Change-Id: Iadbf42f35eb40c95ad32b2108ae25d8f199998bd
2020-02-07 12:38:27 -07:00
GDB Administrator 168359c1b5 Automatic date update in version.in 2020-02-07 00:01:51 +00:00
GDB Administrator cab7b99a4f Automatic date update in version.in 2020-02-06 00:01:13 +00:00
GDB Administrator 6eb28a37e9 Automatic date update in version.in 2020-02-05 00:01:15 +00:00
GDB Administrator e0d936418a Automatic date update in version.in 2020-02-04 00:01:43 +00:00
GDB Administrator 4d37e9a90b Automatic date update in version.in 2020-02-03 00:01:43 +00:00
GDB Administrator 99a0005346 Automatic date update in version.in 2020-02-02 00:01:30 +00:00
Sergio Durigan Junior 1aa93c3a9b Implement '--enable-src-release-build' option and make src-release.sh use it
The generation of snapshots has been broken since we've disable
in-tree builds for GDB.  Given that src-release.sh performs a build
before creating the release tarball, and that this build is performed
in-tree, the solution we found is to implement a new top-level
configure flag called '--enable-src-release-build' which disables the
in-tree build restriction, and then make src-release.sh use it.

ChangeLog:
2020-02-01  Sergio Durigan Junior  <sergiodj@redhat.com>
	    Eli Zaretskii  <eliz@gnu.org>

	* configure.ac: Don't abort the build if trying to build GDB in tree
	_and_ invoking with '--enable-src-release-build'.
	* configure: Regenerate.
	* src-release.sh (do_proto_toplev): Invoke 'configure' using

Change-Id: Ic6dd55accd9a03e62fe498f7fd704fb67f44bfa9
2020-02-01 15:33:31 -05:00
Eli Zaretskii 50500ecfef libctf: compilation failure on MinGW due to missing errno values
This commit fixes a compilation failure in a couple of libctf files
due to the use of EOVERFLOW and ENOTSUP, which are not defined
when compiling on MinGW.

libctf/ChangeLog:

	PR binutils/25155:
	* ctf-create.c (EOVERFLOW): If not defined by system header,
	redirect to ERANGE as a poor man's substitute.
	* ctf-subr.c (ENOTSUP): If not defined, use ENOSYS instead.

This one is how Eli implemented it. I think this implementation
has a weakness in the following sense: If other units in libctf
start using those constants, we'll get the same error again.
Also, I'm wondering whether their use is documented as part of
the official libtcf API or not -- users might be writing code
that tests for these, and if the system doesn't support them,
how would they know what errno code to use in its place. This
argues for a having that information in one of libctf's header
files. I think it would be nice to have those in ctf-decls.h,
but I think we'll need to include <errno.h> in ctf-decls.h if
we decide to define those macros there.

Rather than second-guess what the CTF developers would prefer,
I'm starting by sending Eli's patch, to see what you guys think.

Thanks,
--
Joel
2020-02-01 15:25:19 +04:00
GDB Administrator 7437a7ef50 Automatic date update in version.in 2020-02-01 00:01:34 +00:00
GDB Administrator 1ca56c96a4 Automatic date update in version.in 2020-01-31 00:01:41 +00:00
GDB Administrator a11ceee48d Automatic date update in version.in 2020-01-30 00:01:30 +00:00
GDB Administrator caeb863eda Automatic date update in version.in 2020-01-29 00:01:22 +00:00
Hannes Domani 42cce0e4fc Fix library segment-address for 64bit values
The address was written as a long value, but long is always a 32bit value
on Windows, which lead to truncated addresses.
The solution was to use paddress instead.

gdb/gdbserver/ChangeLog:

2020-01-28  Hannes Domani  <ssbssa@yahoo.de>

	* server.c (handle_qxfer_libraries): Write segment-address with
	paddress.
2020-01-28 20:10:55 +01:00
GDB Administrator 8d197d83a1 Automatic date update in version.in 2020-01-28 00:02:48 +00:00
GDB Administrator 85e069727b Automatic date update in version.in 2020-01-27 00:01:57 +00:00
GDB Administrator 069022c5b3 Automatic date update in version.in 2020-01-26 00:01:35 +00:00
GDB Administrator 99075aaca1 Automatic date update in version.in 2020-01-25 00:00:54 +00:00
GDB Administrator 937d3d4a1f Automatic date update in version.in 2020-01-24 00:01:02 +00:00
GDB Administrator 0b25a5d915 Automatic date update in version.in 2020-01-23 00:01:16 +00:00
GDB Administrator eb886d58a2 Automatic date update in version.in 2020-01-22 00:01:18 +00:00
GDB Administrator 832bd9e9c9 Automatic date update in version.in 2020-01-21 00:01:48 +00:00
GDB Administrator 283eb89897 Automatic date update in version.in 2020-01-20 00:01:02 +00:00
GDB Administrator 0d4f8ed80a Automatic date update in version.in 2020-01-19 00:01:28 +00:00
GDB Administrator 62723af4cc Automatic date update in version.in 2020-01-18 00:01:25 +00:00
Joel Brobecker 043a001093 Abort configure immediately if building GDB in tree
The move of gnulib to the top src directory is causing the GDB build
to break if configured in tree. We hope to lift that limitation at
some point but, in the meantime, this commit allows us to abort
the initial configure right away with a clear error message should
the user attempt to build in tree.

ChangeLog:

        * configure.ac: Abort the build with an error if trying to build
        GDB in tree.
        * configure: Regenerate.
2020-01-17 19:30:39 +01:00
GDB Administrator a3cf234200 Automatic date update in version.in 2020-01-17 00:01:31 +00:00
GDB Administrator 7f92ae2824 Automatic date update in version.in 2020-01-16 00:01:33 +00:00
GDB Administrator 17524e099d Automatic date update in version.in 2020-01-15 00:00:56 +00:00
GDB Administrator 6c54147084 Automatic date update in version.in 2020-01-14 00:00:55 +00:00
GDB Administrator 7e36ff586d Automatic date update in version.in 2020-01-13 00:00:50 +00:00
GDB Administrator 3e353caee1 Automatic date update in version.in 2020-01-12 00:02:18 +00:00
GDB Administrator 55cca6cf13 Automatic date update in version.in 2020-01-11 00:01:19 +00:00
Christian Biesinger 975292a976 Don't define _FORTIFY_SOURCE on MinGW
Recent MinGW versions require -lssp when using _FORTIFY_SOURCE, which
gdb does (in common-defs.h)
https://github.com/msys2/MINGW-packages/issues/5868#issuecomment-544107564

To avoid all the complications with checking for -lssp and making sure it's
linked statically, just don't define it.

gdb/ChangeLog:

2020-01-10  Christian Biesinger  <cbiesinger@google.com>

	* gdbsupport/common-defs.h: Don't define _FORTIFY_SOURCE on MinGW.

Change-Id: Ide6870ab57198219a2ef78bc675768a789ca2b1d
2020-01-10 11:39:38 -06:00
GDB Administrator ad5e26527f Automatic date update in version.in 2020-01-10 00:00:56 +00:00
GDB Administrator 7e95250e16 Automatic date update in version.in 2020-01-09 00:02:08 +00:00
GDB Administrator cd57c637b2 Automatic date update in version.in 2020-01-08 00:00:53 +00:00
Tom Tromey 3c473fad8f Add constructor to stap_static_probe_ops
PR build/24937 concerns an error given by the clang provided by a
particular version of macOS.  In particular, it reports

    error: default initialization of an object of const type 'const
    stap_static_probe_ops' without a user-provided default constructor

Although (at least according to sources I found online) this was
resolved as a bug in the standard, it seemed simple enough to work
around this.

Given that this is a trivial build fix, I think it should go on the
gdb 9 branch as well.

2020-01-07  Tom Tromey  <tromey@adacore.com>

	PR build/24937:
	* stap-probe.c (class stap_static_probe_ops): Add constructor.

Change-Id: I18f180c17850f420e9b66afc67f9cb3d8dceb0b3
2020-01-07 09:46:26 -07:00
GDB Administrator 6b3a34ea87 Automatic date update in version.in 2020-01-07 00:00:51 +00:00
Andrew Burgess f7da8e5b9b gdb: Fix backtrace with disassemble-next-line on
In this commit:

  commit ec8e2b6d30
  Date:   Fri Jun 14 23:43:00 2019 +0100

      gdb: Don't allow annotations to influence what else GDB prints

A change was accidentally made that moved a call to do_gdb_disassembly
out of an if block guarded by 'if (source_print && sal.symtab)'.  The
result was that if a user has 'set disassemble-next-line on' then the
backtrace would now include some disassembly of a few instructions in
each frame.

This change was not intentional, but was not spotted by any tests.

This commit restores the old behaviour and adds a test to ensure this
doesn't break again in the future.

gdb/ChangeLog:

	* stack.c (print_frame_info): Move disassemble_next_line code
	inside source_print block.

gdb/testsuite/ChangeLog:

	* gdb.base/backtrace.c: New file.
	* gdb.base/backtrace.exp: New file.

Change-Id: I47c52a202fa74be138382646b695827940178689
2020-01-06 21:42:22 +00:00
GDB Administrator f231cbc17e Automatic date update in version.in 2020-01-06 00:01:03 +00:00
Eli Zaretskii 84baa6a515 libctf: Add configure check for asprintf (for MinGW)
This commit fixes a compilation warning when compiling libctf
on MinGW:

    libctf/ctf-dump.c:118:8: warning: implicit declaration of function
    'asprintf'; did you mean 'vasprintf'? [-Wimplicit-function-declaration]

	 if (asprintf (&bit, " %lx: [slice 0x%x:0x%x]",
	     ^~~~~~~~
	     vasprintf

MinGW doesn't provide that function, so we depend on the one provided
by libiberty. However, the declaration is guarded by HAVE_DECL_ASPRINTF,
which we do not have in libctf's config.h.

libctf/ChangeLog:

	PR binutils/25155:
	* configure.ac: Add AC_CHECK_DECLS([asprintf]).
	* configure, config.h.in: Regenerate.

(cherry picked from commit 3a657c600b)
2020-01-05 09:54:55 +04:00
Joel Brobecker 6f6d0a0778 libctf: Regenerate Makefile.in and acinclude.m4
I noticed that if I run "autoreconf" with vanilla automake-1.15.1
and autoconf-2.69, I get some differences.

libctf/ChangeLog:

        * Makefile.in, aclocal.m4: Regenerate.
2020-01-05 09:49:33 +04:00
Joel Brobecker b8e46eb9a1 Update copyright year in gdbarch.sh doc/gdb.texinfo and doc/refcard.tex
These are files that need to be updated by hand, because the copyright.py
script isn't able to handle them automatically.

gdb/ChangeLog:

	* gdbarch.sh: Update copyright year range of generated files.

gdb/doc/ChangeLog:

        * gdb.texinfo, refcard.tex: Update copyright year range.

(cherry picked from commit e5d78223ea)
2020-01-05 09:44:10 +04:00
Joel Brobecker 11bc5fe47f Copyright year range updates after running gdb/copyright.py
gdb/ChangeLog:

	Update copyright year range in all the GDB files automatically
	handled by our copyright.py script.
2020-01-05 09:44:10 +04:00
Joel Brobecker 8b371634b4 gdb/copyright.py: Convert to Python 3
gdb/ChangeLog:

        * copyright.py: Convert to Python 3.

(cherry picked from commit 5f4def5cbd)
2020-01-05 09:44:09 +04:00
Joel Brobecker a292f79fbd gdb/copyright.py: Adapt after move of gnulib from gdb to toplevel
gdb/ChangeLog:

	* copyright.py: Adapt after move of gnulib directory from gdb
	directory to toplevel directory.

(cherry picked from commit 51fd40020e)
2020-01-05 09:44:09 +04:00
Joel Brobecker 1458b0f311 gdb/copyright.py: Exit if run from the wrong directory
We printed an error, but kept going anyway... ;-)

gdb/ChangeLog:

	* copyright.py (main): Exit if run from the wrong directory.

(cherry picked from commit 5fb651f2dd)
2020-01-05 09:44:09 +04:00
Joel Brobecker e9de78be1c update copyright year in version output of gdb, gdbserver and gdbreplay
gdb/ChangeLog:

        * top.c (print_gdb_version): Change copyright year to 2020.

gdb/gdbserver/ChangeLog:

        * server.c (gdbserver_version): Change copyright year to 2020.
        * gdbreplay.c (gdbreplay_version): Likewise.

(cherry picked from commit 5dd8bf886a)
2020-01-05 09:44:09 +04:00
GDB Administrator e33a4274ee Automatic date update in version.in 2020-01-05 00:01:40 +00:00
GDB Administrator 3f83406160 Automatic date update in version.in 2020-01-04 00:00:48 +00:00
GDB Administrator 4955678c8c Automatic date update in version.in 2020-01-03 00:01:53 +00:00
GDB Administrator bf957be6f3 Automatic date update in version.in 2020-01-02 00:01:20 +00:00
GDB Administrator 05989f5ecc Automatic date update in version.in 2020-01-01 00:00:50 +00:00
GDB Administrator 7332f2844c Automatic date update in version.in 2019-12-31 00:01:13 +00:00
GDB Administrator f9d7b63705 Automatic date update in version.in 2019-12-30 00:00:50 +00:00
GDB Administrator af76fcf70f Automatic date update in version.in 2019-12-29 00:01:53 +00:00
GDB Administrator c86ec09cd9 Automatic date update in version.in 2019-12-28 00:01:17 +00:00
GDB Administrator 0e64a4e283 Automatic date update in version.in 2019-12-27 00:01:22 +00:00
Christian Biesinger c0716f3e64 Consistently quote variables used with "test"
This ensures that empty variables and variables with spaces are handled
correctly.

Code was inconsistent on whether the constant string (e.g. yes/no)
should also be quoted; I tried to be consistent with surrounding code.

This fixes the error Eli reported during configure with mingw (though that
was not fatal).

gdb/ChangeLog:

2019-12-19  Christian Biesinger  <cbiesinger@google.com>

	* configure: Regenerate.
	* configure.ac: Quote variable arguments of test.
	* gdbsupport/common.m4: Likewise.

gdb/gdbserver/ChangeLog:

2019-12-19  Christian Biesinger  <cbiesinger@google.com>

	* configure: Regenerate.
	* configure.ac: Quote variable arguments of test.

Change-Id: I220e78b52c7db88b9dd058eda604635b03464fac
2019-12-26 23:34:08 +01:00
GDB Administrator 2030d2b12e Automatic date update in version.in 2019-12-26 00:01:40 +00:00
GDB Administrator f987988860 Automatic date update in version.in 2019-12-25 00:00:57 +00:00
GDB Administrator 8aeb92e18d Automatic date update in version.in 2019-12-24 00:00:56 +00:00
Eli Zaretskii b36fbdf11c Fix compilation of Readline on mingw.org's MinGW
readline/ChangeLog
2019-12-23  Eli Zaretskii  <eliz@gnu.org>

	* posixstat.h (S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH)
	(S_IXOTH, S_IRWXG, S_IRWXO): Define if undefined, even if S_IRWXU
	is defined, because non-Posix systems may defined only the user
	bits.

(cherry picked from commit e76ff63653)
2019-12-23 16:30:35 +02:00
GDB Administrator a0f6c91734 Automatic date update in version.in 2019-12-23 00:00:53 +00:00
GDB Administrator 34f3d48420 Automatic date update in version.in 2019-12-22 00:01:39 +00:00
Eli Zaretskii 5c91fe6ebb Fix inadvertent indentation changes in last commit. 2019-12-21 09:32:39 +02:00
Eli Zaretskii 527178f70a Include xxHash support status in GDB configuration report
gdb/ChangeLog
2019-12-21  Eli Zaretskii  <eliz@gnu.org>

	* top.c (print_gdb_configuration): Print "--with-xxhash" or
	"--without-xxhash" according to HAVE_LIBXXHASH.

(cherry picked from commit 15b07e4f56)
2019-12-21 09:31:57 +02:00
GDB Administrator 200d296cf3 Automatic date update in version.in 2019-12-21 00:01:08 +00:00
GDB Administrator 0c21cc55c7 Automatic date update in version.in 2019-12-20 00:00:54 +00:00
GDB Administrator 32e6bcdb5d Automatic date update in version.in 2019-12-19 00:01:05 +00:00
Tom Tromey 4ae7258edf Fix pthread_setname_np build error
My earlier patch to fix the pthread_setname_np build error on macOS
was incorrect.  While the macOS man page claims that
pthread_setname_np returns void, in <pthread.h> it is actually
declared returning "int".  I knew this earlier, but must have made
some mistake when preparing the patch for submission (perhaps when
removing the templates?).

This patch re-fixes the bug.  I'm also applying it to the 9.1 branch.

Tested by building on macOS High Sierra.

gdb/ChangeLog
2019-12-18  Tom Tromey  <tromey@adacore.com>

	PR build/25268:
	* gdbsupport/thread-pool.c (set_thread_name): Expect "int" return
	type on macOS.  Add comment.

Change-Id: Ib09da6ac33958a0d843f65df2a528112356e7de6
2019-12-18 11:54:01 -07:00
Tom Tromey 1c66314dcb Fix build failure on macOS
PR build/25250 notes that the gdb 9 pre-release fails to build on
macOS, due to a name clash between field_kind::STRING and the STRING
token in ada-exp.y.  I am not sure (I couldn't reproduce this myself),
but presumably this is due to differences caused by the version of
bison in use there.

This patch works around the problem by renaming the field_kind
enumerator.  I chose to rename this one because it is used in
relatively few places -- it's just an implementation detail of the
style code.

This version also renames field_kind::SIGNED for consistency.

Let me know what you think.  I intend to check this in on the gdb 9
branch as well.

2019-12-18  Tom Tromey  <tromey@adacore.com>

	PR build/25250:
	* ui-out.c (ui_out::vmessage): Update.
	* ui-out.h (enum class field_kind) <FIELD_STRING, FIELD_SIGNED>:
	Rename.
	(string_field): Update.
	(signed_field): Update.

Change-Id: Iae9f36f1b793e22c61fee0de2ab2d508668ee7e4
2019-12-18 10:31:53 -07:00
GDB Administrator f0ee30bfb0 Automatic date update in version.in 2019-12-18 00:01:06 +00:00
Simon Marchi be19b69991 Fix double-free when creating more than one block in JIT debug info reader
A double-free happens when using a JIT debug info reader that creates
more than one block.  In the loop that frees blocks in finalize_symtab,
at the very end, the gdb_block_iter_tmp variable is set initially, but
not changed as the loop advances.  If we have two blocks, the first
iteration frees the first block, the second iteration frees the second
block, but the third iteration tries to free the second block again, as
gdb_block_iter_tmp keeps pointing on the second block.

Fix it by assigning the gdb_block_iter_tmp variable in the loop.

I have improved the jit-reader.exp test to cover this case, by adding a
second "JIT-ed" function and creating a block for it.  I have renamed
the existing function to something I find a bit more descriptive.  There
are no significant changes to jit-reader.exp itself, only updates
following the renaming.  The important changes are in jithost.c
(generate a new function) and in jitreader.c (create a gdb_block for
that function).

This was found because of an ASan report:

$ ./gdb testsuite/outputs/gdb.base/jit-reader/jit-reader -ex "jit-reader-load /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/jit-reader/jitreader.so" -ex r
Reading symbols from testsuite/outputs/gdb.base/jit-reader/jit-reader...
Starting program: /home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/jit-reader/jit-reader
=================================================================
==1751048==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000042eb8 at pc 0x5650ef8eec88 bp 0x7ffe52767290 sp 0x7ffe52767280
READ of size 8 at 0x604000042eb8 thread T0
    #0 0x5650ef8eec87 in finalize_symtab /home/simark/src/binutils-gdb/gdb/jit.c:768
    #1 0x5650ef8eef88 in jit_object_close_impl /home/simark/src/binutils-gdb/gdb/jit.c:797
    #2 0x7fbbda986278 in read_debug_info /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jitreader.c:71
    #3 0x5650ef8ef56b in jit_reader_try_read_symtab /home/simark/src/binutils-gdb/gdb/jit.c:850
    #4 0x5650ef8effe3 in jit_register_code /home/simark/src/binutils-gdb/gdb/jit.c:948
    #5 0x5650ef8f2c92 in jit_event_handler(gdbarch*) /home/simark/src/binutils-gdb/gdb/jit.c:1396
    #6 0x5650ef0d137e in handle_jit_event /home/simark/src/binutils-gdb/gdb/breakpoint.c:5470
    [snip]

0x604000042eb8 is located 40 bytes inside of 48-byte region [0x604000042e90,0x604000042ec0)
freed by thread T0 here:
    #0 0x7fbbe57376b0 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:122
    #1 0x5650ef8f350b in xfree<gdb_block> /home/simark/src/binutils-gdb/gdb/gdbsupport/common-utils.h:62
    #2 0x5650ef8eeca9 in finalize_symtab /home/simark/src/binutils-gdb/gdb/jit.c:769
    #3 0x5650ef8eef88 in jit_object_close_impl /home/simark/src/binutils-gdb/gdb/jit.c:797
    #4 0x7fbbda986278 in read_debug_info /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jitreader.c:71
    #5 0x5650ef8ef56b in jit_reader_try_read_symtab /home/simark/src/binutils-gdb/gdb/jit.c:850
    #6 0x5650ef8effe3 in jit_register_code /home/simark/src/binutils-gdb/gdb/jit.c:948
    #7 0x5650ef8f2c92 in jit_event_handler(gdbarch*) /home/simark/src/binutils-gdb/gdb/jit.c:1396
    #8 0x5650ef0d137e in handle_jit_event /home/simark/src/binutils-gdb/gdb/breakpoint.c:5470
    [snip]

previously allocated by thread T0 here:
    #0 0x7fbbe5737cd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
    #1 0x5650eef662f3 in xcalloc /home/simark/src/binutils-gdb/gdb/alloc.c:100
    #2 0x5650ef8f34ea in xcnew<gdb_block> /home/simark/src/binutils-gdb/gdb/gdbsupport/poison.h:122
    #3 0x5650ef8ed467 in jit_block_open_impl /home/simark/src/binutils-gdb/gdb/jit.c:557
    #4 0x7fbbda98620a in read_debug_info /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/jitreader.c:60
    #5 0x5650ef8ef56b in jit_reader_try_read_symtab /home/simark/src/binutils-gdb/gdb/jit.c:850
    #6 0x5650ef8effe3 in jit_register_code /home/simark/src/binutils-gdb/gdb/jit.c:948
    #7 0x5650ef8f2c92 in jit_event_handler(gdbarch*) /home/simark/src/binutils-gdb/gdb/jit.c:1396
    #8 0x5650ef0d137e in handle_jit_event /home/simark/src/binutils-gdb/gdb/breakpoint.c:5470
    [snip]

gdb/ChangeLog:

	* jit.c (finalize_symtab): Set gdb_block_iter_tmp in loop.

gdb/testsuite/ChangeLog:

	* gdb.base/jit-reader.exp (jit_reader_test): Rename
	jit_function_00 to jit_function_stack_mangle.
	* gdb.base/jithost.c (jit_function_t): Rename to...
	(jit_function_stack_mangle_t): ... this.
	(jit_function_add_t): New typedef.
	(jit_function_00_code): Rename to...
	(jit_function_stack_mangle_code): ... this, make static.
	(jit_function_add_code): New.
	(main): Generate "add" function and call it.  Adjust to changes
	in jithost_abi.
	* gdb.base/jithost.h (struct jithost_abi_bounds): New.
	(struct jithost_abi) <begin, end>: Remove fields.
	<object, function_stack_mangle, function_add>: New fields.
	* gdb.base/jitreader.c (struct reader_state) <code_begin,
	code_end>: Remove fields.
	<func_stack_mangle>: New field.
	(read_debug_info): Adjust to renaming, create block for "add"
	function.
	(read_sp, unwind_frame, get_frame_id): Adjust to other changes.
2019-12-17 14:18:02 -05:00
GDB Administrator 1bc50c51fd Automatic date update in version.in 2019-12-17 00:01:00 +00:00
GDB Administrator b6778b5b30 Automatic date update in version.in 2019-12-16 00:01:08 +00:00
Christian Biesinger 59e99adeed Update documentation for the default value of main set worker-threads
I forgot to update this documentation when I changed the default for
maint set worker-threads to be 0. This is a branch-only change, because
on trunk this has been changed back to unlimited.

gdb/doc/ChangeLog:

2019-12-15  Christian Biesinger  <cbiesinger@google.com>

	* gdb.texinfo (Maintenance Commands): Update documentation for
	maint set worker-threads to say the default is 0.

Change-Id: I75b74c5da599e657ee94daa8c88b5a097bc58d15
2019-12-15 14:34:36 -05:00
GDB Administrator 8bad7749dc Automatic date update in version.in 2019-12-15 00:01:31 +00:00
Andrew Burgess b547b1310d gdb/doc: Remove duplicate description of lookup_global_symbol
In this commit:

  commit 086baaf134
  Date:   Tue Oct 15 16:18:26 2019 +0100

      gdb/python: Introduce gdb.lookup_static_symbols

A duplicate description of gdb.lookup_global_symbol was accidentally
added.  This commit corrects this mistake and removes the duplicate.

gdb/doc/ChangeLog:

	* python.texi (Symbols In Python): Remove duplicate description of
	gdb.lookup_global_symbol.

Change-Id: I4457b42cf05bde39e5c0ff39f168af919cad1255
2019-12-14 23:28:10 +00:00
GDB Administrator 17a03c954d Automatic date update in version.in 2019-12-14 00:01:00 +00:00
GDB Administrator 5d4b673fc6 Automatic date update in version.in 2019-12-13 00:01:02 +00:00
GDB Administrator 25d38fd3d5 Automatic date update in version.in 2019-12-12 00:00:55 +00:00
Joel Brobecker 3f43467191 Bump GDB version number to 9.0.90.DATE-git.
gdb/ChangeLog:

	* version.in: Set GDB version number to 9.0.90.DATE-git.
2019-12-11 22:42:19 +01:00
Joel Brobecker 07d5aa38fd Document the GDB 9.0.90 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 9.0.90 released.
2019-12-11 22:42:13 +01:00
Joel Brobecker b06b54862e Set GDB version number to 9.0.90.
gdb/ChangeLog:

	* version.in: Set GDB version number to 9.0.90.
2019-12-11 21:56:24 +01:00
Joel Brobecker 41ec388bf2 gdb/NEWS: Say "Changes in GDB 9" rather than "Changes since GDB 8.3"
gdb/ChangeLog:

 	* NEWS: Change "Changes since GDB 8.3" into "Changes in GDB 9".
2019-12-11 21:51:26 +01:00
Joel Brobecker 1c47c133d2 Set development mode to "off" by default.
bfd/ChangeLog:

	* development.sh (development): Set to false.
2019-12-11 21:37:55 +01:00
Joel Brobecker c87abc5019 Bump version to 9.0.90.DATE-git.
Now that the GDB 9 branch has been created, we can
bump the version number.

gdb/ChangeLog:

	GDB 9 branch created (27f7b2f640):
	* version.in: Bump version to 9.0.90.DATE-git.
2019-12-11 21:37:08 +01:00
11022 changed files with 2327073 additions and 515737 deletions

3
.gitignore vendored
View File

@ -41,9 +41,6 @@ TAGS.sub
.gdbinit
.gdb_history
perf.data
perf.data.old
# ignore core files, but not java/net/protocol/core/
core
!core/

157
ChangeLog
View File

@ -1,153 +1,16 @@
2020-07-04 Nick Clifton <nickc@redhat.com>
2020-02-01 Sergio Durigan Junior <sergiodj@redhat.com>
Binutils 2.35 branch created.
* configure.ac: Don't abort the build if trying to build GDB in tree
_and_ invoking with '--enable-src-release-build'.
* configure: Regenerate.
* src-release.sh (do_proto_toplev): Invoke 'configure' using
'--enable-src-release-build'.
2020-04-21 Stephen Casner <casner@acm.org>
2020-01-17 Joel Brobecker <brobecker@adacore.com>
PR 25830
* configure.ac (noconfigdirs): Exclude gdb & gprof for pdp11.
* configure: Rebuild.
2020-03-12 Tom Tromey <tom@tromey.com>
* Makefile.in: Rebuild.
* Makefile.def (gdbserver): Depend on gdbsupport.
2020-03-12 Tom Tromey <tom@tromey.com>
* Makefile.in: Rebuild.
* Makefile.def (gdbsupport): Don't depend on bfd.
2020-03-12 Tom Tromey <tom@tromey.com>
* Makefile.in: Rebuild.
* Makefile.def (gdbsupport): Depend on intl.
2020-02-17 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac (configdirs): Add gnulib and gdbsupport when building
gdbserver.
2020-02-14 Tom Tromey <tom@tromey.com>
* Makefile.in: Rebuild.
* Makefile.def: Make gdbserver require gnulib and libiberty.
2020-02-07 Tom Tromey <tom@tromey.com>
Pedro Alves <palves@redhat.com>
* src-release.sh (GDB_SUPPORT_DIRS): Add gdbserver.
* gdbserver: New directory, moved from gdb/gdbserver.
* configure.ac (host_tools): Add gdbserver.
Only build gdbserver on certain systems.
* Makefile.in, configure: Rebuild.
* Makefile.def (host_modules, dependencies): Add gdbserver.
* MAINTAINERS: Add gdbserver.
2020-01-28 Sergio Durigan Junior <sergiodj@redhat.com>
* src-release.sh (getver): Look for gdbsupport's
create-version.sh script at the current directory if tool is
"gdb".
2020-01-19 Simon Marchi <simon.marchi@polymtl.ca>
* remote-sim.c (gdbsim_target::wait): Return
sim_data->remote_sim_ptid instead of inferior_ptid.
2020-01-18 Nick Clifton <nickc@redhat.com>
Binutils 2.34 branch created.
2020-01-18 Nick Clifton <nickc@redhat.com>
Synchronize top level configure files with master version:
2020-01-01 Ben Elliston <bje@gnu.org>
* config.guess: Update copyright years.
* config.sub: Likewise.
2019-12-21 Ben Elliston <bje@gnu.org>
* config.guess (set_cc_for_build): Prevent multiple calls by
checking if $tmp is already set. We can't check CC_FOR_BUILD as
the user may set it externally. Thanks to Torbjörn Granlund for
the bug report.
2019-12-21 Torbjörn Granlund <tg@gmplib.org>
* config.guess (alpha:Linux:*:*): Guard against missing
/proc/cpuinfo by redirecting standard error to /dev/null.
2019-09-12 Daniel Bittman <danielbittman1@gmail.com>
* config.guess (*:Twizzler:*:*): New.
* config.sub (-twizzler*): New.
2019-07-24 Ben Elliston <bje@gnu.org>
* config.guess (mips:OSF1:*.*): Whitespace cleanup.
2019-06-30 Ben Elliston <bje@gnu.org>
* config.sub (case $os): Match nsk* and powerunix. Don't later
match nsk* and set os=nsk which removes the OS version number.
2019-06-30 Ben Elliston <bje@gnu.org>
* config.sub: Recognise os108*.
2019-06-26 Ben Elliston <bje@gnu.org>
* config.sub (hp300): Set $os to hpux.
2019-06-26 Ben Elliston <bje@gnu.org>
* config.sub (vsta): Move into alphabetical order.
2019-06-10 Ben Elliston <bje@gnu.org>
* config.guess (*:OS108:*:*): Recognise new OS.
2019-05-28 Ben Elliston <bje@gnu.org>
* config.guess (*:Darwin:*:*): Run xcode-select to determine if a
system compiler is installed. If not, do not run set_cc_for_build,
as the default cc will open a dialog box asking to install
Xcode. If no C compiler is available, guess based on uname -p and
uname -m.
2019-05-28 Ben Elliston <bje@gnu.org>
* config.guess (*:Darwin:*:*): Simplify UNAME_PROCESSOR.
2020-01-17 Simon Marchi <simon.marchi@efficios.com>
* Makefile.def: Add dependencies of all-gdbsupport on all-bfd.
* Makefile.in: Re-generate.
2020-01-14 Tom Tromey <tom@tromey.com>
* src-release.sh (GDB_SUPPORT_DIRS): Add gdbsupport.
* MAINTAINERS: Add gdbsupport.
* configure: Rebuild.
* configure.ac (configdirs): Add gdbsupport.
* gdbsupport: New directory, move from gdb/gdbsupport.
* Makefile.def (host_modules, dependencies): Add gnulib.
* Makefile.in: Rebuild.
2020-01-09 Aaron Merey <amerey@redhat.com>
* config/debuginfod.m4: New file. Add macro AC_DEBUGINFOD. Adds
new configure option --with-debuginfod.
* configure: Regenerate.
* configure.ac: Call AC_DEBUGINFOD.
2019-12-26 Christian Biesinger <cbiesinger@google.com>
* .gitignore: Add perf.data and perf.data.old.
* configure.ac: Abort the build with an error if trying to build
GDB in tree.
* configure: Regenerate.
2019-10-17 Sergio Durigan Junior <sergiodj@redhat.com>

View File

@ -41,7 +41,7 @@ config.guess; config.sub; readline/support/config.{sub,guess}
depcomp; mkinstalldirs
Send bug reports and patches to bug-automake@gnu.org.
gdb/; gdbserver/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
gdb/; gnulib/; readline/; sim/; GDB's part of include/
GDB: http://www.gnu.org/software/gdb/
Patches to gdb-patches@sourceware.org.
See also gdb/MAINTAINERS and sim/MAINTAINERS.

View File

@ -113,8 +113,6 @@ host_modules= { module= zlib; no_install=true; no_check=true;
bootstrap=true;
extra_configure_flags='@extra_host_zlib_configure_flags@';};
host_modules= { module= gnulib; };
host_modules= { module= gdbsupport; };
host_modules= { module= gdbserver; };
host_modules= { module= gdb; };
host_modules= { module= expect; };
host_modules= { module= guile; };
@ -394,14 +392,12 @@ dependencies = { module=configure-gdb; on=all-intl; };
dependencies = { module=configure-gdb; on=configure-sim; };
dependencies = { module=configure-gdb; on=all-bfd; };
dependencies = { module=configure-gdb; on=all-gnulib; };
dependencies = { module=configure-gdb; on=all-gdbsupport; };
// Depend on all-libiconv so that configure checks for iconv
// functions will work.
dependencies = { module=configure-gdb; on=all-libiconv; };
dependencies = { module=all-gdb; on=all-libiberty; };
dependencies = { module=all-gdb; on=all-libiconv; };
dependencies = { module=all-gdb; on=all-gnulib; };
dependencies = { module=all-gdb; on=all-gdbsupport; };
dependencies = { module=all-gdb; on=all-opcodes; };
dependencies = { module=all-gdb; on=all-readline; };
dependencies = { module=all-gdb; on=all-build-bison; };
@ -410,23 +406,12 @@ dependencies = { module=all-gdb; on=all-libdecnumber; };
dependencies = { module=all-gdb; on=all-libtermcap; };
dependencies = { module=all-gdb; on=all-libctf; };
// Host modules specific to gdbserver.
dependencies = { module=configure-gdbserver; on=all-gnulib; };
dependencies = { module=all-gdbserver; on=all-gdbsupport; };
dependencies = { module=all-gdbserver; on=all-gnulib; };
dependencies = { module=all-gdbserver; on=all-libiberty; };
dependencies = { module=configure-libgui; on=configure-tcl; };
dependencies = { module=configure-libgui; on=configure-tk; };
dependencies = { module=all-libgui; on=all-tcl; };
dependencies = { module=all-libgui; on=all-tk; };
dependencies = { module=all-libgui; on=all-itcl; };
dependencies = { module=configure-gdbsupport; on=configure-gnulib; };
dependencies = { module=configure-gdbsupport; on=configure-intl; };
dependencies = { module=all-gdbsupport; on=all-gnulib; };
dependencies = { module=all-gdbsupport; on=all-intl; };
// Host modules specific to binutils.
dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; };
dependencies = { module=configure-bfd; on=configure-intl; };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
See ../binutils/MAINTAINERS
Copyright (C) 2012-2020 Free Software Foundation, Inc.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright

View File

@ -1,6 +1,6 @@
## Process this file with automake to generate Makefile.in
#
# Copyright (C) 2012-2020 Free Software Foundation, Inc.
# Copyright (C) 2012-2019 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -145,6 +145,7 @@ ALL_MACHINES = \
cpu-or1k.lo \
cpu-pdp11.lo \
cpu-pj.lo \
cpu-plugin.lo \
cpu-powerpc.lo \
cpu-pru.lo \
cpu-rs6000.lo \
@ -160,6 +161,7 @@ ALL_MACHINES = \
cpu-tic4x.lo \
cpu-tic54x.lo \
cpu-tic6x.lo \
cpu-tic80.lo \
cpu-tilegx.lo \
cpu-tilepro.lo \
cpu-v850.lo \
@ -230,6 +232,7 @@ ALL_MACHINES_CFILES = \
cpu-or1k.c \
cpu-pdp11.c \
cpu-pj.c \
cpu-plugin.c \
cpu-powerpc.c \
cpu-pru.c \
cpu-rs6000.c \
@ -245,6 +248,7 @@ ALL_MACHINES_CFILES = \
cpu-tic4x.c \
cpu-tic54x.c \
cpu-tic6x.c \
cpu-tic80.c \
cpu-tilegx.c \
cpu-tilepro.c \
cpu-v850.c \
@ -264,6 +268,7 @@ ALL_MACHINES_CFILES = \
BFD32_BACKENDS = \
aout-cris.lo \
aout-ns32k.lo \
aout-tic30.lo \
aout32.lo \
cf-i386lynx.lo \
coff-go32.lo \
@ -275,6 +280,7 @@ BFD32_BACKENDS = \
coff-tic30.lo \
coff-tic4x.lo \
coff-tic54x.lo \
coff-tic80.lo \
coff-z80.lo \
coff-z8k.lo \
coffgen.lo \
@ -306,7 +312,6 @@ BFD32_BACKENDS = \
elf32-dlx.lo \
elf32-e2k.lo \
elf32-e2k-pm.lo \
elf32-e2k-pm-uclibc.lo \
elf32-epiphany.lo \
elf32-fr30.lo \
elf32-frv.lo \
@ -356,12 +361,9 @@ BFD32_BACKENDS = \
elf32-xgate.lo \
elf32-xstormy16.lo \
elf32-xtensa.lo \
elf32-z80.lo \
elf32.lo \
elflink.lo \
elfxx-e2k.lo \
elfxx-e2k-pm.lo \
elfxx-e2k-uclibc.lo \
elfxx-sparc.lo \
elfxx-tilegx.lo \
i386aout.lo \
@ -405,6 +407,7 @@ BFD32_BACKENDS = \
BFD32_BACKENDS_CFILES = \
aout-cris.c \
aout-ns32k.c \
aout-tic30.c \
aout32.c \
cf-i386lynx.c \
coff-go32.c \
@ -416,6 +419,7 @@ BFD32_BACKENDS_CFILES = \
coff-tic30.c \
coff-tic4x.c \
coff-tic54x.c \
coff-tic80.c \
coff-z80.c \
coff-z8k.c \
coffgen.c \
@ -447,7 +451,6 @@ BFD32_BACKENDS_CFILES = \
elf32-dlx.c \
elf32-e2k.c \
elf32-e2k-pm.c \
elf32-e2k-pm-uclibc.c \
elf32-epiphany.c \
elf32-fr30.c \
elf32-frv.c \
@ -497,12 +500,9 @@ BFD32_BACKENDS_CFILES = \
elf32-xgate.c \
elf32-xstormy16.c \
elf32-xtensa.c \
elf32-z80.c \
elf32.c \
elflink.c \
elfxx-e2k.c \
elfxx-e2k-pm.c \
elfxx-e2k-uclibc.c \
elfxx-sparc.c \
elfxx-tilegx.c \
i386aout.c \
@ -562,9 +562,6 @@ BFD64_BACKENDS = \
elf32-score7.lo \
elf64-alpha.lo \
elf64-e2k.lo \
elf64-e2k-kpda.lo \
elf64-e2k-pm.lo \
elf64-e2k-uclibc.lo \
elf64-gen.lo \
elf64-hppa.lo \
elf64-ia64.lo \
@ -607,9 +604,6 @@ BFD64_BACKENDS_CFILES = \
elf32-score7.c \
elf64-alpha.c \
elf64-e2k.c \
elf64-e2k-kpda.c \
elf64-e2k-pm.c \
elf64-e2k-uclibc.c \
elf64-gen.c \
elf64-hppa.c \
elf64-ia64-vms.c \
@ -847,46 +841,63 @@ endif
endif
elf32-target.h : elfxx-target.h
$(SED) -e s/NN/32/g < $< > $@
rm -f elf32-target.h
$(SED) -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new
mv -f elf32-target.new elf32-target.h
elf64-target.h : elfxx-target.h
$(SED) -e s/NN/64/g < $< > $@
rm -f elf64-target.h
$(SED) -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
mv -f elf64-target.new elf64-target.h
elf32-aarch64.c : elfnn-aarch64.c
echo "#line 1 \"elfnn-aarch64.c\"" > $@
$(SED) -e s/NN/32/g < $< >> $@
rm -f elf32-aarch64.c
echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf32-aarch64.new
$(SED) -e s/NN/32/g < $(srcdir)/elfnn-aarch64.c >> elf32-aarch64.new
mv -f elf32-aarch64.new elf32-aarch64.c
elf64-aarch64.c : elfnn-aarch64.c
echo "#line 1 \"elfnn-aarch64.c\"" > $@
$(SED) -e s/NN/64/g < $< >> $@
rm -f elf64-aarch64.c
echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf64-aarch64.new
$(SED) -e s/NN/64/g < $(srcdir)/elfnn-aarch64.c >> elf64-aarch64.new
mv -f elf64-aarch64.new elf64-aarch64.c
elf32-ia64.c : elfnn-ia64.c
echo "#line 1 \"elfnn-ia64.c\"" > $@
$(SED) -e s/NN/32/g < $< >> $@
rm -f elf32-ia64.c
$(SED) -e s/NN/32/g < $(srcdir)/elfnn-ia64.c > elf32-ia64.new
mv -f elf32-ia64.new elf32-ia64.c
elf64-ia64.c : elfnn-ia64.c
echo "#line 1 \"elfnn-ia64.c\"" > $@
$(SED) -e s/NN/64/g < $< >> $@
rm -f elf64-ia64.c
$(SED) -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
mv -f elf64-ia64.new elf64-ia64.c
elf32-riscv.c : elfnn-riscv.c
echo "#line 1 \"elfnn-riscv.c\"" > $@
$(SED) -e s/NN/32/g < $< >> $@
rm -f elf32-riscv.c
echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf32-riscv.new
sed -e s/NN/32/g < $(srcdir)/elfnn-riscv.c >> elf32-riscv.new
mv -f elf32-riscv.new elf32-riscv.c
elf64-riscv.c : elfnn-riscv.c
echo "#line 1 \"elfnn-riscv.c\"" > $@
$(SED) -e s/NN/64/g < $< >> $@
rm -f elf64-riscv.c
echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf64-riscv.new
sed -e s/NN/64/g < $(srcdir)/elfnn-riscv.c >> elf64-riscv.new
mv -f elf64-riscv.new elf64-riscv.c
peigen.c : peXXigen.c
echo "#line 1 \"peXXigen.c\"" > $@
$(SED) -e s/XX/pe/g < $< >> $@
rm -f peigen.c
$(SED) -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
mv -f peigen.new peigen.c
pepigen.c : peXXigen.c
echo "#line 1 \"peXXigen.c\"" > $@
$(SED) -e s/XX/pep/g < $< >> $@
rm -f pepigen.c
$(SED) -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
mv -f pepigen.new pepigen.c
pex64igen.c: peXXigen.c
echo "#line 1 \"peXXigen.c\"" > $@
$(SED) -e s/XX/pex64/g < $< >> $@
rm -f pex64igen.c
$(SED) -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new
mv -f pex64igen.new pex64igen.c
BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/diagnostics.h
LOCAL_H_DEPS= libbfd.h sysdep.h config.h bfd_stdint.h
@ -968,7 +979,7 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
bfd_version_string="\"$(VERSION)-25.014\"" ;\
bfd_version_string="\"$(VERSION)\"" ;\
bfd_soversion="$(VERSION)" ;\
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\

View File

@ -15,7 +15,7 @@
@SET_MAKE@
#
# Copyright (C) 2012-2020 Free Software Foundation, Inc.
# Copyright (C) 2012-2019 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -569,6 +569,7 @@ ALL_MACHINES = \
cpu-or1k.lo \
cpu-pdp11.lo \
cpu-pj.lo \
cpu-plugin.lo \
cpu-powerpc.lo \
cpu-pru.lo \
cpu-rs6000.lo \
@ -584,6 +585,7 @@ ALL_MACHINES = \
cpu-tic4x.lo \
cpu-tic54x.lo \
cpu-tic6x.lo \
cpu-tic80.lo \
cpu-tilegx.lo \
cpu-tilepro.lo \
cpu-v850.lo \
@ -654,6 +656,7 @@ ALL_MACHINES_CFILES = \
cpu-or1k.c \
cpu-pdp11.c \
cpu-pj.c \
cpu-plugin.c \
cpu-powerpc.c \
cpu-pru.c \
cpu-rs6000.c \
@ -669,6 +672,7 @@ ALL_MACHINES_CFILES = \
cpu-tic4x.c \
cpu-tic54x.c \
cpu-tic6x.c \
cpu-tic80.c \
cpu-tilegx.c \
cpu-tilepro.c \
cpu-v850.c \
@ -689,6 +693,7 @@ ALL_MACHINES_CFILES = \
BFD32_BACKENDS = \
aout-cris.lo \
aout-ns32k.lo \
aout-tic30.lo \
aout32.lo \
cf-i386lynx.lo \
coff-go32.lo \
@ -700,6 +705,7 @@ BFD32_BACKENDS = \
coff-tic30.lo \
coff-tic4x.lo \
coff-tic54x.lo \
coff-tic80.lo \
coff-z80.lo \
coff-z8k.lo \
coffgen.lo \
@ -731,7 +737,6 @@ BFD32_BACKENDS = \
elf32-dlx.lo \
elf32-e2k.lo \
elf32-e2k-pm.lo \
elf32-e2k-pm-uclibc.lo \
elf32-epiphany.lo \
elf32-fr30.lo \
elf32-frv.lo \
@ -781,12 +786,9 @@ BFD32_BACKENDS = \
elf32-xgate.lo \
elf32-xstormy16.lo \
elf32-xtensa.lo \
elf32-z80.lo \
elf32.lo \
elflink.lo \
elfxx-e2k.lo \
elfxx-e2k-pm.lo \
elfxx-e2k-uclibc.lo \
elfxx-sparc.lo \
elfxx-tilegx.lo \
i386aout.lo \
@ -830,6 +832,7 @@ BFD32_BACKENDS = \
BFD32_BACKENDS_CFILES = \
aout-cris.c \
aout-ns32k.c \
aout-tic30.c \
aout32.c \
cf-i386lynx.c \
coff-go32.c \
@ -841,6 +844,7 @@ BFD32_BACKENDS_CFILES = \
coff-tic30.c \
coff-tic4x.c \
coff-tic54x.c \
coff-tic80.c \
coff-z80.c \
coff-z8k.c \
coffgen.c \
@ -872,7 +876,6 @@ BFD32_BACKENDS_CFILES = \
elf32-dlx.c \
elf32-e2k.c \
elf32-e2k-pm.c \
elf32-e2k-pm-uclibc.c \
elf32-epiphany.c \
elf32-fr30.c \
elf32-frv.c \
@ -922,12 +925,9 @@ BFD32_BACKENDS_CFILES = \
elf32-xgate.c \
elf32-xstormy16.c \
elf32-xtensa.c \
elf32-z80.c \
elf32.c \
elflink.c \
elfxx-e2k.c \
elfxx-e2k-pm.c \
elfxx-e2k-uclibc.c \
elfxx-sparc.c \
elfxx-tilegx.c \
i386aout.c \
@ -988,9 +988,6 @@ BFD64_BACKENDS = \
elf32-score7.lo \
elf64-alpha.lo \
elf64-e2k.lo \
elf64-e2k-kpda.lo \
elf64-e2k-pm.lo \
elf64-e2k-uclibc.lo \
elf64-gen.lo \
elf64-hppa.lo \
elf64-ia64.lo \
@ -1033,9 +1030,6 @@ BFD64_BACKENDS_CFILES = \
elf32-score7.c \
elf64-alpha.c \
elf64-e2k.c \
elf64-e2k-kpda.c \
elf64-e2k-pm.c \
elf64-e2k-uclibc.c \
elf64-gen.c \
elf64-hppa.c \
elf64-ia64-vms.c \
@ -1315,6 +1309,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aix5ppc-core.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout-cris.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout-ns32k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout-tic30.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aout64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/archive.Plo@am__quote@
@ -1338,6 +1333,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-tic30.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-tic4x.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-tic54x.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-tic80.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-x86_64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-z80.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coff-z8k.Plo@am__quote@
@ -1400,6 +1396,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-or1k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-pdp11.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-pj.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-plugin.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-powerpc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-pru.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-riscv.Plo@am__quote@
@ -1416,6 +1413,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-tic4x.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-tic54x.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-tic6x.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-tic80.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-tilegx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-tilepro.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-v850.Plo@am__quote@
@ -1457,7 +1455,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-d10v.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-d30v.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-dlx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-e2k-pm-uclibc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-e2k-pm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-e2k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-epiphany.Plo@am__quote@
@ -1513,14 +1510,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-xgate.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-xstormy16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-xtensa.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-z80.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-aarch64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-alpha.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-bpf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-e2k-kpda.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-e2k-pm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-e2k-uclibc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-e2k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-gen.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-hppa.Plo@am__quote@
@ -1539,8 +1532,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elflink.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfn32-mips.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-aarch64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-e2k-pm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-e2k-uclibc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-e2k.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-ia64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-mips.Plo@am__quote@
@ -1990,46 +1981,63 @@ dwarf2.lo: dwarf2.c Makefile
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
elf32-target.h : elfxx-target.h
$(SED) -e s/NN/32/g < $< > $@
rm -f elf32-target.h
$(SED) -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new
mv -f elf32-target.new elf32-target.h
elf64-target.h : elfxx-target.h
$(SED) -e s/NN/64/g < $< > $@
rm -f elf64-target.h
$(SED) -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
mv -f elf64-target.new elf64-target.h
elf32-aarch64.c : elfnn-aarch64.c
echo "#line 1 \"elfnn-aarch64.c\"" > $@
$(SED) -e s/NN/32/g < $< >> $@
rm -f elf32-aarch64.c
echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf32-aarch64.new
$(SED) -e s/NN/32/g < $(srcdir)/elfnn-aarch64.c >> elf32-aarch64.new
mv -f elf32-aarch64.new elf32-aarch64.c
elf64-aarch64.c : elfnn-aarch64.c
echo "#line 1 \"elfnn-aarch64.c\"" > $@
$(SED) -e s/NN/64/g < $< >> $@
rm -f elf64-aarch64.c
echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf64-aarch64.new
$(SED) -e s/NN/64/g < $(srcdir)/elfnn-aarch64.c >> elf64-aarch64.new
mv -f elf64-aarch64.new elf64-aarch64.c
elf32-ia64.c : elfnn-ia64.c
echo "#line 1 \"elfnn-ia64.c\"" > $@
$(SED) -e s/NN/32/g < $< >> $@
rm -f elf32-ia64.c
$(SED) -e s/NN/32/g < $(srcdir)/elfnn-ia64.c > elf32-ia64.new
mv -f elf32-ia64.new elf32-ia64.c
elf64-ia64.c : elfnn-ia64.c
echo "#line 1 \"elfnn-ia64.c\"" > $@
$(SED) -e s/NN/64/g < $< >> $@
rm -f elf64-ia64.c
$(SED) -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
mv -f elf64-ia64.new elf64-ia64.c
elf32-riscv.c : elfnn-riscv.c
echo "#line 1 \"elfnn-riscv.c\"" > $@
$(SED) -e s/NN/32/g < $< >> $@
rm -f elf32-riscv.c
echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf32-riscv.new
sed -e s/NN/32/g < $(srcdir)/elfnn-riscv.c >> elf32-riscv.new
mv -f elf32-riscv.new elf32-riscv.c
elf64-riscv.c : elfnn-riscv.c
echo "#line 1 \"elfnn-riscv.c\"" > $@
$(SED) -e s/NN/64/g < $< >> $@
rm -f elf64-riscv.c
echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf64-riscv.new
sed -e s/NN/64/g < $(srcdir)/elfnn-riscv.c >> elf64-riscv.new
mv -f elf64-riscv.new elf64-riscv.c
peigen.c : peXXigen.c
echo "#line 1 \"peXXigen.c\"" > $@
$(SED) -e s/XX/pe/g < $< >> $@
rm -f peigen.c
$(SED) -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
mv -f peigen.new peigen.c
pepigen.c : peXXigen.c
echo "#line 1 \"peXXigen.c\"" > $@
$(SED) -e s/XX/pep/g < $< >> $@
rm -f pepigen.c
$(SED) -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
mv -f pepigen.new pepigen.c
pex64igen.c: peXXigen.c
echo "#line 1 \"peXXigen.c\"" > $@
$(SED) -e s/XX/pex64/g < $< >> $@
rm -f pex64igen.c
$(SED) -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new
mv -f pex64igen.new pex64igen.c
$(BFD32_LIBS) \
$(BFD64_LIBS) \
$(ALL_MACHINES) \
@ -2092,7 +2100,7 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES)
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
bfd_version_string="\"$(VERSION)-25.014\"" ;\
bfd_version_string="\"$(VERSION)\"" ;\
bfd_soversion="$(VERSION)" ;\
bfd_version_package="\"$(PKGVERSION)\"" ;\
report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\

View File

@ -82,7 +82,7 @@ TARGETNAME
The name of the target, for run-time lookups.
Usually "a.out-<target>"
Copyright (C) 2012-2020 Free Software Foundation, Inc.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright

View File

@ -48,7 +48,7 @@ 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.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright

View File

@ -20,7 +20,7 @@ Things that still need to be done: -*- Text -*-
o - upgrade the reloc handling as per Steve's suggestion.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright

View File

@ -1,5 +1,5 @@
dnl
dnl Copyright (C) 2012-2020 Free Software Foundation, Inc.
dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
dnl
dnl This file is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/* BFD back-end for AIX on PS/2 core files.
This was based on trad-core.c, which was written by John Gilmore of
Cygnus Support.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
@ -65,13 +65,13 @@ struct trad_core_struct
asection *sections[MAX_CORE_SEGS];
};
static bfd_cleanup
static const bfd_target *
aix386_core_file_p (bfd *abfd)
{
int i, n;
unsigned char longbuf[4]; /* Raw bytes of various header fields */
bfd_size_type core_size = sizeof (struct corehdr);
size_t amt;
bfd_size_type amt;
struct corehdr *core;
struct mergem
{
@ -189,7 +189,7 @@ aix386_core_file_p (bfd *abfd)
n++;
}
return _bfd_no_cleanup;
return abfd->xvec;
}
static char *

View File

@ -1,5 +1,5 @@
/* IBM RS/6000 "XCOFF" back-end for BFD.
Copyright (C) 2001-2020 Free Software Foundation, Inc.
Copyright (C) 2001-2019 Free Software Foundation, Inc.
Written by Tom Rix
Contributed by Red Hat Inc.
@ -23,7 +23,7 @@
#include "sysdep.h"
#include "bfd.h"
bfd_cleanup xcoff64_core_p (bfd *);
const bfd_target *xcoff64_core_p (bfd *);
bfd_boolean xcoff64_core_file_matches_executable_p (bfd *, bfd *);
char *xcoff64_core_file_failing_command (bfd *);
int xcoff64_core_file_failing_signal (bfd *);
@ -48,7 +48,7 @@ int xcoff64_core_file_failing_signal (bfd *);
#define CHECK_FILE_OFFSET(s, v) \
((bfd_signed_vma)(v) < 0 || (bfd_signed_vma)(v) > (bfd_signed_vma)(s).st_size)
bfd_cleanup
const bfd_target *
xcoff64_core_p (bfd *abfd)
{
enum bfd_architecture arch;
@ -60,6 +60,7 @@ xcoff64_core_p (bfd *abfd)
bfd_vma ld_offset;
bfd_size_type i;
struct vm_infox vminfo;
const bfd_target *return_value = NULL;
flagword flags;
/* Get the header. */
@ -108,12 +109,12 @@ xcoff64_core_p (bfd *abfd)
{
bfd_set_error (bfd_error_file_truncated);
return NULL;
return return_value;
}
new_core_hdr = bfd_zalloc (abfd, sizeof (struct core_dumpxx));
if (NULL == new_core_hdr)
return NULL;
return return_value;
memcpy (new_core_hdr, &core, sizeof (struct core_dumpxx));
/* The core_hdr() macro is no longer used here because it would
@ -125,7 +126,7 @@ xcoff64_core_p (bfd *abfd)
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".stack", flags);
if (NULL == sec)
return NULL;
return return_value;
sec->size = core.c_size;
sec->vma = core.c_stackorg;
@ -135,7 +136,7 @@ xcoff64_core_p (bfd *abfd)
flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
sec = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
if (NULL == sec)
return NULL;
return return_value;
sec->size = sizeof (struct __context64);
sec->vma = 0;
@ -149,7 +150,7 @@ xcoff64_core_p (bfd *abfd)
flags = SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".ldinfo", flags);
if (NULL == sec)
return NULL;
return return_value;
sec->size = core.c_lsize;
sec->vma = 0;
@ -163,7 +164,7 @@ xcoff64_core_p (bfd *abfd)
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
return NULL;
return return_value;
sec->size = core.c_datasize;
sec->vma = core.c_dataorg;
@ -175,18 +176,18 @@ xcoff64_core_p (bfd *abfd)
while (1)
{
if (bfd_seek (abfd, ld_offset, SEEK_SET) != 0)
return NULL;
return return_value;
if (sizeof (struct __ld_info64) !=
bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd))
return NULL;
return return_value;
if (ldinfo.ldinfo_core)
{
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
return NULL;
return return_value;
sec->size = ldinfo.ldinfo_datasize;
sec->vma = ldinfo.ldinfo_dataorg;
@ -202,19 +203,19 @@ xcoff64_core_p (bfd *abfd)
if (core.c_vmregions)
{
if (bfd_seek (abfd, core.c_vmm, SEEK_SET) != 0)
return NULL;
return return_value;
for (i = 0; i < core.c_vmregions; i++)
if (sizeof (struct vm_infox) !=
bfd_bread (&vminfo, sizeof (struct vm_infox), abfd))
return NULL;
return return_value;
if (vminfo.vminfo_offset)
{
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".vmdata", flags);
if (NULL == sec)
return NULL;
return return_value;
sec->size = vminfo.vminfo_size;
sec->vma = vminfo.vminfo_addr;
@ -227,13 +228,13 @@ xcoff64_core_p (bfd *abfd)
mach = DEFAULT_MACHINE;
bfd_default_set_arch_mach (abfd, arch, mach);
return _bfd_no_cleanup;
return_value = (bfd_target *) abfd->xvec; /* This is garbage for now. */
xcoff64_core_p_error:
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return NULL;
return return_value;
}
/* Return `TRUE' if given core is from the given executable. */
@ -288,11 +289,11 @@ xcoff64_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
}
str1 = strrchr (path, '/');
str2 = strrchr (bfd_get_filename (exec_bfd), '/');
str2 = strrchr (exec_bfd->filename, '/');
/* Step over character '/'. */
str1 = str1 != NULL ? str1 + 1 : path;
str2 = str2 != NULL ? str2 + 1 : bfd_get_filename (exec_bfd);
str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename;
if (strcmp (str1, str2) == 0)
return_value = TRUE;
@ -328,7 +329,7 @@ xcoff64_core_file_failing_signal (bfd *abfd)
#else /* AIX_5_CORE */
bfd_cleanup
const bfd_target *
xcoff64_core_p (bfd *abfd ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_wrong_format);

View File

@ -1,5 +1,5 @@
/* BFD backend for CRIS a.out binaries.
Copyright (C) 2000-2020 Free Software Foundation, Inc.
Copyright (C) 2000-2019 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson.
@ -56,6 +56,9 @@
#define TARGET_PAGE_SIZE SEGMENT_SIZE
#define TARGETNAME "a.out-cris"
/* The definition here seems not used; just provided as a convention. */
#define DEFAULT_ARCH bfd_arch_cris
/* Do not "beautify" the CONCAT* macro args. Traditional C will not
remove whitespace added here, and thus will fail to concatenate
the tokens. */
@ -89,8 +92,9 @@ static bfd_boolean MY (set_sizes) (bfd *);
through SET_ARCH_MACH. The default bfd_default_set_arch_mach will
not call set_sizes. */
#define MY_set_arch_mach NAME (aout, set_arch_mach)
#define SET_ARCH_MACH(BFD, EXECP) \
bfd_set_arch_mach (BFD, bfd_arch_cris, N_MACHTYPE (EXECP))
MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXECP))
/* These macros describe the binary layout of the reloc information we
use in a file. */
@ -227,14 +231,12 @@ MY (swap_ext_reloc_in) (bfd *abfd,
cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
/* Now the fun stuff. */
r_index = (((unsigned int) bytes->r_index[2] << 16)
| ((unsigned int) bytes->r_index[1] << 8)
| bytes->r_index[0]);
r_index = (bytes->r_index[2] << 16)
| (bytes->r_index[1] << 8)
| bytes->r_index[0];
r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
>> RELOC_EXT_BITS_TYPE_SH_LITTLE);
r_type = ((bytes->r_type[0]) >> RELOC_EXT_BITS_TYPE_SH_LITTLE)
& RELOC_EXT_BITS_TYPE_LITTLE;
if (r_type > 2)
{

View File

@ -1,5 +1,5 @@
/* BFD back-end for ns32k a.out-ish binaries.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Contributed by Ian Dall (idall@eleceng.adelaide.edu.au).
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* Define a target vector and some small routines for a variant of a.out.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -34,7 +34,7 @@ extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *);
This routine is called from some_aout_object_p just before it returns. */
#ifndef MY_callback
static bfd_cleanup
static const bfd_target *
MY (callback) (bfd *abfd)
{
struct internal_exec *execp = exec_hdr (abfd);
@ -121,20 +121,20 @@ MY (callback) (bfd *abfd)
/* Don't set sizes now -- can't be sure until we know arch & mach.
Sizes get set in set_sizes callback, later. */
return _bfd_no_cleanup;
return abfd->xvec;
}
#endif
#ifndef MY_object_p
/* Finish up the reading of an a.out file header. */
static bfd_cleanup
static const bfd_target *
MY (object_p) (bfd *abfd)
{
struct external_exec exec_bytes; /* Raw exec header from file. */
struct internal_exec exec; /* Cleaned-up exec header. */
bfd_cleanup cleanup;
size_t amt = EXEC_BYTES_SIZE;
const bfd_target *target;
bfd_size_type amt = EXEC_BYTES_SIZE;
if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
{
@ -164,7 +164,7 @@ MY (object_p) (bfd *abfd)
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#endif
cleanup = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
target = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
#ifdef ENTRY_CAN_BE_ZERO
/* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
@ -180,13 +180,12 @@ MY (object_p) (bfd *abfd)
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
#endif
if (stat (bfd_get_filename (abfd), &buf) == 0
&& (buf.st_mode & S_IXUSR) != 0)
if (stat (abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
abfd->flags |= EXEC_P;
}
#endif /* ENTRY_CAN_BE_ZERO */
return cleanup;
return target;
}
#define MY_object_p MY (object_p)
#endif

1173
bfd/aout-tic30.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* BFD back-end for 32-bit a.out files.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD back-end for 64-bit a.out files.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -21,4 +21,12 @@
#define ARCH_SIZE 64
/* aoutx.h requires definitions for BMAGIC and QMAGIC. */
#ifndef BMAGIC
#define BMAGIC 0
#endif
#ifndef QMAGIC
#define QMAGIC 0
#endif
#include "aoutx.h"

View File

@ -1,5 +1,5 @@
/* BFD semi-generic back-end for a.out binaries.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -128,18 +128,6 @@ DESCRIPTION
#include "aout/stab_gnu.h"
#include "aout/ar.h"
#ifdef BMAGIC
#define N_IS_BMAGIC(x) (N_MAGIC (x) == BMAGIC)
#else
#define N_IS_BMAGIC(x) (0)
#endif
#ifdef QMAGIC
#define N_SET_QMAGIC(x) N_SET_MAGIC (x, QMAGIC)
#else
#define N_SET_QMAGIC(x) do { /**/ } while (0)
#endif
/*
SUBSECTION
Relocations
@ -464,14 +452,14 @@ DESCRIPTION
handle any last-minute setup.
*/
bfd_cleanup
const bfd_target *
NAME (aout, some_aout_object_p) (bfd *abfd,
struct internal_exec *execp,
bfd_cleanup (*callback_to_real_object_p) (bfd *))
const bfd_target *(*callback_to_real_object_p) (bfd *))
{
struct aout_data_struct *rawptr, *oldrawptr;
bfd_cleanup result;
size_t amt = sizeof (* rawptr);
const bfd_target *result;
bfd_size_type amt = sizeof (* rawptr);
rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
if (rawptr == NULL)
@ -504,7 +492,7 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
abfd->flags |= D_PAGED | WP_TEXT;
adata (abfd).magic = z_magic;
}
else if (N_IS_QMAGIC (execp))
else if (N_MAGIC (execp) == QMAGIC)
{
abfd->flags |= D_PAGED | WP_TEXT;
adata (abfd).magic = z_magic;
@ -515,7 +503,8 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
abfd->flags |= WP_TEXT;
adata (abfd).magic = n_magic;
}
else if (N_MAGIC (execp) == OMAGIC || N_IS_BMAGIC (execp))
else if (N_MAGIC (execp) == OMAGIC
|| N_MAGIC (execp) == BMAGIC)
adata (abfd).magic = o_magic;
else
/* Should have been checked with N_BADMAG before this routine
@ -602,7 +591,7 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
adata (abfd)->segment_size = SEGMENT_SIZE;
adata (abfd)->exec_bytes_size = EXEC_BYTES_SIZE;
return _bfd_no_cleanup
return abfd->xvec;
/* The architecture is encoded in various ways in various a.out variants,
or is not encoded at all in some of them. The relocation size depends
@ -682,7 +671,7 @@ bfd_boolean
NAME (aout, mkobject) (bfd *abfd)
{
struct aout_data_struct *rawptr;
size_t amt = sizeof (* rawptr);
bfd_size_type amt = sizeof (* rawptr);
bfd_set_error (bfd_error_system_call);
@ -902,56 +891,57 @@ adjust_o_magic (bfd *abfd, struct internal_exec *execp)
file_ptr pos = adata (abfd).exec_bytes_size;
bfd_vma vma = 0;
int pad = 0;
asection *text = obj_textsec (abfd);
asection *data = obj_datasec (abfd);
asection *bss = obj_bsssec (abfd);
/* Text. */
text->filepos = pos;
if (!text->user_set_vma)
text->vma = vma;
obj_textsec (abfd)->filepos = pos;
if (!obj_textsec (abfd)->user_set_vma)
obj_textsec (abfd)->vma = vma;
else
vma = text->vma;
vma = obj_textsec (abfd)->vma;
pos += execp->a_text;
vma += execp->a_text;
pos += obj_textsec (abfd)->size;
vma += obj_textsec (abfd)->size;
/* Data. */
if (!data->user_set_vma)
if (!obj_datasec (abfd)->user_set_vma)
{
obj_textsec (abfd)->size += pad;
pos += pad;
vma += pad;
data->vma = vma;
obj_datasec (abfd)->vma = vma;
}
else
vma = data->vma;
execp->a_text += pad;
data->filepos = pos;
pos += data->size;
vma += data->size;
vma = obj_datasec (abfd)->vma;
obj_datasec (abfd)->filepos = pos;
pos += obj_datasec (abfd)->size;
vma += obj_datasec (abfd)->size;
/* BSS. */
if (!bss->user_set_vma)
if (!obj_bsssec (abfd)->user_set_vma)
{
obj_datasec (abfd)->size += pad;
pos += pad;
vma += pad;
bss->vma = vma;
obj_bsssec (abfd)->vma = vma;
}
else
{
/* The VMA of the .bss section is set by the VMA of the
.data section plus the size of the .data section. We may
need to add padding bytes to make this true. */
pad = bss->vma - vma;
if (pad < 0)
pad = 0;
pos += pad;
pad = obj_bsssec (abfd)->vma - vma;
if (pad > 0)
{
obj_datasec (abfd)->size += pad;
pos += pad;
}
}
execp->a_data = data->size + pad;
bss->filepos = pos;
execp->a_bss = bss->size;
obj_bsssec (abfd)->filepos = pos;
/* Fix up the exec header. */
execp->a_text = obj_textsec (abfd)->size;
execp->a_data = obj_datasec (abfd)->size;
execp->a_bss = obj_bsssec (abfd)->size;
N_SET_MAGIC (execp, OMAGIC);
}
@ -963,9 +953,6 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp)
const struct aout_backend_data *abdp;
/* TRUE if text includes exec header. */
bfd_boolean ztih;
asection *text = obj_textsec (abfd);
asection *data = obj_datasec (abfd);
asection *bss = obj_bsssec (abfd);
abdp = aout_backend_info (abfd);
@ -973,17 +960,18 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp)
ztih = (abdp != NULL
&& (abdp->text_includes_header
|| obj_aout_subformat (abfd) == q_magic_format));
text->filepos = (ztih
? adata (abfd).exec_bytes_size
: adata (abfd).zmagic_disk_block_size);
if (!text->user_set_vma)
obj_textsec (abfd)->filepos = (ztih
? adata (abfd).exec_bytes_size
: adata (abfd).zmagic_disk_block_size);
if (! obj_textsec (abfd)->user_set_vma)
{
/* ?? Do we really need to check for relocs here? */
text->vma = ((abfd->flags & HAS_RELOC)
? 0
: (ztih
? abdp->default_text_vma + adata (abfd).exec_bytes_size
: abdp->default_text_vma));
obj_textsec (abfd)->vma = ((abfd->flags & HAS_RELOC)
? 0
: (ztih
? (abdp->default_text_vma
+ adata (abfd).exec_bytes_size)
: abdp->default_text_vma));
text_pad = 0;
}
else
@ -992,17 +980,17 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp)
may need to pad it such that the .data section starts at a page
boundary. */
if (ztih)
text_pad = ((text->filepos - text->vma)
text_pad = ((obj_textsec (abfd)->filepos - obj_textsec (abfd)->vma)
& (adata (abfd).page_size - 1));
else
text_pad = (-text->vma
text_pad = ((- obj_textsec (abfd)->vma)
& (adata (abfd).page_size - 1));
}
/* Find start of data. */
if (ztih)
{
text_end = text->filepos + execp->a_text;
text_end = obj_textsec (abfd)->filepos + obj_textsec (abfd)->size;
text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end;
}
else
@ -1010,45 +998,55 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp)
/* Note that if page_size == zmagic_disk_block_size, then
filepos == page_size, and this case is the same as the ztih
case. */
text_end = execp->a_text;
text_end = obj_textsec (abfd)->size;
text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end;
text_end += text->filepos;
text_end += obj_textsec (abfd)->filepos;
}
execp->a_text += text_pad;
obj_textsec (abfd)->size += text_pad;
text_end += text_pad;
/* Data. */
if (!data->user_set_vma)
if (!obj_datasec (abfd)->user_set_vma)
{
bfd_vma vma;
vma = text->vma + execp->a_text;
data->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
vma = obj_textsec (abfd)->vma + obj_textsec (abfd)->size;
obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
}
if (abdp && abdp->zmagic_mapped_contiguous)
{
text_pad = data->vma - (text->vma + execp->a_text);
asection * text = obj_textsec (abfd);
asection * data = obj_datasec (abfd);
text_pad = data->vma - (text->vma + text->size);
/* Only pad the text section if the data
section is going to be placed after it. */
if (text_pad > 0)
execp->a_text += text_pad;
text->size += text_pad;
}
data->filepos = text->filepos + execp->a_text;
obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos
+ obj_textsec (abfd)->size);
/* Fix up exec header while we're at it. */
execp->a_text = obj_textsec (abfd)->size;
if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
execp->a_text += adata (abfd).exec_bytes_size;
if (obj_aout_subformat (abfd) == q_magic_format)
N_SET_QMAGIC (execp);
N_SET_MAGIC (execp, QMAGIC);
else
N_SET_MAGIC (execp, ZMAGIC);
/* Spec says data section should be rounded up to page boundary. */
execp->a_data = align_power (data->size, bss->alignment_power);
execp->a_data = BFD_ALIGN (execp->a_data, adata (abfd).page_size);
data_pad = execp->a_data - data->size;
obj_datasec (abfd)->size
= align_power (obj_datasec (abfd)->size,
obj_bsssec (abfd)->alignment_power);
execp->a_data = BFD_ALIGN (obj_datasec (abfd)->size,
adata (abfd).page_size);
data_pad = execp->a_data - obj_datasec (abfd)->size;
/* BSS. */
if (!bss->user_set_vma)
bss->vma = data->vma + execp->a_data;
if (!obj_bsssec (abfd)->user_set_vma)
obj_bsssec (abfd)->vma = (obj_datasec (abfd)->vma
+ obj_datasec (abfd)->size);
/* If the BSS immediately follows the data section and extra space
in the page is left after the data section, fudge data
in the header so that the bss section looks smaller by that
@ -1056,10 +1054,12 @@ adjust_z_magic (bfd *abfd, struct internal_exec *execp)
(Note that a linker script, as well as the above assignment,
could have explicitly set the BSS vma to immediately follow
the data section.) */
if (align_power (bss->vma, bss->alignment_power) == data->vma + execp->a_data)
execp->a_bss = data_pad > bss->size ? 0 : bss->size - data_pad;
if (align_power (obj_bsssec (abfd)->vma, obj_bsssec (abfd)->alignment_power)
== obj_datasec (abfd)->vma + obj_datasec (abfd)->size)
execp->a_bss = (data_pad > obj_bsssec (abfd)->size
? 0 : obj_bsssec (abfd)->size - data_pad);
else
execp->a_bss = bss->size;
execp->a_bss = obj_bsssec (abfd)->size;
}
static void
@ -1068,39 +1068,38 @@ adjust_n_magic (bfd *abfd, struct internal_exec *execp)
file_ptr pos = adata (abfd).exec_bytes_size;
bfd_vma vma = 0;
int pad;
asection *text = obj_textsec (abfd);
asection *data = obj_datasec (abfd);
asection *bss = obj_bsssec (abfd);
/* Text. */
text->filepos = pos;
if (!text->user_set_vma)
text->vma = vma;
obj_textsec (abfd)->filepos = pos;
if (!obj_textsec (abfd)->user_set_vma)
obj_textsec (abfd)->vma = vma;
else
vma = text->vma;
pos += execp->a_text;
vma += execp->a_text;
vma = obj_textsec (abfd)->vma;
pos += obj_textsec (abfd)->size;
vma += obj_textsec (abfd)->size;
/* Data. */
data->filepos = pos;
if (!data->user_set_vma)
data->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
vma = data->vma;
obj_datasec (abfd)->filepos = pos;
if (!obj_datasec (abfd)->user_set_vma)
obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);
vma = obj_datasec (abfd)->vma;
/* Since BSS follows data immediately, see if it needs alignment. */
vma += data->size;
pad = align_power (vma, bss->alignment_power) - vma;
execp->a_data = data->size + pad;
pos += execp->a_data;
vma += obj_datasec (abfd)->size;
pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;
obj_datasec (abfd)->size += pad;
pos += obj_datasec (abfd)->size;
/* BSS. */
if (!bss->user_set_vma)
bss->vma = vma;
if (!obj_bsssec (abfd)->user_set_vma)
obj_bsssec (abfd)->vma = vma;
else
vma = bss->vma;
vma = obj_bsssec (abfd)->vma;
/* Fix up exec header. */
execp->a_bss = bss->size;
execp->a_text = obj_textsec (abfd)->size;
execp->a_data = obj_datasec (abfd)->size;
execp->a_bss = obj_bsssec (abfd)->size;
N_SET_MAGIC (execp, NMAGIC);
}
@ -1115,8 +1114,9 @@ NAME (aout, adjust_sizes_and_vmas) (bfd *abfd)
if (adata (abfd).magic != undecided_magic)
return TRUE;
execp->a_text = align_power (obj_textsec (abfd)->size,
obj_textsec (abfd)->alignment_power);
obj_textsec (abfd)->size =
align_power (obj_textsec (abfd)->size,
obj_textsec (abfd)->alignment_power);
/* Rule (heuristic) for when to pad to a new page. Note that there
are (at least) two ways demand-paged (ZMAGIC) files have been
@ -1181,11 +1181,11 @@ NAME (aout, adjust_sizes_and_vmas) (bfd *abfd)
#ifdef BFD_AOUT_DEBUG
fprintf (stderr, " text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x>\n",
obj_textsec (abfd)->vma, execp->a_text,
obj_textsec (abfd)->vma, obj_textsec (abfd)->size,
obj_textsec (abfd)->filepos,
obj_datasec (abfd)->vma, execp->a_data,
obj_datasec (abfd)->vma, obj_datasec (abfd)->size,
obj_datasec (abfd)->filepos,
obj_bsssec (abfd)->vma, execp->a_bss);
obj_bsssec (abfd)->vma, obj_bsssec (abfd)->size);
#endif
return TRUE;
@ -1303,11 +1303,16 @@ aout_get_external_symbols (bfd *abfd)
/* 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 = (struct external_nlist *) _bfd_malloc_and_read (abfd, amt, amt);
syms = (struct external_nlist *) bfd_malloc (amt);
if (syms == NULL)
return FALSE;
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
|| bfd_bread (syms, amt, abfd) != amt)
{
free (syms);
return FALSE;
}
#endif
obj_aout_external_syms (abfd) = syms;
@ -1670,7 +1675,7 @@ translate_to_native_sym_flags (bfd *abfd,
asymbol *
NAME (aout, make_empty_symbol) (bfd *abfd)
{
size_t amt = sizeof (aout_symbol_type);
bfd_size_type amt = sizeof (aout_symbol_type);
aout_symbol_type *new_symbol = (aout_symbol_type *) bfd_zalloc (abfd, amt);
if (!new_symbol)
@ -1680,7 +1685,7 @@ NAME (aout, make_empty_symbol) (bfd *abfd)
return &new_symbol->symbol;
}
/* Translate a set of external symbols into internal symbols. */
/* Translate a set of internal symbols into external symbols. */
bfd_boolean
NAME (aout, translate_symbol_table) (bfd *abfd,
@ -1847,7 +1852,7 @@ static bfd_boolean
emit_stringtab (bfd *abfd, struct bfd_strtab_hash *tab)
{
bfd_byte buffer[BYTES_IN_WORD];
size_t amt = BYTES_IN_WORD;
bfd_size_type amt = BYTES_IN_WORD;
/* The string table starts with the size. */
PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer);
@ -1873,7 +1878,7 @@ NAME (aout, write_syms) (bfd *abfd)
asymbol *g = generic[count];
bfd_size_type indx;
struct external_nlist nsp;
size_t amt;
bfd_size_type amt;
indx = add_to_stringtab (abfd, strtab, g->name, FALSE);
if (indx == (bfd_size_type) -1)
@ -1912,7 +1917,7 @@ NAME (aout, write_syms) (bfd *abfd)
return TRUE;
error_return:
error_return:
_bfd_stringtab_free (strtab);
return FALSE;
}
@ -1956,24 +1961,7 @@ NAME (aout, swap_std_reloc_out) (bfd *abfd,
PUT_WORD (abfd, g->address, natptr->r_address);
BFD_ASSERT (g->howto != NULL);
switch (bfd_get_reloc_size (g->howto))
{
default:
_bfd_error_handler (_("%pB: unsupported AOUT relocation size: %d"),
abfd, bfd_get_reloc_size (g->howto));
bfd_set_error (bfd_error_bad_value);
return;
case 1:
case 2:
case 4:
r_length = g->howto->size; /* Size as a power of two. */
break;
case 8:
r_length = 3;
break;
}
r_length = g->howto->size ; /* Size as a power of two. */
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
/* XXX This relies on relocs coming from a.out files. */
r_baserel = (g->howto->type & 8) != 0;
@ -2328,22 +2316,34 @@ NAME (aout, slurp_reloc_table) (bfd *abfd, sec_ptr asect, asymbol **symbols)
return FALSE;
}
each_size = obj_reloc_entry_size (abfd);
count = reloc_size / each_size;
if (count == 0)
if (reloc_size == 0)
return TRUE; /* Nothing to be done. */
if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
return FALSE;
relocs = _bfd_malloc_and_read (abfd, reloc_size, reloc_size);
if (relocs == NULL)
return FALSE;
each_size = obj_reloc_entry_size (abfd);
count = reloc_size / each_size;
if (count == 0)
return TRUE; /* Nothing to be done. */
amt = count * sizeof (arelent);
reloc_cache = (arelent *) bfd_zmalloc (amt);
if (reloc_cache == NULL)
return FALSE;
relocs = bfd_malloc (reloc_size);
if (relocs == NULL)
{
free (reloc_cache);
return FALSE;
}
if (bfd_bread (relocs, reloc_size, abfd) != reloc_size)
{
free (relocs);
free (reloc_cache);
return FALSE;
}
@ -2409,8 +2409,8 @@ NAME (aout, squirt_out_relocs) (bfd *abfd, asection *section)
|| (*generic)->sym_ptr_ptr == NULL)
{
bfd_set_error (bfd_error_invalid_operation);
_bfd_error_handler (_("%pB: attempt to write out "
"unknown reloc type"), abfd);
_bfd_error_handler (_("\
%pB: attempt to write out unknown reloc type"), abfd);
return FALSE;
}
MY_swap_ext_reloc_out (abfd, *generic,
@ -2427,8 +2427,8 @@ NAME (aout, squirt_out_relocs) (bfd *abfd, asection *section)
|| (*generic)->sym_ptr_ptr == NULL)
{
bfd_set_error (bfd_error_invalid_operation);
_bfd_error_handler (_("%pB: attempt to write out "
"unknown reloc type"), abfd);
_bfd_error_handler (_("\
%pB: attempt to write out unknown reloc type"), abfd);
return FALSE;
}
MY_swap_std_reloc_out (abfd, *generic,
@ -2697,7 +2697,7 @@ NAME (aout, find_nearest_line) (bfd *abfd,
bfd_size_type filelen, funclen;
char *buf;
*filename_ptr = bfd_get_filename (abfd);
*filename_ptr = abfd->filename;
*functionname_ptr = NULL;
*line_ptr = 0;
if (disriminator_ptr)
@ -2827,7 +2827,8 @@ NAME (aout, find_nearest_line) (bfd *abfd,
else
funclen = strlen (bfd_asymbol_name (func));
free (adata (abfd).line_buf);
if (adata (abfd).line_buf != NULL)
free (adata (abfd).line_buf);
if (filelen + funclen == 0)
adata (abfd).line_buf = buf = NULL;
@ -2909,7 +2910,7 @@ NAME (aout, bfd_free_cached_info) (bfd *abfd)
|| abfd->tdata.aout_data == NULL)
return TRUE;
#define BFCI_FREE(x) do { free (x); x = NULL; } while (0)
#define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; }
BFCI_FREE (obj_aout_symbols (abfd));
#ifdef USE_MMAP
obj_aout_external_syms (abfd) = 0;
@ -2979,7 +2980,7 @@ struct bfd_link_hash_table *
NAME (aout, link_hash_table_create) (bfd *abfd)
{
struct aout_link_hash_table *ret;
size_t amt = sizeof (* ret);
bfd_size_type amt = sizeof (* ret);
ret = (struct aout_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
@ -3633,7 +3634,7 @@ aout_link_write_other_symbol (struct bfd_hash_entry *bh, void *data)
bfd_vma val;
struct external_nlist outsym;
bfd_size_type indx;
size_t amt;
bfd_size_type amt;
if (h->root.type == bfd_link_hash_warning)
{
@ -3758,7 +3759,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
struct reloc_std_external srel;
struct reloc_ext_external erel;
void * rel_ptr;
size_t amt;
bfd_size_type amt;
pr = p->u.reloc.p;
@ -3830,16 +3831,13 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
int r_baserel;
int r_jmptable;
int r_relative;
unsigned int r_length;
int r_length;
r_pcrel = (int) howto->pc_relative;
r_baserel = (howto->type & 8) != 0;
r_jmptable = (howto->type & 16) != 0;
r_relative = (howto->type & 32) != 0;
if (bfd_get_reloc_size (howto) != 8)
r_length = howto->size; /* Size as a power of two. */
else
r_length = 3;
r_length = howto->size;
PUT_WORD (flaginfo->output_bfd, p->offset, srel.r_address);
if (bfd_header_big_endian (flaginfo->output_bfd))
@ -4856,8 +4854,7 @@ aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd)
discarding such symbols. */
if (strip != strip_all
&& (strip != strip_some
|| bfd_hash_lookup (flaginfo->info->keep_hash,
bfd_get_filename (input_bfd),
|| bfd_hash_lookup (flaginfo->info->keep_hash, input_bfd->filename,
FALSE, FALSE) != NULL)
&& discard != discard_all)
{
@ -4865,7 +4862,7 @@ aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd)
H_PUT_8 (output_bfd, 0, outsym->e_other);
H_PUT_16 (output_bfd, 0, outsym->e_desc);
strtab_index = add_to_stringtab (output_bfd, flaginfo->strtab,
bfd_get_filename (input_bfd), FALSE);
input_bfd->filename, FALSE);
if (strtab_index == (bfd_size_type) -1)
return FALSE;
PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
@ -5627,15 +5624,26 @@ NAME (aout, final_link) (bfd *abfd,
}
}
free (aout_info.contents);
aout_info.contents = NULL;
free (aout_info.relocs);
aout_info.relocs = NULL;
free (aout_info.symbol_map);
aout_info.symbol_map = NULL;
free (aout_info.output_syms);
aout_info.output_syms = NULL;
if (aout_info.contents != NULL)
{
free (aout_info.contents);
aout_info.contents = NULL;
}
if (aout_info.relocs != NULL)
{
free (aout_info.relocs);
aout_info.relocs = NULL;
}
if (aout_info.symbol_map != NULL)
{
free (aout_info.symbol_map);
aout_info.symbol_map = NULL;
}
if (aout_info.output_syms != NULL)
{
free (aout_info.output_syms);
aout_info.output_syms = NULL;
}
if (includes_hash_initialized)
{
bfd_hash_table_free (&aout_info.includes.root);
@ -5678,10 +5686,14 @@ NAME (aout, final_link) (bfd *abfd,
return TRUE;
error_return:
free (aout_info.contents);
free (aout_info.relocs);
free (aout_info.symbol_map);
free (aout_info.output_syms);
if (aout_info.contents != NULL)
free (aout_info.contents);
if (aout_info.relocs != NULL)
free (aout_info.relocs);
if (aout_info.symbol_map != NULL)
free (aout_info.symbol_map);
if (aout_info.output_syms != NULL)
free (aout_info.output_syms);
if (includes_hash_initialized)
bfd_hash_table_free (&aout_info.includes.root);
return FALSE;

View File

@ -1,5 +1,5 @@
/* ARC-specific support for 32-bit ELF
Copyright (C) 1994-2020 Free Software Foundation, Inc.
Copyright (C) 1994-2019 Free Software Foundation, Inc.
Contributed by Cupertino Miranda (cmiranda@synopsys.com).
This file is part of BFD, the Binary File Descriptor library.
@ -296,7 +296,7 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
if (h != NULL)
{
/* TODO: This should not be here. */
// TODO: This should not be here.
reloc_data->sym_value = h->root.u.def.value;
reloc_data->sym_section = h->root.u.def.section;

View File

@ -1,5 +1,5 @@
/* Arc V2 Related PLT entries.
Copyright (C) 2016-2020 Free Software Foundation, Inc.
Copyright (C) 2016-2019 Free Software Foundation, Inc.
Contributed by Cupertino Miranda (cmiranda@synopsys.com).
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* ARC-specific header file for PLT support.
Copyright (C) 2016-2020 Free Software Foundation, Inc.
Copyright (C) 2016-2019 Free Software Foundation, Inc.
Contributed by Cupertino Miranda (cmiranda@synopsys.com).
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD back-end for archive files (libraries).
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
This file is part of BFD, the Binary File Descriptor library.
@ -212,7 +212,7 @@ _bfd_ar_sizepad (char *p, size_t n, bfd_size_type size)
bfd_boolean
_bfd_generic_mkarchive (bfd *abfd)
{
size_t amt = sizeof (struct artdata);
bfd_size_type amt = sizeof (struct artdata);
abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == NULL)
@ -403,7 +403,7 @@ find_nested_archive (const char *filename, bfd *arch_bfd)
bfd *abfd;
/* PR 15140: Don't allow a nested archive pointing to itself. */
if (filename_cmp (filename, bfd_get_filename (arch_bfd)) == 0)
if (filename_cmp (filename, arch_bfd->filename) == 0)
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
@ -413,7 +413,7 @@ find_nested_archive (const char *filename, bfd *arch_bfd)
abfd != NULL;
abfd = abfd->archive_next)
{
if (filename_cmp (filename, bfd_get_filename (abfd)) == 0)
if (filename_cmp (filename, abfd->filename) == 0)
return abfd;
}
abfd = open_nested_file (filename, arch_bfd);
@ -488,7 +488,6 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
bfd_size_type parsed_size;
struct areltdata *ared;
char *filename = NULL;
ufile_ptr filesize;
bfd_size_type namelen = 0;
bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
char *allocptr = 0;
@ -539,19 +538,11 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
{
/* BSD-4.4 extended name */
namelen = atoi (&hdr.ar_name[3]);
filesize = bfd_get_file_size (abfd);
if (namelen > parsed_size
|| namelen > -allocsize - 2
|| (filesize != 0 && namelen > filesize))
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
}
allocsize += namelen + 1;
parsed_size -= namelen;
extra_size = namelen;
allocptr = (char *) bfd_malloc (allocsize);
allocptr = (char *) bfd_zmalloc (allocsize);
if (allocptr == NULL)
return NULL;
filename = (allocptr
@ -595,13 +586,13 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
if (!allocptr)
{
allocptr = (char *) bfd_malloc (allocsize);
allocptr = (char *) bfd_zmalloc (allocsize);
if (allocptr == NULL)
return NULL;
}
memset (allocptr, 0, sizeof (struct areltdata));
ared = (struct areltdata *) allocptr;
ared->arch_header = allocptr + sizeof (struct areltdata);
memcpy (ared->arch_header, &hdr, sizeof (struct ar_hdr));
ared->parsed_size = parsed_size;
@ -628,7 +619,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
char *
_bfd_append_relative_path (bfd *arch, char *elt_name)
{
const char *arch_name = bfd_get_filename (arch);
const char *arch_name = arch->filename;
const char *base_name = lbasename (arch_name);
size_t prefix_len;
char *filename;
@ -737,7 +728,8 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
else
{
n_bfd->origin = n_bfd->proxy_origin;
if (!bfd_set_filename (n_bfd, filename))
n_bfd->filename = bfd_strdup (filename);
if (n_bfd->filename == NULL)
goto out;
}
@ -850,12 +842,12 @@ _bfd_noarchive_openr_next_archived_file (bfd *archive,
return (bfd *) _bfd_ptr_bfd_null_error (archive);
}
bfd_cleanup
const bfd_target *
bfd_generic_archive_p (bfd *abfd)
{
struct artdata *tdata_hold;
char armag[SARMAG + 1];
size_t amt;
bfd_size_type amt;
if (bfd_bread (armag, SARMAG, abfd) != SARMAG)
{
@ -932,7 +924,7 @@ bfd_generic_archive_p (bfd *abfd)
}
}
return _bfd_no_cleanup;
return abfd->xvec;
}
/* Some constants for a 32 bit BSD archive structure. We do not
@ -959,12 +951,11 @@ static bfd_boolean
do_slurp_bsd_armap (bfd *abfd)
{
struct areltdata *mapdata;
size_t counter;
unsigned int counter;
bfd_byte *raw_armap, *rbase;
struct artdata *ardata = bfd_ardata (abfd);
char *stringbase;
bfd_size_type parsed_size;
size_t amt, string_size;
bfd_size_type parsed_size, amt;
carsym *set;
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
@ -974,51 +965,45 @@ do_slurp_bsd_armap (bfd *abfd)
free (mapdata);
/* PR 17512: file: 883ff754. */
/* PR 17512: file: 0458885f. */
if (parsed_size < BSD_SYMDEF_COUNT_SIZE + BSD_STRING_COUNT_SIZE)
{
bfd_set_error (bfd_error_malformed_archive);
return FALSE;
}
if (parsed_size < 4)
return FALSE;
raw_armap = (bfd_byte *) _bfd_alloc_and_read (abfd, parsed_size, parsed_size);
raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
if (raw_armap == NULL)
return FALSE;
parsed_size -= BSD_SYMDEF_COUNT_SIZE + BSD_STRING_COUNT_SIZE;
amt = H_GET_32 (abfd, raw_armap);
if (amt > parsed_size
|| amt % BSD_SYMDEF_SIZE != 0)
if (bfd_bread (raw_armap, parsed_size, abfd) != parsed_size)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
byebye:
bfd_release (abfd, raw_armap);
return FALSE;
}
ardata->symdef_count = H_GET_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE;
if (ardata->symdef_count * BSD_SYMDEF_SIZE >
parsed_size - BSD_SYMDEF_COUNT_SIZE)
{
/* Probably we're using the wrong byte ordering. */
bfd_set_error (bfd_error_wrong_format);
goto release_armap;
goto byebye;
}
rbase = raw_armap + BSD_SYMDEF_COUNT_SIZE;
stringbase = (char *) rbase + amt + BSD_STRING_COUNT_SIZE;
string_size = parsed_size - amt;
ardata->symdef_count = amt / BSD_SYMDEF_SIZE;
if (_bfd_mul_overflow (ardata->symdef_count, sizeof (carsym), &amt))
{
bfd_set_error (bfd_error_no_memory);
goto release_armap;
}
stringbase = ((char *) rbase
+ ardata->symdef_count * BSD_SYMDEF_SIZE
+ BSD_STRING_COUNT_SIZE);
amt = ardata->symdef_count * sizeof (carsym);
ardata->symdefs = (struct carsym *) bfd_alloc (abfd, amt);
if (!ardata->symdefs)
goto release_armap;
return FALSE;
for (counter = 0, set = ardata->symdefs;
counter < ardata->symdef_count;
counter++, set++, rbase += BSD_SYMDEF_SIZE)
{
unsigned nameoff = H_GET_32 (abfd, rbase);
if (nameoff >= string_size)
{
bfd_set_error (bfd_error_malformed_archive);
goto release_armap;
}
set->name = stringbase + nameoff;
set->name = H_GET_32 (abfd, rbase) + stringbase;
set->file_offset = H_GET_32 (abfd, rbase + BSD_SYMDEF_OFFSET_SIZE);
}
@ -1030,12 +1015,6 @@ do_slurp_bsd_armap (bfd *abfd)
to be allocated on an objalloc anyway... */
abfd->has_armap = TRUE;
return TRUE;
release_armap:
ardata->symdef_count = 0;
ardata->symdefs = NULL;
bfd_release (abfd, raw_armap);
return FALSE;
}
/* Read a COFF archive symbol table. Returns FALSE on error, TRUE
@ -1051,12 +1030,12 @@ do_slurp_coff_armap (bfd *abfd)
char *stringend;
bfd_size_type stringsize;
bfd_size_type parsed_size;
ufile_ptr filesize;
size_t nsymz, carsym_size, ptrsize, i;
carsym *carsyms;
bfd_size_type nsymz; /* Number of symbols in armap. */
bfd_vma (*swap) (const void *);
char int_buf[4];
struct areltdata *tmp;
char int_buf[sizeof (long)];
bfd_size_type carsym_size, ptrsize;
unsigned int i;
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
@ -1065,54 +1044,47 @@ do_slurp_coff_armap (bfd *abfd)
free (mapdata);
if (bfd_bread (int_buf, 4, abfd) != 4)
return FALSE;
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
return FALSE;
}
/* It seems that all numeric information in a coff archive is always
in big endian format, no matter the host or target. */
in big endian format, nomatter the host or target. */
swap = bfd_getb32;
nsymz = bfd_getb32 (int_buf);
stringsize = parsed_size - (4 * nsymz) - 4;
/* The coff armap must be read sequentially. So we construct a
bsd-style one in core all at once, for simplicity. */
if (_bfd_mul_overflow (nsymz, sizeof (carsym), &carsym_size))
{
bfd_set_error (bfd_error_no_memory);
return FALSE;
}
filesize = bfd_get_file_size (abfd);
ptrsize = 4 * nsymz;
if ((filesize != 0 && parsed_size > filesize)
|| parsed_size < 4
|| parsed_size - 4 < ptrsize)
{
bfd_set_error (bfd_error_malformed_archive);
return FALSE;
}
stringsize = parsed_size - ptrsize - 4;
if (carsym_size + stringsize + 1 <= carsym_size)
{
bfd_set_error (bfd_error_no_memory);
return FALSE;
}
/* Allocate and read in the raw offsets. */
raw_armap = (int *) _bfd_malloc_and_read (abfd, ptrsize, ptrsize);
if (raw_armap == NULL)
if (nsymz > ~ (bfd_size_type) 0 / sizeof (carsym))
return FALSE;
ardata->symdefs = (struct carsym *) bfd_alloc (abfd,
carsym_size + stringsize + 1);
carsym_size = (nsymz * sizeof (carsym));
ptrsize = (4 * nsymz);
if (carsym_size + stringsize + 1 <= carsym_size)
return FALSE;
ardata->symdefs = (struct carsym *) bfd_zalloc (abfd,
carsym_size + stringsize + 1);
if (ardata->symdefs == NULL)
goto free_armap;
return FALSE;
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
if (bfd_bread (stringbase, stringsize, abfd) != stringsize)
/* Allocate and read in the raw offsets. */
raw_armap = (int *) bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize
|| (bfd_bread (stringbase, stringsize, abfd) != stringsize))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
goto release_raw_armap;
}
/* OK, build the carsyms. */
stringend = stringbase + stringsize;
@ -1132,29 +1104,34 @@ do_slurp_coff_armap (bfd *abfd)
ardata->first_file_filepos = bfd_tell (abfd);
/* Pad to an even boundary if you have to. */
ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
if (bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET) != 0)
goto release_symdefs;
abfd->has_armap = TRUE;
free (raw_armap);
bfd_release (abfd, raw_armap);
/* Check for a second archive header (as used by PE). */
tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (tmp != NULL)
{
if (tmp->arch_header[0] == '/'
&& tmp->arch_header[1] == ' ')
ardata->first_file_filepos
+= (tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~(unsigned) 1;
free (tmp);
}
{
struct areltdata *tmp;
bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET);
tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (tmp != NULL)
{
if (tmp->arch_header[0] == '/'
&& tmp->arch_header[1] == ' ')
{
ardata->first_file_filepos +=
(tmp->parsed_size + sizeof (struct ar_hdr) + 1) & ~(unsigned) 1;
}
free (tmp);
}
}
return TRUE;
release_symdefs:
release_raw_armap:
bfd_release (abfd, raw_armap);
release_symdefs:
bfd_release (abfd, (ardata)->symdefs);
free_armap:
free (raw_armap);
return FALSE;
}
@ -1231,6 +1208,8 @@ bfd_boolean
_bfd_slurp_extended_name_table (bfd *abfd)
{
char nextname[17];
struct areltdata *namedata;
bfd_size_type amt;
/* FIXME: Formatting sucks here, and in case of failure of BFD_READ,
we probably don't want to return TRUE. */
@ -1239,10 +1218,6 @@ _bfd_slurp_extended_name_table (bfd *abfd)
if (bfd_bread (nextname, 16, abfd) == 16)
{
struct areltdata *namedata;
bfd_size_type amt;
ufile_ptr filesize;
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
@ -1258,16 +1233,12 @@ _bfd_slurp_extended_name_table (bfd *abfd)
if (namedata == NULL)
return FALSE;
filesize = bfd_get_file_size (abfd);
amt = namedata->parsed_size;
if (amt + 1 == 0 || (filesize != 0 && amt > filesize))
{
bfd_set_error (bfd_error_malformed_archive);
goto byebye;
}
if (amt + 1 == 0)
goto byebye;
bfd_ardata (abfd)->extended_names_size = amt;
bfd_ardata (abfd)->extended_names = (char *) bfd_alloc (abfd, amt + 1);
bfd_ardata (abfd)->extended_names = (char *) bfd_zalloc (abfd, amt + 1);
if (bfd_ardata (abfd)->extended_names == NULL)
{
byebye:
@ -1285,7 +1256,6 @@ _bfd_slurp_extended_name_table (bfd *abfd)
bfd_ardata (abfd)->extended_names = NULL;
goto byebye;
}
bfd_ardata (abfd)->extended_names[amt] = 0;
/* Since the archive is supposed to be printable if it contains
text, the entries in the list are newline-padded, not null
@ -1468,7 +1438,8 @@ adjust_relative_path (const char * path, const char * ref_path)
if (len > pathbuf_len)
{
free (pathbuf);
if (pathbuf != NULL)
free (pathbuf);
pathbuf_len = 0;
pathbuf = (char *) bfd_malloc (len);
if (pathbuf == NULL)
@ -1562,13 +1533,13 @@ _bfd_construct_extended_name_table (bfd *abfd,
if (bfd_is_thin_archive (abfd))
{
const char *filename = bfd_get_filename (current);
const char *filename = current->filename;
/* If the element being added is a member of another archive
(i.e., we are flattening), use the containing archive's name. */
if (current->my_archive
&& ! bfd_is_thin_archive (current->my_archive))
filename = bfd_get_filename (current->my_archive);
filename = current->my_archive->filename;
/* If the path is the same as the previous path seen,
reuse it. This can happen when flattening a thin
@ -1581,8 +1552,8 @@ _bfd_construct_extended_name_table (bfd *abfd,
/* If the path is relative, adjust it relative to
the containing archive. */
if (! IS_ABSOLUTE_PATH (filename)
&& ! IS_ABSOLUTE_PATH (bfd_get_filename (abfd)))
normal = adjust_relative_path (filename, bfd_get_filename (abfd));
&& ! IS_ABSOLUTE_PATH (abfd->filename))
normal = adjust_relative_path (filename, abfd->filename);
else
normal = filename;
@ -1596,7 +1567,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
continue;
}
normal = normalize (abfd, bfd_get_filename (current));
normal = normalize (abfd, current->filename);
if (normal == NULL)
return FALSE;
@ -1636,7 +1607,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
if (total_namelen == 0)
return TRUE;
*tabloc = (char *) bfd_alloc (abfd, total_namelen);
*tabloc = (char *) bfd_zalloc (abfd, total_namelen);
if (*tabloc == NULL)
return FALSE;
@ -1653,7 +1624,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
const char *normal;
unsigned int thislen;
long stroff;
const char *filename = bfd_get_filename (current);
const char *filename = current->filename;
if (bfd_is_thin_archive (abfd))
{
@ -1661,7 +1632,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
(i.e., we are flattening), use the containing archive's name. */
if (current->my_archive
&& ! bfd_is_thin_archive (current->my_archive))
filename = bfd_get_filename (current->my_archive);
filename = current->my_archive->filename;
/* If the path is the same as the previous path seen,
reuse it. This can happen when flattening a thin
archive that contains other archives.
@ -1670,8 +1641,8 @@ _bfd_construct_extended_name_table (bfd *abfd,
if (last_filename && filename_cmp (last_filename, filename) == 0)
normal = last_filename;
else if (! IS_ABSOLUTE_PATH (filename)
&& ! IS_ABSOLUTE_PATH (bfd_get_filename (abfd)))
normal = adjust_relative_path (filename, bfd_get_filename (abfd));
&& ! IS_ABSOLUTE_PATH (abfd->filename))
normal = adjust_relative_path (filename, abfd->filename);
else
normal = filename;
}
@ -1693,14 +1664,16 @@ _bfd_construct_extended_name_table (bfd *abfd,
stroff = last_stroff;
else
{
last_filename = filename;
strcpy (strptr, normal);
if (! trailing_slash)
strptr[thislen] = ARFMAG[1];
else
{
strptr[thislen] = '/';
strptr[thislen + 1] = ARFMAG[1];
}
stroff = strptr - *tabloc;
last_stroff = stroff;
memcpy (strptr, normal, thislen);
strptr += thislen;
if (trailing_slash)
*strptr++ = '/';
*strptr++ = ARFMAG[1];
}
hdr->ar_name[0] = ar_padchar (current);
if (bfd_is_thin_archive (abfd) && current->origin > 0)
@ -1713,6 +1686,13 @@ _bfd_construct_extended_name_table (bfd *abfd,
}
else
_bfd_ar_spacepad (hdr->ar_name + 1, maxname - 1, "%-ld", stroff);
if (normal != last_filename)
{
strptr += thislen + 1;
if (trailing_slash)
++strptr;
last_filename = filename;
}
}
}
@ -1739,7 +1719,7 @@ _bfd_archive_bsd44_construct_extended_name_table (bfd *abfd,
current != NULL;
current = current->archive_next)
{
const char *normal = normalize (abfd, bfd_get_filename (current));
const char *normal = normalize (abfd, current->filename);
int has_space = 0;
unsigned int len;
@ -1785,7 +1765,7 @@ _bfd_bsd44_write_ar_hdr (bfd *archive, bfd *abfd)
if (is_bsd44_extended_name (hdr->ar_name))
{
/* This is a BSD 4.4 extended name. */
const char *fullname = normalize (abfd, bfd_get_filename (abfd));
const char *fullname = normalize (abfd, abfd->filename);
unsigned int len = strlen (fullname);
unsigned int padded_len = (len + 3) & ~3;
@ -1861,7 +1841,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
struct stat status;
struct areltdata *ared;
struct ar_hdr *hdr;
size_t amt;
bfd_size_type amt;
if (member && (member->flags & BFD_IN_MEMORY) != 0)
{
@ -2137,15 +2117,13 @@ _bfd_write_archive_contents (bfd *arch)
if (!current->arelt_data)
{
current->arelt_data =
bfd_ar_hdr_from_filesystem (arch, bfd_get_filename (current),
current);
bfd_ar_hdr_from_filesystem (arch, current->filename, current);
if (!current->arelt_data)
goto input_err;
/* Put in the file name. */
BFD_SEND (arch, _bfd_truncate_arname,
(arch, bfd_get_filename (current),
(char *) arch_hdr (current)));
(arch, current->filename, (char *) arch_hdr (current)));
}
if (makemap && ! hasobjects)
@ -2213,13 +2191,17 @@ _bfd_write_archive_contents (bfd *arch)
while (remaining)
{
size_t amt = DEFAULT_BUFFERSIZE;
unsigned int amt = DEFAULT_BUFFERSIZE;
if (amt > remaining)
amt = remaining;
errno = 0;
if (bfd_bread (buffer, amt, current) != amt)
goto input_err;
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_file_truncated);
goto input_err;
}
if (bfd_bwrite (buffer, amt, arch) != amt)
return FALSE;
remaining -= amt;
@ -2273,7 +2255,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
asymbol **syms = NULL;
long syms_max = 0;
bfd_boolean ret;
size_t amt;
bfd_size_type amt;
static bfd_boolean report_plugin_err = TRUE;
/* Dunno if this is the best place for this info... */
@ -2294,7 +2276,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
/* Drop all the files called __.SYMDEF, we're going to make our own. */
while (arch->archive_head
&& strcmp (bfd_get_filename (arch->archive_head), "__.SYMDEF") == 0)
&& strcmp (arch->archive_head->filename, "__.SYMDEF") == 0)
arch->archive_head = arch->archive_head->archive_next;
/* Map over each element. */
@ -2325,7 +2307,8 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
{
if (storage > syms_max)
{
free (syms);
if (syms_max > 0)
free (syms);
syms_max = storage;
syms = (asymbol **) bfd_malloc (syms_max);
if (syms == NULL)
@ -2406,16 +2389,20 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
ret = BFD_SEND (arch, write_armap,
(arch, elength, map, orl_count, stridx));
free (syms);
free (map);
if (syms_max > 0)
free (syms);
if (map != NULL)
free (map);
if (first_name != NULL)
bfd_release (arch, first_name);
return ret;
error_return:
free (syms);
free (map);
if (syms_max > 0)
free (syms);
if (map != NULL)
free (map);
if (first_name != NULL)
bfd_release (arch, first_name);
@ -2490,7 +2477,7 @@ _bfd_bsd_write_armap (bfd *arch,
{
struct stat statbuf;
if (stat (bfd_get_filename (arch), &statbuf) == 0)
if (stat (arch->filename, &statbuf) == 0)
bfd_ardata (arch)->armap_timestamp = (statbuf.st_mtime
+ ARMAP_TIME_OFFSET);
uid = getuid();

View File

@ -1,5 +1,5 @@
/* Support for 64-bit archives.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
<mark@codesourcery.com>
@ -47,7 +47,6 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
bfd_byte *raw_armap = NULL;
carsym *carsyms;
bfd_size_type amt;
ufile_ptr filesize;
ardata->symdefs = NULL;
@ -77,13 +76,6 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
parsed_size = mapdata->parsed_size;
free (mapdata);
filesize = bfd_get_file_size (abfd);
if (filesize != 0 && parsed_size > filesize)
{
bfd_set_error (bfd_error_malformed_archive);
return FALSE;
}
if (bfd_bread (int_buf, 8, abfd) != 8)
{
if (bfd_get_error () != bfd_error_system_call)
@ -110,19 +102,22 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
bfd_set_error (bfd_error_malformed_archive);
return FALSE;
}
ardata->symdefs = (struct carsym *) bfd_alloc (abfd, amt);
ardata->symdefs = (struct carsym *) bfd_zalloc (abfd, amt);
if (ardata->symdefs == NULL)
return FALSE;
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
raw_armap = (bfd_byte *) _bfd_alloc_and_read (abfd, ptrsize, ptrsize);
if (raw_armap == NULL
raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize
|| bfd_bread (stringbase, stringsize, abfd) != stringsize)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
goto release_symdefs;
goto release_raw_armap;
}
stringend = stringbase + stringsize;
@ -147,7 +142,9 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
return TRUE;
release_symdefs:
release_raw_armap:
bfd_release (abfd, raw_armap);
release_symdefs:
bfd_release (abfd, ardata->symdefs);
return FALSE;
}

View File

@ -1,5 +1,5 @@
/* BFD library support routines for architectures.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -220,6 +220,10 @@ DESCRIPTION
. bfd_arch_k1om, {* Intel K1OM. *}
.#define bfd_mach_k1om (1 << 6)
.#define bfd_mach_k1om_intel_syntax (bfd_mach_k1om | bfd_mach_i386_intel_syntax)
.#define bfd_mach_i386_nacl (1 << 7)
.#define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl)
.#define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl)
.#define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl)
. bfd_arch_iamcu, {* Intel MCU. *}
.#define bfd_mach_iamcu (1 << 8)
.#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu)
@ -237,6 +241,7 @@ DESCRIPTION
.#define bfd_mach_h8300sx 6
.#define bfd_mach_h8300sxn 7
. bfd_arch_pdp11, {* DEC PDP-11. *}
. bfd_arch_plugin,
. bfd_arch_powerpc, {* PowerPC. *}
.#define bfd_mach_ppc 32
.#define bfd_mach_ppc64 64
@ -359,6 +364,7 @@ DESCRIPTION
.#define bfd_mach_tic4x 40
. bfd_arch_tic54x, {* Texas Instruments TMS320C54X. *}
. bfd_arch_tic6x, {* Texas Instruments TMS320C6X. *}
. bfd_arch_tic80, {* TI TMS320c80 (MVP). *}
. bfd_arch_v850, {* NEC V850. *}
. bfd_arch_v850_rh850,{* NEC V850 (using RH850 ABI). *}
.#define bfd_mach_v850 1
@ -509,25 +515,10 @@ DESCRIPTION
. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *}
.#define bfd_mach_xtensa 1
. bfd_arch_z80,
.{* Zilog Z80 without undocumented opcodes. *}
.#define bfd_mach_z80strict 1
.{* Zilog Z180: successor with additional instructions, but without
. halves of ix and iy. *}
.#define bfd_mach_z180 2
.{* Zilog Z80 with ixl, ixh, iyl, and iyh. *}
.#define bfd_mach_z80 3
.{* Zilog eZ80 (successor of Z80 & Z180) in Z80 (16-bit address) mode. *}
.#define bfd_mach_ez80_z80 4
.{* Zilog eZ80 (successor of Z80 & Z180) in ADL (24-bit address) mode. *}
.#define bfd_mach_ez80_adl 5
.{* Z80N *}
.#define bfd_mach_z80n 6
.{* Zilog Z80 with all undocumented instructions. *}
.#define bfd_mach_z80full 7
.{* GameBoy Z80 (reduced instruction set). *}
.#define bfd_mach_gbz80 8
.{* ASCII R800: successor with multiplication. *}
.#define bfd_mach_r800 11
.#define bfd_mach_z80strict 1 {* No undocumented opcodes. *}
.#define bfd_mach_z80 3 {* With ixl, ixh, iyl, and iyh. *}
.#define bfd_mach_z80full 7 {* All undocumented instructions. *}
.#define bfd_mach_r800 11 {* R800: successor with multiplication. *}
. bfd_arch_lm32, {* Lattice Mico32. *}
.#define bfd_mach_lm32 1
. bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
@ -691,6 +682,7 @@ extern const bfd_arch_info_type bfd_ns32k_arch;
extern const bfd_arch_info_type bfd_or1k_arch;
extern const bfd_arch_info_type bfd_pdp11_arch;
extern const bfd_arch_info_type bfd_pj_arch;
extern const bfd_arch_info_type bfd_plugin_arch;
extern const bfd_arch_info_type bfd_powerpc_archs[];
#define bfd_powerpc_arch bfd_powerpc_archs[0]
extern const bfd_arch_info_type bfd_pru_arch;
@ -707,6 +699,7 @@ extern const bfd_arch_info_type bfd_tic30_arch;
extern const bfd_arch_info_type bfd_tic4x_arch;
extern const bfd_arch_info_type bfd_tic54x_arch;
extern const bfd_arch_info_type bfd_tic6x_arch;
extern const bfd_arch_info_type bfd_tic80_arch;
extern const bfd_arch_info_type bfd_tilegx_arch;
extern const bfd_arch_info_type bfd_tilepro_arch;
extern const bfd_arch_info_type bfd_v850_arch;
@ -795,6 +788,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_tic4x_arch,
&bfd_tic54x_arch,
&bfd_tic6x_arch,
&bfd_tic80_arch,
&bfd_tilegx_arch,
&bfd_tilepro_arch,
&bfd_v850_arch,
@ -881,7 +875,7 @@ bfd_arch_list (void)
const char **name_ptr;
const char **name_list;
const bfd_arch_info_type * const *app;
size_t amt;
bfd_size_type amt;
/* Determine the number of architectures. */
vec_length = 0;

View File

@ -1,6 +1,6 @@
/* Main header file for the bfd library -- portable access to object files.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Contributed by Cygnus Support.

View File

@ -7,7 +7,7 @@
/* Main header file for the bfd library -- portable access to object files.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Contributed by Cygnus Support.
@ -643,7 +643,7 @@ bfd_boolean bfd_fill_in_gnu_debuglink_section
char *bfd_follow_build_id_debuglink (bfd *abfd, const char *dir);
const char *bfd_set_filename (bfd *abfd, const char *filename);
void bfd_set_filename (bfd *abfd, char *filename);
/* Extracted from libbfd.c. */
@ -700,7 +700,7 @@ bfd_vma bfd_getl24 (const void *p);
BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
#define bfd_get(bits, abfd, ptr) \
((bits) == 8 ? bfd_get_8 (abfd, ptr) \
((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
: (bits) == 16 ? bfd_get_16 (abfd, ptr) \
: (bits) == 32 ? bfd_get_32 (abfd, ptr) \
: (bits) == 64 ? bfd_get_64 (abfd, ptr) \
@ -795,10 +795,6 @@ typedef struct bfd_section
/* A unique sequence number. */
unsigned int id;
/* A unique section number which can be used by assembler to
distinguish different sections with the same section name. */
unsigned int section_id;
/* Which section in the bfd; 0..n-1 as sections are created in a bfd. */
unsigned int index;
@ -932,10 +928,6 @@ typedef struct bfd_section
else up the line will take care of it later. */
#define SEC_LINKER_CREATED 0x100000
/* This section contains a section ID to distinguish different
sections with the same section name. */
#define SEC_ASSEMBLER_SECTION_ID 0x100000
/* This section should not be subject to garbage collection.
Also set to inform the linker that this section should not be
listed in the link map as discarded. */
@ -1185,17 +1177,11 @@ typedef struct bfd_section
/* Early in the link process, map_head and map_tail are used to build
a list of input sections attached to an output section. Later,
output sections use these fields for a list of bfd_link_order
structs. The linked_to_symbol_name field is for ELF assembler
internal use. */
structs. */
union {
struct bfd_link_order *link_order;
struct bfd_section *s;
const char *linked_to_symbol_name;
} map_head, map_tail;
/* Points to the output section this section is already assigned to, if any.
This is used when support for non-contiguous memory regions is enabled. */
struct bfd_section *already_assigned;
} asection;
/* Relax table contains information about instructions which can
@ -1329,9 +1315,7 @@ bfd_is_ind_section (const asection *sec)
static inline bfd_boolean
bfd_is_const_section (const asection *sec)
{
return (sec >= _bfd_std_section
&& sec < _bfd_std_section + (sizeof (_bfd_std_section)
/ sizeof (_bfd_std_section[0])));
return sec >= bfd_abs_section_ptr && sec <= bfd_ind_section_ptr;
}
/* Return TRUE if input section SEC has been discarded. */
@ -1345,42 +1329,41 @@ discarded_section (const asection *sec)
}
#define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS) \
/* name, id, section_id, index, next, prev, flags, user_set_vma, */ \
{ NAME, IDX, 0, 0, NULL, NULL, FLAGS, 0, \
/* name, id, index, next, prev, flags, user_set_vma, */ \
{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
\
/* linker_mark, linker_has_input, gc_mark, decompress_status, */ \
/* linker_mark, linker_has_input, gc_mark, decompress_status, */ \
0, 0, 1, 0, \
\
/* segment_mark, sec_info_type, use_rela_p, */ \
/* segment_mark, sec_info_type, use_rela_p, */ \
0, 0, 0, \
\
/* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5, */ \
/* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5, */ \
0, 0, 0, 0, 0, 0, \
\
/* vma, lma, size, rawsize, compressed_size, relax, relax_count, */ \
/* vma, lma, size, rawsize, compressed_size, relax, relax_count, */ \
0, 0, 0, 0, 0, 0, 0, \
\
/* output_offset, output_section, alignment_power, */ \
/* output_offset, output_section, alignment_power, */ \
0, &SEC, 0, \
\
/* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \
/* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \
NULL, NULL, 0, 0, 0, \
\
/* line_filepos, userdata, contents, lineno, lineno_count, */ \
/* line_filepos, userdata, contents, lineno, lineno_count, */ \
0, NULL, NULL, NULL, 0, \
\
/* entsize, kept_section, moving_line_filepos, */ \
0, NULL, 0, \
0, NULL, 0, \
\
/* target_index, used_by_bfd, constructor_chain, owner, */ \
/* target_index, used_by_bfd, constructor_chain, owner, */ \
0, NULL, NULL, NULL, \
\
/* symbol, symbol_ptr_ptr, */ \
/* symbol, symbol_ptr_ptr, */ \
(struct bfd_symbol *) SYM, &SEC.symbol, \
\
/* map_head, map_tail, already_assigned */ \
{ NULL }, { NULL }, NULL \
\
/* map_head, map_tail */ \
{ NULL }, { NULL } \
}
/* We use a macro to initialize the static asymbol structures because
@ -1620,6 +1603,10 @@ enum bfd_architecture
bfd_arch_k1om, /* Intel K1OM. */
#define bfd_mach_k1om (1 << 6)
#define bfd_mach_k1om_intel_syntax (bfd_mach_k1om | bfd_mach_i386_intel_syntax)
#define bfd_mach_i386_nacl (1 << 7)
#define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl)
#define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl)
#define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl)
bfd_arch_iamcu, /* Intel MCU. */
#define bfd_mach_iamcu (1 << 8)
#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu)
@ -1637,6 +1624,7 @@ enum bfd_architecture
#define bfd_mach_h8300sx 6
#define bfd_mach_h8300sxn 7
bfd_arch_pdp11, /* DEC PDP-11. */
bfd_arch_plugin,
bfd_arch_powerpc, /* PowerPC. */
#define bfd_mach_ppc 32
#define bfd_mach_ppc64 64
@ -1759,6 +1747,7 @@ enum bfd_architecture
#define bfd_mach_tic4x 40
bfd_arch_tic54x, /* Texas Instruments TMS320C54X. */
bfd_arch_tic6x, /* Texas Instruments TMS320C6X. */
bfd_arch_tic80, /* TI TMS320c80 (MVP). */
bfd_arch_v850, /* NEC V850. */
bfd_arch_v850_rh850,/* NEC V850 (using RH850 ABI). */
#define bfd_mach_v850 1
@ -1909,25 +1898,10 @@ enum bfd_architecture
bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
#define bfd_mach_xtensa 1
bfd_arch_z80,
/* Zilog Z80 without undocumented opcodes. */
#define bfd_mach_z80strict 1
/* Zilog Z180: successor with additional instructions, but without
halves of ix and iy. */
#define bfd_mach_z180 2
/* Zilog Z80 with ixl, ixh, iyl, and iyh. */
#define bfd_mach_z80 3
/* Zilog eZ80 (successor of Z80 & Z180) in Z80 (16-bit address) mode. */
#define bfd_mach_ez80_z80 4
/* Zilog eZ80 (successor of Z80 & Z180) in ADL (24-bit address) mode. */
#define bfd_mach_ez80_adl 5
/* Z80N */
#define bfd_mach_z80n 6
/* Zilog Z80 with all undocumented instructions. */
#define bfd_mach_z80full 7
/* GameBoy Z80 (reduced instruction set). */
#define bfd_mach_gbz80 8
/* ASCII R800: successor with multiplication. */
#define bfd_mach_r800 11
#define bfd_mach_z80strict 1 /* No undocumented opcodes. */
#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */
#define bfd_mach_z80full 7 /* All undocumented instructions. */
#define bfd_mach_r800 11 /* R800: successor with multiplication. */
bfd_arch_lm32, /* Lattice Mico32. */
#define bfd_mach_lm32 1
bfd_arch_microblaze,/* Xilinx MicroBlaze. */
@ -3070,10 +3044,10 @@ instruction. */
BFD_RELOC_PPC64_DTPREL16_HIGHESTA,
BFD_RELOC_PPC64_TPREL34,
BFD_RELOC_PPC64_DTPREL34,
BFD_RELOC_PPC64_GOT_TLSGD_PCREL34,
BFD_RELOC_PPC64_GOT_TLSLD_PCREL34,
BFD_RELOC_PPC64_GOT_TPREL_PCREL34,
BFD_RELOC_PPC64_GOT_DTPREL_PCREL34,
BFD_RELOC_PPC64_GOT_TLSGD34,
BFD_RELOC_PPC64_GOT_TLSLD34,
BFD_RELOC_PPC64_GOT_TPREL34,
BFD_RELOC_PPC64_GOT_DTPREL34,
BFD_RELOC_PPC64_TLS_PCREL,
/* IBM 370/390 relocations */
@ -5249,9 +5223,7 @@ to one of its own internal functions or data structures. */
PLT entries. Otherwise, this is just a generic 32-bit relocation. */
BFD_RELOC_XTENSA_PLT,
/* Xtensa relocations for backward compatibility. These have been replaced
by BFD_RELOC_XTENSA_PDIFF and BFD_RELOC_XTENSA_NDIFF.
Xtensa relocations to mark the difference of two local symbols.
/* Xtensa relocations to mark the difference of two local symbols.
These are only needed to support linker relaxation and can be ignored
when not relaxing. The field is set to the value of the difference
assuming no relaxation. The relocation encodes the position of the
@ -5325,46 +5297,9 @@ BFD_RELOC_XTENSA_ASM_EXPAND. */
BFD_RELOC_XTENSA_TLS_ARG,
BFD_RELOC_XTENSA_TLS_CALL,
/* Xtensa relocations to mark the difference of two local symbols.
These are only needed to support linker relaxation and can be ignored
when not relaxing. The field is set to the value of the difference
assuming no relaxation. The relocation encodes the position of the
subtracted symbol so the linker can determine whether to adjust the field
value. PDIFF relocations are used for positive differences, NDIFF
relocations are used for negative differences. The difference value
is treated as unsigned with these relocation types, giving full
8/16 value ranges. */
BFD_RELOC_XTENSA_PDIFF8,
BFD_RELOC_XTENSA_PDIFF16,
BFD_RELOC_XTENSA_PDIFF32,
BFD_RELOC_XTENSA_NDIFF8,
BFD_RELOC_XTENSA_NDIFF16,
BFD_RELOC_XTENSA_NDIFF32,
/* 8 bit signed offset in (ix+d) or (iy+d). */
BFD_RELOC_Z80_DISP8,
/* First 8 bits of multibyte (32, 24 or 16 bit) value. */
BFD_RELOC_Z80_BYTE0,
/* Second 8 bits of multibyte (32, 24 or 16 bit) value. */
BFD_RELOC_Z80_BYTE1,
/* Third 8 bits of multibyte (32 or 24 bit) value. */
BFD_RELOC_Z80_BYTE2,
/* Fourth 8 bits of multibyte (32 bit) value. */
BFD_RELOC_Z80_BYTE3,
/* Lowest 16 bits of multibyte (32 or 24 bit) value. */
BFD_RELOC_Z80_WORD0,
/* Highest 16 bits of multibyte (32 or 24 bit) value. */
BFD_RELOC_Z80_WORD1,
/* Like BFD_RELOC_16 but big-endian. */
BFD_RELOC_Z80_16_BE,
/* DJNZ offset. */
BFD_RELOC_Z8K_DISP7,
@ -6630,6 +6565,12 @@ struct bfd
/* A unique identifier of the BFD */
unsigned int id;
/* The format which belongs to the BFD. (object, core, etc.) */
ENUM_BITFIELD (bfd_format) format : 3;
/* The direction with which the BFD was opened. */
ENUM_BITFIELD (bfd_direction) direction : 2;
/* Format_specific flags. */
flagword flags;
@ -6733,12 +6674,6 @@ struct bfd
| BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \
| BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON)
/* The format which belongs to the BFD. (object, core, etc.) */
ENUM_BITFIELD (bfd_format) format : 3;
/* The direction with which the BFD was opened. */
ENUM_BITFIELD (bfd_direction) direction : 2;
/* Is the file descriptor being cached? That is, can it be closed as
needed, and re-opened when accessed later? */
unsigned int cacheable : 1;
@ -6794,8 +6729,9 @@ struct bfd
library. */
bfd *plugin_dummy_bfd;
/* The offset of this bfd in the file, typically 0 if it is not
contained in an archive. */
/* Currently my_archive is tested before adding origin to
anything. I believe that this can become always an add of
origin, with origin set to 0 for non archive files. */
ufile_ptr origin;
/* The origin in the archive of the proxy entry. This will
@ -6827,7 +6763,7 @@ struct bfd
/* Symbol table for output BFD (with symcount entries).
Also used by the linker to cache input BFD symbols. */
struct bfd_symbol **outsymbols;
struct bfd_symbol **outsymbols;
/* Used for input and output. */
unsigned int symcount;
@ -6838,11 +6774,6 @@ struct bfd
/* Pointer to structure which contains architecture information. */
const struct bfd_arch_info *arch_info;
/* Cached length of file for bfd_get_size. 0 until bfd_get_size is
called, 1 if stat returns an error or the file size is too large to
return in ufile_ptr. Both 0 and 1 should be treated as "unknown". */
ufile_ptr size;
/* Stuff only useful for archives. */
void *arelt_data;
struct bfd *my_archive; /* The containing archive BFD. */
@ -7253,8 +7184,7 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
#define bfd_stat_arch_elt(abfd, stat) \
BFD_SEND (abfd->my_archive ? abfd->my_archive : abfd, \
_bfd_stat_arch_elt, (abfd, stat))
BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
#define bfd_update_armap_timestamp(abfd) \
BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
@ -7427,8 +7357,6 @@ typedef struct bfd_link_info _bfd_link_info;
/* Forward declaration. */
typedef struct flag_info flag_info;
typedef void (*bfd_cleanup) (bfd *);
typedef struct bfd_target
{
/* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
@ -7493,9 +7421,9 @@ typedef struct bfd_target
/* Format dependent routines: these are vectors of entry points
within the target vector structure, one for each format to check. */
/* Check the format of a file being read. Return a <<bfd_cleanup>> on
success or zero on failure. */
bfd_cleanup (*_bfd_check_format[bfd_type_end]) (bfd *);
/* Check the format of a file being read. Return a <<bfd_target *>> or zero. */
const struct bfd_target *
(*_bfd_check_format[bfd_type_end]) (bfd *);
/* Set the format of a file being written. */
bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
@ -7641,10 +7569,9 @@ typedef struct bfd_target
#define bfd_get_symbol_info(b,p,e) \
BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
const char *(*_bfd_get_symbol_version_string) (bfd *, struct bfd_symbol *,
bfd_boolean,
bfd_boolean *);
#define bfd_get_symbol_version_string(b,s,p,h) \
BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,p,h))
#define bfd_get_symbol_version_string(b,s,h) \
BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,h))
bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
alent * (*_get_lineno) (bfd *, struct bfd_symbol *);

151
bfd/bfd.c
View File

@ -1,5 +1,5 @@
/* Generic BFD library interface and support routines.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -85,6 +85,12 @@ CODE_FRAGMENT
. {* A unique identifier of the BFD *}
. unsigned int id;
.
. {* The format which belongs to the BFD. (object, core, etc.) *}
. ENUM_BITFIELD (bfd_format) format : 3;
.
. {* The direction with which the BFD was opened. *}
. ENUM_BITFIELD (bfd_direction) direction : 2;
.
. {* Format_specific flags. *}
. flagword flags;
.
@ -188,12 +194,6 @@ CODE_FRAGMENT
. | BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \
. | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON)
.
. {* The format which belongs to the BFD. (object, core, etc.) *}
. ENUM_BITFIELD (bfd_format) format : 3;
.
. {* The direction with which the BFD was opened. *}
. ENUM_BITFIELD (bfd_direction) direction : 2;
.
. {* Is the file descriptor being cached? That is, can it be closed as
. needed, and re-opened when accessed later? *}
. unsigned int cacheable : 1;
@ -249,8 +249,9 @@ CODE_FRAGMENT
. library. *}
. bfd *plugin_dummy_bfd;
.
. {* The offset of this bfd in the file, typically 0 if it is not
. contained in an archive. *}
. {* Currently my_archive is tested before adding origin to
. anything. I believe that this can become always an add of
. origin, with origin set to 0 for non archive files. *}
. ufile_ptr origin;
.
. {* The origin in the archive of the proxy entry. This will
@ -282,7 +283,7 @@ CODE_FRAGMENT
.
. {* Symbol table for output BFD (with symcount entries).
. Also used by the linker to cache input BFD symbols. *}
. struct bfd_symbol **outsymbols;
. struct bfd_symbol **outsymbols;
.
. {* Used for input and output. *}
. unsigned int symcount;
@ -293,11 +294,6 @@ CODE_FRAGMENT
. {* Pointer to structure which contains architecture information. *}
. const struct bfd_arch_info *arch_info;
.
. {* Cached length of file for bfd_get_size. 0 until bfd_get_size is
. called, 1 if stat returns an error or the file size is too large to
. return in ufile_ptr. Both 0 and 1 should be treated as "unknown". *}
. ufile_ptr size;
.
. {* Stuff only useful for archives. *}
. void *arelt_data;
. struct bfd *my_archive; {* The containing archive BFD. *}
@ -787,8 +783,8 @@ bfd_errmsg (bfd_error_type error_tag)
char *buf;
const char *msg = bfd_errmsg (input_error);
if (asprintf (&buf, _(bfd_errmsgs [error_tag]),
bfd_get_filename (input_bfd), msg) != -1)
if (asprintf (&buf, _(bfd_errmsgs [error_tag]), input_bfd->filename, msg)
!= -1)
return buf;
/* Ick, what to do on out of memory? */
@ -1114,10 +1110,10 @@ _bfd_doprnt (FILE *stream, const char *format, union _bfd_doprnt_args *args)
else if (abfd->my_archive
&& !bfd_is_thin_archive (abfd->my_archive))
result = fprintf (stream, "%s(%s)",
bfd_get_filename (abfd->my_archive),
bfd_get_filename (abfd));
abfd->my_archive->filename,
abfd->filename);
else
result = fprintf (stream, "%s", bfd_get_filename (abfd));
result = fprintf (stream, "%s", abfd->filename);
}
else
PRINT_TYPE (void *, p);
@ -2062,8 +2058,7 @@ DESCRIPTION
. BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
.
.#define bfd_stat_arch_elt(abfd, stat) \
. BFD_SEND (abfd->my_archive ? abfd->my_archive : abfd, \
. _bfd_stat_arch_elt, (abfd, stat))
. BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
.
.#define bfd_update_armap_timestamp(abfd) \
. BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
@ -2167,15 +2162,14 @@ bfd_record_phdr (bfd *abfd,
bfd_boolean flags_valid,
flagword flags,
bfd_boolean at_valid,
bfd_vma at, /* Bytes. */
bfd_vma at,
bfd_boolean includes_filehdr,
bfd_boolean includes_phdrs,
unsigned int count,
asection **secs)
{
struct elf_segment_map *m, **pm;
size_t amt;
unsigned int opb = bfd_octets_per_byte (abfd, NULL);
bfd_size_type amt;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
return TRUE;
@ -2188,7 +2182,7 @@ bfd_record_phdr (bfd *abfd,
m->p_type = type;
m->p_flags = flags;
m->p_paddr = at * opb;
m->p_paddr = at;
m->p_flags_valid = flags_valid;
m->p_paddr_valid = at_valid;
m->includes_filehdr = includes_filehdr;
@ -2487,7 +2481,8 @@ bfd_demangle (bfd *abfd, const char *name, int options)
res = cplus_demangle (name, options);
free (alloc);
if (alloc != NULL)
free (alloc);
if (res == NULL)
{
@ -2545,57 +2540,59 @@ void
bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
asection *sec)
{
if ((abfd->flags & BFD_COMPRESS) == 0)
abort ();
switch (bfd_get_flavour (abfd))
if ((abfd->flags & BFD_COMPRESS) != 0)
{
case bfd_target_elf_flavour:
if ((abfd->flags & BFD_COMPRESS_GABI) != 0)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
/* Set the SHF_COMPRESSED bit. */
elf_section_flags (sec) |= SHF_COMPRESSED;
if (bed->s->elfclass == ELFCLASS32)
if ((abfd->flags & BFD_COMPRESS_GABI) != 0)
{
Elf32_External_Chdr *echdr = (Elf32_External_Chdr *) contents;
bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
bfd_put_32 (abfd, sec->size, &echdr->ch_size);
bfd_put_32 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign);
/* bfd_log2 (alignof (Elf32_Chdr)) */
bfd_set_section_alignment (sec, 2);
const struct elf_backend_data *bed
= get_elf_backend_data (abfd);
/* Set the SHF_COMPRESSED bit. */
elf_section_flags (sec) |= SHF_COMPRESSED;
if (bed->s->elfclass == ELFCLASS32)
{
Elf32_External_Chdr *echdr
= (Elf32_External_Chdr *) contents;
bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
bfd_put_32 (abfd, sec->size, &echdr->ch_size);
bfd_put_32 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign);
/* bfd_log2 (alignof (Elf32_Chdr)) */
bfd_set_section_alignment (sec, 2);
}
else
{
Elf64_External_Chdr *echdr
= (Elf64_External_Chdr *) contents;
bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
bfd_put_32 (abfd, 0, &echdr->ch_reserved);
bfd_put_64 (abfd, sec->size, &echdr->ch_size);
bfd_put_64 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign);
/* bfd_log2 (alignof (Elf64_Chdr)) */
bfd_set_section_alignment (sec, 3);
}
}
else
{
Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents;
bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
bfd_put_32 (abfd, 0, &echdr->ch_reserved);
bfd_put_64 (abfd, sec->size, &echdr->ch_size);
bfd_put_64 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign);
/* bfd_log2 (alignof (Elf64_Chdr)) */
bfd_set_section_alignment (sec, 3);
/* Clear the SHF_COMPRESSED bit. */
elf_section_flags (sec) &= ~SHF_COMPRESSED;
/* Write the zlib header. It should be "ZLIB" followed by
the uncompressed section size, 8 bytes in big-endian
order. */
memcpy (contents, "ZLIB", 4);
bfd_putb64 (sec->size, contents + 4);
/* No way to keep the original alignment, just use 1 always. */
bfd_set_section_alignment (sec, 0);
}
break;
}
/* Clear the SHF_COMPRESSED bit. */
elf_section_flags (sec) &= ~SHF_COMPRESSED;
/* Fall through. */
default:
/* Write the zlib header. It should be "ZLIB" followed by
the uncompressed section size, 8 bytes in big-endian
order. */
memcpy (contents, "ZLIB", 4);
bfd_putb64 (sec->size, contents + 4);
/* No way to keep the original alignment, just use 1 always. */
bfd_set_section_alignment (sec, 0);
break;
}
else
abort ();
}
/*
@ -2773,7 +2770,7 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
/* Do nothing if ELF classes of input and output are the same. */
/* Do nothing if ELF classes of input and output are the same. */
if (get_elf_backend_data (ibfd)->s->elfclass
== get_elf_backend_data (obfd)->s->elfclass)
return TRUE;
@ -2787,17 +2784,11 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
if ((ibfd->flags & BFD_DECOMPRESS))
return TRUE;
/* Do nothing if the input section isn't a SHF_COMPRESSED section. */
/* Do nothing if the input section isn't a SHF_COMPRESSED section. */
ihdr_size = bfd_get_compression_header_size (ibfd, isec);
if (ihdr_size == 0)
return TRUE;
/* PR 25221. Check for corrupt input sections. */
if (ihdr_size > bfd_get_section_limit (ibfd, isec))
/* FIXME: Issue a warning about a corrupt
compression header size field ? */
return FALSE;
contents = *ptr;
/* Convert the contents of the input SHF_COMPRESSED section to
@ -2814,12 +2805,6 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
use_memmove = FALSE;
}
else if (ihdr_size != sizeof (Elf64_External_Chdr))
{
/* FIXME: Issue a warning about a corrupt
compression header size field ? */
return FALSE;
}
else
{
Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents;

View File

@ -1,6 +1,6 @@
dnl This file was derived from acinclude.m4.
dnl
dnl Copyright (C) 2012-2020 Free Software Foundation, Inc.
dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
dnl
dnl This file is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* Low-level I/O routines for BFDs.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
@ -25,10 +25,6 @@
#include <limits.h>
#include "bfd.h"
#include "libbfd.h"
#include "aout/ar.h"
#if defined (_WIN32)
#include <windows.h>
#endif
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
@ -96,7 +92,12 @@ _bfd_real_fopen (const char *filename, const char *modes)
In fopen-vms.h, they are separated from the mode with a comma.
Split here. */
vms_attr = strchr (modes, ',');
if (vms_attr != NULL)
if (vms_attr == NULL)
{
/* No attributes. */
return close_on_exec (fopen (filename, modes));
}
else
{
/* Attributes found. Split. */
size_t modes_len = strlen (modes) + 1;
@ -114,38 +115,13 @@ _bfd_real_fopen (const char *filename, const char *modes)
}
return close_on_exec (fopen (filename, at[0], at[1], at[2]));
}
#elif defined (_WIN32)
size_t filelen = strlen (filename) + 1;
if (filelen > MAX_PATH - 1)
{
FILE * file;
char * fullpath = (char *) malloc (filelen + 8);
int i;
/* Add a Microsoft recommended prefix that
will allow the extra-long path to work. */
strcpy (fullpath, "\\\\?\\");
strcat (fullpath, filename);
/* Convert any UNIX style path separators into the DOS form. */
for (i = 0; fullpath[i]; i++)
{
if (IS_UNIX_DIR_SEPARATOR (fullpath[i]))
fullpath[i] = '\\';
}
file = close_on_exec (fopen (fullpath, modes));
free (fullpath);
return file;
}
#elif defined (HAVE_FOPEN64)
#else /* !VMS */
#if defined (HAVE_FOPEN64)
return close_on_exec (fopen64 (filename, modes));
#endif
#else
return close_on_exec (fopen (filename, modes));
#endif
#endif /* !VMS */
}
/*
@ -210,7 +186,6 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
offset += abfd->origin;
abfd = abfd->my_archive;
}
offset += abfd->origin;
/* If this is an archive element, don't read past the end of
this element. */
@ -280,7 +255,6 @@ bfd_tell (bfd *abfd)
offset += abfd->origin;
abfd = abfd->my_archive;
}
offset += abfd->origin;
if (abfd->iovec == NULL)
return 0;
@ -341,7 +315,6 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
offset += abfd->origin;
abfd = abfd->my_archive;
}
offset += abfd->origin;
if (abfd->iovec == NULL)
{
@ -442,32 +415,17 @@ DESCRIPTION
of space for the 15 bazillon byte table it is about to read.
This function at least allows us to answer the question, "is the
size reasonable?".
A return value of zero indicates the file size is unknown.
*/
ufile_ptr
bfd_get_size (bfd *abfd)
{
/* A size of 0 means we haven't yet called bfd_stat. A size of 1
means we have a cached value of 0, ie. unknown. */
if (abfd->size <= 1 || bfd_write_p (abfd))
{
struct stat buf;
struct stat buf;
if (abfd->size == 1 && !bfd_write_p (abfd))
return 0;
if (bfd_stat (abfd, &buf) != 0)
return 0;
if (bfd_stat (abfd, &buf) != 0
|| buf.st_size == 0
|| buf.st_size - (ufile_ptr) buf.st_size != 0)
{
abfd->size = 1;
return 0;
}
abfd->size = buf.st_size;
}
return abfd->size;
return buf.st_size;
}
/*
@ -487,25 +445,11 @@ DESCRIPTION
ufile_ptr
bfd_get_file_size (bfd *abfd)
{
ufile_ptr file_size, archive_size = (ufile_ptr) -1;
if (abfd->my_archive != NULL
&& !bfd_is_thin_archive (abfd->my_archive))
{
struct areltdata *adata = (struct areltdata *) abfd->arelt_data;
archive_size = adata->parsed_size;
/* If the archive is compressed we can't compare against file size. */
if (adata->arch_header != NULL
&& memcmp (((struct ar_hdr *) adata->arch_header)->ar_fmag,
"Z\012", 2) == 0)
return archive_size;
abfd = abfd->my_archive;
}
return arelt_size (abfd);
file_size = bfd_get_size (abfd);
if (archive_size < file_size)
return archive_size;
return file_size;
return bfd_get_size (abfd);
}
/*
@ -535,7 +479,6 @@ bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
offset += abfd->origin;
abfd = abfd->my_archive;
}
offset += abfd->origin;
if (abfd->iovec == NULL)
{
@ -663,7 +606,8 @@ memory_bclose (struct bfd *abfd)
{
struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
free (bim->buffer);
if (bim->buffer != NULL)
free (bim->buffer);
free (bim);
abfd->iostream = NULL;

View File

@ -1,5 +1,5 @@
/* Support for memory-mapped windows into a BFD.
Copyright (C) 1995-2020 Free Software Foundation, Inc.
Copyright (C) 1995-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -150,7 +150,6 @@ bfd_get_file_window (bfd *abfd,
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

View File

@ -1,5 +1,5 @@
/* BFD back-end for binary objects.
Copyright (C) 1994-2020 Free Software Foundation, Inc.
Copyright (C) 1994-2019 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
@ -53,7 +53,7 @@ binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
was not defaulted. That is, it must be explicitly specified as
being binary. */
static bfd_cleanup
static const bfd_target *
binary_object_p (bfd *abfd)
{
struct stat statbuf;
@ -86,7 +86,7 @@ binary_object_p (bfd *abfd)
abfd->tdata.any = (void *) sec;
return _bfd_no_cleanup;
return abfd->xvec;
}
#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
@ -151,7 +151,7 @@ binary_canonicalize_symtab (bfd *abfd, asymbol **alocation)
asection *sec = (asection *) abfd->tdata.any;
asymbol *syms;
unsigned int i;
size_t amt = BIN_SYMS * sizeof (asymbol);
bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
syms = (asymbol *) bfd_alloc (abfd, amt);
if (syms == NULL)

View File

@ -1,6 +1,6 @@
/* BFD library -- caching of file descriptors.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
@ -592,17 +592,15 @@ bfd_open_file (bfd *abfd)
{
case read_direction:
case no_direction:
abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd), FOPEN_RB);
abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_RB);
break;
case both_direction:
case write_direction:
if (abfd->opened_once)
{
abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd),
FOPEN_RUB);
abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_RUB);
if (abfd->iostream == NULL)
abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd),
FOPEN_WUB);
abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB);
}
else
{
@ -629,11 +627,10 @@ bfd_open_file (bfd *abfd)
the --info option. */
struct stat s;
if (stat (bfd_get_filename (abfd), &s) == 0 && s.st_size != 0)
unlink_if_ordinary (bfd_get_filename (abfd));
if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
unlink_if_ordinary (abfd->filename);
#endif
abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd),
FOPEN_WUB);
abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB);
abfd->opened_once = TRUE;
}
break;

View File

@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF LynxOS files.
Copyright (C) 1993-2020 Free Software Foundation, Inc.
Copyright (C) 1993-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD back-end for CISCO crash dumps.
Copyright (C) 1994-2020 Free Software Foundation, Inc.
Copyright (C) 1994-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -80,7 +80,7 @@ struct cisco_core_struct
/* Examine the file for a crash info struct at the offset given by
CRASH_INFO_LOC. */
static bfd_cleanup
static const bfd_target *
cisco_core_file_validate (bfd *abfd, int crash_info_loc)
{
char buf[4];
@ -92,7 +92,7 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
unsigned int rambase;
sec_ptr asect;
struct stat statbuf;
size_t amt;
bfd_size_type amt;
flagword flags;
if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0)
@ -274,7 +274,7 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
nread = statbuf.st_size - asect->filepos;
asect->size = (nread < 1024) ? nread : 1024;
return _bfd_no_cleanup;
return abfd->xvec;
/* Get here if we have already started filling out the BFD
and there is an error of some kind. */
@ -286,19 +286,19 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
return NULL;
}
static bfd_cleanup
static const bfd_target *
cisco_core_file_p (bfd *abfd)
{
int *crash_info_locp;
bfd_cleanup cleanup = NULL;
const bfd_target *target = NULL;
for (crash_info_locp = crash_info_locs;
*crash_info_locp != -1 && cleanup == NULL;
*crash_info_locp != -1 && target == NULL;
crash_info_locp++)
{
cleanup = cisco_core_file_validate (abfd, *crash_info_locp);
target = cisco_core_file_validate (abfd, *crash_info_locp);
}
return cleanup;
return (target);
}
static char *

View File

@ -1,5 +1,5 @@
/* BFD back-end for ALPHA Extended-Coff files.
Copyright (C) 1993-2020 Free Software Foundation, Inc.
Copyright (C) 1993-2019 Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
@ -398,10 +398,10 @@ static reloc_howto_type alpha_howto_table[] =
/* Recognize an Alpha ECOFF file. */
static bfd_cleanup
static const bfd_target *
alpha_ecoff_object_p (bfd *abfd)
{
bfd_cleanup ret;
static const bfd_target *ret;
ret = coff_object_p (abfd);
@ -423,7 +423,7 @@ alpha_ecoff_object_p (bfd *abfd)
{
bfd_size_type size;
size = (bfd_size_type) sec->line_filepos * 8;
size = sec->line_filepos * 8;
BFD_ASSERT (size == sec->size
|| size + 8 == sec->size);
if (!bfd_set_section_size (sec, size))
@ -1127,11 +1127,13 @@ alpha_ecoff_get_relocated_section_contents (bfd *abfd,
abort ();
successful_return:
free (reloc_vector);
if (reloc_vector != NULL)
free (reloc_vector);
return data;
error_return:
free (reloc_vector);
if (reloc_vector != NULL)
free (reloc_vector);
return NULL;
}
@ -2024,10 +2026,7 @@ alpha_ecoff_read_ar_hdr (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) FILHSZ, SEEK_CUR) != 0
|| bfd_bread (ab, (bfd_size_type) 8, abfd) != 8
|| bfd_seek (abfd, (file_ptr) (- (FILHSZ + 8)), SEEK_CUR) != 0)
{
free (ret);
return NULL;
}
return NULL;
ret->parsed_size = H_GET_64 (abfd, ab);
}
@ -2048,7 +2047,6 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
bfd_size_type size;
bfd_byte *buf, *p;
struct bfd_in_memory *bim;
ufile_ptr filesize;
buf = NULL;
nbfd = _bfd_get_elt_at_filepos (archive, filepos);
@ -2082,14 +2080,6 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
goto error_return;
size = H_GET_64 (nbfd, ab);
/* The decompression algorithm will at most expand by eight times. */
filesize = bfd_get_file_size (archive);
if (filesize != 0 && size / 8 > filesize)
{
bfd_set_error (bfd_error_malformed_archive);
goto error_return;
}
if (size != 0)
{
bfd_size_type left;
@ -2128,7 +2118,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
n = dict[h];
else
{
if (bfd_bread (&n, 1, nbfd) != 1)
if (! bfd_bread (&n, (bfd_size_type) 1, nbfd))
goto error_return;
dict[h] = n;
}
@ -2169,7 +2159,8 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
return nbfd;
error_return:
free (buf);
if (buf != NULL)
free (buf);
if (nbfd != NULL)
bfd_close (nbfd);
return NULL;
@ -2421,8 +2412,7 @@ const bfd_target alpha_ecoff_le_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
| SEC_DATA | SEC_SMALL_DATA),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */

View File

@ -1,5 +1,5 @@
/* BFD back-end for ARM COFF files.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -924,7 +924,7 @@ static struct bfd_link_hash_table *
coff_arm_link_hash_table_create (bfd * abfd)
{
struct coff_arm_link_hash_table * ret;
size_t amt = sizeof (struct coff_arm_link_hash_table);
bfd_size_type amt = sizeof (struct coff_arm_link_hash_table);
ret = bfd_zmalloc (amt);
if (ret == NULL)
@ -1026,7 +1026,7 @@ find_thumb_glue (struct bfd_link_info *info,
{
char *tmp_name;
struct coff_link_hash_entry *myh;
size_t amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
bfd_size_type amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1;
tmp_name = bfd_malloc (amt);
@ -1055,7 +1055,7 @@ find_arm_glue (struct bfd_link_info *info,
{
char *tmp_name;
struct coff_link_hash_entry * myh;
size_t amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
bfd_size_type amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1;
tmp_name = bfd_malloc (amt);
@ -1154,7 +1154,7 @@ static const insn32 t2a6_bx_insn = 0xe12fff1e;
/* The standard COFF backend linker does not cope with the special
Thumb BRANCH23 relocation. The alternative would be to split the
BRANCH23 into separate HI23 and LO23 relocations. However, it is a
BRANCH23 into seperate HI23 and LO23 relocations. However, it is a
bit simpler simply providing our own relocation driver. */
/* The reloc processing routine for the ARM/Thumb COFF linker. NOTE:
@ -1840,7 +1840,7 @@ record_arm_to_thumb_glue (struct bfd_link_info * info,
struct bfd_link_hash_entry * bh;
struct coff_arm_link_hash_table * globals;
bfd_vma val;
size_t amt;
bfd_size_type amt;
globals = coff_arm_hash_table (info);
@ -1896,7 +1896,7 @@ record_thumb_to_arm_glue (struct bfd_link_info * info,
struct bfd_link_hash_entry * bh;
struct coff_arm_link_hash_table * globals;
bfd_vma val;
size_t amt;
bfd_size_type amt;
globals = coff_arm_hash_table (info);
@ -2210,8 +2210,7 @@ coff_arm_merge_private_bfd_data (bfd * ibfd, struct bfd_link_info *info)
{
_bfd_error_handler
/* xgettext: c-format */
(_("error: %pB is compiled for APCS-%d, "
"whereas %pB is compiled for APCS-%d"),
(_("error: %pB is compiled for APCS-%d, whereas %pB is compiled for APCS-%d"),
ibfd, APCS_26_FLAG (ibfd) ? 26 : 32,
obfd, APCS_26_FLAG (obfd) ? 26 : 32
);
@ -2224,16 +2223,14 @@ coff_arm_merge_private_bfd_data (bfd * ibfd, struct bfd_link_info *info)
{
if (APCS_FLOAT_FLAG (ibfd))
/* xgettext: c-format */
_bfd_error_handler
(_("error: %pB passes floats in float registers, "
"whereas %pB passes them in integer registers"),
ibfd, obfd);
_bfd_error_handler (_("\
error: %pB passes floats in float registers, whereas %pB passes them in integer registers"),
ibfd, obfd);
else
/* xgettext: c-format */
_bfd_error_handler
(_("error: %pB passes floats in integer registers, "
"whereas %pB passes them in float registers"),
ibfd, obfd);
_bfd_error_handler (_("\
error: %pB passes floats in integer registers, whereas %pB passes them in float registers"),
ibfd, obfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@ -2243,16 +2240,14 @@ coff_arm_merge_private_bfd_data (bfd * ibfd, struct bfd_link_info *info)
{
if (PIC_FLAG (ibfd))
/* xgettext: c-format */
_bfd_error_handler
(_("error: %pB is compiled as position independent code, "
"whereas target %pB is absolute position"),
ibfd, obfd);
_bfd_error_handler (_("\
error: %pB is compiled as position independent code, whereas target %pB is absolute position"),
ibfd, obfd);
else
/* xgettext: c-format */
_bfd_error_handler
(_("error: %pB is compiled as absolute position code, "
"whereas target %pB is position independent"),
ibfd, obfd);
_bfd_error_handler (_("\
error: %pB is compiled as absolute position code, whereas target %pB is position independent"),
ibfd, obfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@ -2277,15 +2272,14 @@ coff_arm_merge_private_bfd_data (bfd * ibfd, struct bfd_link_info *info)
{
if (INTERWORK_FLAG (ibfd))
/* xgettext: c-format */
_bfd_error_handler (_("warning: %pB supports interworking, "
"whereas %pB does not"),
_bfd_error_handler (_("\
warning: %pB supports interworking, whereas %pB does not"),
ibfd, obfd);
else
/* xgettext: c-format */
_bfd_error_handler
(_("warning: %pB does not support interworking, "
"whereas %pB does"),
ibfd, obfd);
_bfd_error_handler (_("\
warning: %pB does not support interworking, whereas %pB does"),
ibfd, obfd);
}
}
else
@ -2434,11 +2428,9 @@ coff_arm_copy_private_bfd_data (bfd * src, bfd * dest)
if (INTERWORK_FLAG (dest))
{
/* xgettext:c-format */
_bfd_error_handler
(_("warning: clearing the interworking flag of %pB "
"because non-interworking code in %pB has been "
"linked with it"),
dest, src);
_bfd_error_handler (_("\
warning: clearing the interworking flag of %pB because non-interworking code in %pB has been linked with it"),
dest, src);
}
SET_INTERWORK_FLAG (dest, 0);

View File

@ -1,5 +1,5 @@
/* BFD back-end for ARM COFF files.
Copyright (C) 2019-2020 Free Software Foundation, Inc.
Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD COFF interfaces used outside of BFD.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD COFF interfaces used outside of BFD.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF files (DJGPP variant).
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by DJ Delorie.
This file is part of BFD, the Binary File Descriptor library.
@ -22,7 +22,6 @@
#define TARGET_SYM i386_coff_go32_vec
#define TARGET_NAME "coff-go32"
#define TARGET_UNDERSCORE '_'
#define COFF_GO32
#define COFF_LONG_SECTION_NAMES
#define COFF_SUPPORT_GNU_LINKONCE
#define COFF_LONG_FILENAMES
@ -43,137 +42,4 @@
{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
/* Section contains extended relocations. */
#define IMAGE_SCN_LNK_NRELOC_OVFL (0x01000000)
#include "sysdep.h"
#include "bfd.h"
/* The following functions are not static, because they are also
used for coff-go32-exe (coff-stgo32.c). */
bfd_boolean _bfd_go32_mkobject (bfd *);
void _bfd_go32_swap_scnhdr_in (bfd *, void *, void *);
unsigned int _bfd_go32_swap_scnhdr_out (bfd *, void *, void *);
#define coff_mkobject _bfd_go32_mkobject
#define coff_SWAP_scnhdr_in _bfd_go32_swap_scnhdr_in
#define coff_SWAP_scnhdr_out _bfd_go32_swap_scnhdr_out
#include "coff-i386.c"
bfd_boolean
_bfd_go32_mkobject (bfd * abfd)
{
const bfd_size_type amt = sizeof (coff_data_type);
abfd->tdata.coff_obj_data = bfd_zalloc (abfd, amt);
if (abfd->tdata.coff_obj_data == NULL)
return FALSE;
coff_data (abfd)->go32 = TRUE;
return TRUE;
}
void
_bfd_go32_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
{
SCNHDR *scnhdr_ext = (SCNHDR *) ext;
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
memcpy (scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr);
scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr);
scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size);
scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr);
scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr);
scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr);
scnhdr_int->s_flags = GET_SCNHDR_FLAGS (abfd, scnhdr_ext->s_flags);
scnhdr_int->s_nreloc = GET_SCNHDR_NRELOC (abfd, scnhdr_ext->s_nreloc);
scnhdr_int->s_nlnno = GET_SCNHDR_NLNNO (abfd, scnhdr_ext->s_nlnno);
/* DJGPP follows the same strategy as PE COFF.
Iff the file is an executable then the higher 16 bits
of the line number have been stored in the relocation
counter field. */
if (abfd->flags & EXEC_P && (strcmp (scnhdr_ext->s_name, ".text") == 0))
{
scnhdr_int->s_nlnno
= (GET_SCNHDR_NRELOC (abfd, scnhdr_ext->s_nreloc) << 16)
+ GET_SCNHDR_NLNNO (abfd, scnhdr_ext->s_nlnno);
scnhdr_int->s_nreloc = 0;
}
}
unsigned int
_bfd_go32_swap_scnhdr_out (bfd * abfd, void * in, void * out)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
SCNHDR *scnhdr_ext = (SCNHDR *) out;
unsigned int ret = bfd_coff_scnhsz (abfd);
memcpy (scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr, scnhdr_ext->s_vaddr);
PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr, scnhdr_ext->s_paddr);
PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size, scnhdr_ext->s_size);
PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, scnhdr_ext->s_scnptr);
PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, scnhdr_ext->s_relptr);
PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr);
PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
if (abfd->flags & EXEC_P && (strcmp (scnhdr_int->s_name, ".text") == 0))
{
/* DJGPP follows the same strategy as PE COFF.
By inference from looking at MS output, the 32 bit field
which is the combination of the number_of_relocs and
number_of_linenos is used for the line number count in
executables. A 16-bit field won't do for cc1. The MS
document says that the number of relocs is zero for
executables, but the 17-th bit has been observed to be there.
Overflow is not an issue: a 4G-line program will overflow a
bunch of other fields long before this! */
PUT_SCNHDR_NLNNO (abfd, (scnhdr_int->s_nlnno & 0xffff),
scnhdr_ext->s_nlnno);
PUT_SCNHDR_NRELOC (abfd, (scnhdr_int->s_nlnno >> 16),
scnhdr_ext->s_nreloc);
}
else
{
/* DJGPP follows the same strategy as PE COFF. */
if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO)
PUT_SCNHDR_NLNNO (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
else
{
char buf[sizeof (scnhdr_int->s_name) + 1];
memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
buf[sizeof (scnhdr_int->s_name)] = '\0';
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: warning: %s: line number overflow: 0x%lx > 0xffff"),
abfd, buf, scnhdr_int->s_nlnno);
bfd_set_error (bfd_error_file_truncated);
PUT_SCNHDR_NLNNO (abfd, 0xffff, scnhdr_ext->s_nlnno);
ret = 0;
}
/* Although we could encode 0xffff relocs here, we do not, to be
consistent with other parts of bfd. Also it lets us warn, as
we should never see 0xffff here w/o having the overflow flag
set. */
if (scnhdr_int->s_nreloc < MAX_SCNHDR_NRELOC)
PUT_SCNHDR_NRELOC (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
else
{
/* DJGPP can deal with large #s of relocs, but not here. */
PUT_SCNHDR_NRELOC (abfd, 0xffff, scnhdr_ext->s_nreloc);
scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL;
PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
}
}
return ret;
}

View File

@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF files.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -31,6 +31,10 @@
#include "coff/pe.h"
#endif
#ifdef COFF_GO32_EXE
#include "coff/go32exe.h"
#endif
#ifndef bfd_pe_print_pdata
#define bfd_pe_print_pdata NULL
#endif
@ -659,21 +663,23 @@ const bfd_target
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
#ifndef COFF_CHECK_FORMAT
#define COFF_CHECK_FORMAT coff_object_p
#endif
#ifndef COFF_WRITE_CONTENTS
#define COFF_WRITE_CONTENTS coff_write_object_contents
#endif
/* Note that we allow an object file to be treated as a core file as well. */
#ifdef COFF_CHECK_FORMAT
{ /* bfd_check_format */
_bfd_dummy_target,
COFF_CHECK_FORMAT,
bfd_generic_archive_p,
COFF_CHECK_FORMAT
},
#else
{
_bfd_dummy_target,
coff_object_p,
bfd_generic_archive_p,
coff_object_p
},
#endif
{ /* bfd_set_format */
_bfd_bool_bfd_false_error,
coff_mkobject,
@ -682,7 +688,7 @@ const bfd_target
},
{ /* bfd_write_contents */
_bfd_bool_bfd_false_error,
COFF_WRITE_CONTENTS,
coff_write_object_contents,
_bfd_write_archive_contents,
_bfd_bool_bfd_false_error
},
@ -701,75 +707,3 @@ const bfd_target
COFF_SWAP_TABLE
};
#ifdef COFF_WITH_PE_BIGOBJ
const bfd_target
TARGET_SYM_BIG =
{
TARGET_NAME_BIG,
bfd_target_coff_flavour,
BFD_ENDIAN_LITTLE, /* data byte order is little */
BFD_ENDIAN_LITTLE, /* header byte order is little */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
#ifdef COFF_WITH_PE
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING
#endif
| SEC_CODE | SEC_DATA | SEC_EXCLUDE ),
#ifdef TARGET_UNDERSCORE
TARGET_UNDERSCORE, /* leading underscore */
#else
0, /* leading underscore */
#endif
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
/* Note that we allow an object file to be treated as a core file as well. */
{ /* bfd_check_format */
_bfd_dummy_target,
COFF_CHECK_FORMAT,
bfd_generic_archive_p,
COFF_CHECK_FORMAT
},
{ /* bfd_set_format */
_bfd_bool_bfd_false_error,
coff_mkobject,
_bfd_generic_mkarchive,
_bfd_bool_bfd_false_error
},
{ /* bfd_write_contents */
_bfd_bool_bfd_false_error,
COFF_WRITE_CONTENTS,
_bfd_write_archive_contents,
_bfd_bool_bfd_false_error
},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (coff),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
&bigobj_swap_table
};
#endif

View File

@ -1,5 +1,5 @@
/* BFD back-end for HP/Intel IA-64 COFF files.
Copyright (C) 1999-2020 Free Software Foundation, Inc.
Copyright (C) 1999-2019 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@ -67,7 +67,7 @@ in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED,
#include "coffcode.h"
static bfd_cleanup
static const bfd_target *
ia64coff_object_p (bfd *abfd)
{
#ifdef COFF_IMAGE_WITH_PE

View File

@ -1,5 +1,5 @@
/* BFD back-end for Motorola MCore COFF/PE
Copyright (C) 1999-2020 Free Software Foundation, Inc.
Copyright (C) 1999-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD back-end for MIPS Extended-Coff files.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@ -1440,8 +1440,7 @@ const bfd_target mips_ecoff_le_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
| SEC_DATA | SEC_SMALL_DATA),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
@ -1498,8 +1497,7 @@ const bfd_target mips_ecoff_be_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
| SEC_DATA | SEC_SMALL_DATA),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
@ -1556,8 +1554,7 @@ const bfd_target mips_ecoff_bele_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
| SEC_DATA | SEC_SMALL_DATA),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */

View File

@ -1,5 +1,5 @@
/* BFD back-end for PowerPC Microsoft Portable Executable files.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Original version pieced together by Kim Knuttila (krk@cygnus.com)
@ -179,7 +179,7 @@ static struct bfd_link_hash_table *
ppc_coff_link_hash_table_create (bfd *abfd)
{
struct ppc_coff_link_hash_table *ret;
size_t amt = sizeof (struct ppc_coff_link_hash_table);
bfd_size_type amt = sizeof (struct ppc_coff_link_hash_table);
ret = (struct ppc_coff_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
@ -771,7 +771,7 @@ record_toc (asection *toc_section,
const char *name)
{
/* Add this entry to our toc addr-offset-name list. */
size_t amt = sizeof (struct list_ele);
bfd_size_type amt = sizeof (struct list_ele);
struct list_ele *t = (struct list_ele *) bfd_malloc (amt);
if (t == NULL)
@ -1513,6 +1513,7 @@ ppc_allocate_toc_section (struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
asection *s;
bfd_byte *foo;
bfd_size_type amt;
static char test_char = '1';
if ( global_toc_size == 0 ) /* FIXME: does this get me in trouble? */
@ -1527,7 +1528,8 @@ ppc_allocate_toc_section (struct bfd_link_info *info ATTRIBUTE_UNUSED)
/* No toc section? Something is very wrong. */
abort ();
foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, global_toc_size);
amt = global_toc_size;
foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt);
memset(foo, test_char, (size_t) global_toc_size);
s->size = global_toc_size;
@ -2258,20 +2260,41 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
coff_debug_merge_hash_table_free (&flaginfo.debug_merge);
debug_merge_allocated = FALSE;
free (flaginfo.internal_syms);
flaginfo.internal_syms = NULL;
free (flaginfo.sec_ptrs);
flaginfo.sec_ptrs = NULL;
free (flaginfo.sym_indices);
flaginfo.sym_indices = NULL;
free (flaginfo.linenos);
flaginfo.linenos = NULL;
free (flaginfo.contents);
flaginfo.contents = NULL;
free (flaginfo.external_relocs);
flaginfo.external_relocs = NULL;
free (flaginfo.internal_relocs);
flaginfo.internal_relocs = NULL;
if (flaginfo.internal_syms != NULL)
{
free (flaginfo.internal_syms);
flaginfo.internal_syms = NULL;
}
if (flaginfo.sec_ptrs != NULL)
{
free (flaginfo.sec_ptrs);
flaginfo.sec_ptrs = NULL;
}
if (flaginfo.sym_indices != NULL)
{
free (flaginfo.sym_indices);
flaginfo.sym_indices = NULL;
}
if (flaginfo.linenos != NULL)
{
free (flaginfo.linenos);
flaginfo.linenos = NULL;
}
if (flaginfo.contents != NULL)
{
free (flaginfo.contents);
flaginfo.contents = NULL;
}
if (flaginfo.external_relocs != NULL)
{
free (flaginfo.external_relocs);
flaginfo.external_relocs = NULL;
}
if (flaginfo.internal_relocs != NULL)
{
free (flaginfo.internal_relocs);
flaginfo.internal_relocs = NULL;
}
/* The value of the last C_FILE symbol is supposed to be the symbol
index of the first external symbol. Write it out again if
@ -2297,8 +2320,11 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
goto error_return;
/* The outsyms buffer is used by _bfd_coff_write_global_sym. */
free (flaginfo.outsyms);
flaginfo.outsyms = NULL;
if (flaginfo.outsyms != NULL)
{
free (flaginfo.outsyms);
flaginfo.outsyms = NULL;
}
if (bfd_link_relocatable (info))
{
@ -2351,8 +2377,10 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
for (i = 0; i < abfd->section_count; i++)
{
free (flaginfo.section_info[i].relocs);
free (flaginfo.section_info[i].rel_hashes);
if (flaginfo.section_info[i].relocs != NULL)
free (flaginfo.section_info[i].relocs);
if (flaginfo.section_info[i].rel_hashes != NULL)
free (flaginfo.section_info[i].rel_hashes);
}
free (flaginfo.section_info);
flaginfo.section_info = NULL;
@ -2409,20 +2437,31 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
for (i = 0; i < abfd->section_count; i++)
{
free (flaginfo.section_info[i].relocs);
free (flaginfo.section_info[i].rel_hashes);
if (flaginfo.section_info[i].relocs != NULL)
free (flaginfo.section_info[i].relocs);
if (flaginfo.section_info[i].rel_hashes != NULL)
free (flaginfo.section_info[i].rel_hashes);
}
free (flaginfo.section_info);
}
free (flaginfo.internal_syms);
free (flaginfo.sec_ptrs);
free (flaginfo.sym_indices);
free (flaginfo.outsyms);
free (flaginfo.linenos);
free (flaginfo.contents);
free (flaginfo.external_relocs);
free (flaginfo.internal_relocs);
free (external_relocs);
if (flaginfo.internal_syms != NULL)
free (flaginfo.internal_syms);
if (flaginfo.sec_ptrs != NULL)
free (flaginfo.sec_ptrs);
if (flaginfo.sym_indices != NULL)
free (flaginfo.sym_indices);
if (flaginfo.outsyms != NULL)
free (flaginfo.outsyms);
if (flaginfo.linenos != NULL)
free (flaginfo.linenos);
if (flaginfo.contents != NULL)
free (flaginfo.contents);
if (flaginfo.external_relocs != NULL)
free (flaginfo.external_relocs);
if (flaginfo.internal_relocs != NULL)
free (flaginfo.internal_relocs);
if (external_relocs != NULL)
free (external_relocs);
return FALSE;
}
#endif

View File

@ -1,5 +1,5 @@
/* BFD back-end for IBM RS/6000 "XCOFF" files.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore.
Archive support from Damon A. Permezel.
Contributed by IBM Corporation and Cygnus Support.
@ -38,7 +38,7 @@ extern bfd_boolean _bfd_xcoff_is_local_label_name (bfd *, const char *);
extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup
(bfd *, bfd_reloc_code_real_type);
extern bfd_boolean _bfd_xcoff_slurp_armap (bfd *);
extern bfd_cleanup _bfd_xcoff_archive_p (bfd *);
extern const bfd_target *_bfd_xcoff_archive_p (bfd *);
extern void * _bfd_xcoff_read_ar_hdr (bfd *);
extern bfd *_bfd_xcoff_openr_next_archived_file (bfd *, bfd *);
extern int _bfd_xcoff_stat_arch_elt (bfd *, struct stat *);
@ -77,7 +77,7 @@ void xcoff_rtype2howto (arelent *, struct internal_reloc *);
#define coff_mkobject _bfd_xcoff_mkobject
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
#ifdef AIX_CORE
extern bfd_cleanup rs6000coff_core_p (bfd *abfd);
extern const bfd_target * rs6000coff_core_p (bfd *abfd);
extern bfd_boolean rs6000coff_core_file_matches_executable_p
(bfd *cbfd, bfd *ebfd);
extern char *rs6000coff_core_file_failing_command (bfd *abfd);
@ -323,7 +323,7 @@ bfd_boolean
_bfd_xcoff_mkobject (bfd *abfd)
{
coff_data_type *coff;
size_t amt = sizeof (struct xcoff_tdata);
bfd_size_type amt = sizeof (struct xcoff_tdata);
abfd->tdata.xcoff_obj_data = (struct xcoff_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.xcoff_obj_data == NULL)
@ -652,7 +652,7 @@ _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type, int in_class,
ext->x_sym.x_misc.x_lnsz.x_size);
}
end:
end:
return bfd_coff_auxesz (abfd);
}
@ -1260,25 +1260,18 @@ _bfd_xcoff_slurp_armap (bfd *abfd)
return FALSE;
GET_VALUE_IN_FIELD (sz, hdr.size, 10);
if (sz + 1 < 5)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
/* Read in the entire symbol table. */
contents = (bfd_byte *) _bfd_alloc_and_read (abfd, sz + 1, sz);
contents = (bfd_byte *) bfd_alloc (abfd, sz);
if (contents == NULL)
return FALSE;
/* Ensure strings are NULL terminated so we don't wander off the
end of the buffer. */
contents[sz] = 0;
if (bfd_bread (contents, sz, abfd) != sz)
return FALSE;
/* The symbol table starts with a four byte count. */
c = H_GET_32 (abfd, contents);
if (c >= sz / 4)
if (c * 4 >= sz)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
@ -1322,25 +1315,18 @@ _bfd_xcoff_slurp_armap (bfd *abfd)
return FALSE;
GET_VALUE_IN_FIELD (sz, hdr.size, 10);
if (sz + 1 < 9)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
/* Read in the entire symbol table. */
contents = (bfd_byte *) _bfd_alloc_and_read (abfd, sz + 1, sz);
contents = (bfd_byte *) bfd_alloc (abfd, sz);
if (contents == NULL)
return FALSE;
/* Ensure strings are NULL terminated so we don't wander off the
end of the buffer. */
contents[sz] = 0;
if (bfd_bread (contents, sz, abfd) != sz)
return FALSE;
/* The symbol table starts with an eight byte count. */
c = H_GET_64 (abfd, contents);
if (c >= sz / 8)
if (c * 8 >= sz)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
@ -1380,12 +1366,12 @@ _bfd_xcoff_slurp_armap (bfd *abfd)
/* See if this is an XCOFF archive. */
bfd_cleanup
const bfd_target *
_bfd_xcoff_archive_p (bfd *abfd)
{
struct artdata *tdata_hold;
char magic[SXCOFFARMAG];
size_t amt = SXCOFFARMAG;
bfd_size_type amt = SXCOFFARMAG;
if (bfd_bread (magic, amt, abfd) != amt)
{
@ -1481,7 +1467,7 @@ _bfd_xcoff_archive_p (bfd *abfd)
return NULL;
}
return _bfd_no_cleanup;
return abfd->xvec;
}
/* Read the archive header in an XCOFF archive. */
@ -1491,23 +1477,32 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd)
{
bfd_size_type namlen;
struct areltdata *ret;
bfd_size_type amt;
bfd_size_type amt = sizeof (struct areltdata);
ret = (struct areltdata *) bfd_zmalloc (amt);
if (ret == NULL)
return NULL;
if (! xcoff_big_format_p (abfd))
{
struct xcoff_ar_hdr hdr;
struct xcoff_ar_hdr *hdrp;
if (bfd_bread (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR)
return NULL;
if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
!= SIZEOF_AR_HDR)
{
free (ret);
return NULL;
}
GET_VALUE_IN_FIELD (namlen, hdr.namlen, 10);
amt = sizeof (struct areltdata) + SIZEOF_AR_HDR + namlen + 1;
ret = (struct areltdata *) bfd_malloc (amt);
if (ret == NULL)
return ret;
hdrp = (struct xcoff_ar_hdr *) (ret + 1);
amt = SIZEOF_AR_HDR + namlen + 1;
hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd, amt);
if (hdrp == NULL)
{
free (ret);
return NULL;
}
memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen)
{
@ -1525,16 +1520,21 @@ _bfd_xcoff_read_ar_hdr (bfd *abfd)
struct xcoff_ar_hdr_big hdr;
struct xcoff_ar_hdr_big *hdrp;
if (bfd_bread (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG)
return NULL;
if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
!= SIZEOF_AR_HDR_BIG)
{
free (ret);
return NULL;
}
GET_VALUE_IN_FIELD (namlen, hdr.namlen, 10);
amt = sizeof (struct areltdata) + SIZEOF_AR_HDR_BIG + namlen + 1;
ret = (struct areltdata *) bfd_malloc (amt);
if (ret == NULL)
return ret;
hdrp = (struct xcoff_ar_hdr_big *) (ret + 1);
amt = SIZEOF_AR_HDR_BIG + namlen + 1;
hdrp = (struct xcoff_ar_hdr_big *) bfd_alloc (abfd, amt);
if (hdrp == NULL)
{
free (ret);
return NULL;
}
memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG);
if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen)
{
@ -3389,8 +3389,7 @@ xcoff_ppc_relocate_section (bfd *output_bfd,
(info, h->root.root.string,
input_bfd, input_section,
rel->r_vaddr - input_section->vma,
info->unresolved_syms_in_objects == RM_DIAGNOSE &&
!info->warn_unresolved_syms);
info->unresolved_syms_in_objects == RM_GENERATE_ERROR);
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)

View File

@ -1,5 +1,5 @@
/* BFD back-end for Renesas Super-H COFF binaries.
Copyright (C) 1993-2020 Free Software Foundation, Inc.
Copyright (C) 1993-2019 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain, <sac@cygnus.com>.
Relaxing code written by Ian Lance Taylor, <ian@cygnus.com>.
@ -722,7 +722,7 @@ sh_relax_section (bfd *abfd,
if (coff_section_data (abfd, sec) == NULL)
{
size_t amt = sizeof (struct coff_section_tdata);
bfd_size_type amt = sizeof (struct coff_section_tdata);
sec->used_by_bfd = bfd_zalloc (abfd, amt);
if (sec->used_by_bfd == NULL)
return FALSE;
@ -1056,9 +1056,10 @@ sh_relax_section (bfd *abfd,
return TRUE;
error_return:
if (internal_relocs != coff_section_data (abfd, sec)->relocs)
if (internal_relocs != NULL
&& internal_relocs != coff_section_data (abfd, sec)->relocs)
free (internal_relocs);
if (contents != coff_section_data (abfd, sec)->contents)
if (contents != NULL && contents != coff_section_data (abfd, sec)->contents)
free (contents);
return FALSE;
}
@ -2722,7 +2723,8 @@ sh_align_loads (bfd *abfd,
return TRUE;
error_return:
free (labels);
if (labels != NULL)
free (labels);
return FALSE;
}
@ -2993,9 +2995,12 @@ sh_coff_get_relocated_section_contents (bfd *output_bfd,
return data;
error_return:
free (internal_relocs);
free (internal_syms);
free (sections);
if (internal_relocs != NULL)
free (internal_relocs);
if (internal_syms != NULL)
free (internal_syms);
if (sections != NULL)
free (sections);
return NULL;
}
@ -3039,7 +3044,7 @@ CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE,
/* Only recognize the small versions if the target was not defaulted.
Otherwise we won't recognize the non default endianness. */
static bfd_cleanup
static const bfd_target *
coff_small_object_p (bfd *abfd)
{
if (abfd->target_defaulted)

View File

@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF files (DJGPP variant with a stub).
Copyright (C) 1997-2020 Free Software Foundation, Inc.
Copyright (C) 1997-2019 Free Software Foundation, Inc.
Written by Robert Hoehne.
This file is part of BFD, the Binary File Descriptor library.
@ -23,10 +23,17 @@
DOS executable program before the coff image to load it in memory
and execute it. This is needed, because DOS cannot run coff files.
The COFF image is loaded in memory without the stub attached, so
all offsets are relative to the beginning of the image, not the
actual file. We handle this in bfd by setting bfd->origin to where
the COFF image starts. */
All the functions below are called by the corresponding functions
from coffswap.h.
The only thing what they do is to adjust the information stored in
the COFF file which are offset into the file.
This is needed, because DJGPP uses a very special way to load and run
the coff image. It loads the image in memory and assumes then, that the
image had no stub by using the filepointers as pointers in the coff
image and NOT in the file.
To be compatible with any existing executables I have fixed this
here and NOT in the DJGPP startup code. */
#define TARGET_SYM i386_coff_go32stubbed_vec
#define TARGET_NAME "coff-go32-exe"
@ -46,29 +53,54 @@
{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
/* Section contains extended relocations. */
#define IMAGE_SCN_LNK_NRELOC_OVFL (0x01000000)
#include "sysdep.h"
#include "bfd.h"
#include "coff/msdos.h"
static bfd_cleanup go32exe_check_format (bfd *);
static bfd_boolean go32exe_write_object_contents (bfd *);
static bfd_boolean go32exe_mkobject (bfd *);
static bfd_boolean go32exe_copy_private_bfd_data (bfd *, bfd *);
/* All that ..._PRE and ...POST functions are called from the corresponding
coff_swap... functions. The ...PRE functions are called at the beginning
of the function and the ...POST functions at the end of the swap routines. */
/* Defined in coff-go32.c. */
bfd_boolean _bfd_go32_mkobject (bfd *);
void _bfd_go32_swap_scnhdr_in (bfd *, void *, void *);
unsigned int _bfd_go32_swap_scnhdr_out (bfd *, void *, void *);
static void
adjust_filehdr_in_post (bfd *, void *, void *);
static void
adjust_filehdr_out_pre (bfd *, void *, void *);
static void
adjust_filehdr_out_post (bfd *, void *, void *);
static void
adjust_scnhdr_in_post (bfd *, void *, void *);
static void
adjust_scnhdr_out_pre (bfd *, void *, void *);
static void
adjust_scnhdr_out_post (bfd *, void *, void *);
static void
adjust_aux_in_post (bfd *, void *, int, int, int, int, void *);
static void
adjust_aux_out_pre (bfd *, void *, int, int, int, int, void *);
static void
adjust_aux_out_post (bfd *, void *, int, int, int, int, void *);
static void
create_go32_stub (bfd *);
#define COFF_CHECK_FORMAT go32exe_check_format
#define COFF_WRITE_CONTENTS go32exe_write_object_contents
#define coff_mkobject go32exe_mkobject
#define coff_bfd_copy_private_bfd_data go32exe_copy_private_bfd_data
#define coff_SWAP_scnhdr_in _bfd_go32_swap_scnhdr_in
#define coff_SWAP_scnhdr_out _bfd_go32_swap_scnhdr_out
#define COFF_ADJUST_FILEHDR_IN_POST adjust_filehdr_in_post
#define COFF_ADJUST_FILEHDR_OUT_PRE adjust_filehdr_out_pre
#define COFF_ADJUST_FILEHDR_OUT_POST adjust_filehdr_out_post
#define COFF_ADJUST_SCNHDR_IN_POST adjust_scnhdr_in_post
#define COFF_ADJUST_SCNHDR_OUT_PRE adjust_scnhdr_out_pre
#define COFF_ADJUST_SCNHDR_OUT_POST adjust_scnhdr_out_post
#define COFF_ADJUST_AUX_IN_POST adjust_aux_in_post
#define COFF_ADJUST_AUX_OUT_PRE adjust_aux_out_pre
#define COFF_ADJUST_AUX_OUT_POST adjust_aux_out_post
static const bfd_target *go32_check_format (bfd *);
#define COFF_CHECK_FORMAT go32_check_format
static bfd_boolean
go32_stubbed_coff_bfd_copy_private_bfd_data (bfd *, bfd *);
#define coff_bfd_copy_private_bfd_data go32_stubbed_coff_bfd_copy_private_bfd_data
#include "coff-i386.c"
@ -78,15 +110,160 @@ unsigned int _bfd_go32_swap_scnhdr_out (bfd *, void *, void *);
/* These bytes are a 2048-byte DOS executable, which loads the COFF
image into memory and then runs it. It is called 'stub'. */
#define GO32EXE_DEFAULT_STUB_SIZE 2048
static const unsigned char go32exe_default_stub[GO32EXE_DEFAULT_STUB_SIZE] =
static const unsigned char stub_bytes[GO32_STUBSIZE] =
{
#include "go32stub.h"
};
/* Temporary location for stub read from input file. */
static char * go32exe_temp_stub = NULL;
static bfd_size_type go32exe_temp_stub_size = 0;
/*
I have not commented each swap function below, because the
technique is in any function the same. For the ...in function,
all the pointers are adjusted by adding GO32_STUBSIZE and for the
...out function, it is subtracted first and after calling the
standard swap function it is reset to the old value. */
/* This macro is used for adjusting the filepointers, which
is done only, if the pointer is nonzero. */
#define ADJUST_VAL(val,diff) \
if (val != 0) val += diff
static void
adjust_filehdr_in_post (bfd * abfd ATTRIBUTE_UNUSED,
void * src,
void * dst)
{
FILHDR *filehdr_src = (FILHDR *) src;
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
ADJUST_VAL (filehdr_dst->f_symptr, GO32_STUBSIZE);
/* Save now the stub to be used later. Put the stub data to FILEHDR_DST
first as coff_data (abfd) still does not exist. It may not even be ever
created as we are just checking the file format of ABFD. */
memcpy (filehdr_dst->go32stub, filehdr_src->stub, GO32_STUBSIZE);
filehdr_dst->f_flags |= F_GO32STUB;
}
static void
adjust_filehdr_out_pre (bfd * abfd, void * in, void * out)
{
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
FILHDR *filehdr_out = (FILHDR *) out;
/* Generate the stub. */
create_go32_stub (abfd);
/* Copy the stub to the file header. */
if (coff_data (abfd)->go32stub != NULL)
memcpy (filehdr_out->stub, coff_data (abfd)->go32stub, GO32_STUBSIZE);
else
/* Use the default. */
memcpy (filehdr_out->stub, stub_bytes, GO32_STUBSIZE);
ADJUST_VAL (filehdr_in->f_symptr, -GO32_STUBSIZE);
}
static void
adjust_filehdr_out_post (bfd * abfd ATTRIBUTE_UNUSED,
void * in,
void * out ATTRIBUTE_UNUSED)
{
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
/* Undo the above change. */
ADJUST_VAL (filehdr_in->f_symptr, GO32_STUBSIZE);
}
static void
adjust_scnhdr_in_post (bfd * abfd ATTRIBUTE_UNUSED,
void * ext ATTRIBUTE_UNUSED,
void * in)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
ADJUST_VAL (scnhdr_int->s_scnptr, GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_relptr, GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_lnnoptr, GO32_STUBSIZE);
}
static void
adjust_scnhdr_out_pre (bfd * abfd ATTRIBUTE_UNUSED,
void * in,
void * out ATTRIBUTE_UNUSED)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
ADJUST_VAL (scnhdr_int->s_scnptr, -GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_relptr, -GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_lnnoptr, -GO32_STUBSIZE);
}
static void
adjust_scnhdr_out_post (bfd * abfd ATTRIBUTE_UNUSED,
void * in,
void * out ATTRIBUTE_UNUSED)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
ADJUST_VAL (scnhdr_int->s_scnptr, GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_relptr, GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_lnnoptr, GO32_STUBSIZE);
}
static void
adjust_aux_in_post (bfd * abfd ATTRIBUTE_UNUSED,
void * ext1 ATTRIBUTE_UNUSED,
int type,
int in_class,
int indx ATTRIBUTE_UNUSED,
int numaux ATTRIBUTE_UNUSED,
void * in1)
{
union internal_auxent *in = (union internal_auxent *) in1;
if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type)
|| ISTAG (in_class))
{
ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, GO32_STUBSIZE);
}
}
static void
adjust_aux_out_pre (bfd *abfd ATTRIBUTE_UNUSED,
void * inp,
int type,
int in_class,
int indx ATTRIBUTE_UNUSED,
int numaux ATTRIBUTE_UNUSED,
void * extp ATTRIBUTE_UNUSED)
{
union internal_auxent *in = (union internal_auxent *) inp;
if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type)
|| ISTAG (in_class))
{
ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, -GO32_STUBSIZE);
}
}
static void
adjust_aux_out_post (bfd *abfd ATTRIBUTE_UNUSED,
void * inp,
int type,
int in_class,
int indx ATTRIBUTE_UNUSED,
int numaux ATTRIBUTE_UNUSED,
void * extp ATTRIBUTE_UNUSED)
{
union internal_auxent *in = (union internal_auxent *) inp;
if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type)
|| ISTAG (in_class))
{
ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, GO32_STUBSIZE);
}
}
/* That's the function, which creates the stub. There are
different cases from where the stub is taken.
@ -98,16 +275,13 @@ static bfd_size_type go32exe_temp_stub_size = 0;
file.
If there was any error, the standard stub (compiled in this file)
is taken.
Ideally this function should exec '$(TARGET)-stubify' to generate
a stub, like gcc does. */
is taken. */
static void
go32exe_create_stub (bfd *abfd)
create_go32_stub (bfd *abfd)
{
/* Do it only once. */
if (coff_data (abfd)->stub == NULL)
if (coff_data (abfd)->go32stub == NULL)
{
char *stub;
struct stat st;
@ -117,22 +291,6 @@ go32exe_create_stub (bfd *abfd)
unsigned long coff_start;
long exe_start;
/* If we read a stub from an input file, use that one. */
if (go32exe_temp_stub != NULL)
{
coff_data (abfd)->stub = bfd_alloc (abfd,
go32exe_temp_stub_size);
if (coff_data (abfd)->stub == NULL)
return;
memcpy (coff_data (abfd)->stub, go32exe_temp_stub,
go32exe_temp_stub_size);
coff_data (abfd)->stub_size = go32exe_temp_stub_size;
free (go32exe_temp_stub);
go32exe_temp_stub = NULL;
go32exe_temp_stub_size = 0;
return;
}
/* Check at first the environment variable $(GO32STUB). */
stub = getenv ("GO32STUB");
/* Now check the environment variable $(STUB). */
@ -165,6 +323,13 @@ go32exe_create_stub (bfd *abfd)
if (_H (1))
coff_start += (long) _H (1) - 512L;
/* Currently there is only a fixed stub size of 2048 bytes
supported. */
if (coff_start != 2048)
{
close (f);
goto stub_end;
}
exe_start = _H (4) * 16;
if ((long) lseek (f, exe_start, SEEK_SET) != exe_start)
{
@ -182,35 +347,31 @@ go32exe_create_stub (bfd *abfd)
goto stub_end;
}
/* Now we found a correct stub (hopefully). */
coff_data (abfd)->stub = bfd_alloc (abfd, (bfd_size_type) coff_start);
if (coff_data (abfd)->stub == NULL)
coff_data (abfd)->go32stub = bfd_alloc (abfd, (bfd_size_type) coff_start);
if (coff_data (abfd)->go32stub == NULL)
{
close (f);
return;
}
lseek (f, 0L, SEEK_SET);
if ((unsigned long) read (f, coff_data (abfd)->stub, coff_start)
if ((unsigned long) read (f, coff_data (abfd)->go32stub, coff_start)
!= coff_start)
{
bfd_release (abfd, coff_data (abfd)->stub);
coff_data (abfd)->stub = NULL;
bfd_release (abfd, coff_data (abfd)->go32stub);
coff_data (abfd)->go32stub = NULL;
}
else
coff_data (abfd)->stub_size = coff_start;
close (f);
}
stub_end:
stub_end:
/* There was something wrong above, so use now the standard builtin
stub. */
if (coff_data (abfd)->stub == NULL)
if (coff_data (abfd)->go32stub == NULL)
{
coff_data (abfd)->stub
= bfd_alloc (abfd, (bfd_size_type) GO32EXE_DEFAULT_STUB_SIZE);
if (coff_data (abfd)->stub == NULL)
coff_data (abfd)->go32stub
= bfd_alloc (abfd, (bfd_size_type) GO32_STUBSIZE);
if (coff_data (abfd)->go32stub == NULL)
return;
memcpy (coff_data (abfd)->stub, go32exe_default_stub,
GO32EXE_DEFAULT_STUB_SIZE);
coff_data (abfd)->stub_size = GO32EXE_DEFAULT_STUB_SIZE;
memcpy (coff_data (abfd)->go32stub, stub_bytes, GO32_STUBSIZE);
}
}
@ -218,163 +379,46 @@ go32exe_create_stub (bfd *abfd)
to the new obfd. */
static bfd_boolean
go32exe_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
go32_stubbed_coff_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
/* Check if both are the same targets. */
if (ibfd->xvec != obfd->xvec)
return TRUE;
/* Make sure we have a source stub. */
BFD_ASSERT (coff_data (ibfd)->stub != NULL);
/* Check if we have a source stub. */
if (coff_data (ibfd)->go32stub == NULL)
return TRUE;
/* Reallocate the output stub if necessary. */
if (coff_data (ibfd)->stub_size > coff_data (obfd)->stub_size)
coff_data (obfd)->stub = bfd_alloc (obfd, coff_data (ibfd)->stub_size);
if (coff_data (obfd)->stub == NULL)
return FALSE;
/* As adjust_filehdr_out_pre may get called only after this function,
optionally allocate the output stub. */
if (coff_data (obfd)->go32stub == NULL)
coff_data (obfd)->go32stub = bfd_alloc (obfd,
(bfd_size_type) GO32_STUBSIZE);
/* Now copy the stub. */
memcpy (coff_data (obfd)->stub, coff_data (ibfd)->stub,
coff_data (ibfd)->stub_size);
coff_data (obfd)->stub_size = coff_data (ibfd)->stub_size;
obfd->origin = coff_data (obfd)->stub_size;
if (coff_data (obfd)->go32stub != NULL)
memcpy (coff_data (obfd)->go32stub, coff_data (ibfd)->go32stub,
GO32_STUBSIZE);
return TRUE;
}
/* Cleanup function, returned from check_format hook. */
/* coff_object_p only checks 2 bytes F_MAGIC at GO32_STUBSIZE inside the file
which is too fragile. */
static void
go32exe_cleanup (bfd *abfd)
static const bfd_target *
go32_check_format (bfd *abfd)
{
abfd->origin = 0;
char mz[2];
free (go32exe_temp_stub);
go32exe_temp_stub = NULL;
go32exe_temp_stub_size = 0;
}
/* Check that there is a GO32 stub and read it to go32exe_temp_stub.
Then set abfd->origin so that the COFF image is read at the correct
file offset. */
static bfd_cleanup
go32exe_check_format (bfd *abfd)
{
struct external_DOS_hdr filehdr_dos;
uint16_t num_pages;
uint16_t last_page_size;
uint32_t header_end;
bfd_size_type stubsize;
/* This format can not appear in an archive. */
if (abfd->origin != 0)
if (bfd_bread (mz, 2, abfd) != 2 || mz[0] != 'M' || mz[1] != 'Z')
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
bfd_set_error (bfd_error_system_call);
/* Read in the stub file header, which is a DOS MZ executable. */
if (bfd_bread (&filehdr_dos, DOS_HDR_SIZE, abfd) != DOS_HDR_SIZE)
goto fail;
/* Make sure that this is an MZ executable. */
if (H_GET_16 (abfd, filehdr_dos.e_magic) != IMAGE_DOS_SIGNATURE)
goto fail_format;
/* Determine the size of the stub */
num_pages = H_GET_16 (abfd, filehdr_dos.e_cp);
last_page_size = H_GET_16 (abfd, filehdr_dos.e_cblp);
stubsize = num_pages * 512;
if (last_page_size != 0)
stubsize += last_page_size - 512;
/* Save now the stub to be used later. Put the stub data to a temporary
location first as tdata still does not exist. It may not even
be ever created if we are just checking the file format of ABFD. */
bfd_seek (abfd, 0, SEEK_SET);
go32exe_temp_stub = bfd_malloc (stubsize);
if (go32exe_temp_stub == NULL)
goto fail;
if (bfd_bread (go32exe_temp_stub, stubsize, abfd) != stubsize)
goto fail;
go32exe_temp_stub_size = stubsize;
/* Confirm that this is a go32stub. */
header_end = H_GET_16 (abfd, filehdr_dos.e_cparhdr) * 16UL;
if (! CONST_STRNEQ (go32exe_temp_stub + header_end, "go32stub"))
goto fail_format;
/* Set origin to where the COFF header starts and seek there. */
abfd->origin = stubsize;
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto fail;
return NULL;
/* Call coff_object_p to read the COFF image. If this fails then the file
must be just a stub with no COFF data attached. */
bfd_cleanup cleanup = coff_object_p (abfd);
if (cleanup == NULL)
goto fail;
BFD_ASSERT (cleanup == _bfd_no_cleanup);
return go32exe_cleanup;
fail_format:
bfd_set_error (bfd_error_wrong_format);
fail:
go32exe_cleanup (abfd);
return NULL;
}
/* Write the stub to the output file, then call coff_write_object_contents. */
static bfd_boolean
go32exe_write_object_contents (bfd *abfd)
{
const bfd_size_type pos = bfd_tell (abfd);
const bfd_size_type stubsize = coff_data (abfd)->stub_size;
BFD_ASSERT (stubsize != 0);
bfd_set_error (bfd_error_system_call);
/* Write the stub. */
abfd->origin = 0;
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return FALSE;
if (bfd_bwrite (coff_data (abfd)->stub, stubsize, abfd) != stubsize)
return FALSE;
/* Seek back to where we were. */
abfd->origin = stubsize;
if (bfd_seek (abfd, pos, SEEK_SET) != 0)
return FALSE;
return coff_write_object_contents (abfd);
}
/* mkobject hook. Called directly through bfd_set_format or via
coff_mkobject_hook etc from bfd_check_format. */
static bfd_boolean
go32exe_mkobject (bfd *abfd)
{
/* Don't output to an archive. */
if (abfd->my_archive != NULL)
return FALSE;
if (!_bfd_go32_mkobject (abfd))
return FALSE;
go32exe_create_stub (abfd);
if (coff_data (abfd)->stub == NULL)
{
bfd_release (abfd, coff_data (abfd));
return FALSE;
}
abfd->origin = coff_data (abfd)->stub_size;
return TRUE;
return coff_object_p (abfd);
}

View File

@ -1,5 +1,5 @@
/* BFD back-end for TMS320C30 coff binaries.
Copyright (C) 1998-2020 Free Software Foundation, Inc.
Copyright (C) 1998-2019 Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD back-end for TMS320C4X coff binaries.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz)

View File

@ -1,5 +1,5 @@
/* BFD back-end for TMS320C54X coff binaries.
Copyright (C) 1999-2020 Free Software Foundation, Inc.
Copyright (C) 1999-2019 Free Software Foundation, Inc.
Contributed by Timothy Wall (twall@cygnus.com)
This file is part of BFD, the Binary File Descriptor library.

711
bfd/coff-tic80.c Normal file
View File

@ -0,0 +1,711 @@
/* BFD back-end for Texas Instruments TMS320C80 Multimedia Video Processor (MVP).
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Written by Fred Fish (fnf@cygnus.com)
There is nothing new under the sun. This file draws a lot on other
coff files.
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, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#ifdef _CONST
/* Newlib-based hosts define _CONST as a STDC-safe alias for const,
but to the tic80 toolchain it means something altogether different.
Since sysdep.h will have pulled in stdio.h and hence _ansi.h which
contains this definition, we must undef it before including the
tic80-specific definition. */
#undef _CONST
#endif /* _CONST */
#include "coff/tic80.h"
#include "coff/internal.h"
#include "libcoff.h"
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
#define COFF_ALIGN_IN_SECTION_HEADER 1
#define COFF_ALIGN_IN_SFLAGS 1
#define COFF_ENCODE_ALIGNMENT(S,X) ((S).s_flags |= (((unsigned)(X) & 0xf) << 8))
#define COFF_DECODE_ALIGNMENT(X) (((X) >> 8) & 0xf)
#define GET_SCNHDR_FLAGS H_GET_16
#define PUT_SCNHDR_FLAGS H_PUT_16
static bfd_reloc_status_type ppbase_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type glob15_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type glob16_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type local16_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static reloc_howto_type tic80_howto_table[] =
{
HOWTO (R_RELLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
NULL, /* special_function */
"RELLONG", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_MPPCR, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
NULL, /* special_function */
"MPPCR", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_ABS, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
NULL, /* special_function */
"ABS", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppbase_reloc, /* special_function */
"PPBASE", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppbase_reloc, /* special_function */
"PPLBASE", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PP15, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PP15", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PP15W, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PP15W", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PP15H, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PP15H", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PP16B, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob16_reloc, /* special_function */
"PP16B", /* name */
TRUE, /* partial_inplace */
0x3ffc0, /* src_mask */
0x3ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPL15, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPL15", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPL15W, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPL15W", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPL15H, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPL15H", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPL16B, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
local16_reloc, /* special_function */
"PPL16B", /* name */
TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPN15, /* type */
0, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PPN15", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPN15W, /* type */
2, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PPN15W", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPN15H, /* type */
1, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PPN15H", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPN16B, /* type */
0, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob16_reloc, /* special_function */
"PPN16B", /* name */
TRUE, /* partial_inplace */
0x3ffc0, /* src_mask */
0x3ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLN15, /* type */
0, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPLN15", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLN15W, /* type */
2, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPLN15W", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLN15H, /* type */
1, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPLN15H", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLN16B, /* type */
0, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
local16_reloc, /* special_function */
"PPLN16B", /* name */
TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE) /* pcrel_offset */
};
/* Special relocation functions, used when the output file is not
itself a COFF TIc80 file. */
/* This special function is used for the base address type
relocations. */
static bfd_reloc_status_type
ppbase_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry ATTRIBUTE_UNUSED,
asymbol *symbol_in ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *input_section ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
/* FIXME. */
abort ();
}
/* This special function is used for the global 15 bit relocations. */
static bfd_reloc_status_type
glob15_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry ATTRIBUTE_UNUSED,
asymbol *symbol_in ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *input_section ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
/* FIXME. */
abort ();
}
/* This special function is used for the global 16 bit relocations. */
static bfd_reloc_status_type
glob16_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry ATTRIBUTE_UNUSED,
asymbol *symbol_in ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *input_section ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
/* FIXME. */
abort ();
}
/* This special function is used for the local 16 bit relocations. */
static bfd_reloc_status_type
local16_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry ATTRIBUTE_UNUSED,
asymbol *symbol_in ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *input_section ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
/* FIXME. */
abort ();
}
/* Code to turn an external r_type into a pointer to an entry in the howto_table.
If passed an r_type we don't recognize the abort rather than silently failing
to generate an output file. */
static void
rtype2howto (arelent *cache_ptr, struct internal_reloc *dst)
{
unsigned int i;
for (i = 0; i < sizeof tic80_howto_table / sizeof tic80_howto_table[0]; i++)
{
if (tic80_howto_table[i].type == dst->r_type)
{
cache_ptr->howto = tic80_howto_table + i;
return;
}
}
_bfd_error_handler (_("unsupported relocation type %#x"),
(unsigned int) dst->r_type);
cache_ptr->howto = tic80_howto_table + 0;
}
#define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst)
#define coff_rtype_to_howto coff_tic80_rtype_to_howto
static reloc_howto_type *
coff_tic80_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec,
struct internal_reloc *rel,
struct coff_link_hash_entry *h ATTRIBUTE_UNUSED,
struct internal_syment *sym ATTRIBUTE_UNUSED,
bfd_vma *addendp)
{
arelent genrel;
if (rel -> r_symndx == -1 && addendp != NULL)
{
/* This is a TI "internal relocation", which means that the relocation
amount is the amount by which the current section is being relocated
in the output section. */
*addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma;
}
RTYPE2HOWTO (&genrel, rel);
return genrel.howto;
}
#ifndef BADMAG
#define BADMAG(x) TIC80BADMAG(x)
#endif
#define coff_relocate_section coff_tic80_relocate_section
/* We need a special relocation routine to handle the PP relocs. Most
of this is a copy of _bfd_coff_generic_relocate_section. */
static bfd_boolean
coff_tic80_relocate_section (bfd *output_bfd,
struct bfd_link_info *info,
bfd *input_bfd,
asection *input_section,
bfd_byte *contents,
struct internal_reloc *relocs,
struct internal_syment *syms,
asection **sections)
{
struct internal_reloc *rel;
struct internal_reloc *relend;
rel = relocs;
relend = rel + input_section->reloc_count;
for (; rel < relend; rel++)
{
long symndx;
struct coff_link_hash_entry *h;
struct internal_syment *sym;
bfd_vma addend;
bfd_vma val;
reloc_howto_type *howto;
bfd_reloc_status_type rstat;
bfd_vma addr;
symndx = rel->r_symndx;
if (symndx == -1)
{
h = NULL;
sym = NULL;
}
else
{
h = obj_coff_sym_hashes (input_bfd)[symndx];
sym = syms + symndx;
}
/* COFF treats common symbols in one of two ways. Either the
size of the symbol is included in the section contents, or it
is not. We assume that the size is not included, and force
the rtype_to_howto function to adjust the addend as needed. */
if (sym != NULL && sym->n_scnum != 0)
addend = - sym->n_value;
else
addend = 0;
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, &addend);
if (howto == NULL)
return FALSE;
val = 0;
if (h == NULL)
{
asection *sec;
if (symndx == -1)
{
sec = bfd_abs_section_ptr;
val = 0;
}
else
{
sec = sections[symndx];
val = (sec->output_section->vma
+ sec->output_offset
+ sym->n_value);
if (! obj_pe (output_bfd))
val -= sec->vma;
}
}
else
{
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
asection *sec;
sec = h->root.u.def.section;
val = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
}
else if (! bfd_link_relocatable (info))
(*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
rel->r_vaddr - input_section->vma, TRUE);
}
addr = rel->r_vaddr - input_section->vma;
/* FIXME: This code assumes little endian, but the PP can
apparently be bi-endian. I don't know if the bi-endianness
applies to the instruction set or just to the data. */
switch (howto->type)
{
default:
case R_ABS:
case R_RELLONGX:
case R_PPL15:
case R_PPL15W:
case R_PPL15H:
case R_PPLN15:
case R_PPLN15W:
case R_PPLN15H:
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, addr, val, addend);
break;
case R_PP15:
case R_PP15W:
case R_PP15H:
case R_PPN15:
case R_PPN15W:
case R_PPN15H:
/* Offset the address so that we can use 4 byte relocations. */
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents + 2, addr, val, addend);
break;
case R_PP16B:
case R_PPN16B:
{
/* The most significant bit is stored in bit 6. */
bfd_byte hold;
hold = contents[addr + 4];
contents[addr + 4] &=~ 0x20;
contents[addr + 4] |= (contents[addr] >> 1) & 0x20;
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents + 2, addr,
val, addend);
contents[addr] &=~ 0x40;
contents[addr] |= (contents[addr + 4] << 1) & 0x40;
contents[addr + 4] &=~ 0x20;
contents[addr + 4] |= hold & 0x20;
break;
}
case R_PPL16B:
case R_PPLN16B:
{
/* The most significant bit is stored in bit 28. */
bfd_byte hold;
hold = contents[addr + 1];
contents[addr + 1] &=~ 0x80;
contents[addr + 1] |= (contents[addr + 3] << 3) & 0x80;
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, addr,
val, addend);
contents[addr + 3] &= ~0x10;
contents[addr + 3] |= (contents[addr + 1] >> 3) & 0x10;
contents[addr + 1] &=~ 0x80;
contents[addr + 1] |= hold & 0x80;
break;
}
case R_PPBASE:
/* Parameter RAM is from 0x1000000 to 0x1000800. */
contents[addr] &=~ 0x3;
if (val >= 0x1000000 && val < 0x1000800)
contents[addr] |= 0x3;
else
contents[addr] |= 0x2;
rstat = bfd_reloc_ok;
break;
case R_PPLBASE:
/* Parameter RAM is from 0x1000000 to 0x1000800. */
contents[addr + 2] &= ~0xc0;
if (val >= 0x1000000 && val < 0x1000800)
contents[addr + 2] |= 0xc0;
else
contents[addr + 2] |= 0x80;
rstat = bfd_reloc_ok;
break;
}
switch (rstat)
{
default:
abort ();
case bfd_reloc_ok:
break;
case bfd_reloc_outofrange:
_bfd_error_handler
/* xgettext: c-format */
(_("%pB: bad reloc address %#" PRIx64 " in section `%pA'"),
input_bfd, (uint64_t) rel->r_vaddr, input_section);
return FALSE;
case bfd_reloc_overflow:
{
const char *name;
char buf[SYMNMLEN + 1];
if (symndx == -1)
name = "*ABS*";
else if (h != NULL)
name = NULL;
else
{
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
if (name == NULL)
return FALSE;
}
(*info->callbacks->reloc_overflow)
(info, (h ? &h->root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd, input_section,
rel->r_vaddr - input_section->vma);
}
}
}
return TRUE;
}
#define TIC80COFF 1 /* Customize coffcode.h */
#undef C_AUTOARG /* Clashes with TIc80's C_UEXT */
#undef C_LASTENT /* Clashes with TIc80's C_STATLAB */
#ifndef bfd_pe_print_pdata
#define bfd_pe_print_pdata NULL
#endif
#include "coffcode.h"
CREATE_LITTLE_COFF_TARGET_VEC (tic80_coff_vec, "coff-tic80", D_PAGED, 0, '_', NULL, COFF_SWAP_TABLE)

View File

@ -1,5 +1,5 @@
/* BFD back-end for AMD 64 COFF files.
Copyright (C) 2006-2020 Free Software Foundation, Inc.
Copyright (C) 2006-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -824,76 +824,3 @@ const bfd_target
COFF_SWAP_TABLE
};
/* Entry for big object files. */
#ifdef COFF_WITH_PE_BIGOBJ
const bfd_target
TARGET_SYM_BIG =
{
TARGET_NAME_BIG,
bfd_target_coff_flavour,
BFD_ENDIAN_LITTLE, /* Data byte order is little. */
BFD_ENDIAN_LITTLE, /* Header byte order is little. */
(HAS_RELOC | EXEC_P /* Object flags. */
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */
#if defined(COFF_WITH_PE)
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING
#endif
| SEC_CODE | SEC_DATA | SEC_EXCLUDE ),
#ifdef TARGET_UNDERSCORE
TARGET_UNDERSCORE, /* Leading underscore. */
#else
0, /* Leading underscore. */
#endif
'/', /* Ar_pad_char. */
15, /* Ar_max_namelen. */
0, /* match priority. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Hdrs. */
/* Note that we allow an object file to be treated as a core file as well. */
{ /* bfd_check_format. */
_bfd_dummy_target,
amd64coff_object_p,
bfd_generic_archive_p,
amd64coff_object_p
},
{ /* bfd_set_format. */
_bfd_bool_bfd_false_error,
coff_mkobject,
_bfd_generic_mkarchive,
_bfd_bool_bfd_false_error
},
{ /* bfd_write_contents. */
_bfd_bool_bfd_false_error,
coff_write_object_contents,
_bfd_write_archive_contents,
_bfd_bool_bfd_false_error
},
BFD_JUMP_TABLE_GENERIC (coff),
BFD_JUMP_TABLE_COPY (coff),
BFD_JUMP_TABLE_CORE (_bfd_nocore),
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
BFD_JUMP_TABLE_SYMBOLS (coff),
BFD_JUMP_TABLE_RELOCS (coff),
BFD_JUMP_TABLE_WRITE (coff),
BFD_JUMP_TABLE_LINK (coff),
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
&bigobj_swap_table
};
#endif

View File

@ -1,5 +1,5 @@
/* BFD back-end for Zilog Z80 COFF binaries.
Copyright (C) 2005-2020 Free Software Foundation, Inc.
Copyright (C) 2005-2019 Free Software Foundation, Inc.
Contributed by Arnold Metselaar <arnold_m@operamail.com>
This file is part of BFD, the Binary File Descriptor library.
@ -26,219 +26,39 @@
#include "coff/z80.h"
#include "coff/internal.h"
#include "libcoff.h"
#include "libiberty.h"
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 0
typedef struct {
bfd_reloc_code_real_type r_type;
reloc_howto_type howto;
} bfd_howto_type;
static reloc_howto_type r_imm32 =
HOWTO (R_IMM32, 0, 2, 32, FALSE, 0,
complain_overflow_dont, 0, "r_imm32", TRUE, 0xffffffff, 0xffffffff,
FALSE);
#define BFD_EMPTY_HOWTO(rt,x) {rt, EMPTY_HOWTO(x)}
#define BFD_HOWTO(rt,a,b,c,d,e,f,g,h,i,j,k,l,m) {rt, HOWTO(a,b,c,d,e,f,g,h,i,j,k,l,m)}
static reloc_howto_type r_imm24 =
HOWTO (R_IMM24, 0, 1, 24, FALSE, 0,
complain_overflow_dont, 0, "r_imm24", TRUE, 0x00ffffff, 0x00ffffff,
FALSE);
static bfd_howto_type howto_table[] =
{
BFD_EMPTY_HOWTO (BFD_RELOC_NONE, 0),
static reloc_howto_type r_imm16 =
HOWTO (R_IMM16, 0, 1, 16, FALSE, 0,
complain_overflow_dont, 0, "r_imm16", TRUE, 0x0000ffff, 0x0000ffff,
FALSE);
BFD_HOWTO (BFD_RELOC_32,
R_IMM32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm32", /* name */
FALSE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
static reloc_howto_type r_imm8 =
HOWTO (R_IMM8, 0, 0, 8, FALSE, 0,
complain_overflow_bitfield, 0, "r_imm8", TRUE, 0x000000ff, 0x000000ff,
FALSE);
BFD_HOWTO (BFD_RELOC_24,
R_IMM24, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
24, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm24", /* name */
FALSE, /* partial_inplace */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
FALSE), /* pcrel_offset */
static reloc_howto_type r_jr =
HOWTO (R_JR, 0, 0, 8, TRUE, 0,
complain_overflow_signed, 0, "r_jr", FALSE, 0, 0xFF,
FALSE);
BFD_HOWTO (BFD_RELOC_16,
R_IMM16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm16", /* name */
FALSE, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
static reloc_howto_type r_off8 =
HOWTO (R_OFF8, 0, 0, 8, FALSE, 0,
complain_overflow_signed, 0,"r_off8", FALSE, 0, 0xff,
FALSE);
BFD_HOWTO (BFD_RELOC_8,
R_IMM8, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm8", /* name */
FALSE, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
FALSE), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_8_PCREL,
R_JR, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"r_jr", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xFF, /* dst_mask */
TRUE), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_DISP8,
R_OFF8, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"r_off8", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
FALSE), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_BYTE0,
R_BYTE0, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_byte0", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
FALSE), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_BYTE1,
R_BYTE1, /* type */
8, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_byte1", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
FALSE), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_BYTE2,
R_BYTE2, /* type */
16, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_byte2", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
FALSE), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_BYTE3,
R_BYTE3, /* type */
24, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_byte3", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
FALSE), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_WORD0,
R_WORD0, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_word0", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_WORD1,
R_WORD1, /* type */
16, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_word1", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_16_BE,
R_IMM16BE, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm16be", /* name */
FALSE, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
};
#define NUM_HOWTOS ARRAY_SIZE (howto_table)
#define BADMAG(x) Z80BADMAG(x)
#define Z80 1 /* Customize coffcode.h. */
@ -254,19 +74,34 @@ static bfd_howto_type howto_table[] =
dst->r_stuff[1] = 'C';
/* Code to turn a r_type into a howto ptr, uses the above howto table. */
static void
rtype2howto (arelent *internal, struct internal_reloc *dst)
{
unsigned i;
for (i = 0; i < NUM_HOWTOS; i++)
switch (dst->r_type)
{
if (howto_table[i].howto.type == dst->r_type)
{
internal->howto = &howto_table[i].howto;
return;
}
default:
internal->howto = NULL;
break;
case R_IMM8:
internal->howto = &r_imm8;
break;
case R_IMM16:
internal->howto = &r_imm16;
break;
case R_IMM24:
internal->howto = &r_imm24;
break;
case R_IMM32:
internal->howto = &r_imm32;
break;
case R_JR:
internal->howto = &r_jr;
break;
case R_OFF8:
internal->howto = &r_off8;
break;
}
internal->howto = NULL;
}
#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry)
@ -275,23 +110,35 @@ static reloc_howto_type *
coff_z80_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type code)
{
unsigned i;
for (i = 0; i < NUM_HOWTOS; i++)
if (howto_table[i].r_type == code)
return &howto_table[i].howto;
BFD_FAIL ();
return NULL;
switch (code)
{
case BFD_RELOC_8: return & r_imm8;
case BFD_RELOC_16: return & r_imm16;
case BFD_RELOC_24: return & r_imm24;
case BFD_RELOC_32: return & r_imm32;
case BFD_RELOC_8_PCREL: return & r_jr;
case BFD_RELOC_Z80_DISP8: return & r_off8;
default: BFD_FAIL ();
return NULL;
}
}
static reloc_howto_type *
coff_z80_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
const char *r_name)
{
unsigned i;
for (i = 0; i < NUM_HOWTOS; i++)
if (strcasecmp(howto_table[i].howto.name, r_name) == 0)
return &howto_table[i].howto;
if (strcasecmp (r_imm8.name, r_name) == 0)
return &r_imm8;
if (strcasecmp (r_imm16.name, r_name) == 0)
return &r_imm16;
if (strcasecmp (r_imm24.name, r_name) == 0)
return &r_imm24;
if (strcasecmp (r_imm32.name, r_name) == 0)
return &r_imm32;
if (strcasecmp (r_jr.name, r_name) == 0)
return &r_jr;
if (strcasecmp (r_off8.name, r_name) == 0)
return &r_off8;
return NULL;
}
@ -333,15 +180,14 @@ extra_case (bfd *in_abfd,
unsigned int *dst_ptr)
{
asection * input_section = link_order->u.indirect.section;
int val = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
int val;
switch (reloc->howto->type)
{
case R_OFF8:
if (reloc->howto->partial_inplace)
val += (signed char)(bfd_get_8 ( in_abfd, data+*src_ptr)
& reloc->howto->src_mask);
if (val>127 || val<-128) /* Test for overflow. */
val = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
if (val>127 || val<-128) /* Test for overflow. */
(*link_info->callbacks->reloc_overflow)
(link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr),
reloc->howto->name, reloc->addend, input_section->owner,
@ -352,55 +198,26 @@ extra_case (bfd *in_abfd,
(*src_ptr) += 1;
break;
case R_BYTE3:
bfd_put_8 (in_abfd, val >> 24, data + *dst_ptr);
(*dst_ptr) += 1;
(*src_ptr) += 1;
break;
case R_BYTE2:
bfd_put_8 (in_abfd, val >> 16, data + *dst_ptr);
(*dst_ptr) += 1;
(*src_ptr) += 1;
break;
case R_BYTE1:
bfd_put_8 (in_abfd, val >> 8, data + *dst_ptr);
(*dst_ptr) += 1;
(*src_ptr) += 1;
break;
case R_IMM8:
if (reloc->howto->partial_inplace)
val += bfd_get_8 ( in_abfd, data+*src_ptr) & reloc->howto->src_mask;
/* Fall through. */
case R_BYTE0:
val = bfd_get_8 ( in_abfd, data+*src_ptr)
+ bfd_coff_reloc16_get_value (reloc, link_info, input_section);
bfd_put_8 (in_abfd, val, data + *dst_ptr);
(*dst_ptr) += 1;
(*src_ptr) += 1;
break;
case R_WORD1:
bfd_put_16 (in_abfd, val >> 16, data + *dst_ptr);
(*dst_ptr) += 2;
(*src_ptr) += 2;
break;
case R_IMM16:
if (reloc->howto->partial_inplace)
val += bfd_get_16 ( in_abfd, data+*src_ptr) & reloc->howto->src_mask;
/* Fall through. */
case R_WORD0:
val = bfd_get_16 ( in_abfd, data+*src_ptr)
+ bfd_coff_reloc16_get_value (reloc, link_info, input_section);
bfd_put_16 (in_abfd, val, data + *dst_ptr);
(*dst_ptr) += 2;
(*src_ptr) += 2;
break;
case R_IMM24:
if (reloc->howto->partial_inplace)
val += (bfd_get_16 ( in_abfd, data+*src_ptr)
+ (bfd_get_8 ( in_abfd, data+*src_ptr+2) << 16))
& reloc->howto->src_mask;
val = bfd_get_16 ( in_abfd, data+*src_ptr)
+ (bfd_get_8 ( in_abfd, data+*src_ptr+2) << 16)
+ bfd_coff_reloc16_get_value (reloc, link_info, input_section);
bfd_put_16 (in_abfd, val, data + *dst_ptr);
bfd_put_8 (in_abfd, val >> 16, data + *dst_ptr+2);
(*dst_ptr) += 3;
@ -408,8 +225,8 @@ extra_case (bfd *in_abfd,
break;
case R_IMM32:
if (reloc->howto->partial_inplace)
val += bfd_get_32 ( in_abfd, data+*src_ptr) & reloc->howto->src_mask;
val = bfd_get_32 ( in_abfd, data+*src_ptr)
+ bfd_coff_reloc16_get_value (reloc, link_info, input_section);
bfd_put_32 (in_abfd, val, data + *dst_ptr);
(*dst_ptr) += 4;
(*src_ptr) += 4;
@ -417,13 +234,15 @@ extra_case (bfd *in_abfd,
case R_JR:
{
if (reloc->howto->partial_inplace)
val += (signed char)(bfd_get_8 ( in_abfd, data+*src_ptr)
& reloc->howto->src_mask);
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
bfd_vma dot = (*dst_ptr
+ input_section->output_offset
+ input_section->output_section->vma);
int gap = val - dot;
int gap = dst - dot - 1; /* -1, Since the offset is relative
to the value of PC after reading
the offset. */
if (gap >= 128 || gap < -128)
(*link_info->callbacks->reloc_overflow)
(link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr),
@ -436,32 +255,11 @@ extra_case (bfd *in_abfd,
break;
}
case R_IMM16BE:
if (reloc->howto->partial_inplace)
val += (bfd_get_8 ( in_abfd, data+*src_ptr+0) * 0x100 +
bfd_get_8 ( in_abfd, data+*src_ptr+1)) & reloc->howto->src_mask;
bfd_put_8 (in_abfd, val >> 8, data + *dst_ptr+0);
bfd_put_8 (in_abfd, val, data + *dst_ptr+1);
(*dst_ptr) += 2;
(*src_ptr) += 2;
break;
default:
abort ();
}
}
static int
z80_is_local_label_name (bfd * abfd ATTRIBUTE_UNUSED,
const char * name)
{
return (name[0] == '.' && name[1] == 'L') ||
_bfd_coff_is_local_label_name (abfd, name);
}
#define coff_bfd_is_local_label_name z80_is_local_label_name
#define coff_reloc16_extra_cases extra_case
#define coff_bfd_reloc_type_lookup coff_z80_reloc_type_lookup
#define coff_bfd_reloc_name_lookup coff_z80_reloc_name_lookup

View File

@ -1,5 +1,5 @@
/* BFD back-end for Zilog Z800n COFF binaries.
Copyright (C) 1992-2020 Free Software Foundation, Inc.
Copyright (C) 1992-2019 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain, <sac@cygnus.com>.

View File

@ -1,5 +1,5 @@
/* BFD back-end for IBM RS/6000 "XCOFF64" files.
Copyright (C) 2000-2020 Free Software Foundation, Inc.
Copyright (C) 2000-2019 Free Software Foundation, Inc.
Written Clinton Popetz.
Contributed by Cygnus Support.
@ -155,7 +155,7 @@ static bfd_boolean xcoff64_ppc_relocate_section
asection **);
static bfd_boolean xcoff64_slurp_armap
(bfd *);
static bfd_cleanup xcoff64_archive_p
static const bfd_target *xcoff64_archive_p
(bfd *);
static bfd *xcoff64_openr_next_archived_file
(bfd *, bfd *);
@ -238,7 +238,7 @@ bfd_boolean (*xcoff64_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION])
#define coff_bfd_reloc_type_lookup xcoff64_reloc_type_lookup
#define coff_bfd_reloc_name_lookup xcoff64_reloc_name_lookup
#ifdef AIX_CORE
extern bfd_cleanup rs6000coff_core_p
extern const bfd_target * rs6000coff_core_p
(bfd *abfd);
extern bfd_boolean rs6000coff_core_file_matches_executable_p
(bfd *cbfd, bfd *ebfd);
@ -1249,11 +1249,10 @@ xcoff64_ppc_relocate_section (bfd *output_bfd,
{
if (info->unresolved_syms_in_objects != RM_IGNORE
&& (h->flags & XCOFF_WAS_UNDEFINED) != 0)
info->callbacks->undefined_symbol
(*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
rel->r_vaddr - input_section->vma,
info->unresolved_syms_in_objects == RM_DIAGNOSE
&& !info->warn_unresolved_syms);
info->unresolved_syms_in_objects == RM_GENERATE_ERROR);
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
@ -1934,25 +1933,18 @@ xcoff64_slurp_armap (bfd *abfd)
return FALSE;
sz = bfd_scan_vma (hdr.size, (const char **) NULL, 10);
if (sz + 1 < 9)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
/* Read in the entire symbol table. */
contents = (bfd_byte *) _bfd_alloc_and_read (abfd, sz + 1, sz);
contents = (bfd_byte *) bfd_alloc (abfd, sz);
if (contents == NULL)
return FALSE;
/* Ensure strings are NULL terminated so we don't wander off the end
of the buffer. */
contents[sz] = 0;
if (bfd_bread (contents, sz, abfd) != sz)
return FALSE;
/* The symbol table starts with an eight byte count. */
c = H_GET_64 (abfd, contents);
if (c >= sz / 8)
if (c * 8 >= sz)
{
bfd_set_error (bfd_error_bad_value);
return FALSE;
@ -1992,14 +1984,14 @@ xcoff64_slurp_armap (bfd *abfd)
/* See if this is an NEW XCOFF archive. */
static bfd_cleanup
static const bfd_target *
xcoff64_archive_p (bfd *abfd)
{
struct artdata *tdata_hold;
char magic[SXCOFFARMAG];
/* This is the new format. */
struct xcoff_ar_file_hdr_big hdr;
size_t amt = SXCOFFARMAG;
bfd_size_type amt = SXCOFFARMAG;
if (bfd_bread (magic, amt, abfd) != amt)
{
@ -2059,7 +2051,7 @@ xcoff64_archive_p (bfd *abfd)
return NULL;
}
return _bfd_no_cleanup;
return abfd->xvec;
}
@ -2806,7 +2798,7 @@ const bfd_target rs6000_xcoff64_vec =
&bfd_xcoff_backend_data,
};
extern bfd_cleanup xcoff64_core_p
extern const bfd_target *xcoff64_core_p
(bfd *);
extern bfd_boolean xcoff64_core_file_matches_executable_p
(bfd *, bfd *);

View File

@ -1,5 +1,5 @@
/* Support for the generic parts of most COFF variants, for BFD.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -364,10 +364,6 @@ CODE_FRAGMENT
#define GNU_LINKONCE_WT ".gnu.linkonce.wt."
#define DOT_RELOC ".reloc"
#if defined(COFF_WITH_PE) || defined(COFF_GO32_EXE) || defined(COFF_GO32)
# define COFF_WITH_EXTENDED_RELOC_COUNTER
#endif
#if defined (COFF_LONG_SECTION_NAMES)
/* Needed to expand the inputs to BLANKOR1TOODD. */
#define COFFLONGSECTIONCATHELPER(x,y) x ## y
@ -721,7 +717,7 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
#ifndef COFF_WITH_PE
static bfd_boolean
styp_to_sec_flags (bfd *abfd,
styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
void * hdr,
const char *name,
asection *section ATTRIBUTE_UNUSED,
@ -854,11 +850,6 @@ styp_to_sec_flags (bfd *abfd,
sec_flags = (SEC_LOAD | SEC_ALLOC);
#endif /* STYP_SDATA */
if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0
&& (CONST_STRNEQ (name, ".sbss")
|| CONST_STRNEQ (name, ".sdata")))
sec_flags |= SEC_SMALL_DATA;
#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
/* As a GNU extension, if the name begins with .gnu.linkonce, we
only link a single copy of the section. This is used to support
@ -1118,7 +1109,7 @@ handle_COMDAT (bfd * abfd,
drop through from the above). */
{
char *newname;
size_t amt;
bfd_size_type amt;
/* This must the second symbol with the
section #. It is the actual symbol name.
@ -1321,11 +1312,6 @@ styp_to_sec_flags (bfd *abfd,
}
}
if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0
&& (CONST_STRNEQ (name, ".sbss")
|| CONST_STRNEQ (name, ".sdata")))
sec_flags |= SEC_SMALL_DATA;
#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
/* As a GNU extension, if the name begins with .gnu.linkonce, we
only link a single copy of the section. This is used to support
@ -1766,7 +1752,7 @@ static bfd_boolean
coff_new_section_hook (bfd * abfd, asection * section)
{
combined_entry_type *native;
size_t amt;
bfd_size_type amt;
unsigned char sclass = C_STAT;
section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
@ -1857,7 +1843,7 @@ coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED,
void * scnhdr)
{
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
size_t amt;
bfd_size_type amt;
unsigned int alignment_power_const
= hdr->s_flags & IMAGE_SCN_ALIGN_POWER_BIT_MASK;
@ -1968,39 +1954,6 @@ coff_set_alignment_hook (bfd *abfd, asection *section, void * scnhdr)
}
#else /* ! RS6000COFF_C */
#if defined (COFF_GO32_EXE) || defined (COFF_GO32)
static void
coff_set_alignment_hook (bfd * abfd, asection * section, void * scnhdr)
{
struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr;
/* Check for extended relocs. */
if (hdr->s_flags & IMAGE_SCN_LNK_NRELOC_OVFL)
{
struct external_reloc dst;
struct internal_reloc n;
const file_ptr oldpos = bfd_tell (abfd);
const bfd_size_type relsz = bfd_coff_relsz (abfd);
if (bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0) != 0)
return;
if (bfd_bread (& dst, relsz, abfd) != relsz)
return;
coff_swap_reloc_in (abfd, &dst, &n);
if (bfd_seek (abfd, oldpos, 0) != 0)
return;
section->reloc_count = hdr->s_nreloc = n.r_vaddr - 1;
section->rel_filepos += relsz;
}
else if (hdr->s_nreloc == 0xffff)
_bfd_error_handler
(_("%pB: warning: claims to have 0xffff relocs, without overflow"),
abfd);
}
#else /* ! COFF_GO32_EXE && ! COFF_GO32 */
static void
coff_set_alignment_hook (bfd *abfd ATTRIBUTE_UNUSED,
@ -2009,7 +1962,6 @@ coff_set_alignment_hook (bfd *abfd ATTRIBUTE_UNUSED,
{
}
#endif /* ! COFF_GO32_EXE && ! COFF_GO32 */
#endif /* ! RS6000COFF_C */
#endif /* ! COFF_WITH_PE */
#endif /* ! COFF_ALIGN_IN_SECTION_HEADER */
@ -2020,7 +1972,7 @@ static bfd_boolean
coff_mkobject (bfd * abfd)
{
coff_data_type *coff;
size_t amt = sizeof (coff_data_type);
bfd_size_type amt = sizeof (coff_data_type);
abfd->tdata.coff_obj_data = bfd_zalloc (abfd, amt);
if (abfd->tdata.coff_obj_data == NULL)
@ -2114,6 +2066,15 @@ coff_mkobject_hook (bfd * abfd,
abfd->flags |= HAS_DEBUG;
#endif
if ((internal_f->f_flags & F_GO32STUB) != 0)
{
coff->go32stub = (char *) bfd_alloc (abfd, (bfd_size_type) GO32_STUBSIZE);
if (coff->go32stub == NULL)
return NULL;
}
if (coff->go32stub != NULL)
memcpy (coff->go32stub, internal_f->go32stub, GO32_STUBSIZE);
return coff;
}
#endif
@ -2200,15 +2161,11 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
arch = bfd_arch_z80;
switch (internal_f->f_flags & F_MACHMASK)
{
case 0:
case bfd_mach_z80strict << 12:
case bfd_mach_z80 << 12:
case bfd_mach_z80n << 12:
case bfd_mach_z80full << 12:
case bfd_mach_r800 << 12:
case bfd_mach_gbz80 << 12:
case bfd_mach_z180 << 12:
case bfd_mach_ez80_z80 << 12:
case bfd_mach_ez80_adl << 12:
machine = ((unsigned)internal_f->f_flags & F_MACHMASK) >> 12;
break;
default:
@ -2261,11 +2218,15 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
struct internal_syment sym;
bfd_size_type amt = bfd_coff_symesz (abfd);
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
return FALSE;
buf = _bfd_malloc_and_read (abfd, amt, amt);
buf = bfd_malloc (amt);
if (buf == NULL)
return FALSE;
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
|| bfd_bread (buf, amt, abfd) != amt)
{
free (buf);
return FALSE;
}
bfd_coff_swap_sym_in (abfd, buf, & sym);
if (sym.n_sclass == C_FILE)
cputype = sym.n_type & 0xff;
@ -2369,6 +2330,12 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
break;
#endif
#ifdef TIC80_ARCH_MAGIC
case TIC80_ARCH_MAGIC:
arch = bfd_arch_tic80;
break;
#endif
#ifdef MCOREMAGIC
case MCOREMAGIC:
arch = bfd_arch_mcore;
@ -2559,8 +2526,8 @@ coff_write_relocs (bfd * abfd, int first_undef)
if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0)
return FALSE;
#ifdef COFF_WITH_EXTENDED_RELOC_COUNTER
if ((obj_pe (abfd) || obj_go32 (abfd)) && s->reloc_count >= 0xffff)
#ifdef COFF_WITH_PE
if (obj_pe (abfd) && s->reloc_count >= 0xffff)
{
/* Encode real count here as first reloc. */
struct internal_reloc n;
@ -2666,7 +2633,8 @@ coff_write_relocs (bfd * abfd, int first_undef)
}
#ifdef TARG_AUX
free (p);
if (p != NULL)
free (p);
#endif
}
@ -2688,15 +2656,11 @@ coff_set_flags (bfd * abfd,
*magicp = Z80MAGIC;
switch (bfd_get_mach (abfd))
{
case 0:
case bfd_mach_z80strict:
case bfd_mach_z80:
case bfd_mach_z80n:
case bfd_mach_z80full:
case bfd_mach_r800:
case bfd_mach_gbz80:
case bfd_mach_z180:
case bfd_mach_ez80_z80:
case bfd_mach_ez80_adl:
*flagsp = bfd_get_mach (abfd) << 12;
break;
default:
@ -2751,6 +2715,12 @@ coff_set_flags (bfd * abfd,
return TRUE;
#endif
#ifdef TIC80_ARCH_MAGIC
case bfd_arch_tic80:
*magicp = TIC80_ARCH_MAGIC;
return TRUE;
#endif
#ifdef ARMMAGIC
case bfd_arch_arm:
#ifdef ARM_WINCE
@ -2913,7 +2883,7 @@ sort_by_secaddr (const void * arg1, const void * arg2)
/* Calculate the file position for each section. */
#define ALIGN_SECTIONS_IN_FILE
#ifdef TICOFF
#if defined(TIC80COFF) || defined(TICOFF)
#undef ALIGN_SECTIONS_IN_FILE
#endif
@ -3122,7 +3092,7 @@ coff_compute_section_file_positions (bfd * abfd)
page size too, and remember both sizes. */
if (coff_section_data (abfd, current) == NULL)
{
size_t amt = sizeof (struct coff_section_tdata);
bfd_size_type amt = sizeof (struct coff_section_tdata);
current->used_by_bfd = bfd_zalloc (abfd, amt);
if (current->used_by_bfd == NULL)
@ -3130,7 +3100,7 @@ coff_compute_section_file_positions (bfd * abfd)
}
if (pei_section_data (abfd, current) == NULL)
{
size_t amt = sizeof (struct pei_section_tdata);
bfd_size_type amt = sizeof (struct pei_section_tdata);
coff_section_data (abfd, current)->tdata = bfd_zalloc (abfd, amt);
if (coff_section_data (abfd, current)->tdata == NULL)
@ -3419,9 +3389,9 @@ coff_write_object_contents (bfd * abfd)
for (current = abfd->sections; current != NULL; current =
current->next)
{
#ifdef COFF_WITH_EXTENDED_RELOC_COUNTER
#ifdef COFF_WITH_PE
/* We store the actual reloc count in the first reloc's addr. */
if ((obj_pe (abfd) || obj_go32 (abfd)) && current->reloc_count >= 0xffff)
if (obj_pe (abfd) && current->reloc_count >= 0xffff)
reloc_count ++;
#endif
reloc_count += current->reloc_count;
@ -3449,9 +3419,9 @@ coff_write_object_contents (bfd * abfd)
{
current->rel_filepos = reloc_base;
reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
#ifdef COFF_WITH_EXTENDED_RELOC_COUNTER
#ifdef COFF_WITH_PE
/* Extra reloc to hold real count. */
if ((obj_pe (abfd) || obj_go32 (abfd)) && current->reloc_count >= 0xffff)
if (obj_pe (abfd) && current->reloc_count >= 0xffff)
reloc_base += bfd_coff_relsz (abfd);
#endif
}
@ -3652,7 +3622,7 @@ coff_write_object_contents (bfd * abfd)
SCNHDR buff;
bfd_size_type amt = bfd_coff_scnhsz (abfd);
if (bfd_coff_swap_scnhdr_out (abfd, &section, &buff) == 0
if (coff_swap_scnhdr_out (abfd, &section, &buff) == 0
|| bfd_bwrite (& buff, amt, abfd) != amt)
return FALSE;
}
@ -3778,7 +3748,7 @@ coff_write_object_contents (bfd * abfd)
scnhdr.s_nlnno = current->target_index;
scnhdr.s_flags = STYP_OVRFLO;
amt = bfd_coff_scnhsz (abfd);
if (bfd_coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
|| bfd_bwrite (& buff, amt, abfd) != amt)
return FALSE;
}
@ -3786,22 +3756,6 @@ coff_write_object_contents (bfd * abfd)
#endif
#endif
#if defined (COFF_GO32_EXE) || defined (COFF_GO32)
/* Pad section headers. */
if ((abfd->flags & EXEC_P) && abfd->sections != NULL)
{
file_ptr cur_ptr = scn_base
+ abfd->section_count * bfd_coff_scnhsz (abfd);
long fill_size = (abfd->sections->filepos - cur_ptr);
bfd_byte *b = bfd_zmalloc (fill_size);
if (b)
{
bfd_bwrite ((PTR)b, fill_size, abfd);
free (b);
}
}
#endif
/* OK, now set up the filehdr... */
/* Don't include the internal abs section in the section count */
@ -3857,6 +3811,9 @@ coff_write_object_contents (bfd * abfd)
but it doesn't hurt to set it internally. */
internal_f.f_target_id = TI_TARGET_ID;
#endif
#ifdef TIC80_TARGET_ID
internal_f.f_target_id = TIC80_TARGET_ID;
#endif
/* FIXME, should do something about the other byte orders and
architectures. */
@ -3884,6 +3841,10 @@ coff_write_object_contents (bfd * abfd)
internal_a.magic = TICOFF_AOUT_MAGIC;
#define __A_MAGIC_SET__
#endif
#ifdef TIC80COFF
internal_a.magic = TIC80_ARCH_MAGIC;
#define __A_MAGIC_SET__
#endif /* TIC80 */
#if defined(ARM)
#define __A_MAGIC_SET__
@ -4250,16 +4211,15 @@ static void *
buy_and_read (bfd *abfd, file_ptr where,
bfd_size_type nmemb, bfd_size_type size)
{
size_t amt;
void *area = bfd_alloc2 (abfd, nmemb, size);
if (_bfd_mul_overflow (nmemb, size, &amt))
{
bfd_set_error (bfd_error_file_too_big);
return NULL;
}
if (bfd_seek (abfd, where, SEEK_SET) != 0)
if (!area)
return NULL;
return _bfd_alloc_and_read (abfd, amt, amt);
size *= nmemb;
if (bfd_seek (abfd, where, SEEK_SET) != 0
|| bfd_bread (area, size, abfd) != size)
return NULL;
return area;
}
/*
@ -4316,7 +4276,6 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
LINENO *src;
bfd_boolean have_func;
bfd_boolean ret = TRUE;
size_t amt;
if (asect->lineno_count == 0)
return TRUE;
@ -4331,12 +4290,9 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
return FALSE;
}
if (_bfd_mul_overflow (asect->lineno_count + 1, sizeof (alent), &amt))
{
bfd_set_error (bfd_error_file_too_big);
return FALSE;
}
lineno_cache = (alent *) bfd_alloc (abfd, amt);
lineno_cache = (alent *) bfd_alloc2 (abfd,
(bfd_size_type) asect->lineno_count + 1,
sizeof (alent));
if (lineno_cache == NULL)
return FALSE;
@ -4450,12 +4406,8 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
alent *n_lineno_cache;
/* Create a table of functions. */
if (_bfd_mul_overflow (nbr_func, sizeof (alent *), &amt))
{
bfd_set_error (bfd_error_file_too_big);
ret = FALSE;
}
else if ((func_table = (alent **) bfd_alloc (abfd, amt)) != NULL)
func_table = (alent **) bfd_alloc2 (abfd, nbr_func, sizeof (alent *));
if (func_table != NULL)
{
alent **p = func_table;
unsigned int i;
@ -4470,12 +4422,9 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
qsort (func_table, nbr_func, sizeof (alent *), coff_sort_func_alent);
/* Create the new sorted table. */
if (_bfd_mul_overflow (asect->lineno_count, sizeof (alent), &amt))
{
bfd_set_error (bfd_error_file_too_big);
ret = FALSE;
}
else if ((n_lineno_cache = (alent *) bfd_alloc (abfd, amt)) != NULL)
n_lineno_cache = (alent *) bfd_alloc2 (abfd, asect->lineno_count,
sizeof (alent));
if (n_lineno_cache != NULL)
{
alent *n_cache_ptr = n_lineno_cache;
@ -4521,7 +4470,6 @@ coff_slurp_symbol_table (bfd * abfd)
unsigned int *table_ptr;
unsigned int number_of_symbols = 0;
bfd_boolean ret = TRUE;
size_t amt;
if (obj_symbols (abfd))
return TRUE;
@ -4531,23 +4479,15 @@ coff_slurp_symbol_table (bfd * abfd)
return FALSE;
/* Allocate enough room for all the symbols in cached form. */
if (_bfd_mul_overflow (obj_raw_syment_count (abfd),
sizeof (*cached_area), &amt))
{
bfd_set_error (bfd_error_file_too_big);
return FALSE;
}
cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt);
cached_area = (coff_symbol_type *) bfd_alloc2 (abfd,
obj_raw_syment_count (abfd),
sizeof (coff_symbol_type));
if (cached_area == NULL)
return FALSE;
if (_bfd_mul_overflow (obj_raw_syment_count (abfd),
sizeof (*table_ptr), &amt))
{
bfd_set_error (bfd_error_file_too_big);
return FALSE;
}
table_ptr = (unsigned int *) bfd_zalloc (abfd, amt);
table_ptr = (unsigned int *) bfd_zalloc2 (abfd, obj_raw_syment_count (abfd),
sizeof (unsigned int));
if (table_ptr == NULL)
return FALSE;
else
@ -4835,7 +4775,7 @@ coff_slurp_symbol_table (bfd * abfd)
case C_ALIAS: /* Duplicate tag. */
#endif
/* New storage classes for TI COFF. */
#ifdef TICOFF
#if defined(TIC80COFF) || defined(TICOFF)
case C_UEXT: /* Tentative external definition. */
#endif
case C_EXTLAB: /* External load time label. */
@ -5034,7 +4974,6 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols)
arelent *reloc_cache;
arelent *cache_ptr;
unsigned int idx;
size_t amt;
if (asect->relocation)
return TRUE;
@ -5048,12 +4987,9 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols)
native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos,
asect->reloc_count,
bfd_coff_relsz (abfd));
if (_bfd_mul_overflow (asect->reloc_count, sizeof (arelent), &amt))
{
bfd_set_error (bfd_error_file_too_big);
return FALSE;
}
reloc_cache = (arelent *) bfd_alloc (abfd, amt);
reloc_cache = (arelent *) bfd_alloc2 (abfd, asect->reloc_count,
sizeof (arelent));
if (reloc_cache == NULL || native_relocs == NULL)
return FALSE;
@ -5725,7 +5661,7 @@ static bfd_coff_backend_data bigobj_swap_table =
#endif /* COFF_WITH_PE_BIGOBJ */
#ifndef coff_close_and_cleanup
#define coff_close_and_cleanup _bfd_coff_close_and_cleanup
#define coff_close_and_cleanup _bfd_generic_close_and_cleanup
#endif
#ifndef coff_bfd_free_cached_info

View File

@ -1,5 +1,5 @@
/* Support for the generic parts of COFF, for BFD.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -225,12 +225,12 @@ make_a_section_from_file (bfd *abfd,
/* Read in a COFF object and make it into a BFD. This is used by
ECOFF as well. */
bfd_cleanup
const bfd_target *
coff_real_object_p (bfd *,
unsigned,
struct internal_filehdr *,
struct internal_aouthdr *);
bfd_cleanup
const bfd_target *
coff_real_object_p (bfd *abfd,
unsigned nscns,
struct internal_filehdr *internal_f,
@ -275,10 +275,13 @@ coff_real_object_p (bfd *abfd,
scnhsz = bfd_coff_scnhsz (abfd);
readsize = (bfd_size_type) nscns * scnhsz;
external_sections = (char *) _bfd_alloc_and_read (abfd, readsize, readsize);
external_sections = (char *) bfd_alloc (abfd, readsize);
if (!external_sections)
goto fail;
if (bfd_bread ((void *) external_sections, readsize, abfd) != readsize)
goto fail;
/* Set the arch/mach *before* swapping in sections; section header swapping
may depend on arch/mach info. */
if (! bfd_coff_set_arch_mach_hook (abfd, (void *) internal_f))
@ -299,23 +302,21 @@ coff_real_object_p (bfd *abfd,
}
}
_bfd_coff_free_symbols (abfd);
return _bfd_no_cleanup;
return abfd->xvec;
fail:
_bfd_coff_free_symbols (abfd);
bfd_release (abfd, tdata);
fail2:
abfd->tdata.any = tdata_save;
abfd->flags = oflags;
abfd->start_address = ostart;
return NULL;
return (const bfd_target *) NULL;
}
/* Turn a COFF file into a BFD, but fail with bfd_error_wrong_format if it is
not a COFF file. This is also used by ECOFF. */
bfd_cleanup
const bfd_target *
coff_object_p (bfd *abfd)
{
bfd_size_type filhsz;
@ -329,11 +330,14 @@ coff_object_p (bfd *abfd)
filhsz = bfd_coff_filhsz (abfd);
aoutsz = bfd_coff_aoutsz (abfd);
filehdr = _bfd_alloc_and_read (abfd, filhsz, filhsz);
filehdr = bfd_alloc (abfd, filhsz);
if (filehdr == NULL)
return NULL;
if (bfd_bread (filehdr, filhsz, abfd) != filhsz)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
bfd_release (abfd, filehdr);
return NULL;
}
bfd_coff_swap_filehdr_in (abfd, filehdr, &internal_f);
@ -359,13 +363,18 @@ coff_object_p (bfd *abfd)
{
void * opthdr;
opthdr = _bfd_alloc_and_read (abfd, aoutsz, internal_f.f_opthdr);
opthdr = bfd_alloc (abfd, aoutsz);
if (opthdr == NULL)
return NULL;
if (bfd_bread (opthdr, (bfd_size_type) internal_f.f_opthdr, abfd)
!= internal_f.f_opthdr)
{
bfd_release (abfd, opthdr);
return NULL;
}
/* PR 17512: file: 11056-1136-0.004. */
if (internal_f.f_opthdr < aoutsz)
memset (((char *) opthdr) + internal_f.f_opthdr, 0,
aoutsz - internal_f.f_opthdr);
memset (((char *) opthdr) + internal_f.f_opthdr, 0, aoutsz - internal_f.f_opthdr);
bfd_coff_swap_aouthdr_in (abfd, opthdr, (void *) &internal_a);
bfd_release (abfd, opthdr);
@ -544,8 +553,11 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
for (; erel < erel_end; erel += relsz, irel++)
bfd_coff_swap_reloc_in (abfd, (void *) erel, (void *) irel);
free (free_external);
free_external = NULL;
if (free_external != NULL)
{
free (free_external);
free_external = NULL;
}
if (cache && free_internal != NULL)
{
@ -563,8 +575,10 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
return internal_relocs;
error_return:
free (free_external);
free (free_internal);
if (free_external != NULL)
free (free_external);
if (free_internal != NULL)
free (free_internal);
return NULL;
}
@ -1577,20 +1591,19 @@ build_debug_section (bfd *abfd, asection ** sect_return)
return NULL;
}
sec_size = sect->size;
debug_section = (char *) bfd_alloc (abfd, sec_size);
if (debug_section == NULL)
return NULL;
/* Seek to the beginning of the `.debug' section and read it.
Save the current position first; it is needed by our caller.
Then read debug section and reset the file pointer. */
position = bfd_tell (abfd);
if (bfd_seek (abfd, sect->filepos, SEEK_SET) != 0)
return NULL;
sec_size = sect->size;
debug_section = (char *) _bfd_alloc_and_read (abfd, sec_size, sec_size);
if (debug_section == NULL)
return NULL;
if (bfd_seek (abfd, position, SEEK_SET) != 0)
if (bfd_seek (abfd, sect->filepos, SEEK_SET) != 0
|| bfd_bread (debug_section, sec_size, abfd) != sec_size
|| bfd_seek (abfd, position, SEEK_SET) != 0)
return NULL;
* sect_return = sect;
@ -1624,28 +1637,50 @@ copy_name (bfd *abfd, char *name, size_t maxlen)
bfd_boolean
_bfd_coff_get_external_symbols (bfd *abfd)
{
size_t symesz;
size_t size;
bfd_size_type symesz;
bfd_size_type size;
void * syms;
if (obj_coff_external_syms (abfd) != NULL)
return TRUE;
symesz = bfd_coff_symesz (abfd);
if (_bfd_mul_overflow (obj_raw_syment_count (abfd), symesz, &size))
size = obj_raw_syment_count (abfd) * symesz;
if (size == 0)
return TRUE;
/* Check for integer overflow and for unreasonable symbol counts. */
if (size < obj_raw_syment_count (abfd)
|| (bfd_get_file_size (abfd) > 0
&& size > bfd_get_file_size (abfd)))
{
bfd_set_error (bfd_error_file_truncated);
_bfd_error_handler (_("%pB: corrupt symbol count: %#" PRIx64 ""),
abfd, (uint64_t) obj_raw_syment_count (abfd));
return FALSE;
}
if (size == 0)
return TRUE;
syms = bfd_malloc (size);
if (syms == NULL)
{
/* PR 21013: Provide an error message when the alloc fails. */
_bfd_error_handler (_("%pB: not enough memory to allocate space "
"for %#" PRIx64 " symbols of size %#" PRIx64),
abfd, (uint64_t) obj_raw_syment_count (abfd),
(uint64_t) symesz);
return FALSE;
}
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
|| bfd_bread (syms, size, abfd) != size)
{
if (syms != NULL)
free (syms);
return FALSE;
}
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
return FALSE;
syms = _bfd_malloc_and_read (abfd, size, size);
obj_coff_external_syms (abfd) = syms;
return syms != NULL;
return TRUE;
}
/* Read in the external strings. The strings are not loaded until
@ -1661,7 +1696,6 @@ _bfd_coff_read_string_table (bfd *abfd)
bfd_size_type strsize;
char *strings;
file_ptr pos;
ufile_ptr filesize;
if (obj_coff_strings (abfd) != NULL)
return obj_coff_strings (abfd);
@ -1695,9 +1729,7 @@ _bfd_coff_read_string_table (bfd *abfd)
#endif
}
filesize = bfd_get_file_size (abfd);
if (strsize < STRING_SIZE_SIZE
|| (filesize != 0 && strsize > filesize))
if (strsize < STRING_SIZE_SIZE || strsize > bfd_get_file_size (abfd))
{
_bfd_error_handler
/* xgettext: c-format */
@ -1813,13 +1845,6 @@ coff_get_normalized_symtab (bfd *abfd)
symbol_ptr = internal_ptr;
internal_ptr->is_sym = TRUE;
/* PR 17512: Prevent buffer overrun. */
if (symbol_ptr->u.syment.n_numaux > ((raw_end - 1) - raw_src) / symesz)
{
bfd_release (abfd, internal);
return NULL;
}
for (i = 0;
i < symbol_ptr->u.syment.n_numaux;
i++)
@ -1827,6 +1852,13 @@ coff_get_normalized_symtab (bfd *abfd)
internal_ptr++;
raw_src += symesz;
/* PR 17512: Prevent buffer overrun. */
if (raw_src >= raw_end || internal_ptr >= internal_end)
{
bfd_release (abfd, internal);
return NULL;
}
bfd_coff_swap_aux_in (abfd, (void *) raw_src,
symbol_ptr->u.syment.n_type,
symbol_ptr->u.syment.n_sclass,
@ -1839,13 +1871,10 @@ coff_get_normalized_symtab (bfd *abfd)
}
}
/* Free the raw symbols. */
if (obj_coff_external_syms (abfd) != NULL
&& ! obj_coff_keep_syms (abfd))
{
free (obj_coff_external_syms (abfd));
obj_coff_external_syms (abfd) = NULL;
}
/* Free the raw symbols, but not the strings (if we have them). */
obj_coff_keep_strings (abfd) = TRUE;
if (! _bfd_coff_free_symbols (abfd))
return NULL;
for (internal_ptr = internal; internal_ptr < internal_end;
internal_ptr++)
@ -1991,7 +2020,7 @@ coff_get_reloc_upper_bound (bfd *abfd, sec_ptr asect)
asymbol *
coff_make_empty_symbol (bfd *abfd)
{
size_t amt = sizeof (coff_symbol_type);
bfd_size_type amt = sizeof (coff_symbol_type);
coff_symbol_type *new_symbol = (coff_symbol_type *) bfd_zalloc (abfd, amt);
if (new_symbol == NULL)
@ -2012,7 +2041,7 @@ coff_bfd_make_debug_symbol (bfd *abfd,
void * ptr ATTRIBUTE_UNUSED,
unsigned long sz ATTRIBUTE_UNUSED)
{
size_t amt = sizeof (coff_symbol_type);
bfd_size_type amt = sizeof (coff_symbol_type);
coff_symbol_type *new_symbol = (coff_symbol_type *) bfd_alloc (abfd, amt);
if (new_symbol == NULL)
@ -2237,7 +2266,7 @@ coff_find_nearest_line_with_names (bfd *abfd,
combined_entry_type *pend;
alent *l;
struct coff_section_tdata *sec_data;
size_t amt;
bfd_size_type amt;
/* Before looking through the symbol table, try to use a .stab
section to find the information. */
@ -2435,15 +2464,11 @@ coff_find_nearest_line_with_names (bfd *abfd,
/* In XCOFF a debugging symbol can follow the
function symbol. */
if (((size_t) ((char *) s - (char *) obj_raw_syments (abfd))
< obj_raw_syment_count (abfd) * sizeof (*s))
&& s->u.syment.n_scnum == N_DEBUG)
if (s->u.syment.n_scnum == N_DEBUG)
s = s + 1 + s->u.syment.n_numaux;
/* S should now point to the .bf of the function. */
if (((size_t) ((char *) s - (char *) obj_raw_syments (abfd))
< obj_raw_syment_count (abfd) * sizeof (*s))
&& s->u.syment.n_numaux)
if (s->u.syment.n_numaux)
{
/* The linenumber is stored in the auxent. */
union internal_auxent *a = &((s + 1)->u.auxent);
@ -2564,7 +2589,7 @@ bfd_coff_set_symbol_class (bfd * abfd,
coff_write_alien_symbol(). */
combined_entry_type * native;
size_t amt = sizeof (* native);
bfd_size_type amt = sizeof (* native);
native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (native == NULL)
@ -3136,20 +3161,3 @@ bfd_coff_group_name (bfd *abfd, const asection *sec)
return ci->name;
return NULL;
}
bfd_boolean
_bfd_coff_close_and_cleanup (bfd *abfd)
{
if (abfd->format == bfd_object
&& bfd_family_coff (abfd)
&& coff_data (abfd) != NULL)
{
/* PR 25447:
Do not clear the keep_syms and keep_strings flags.
These may have been set by pe_ILF_build_a_bfd() indicating
that the syms and strings pointers are not to be freed. */
if (!_bfd_coff_free_symbols (abfd))
return FALSE;
}
return _bfd_generic_close_and_cleanup (abfd);
}

View File

@ -1,5 +1,5 @@
/* COFF specific linker code.
Copyright (C) 1994-2020 Free Software Foundation, Inc.
Copyright (C) 1994-2019 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -109,7 +109,7 @@ struct bfd_link_hash_table *
_bfd_coff_link_hash_table_create (bfd *abfd)
{
struct coff_link_hash_table *ret;
size_t amt = sizeof (struct coff_link_hash_table);
bfd_size_type amt = sizeof (struct coff_link_hash_table);
ret = (struct coff_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
@ -212,12 +212,6 @@ coff_link_check_archive_element (bfd *abfd,
if (h->type != bfd_link_hash_undefined)
return TRUE;
/* If the archive element has already been loaded then one
of the symbols defined by that element might have been
made undefined due to being in a discarded section. */
if (((struct coff_link_hash_entry *) h)->indx == -3)
return TRUE;
/* PR 22369 - Skip non COFF objects in the archive. */
if (! bfd_family_coff (abfd))
return TRUE;
@ -292,7 +286,6 @@ coff_link_add_symbols (bfd *abfd,
asection *section;
bfd_vma value;
bfd_boolean addit;
bfd_boolean discarded = FALSE;
/* This symbol is externally visible. */
@ -318,10 +311,7 @@ coff_link_add_symbols (bfd *abfd,
flags = BSF_EXPORT | BSF_GLOBAL;
section = coff_section_from_bfd_index (abfd, sym.n_scnum);
if (discarded_section (section))
{
discarded = TRUE;
section = bfd_und_section_ptr;
}
section = bfd_und_section_ptr;
else if (! obj_pe (abfd))
value -= section->vma;
break;
@ -418,9 +408,6 @@ coff_link_add_symbols (bfd *abfd,
(const char *) NULL, copy, FALSE,
(struct bfd_link_hash_entry **) sym_hash)))
goto error_return;
if (discarded)
(*sym_hash)->indx = -3;
}
if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
@ -702,7 +689,7 @@ _bfd_coff_final_link (bfd *abfd,
rel_filepos += o->reloc_count * relsz;
/* In PE COFF, if there are at least 0xffff relocations an
extra relocation will be written out to encode the count. */
if ((obj_pe (abfd) || obj_go32 (abfd)) && o->reloc_count >= 0xffff)
if (obj_pe (abfd) && o->reloc_count >= 0xffff)
rel_filepos += relsz;
}
@ -1006,20 +993,41 @@ _bfd_coff_final_link (bfd *abfd,
coff_debug_merge_hash_table_free (&flaginfo.debug_merge);
debug_merge_allocated = FALSE;
free (flaginfo.internal_syms);
flaginfo.internal_syms = NULL;
free (flaginfo.sec_ptrs);
flaginfo.sec_ptrs = NULL;
free (flaginfo.sym_indices);
flaginfo.sym_indices = NULL;
free (flaginfo.linenos);
flaginfo.linenos = NULL;
free (flaginfo.contents);
flaginfo.contents = NULL;
free (flaginfo.external_relocs);
flaginfo.external_relocs = NULL;
free (flaginfo.internal_relocs);
flaginfo.internal_relocs = NULL;
if (flaginfo.internal_syms != NULL)
{
free (flaginfo.internal_syms);
flaginfo.internal_syms = NULL;
}
if (flaginfo.sec_ptrs != NULL)
{
free (flaginfo.sec_ptrs);
flaginfo.sec_ptrs = NULL;
}
if (flaginfo.sym_indices != NULL)
{
free (flaginfo.sym_indices);
flaginfo.sym_indices = NULL;
}
if (flaginfo.linenos != NULL)
{
free (flaginfo.linenos);
flaginfo.linenos = NULL;
}
if (flaginfo.contents != NULL)
{
free (flaginfo.contents);
flaginfo.contents = NULL;
}
if (flaginfo.external_relocs != NULL)
{
free (flaginfo.external_relocs);
flaginfo.external_relocs = NULL;
}
if (flaginfo.internal_relocs != NULL)
{
free (flaginfo.internal_relocs);
flaginfo.internal_relocs = NULL;
}
/* The value of the last C_FILE symbol is supposed to be the symbol
index of the first external symbol. Write it out again if
@ -1058,8 +1066,11 @@ _bfd_coff_final_link (bfd *abfd,
goto error_return;
/* The outsyms buffer is used by _bfd_coff_write_global_sym. */
free (flaginfo.outsyms);
flaginfo.outsyms = NULL;
if (flaginfo.outsyms != NULL)
{
free (flaginfo.outsyms);
flaginfo.outsyms = NULL;
}
if (bfd_link_relocatable (info) && max_output_reloc_count > 0)
{
@ -1097,7 +1108,7 @@ _bfd_coff_final_link (bfd *abfd,
if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0)
goto error_return;
if ((obj_pe (abfd) || obj_go32 (abfd)) && o->reloc_count >= 0xffff)
if (obj_pe (abfd) && o->reloc_count >= 0xffff)
{
/* In PE COFF, write the count of relocs as the first
reloc. The header overflow bit will be set
@ -1130,8 +1141,10 @@ _bfd_coff_final_link (bfd *abfd,
for (i = 0; i < abfd->section_count; i++)
{
free (flaginfo.section_info[i].relocs);
free (flaginfo.section_info[i].rel_hashes);
if (flaginfo.section_info[i].relocs != NULL)
free (flaginfo.section_info[i].relocs);
if (flaginfo.section_info[i].rel_hashes != NULL)
free (flaginfo.section_info[i].rel_hashes);
}
free (flaginfo.section_info);
flaginfo.section_info = NULL;
@ -1190,20 +1203,31 @@ _bfd_coff_final_link (bfd *abfd,
for (i = 0; i < abfd->section_count; i++)
{
free (flaginfo.section_info[i].relocs);
free (flaginfo.section_info[i].rel_hashes);
if (flaginfo.section_info[i].relocs != NULL)
free (flaginfo.section_info[i].relocs);
if (flaginfo.section_info[i].rel_hashes != NULL)
free (flaginfo.section_info[i].rel_hashes);
}
free (flaginfo.section_info);
}
free (flaginfo.internal_syms);
free (flaginfo.sec_ptrs);
free (flaginfo.sym_indices);
free (flaginfo.outsyms);
free (flaginfo.linenos);
free (flaginfo.contents);
free (flaginfo.external_relocs);
free (flaginfo.internal_relocs);
free (external_relocs);
if (flaginfo.internal_syms != NULL)
free (flaginfo.internal_syms);
if (flaginfo.sec_ptrs != NULL)
free (flaginfo.sec_ptrs);
if (flaginfo.sym_indices != NULL)
free (flaginfo.sym_indices);
if (flaginfo.outsyms != NULL)
free (flaginfo.outsyms);
if (flaginfo.linenos != NULL)
free (flaginfo.linenos);
if (flaginfo.contents != NULL)
free (flaginfo.contents);
if (flaginfo.external_relocs != NULL)
free (flaginfo.external_relocs);
if (flaginfo.internal_relocs != NULL)
free (flaginfo.internal_relocs);
if (external_relocs != NULL)
free (external_relocs);
return FALSE;
}
@ -1262,7 +1286,8 @@ process_embedded_commands (bfd *output_bfd,
if (!bfd_malloc_and_get_section (abfd, sec, &copy))
{
free (copy);
if (copy != NULL)
free (copy);
return 0;
}
e = (char *) copy + sec->size;
@ -1622,7 +1647,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
struct coff_debug_merge_element **epp;
bfd_byte *esl, *eslend;
struct internal_syment *islp;
size_t amt;
bfd_size_type amt;
name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
if (name == NULL)
@ -2580,9 +2605,6 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
return FALSE;
case bfd_link_hash_undefined:
if (h->indx == -3)
return TRUE;
/* Fall through. */
case bfd_link_hash_undefweak:
isym.n_scnum = N_UNDEF;
isym.n_value = 0;

View File

@ -1,5 +1,5 @@
/* Generic COFF swapping routines, for BFD.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -264,6 +264,9 @@ coff_swap_filehdr_in (bfd * abfd, void * src, void * dst)
filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms);
filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr);
filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags);
#ifdef TIC80_TARGET_ID
filehdr_dst->f_target_id = H_GET_16 (abfd, filehdr_src->f_target_id);
#endif
#ifdef COFF_ADJUST_FILEHDR_IN_POST
COFF_ADJUST_FILEHDR_IN_POST (abfd, src, dst);
@ -286,6 +289,9 @@ coff_swap_filehdr_out (bfd *abfd, void * in, void * out)
H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
#ifdef TIC80_TARGET_ID
H_PUT_16 (abfd, filehdr_in->f_target_id, filehdr_out->f_target_id);
#endif
#ifdef COFF_ADJUST_FILEHDR_OUT_POST
COFF_ADJUST_FILEHDR_OUT_POST (abfd, in, out);
@ -399,7 +405,7 @@ coff_swap_aux_in (bfd *abfd,
#if FILNMLEN != E_FILNMLEN
#error we need to cope with truncating or extending FILNMLEN
#else
if (numaux > 1 && coff_data (abfd)->pe)
if (numaux > 1)
{
if (indx == 0)
memcpy (in->x_file.x_fname, ext->x_file.x_fname,
@ -725,7 +731,6 @@ coff_swap_aouthdr_out (bfd * abfd, void * in, void * out)
return AOUTSZ;
}
ATTRIBUTE_UNUSED
static void
coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
{
@ -752,7 +757,6 @@ coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
#endif
}
ATTRIBUTE_UNUSED
static unsigned int
coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
{

View File

@ -1,5 +1,5 @@
/* Compressed section support (intended for debug sections).
Copyright (C) 2008-2020 Free Software Foundation, Inc.
Copyright (C) 2008-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -255,9 +255,6 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
/* PR 24753: Linker created sections can be larger than
the file size, eg if they are being used to hold stubs. */
&& (bfd_section_flags (sec) & SEC_LINKER_CREATED) == 0
/* PR 24753: Sections which have no content should also be
excluded as they contain no size on disk. */
&& (bfd_section_flags (sec) & SEC_HAS_CONTENTS) != 0
/* The MMO file format supports its own special compression
technique, but it uses COMPRESS_SECTION_NONE when loading
a section's contents. */

View File

@ -1,6 +1,6 @@
# config.bfd
#
# Copyright (C) 2012-2020 Free Software Foundation, Inc.
# Copyright (C) 2012-2019 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -53,8 +53,7 @@ case $targ in
echo "*** Use or1k-*-elf or or1k-*-linux as the target instead" >&2
exit 1
;;
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin* | \
xc16x-*-* | \
c30-*-*aout* | tic30-*-*aout* | \
null)
if test "x$enable_obsolete" != xyes; then
echo "*** Configuration $targ is obsolete." >&2
@ -86,7 +85,6 @@ case $targ in
arm-*-oabi | \
arm-*-riscix* | \
arm-epoc-pe* | \
c30-*-*aout* | tic30-*-*aout* | \
cr16c-*-* | \
h8300*-*-coff | \
h8500*-*-coff | \
@ -210,7 +208,7 @@ wasm32) targ_archs=bfd_wasm32_arch ;;
x86_64*) targ_archs=bfd_i386_arch ;;
xtensa*) targ_archs=bfd_xtensa_arch ;;
xgate) targ_archs=bfd_xgate_arch ;;
z80*|r800|z180|gbz80|ez80*) targ_archs=bfd_z80_arch ;;
z80|r800) targ_archs=bfd_z80_arch ;;
z8k*) targ_archs=bfd_z8k_arch ;;
*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@ -341,11 +339,15 @@ case "${targ}" in
;;
arm-*-nacl*)
targ_defvec=arm_elf32_nacl_le_vec
targ_selvecs="arm_elf32_nacl_be_vec"
targ_selvecs="arm_elf32_nacl_be_vec i386_elf32_nacl_vec"
targ64_selvecs="x86_64_elf32_nacl_vec x86_64_elf64_nacl_vec"
targ_archs="$targ_archs bfd_i386_arch"
;;
armeb-*-nacl*)
targ_defvec=arm_elf32_nacl_be_vec
targ_selvecs="arm_elf32_nacl_le_vec"
targ_selvecs="arm_elf32_nacl_le_vec i386_elf32_nacl_vec"
targ64_selvecs="x86_64_elf32_nacl_vec x86_64_elf64_nacl_vec"
targ_archs="$targ_archs bfd_i386_arch"
;;
armeb-*-netbsdelf*)
targ_defvec=arm_elf32_be_vec
@ -412,6 +414,9 @@ case "${targ}" in
targ_underscore=yes
;;
c30-*-*aout* | tic30-*-*aout*)
targ_defvec=tic30_aout_vec
;;
c30-*-*coff* | tic30-*-*coff*)
targ_defvec=tic30_coff_vec
;;
@ -476,16 +481,10 @@ case "${targ}" in
;;
#endif
e2k-*-linux-gnu)
targ_defvec=e2k_elf64_vec
targ_selvecs="e2k_elf32_vec e2k_pm_elf32_vec"
targ64_selvecs="e2k_pm_elf64_vec"
want64=true
;;
e2k-*-linux-uclibc)
targ_defvec=e2k_uclibc_elf64_vec
targ_selvecs="e2k_pm_uclibc_elf32_vec"
e2k-*-linux-*)
targ_defvec=e2k_elf32_vec
targ_selvecs="e2k_pm_elf32_vec"
targ64_selvecs="e2k_elf64_vec"
want64=true
;;
@ -651,6 +650,12 @@ case "${targ}" in
targ_selvecs="iamcu_elf32_vec i386_pei_vec"
targ64_selvecs="x86_64_elf64_vec x86_64_elf32_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec"
;;
i[3-7]86-*-nacl*)
targ_defvec=i386_elf32_nacl_vec
targ_selvecs="arm_elf32_nacl_be_vec arm_elf32_nacl_le_vec"
targ64_selvecs="x86_64_elf64_nacl_vec x86_64_elf32_nacl_vec"
targ_archs="$targ_archs bfd_arm_arch"
;;
i[3-7]86-*-redox*)
targ_defvec=i386_elf32_vec
targ_selvecs=
@ -701,9 +706,15 @@ case "${targ}" in
targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec"
want64=true
;;
x86_64-*-nacl*)
targ_defvec=x86_64_elf32_nacl_vec
targ_selvecs="i386_elf32_nacl_vec x86_64_elf64_nacl_vec arm_elf32_nacl_be_vec arm_elf32_nacl_le_vec"
targ_archs="$targ_archs bfd_arm_arch"
want64=true
;;
x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin)
targ_defvec=x86_64_pe_vec
targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_big_vec x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_be_vec x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
want64=true
targ_underscore=no
;;
@ -753,7 +764,7 @@ case "${targ}" in
;;
i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe)
targ_defvec=i386_pe_vec
targ_selvecs="i386_pe_vec i386_pe_big_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
targ_underscore=yes
;;
i[3-7]86-*-vxworks*)
@ -1335,6 +1346,11 @@ case "${targ}" in
targ_selvecs="tic6x_elf32_linux_be_vec tic6x_elf32_le_vec tic6x_elf32_be_vec"
;;
tic80*-*-*)
targ_defvec=tic80_coff_vec
targ_underscore=yes
;;
#ifdef BFD64
tilegx-*-*)
targ_defvec=tilegx_elf64_le_vec
@ -1389,10 +1405,6 @@ case "${targ}" in
targ_selvecs="wasm_vec"
;;
xc16x-*-elf)
targ_defvec=xc16x_elf32_vec
;;
xgate-*-*)
targ_defvec=xgate_elf32_vec
targ_selvecs="xgate_elf32_vec"
@ -1406,14 +1418,12 @@ case "${targ}" in
targ_defvec=xtensa_elf32_le_vec
targ_selvecs=xtensa_elf32_be_vec
;;
z80-*-coff)
targ_defvec=z80_coff_vec
targ_underscore=no
xc16x-*-elf)
targ_defvec=xc16x_elf32_vec
;;
z80-*-elf)
targ_defvec=z80_elf32_vec
z80-*-*)
targ_defvec=z80_coff_vec
targ_underscore=no
;;

View File

@ -302,9 +302,6 @@
*/
#undef LT_OBJDIR
/* Define if we should enable new PM ABI */
#undef NEW_PM_ABI
/* Name of package */
#undef PACKAGE
@ -374,6 +371,9 @@
/* Define if we should default to creating read-only plt entries */
#undef USE_SECUREPLT
/* Define if we should use new PM ABI for E2K */
#undef NEW_PM_ABI
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE

76
bfd/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bfd 2.35.0.
# Generated by GNU Autoconf 2.69 for bfd 2.33.50.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bfd'
PACKAGE_TARNAME='bfd'
PACKAGE_VERSION='2.35.0'
PACKAGE_STRING='bfd 2.35.0'
PACKAGE_VERSION='2.33.50'
PACKAGE_STRING='bfd 2.33.50'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -1392,7 +1392,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bfd 2.35.0 to adapt to many kinds of systems.
\`configure' configures bfd 2.33.50 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1463,7 +1463,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bfd 2.35.0:";;
short | recursive ) echo "Configuration of bfd 2.33.50:";;
esac
cat <<\_ACEOF
@ -1591,7 +1591,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bfd configure 2.35.0
bfd configure 2.33.50
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -2239,7 +2239,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bfd $as_me 2.35.0, which was
It was created by bfd $as_me 2.33.50, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -4189,7 +4189,7 @@ fi
# Define the identity of the package.
PACKAGE='bfd'
VERSION='2.35.0'
VERSION='2.33.50'
cat >>confdefs.h <<_ACEOF
@ -12402,30 +12402,6 @@ fi
case "${target}" in
vax-*-netbsdelf*) ;;
*-*-*aout* | i[3-7]86-*-bsd* | i[3-7]86-*-msdos* | ns32k-*-* | \
pdp11-*-* | vax-*-*bsd*)
if test "$plugins" = "yes"; then
if test "${enable_plugins+set}" = set; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Enabling plugins for AOUT is experimental" >&5
$as_echo "$as_me: WARNING: Enabling plugins for AOUT is experimental" >&2;}
else
plugins=no
fi
fi ;;
*-*-*vms* | \
powerpc*-*-aix* | powerpc-*-beos* | powerpc-*-macos* | rs6000-*-*)
if test "$plugins" = "yes"; then
if test "${enable_plugins+set}" = set; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Enabling plugins may result in ar creating non-standard archives for ${target}" >&5
$as_echo "$as_me: WARNING: Enabling plugins may result in ar creating non-standard archives for ${target}" >&2;}
else
plugins=no
fi
fi ;;
esac
if test "$plugins" = "yes"; then
PLUGINS_TRUE=
PLUGINS_FALSE='#'
@ -14715,7 +14691,7 @@ coff="cofflink.lo $coffgen"
ecoff="ecofflink.lo $coffgen"
xcoff="xcofflink.lo $coffgen"
elfxx_x86="elfxx-x86.lo elf-ifunc.lo elf-vxworks.lo"
elfxx_x86="elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo"
for vec in $selvecs
do
target_size=32
@ -14774,12 +14750,9 @@ do
d30v_elf32_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
dlx_elf32_be_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
e2k_elf32_vec) tb="$tb elf32-e2k.lo elfxx-e2k.lo elf-ifunc.lo $elf"; want64=true;;
e2k_pm_elf32_vec) tb="$tb elf32-e2k-pm.lo elfxx-e2k-pm.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_pm_uclibc_elf32_vec) tb="$tb elf32-e2k-pm-uclibc.lo elfxx-e2k-pm.lo elfxx-e2k-uclibc.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_pm_elf32_vec) tb="$tb elf32-e2k-pm.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_elf64_vec) tb="$tb elf64-e2k.lo elfxx-e2k.lo elf-ifunc.lo $elf"; target_size=64;;
e2k_kpda_elf64_vec) tb="$tb elf64-e2k-kpda.lo elfxx-e2k.lo elf-ifunc.lo $elf"; target_size=64;;
e2k_pm_elf64_vec) tb="$tb elf64-e2k-pm.lo elfxx-e2k-pm.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_uclibc_elf64_vec) tb="$tb elf64-e2k-uclibc.lo elfxx-e2k-uclibc.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
elf32_be_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
elf32_le_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
elf64_be_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
@ -14807,12 +14780,12 @@ do
i386_coff_lynx_vec) tb="$tb cf-i386lynx.lo lynx-core.lo $coff" ;;
i386_elf32_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_fbsd_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_nacl_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_sol2_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_vxworks_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_mach_o_vec) tb="$tb mach-o-i386.lo" ;;
i386_msdos_vec) tb="$tb i386msdos.lo" ;;
i386_pe_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;;
i386_pe_big_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;;
i386_pei_vec) tb="$tb pei-i386.lo peigen.lo $coff" ;;
iamcu_elf32_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
ia64_elf32_be_vec) tb="$tb elf32-ia64.lo elfxx-ia64.lo elf32.lo $elf" ;;
@ -14824,10 +14797,10 @@ do
ia64_pei_vec) tb="$tb pei-ia64.lo pepigen.lo $coff"; target_size=64 ;;
ip2k_elf32_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;;
iq2000_elf32_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;;
k1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
k1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
k1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
k1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
lm32_elf32_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;;
lm32_elf32_fdpic_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;;
m32c_elf32_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;;
@ -14926,8 +14899,8 @@ do
rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
@ -14952,6 +14925,7 @@ do
sparc_elf64_sol2_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
spu_elf32_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;;
sym_vec) tb="$tb xsym.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
tic30_coff_vec) tb="$tb coff-tic30.lo $coffgen" ;;
tic4x_coff0_vec) tb="$tb coff-tic4x.lo $coffgen" ;;
tic4x_coff0_beh_vec) tb="$tb coff-tic4x.lo $coffgen" ;;
@ -14971,6 +14945,7 @@ do
tic6x_elf32_c6000_le_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;;
tic6x_elf32_linux_be_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;;
tic6x_elf32_linux_le_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;;
tic80_coff_vec) tb="$tb coff-tic80.lo $coff" ;;
tilegx_elf32_be_vec) tb="$tb elf32-tilegx.lo elfxx-tilegx.lo elf32.lo $elf" ; target_size=32 ;;
tilegx_elf32_le_vec) tb="$tb elf32-tilegx.lo elfxx-tilegx.lo elf32.lo $elf" ; target_size=32 ;;
tilegx_elf64_be_vec) tb="$tb elf64-tilegx.lo elfxx-tilegx.lo elf64.lo $elf" ; target_size=64 ;;
@ -14987,13 +14962,15 @@ do
wasm32_elf32_vec) tb="$tb elf32-wasm32.lo elf32.lo $elf" ;;
x86_64_coff_vec) tb="$tb coff-x86_64.lo $coff"; target_size=64 ;;
x86_64_elf32_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf32_nacl_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf64_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_cloudabi_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_nacl_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_sol2_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_mach_o_vec) tb="$tb mach-o-x86-64.lo" ;;
x86_64_pe_vec) tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
x86_64_pe_big_vec) tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
x86_64_pe_be_vec) tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
x86_64_pei_vec) tb="$tb pei-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
xc16x_elf32_vec) tb="$tb elf32-xc16x.lo elf32.lo $elf" ;;
xgate_elf32_vec) tb="$tb elf32-xgate.lo elf32.lo $elf" ;;
@ -15001,7 +14978,6 @@ do
xtensa_elf32_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
xtensa_elf32_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
z80_coff_vec) tb="$tb coff-z80.lo reloc16.lo $coffgen" ;;
z80_elf32_vec) tb="$tb elf32-z80.lo elf32.lo $elf" ;;
z8k_coff_vec) tb="$tb coff-z8k.lo reloc16.lo $coff" ;;
# These appear out of order in targets.c
@ -15161,7 +15137,7 @@ if test "${target}" = "${host}"; then
;;
arm-*-freebsd* | arm-*-kfreebsd*-gnu)
COREFILE='' ;;
arm*-*-netbsd* | arm-*-openbsd*)
arm-*-netbsd* | arm-*-openbsd*)
COREFILE=netbsd-core.lo
;;
arm-*-riscix) COREFILE=trad-core.lo ;;
@ -15222,7 +15198,7 @@ if test "${target}" = "${host}"; then
;;
i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
mips*-*-netbsd* | mips*-*-openbsd*)
mips-*-netbsd* | mips*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
mips-sgi-irix4*) COREFILE=irix-core.lo ;;
@ -16999,7 +16975,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bfd $as_me 2.35.0, which was
This file was extended by bfd $as_me 2.33.50, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -17065,7 +17041,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bfd config.status 2.35.0
bfd config.status 2.33.50
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (C) 2012-2020 Free Software Foundation, Inc.
dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
dnl
dnl This file is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@ -44,30 +44,6 @@ LT_INIT([dlopen])
# AC_PLUGINS setting $plugins is called by ACX_LARGEFILE.
ACX_LARGEFILE
changequote(,)dnl
case "${target}" in
vax-*-netbsdelf*) ;;
*-*-*aout* | i[3-7]86-*-bsd* | i[3-7]86-*-msdos* | ns32k-*-* | \
pdp11-*-* | vax-*-*bsd*)
changequote([,])dnl
if test "$plugins" = "yes"; then
if test "${enable_plugins+set}" = set; then
AC_MSG_WARN(Enabling plugins for AOUT is experimental)
else
plugins=no
fi
fi ;;
*-*-*vms* | \
powerpc*-*-aix* | powerpc-*-beos* | powerpc-*-macos* | rs6000-*-*)
if test "$plugins" = "yes"; then
if test "${enable_plugins+set}" = set; then
AC_MSG_WARN(Enabling plugins may result in ar creating non-standard archives for ${target})
else
plugins=no
fi
fi ;;
esac
AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
AC_ARG_ENABLE(64-bit-bfd,
@ -445,7 +421,7 @@ coff="cofflink.lo $coffgen"
ecoff="ecofflink.lo $coffgen"
xcoff="xcofflink.lo $coffgen"
elfxx_x86="elfxx-x86.lo elf-ifunc.lo elf-vxworks.lo"
elfxx_x86="elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo"
for vec in $selvecs
do
target_size=32
@ -504,12 +480,9 @@ do
d30v_elf32_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
dlx_elf32_be_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
e2k_elf32_vec) tb="$tb elf32-e2k.lo elfxx-e2k.lo elf-ifunc.lo $elf"; want64=true;;
e2k_pm_elf32_vec) tb="$tb elf32-e2k-pm.lo elfxx-e2k-pm.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_pm_uclibc_elf32_vec) tb="$tb elf32-e2k-pm-uclibc.lo elfxx-e2k-pm.lo elfxx-e2k-uclibc.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_pm_elf32_vec) tb="$tb elf32-e2k-pm.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_elf64_vec) tb="$tb elf64-e2k.lo elfxx-e2k.lo elf-ifunc.lo $elf"; target_size=64;;
e2k_kpda_elf64_vec) tb="$tb elf64-e2k-kpda.lo elfxx-e2k.lo elf-ifunc.lo $elf"; target_size=64;;
e2k_pm_elf64_vec) tb="$tb elf64-e2k-pm.lo elfxx-e2k-pm.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
e2k_uclibc_elf64_vec) tb="$tb elf64-e2k-uclibc.lo elfxx-e2k-uclibc.lo elfxx-e2k.lo elf-ifunc.lo $elf";;
elf32_be_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
elf32_le_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
elf64_be_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
@ -537,12 +510,12 @@ do
i386_coff_lynx_vec) tb="$tb cf-i386lynx.lo lynx-core.lo $coff" ;;
i386_elf32_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_fbsd_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_nacl_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_sol2_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_vxworks_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_mach_o_vec) tb="$tb mach-o-i386.lo" ;;
i386_msdos_vec) tb="$tb i386msdos.lo" ;;
i386_pe_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;;
i386_pe_big_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;;
i386_pei_vec) tb="$tb pei-i386.lo peigen.lo $coff" ;;
iamcu_elf32_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
ia64_elf32_be_vec) tb="$tb elf32-ia64.lo elfxx-ia64.lo elf32.lo $elf" ;;
@ -554,10 +527,10 @@ do
ia64_pei_vec) tb="$tb pei-ia64.lo pepigen.lo $coff"; target_size=64 ;;
ip2k_elf32_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;;
iq2000_elf32_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;;
k1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
k1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
k1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
k1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
lm32_elf32_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;;
lm32_elf32_fdpic_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;;
m32c_elf32_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;;
@ -656,8 +629,8 @@ do
rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
@ -682,6 +655,7 @@ do
sparc_elf64_sol2_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
spu_elf32_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;;
sym_vec) tb="$tb xsym.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
tic30_coff_vec) tb="$tb coff-tic30.lo $coffgen" ;;
tic4x_coff0_vec) tb="$tb coff-tic4x.lo $coffgen" ;;
tic4x_coff0_beh_vec) tb="$tb coff-tic4x.lo $coffgen" ;;
@ -701,6 +675,7 @@ do
tic6x_elf32_c6000_le_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;;
tic6x_elf32_linux_be_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;;
tic6x_elf32_linux_le_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;;
tic80_coff_vec) tb="$tb coff-tic80.lo $coff" ;;
tilegx_elf32_be_vec) tb="$tb elf32-tilegx.lo elfxx-tilegx.lo elf32.lo $elf" ; target_size=32 ;;
tilegx_elf32_le_vec) tb="$tb elf32-tilegx.lo elfxx-tilegx.lo elf32.lo $elf" ; target_size=32 ;;
tilegx_elf64_be_vec) tb="$tb elf64-tilegx.lo elfxx-tilegx.lo elf64.lo $elf" ; target_size=64 ;;
@ -717,13 +692,15 @@ do
wasm32_elf32_vec) tb="$tb elf32-wasm32.lo elf32.lo $elf" ;;
x86_64_coff_vec) tb="$tb coff-x86_64.lo $coff"; target_size=64 ;;
x86_64_elf32_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf32_nacl_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf64_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_cloudabi_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_nacl_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_sol2_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_mach_o_vec) tb="$tb mach-o-x86-64.lo" ;;
x86_64_pe_vec) tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
x86_64_pe_big_vec) tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
x86_64_pe_be_vec) tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
x86_64_pei_vec) tb="$tb pei-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
xc16x_elf32_vec) tb="$tb elf32-xc16x.lo elf32.lo $elf" ;;
xgate_elf32_vec) tb="$tb elf32-xgate.lo elf32.lo $elf" ;;
@ -731,7 +708,6 @@ do
xtensa_elf32_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
xtensa_elf32_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
z80_coff_vec) tb="$tb coff-z80.lo reloc16.lo $coffgen" ;;
z80_elf32_vec) tb="$tb elf32-z80.lo elf32.lo $elf" ;;
z8k_coff_vec) tb="$tb coff-z8k.lo reloc16.lo $coff" ;;
# These appear out of order in targets.c
@ -876,7 +852,7 @@ if test "${target}" = "${host}"; then
;;
arm-*-freebsd* | arm-*-kfreebsd*-gnu)
COREFILE='' ;;
arm*-*-netbsd* | arm-*-openbsd*)
arm-*-netbsd* | arm-*-openbsd*)
COREFILE=netbsd-core.lo
;;
arm-*-riscix) COREFILE=trad-core.lo ;;
@ -961,7 +937,7 @@ changequote(,)dnl
i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
changequote([,])dnl
mips*-*-netbsd* | mips*-*-openbsd*)
mips-*-netbsd* | mips*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
mips-sgi-irix4*) COREFILE=irix-core.lo ;;

View File

@ -7,7 +7,7 @@ $!
$! Written by Klaus K"ampf (kkaempf@rmi.de)
$! Rewritten by Tristan Gingold (gingold@adacore.com)
$!
$! Copyright (C) 2012-2020 Free Software Foundation, Inc.
$! Copyright (C) 2012-2019 Free Software Foundation, Inc.
$!
$! This file is free software; you can redistribute it and/or modify
$! it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2012-2020 Free Software Foundation, Inc.
# Copyright (C) 2012-2019 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* Core file generic interface routines for BFD.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for AArch64.
Copyright (C) 2009-2020 Free Software Foundation, Inc.
Copyright (C) 2009-2019 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* ELF AArch64 mapping symbol support
Copyright (C) 2019-2020 Free Software Foundation, Inc.
Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the Alpha architecture.
Copyright (C) 1992-2020 Free Software Foundation, Inc.
Copyright (C) 1992-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the ARC processor
Copyright (C) 1994-2020 Free Software Foundation, Inc.
Copyright (C) 1994-2019 Free Software Foundation, Inc.
Contributed by Doug Evans (dje@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the ARM processor
Copyright (C) 1994-2020 Free Software Foundation, Inc.
Copyright (C) 1994-2019 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
@ -300,8 +300,8 @@ bfd_arm_merge_machines (bfd *ibfd, bfd *obfd)
|| out == bfd_mach_arm_iWMMXt2))
{
/* xgettext: c-format */
_bfd_error_handler (_("error: %pB is compiled for the EP9312, "
"whereas %pB is compiled for XScale"),
_bfd_error_handler (_("\
error: %pB is compiled for the EP9312, whereas %pB is compiled for XScale"),
ibfd, obfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@ -312,8 +312,8 @@ bfd_arm_merge_machines (bfd *ibfd, bfd *obfd)
|| in == bfd_mach_arm_iWMMXt2))
{
/* xgettext: c-format */
_bfd_error_handler (_("error: %pB is compiled for the EP9312, "
"whereas %pB is compiled for XScale"),
_bfd_error_handler (_("\
error: %pB is compiled for the EP9312, whereas %pB is compiled for XScale"),
obfd, ibfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
@ -458,7 +458,8 @@ bfd_arm_update_notes (bfd *abfd, const char *note_section)
return TRUE;
FAIL:
free (buffer);
if (buffer != NULL)
free (buffer);
return FALSE;
}
@ -527,7 +528,8 @@ bfd_arm_get_mach_from_notes (bfd *abfd, const char *note_section)
}
FAIL:
free (buffer);
if (buffer != NULL)
free (buffer);
return bfd_mach_arm_unknown;
}

View File

@ -1,5 +1,5 @@
/* BFD support for the ARM processor
Copyright (C) 2019-2020 Free Software Foundation, Inc.
Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD library support routines for the AVR architecture.
Copyright (C) 1999-2020 Free Software Foundation, Inc.
Copyright (C) 1999-2019 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,6 +1,6 @@
/* BFD Support for the ADI Blackfin processor.
Copyright (C) 2005-2020 Free Software Foundation, Inc.
Copyright (C) 2005-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the BPF processor.
Copyright (C) 2019-2020 Free Software Foundation, Inc.
Copyright (C) 2019 Free Software Foundation, Inc.
Contributed by Oracle Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the CR16 processor.
Copyright (C) 2007-2020 Free Software Foundation, Inc.
Copyright (C) 2007-2019 Free Software Foundation, Inc.
Written by M R Swami Reddy
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the Axis CRIS architecture.
Copyright (C) 2000-2020 Free Software Foundation, Inc.
Copyright (C) 2000-2019 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson.

View File

@ -1,5 +1,5 @@
/* BFD support for the CRX processor.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Copyright (C) 2004-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for C-SKY processors.
Copyright (C) 1994-2020 Free Software Foundation, Inc.
Copyright (C) 1994-2019 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the D10V processor
Copyright (C) 1996-2020 Free Software Foundation, Inc.
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the Mitsubishi D30V processor
Copyright (C) 1997-2020 Free Software Foundation, Inc.
Copyright (C) 1997-2019 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the DLX Microprocessor architecture.
Copyright (C) 2002-2020 Free Software Foundation, Inc.
Copyright (C) 2002-2019 Free Software Foundation, Inc.
Hacked by Kuang Hwa Lin <kuang@sbcglobal.net>
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the Adapteva EPIPHANY processor.
Copyright (C) 2009-2020 Free Software Foundation, Inc.
Copyright (C) 2009-2019 Free Software Foundation, Inc.
Contributed by Embecosm on behalf of Adapteva, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the FR30 processor.
Copyright (C) 1998-2020 Free Software Foundation, Inc.
Copyright (C) 1998-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the FRV processor.
Copyright (C) 2002-2020 Free Software Foundation, Inc.
Copyright (C) 2002-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the ft32 processor.
Copyright (C) 2013-2020 Free Software Foundation, Inc.
Copyright (C) 2013-2019 Free Software Foundation, Inc.
Written by FTDI (support@ftdichip.com)
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD library support routines for the Renesas H8/300 architecture.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* H8/300 functions.
Copyright (C) 2019-2020 Free Software Foundation, Inc.
Copyright (C) 2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the HP Precision Architecture architecture.
Copyright (C) 1992-2020 Free Software Foundation, Inc.
Copyright (C) 1992-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the Intel 386 architecture.
Copyright (C) 1992-2020 Free Software Foundation, Inc.
Copyright (C) 1992-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -117,6 +117,19 @@ bfd_arch_i386_long_nop_fill (bfd_size_type count,
return bfd_arch_i386_fill (count, code, TRUE);
}
/* Fill the buffer with zero, or one-byte nop instructions if CODE is TRUE. */
static void *
bfd_arch_i386_onebyte_nop_fill (bfd_size_type count,
bfd_boolean is_bigendian ATTRIBUTE_UNUSED,
bfd_boolean code)
{
void *fill = bfd_malloc (count);
if (fill != NULL)
memset (fill, code ? 0x90 : 0, count);
return fill;
}
#define N(BITS, MACH, NAME, PRINT, DEF, FILL, NEXT) \
{ BITS, /* Bits in a word. */ \
BITS, /* Bits in an address. */ \
@ -135,9 +148,22 @@ bfd_arch_i386_long_nop_fill (bfd_size_type count,
}
static const bfd_arch_info_type bfd_x64_32_nacl_arch =
N (64, bfd_mach_x64_32_nacl, "i386", "i386:x64-32:nacl",
FALSE, bfd_arch_i386_onebyte_nop_fill, NULL);
static const bfd_arch_info_type bfd_x86_64_nacl_arch =
N (64, bfd_mach_x86_64_nacl, "i386", "i386:x86-64:nacl",
FALSE, bfd_arch_i386_onebyte_nop_fill, &bfd_x64_32_nacl_arch);
const bfd_arch_info_type bfd_i386_nacl_arch =
N (32, bfd_mach_i386_i386_nacl, "i386", "i386:nacl",
TRUE, bfd_arch_i386_onebyte_nop_fill, &bfd_x86_64_nacl_arch);
static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax =
N (64, bfd_mach_x64_32_intel_syntax, "i386:intel", "i386:x64-32:intel",
FALSE, bfd_arch_i386_long_nop_fill, NULL);
FALSE, bfd_arch_i386_long_nop_fill, &bfd_i386_nacl_arch);
static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
N (64, bfd_mach_x86_64_intel_syntax, "i386:intel", "i386:x86-64:intel",

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the ia64 architecture.
Copyright (C) 1998-2020 Free Software Foundation, Inc.
Copyright (C) 1998-2019 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.

View File

@ -1,5 +1,5 @@
/* BFD support for the Intel MCU architecture.
Copyright (C) 2015-2020 Free Software Foundation, Inc.
Copyright (C) 2015-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.

Some files were not shown because too many files have changed in this diff Show More