Delete parts of gdb which are now shared with binutils.
This commit is contained in:
parent
ce1bf9a557
commit
230ee8ad3f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46317
@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
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 2 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, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
File diff suppressed because it is too large
Load Diff
@ -1,83 +0,0 @@
|
||||
Preliminary Notes on Porting BFD
|
||||
--------------------------------
|
||||
|
||||
The 'host' is the system a tool runs *on*.
|
||||
The 'target' is the system a tool runs *for*, i.e.
|
||||
a tool can read/write the binaries of the target.
|
||||
|
||||
Porting to a new host
|
||||
---------------------
|
||||
Pick a name for your host. Call that <host>.
|
||||
(<host> might be sun4, ...)
|
||||
Create a file hosts/<host>.mh.
|
||||
|
||||
Porting to a new target
|
||||
-----------------------
|
||||
Pick a name for your target. Call that <target>.
|
||||
Call the name for your CPU architecture <cpu>.
|
||||
You need to create <target>.c and config/<target>.mt,
|
||||
and add a case for it to a case statements in bfd/configure.host and
|
||||
bfd/config.bfd, which associates each canonical host type with a BFD
|
||||
host type (used as the base of the makefile fragment names), and to the
|
||||
table in bfd/configure.in which associates each target vector with
|
||||
the .o files it uses.
|
||||
|
||||
config/<target>.mt is a Makefile fragment.
|
||||
The following is usually enough:
|
||||
DEFAULT_VECTOR=<target>_vec
|
||||
SELECT_ARCHITECTURES=bfd_<cpu>_arch
|
||||
|
||||
See the list of cpu types in archures.c, or "ls cpu-*.c".
|
||||
If your architecture is new, you need to add it to the tables
|
||||
in bfd/archures.c, opcodes/configure.in, and binutils/objdump.c.
|
||||
|
||||
For more information about .mt and .mh files, see config/README.
|
||||
|
||||
The file <target>.c is the hard part. It implements the
|
||||
bfd_target <target>_vec, which includes pointers to
|
||||
functions that do the actual <target>-specific methods.
|
||||
|
||||
Porting to a <target> that uses the a.out binary format
|
||||
-------------------------------------------------------
|
||||
|
||||
In this case, the include file aout-target.h probaby does most
|
||||
of what you need. The program gen-aout generates <target>.c for
|
||||
you automatically for many a.out systems. Do:
|
||||
make gen-aout
|
||||
./gen-aout <target> > <target>.c
|
||||
(This only works if you are building on the target ("native").
|
||||
If you must make a cross-port from scratch, copy the most
|
||||
similar existing file that includes aout-target.h, and fix what is wrong.)
|
||||
|
||||
Check the parameters in <target>.c, and fix anything that is wrong.
|
||||
(Also let us know about it; perhaps we can improve gen-aout.c.)
|
||||
|
||||
TARGET_IS_BIG_ENDIAN_P
|
||||
Should be defined if <target> is big-endian.
|
||||
|
||||
N_HEADER_IN_TEXT(x)
|
||||
See discussion in ../include/aout/aout64.h.
|
||||
|
||||
BYTES_IN_WORD
|
||||
Number of bytes per word. (Usually 4 but can be 8.)
|
||||
|
||||
ARCH
|
||||
Number of bits per word. (Usually 32, but can be 64.)
|
||||
|
||||
ENTRY_CAN_BE_ZERO
|
||||
Define if the extry point (start address of an
|
||||
executable program) can be 0x0.
|
||||
|
||||
TEXT_START_ADDR
|
||||
The address of the start of the text segemnt in
|
||||
virtual memory. Normally, the same as the entry point.
|
||||
|
||||
TARGET_PAGE_SIZE
|
||||
|
||||
SEGMENT_SIZE
|
||||
Usually, the same as the TARGET_PAGE_SIZE.
|
||||
Alignment needed for the data segment.
|
||||
|
||||
TARGETNAME
|
||||
The name of the target, for run-time lookups.
|
||||
Usually "a.out-<target>"
|
@ -1,25 +0,0 @@
|
||||
Things that still need to be done: -*- Text -*-
|
||||
|
||||
o - A source of space lossage is that all the target-dependent code
|
||||
is in a single bfd_target structure. Hence all the code for
|
||||
*writing* object files is still pulled into all the applications
|
||||
that only care about *reading* (gdb, nm, objdump), while gas has
|
||||
to carry along all the unneded baggage for reading objects. And
|
||||
so on. This would be a substantial change, and the payoff would
|
||||
not all that great (essentially none if bfd is used as a shared
|
||||
library).
|
||||
|
||||
o - The storage needed by BFD data structures is also larger than strictly
|
||||
needed. This may be difficult to do much about.
|
||||
|
||||
o - implement bfd_abort, which should close the bfd but not alter the
|
||||
filesystem.
|
||||
|
||||
o - update the bfd doc; write a how-to-write-a-backend doc, take out
|
||||
the stupid quips and fill in all the blanks.
|
||||
|
||||
o - upgrade the reloc handling as per Steve's suggestion.
|
||||
|
||||
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
cygnus-2.6
|
43
contrib/gdb/bfd/aclocal.m4
vendored
43
contrib/gdb/bfd/aclocal.m4
vendored
@ -1,43 +0,0 @@
|
||||
dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
|
||||
AC_DEFUN(BFD_BINARY_FOPEN,
|
||||
[AC_REQUIRE([AC_CANONICAL_SYSTEM])
|
||||
case "${host}" in
|
||||
changequote(,)dnl
|
||||
i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32)
|
||||
changequote([,])dnl
|
||||
AC_DEFINE(USE_BINARY_FOPEN) ;;
|
||||
esac])dnl
|
||||
|
||||
dnl Get a default for CC_FOR_BUILD to put into Makefile.
|
||||
AC_DEFUN(BFD_CC_FOR_BUILD,
|
||||
[# Put a plausible default for CC_FOR_BUILD in Makefile.
|
||||
AC_REQUIRE([AC_C_CROSS])dnl
|
||||
if test -z "$CC_FOR_BUILD"; then
|
||||
if test "x$cross_compiling" = "xno"; then
|
||||
CC_FOR_BUILD='$(CC)'
|
||||
else
|
||||
CC_FOR_BUILD=gcc
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(CC_FOR_BUILD)])dnl
|
||||
|
||||
dnl See whether we need a declaration for a function.
|
||||
AC_DEFUN(BFD_NEED_DECLARATION,
|
||||
[AC_MSG_CHECKING([whether $1 must be declared])
|
||||
AC_CACHE_VAL(bfd_cv_decl_needed_$1,
|
||||
[AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif],
|
||||
[char *(*pfn) = (char *(*)) $1],
|
||||
bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
|
||||
AC_MSG_RESULT($bfd_cv_decl_needed_$1)
|
||||
if test $bfd_cv_decl_needed_$1 = yes; then
|
||||
bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||
AC_DEFINE_UNQUOTED($bfd_tr_decl)
|
||||
fi
|
||||
])dnl
|
@ -1,607 +0,0 @@
|
||||
/* Define a target vector and some small routines for a variant of a.out.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "aout/aout64.h"
|
||||
#include "aout/stab_gnu.h"
|
||||
#include "aout/ar.h"
|
||||
/*#include "libaout.h"*/
|
||||
|
||||
extern reloc_howto_type * NAME(aout,reloc_type_lookup) ();
|
||||
|
||||
/* Set parameters about this a.out file that are machine-dependent.
|
||||
This routine is called from some_aout_object_p just before it returns. */
|
||||
#ifndef MY_callback
|
||||
static const bfd_target *
|
||||
MY(callback) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
unsigned int arch_align_power;
|
||||
unsigned long arch_align;
|
||||
|
||||
/* Calculate the file positions of the parts of a newly read aout header */
|
||||
obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp);
|
||||
|
||||
/* The virtual memory addresses of the sections */
|
||||
obj_textsec (abfd)->vma = N_TXTADDR(*execp);
|
||||
obj_datasec (abfd)->vma = N_DATADDR(*execp);
|
||||
obj_bsssec (abfd)->vma = N_BSSADDR(*execp);
|
||||
|
||||
obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
|
||||
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
|
||||
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
|
||||
|
||||
/* The file offsets of the sections */
|
||||
obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
|
||||
obj_datasec (abfd)->filepos = N_DATOFF (*execp);
|
||||
|
||||
/* The file offsets of the relocation info */
|
||||
obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp);
|
||||
obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp);
|
||||
|
||||
/* The file offsets of the string table and symbol table. */
|
||||
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
|
||||
obj_str_filepos (abfd) = N_STROFF (*execp);
|
||||
|
||||
/* Determine the architecture and machine type of the object file. */
|
||||
#ifdef SET_ARCH_MACH
|
||||
SET_ARCH_MACH(abfd, *execp);
|
||||
#else
|
||||
bfd_default_set_arch_mach(abfd, DEFAULT_ARCH, 0);
|
||||
#endif
|
||||
|
||||
/* Now that we know the architecture, set the alignments of the
|
||||
sections. This is normally done by NAME(aout,new_section_hook),
|
||||
but when the initial sections were created the architecture had
|
||||
not yet been set. However, for backward compatibility, we don't
|
||||
set the alignment power any higher than as required by the size
|
||||
of the section. */
|
||||
arch_align_power = bfd_get_arch_info (abfd)->section_align_power;
|
||||
arch_align = 1 << arch_align_power;
|
||||
if ((BFD_ALIGN (obj_textsec (abfd)->_raw_size, arch_align)
|
||||
== obj_textsec (abfd)->_raw_size)
|
||||
&& (BFD_ALIGN (obj_datasec (abfd)->_raw_size, arch_align)
|
||||
== obj_datasec (abfd)->_raw_size)
|
||||
&& (BFD_ALIGN (obj_bsssec (abfd)->_raw_size, arch_align)
|
||||
== obj_bsssec (abfd)->_raw_size))
|
||||
{
|
||||
obj_textsec (abfd)->alignment_power = arch_align_power;
|
||||
obj_datasec (abfd)->alignment_power = arch_align_power;
|
||||
obj_bsssec (abfd)->alignment_power = arch_align_power;
|
||||
}
|
||||
|
||||
/* Don't set sizes now -- can't be sure until we know arch & mach.
|
||||
Sizes get set in set_sizes callback, later. */
|
||||
#if 0
|
||||
adata(abfd).page_size = TARGET_PAGE_SIZE;
|
||||
#ifdef SEGMENT_SIZE
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
#else
|
||||
adata(abfd).segment_size = TARGET_PAGE_SIZE;
|
||||
#endif
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
#endif
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef MY_object_p
|
||||
/* Finish up the reading of an a.out file header */
|
||||
|
||||
static const bfd_target *
|
||||
MY(object_p) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec exec_bytes; /* Raw exec header from file */
|
||||
struct internal_exec exec; /* Cleaned-up exec header */
|
||||
const bfd_target *target;
|
||||
|
||||
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
|
||||
!= EXEC_BYTES_SIZE) {
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SWAP_MAGIC
|
||||
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
|
||||
#else
|
||||
exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
|
||||
#endif /* SWAP_MAGIC */
|
||||
|
||||
if (N_BADMAG (exec)) return 0;
|
||||
#ifdef MACHTYPE_OK
|
||||
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
|
||||
#endif
|
||||
|
||||
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
|
||||
|
||||
#ifdef SWAP_MAGIC
|
||||
/* swap_exec_header_in read in a_info with the wrong byte order */
|
||||
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
|
||||
#endif /* SWAP_MAGIC */
|
||||
|
||||
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)
|
||||
* means that it isn't obvious if EXEC_P should be set.
|
||||
* All of the following must be true for an executable:
|
||||
* There must be no relocations, the bfd can be neither an
|
||||
* archive nor an archive element, and the file must be executable. */
|
||||
|
||||
if (exec.a_trsize + exec.a_drsize == 0
|
||||
&& bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
|
||||
{
|
||||
struct stat buf;
|
||||
#ifndef S_IXUSR
|
||||
#define S_IXUSR 0100 /* Execute by owner. */
|
||||
#endif
|
||||
if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
|
||||
abfd->flags |= EXEC_P;
|
||||
}
|
||||
#endif /* ENTRY_CAN_BE_ZERO */
|
||||
|
||||
return target;
|
||||
}
|
||||
#define MY_object_p MY(object_p)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MY_mkobject
|
||||
static boolean
|
||||
MY(mkobject) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (NAME(aout,mkobject)(abfd) == false)
|
||||
return false;
|
||||
#if 0 /* Sizes get set in set_sizes callback, later, after we know
|
||||
the architecture and machine. */
|
||||
adata(abfd).page_size = TARGET_PAGE_SIZE;
|
||||
#ifdef SEGMENT_SIZE
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
#else
|
||||
adata(abfd).segment_size = TARGET_PAGE_SIZE;
|
||||
#endif
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
#define MY_mkobject MY(mkobject)
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_copy_private_section_data
|
||||
|
||||
/* Copy private section data. This actually does nothing with the
|
||||
sections. It copies the subformat field. We copy it here, because
|
||||
we need to know whether this is a QMAGIC file before we set the
|
||||
section contents, and copy_private_bfd_data is not called until
|
||||
after the section contents have been set. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static boolean
|
||||
MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
|
||||
bfd *ibfd;
|
||||
asection *isec;
|
||||
bfd *obfd;
|
||||
asection *osec;
|
||||
{
|
||||
if (bfd_get_flavour (obfd) == bfd_target_aout_flavour)
|
||||
obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Write an object file.
|
||||
Section contents have already been written. We write the
|
||||
file header, symbols, and relocation. */
|
||||
|
||||
#ifndef MY_write_object_contents
|
||||
static boolean
|
||||
MY(write_object_contents) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
#if CHOOSE_RELOC_SIZE
|
||||
CHOOSE_RELOC_SIZE(abfd);
|
||||
#else
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
#endif
|
||||
|
||||
WRITE_HEADERS(abfd, execp);
|
||||
|
||||
return true;
|
||||
}
|
||||
#define MY_write_object_contents MY(write_object_contents)
|
||||
#endif
|
||||
|
||||
#ifndef MY_set_sizes
|
||||
static boolean
|
||||
MY(set_sizes) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
adata(abfd).page_size = TARGET_PAGE_SIZE;
|
||||
|
||||
#ifdef SEGMENT_SIZE
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
#else
|
||||
adata(abfd).segment_size = TARGET_PAGE_SIZE;
|
||||
#endif
|
||||
|
||||
#ifdef ZMAGIC_DISK_BLOCK_SIZE
|
||||
adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
|
||||
#else
|
||||
adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
|
||||
#endif
|
||||
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
return true;
|
||||
}
|
||||
#define MY_set_sizes MY(set_sizes)
|
||||
#endif
|
||||
|
||||
#ifndef MY_exec_hdr_flags
|
||||
#define MY_exec_hdr_flags 0
|
||||
#endif
|
||||
|
||||
#ifndef MY_backend_data
|
||||
|
||||
#ifndef MY_zmagic_contiguous
|
||||
#define MY_zmagic_contiguous 0
|
||||
#endif
|
||||
#ifndef MY_text_includes_header
|
||||
#define MY_text_includes_header 0
|
||||
#endif
|
||||
#ifndef MY_exec_header_not_counted
|
||||
#define MY_exec_header_not_counted 0
|
||||
#endif
|
||||
#ifndef MY_add_dynamic_symbols
|
||||
#define MY_add_dynamic_symbols 0
|
||||
#endif
|
||||
#ifndef MY_add_one_symbol
|
||||
#define MY_add_one_symbol 0
|
||||
#endif
|
||||
#ifndef MY_link_dynamic_object
|
||||
#define MY_link_dynamic_object 0
|
||||
#endif
|
||||
#ifndef MY_write_dynamic_symbol
|
||||
#define MY_write_dynamic_symbol 0
|
||||
#endif
|
||||
#ifndef MY_check_dynamic_reloc
|
||||
#define MY_check_dynamic_reloc 0
|
||||
#endif
|
||||
#ifndef MY_finish_dynamic_link
|
||||
#define MY_finish_dynamic_link 0
|
||||
#endif
|
||||
|
||||
static CONST struct aout_backend_data MY(backend_data) = {
|
||||
MY_zmagic_contiguous,
|
||||
MY_text_includes_header,
|
||||
MY_exec_hdr_flags,
|
||||
0, /* text vma? */
|
||||
MY_set_sizes,
|
||||
MY_exec_header_not_counted,
|
||||
MY_add_dynamic_symbols,
|
||||
MY_add_one_symbol,
|
||||
MY_link_dynamic_object,
|
||||
MY_write_dynamic_symbol,
|
||||
MY_check_dynamic_reloc,
|
||||
MY_finish_dynamic_link
|
||||
};
|
||||
#define MY_backend_data &MY(backend_data)
|
||||
#endif
|
||||
|
||||
#ifndef MY_final_link_callback
|
||||
|
||||
/* Callback for the final_link routine to set the section offsets. */
|
||||
|
||||
static void MY_final_link_callback
|
||||
PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
|
||||
|
||||
static void
|
||||
MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff)
|
||||
bfd *abfd;
|
||||
file_ptr *ptreloff;
|
||||
file_ptr *pdreloff;
|
||||
file_ptr *psymoff;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
*ptreloff = N_TRELOFF (*execp);
|
||||
*pdreloff = N_DRELOFF (*execp);
|
||||
*psymoff = N_SYMOFF (*execp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_final_link
|
||||
|
||||
/* Final link routine. We need to use a call back to get the correct
|
||||
offsets in the output file. */
|
||||
|
||||
static boolean
|
||||
MY_bfd_final_link (abfd, info)
|
||||
bfd *abfd;
|
||||
struct bfd_link_info *info;
|
||||
{
|
||||
return NAME(aout,final_link) (abfd, info, MY_final_link_callback);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* We assume BFD generic archive files. */
|
||||
#ifndef MY_openr_next_archived_file
|
||||
#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file
|
||||
#endif
|
||||
#ifndef MY_get_elt_at_index
|
||||
#define MY_get_elt_at_index _bfd_generic_get_elt_at_index
|
||||
#endif
|
||||
#ifndef MY_generic_stat_arch_elt
|
||||
#define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt
|
||||
#endif
|
||||
#ifndef MY_slurp_armap
|
||||
#define MY_slurp_armap bfd_slurp_bsd_armap
|
||||
#endif
|
||||
#ifndef MY_slurp_extended_name_table
|
||||
#define MY_slurp_extended_name_table _bfd_slurp_extended_name_table
|
||||
#endif
|
||||
#ifndef MY_construct_extended_name_table
|
||||
#define MY_construct_extended_name_table \
|
||||
_bfd_archive_bsd_construct_extended_name_table
|
||||
#endif
|
||||
#ifndef MY_write_armap
|
||||
#define MY_write_armap bsd_write_armap
|
||||
#endif
|
||||
#ifndef MY_read_ar_hdr
|
||||
#define MY_read_ar_hdr _bfd_generic_read_ar_hdr
|
||||
#endif
|
||||
#ifndef MY_truncate_arname
|
||||
#define MY_truncate_arname bfd_bsd_truncate_arname
|
||||
#endif
|
||||
#ifndef MY_update_armap_timestamp
|
||||
#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
|
||||
#endif
|
||||
|
||||
/* No core file defined here -- configure in trad-core.c separately. */
|
||||
#ifndef MY_core_file_failing_command
|
||||
#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command
|
||||
#endif
|
||||
#ifndef MY_core_file_failing_signal
|
||||
#define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal
|
||||
#endif
|
||||
#ifndef MY_core_file_matches_executable_p
|
||||
#define MY_core_file_matches_executable_p \
|
||||
_bfd_nocore_core_file_matches_executable_p
|
||||
#endif
|
||||
#ifndef MY_core_file_p
|
||||
#define MY_core_file_p _bfd_dummy_target
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_debug_info_start
|
||||
#define MY_bfd_debug_info_start bfd_void
|
||||
#endif
|
||||
#ifndef MY_bfd_debug_info_end
|
||||
#define MY_bfd_debug_info_end bfd_void
|
||||
#endif
|
||||
#ifndef MY_bfd_debug_info_accumulate
|
||||
#define MY_bfd_debug_info_accumulate \
|
||||
(void (*) PARAMS ((bfd*, struct sec *))) bfd_void
|
||||
#endif
|
||||
|
||||
#ifndef MY_core_file_failing_command
|
||||
#define MY_core_file_failing_command NAME(aout,core_file_failing_command)
|
||||
#endif
|
||||
#ifndef MY_core_file_failing_signal
|
||||
#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal)
|
||||
#endif
|
||||
#ifndef MY_core_file_matches_executable_p
|
||||
#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p)
|
||||
#endif
|
||||
#ifndef MY_set_section_contents
|
||||
#define MY_set_section_contents NAME(aout,set_section_contents)
|
||||
#endif
|
||||
#ifndef MY_get_section_contents
|
||||
#define MY_get_section_contents NAME(aout,get_section_contents)
|
||||
#endif
|
||||
#ifndef MY_get_section_contents_in_window
|
||||
#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||
#endif
|
||||
#ifndef MY_new_section_hook
|
||||
#define MY_new_section_hook NAME(aout,new_section_hook)
|
||||
#endif
|
||||
#ifndef MY_get_symtab_upper_bound
|
||||
#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)
|
||||
#endif
|
||||
#ifndef MY_get_symtab
|
||||
#define MY_get_symtab NAME(aout,get_symtab)
|
||||
#endif
|
||||
#ifndef MY_get_reloc_upper_bound
|
||||
#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)
|
||||
#endif
|
||||
#ifndef MY_canonicalize_reloc
|
||||
#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc)
|
||||
#endif
|
||||
#ifndef MY_make_empty_symbol
|
||||
#define MY_make_empty_symbol NAME(aout,make_empty_symbol)
|
||||
#endif
|
||||
#ifndef MY_print_symbol
|
||||
#define MY_print_symbol NAME(aout,print_symbol)
|
||||
#endif
|
||||
#ifndef MY_get_symbol_info
|
||||
#define MY_get_symbol_info NAME(aout,get_symbol_info)
|
||||
#endif
|
||||
#ifndef MY_get_lineno
|
||||
#define MY_get_lineno NAME(aout,get_lineno)
|
||||
#endif
|
||||
#ifndef MY_set_arch_mach
|
||||
#define MY_set_arch_mach NAME(aout,set_arch_mach)
|
||||
#endif
|
||||
#ifndef MY_find_nearest_line
|
||||
#define MY_find_nearest_line NAME(aout,find_nearest_line)
|
||||
#endif
|
||||
#ifndef MY_sizeof_headers
|
||||
#define MY_sizeof_headers NAME(aout,sizeof_headers)
|
||||
#endif
|
||||
#ifndef MY_bfd_get_relocated_section_contents
|
||||
#define MY_bfd_get_relocated_section_contents \
|
||||
bfd_generic_get_relocated_section_contents
|
||||
#endif
|
||||
#ifndef MY_bfd_relax_section
|
||||
#define MY_bfd_relax_section bfd_generic_relax_section
|
||||
#endif
|
||||
#ifndef MY_bfd_reloc_type_lookup
|
||||
#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
|
||||
#endif
|
||||
#ifndef MY_bfd_make_debug_symbol
|
||||
#define MY_bfd_make_debug_symbol 0
|
||||
#endif
|
||||
#ifndef MY_read_minisymbols
|
||||
#define MY_read_minisymbols NAME(aout,read_minisymbols)
|
||||
#endif
|
||||
#ifndef MY_minisymbol_to_symbol
|
||||
#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol)
|
||||
#endif
|
||||
#ifndef MY_bfd_link_hash_table_create
|
||||
#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create)
|
||||
#endif
|
||||
#ifndef MY_bfd_link_add_symbols
|
||||
#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)
|
||||
#endif
|
||||
#ifndef MY_bfd_link_split_section
|
||||
#define MY_bfd_link_split_section _bfd_generic_link_split_section
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MY_bfd_copy_private_bfd_data
|
||||
#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_merge_private_bfd_data
|
||||
#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_copy_private_symbol_data
|
||||
#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_print_private_bfd_data
|
||||
#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_set_private_flags
|
||||
#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_is_local_label
|
||||
#define MY_bfd_is_local_label bfd_generic_is_local_label
|
||||
#endif
|
||||
|
||||
#ifndef MY_bfd_free_cached_info
|
||||
#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)
|
||||
#endif
|
||||
|
||||
#ifndef MY_close_and_cleanup
|
||||
#define MY_close_and_cleanup MY_bfd_free_cached_info
|
||||
#endif
|
||||
|
||||
#ifndef MY_get_dynamic_symtab_upper_bound
|
||||
#define MY_get_dynamic_symtab_upper_bound \
|
||||
_bfd_nodynamic_get_dynamic_symtab_upper_bound
|
||||
#endif
|
||||
#ifndef MY_canonicalize_dynamic_symtab
|
||||
#define MY_canonicalize_dynamic_symtab \
|
||||
_bfd_nodynamic_canonicalize_dynamic_symtab
|
||||
#endif
|
||||
#ifndef MY_get_dynamic_reloc_upper_bound
|
||||
#define MY_get_dynamic_reloc_upper_bound \
|
||||
_bfd_nodynamic_get_dynamic_reloc_upper_bound
|
||||
#endif
|
||||
#ifndef MY_canonicalize_dynamic_reloc
|
||||
#define MY_canonicalize_dynamic_reloc \
|
||||
_bfd_nodynamic_canonicalize_dynamic_reloc
|
||||
#endif
|
||||
|
||||
/* Aout symbols normally have leading underscores */
|
||||
#ifndef MY_symbol_leading_char
|
||||
#define MY_symbol_leading_char '_'
|
||||
#endif
|
||||
|
||||
/* Aout archives normally use spaces for padding */
|
||||
#ifndef AR_PAD_CHAR
|
||||
#define AR_PAD_CHAR ' '
|
||||
#endif
|
||||
|
||||
#ifndef MY_BFD_TARGET
|
||||
const bfd_target MY(vec) =
|
||||
{
|
||||
TARGETNAME, /* name */
|
||||
bfd_target_aout_flavour,
|
||||
#ifdef TARGET_IS_BIG_ENDIAN_P
|
||||
BFD_ENDIAN_BIG, /* target byte order (big) */
|
||||
BFD_ENDIAN_BIG, /* target headers byte order (big) */
|
||||
#else
|
||||
BFD_ENDIAN_LITTLE, /* target byte order (little) */
|
||||
BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
|
||||
#endif
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
MY_symbol_leading_char,
|
||||
AR_PAD_CHAR, /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
#ifdef TARGET_IS_BIG_ENDIAN_P
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
||||
#else
|
||||
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 */
|
||||
#endif
|
||||
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, MY_core_file_p},
|
||||
{bfd_false, MY_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (MY),
|
||||
BFD_JUMP_TABLE_COPY (MY),
|
||||
BFD_JUMP_TABLE_CORE (MY),
|
||||
BFD_JUMP_TABLE_ARCHIVE (MY),
|
||||
BFD_JUMP_TABLE_SYMBOLS (MY),
|
||||
BFD_JUMP_TABLE_RELOCS (MY),
|
||||
BFD_JUMP_TABLE_WRITE (MY),
|
||||
BFD_JUMP_TABLE_LINK (MY),
|
||||
BFD_JUMP_TABLE_DYNAMIC (MY),
|
||||
|
||||
(PTR) MY_backend_data,
|
||||
};
|
||||
#endif /* MY_BFD_TARGET */
|
@ -1,23 +0,0 @@
|
||||
/* BFD back-end for 32-bit a.out files.
|
||||
Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define ARCH_SIZE 32
|
||||
|
||||
#include "aoutx.h"
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,720 +0,0 @@
|
||||
/* BFD library support routines for architectures.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 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.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include <ctype.h>
|
||||
|
||||
/*
|
||||
|
||||
SECTION
|
||||
Architectures
|
||||
|
||||
BFD keeps one atom in a BFD describing the
|
||||
architecture of the data attached to the BFD: a pointer to a
|
||||
<<bfd_arch_info_type>>.
|
||||
|
||||
Pointers to structures can be requested independently of a BFD
|
||||
so that an architecture's information can be interrogated
|
||||
without access to an open BFD.
|
||||
|
||||
The architecture information is provided by each architecture package.
|
||||
The set of default architectures is selected by the macro
|
||||
<<SELECT_ARCHITECTURES>>. This is normally set up in the
|
||||
@file{config/@var{target}.mt} file of your choice. If the name is not
|
||||
defined, then all the architectures supported are included.
|
||||
|
||||
When BFD starts up, all the architectures are called with an
|
||||
initialize method. It is up to the architecture back end to
|
||||
insert as many items into the list of architectures as it wants to;
|
||||
generally this would be one for each machine and one for the
|
||||
default case (an item with a machine field of 0).
|
||||
|
||||
BFD's idea of an architecture is implemented in @file{archures.c}.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
SUBSECTION
|
||||
bfd_architecture
|
||||
|
||||
DESCRIPTION
|
||||
This enum gives the object file's CPU architecture, in a
|
||||
global sense---i.e., what processor family does it belong to?
|
||||
Another field indicates which processor within
|
||||
the family is in use. The machine gives a number which
|
||||
distinguishes different versions of the architecture,
|
||||
containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
|
||||
and 68020 and 68030 for Motorola 68020 and 68030.
|
||||
|
||||
.enum bfd_architecture
|
||||
.{
|
||||
. bfd_arch_unknown, {* File arch not known *}
|
||||
. bfd_arch_obscure, {* Arch known, not one of these *}
|
||||
. bfd_arch_m68k, {* Motorola 68xxx *}
|
||||
. bfd_arch_vax, {* DEC Vax *}
|
||||
. bfd_arch_i960, {* Intel 960 *}
|
||||
. {* The order of the following is important.
|
||||
. lower number indicates a machine type that
|
||||
. only accepts a subset of the instructions
|
||||
. available to machines with higher numbers.
|
||||
. The exception is the "ca", which is
|
||||
. incompatible with all other machines except
|
||||
. "core". *}
|
||||
.
|
||||
.#define bfd_mach_i960_core 1
|
||||
.#define bfd_mach_i960_ka_sa 2
|
||||
.#define bfd_mach_i960_kb_sb 3
|
||||
.#define bfd_mach_i960_mc 4
|
||||
.#define bfd_mach_i960_xa 5
|
||||
.#define bfd_mach_i960_ca 6
|
||||
.#define bfd_mach_i960_jx 7
|
||||
.#define bfd_mach_i960_hx 8
|
||||
.
|
||||
. bfd_arch_a29k, {* AMD 29000 *}
|
||||
. bfd_arch_sparc, {* SPARC *}
|
||||
.#define bfd_mach_sparc 1
|
||||
.{* The difference between v8plus and v9 is that v9 is a true 64 bit env. *}
|
||||
.#define bfd_mach_sparc_v8plus 2
|
||||
.#define bfd_mach_sparc_v8plusa 3 {* with ultrasparc add'ns *}
|
||||
.#define bfd_mach_sparc_v9 4
|
||||
.#define bfd_mach_sparc_v9a 5 {* with ultrasparc add'ns *}
|
||||
.{* Nonzero if MACH has the v9 instruction set. *}
|
||||
.#define bfd_mach_sparc_v9_p(mach) ((mach) != bfd_mach_sparc)
|
||||
. bfd_arch_mips, {* MIPS Rxxxx *}
|
||||
. bfd_arch_i386, {* Intel 386 *}
|
||||
. bfd_arch_we32k, {* AT&T WE32xxx *}
|
||||
. bfd_arch_tahoe, {* CCI/Harris Tahoe *}
|
||||
. bfd_arch_i860, {* Intel 860 *}
|
||||
. bfd_arch_romp, {* IBM ROMP PC/RT *}
|
||||
. bfd_arch_alliant, {* Alliant *}
|
||||
. bfd_arch_convex, {* Convex *}
|
||||
. bfd_arch_m88k, {* Motorola 88xxx *}
|
||||
. bfd_arch_pyramid, {* Pyramid Technology *}
|
||||
. bfd_arch_h8300, {* Hitachi H8/300 *}
|
||||
.#define bfd_mach_h8300 1
|
||||
.#define bfd_mach_h8300h 2
|
||||
. bfd_arch_powerpc, {* PowerPC *}
|
||||
. bfd_arch_rs6000, {* IBM RS/6000 *}
|
||||
. bfd_arch_hppa, {* HP PA RISC *}
|
||||
. bfd_arch_z8k, {* Zilog Z8000 *}
|
||||
.#define bfd_mach_z8001 1
|
||||
.#define bfd_mach_z8002 2
|
||||
. bfd_arch_h8500, {* Hitachi H8/500 *}
|
||||
. bfd_arch_sh, {* Hitachi SH *}
|
||||
. bfd_arch_alpha, {* Dec Alpha *}
|
||||
. bfd_arch_arm, {* Advanced Risc Machines ARM *}
|
||||
. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
|
||||
. bfd_arch_w65, {* WDC 65816 *}
|
||||
. bfd_arch_last
|
||||
. };
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
SUBSECTION
|
||||
bfd_arch_info
|
||||
|
||||
DESCRIPTION
|
||||
This structure contains information on architectures for use
|
||||
within BFD.
|
||||
|
||||
.
|
||||
.typedef struct bfd_arch_info
|
||||
.{
|
||||
. int bits_per_word;
|
||||
. int bits_per_address;
|
||||
. int bits_per_byte;
|
||||
. enum bfd_architecture arch;
|
||||
. unsigned long mach;
|
||||
. const char *arch_name;
|
||||
. const char *printable_name;
|
||||
. unsigned int section_align_power;
|
||||
. {* true if this is the default machine for the architecture *}
|
||||
. boolean the_default;
|
||||
. const struct bfd_arch_info * (*compatible)
|
||||
. PARAMS ((const struct bfd_arch_info *a,
|
||||
. const struct bfd_arch_info *b));
|
||||
.
|
||||
. boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
|
||||
.
|
||||
. const struct bfd_arch_info *next;
|
||||
.} bfd_arch_info_type;
|
||||
*/
|
||||
|
||||
extern const bfd_arch_info_type bfd_a29k_arch;
|
||||
extern const bfd_arch_info_type bfd_alpha_arch;
|
||||
extern const bfd_arch_info_type bfd_arm_arch;
|
||||
extern const bfd_arch_info_type bfd_h8300_arch;
|
||||
extern const bfd_arch_info_type bfd_h8500_arch;
|
||||
extern const bfd_arch_info_type bfd_hppa_arch;
|
||||
extern const bfd_arch_info_type bfd_i386_arch;
|
||||
extern const bfd_arch_info_type bfd_i860_arch;
|
||||
extern const bfd_arch_info_type bfd_i960_arch;
|
||||
extern const bfd_arch_info_type bfd_m68k_arch;
|
||||
extern const bfd_arch_info_type bfd_m88k_arch;
|
||||
extern const bfd_arch_info_type bfd_mips_arch;
|
||||
extern const bfd_arch_info_type bfd_powerpc_arch;
|
||||
extern const bfd_arch_info_type bfd_rs6000_arch;
|
||||
extern const bfd_arch_info_type bfd_sh_arch;
|
||||
extern const bfd_arch_info_type bfd_sparc_arch;
|
||||
extern const bfd_arch_info_type bfd_vax_arch;
|
||||
extern const bfd_arch_info_type bfd_we32k_arch;
|
||||
extern const bfd_arch_info_type bfd_z8k_arch;
|
||||
extern const bfd_arch_info_type bfd_ns32k_arch;
|
||||
extern const bfd_arch_info_type bfd_w65_arch;
|
||||
|
||||
static const bfd_arch_info_type * const bfd_archures_list[] =
|
||||
{
|
||||
#ifdef SELECT_ARCHITECTURES
|
||||
SELECT_ARCHITECTURES,
|
||||
#else
|
||||
&bfd_a29k_arch,
|
||||
&bfd_alpha_arch,
|
||||
&bfd_arm_arch,
|
||||
&bfd_h8300_arch,
|
||||
&bfd_h8500_arch,
|
||||
&bfd_hppa_arch,
|
||||
&bfd_i386_arch,
|
||||
&bfd_i860_arch,
|
||||
&bfd_i960_arch,
|
||||
&bfd_m68k_arch,
|
||||
&bfd_m88k_arch,
|
||||
&bfd_mips_arch,
|
||||
&bfd_powerpc_arch,
|
||||
&bfd_rs6000_arch,
|
||||
&bfd_sh_arch,
|
||||
&bfd_sparc_arch,
|
||||
&bfd_vax_arch,
|
||||
&bfd_we32k_arch,
|
||||
&bfd_z8k_arch,
|
||||
&bfd_ns32k_arch,
|
||||
&bfd_w65_arch,
|
||||
#endif
|
||||
0
|
||||
};
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_printable_name
|
||||
|
||||
SYNOPSIS
|
||||
const char *bfd_printable_name(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return a printable string representing the architecture and machine
|
||||
from the pointer to the architecture info structure.
|
||||
|
||||
*/
|
||||
|
||||
const char *
|
||||
bfd_printable_name (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return abfd->arch_info->printable_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_scan_arch
|
||||
|
||||
SYNOPSIS
|
||||
const bfd_arch_info_type *bfd_scan_arch(const char *string);
|
||||
|
||||
DESCRIPTION
|
||||
Figure out if BFD supports any cpu which could be described with
|
||||
the name @var{string}. Return a pointer to an <<arch_info>>
|
||||
structure if a machine is found, otherwise NULL.
|
||||
|
||||
*/
|
||||
|
||||
const bfd_arch_info_type *
|
||||
bfd_scan_arch (string)
|
||||
const char *string;
|
||||
{
|
||||
const bfd_arch_info_type * const *app, *ap;
|
||||
|
||||
/* Look through all the installed architectures */
|
||||
for (app = bfd_archures_list; *app != NULL; app++)
|
||||
{
|
||||
for (ap = *app; ap != NULL; ap = ap->next)
|
||||
{
|
||||
if (ap->scan (ap, string))
|
||||
return ap;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_arch_get_compatible
|
||||
|
||||
SYNOPSIS
|
||||
const bfd_arch_info_type *bfd_arch_get_compatible(
|
||||
const bfd *abfd,
|
||||
const bfd *bbfd);
|
||||
|
||||
DESCRIPTION
|
||||
Determine whether two BFDs'
|
||||
architectures and machine types are compatible. Calculates
|
||||
the lowest common denominator between the two architectures
|
||||
and machine types implied by the BFDs and returns a pointer to
|
||||
an <<arch_info>> structure describing the compatible machine.
|
||||
*/
|
||||
|
||||
const bfd_arch_info_type *
|
||||
bfd_arch_get_compatible (abfd, bbfd)
|
||||
const bfd *abfd;
|
||||
const bfd *bbfd;
|
||||
{
|
||||
/* If either architecture is unknown, then all we can do is assume
|
||||
the user knows what he's doing. */
|
||||
if (abfd->arch_info->arch == bfd_arch_unknown)
|
||||
return bbfd->arch_info;
|
||||
if (bbfd->arch_info->arch == bfd_arch_unknown)
|
||||
return abfd->arch_info;
|
||||
|
||||
/* Otherwise architecture-specific code has to decide. */
|
||||
return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
INTERNAL_DEFINITION
|
||||
bfd_default_arch_struct
|
||||
|
||||
DESCRIPTION
|
||||
The <<bfd_default_arch_struct>> is an item of
|
||||
<<bfd_arch_info_type>> which has been initialized to a fairly
|
||||
generic state. A BFD starts life by pointing to this
|
||||
structure, until the correct back end has determined the real
|
||||
architecture of the file.
|
||||
|
||||
.extern const bfd_arch_info_type bfd_default_arch_struct;
|
||||
|
||||
*/
|
||||
|
||||
const bfd_arch_info_type bfd_default_arch_struct =
|
||||
{
|
||||
32,32,8,bfd_arch_unknown,0,"unknown","unknown",2,true,
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan,
|
||||
0,
|
||||
};
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_set_arch_info
|
||||
|
||||
SYNOPSIS
|
||||
void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg);
|
||||
|
||||
DESCRIPTION
|
||||
Set the architecture info of @var{abfd} to @var{arg}.
|
||||
*/
|
||||
|
||||
void
|
||||
bfd_set_arch_info (abfd, arg)
|
||||
bfd *abfd;
|
||||
const bfd_arch_info_type *arg;
|
||||
{
|
||||
abfd->arch_info = arg;
|
||||
}
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_default_set_arch_mach
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_default_set_arch_mach(bfd *abfd,
|
||||
enum bfd_architecture arch,
|
||||
unsigned long mach);
|
||||
|
||||
DESCRIPTION
|
||||
Set the architecture and machine type in BFD @var{abfd}
|
||||
to @var{arch} and @var{mach}. Find the correct
|
||||
pointer to a structure and insert it into the <<arch_info>>
|
||||
pointer.
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_default_set_arch_mach (abfd, arch, mach)
|
||||
bfd *abfd;
|
||||
enum bfd_architecture arch;
|
||||
unsigned long mach;
|
||||
{
|
||||
const bfd_arch_info_type * const *app, *ap;
|
||||
|
||||
for (app = bfd_archures_list; *app != NULL; app++)
|
||||
{
|
||||
for (ap = *app; ap != NULL; ap = ap->next)
|
||||
{
|
||||
if (ap->arch == arch
|
||||
&& (ap->mach == mach
|
||||
|| (mach == 0 && ap->the_default)))
|
||||
{
|
||||
abfd->arch_info = ap;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abfd->arch_info = &bfd_default_arch_struct;
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_get_arch
|
||||
|
||||
SYNOPSIS
|
||||
enum bfd_architecture bfd_get_arch(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return the enumerated type which describes the BFD @var{abfd}'s
|
||||
architecture.
|
||||
|
||||
*/
|
||||
|
||||
enum bfd_architecture
|
||||
bfd_get_arch (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return abfd->arch_info->arch;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_get_mach
|
||||
|
||||
SYNOPSIS
|
||||
unsigned long bfd_get_mach(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return the long type which describes the BFD @var{abfd}'s
|
||||
machine.
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
bfd_get_mach (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return abfd->arch_info->mach;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_arch_bits_per_byte
|
||||
|
||||
SYNOPSIS
|
||||
unsigned int bfd_arch_bits_per_byte(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return the number of bits in one of the BFD @var{abfd}'s
|
||||
architecture's bytes.
|
||||
|
||||
*/
|
||||
|
||||
unsigned int
|
||||
bfd_arch_bits_per_byte (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return abfd->arch_info->bits_per_byte;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_arch_bits_per_address
|
||||
|
||||
SYNOPSIS
|
||||
unsigned int bfd_arch_bits_per_address(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return the number of bits in one of the BFD @var{abfd}'s
|
||||
architecture's addresses.
|
||||
*/
|
||||
|
||||
unsigned int
|
||||
bfd_arch_bits_per_address (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return abfd->arch_info->bits_per_address;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_default_compatible
|
||||
|
||||
SYNOPSIS
|
||||
const bfd_arch_info_type *bfd_default_compatible
|
||||
(const bfd_arch_info_type *a,
|
||||
const bfd_arch_info_type *b);
|
||||
|
||||
DESCRIPTION
|
||||
The default function for testing for compatibility.
|
||||
*/
|
||||
|
||||
const bfd_arch_info_type *
|
||||
bfd_default_compatible (a,b)
|
||||
const bfd_arch_info_type *a;
|
||||
const bfd_arch_info_type *b;
|
||||
{
|
||||
if (a->arch != b->arch)
|
||||
return NULL;
|
||||
|
||||
if (a->mach > b->mach)
|
||||
return a;
|
||||
|
||||
if (b->mach > a->mach)
|
||||
return b;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_default_scan
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);
|
||||
|
||||
DESCRIPTION
|
||||
The default function for working out whether this is an
|
||||
architecture hit and a machine hit.
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_default_scan (info, string)
|
||||
const struct bfd_arch_info *info;
|
||||
const char *string;
|
||||
{
|
||||
const char *ptr_src;
|
||||
const char *ptr_tst;
|
||||
unsigned long number;
|
||||
enum bfd_architecture arch;
|
||||
|
||||
/* First test for an exact match */
|
||||
if (strcmp (string, info->printable_name) == 0)
|
||||
return true;
|
||||
|
||||
/* See how much of the supplied string matches with the
|
||||
architecture, eg the string m68k:68020 would match the 68k entry
|
||||
up to the :, then we get left with the machine number */
|
||||
|
||||
for (ptr_src = string, ptr_tst = info->arch_name;
|
||||
*ptr_src && *ptr_tst;
|
||||
ptr_src++, ptr_tst++)
|
||||
{
|
||||
if (*ptr_src != *ptr_tst) break;
|
||||
}
|
||||
|
||||
/* Chewed up as much of the architecture as will match, skip any
|
||||
colons */
|
||||
if (*ptr_src == ':')
|
||||
ptr_src++;
|
||||
|
||||
if (*ptr_src == 0)
|
||||
{
|
||||
/* nothing more, then only keep this one if it is the default
|
||||
machine for this architecture */
|
||||
return info->the_default;
|
||||
}
|
||||
|
||||
number = 0;
|
||||
while (isdigit(*ptr_src))
|
||||
{
|
||||
number = number * 10 + *ptr_src - '0';
|
||||
ptr_src++;
|
||||
}
|
||||
|
||||
switch (number)
|
||||
{
|
||||
case 65:
|
||||
arch = bfd_arch_w65;
|
||||
break;
|
||||
|
||||
case 300:
|
||||
arch = bfd_arch_h8300;
|
||||
break;
|
||||
|
||||
case 500:
|
||||
arch = bfd_arch_h8500;
|
||||
break;
|
||||
|
||||
case 68010:
|
||||
case 68020:
|
||||
case 68030:
|
||||
case 68040:
|
||||
case 68332:
|
||||
case 68050:
|
||||
case 68000:
|
||||
arch = bfd_arch_m68k;
|
||||
break;
|
||||
|
||||
case 386:
|
||||
case 80386:
|
||||
case 486:
|
||||
case 80486:
|
||||
arch = bfd_arch_i386;
|
||||
break;
|
||||
|
||||
case 29000:
|
||||
arch = bfd_arch_a29k;
|
||||
break;
|
||||
|
||||
case 8000:
|
||||
arch = bfd_arch_z8k;
|
||||
break;
|
||||
|
||||
case 32000:
|
||||
arch = bfd_arch_we32k;
|
||||
break;
|
||||
|
||||
case 860:
|
||||
case 80860:
|
||||
arch = bfd_arch_i860;
|
||||
break;
|
||||
case 960:
|
||||
case 80960:
|
||||
arch = bfd_arch_i960;
|
||||
break;
|
||||
|
||||
case 2000:
|
||||
case 3000:
|
||||
case 4000:
|
||||
case 4400:
|
||||
arch = bfd_arch_mips;
|
||||
break;
|
||||
|
||||
case 6000:
|
||||
arch = bfd_arch_rs6000;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (arch != info->arch)
|
||||
return false;
|
||||
|
||||
if (number != info->mach)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_get_arch_info
|
||||
|
||||
SYNOPSIS
|
||||
const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return the architecture info struct in @var{abfd}.
|
||||
*/
|
||||
|
||||
const bfd_arch_info_type *
|
||||
bfd_get_arch_info (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return abfd->arch_info;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_lookup_arch
|
||||
|
||||
SYNOPSIS
|
||||
const bfd_arch_info_type *bfd_lookup_arch
|
||||
(enum bfd_architecture
|
||||
arch,
|
||||
unsigned long machine);
|
||||
|
||||
DESCRIPTION
|
||||
Look for the architecure info structure which matches the
|
||||
arguments @var{arch} and @var{machine}. A machine of 0 matches the
|
||||
machine/architecture structure which marks itself as the
|
||||
default.
|
||||
*/
|
||||
|
||||
const bfd_arch_info_type *
|
||||
bfd_lookup_arch (arch, machine)
|
||||
enum bfd_architecture arch;
|
||||
unsigned long machine;
|
||||
{
|
||||
const bfd_arch_info_type * const *app, *ap;
|
||||
|
||||
for (app = bfd_archures_list; *app != NULL; app++)
|
||||
{
|
||||
for (ap = *app; ap != NULL; ap = ap->next)
|
||||
{
|
||||
if (ap->arch == arch
|
||||
&& (ap->mach == machine
|
||||
|| (machine == 0 && ap->the_default)))
|
||||
return ap;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_printable_arch_mach
|
||||
|
||||
SYNOPSIS
|
||||
const char *bfd_printable_arch_mach
|
||||
(enum bfd_architecture arch, unsigned long machine);
|
||||
|
||||
DESCRIPTION
|
||||
Return a printable string representing the architecture and
|
||||
machine type.
|
||||
|
||||
This routine is depreciated.
|
||||
*/
|
||||
|
||||
const char *
|
||||
bfd_printable_arch_mach (arch, machine)
|
||||
enum bfd_architecture arch;
|
||||
unsigned long machine;
|
||||
{
|
||||
const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine);
|
||||
|
||||
if (ap)
|
||||
return ap->printable_name;
|
||||
return "UNKNOWN!";
|
||||
}
|
@ -1,668 +0,0 @@
|
||||
/* Main header file for the bfd library -- portable access to object files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
|
||||
** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them;
|
||||
** instead, change bfd-in.h or the other BFD source files processed to
|
||||
** generate these 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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* bfd.h -- The only header file required by users of the bfd library
|
||||
|
||||
The bfd.h file is generated from bfd-in.h and various .c files; if you
|
||||
change it, your changes will probably be lost.
|
||||
|
||||
All the prototypes and definitions following the comment "THE FOLLOWING
|
||||
IS EXTRACTED FROM THE SOURCE" are extracted from the source files for
|
||||
BFD. If you change it, someone oneday will extract it from the source
|
||||
again, and your changes will be lost. To save yourself from this bind,
|
||||
change the definitions in the source in the bfd directory. Type "make
|
||||
docs" and then "make headers" in that directory, and magically this file
|
||||
will change to reflect your changes.
|
||||
|
||||
If you don't have the tools to perform the extraction, then you are
|
||||
safe from someone on your system trampling over your header files.
|
||||
You should still maintain the equivalence between the source and this
|
||||
file though; every change you make to the .c file should be reflected
|
||||
here. */
|
||||
|
||||
#ifndef __BFD_H_SEEN__
|
||||
#define __BFD_H_SEEN__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ansidecl.h"
|
||||
#include "obstack.h"
|
||||
|
||||
/* These two lines get substitutions done by commands in Makefile.in. */
|
||||
#define BFD_VERSION "@VERSION@"
|
||||
#define BFD_ARCH_SIZE @WORDSIZE@
|
||||
#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
|
||||
|
||||
#if BFD_ARCH_SIZE >= 64
|
||||
#define BFD64
|
||||
#endif
|
||||
|
||||
#ifndef INLINE
|
||||
#if __GNUC__ >= 2
|
||||
#define INLINE __inline__
|
||||
#else
|
||||
#define INLINE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* forward declaration */
|
||||
typedef struct _bfd bfd;
|
||||
|
||||
/* To squelch erroneous compiler warnings ("illegal pointer
|
||||
combination") from the SVR3 compiler, we would like to typedef
|
||||
boolean to int (it doesn't like functions which return boolean.
|
||||
Making sure they are never implicitly declared to return int
|
||||
doesn't seem to help). But this file is not configured based on
|
||||
the host. */
|
||||
/* General rules: functions which are boolean return true on success
|
||||
and false on failure (unless they're a predicate). -- bfd.doc */
|
||||
/* I'm sure this is going to break something and someone is going to
|
||||
force me to change it. */
|
||||
/* typedef enum boolean {false, true} boolean; */
|
||||
/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
|
||||
/* It gets worse if the host also defines a true/false enum... -sts */
|
||||
/* And even worse if your compiler has built-in boolean types... -law */
|
||||
#if defined (__GNUG__) && (__GNUC_MINOR__ > 5)
|
||||
#define TRUE_FALSE_ALREADY_DEFINED
|
||||
#endif
|
||||
#ifdef MPW
|
||||
/* Pre-emptive strike - get the file with the enum. */
|
||||
#include <Types.h>
|
||||
#define TRUE_FALSE_ALREADY_DEFINED
|
||||
#endif /* MPW */
|
||||
#ifndef TRUE_FALSE_ALREADY_DEFINED
|
||||
typedef enum bfd_boolean {false, true} boolean;
|
||||
#define BFD_TRUE_FALSE
|
||||
#else
|
||||
/* Use enum names that will appear nowhere else. */
|
||||
typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
|
||||
#endif
|
||||
|
||||
/* A pointer to a position in a file. */
|
||||
/* FIXME: This should be using off_t from <sys/types.h>.
|
||||
For now, try to avoid breaking stuff by not including <sys/types.h> here.
|
||||
This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
|
||||
Probably the best long-term answer is to avoid using file_ptr AND off_t
|
||||
in this header file, and to handle this in the BFD implementation
|
||||
rather than in its interface. */
|
||||
/* typedef off_t file_ptr; */
|
||||
typedef long int file_ptr;
|
||||
|
||||
/* Support for different sizes of target format ints and addresses.
|
||||
If the type `long' is at least 64 bits, BFD_HOST_64BIT_LONG will be
|
||||
set to 1 above. Otherwise, if gcc is being used, this code will
|
||||
use gcc's "long long" type. Otherwise, the compilation will fail
|
||||
if 64-bit targets are requested. */
|
||||
|
||||
#ifdef BFD64
|
||||
|
||||
#ifndef BFD_HOST_64_BIT
|
||||
#if BFD_HOST_64BIT_LONG
|
||||
#define BFD_HOST_64_BIT long
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define BFD_HOST_64_BIT long long
|
||||
#endif /* defined (__GNUC__) */
|
||||
#endif /* ! BFD_HOST_64BIT_LONG */
|
||||
#endif /* ! defined (BFD_HOST_64_BIT) */
|
||||
|
||||
typedef unsigned BFD_HOST_64_BIT bfd_vma;
|
||||
typedef BFD_HOST_64_BIT bfd_signed_vma;
|
||||
typedef unsigned BFD_HOST_64_BIT bfd_size_type;
|
||||
typedef unsigned BFD_HOST_64_BIT symvalue;
|
||||
|
||||
#ifndef fprintf_vma
|
||||
#if BFD_HOST_64BIT_LONG
|
||||
#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
|
||||
#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
|
||||
#else
|
||||
#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
|
||||
#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
|
||||
#define fprintf_vma(s,x) \
|
||||
fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
|
||||
#define sprintf_vma(s,x) \
|
||||
sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else /* not BFD64 */
|
||||
|
||||
/* Represent a target address. Also used as a generic unsigned type
|
||||
which is guaranteed to be big enough to hold any arithmetic types
|
||||
we need to deal with. */
|
||||
typedef unsigned long bfd_vma;
|
||||
|
||||
/* A generic signed type which is guaranteed to be big enough to hold any
|
||||
arithmetic types we need to deal with. Can be assumed to be compatible
|
||||
with bfd_vma in the same way that signed and unsigned ints are compatible
|
||||
(as parameters, in assignment, etc). */
|
||||
typedef long bfd_signed_vma;
|
||||
|
||||
typedef unsigned long symvalue;
|
||||
typedef unsigned long bfd_size_type;
|
||||
|
||||
/* Print a bfd_vma x on stream s. */
|
||||
#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
|
||||
#define sprintf_vma(s,x) sprintf(s, "%08lx", x)
|
||||
#endif /* not BFD64 */
|
||||
#define printf_vma(x) fprintf_vma(stdout,x)
|
||||
|
||||
typedef unsigned int flagword; /* 32 bits of flags */
|
||||
typedef unsigned char bfd_byte;
|
||||
|
||||
/** File formats */
|
||||
|
||||
typedef enum bfd_format {
|
||||
bfd_unknown = 0, /* file format is unknown */
|
||||
bfd_object, /* linker/assember/compiler output */
|
||||
bfd_archive, /* object archive file */
|
||||
bfd_core, /* core dump */
|
||||
bfd_type_end} /* marks the end; don't use it! */
|
||||
bfd_format;
|
||||
|
||||
/* Values that may appear in the flags field of a BFD. These also
|
||||
appear in the object_flags field of the bfd_target structure, where
|
||||
they indicate the set of flags used by that backend (not all flags
|
||||
are meaningful for all object file formats) (FIXME: at the moment,
|
||||
the object_flags values have mostly just been copied from backend
|
||||
to another, and are not necessarily correct). */
|
||||
|
||||
/* No flags. */
|
||||
#define NO_FLAGS 0x00
|
||||
|
||||
/* BFD contains relocation entries. */
|
||||
#define HAS_RELOC 0x01
|
||||
|
||||
/* BFD is directly executable. */
|
||||
#define EXEC_P 0x02
|
||||
|
||||
/* BFD has line number information (basically used for F_LNNO in a
|
||||
COFF header). */
|
||||
#define HAS_LINENO 0x04
|
||||
|
||||
/* BFD has debugging information. */
|
||||
#define HAS_DEBUG 0x08
|
||||
|
||||
/* BFD has symbols. */
|
||||
#define HAS_SYMS 0x10
|
||||
|
||||
/* BFD has local symbols (basically used for F_LSYMS in a COFF
|
||||
header). */
|
||||
#define HAS_LOCALS 0x20
|
||||
|
||||
/* BFD is a dynamic object. */
|
||||
#define DYNAMIC 0x40
|
||||
|
||||
/* Text section is write protected (if D_PAGED is not set, this is
|
||||
like an a.out NMAGIC file) (the linker sets this by default, but
|
||||
clears it for -r or -N). */
|
||||
#define WP_TEXT 0x80
|
||||
|
||||
/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
|
||||
linker sets this by default, but clears it for -r or -n or -N). */
|
||||
#define D_PAGED 0x100
|
||||
|
||||
/* BFD is relaxable (this means that bfd_relax_section may be able to
|
||||
do something) (sometimes bfd_relax_section can do something even if
|
||||
this is not set). */
|
||||
#define BFD_IS_RELAXABLE 0x200
|
||||
|
||||
/* This may be set before writing out a BFD to request using a
|
||||
traditional format. For example, this is used to request that when
|
||||
writing out an a.out object the symbols not be hashed to eliminate
|
||||
duplicates. */
|
||||
#define BFD_TRADITIONAL_FORMAT 0x400
|
||||
|
||||
/* This flag indicates that the BFD contents are actually cached in
|
||||
memory. If this is set, iostream points to a bfd_in_memory struct. */
|
||||
#define BFD_IN_MEMORY 0x800
|
||||
|
||||
/* symbols and relocation */
|
||||
|
||||
/* A count of carsyms (canonical archive symbols). */
|
||||
typedef unsigned long symindex;
|
||||
|
||||
/* How to perform a relocation. */
|
||||
typedef const struct reloc_howto_struct reloc_howto_type;
|
||||
|
||||
#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
|
||||
|
||||
/* General purpose part of a symbol X;
|
||||
target specific parts are in libcoff.h, libaout.h, etc. */
|
||||
|
||||
#define bfd_get_section(x) ((x)->section)
|
||||
#define bfd_get_output_section(x) ((x)->section->output_section)
|
||||
#define bfd_set_section(x,y) ((x)->section) = (y)
|
||||
#define bfd_asymbol_base(x) ((x)->section->vma)
|
||||
#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
|
||||
#define bfd_asymbol_name(x) ((x)->name)
|
||||
/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
|
||||
#define bfd_asymbol_bfd(x) ((x)->the_bfd)
|
||||
#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
|
||||
|
||||
/* A canonical archive symbol. */
|
||||
/* This is a type pun with struct ranlib on purpose! */
|
||||
typedef struct carsym {
|
||||
char *name;
|
||||
file_ptr file_offset; /* look here to find the file */
|
||||
} carsym; /* to make these you call a carsymogen */
|
||||
|
||||
|
||||
/* Used in generating armaps (archive tables of contents).
|
||||
Perhaps just a forward definition would do? */
|
||||
struct orl { /* output ranlib */
|
||||
char **name; /* symbol name */
|
||||
file_ptr pos; /* bfd* or file position */
|
||||
int namidx; /* index into string table */
|
||||
};
|
||||
|
||||
|
||||
/* Linenumber stuff */
|
||||
typedef struct lineno_cache_entry {
|
||||
unsigned int line_number; /* Linenumber from start of function*/
|
||||
union {
|
||||
struct symbol_cache_entry *sym; /* Function name */
|
||||
unsigned long offset; /* Offset into section */
|
||||
} u;
|
||||
} alent;
|
||||
|
||||
/* object and core file sections */
|
||||
|
||||
#define align_power(addr, align) \
|
||||
( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
|
||||
|
||||
typedef struct sec *sec_ptr;
|
||||
|
||||
#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
|
||||
#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
|
||||
#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
|
||||
#define bfd_section_name(bfd, ptr) ((ptr)->name)
|
||||
#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
|
||||
#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
|
||||
#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
|
||||
#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
|
||||
#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
|
||||
|
||||
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
|
||||
|
||||
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true)
|
||||
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
|
||||
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
|
||||
|
||||
typedef struct stat stat_type;
|
||||
|
||||
typedef enum bfd_print_symbol
|
||||
{
|
||||
bfd_print_symbol_name,
|
||||
bfd_print_symbol_more,
|
||||
bfd_print_symbol_all
|
||||
} bfd_print_symbol_type;
|
||||
|
||||
/* Information about a symbol that nm needs. */
|
||||
|
||||
typedef struct _symbol_info
|
||||
{
|
||||
symvalue value;
|
||||
char type;
|
||||
CONST char *name; /* Symbol name. */
|
||||
unsigned char stab_type; /* Stab type. */
|
||||
char stab_other; /* Stab other. */
|
||||
short stab_desc; /* Stab desc. */
|
||||
CONST char *stab_name; /* String for stab type. */
|
||||
} symbol_info;
|
||||
|
||||
/* Get the name of a stabs type code. */
|
||||
|
||||
extern const char *bfd_get_stab_name PARAMS ((int));
|
||||
|
||||
/* Hash table routines. There is no way to free up a hash table. */
|
||||
|
||||
/* An element in the hash table. Most uses will actually use a larger
|
||||
structure, and an instance of this will be the first field. */
|
||||
|
||||
struct bfd_hash_entry
|
||||
{
|
||||
/* Next entry for this hash code. */
|
||||
struct bfd_hash_entry *next;
|
||||
/* String being hashed. */
|
||||
const char *string;
|
||||
/* Hash code. This is the full hash code, not the index into the
|
||||
table. */
|
||||
unsigned long hash;
|
||||
};
|
||||
|
||||
/* A hash table. */
|
||||
|
||||
struct bfd_hash_table
|
||||
{
|
||||
/* The hash array. */
|
||||
struct bfd_hash_entry **table;
|
||||
/* The number of slots in the hash table. */
|
||||
unsigned int size;
|
||||
/* A function used to create new elements in the hash table. The
|
||||
first entry is itself a pointer to an element. When this
|
||||
function is first invoked, this pointer will be NULL. However,
|
||||
having the pointer permits a hierarchy of method functions to be
|
||||
built each of which calls the function in the superclass. Thus
|
||||
each function should be written to allocate a new block of memory
|
||||
only if the argument is NULL. */
|
||||
struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
|
||||
struct bfd_hash_table *,
|
||||
const char *));
|
||||
/* An obstack for this hash table. */
|
||||
struct obstack memory;
|
||||
};
|
||||
|
||||
/* Initialize a hash table. */
|
||||
extern boolean bfd_hash_table_init
|
||||
PARAMS ((struct bfd_hash_table *,
|
||||
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
||||
struct bfd_hash_table *,
|
||||
const char *)));
|
||||
|
||||
/* Initialize a hash table specifying a size. */
|
||||
extern boolean bfd_hash_table_init_n
|
||||
PARAMS ((struct bfd_hash_table *,
|
||||
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
||||
struct bfd_hash_table *,
|
||||
const char *),
|
||||
unsigned int size));
|
||||
|
||||
/* Free up a hash table. */
|
||||
extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
|
||||
|
||||
/* Look up a string in a hash table. If CREATE is true, a new entry
|
||||
will be created for this string if one does not already exist. The
|
||||
COPY argument must be true if this routine should copy the string
|
||||
into newly allocated memory when adding an entry. */
|
||||
extern struct bfd_hash_entry *bfd_hash_lookup
|
||||
PARAMS ((struct bfd_hash_table *, const char *, boolean create,
|
||||
boolean copy));
|
||||
|
||||
/* Replace an entry in a hash table. */
|
||||
extern void bfd_hash_replace
|
||||
PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old,
|
||||
struct bfd_hash_entry *nw));
|
||||
|
||||
/* Base method for creating a hash table entry. */
|
||||
extern struct bfd_hash_entry *bfd_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
|
||||
const char *));
|
||||
|
||||
/* Grab some space for a hash table entry. */
|
||||
extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
|
||||
unsigned int));
|
||||
|
||||
/* Traverse a hash table in a random order, calling a function on each
|
||||
element. If the function returns false, the traversal stops. The
|
||||
INFO argument is passed to the function. */
|
||||
extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
|
||||
boolean (*) (struct bfd_hash_entry *,
|
||||
PTR),
|
||||
PTR info));
|
||||
|
||||
/* Semi-portable string concatenation in cpp.
|
||||
The CAT4 hack is to avoid a problem with some strict ANSI C preprocessors.
|
||||
The problem is, "32_" is not a valid preprocessing token, and we don't
|
||||
want extra underscores (e.g., "nlm_32_"). The XCAT2 macro will cause the
|
||||
inner CAT macros to be evaluated first, producing still-valid pp-tokens.
|
||||
Then the final concatenation can be done. (Sigh.) */
|
||||
#ifndef CAT
|
||||
#ifdef SABER
|
||||
#define CAT(a,b) a##b
|
||||
#define CAT3(a,b,c) a##b##c
|
||||
#define CAT4(a,b,c,d) a##b##c##d
|
||||
#else
|
||||
#if defined(__STDC__) || defined(ALMOST_STDC)
|
||||
#define CAT(a,b) a##b
|
||||
#define CAT3(a,b,c) a##b##c
|
||||
#define XCAT2(a,b) CAT(a,b)
|
||||
#define CAT4(a,b,c,d) XCAT2(CAT(a,b),CAT(c,d))
|
||||
#else
|
||||
#define CAT(a,b) a/**/b
|
||||
#define CAT3(a,b,c) a/**/b/**/c
|
||||
#define CAT4(a,b,c,d) a/**/b/**/c/**/d
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
|
||||
|
||||
/* User program access to BFD facilities */
|
||||
|
||||
/* Direct I/O routines, for programs which know more about the object
|
||||
file than BFD does. Use higher level routines if possible. */
|
||||
|
||||
extern bfd_size_type bfd_read
|
||||
PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
|
||||
extern bfd_size_type bfd_write
|
||||
PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
|
||||
extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction));
|
||||
extern long bfd_tell PARAMS ((bfd *abfd));
|
||||
extern int bfd_flush PARAMS ((bfd *abfd));
|
||||
extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
|
||||
|
||||
|
||||
/* Cast from const char * to char * so that caller can assign to
|
||||
a char * without a warning. */
|
||||
#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
|
||||
#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
|
||||
#define bfd_get_format(abfd) ((abfd)->format)
|
||||
#define bfd_get_target(abfd) ((abfd)->xvec->name)
|
||||
#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
|
||||
#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
|
||||
#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
|
||||
#define bfd_header_big_endian(abfd) \
|
||||
((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
|
||||
#define bfd_header_little_endian(abfd) \
|
||||
((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
|
||||
#define bfd_get_file_flags(abfd) ((abfd)->flags)
|
||||
#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
|
||||
#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
|
||||
#define bfd_my_archive(abfd) ((abfd)->my_archive)
|
||||
#define bfd_has_map(abfd) ((abfd)->has_armap)
|
||||
|
||||
#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
|
||||
#define bfd_usrdata(abfd) ((abfd)->usrdata)
|
||||
|
||||
#define bfd_get_start_address(abfd) ((abfd)->start_address)
|
||||
#define bfd_get_symcount(abfd) ((abfd)->symcount)
|
||||
#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
|
||||
#define bfd_count_sections(abfd) ((abfd)->section_count)
|
||||
|
||||
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
|
||||
|
||||
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
|
||||
|
||||
extern boolean bfd_record_phdr
|
||||
PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
|
||||
boolean, boolean, unsigned int, struct sec **));
|
||||
|
||||
/* Byte swapping routines. */
|
||||
|
||||
bfd_vma bfd_getb64 PARAMS ((const unsigned char *));
|
||||
bfd_vma bfd_getl64 PARAMS ((const unsigned char *));
|
||||
bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *));
|
||||
bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *));
|
||||
bfd_vma bfd_getb32 PARAMS ((const unsigned char *));
|
||||
bfd_vma bfd_getl32 PARAMS ((const unsigned char *));
|
||||
bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *));
|
||||
bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *));
|
||||
bfd_vma bfd_getb16 PARAMS ((const unsigned char *));
|
||||
bfd_vma bfd_getl16 PARAMS ((const unsigned char *));
|
||||
bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *));
|
||||
bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *));
|
||||
void bfd_putb64 PARAMS ((bfd_vma, unsigned char *));
|
||||
void bfd_putl64 PARAMS ((bfd_vma, unsigned char *));
|
||||
void bfd_putb32 PARAMS ((bfd_vma, unsigned char *));
|
||||
void bfd_putl32 PARAMS ((bfd_vma, unsigned char *));
|
||||
void bfd_putb16 PARAMS ((bfd_vma, unsigned char *));
|
||||
void bfd_putl16 PARAMS ((bfd_vma, unsigned char *));
|
||||
|
||||
/* Externally visible ECOFF routines. */
|
||||
|
||||
#if defined(__STDC__) || defined(ALMOST_STDC)
|
||||
struct ecoff_debug_info;
|
||||
struct ecoff_debug_swap;
|
||||
struct ecoff_extr;
|
||||
struct symbol_cache_entry;
|
||||
struct bfd_link_info;
|
||||
struct bfd_link_hash_entry;
|
||||
#endif
|
||||
extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
|
||||
extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
|
||||
extern boolean bfd_ecoff_set_regmasks
|
||||
PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
|
||||
unsigned long *cprmask));
|
||||
extern PTR bfd_ecoff_debug_init
|
||||
PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
|
||||
const struct ecoff_debug_swap *output_swap,
|
||||
struct bfd_link_info *));
|
||||
extern void bfd_ecoff_debug_free
|
||||
PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
|
||||
const struct ecoff_debug_swap *output_swap,
|
||||
struct bfd_link_info *));
|
||||
extern boolean bfd_ecoff_debug_accumulate
|
||||
PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
|
||||
const struct ecoff_debug_swap *output_swap,
|
||||
bfd *input_bfd, struct ecoff_debug_info *input_debug,
|
||||
const struct ecoff_debug_swap *input_swap,
|
||||
struct bfd_link_info *));
|
||||
extern boolean bfd_ecoff_debug_accumulate_other
|
||||
PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
|
||||
const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
|
||||
struct bfd_link_info *));
|
||||
extern boolean bfd_ecoff_debug_externals
|
||||
PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
|
||||
const struct ecoff_debug_swap *swap,
|
||||
boolean relocateable,
|
||||
boolean (*get_extr) (struct symbol_cache_entry *,
|
||||
struct ecoff_extr *),
|
||||
void (*set_index) (struct symbol_cache_entry *,
|
||||
bfd_size_type)));
|
||||
extern boolean bfd_ecoff_debug_one_external
|
||||
PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
|
||||
const struct ecoff_debug_swap *swap,
|
||||
const char *name, struct ecoff_extr *esym));
|
||||
extern bfd_size_type bfd_ecoff_debug_size
|
||||
PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
|
||||
const struct ecoff_debug_swap *swap));
|
||||
extern boolean bfd_ecoff_write_debug
|
||||
PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
|
||||
const struct ecoff_debug_swap *swap, file_ptr where));
|
||||
extern boolean bfd_ecoff_write_accumulated_debug
|
||||
PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
|
||||
const struct ecoff_debug_swap *swap,
|
||||
struct bfd_link_info *info, file_ptr where));
|
||||
extern boolean bfd_mips_ecoff_create_embedded_relocs
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
|
||||
char **));
|
||||
|
||||
/* Externally visible ELF routines. */
|
||||
|
||||
struct bfd_link_needed_list
|
||||
{
|
||||
struct bfd_link_needed_list *next;
|
||||
bfd *by;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
extern boolean bfd_elf32_record_link_assignment
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
|
||||
extern boolean bfd_elf64_record_link_assignment
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean));
|
||||
extern struct bfd_link_needed_list *bfd_elf_get_needed_list
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean bfd_elf32_size_dynamic_sections
|
||||
PARAMS ((bfd *, const char *, const char *, boolean,
|
||||
struct bfd_link_info *, struct sec **));
|
||||
extern boolean bfd_elf64_size_dynamic_sections
|
||||
PARAMS ((bfd *, const char *, const char *, boolean,
|
||||
struct bfd_link_info *, struct sec **));
|
||||
extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
|
||||
extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
|
||||
|
||||
/* SunOS shared library support routines for the linker. */
|
||||
|
||||
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean bfd_sunos_record_link_assignment
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *));
|
||||
extern boolean bfd_sunos_size_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
|
||||
struct sec **));
|
||||
|
||||
/* Linux shared library support routines for the linker. */
|
||||
|
||||
extern boolean bfd_i386linux_size_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean bfd_m68klinux_size_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* mmap hacks */
|
||||
|
||||
struct _bfd_window_internal;
|
||||
typedef struct _bfd_window_internal bfd_window_internal;
|
||||
|
||||
typedef struct _bfd_window {
|
||||
/* What the user asked for. */
|
||||
PTR data;
|
||||
bfd_size_type size;
|
||||
/* The actual window used by BFD. Small user-requested read-only
|
||||
regions sharing a page may share a single window into the object
|
||||
file. Read-write versions shouldn't until I've fixed things to
|
||||
keep track of which portions have been claimed by the
|
||||
application; don't want to give the same region back when the
|
||||
application wants two writable copies! */
|
||||
struct _bfd_window_internal *i;
|
||||
} bfd_window;
|
||||
|
||||
extern void bfd_init_window PARAMS ((bfd_window *));
|
||||
extern void bfd_free_window PARAMS ((bfd_window *));
|
||||
extern boolean bfd_get_file_window
|
||||
PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
|
||||
|
||||
/* XCOFF support routines for the linker. */
|
||||
|
||||
extern boolean bfd_xcoff_link_record_set
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
|
||||
bfd_size_type));
|
||||
extern boolean bfd_xcoff_import_symbol
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
|
||||
bfd_vma, const char *, const char *, const char *));
|
||||
extern boolean bfd_xcoff_export_symbol
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
|
||||
boolean));
|
||||
extern boolean bfd_xcoff_link_count_reloc
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *));
|
||||
extern boolean bfd_xcoff_record_link_assignment
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *));
|
||||
extern boolean bfd_xcoff_size_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *,
|
||||
unsigned long, unsigned long, unsigned long, boolean,
|
||||
int, boolean, boolean, struct sec **));
|
||||
|
||||
/* And more from the source. */
|
File diff suppressed because it is too large
Load Diff
@ -1,348 +0,0 @@
|
||||
/* BFD back-end for binary objects.
|
||||
Copyright 1994 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.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This is a BFD backend which may be used to write binary objects.
|
||||
It may only be used for output, not input. The intention is that
|
||||
this may be used as an output format for objcopy in order to
|
||||
generate raw binary data.
|
||||
|
||||
This is very simple. The only complication is that the real data
|
||||
will start at some address X, and in some cases we will not want to
|
||||
include X zeroes just to get to that point. Since the start
|
||||
address is not meaningful for this object file format, we use it
|
||||
instead to indicate the number of zeroes to skip at the start of
|
||||
the file. objcopy cooperates by specially setting the start
|
||||
address to zero by default. */
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
/* Any bfd we create by reading a binary file has three symbols:
|
||||
a start symbol, an end symbol, and an absolute length symbol. */
|
||||
#define BIN_SYMS 3
|
||||
|
||||
static boolean binary_mkobject PARAMS ((bfd *));
|
||||
static const bfd_target *binary_object_p PARAMS ((bfd *));
|
||||
static boolean binary_get_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
|
||||
static long binary_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
static char *mangle_name PARAMS ((bfd *, char *));
|
||||
static long binary_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
static asymbol *binary_make_empty_symbol PARAMS ((bfd *));
|
||||
static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||
static boolean binary_set_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
|
||||
static int binary_sizeof_headers PARAMS ((bfd *, boolean));
|
||||
|
||||
/* Create a binary object. Invoked via bfd_set_format. */
|
||||
|
||||
static boolean
|
||||
binary_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Any file may be considered to be a binary file, provided the target
|
||||
was not defaulted. That is, it must be explicitly specified as
|
||||
being binary. */
|
||||
|
||||
static const bfd_target *
|
||||
binary_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct stat statbuf;
|
||||
asection *sec;
|
||||
|
||||
if (abfd->target_defaulted)
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
abfd->symcount = BIN_SYMS;
|
||||
|
||||
/* Find the file size. */
|
||||
if (bfd_stat (abfd, &statbuf) < 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* One data section. */
|
||||
sec = bfd_make_section (abfd, ".data");
|
||||
if (sec == NULL)
|
||||
return NULL;
|
||||
sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
|
||||
sec->vma = 0;
|
||||
sec->_raw_size = statbuf.st_size;
|
||||
sec->filepos = 0;
|
||||
|
||||
abfd->tdata.any = (PTR) sec;
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
#define binary_new_section_hook _bfd_generic_new_section_hook
|
||||
|
||||
/* Get contents of the only section. */
|
||||
|
||||
static boolean
|
||||
binary_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|
||||
|| bfd_read (location, 1, count, abfd) != count)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Return the amount of memory needed to read the symbol table. */
|
||||
|
||||
static long
|
||||
binary_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return (BIN_SYMS + 1) * sizeof (asymbol *);
|
||||
}
|
||||
|
||||
/* Create a symbol name based on the bfd's filename. */
|
||||
|
||||
static char *
|
||||
mangle_name (abfd, suffix)
|
||||
bfd *abfd;
|
||||
char *suffix;
|
||||
{
|
||||
int size;
|
||||
char *buf;
|
||||
char *p;
|
||||
|
||||
size = (strlen (bfd_get_filename (abfd))
|
||||
+ strlen (suffix)
|
||||
+ sizeof "_binary__");
|
||||
|
||||
buf = (char *) bfd_alloc (abfd, size);
|
||||
if (buf == NULL)
|
||||
return "";
|
||||
|
||||
sprintf (buf, "_binary_%s_%s", bfd_get_filename (abfd), suffix);
|
||||
|
||||
/* Change any non-alphanumeric characters to underscores. */
|
||||
for (p = buf; *p; p++)
|
||||
if (! isalnum (*p))
|
||||
*p = '_';
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Return the symbol table. */
|
||||
|
||||
static long
|
||||
binary_get_symtab (abfd, alocation)
|
||||
bfd *abfd;
|
||||
asymbol **alocation;
|
||||
{
|
||||
asection *sec = (asection *) abfd->tdata.any;
|
||||
asymbol *syms;
|
||||
unsigned int i;
|
||||
|
||||
syms = (asymbol *) bfd_alloc (abfd, BIN_SYMS * sizeof (asymbol));
|
||||
if (syms == NULL)
|
||||
return false;
|
||||
|
||||
/* Start symbol. */
|
||||
syms[0].the_bfd = abfd;
|
||||
syms[0].name = mangle_name (abfd, "start");
|
||||
syms[0].value = 0;
|
||||
syms[0].flags = BSF_GLOBAL;
|
||||
syms[0].section = sec;
|
||||
syms[0].udata.p = NULL;
|
||||
|
||||
/* End symbol. */
|
||||
syms[1].the_bfd = abfd;
|
||||
syms[1].name = mangle_name (abfd, "end");
|
||||
syms[1].value = sec->_raw_size;
|
||||
syms[1].flags = BSF_GLOBAL;
|
||||
syms[1].section = sec;
|
||||
syms[1].udata.p = NULL;
|
||||
|
||||
/* Size symbol. */
|
||||
syms[2].the_bfd = abfd;
|
||||
syms[2].name = mangle_name (abfd, "size");
|
||||
syms[2].value = sec->_raw_size;
|
||||
syms[2].flags = BSF_GLOBAL;
|
||||
syms[2].section = bfd_abs_section_ptr;
|
||||
syms[2].udata.p = NULL;
|
||||
|
||||
for (i = 0; i < BIN_SYMS; i++)
|
||||
*alocation++ = syms++;
|
||||
*alocation = NULL;
|
||||
|
||||
return BIN_SYMS;
|
||||
}
|
||||
|
||||
/* Make an empty symbol. */
|
||||
|
||||
static asymbol *
|
||||
binary_make_empty_symbol (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
|
||||
}
|
||||
|
||||
#define binary_print_symbol _bfd_nosymbols_print_symbol
|
||||
|
||||
/* Get information about a symbol. */
|
||||
|
||||
static void
|
||||
binary_get_symbol_info (ignore_abfd, symbol, ret)
|
||||
bfd *ignore_abfd;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
{
|
||||
bfd_symbol_info (symbol, ret);
|
||||
}
|
||||
|
||||
#define binary_bfd_is_local_label bfd_generic_is_local_label
|
||||
#define binary_get_lineno _bfd_nosymbols_get_lineno
|
||||
#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line
|
||||
#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||
#define binary_read_minisymbols _bfd_generic_read_minisymbols
|
||||
#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||
|
||||
#define binary_get_reloc_upper_bound \
|
||||
((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
|
||||
#define binary_canonicalize_reloc \
|
||||
((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
|
||||
#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
|
||||
|
||||
/* Set the architecture of a binary file. */
|
||||
#define binary_set_arch_mach _bfd_generic_set_arch_mach
|
||||
|
||||
/* Write section contents of a binary file. */
|
||||
|
||||
static boolean
|
||||
binary_set_section_contents (abfd, sec, data, offset, size)
|
||||
bfd *abfd;
|
||||
asection *sec;
|
||||
PTR data;
|
||||
file_ptr offset;
|
||||
bfd_size_type size;
|
||||
{
|
||||
if (! abfd->output_has_begun)
|
||||
{
|
||||
bfd_vma low;
|
||||
asection *s;
|
||||
|
||||
/* The lowest section VMA sets the virtual address of the start
|
||||
of the file. We use the set the file position of all the
|
||||
sections. */
|
||||
low = abfd->sections->vma;
|
||||
for (s = abfd->sections->next; s != NULL; s = s->next)
|
||||
if (s->vma < low)
|
||||
low = s->vma;
|
||||
|
||||
for (s = abfd->sections; s != NULL; s = s->next)
|
||||
s->filepos = s->vma - low;
|
||||
|
||||
abfd->output_has_begun = true;
|
||||
}
|
||||
|
||||
return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
|
||||
}
|
||||
|
||||
/* No space is required for header information. */
|
||||
|
||||
static int
|
||||
binary_sizeof_headers (abfd, exec)
|
||||
bfd *abfd;
|
||||
boolean exec;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define binary_bfd_get_relocated_section_contents \
|
||||
bfd_generic_get_relocated_section_contents
|
||||
#define binary_bfd_relax_section bfd_generic_relax_section
|
||||
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define binary_bfd_final_link _bfd_generic_final_link
|
||||
#define binary_bfd_link_split_section _bfd_generic_link_split_section
|
||||
#define binary_get_section_contents_in_window \
|
||||
_bfd_generic_get_section_contents_in_window
|
||||
|
||||
const bfd_target binary_vec =
|
||||
{
|
||||
"binary", /* name */
|
||||
bfd_target_unknown_flavour, /* flavour */
|
||||
BFD_ENDIAN_UNKNOWN, /* byteorder */
|
||||
BFD_ENDIAN_UNKNOWN, /* header_byteorder */
|
||||
EXEC_P, /* object_flags */
|
||||
(SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA
|
||||
| SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */
|
||||
0, /* symbol_leading_char */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
||||
{ /* bfd_check_format */
|
||||
_bfd_dummy_target,
|
||||
binary_object_p, /* bfd_check_format */
|
||||
_bfd_dummy_target,
|
||||
_bfd_dummy_target,
|
||||
},
|
||||
{ /* bfd_set_format */
|
||||
bfd_false,
|
||||
binary_mkobject,
|
||||
bfd_false,
|
||||
bfd_false,
|
||||
},
|
||||
{ /* bfd_write_contents */
|
||||
bfd_false,
|
||||
bfd_true,
|
||||
bfd_false,
|
||||
bfd_false,
|
||||
},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (binary),
|
||||
BFD_JUMP_TABLE_COPY (_bfd_generic),
|
||||
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
||||
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
|
||||
BFD_JUMP_TABLE_SYMBOLS (binary),
|
||||
BFD_JUMP_TABLE_RELOCS (binary),
|
||||
BFD_JUMP_TABLE_WRITE (binary),
|
||||
BFD_JUMP_TABLE_LINK (binary),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL
|
||||
};
|
@ -1,347 +0,0 @@
|
||||
/* BFD library -- caching of file descriptors.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
SECTION
|
||||
File caching
|
||||
|
||||
The file caching mechanism is embedded within BFD and allows
|
||||
the application to open as many BFDs as it wants without
|
||||
regard to the underlying operating system's file descriptor
|
||||
limit (often as low as 20 open files). The module in
|
||||
<<cache.c>> maintains a least recently used list of
|
||||
<<BFD_CACHE_MAX_OPEN>> files, and exports the name
|
||||
<<bfd_cache_lookup>>, which runs around and makes sure that
|
||||
the required BFD is open. If not, then it chooses a file to
|
||||
close, closes it and opens the one wanted, returning its file
|
||||
handle.
|
||||
|
||||
*/
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
static void insert PARAMS ((bfd *));
|
||||
static void snip PARAMS ((bfd *));
|
||||
static boolean close_one PARAMS ((void));
|
||||
static boolean bfd_cache_delete PARAMS ((bfd *));
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
BFD_CACHE_MAX_OPEN macro
|
||||
|
||||
DESCRIPTION
|
||||
The maximum number of files which the cache will keep open at
|
||||
one time.
|
||||
|
||||
.#define BFD_CACHE_MAX_OPEN 10
|
||||
|
||||
*/
|
||||
|
||||
/* The number of BFD files we have open. */
|
||||
|
||||
static int open_files;
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_last_cache
|
||||
|
||||
SYNOPSIS
|
||||
extern bfd *bfd_last_cache;
|
||||
|
||||
DESCRIPTION
|
||||
Zero, or a pointer to the topmost BFD on the chain. This is
|
||||
used by the <<bfd_cache_lookup>> macro in @file{libbfd.h} to
|
||||
determine when it can avoid a function call.
|
||||
*/
|
||||
|
||||
bfd *bfd_last_cache;
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_cache_lookup
|
||||
|
||||
DESCRIPTION
|
||||
Check to see if the required BFD is the same as the last one
|
||||
looked up. If so, then it can use the stream in the BFD with
|
||||
impunity, since it can't have changed since the last lookup;
|
||||
otherwise, it has to perform the complicated lookup function.
|
||||
|
||||
.#define bfd_cache_lookup(x) \
|
||||
. ((x)==bfd_last_cache? \
|
||||
. (FILE*)(bfd_last_cache->iostream): \
|
||||
. bfd_cache_lookup_worker(x))
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/* Insert a BFD into the cache. */
|
||||
|
||||
static INLINE void
|
||||
insert (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (bfd_last_cache == NULL)
|
||||
{
|
||||
abfd->lru_next = abfd;
|
||||
abfd->lru_prev = abfd;
|
||||
}
|
||||
else
|
||||
{
|
||||
abfd->lru_next = bfd_last_cache;
|
||||
abfd->lru_prev = bfd_last_cache->lru_prev;
|
||||
abfd->lru_prev->lru_next = abfd;
|
||||
abfd->lru_next->lru_prev = abfd;
|
||||
}
|
||||
bfd_last_cache = abfd;
|
||||
}
|
||||
|
||||
/* Remove a BFD from the cache. */
|
||||
|
||||
static INLINE void
|
||||
snip (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
abfd->lru_prev->lru_next = abfd->lru_next;
|
||||
abfd->lru_next->lru_prev = abfd->lru_prev;
|
||||
if (abfd == bfd_last_cache)
|
||||
{
|
||||
bfd_last_cache = abfd->lru_next;
|
||||
if (abfd == bfd_last_cache)
|
||||
bfd_last_cache = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* We need to open a new file, and the cache is full. Find the least
|
||||
recently used cacheable BFD and close it. */
|
||||
|
||||
static boolean
|
||||
close_one ()
|
||||
{
|
||||
register bfd *kill;
|
||||
|
||||
if (bfd_last_cache == NULL)
|
||||
kill = NULL;
|
||||
else
|
||||
{
|
||||
for (kill = bfd_last_cache->lru_prev;
|
||||
! kill->cacheable;
|
||||
kill = kill->lru_prev)
|
||||
{
|
||||
if (kill == bfd_last_cache)
|
||||
{
|
||||
kill = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (kill == NULL)
|
||||
{
|
||||
/* There are no open cacheable BFD's. */
|
||||
return true;
|
||||
}
|
||||
|
||||
kill->where = ftell ((FILE *) kill->iostream);
|
||||
|
||||
return bfd_cache_delete (kill);
|
||||
}
|
||||
|
||||
/* Close a BFD and remove it from the cache. */
|
||||
|
||||
static boolean
|
||||
bfd_cache_delete (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
boolean ret;
|
||||
|
||||
if (fclose ((FILE *) abfd->iostream) == 0)
|
||||
ret = true;
|
||||
else
|
||||
{
|
||||
ret = false;
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
}
|
||||
|
||||
snip (abfd);
|
||||
|
||||
abfd->iostream = NULL;
|
||||
--open_files;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_cache_init
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_cache_init (bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Add a newly opened BFD to the cache.
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_cache_init (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
BFD_ASSERT (abfd->iostream != NULL);
|
||||
if (open_files >= BFD_CACHE_MAX_OPEN)
|
||||
{
|
||||
if (! close_one ())
|
||||
return false;
|
||||
}
|
||||
insert (abfd);
|
||||
++open_files;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_cache_close
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_cache_close (bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Remove the BFD @var{abfd} from the cache. If the attached file is open,
|
||||
then close it too.
|
||||
|
||||
RETURNS
|
||||
<<false>> is returned if closing the file fails, <<true>> is
|
||||
returned if all is well.
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_cache_close (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (abfd->iostream == NULL
|
||||
|| (abfd->flags & BFD_IN_MEMORY) != 0)
|
||||
return true;
|
||||
|
||||
return bfd_cache_delete (abfd);
|
||||
}
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_open_file
|
||||
|
||||
SYNOPSIS
|
||||
FILE* bfd_open_file(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Call the OS to open a file for @var{abfd}. Return the <<FILE *>>
|
||||
(possibly <<NULL>>) that results from this operation. Set up the
|
||||
BFD so that future accesses know the file is open. If the <<FILE *>>
|
||||
returned is <<NULL>>, then it won't have been put in the
|
||||
cache, so it won't have to be removed from it.
|
||||
*/
|
||||
|
||||
FILE *
|
||||
bfd_open_file (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
abfd->cacheable = true; /* Allow it to be closed later. */
|
||||
|
||||
if (open_files >= BFD_CACHE_MAX_OPEN)
|
||||
{
|
||||
if (! close_one ())
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (abfd->direction)
|
||||
{
|
||||
case read_direction:
|
||||
case no_direction:
|
||||
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RB);
|
||||
break;
|
||||
case both_direction:
|
||||
case write_direction:
|
||||
if (abfd->opened_once == true)
|
||||
{
|
||||
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RUB);
|
||||
if (abfd->iostream == NULL)
|
||||
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*open for creat */
|
||||
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WB);
|
||||
abfd->opened_once = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (abfd->iostream != NULL)
|
||||
{
|
||||
if (! bfd_cache_init (abfd))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (FILE *) abfd->iostream;
|
||||
}
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_cache_lookup_worker
|
||||
|
||||
SYNOPSIS
|
||||
FILE *bfd_cache_lookup_worker(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Called when the macro <<bfd_cache_lookup>> fails to find a
|
||||
quick answer. Find a file descriptor for @var{abfd}. If
|
||||
necessary, it open it. If there are already more than
|
||||
<<BFD_CACHE_MAX_OPEN>> files open, it tries to close one first, to
|
||||
avoid running out of file descriptors.
|
||||
*/
|
||||
|
||||
FILE *
|
||||
bfd_cache_lookup_worker (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if ((abfd->flags & BFD_IN_MEMORY) != 0)
|
||||
abort ();
|
||||
|
||||
if (abfd->my_archive)
|
||||
abfd = abfd->my_archive;
|
||||
|
||||
if (abfd->iostream != NULL)
|
||||
{
|
||||
/* Move the file to the start of the cache. */
|
||||
if (abfd != bfd_last_cache)
|
||||
{
|
||||
snip (abfd);
|
||||
insert (abfd);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bfd_open_file (abfd) == NULL)
|
||||
return NULL;
|
||||
if (fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (FILE *) abfd->iostream;
|
||||
}
|
@ -1,493 +0,0 @@
|
||||
/* BFD back-end for Intel 386 COFF files.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "obstack.h"
|
||||
|
||||
#include "coff/i386.h"
|
||||
|
||||
#include "coff/internal.h"
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
#include "coff/pe.h"
|
||||
#endif
|
||||
|
||||
#include "libcoff.h"
|
||||
|
||||
static bfd_reloc_status_type coff_i386_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static reloc_howto_type *coff_i386_rtype_to_howto
|
||||
PARAMS ((bfd *, asection *, struct internal_reloc *,
|
||||
struct coff_link_hash_entry *, struct internal_syment *,
|
||||
|
||||
bfd_vma *));
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
||||
/* The page size is a guess based on ELF. */
|
||||
|
||||
#define COFF_PAGE_SIZE 0x1000
|
||||
|
||||
/* For some reason when using i386 COFF the value stored in the .text
|
||||
section for a reference to a common symbol is the value itself plus
|
||||
any desired offset. Ian Taylor, Cygnus Support. */
|
||||
|
||||
/* If we are producing relocateable output, we need to do some
|
||||
adjustments to the object file that are not done by the
|
||||
bfd_perform_relocation function. This function is called by every
|
||||
reloc type to make any required adjustments. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
symvalue diff;
|
||||
|
||||
if (output_bfd == (bfd *) NULL)
|
||||
return bfd_reloc_continue;
|
||||
|
||||
|
||||
if (bfd_is_com_section (symbol->section))
|
||||
{
|
||||
/* We are relocating a common symbol. The current value in the
|
||||
object file is ORIG + OFFSET, where ORIG is the value of the
|
||||
common symbol as seen by the object file when it was compiled
|
||||
(this may be zero if the symbol was undefined) and OFFSET is
|
||||
the offset into the common symbol (normally zero, but may be
|
||||
non-zero when referring to a field in a common structure).
|
||||
ORIG is the negative of reloc_entry->addend, which is set by
|
||||
the CALC_ADDEND macro below. We want to replace the value in
|
||||
the object file with NEW + OFFSET, where NEW is the value of
|
||||
the common symbol which we are going to put in the final
|
||||
object file. NEW is symbol->value. */
|
||||
diff = symbol->value + reloc_entry->addend;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For some reason bfd_perform_relocation always effectively
|
||||
ignores the addend for a COFF target when producing
|
||||
relocateable output. This seems to be always wrong for 386
|
||||
COFF, so we handle the addend here instead. */
|
||||
diff = reloc_entry->addend;
|
||||
}
|
||||
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
if (reloc_entry->howto->type == 7)
|
||||
{
|
||||
/* diff -= coff_data(output_bfd)->link_info->pe_info.image_base.value;*/
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DOIT(x) \
|
||||
x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
|
||||
|
||||
if (diff != 0)
|
||||
{
|
||||
reloc_howto_type *howto = reloc_entry->howto;
|
||||
unsigned char *addr = (unsigned char *) data + reloc_entry->address;
|
||||
|
||||
switch (howto->size)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
char x = bfd_get_8 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_8 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
short x = bfd_get_16 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_16 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
long x = bfd_get_32 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_32 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Now let bfd_perform_relocation finish everything up. */
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
/* Return true if this relocation should
|
||||
appear in the output .reloc section. */
|
||||
|
||||
static boolean in_reloc_p(abfd, howto)
|
||||
bfd * abfd;
|
||||
reloc_howto_type *howto;
|
||||
{
|
||||
return ! howto->pc_relative && howto->type != R_IMAGEBASE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PCRELOFFSET
|
||||
#define PCRELOFFSET false
|
||||
#endif
|
||||
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
{0},
|
||||
{1},
|
||||
{2},
|
||||
{3},
|
||||
{4},
|
||||
{5},
|
||||
HOWTO (R_DIR32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"dir32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
/* {7}, */
|
||||
HOWTO (R_IMAGEBASE, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"rva32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
{010},
|
||||
{011},
|
||||
{012},
|
||||
{013},
|
||||
{014},
|
||||
{015},
|
||||
{016},
|
||||
HOWTO (R_RELBYTE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"8", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
PCRELOFFSET), /* pcrel_offset */
|
||||
HOWTO (R_RELWORD, /* type */
|
||||
0, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"16", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
PCRELOFFSET), /* pcrel_offset */
|
||||
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 */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
PCRELOFFSET), /* pcrel_offset */
|
||||
HOWTO (R_PCRBYTE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"DISP8", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
PCRELOFFSET), /* pcrel_offset */
|
||||
HOWTO (R_PCRWORD, /* type */
|
||||
0, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"DISP16", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
PCRELOFFSET), /* pcrel_offset */
|
||||
HOWTO (R_PCRLONG, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"DISP32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
PCRELOFFSET) /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Turn a howto into a reloc nunmber */
|
||||
|
||||
#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
|
||||
#define BADMAG(x) I386BADMAG(x)
|
||||
#define I386 1 /* Customize coffcode.h */
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
(cache_ptr)->howto = howto_table + (dst)->r_type;
|
||||
|
||||
/* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
|
||||
library. On some other COFF targets STYP_BSS is normally
|
||||
STYP_NOLOAD. */
|
||||
#define BSS_NOLOAD_IS_SHARED_LIBRARY
|
||||
|
||||
/* Compute the addend of a reloc. If the reloc is to a common symbol,
|
||||
the object file contains the value of the common symbol. By the
|
||||
time this is called, the linker may be using a different symbol
|
||||
from a different object file with a different value. Therefore, we
|
||||
hack wildly to locate the original symbol from this file so that we
|
||||
can make the correct adjustment. This macro sets coffsym to the
|
||||
symbol from the original file, and uses it to set the addend value
|
||||
correctly. If this is not a common symbol, the usual addend
|
||||
calculation is done, except that an additional tweak is needed for
|
||||
PC relative relocs.
|
||||
FIXME: This macro refers to symbols and asect; these are from the
|
||||
calling function, not the macro arguments. */
|
||||
|
||||
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
|
||||
{ \
|
||||
coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
|
||||
if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
|
||||
coffsym = (obj_symbols (abfd) \
|
||||
+ (cache_ptr->sym_ptr_ptr - symbols)); \
|
||||
else if (ptr) \
|
||||
coffsym = coff_symbol_from (abfd, ptr); \
|
||||
if (coffsym != (coff_symbol_type *) NULL \
|
||||
&& coffsym->native->u.syment.n_scnum == 0) \
|
||||
cache_ptr->addend = - coffsym->native->u.syment.n_value; \
|
||||
else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
|
||||
&& ptr->section != (asection *) NULL) \
|
||||
cache_ptr->addend = - (ptr->section->vma + ptr->value); \
|
||||
else \
|
||||
cache_ptr->addend = 0; \
|
||||
if (ptr && howto_table[reloc.r_type].pc_relative) \
|
||||
cache_ptr->addend += asect->vma; \
|
||||
}
|
||||
|
||||
/* We use the special COFF backend linker. */
|
||||
#define coff_relocate_section _bfd_coff_generic_relocate_section
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
|
||||
bfd *abfd;
|
||||
asection *sec;
|
||||
struct internal_reloc *rel;
|
||||
struct coff_link_hash_entry *h;
|
||||
struct internal_syment *sym;
|
||||
bfd_vma *addendp;
|
||||
{
|
||||
|
||||
reloc_howto_type *howto;
|
||||
|
||||
howto = howto_table + rel->r_type;
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
*addendp = 0;
|
||||
#endif
|
||||
|
||||
if (howto->pc_relative)
|
||||
*addendp += sec->vma;
|
||||
|
||||
if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
|
||||
{
|
||||
/* This is a common symbol. The section contents include the
|
||||
size (sym->n_value) as an addend. The relocate_section
|
||||
function will be adding in the final value of the symbol. We
|
||||
need to subtract out the current size in order to get the
|
||||
correct result. */
|
||||
|
||||
BFD_ASSERT (h != NULL);
|
||||
|
||||
|
||||
#ifndef COFF_WITH_PE
|
||||
/* I think we *do* want to bypass this. If we don't, I have seen some data
|
||||
parameters get the wrong relcation address. If I link two versions
|
||||
with and without this section bypassed and then do a binary comparison,
|
||||
the addresses which are different can be looked up in the map. The
|
||||
case in which this section has been bypassed has addresses which correspond
|
||||
to values I can find in the map */
|
||||
*addendp -= sym->n_value;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If the output symbol is common (in which case this must be a
|
||||
relocateable link), we need to add in the final size of the
|
||||
common symbol. */
|
||||
if (h != NULL && h->root.type == bfd_link_hash_common)
|
||||
*addendp += h->root.u.c.size;
|
||||
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
if (howto->pc_relative)
|
||||
*addendp -= 4;
|
||||
|
||||
if (rel->r_type == R_IMAGEBASE)
|
||||
{
|
||||
*addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
|
||||
}
|
||||
#endif
|
||||
|
||||
return howto;
|
||||
}
|
||||
|
||||
|
||||
#define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup
|
||||
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_i386_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case BFD_RELOC_RVA:
|
||||
return howto_table +R_IMAGEBASE;
|
||||
case BFD_RELOC_32:
|
||||
return howto_table + R_DIR32;
|
||||
case BFD_RELOC_32_PCREL:
|
||||
return howto_table + R_PCRLONG;
|
||||
default:
|
||||
BFD_FAIL ();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define coff_rtype_to_howto coff_i386_rtype_to_howto
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
static const bfd_target *
|
||||
i3coff_object_p(a)
|
||||
bfd *a;
|
||||
{
|
||||
return coff_object_p(a);
|
||||
}
|
||||
|
||||
const bfd_target
|
||||
#ifdef TARGET_SYM
|
||||
TARGET_SYM =
|
||||
#else
|
||||
i386coff_vec =
|
||||
#endif
|
||||
{
|
||||
#ifdef TARGET_NAME
|
||||
TARGET_NAME,
|
||||
#else
|
||||
"coff-i386", /* name */
|
||||
#endif
|
||||
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),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
#ifdef TARGET_UNDERSCORE
|
||||
TARGET_UNDERSCORE, /* leading underscore */
|
||||
#else
|
||||
0, /* leading underscore */
|
||||
#endif
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
|
||||
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_dummy_target, i3coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, i3coff_object_p},
|
||||
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
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),
|
||||
|
||||
COFF_SWAP_TABLE,
|
||||
};
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,807 +0,0 @@
|
||||
/* Generic COFF swapping routines, for BFD.
|
||||
Copyright 1990, 1991, 1992, 1993, 1995 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file contains routines used to swap COFF data. It is a header
|
||||
file because the details of swapping depend on the details of the
|
||||
structures used by each COFF implementation. This is included by
|
||||
coffcode.h, as well as by the ECOFF backend.
|
||||
|
||||
Any file which uses this must first include "coff/internal.h" and
|
||||
"coff/CPU.h". The functions will then be correct for that CPU. */
|
||||
|
||||
#ifndef IMAGE_BASE
|
||||
#define IMAGE_BASE 0
|
||||
#endif
|
||||
|
||||
#define PUTWORD bfd_h_put_32
|
||||
#define PUTHALF bfd_h_put_16
|
||||
#define PUTBYTE bfd_h_put_8
|
||||
|
||||
#ifndef GET_FCN_LNNOPTR
|
||||
#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
|
||||
#endif
|
||||
|
||||
#ifndef GET_FCN_ENDNDX
|
||||
#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
|
||||
#endif
|
||||
|
||||
#ifndef PUT_FCN_LNNOPTR
|
||||
#define PUT_FCN_LNNOPTR(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr)
|
||||
#endif
|
||||
#ifndef PUT_FCN_ENDNDX
|
||||
#define PUT_FCN_ENDNDX(abfd, in, ext) PUTWORD(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx)
|
||||
#endif
|
||||
#ifndef GET_LNSZ_LNNO
|
||||
#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno)
|
||||
#endif
|
||||
#ifndef GET_LNSZ_SIZE
|
||||
#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size)
|
||||
#endif
|
||||
#ifndef PUT_LNSZ_LNNO
|
||||
#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_lnno)
|
||||
#endif
|
||||
#ifndef PUT_LNSZ_SIZE
|
||||
#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_16(abfd, in, (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size)
|
||||
#endif
|
||||
#ifndef GET_SCN_SCNLEN
|
||||
#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen)
|
||||
#endif
|
||||
#ifndef GET_SCN_NRELOC
|
||||
#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nreloc)
|
||||
#endif
|
||||
#ifndef GET_SCN_NLINNO
|
||||
#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *)ext->x_scn.x_nlinno)
|
||||
#endif
|
||||
#ifndef PUT_SCN_SCNLEN
|
||||
#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen)
|
||||
#endif
|
||||
#ifndef PUT_SCN_NRELOC
|
||||
#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_16(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc)
|
||||
#endif
|
||||
#ifndef PUT_SCN_NLINNO
|
||||
#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_16(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno)
|
||||
#endif
|
||||
#ifndef GET_LINENO_LNNO
|
||||
#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno));
|
||||
#endif
|
||||
#ifndef PUT_LINENO_LNNO
|
||||
#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno));
|
||||
#endif
|
||||
|
||||
/* The f_symptr field in the filehdr is sometimes 64 bits. */
|
||||
#ifndef GET_FILEHDR_SYMPTR
|
||||
#define GET_FILEHDR_SYMPTR bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_FILEHDR_SYMPTR
|
||||
#define PUT_FILEHDR_SYMPTR bfd_h_put_32
|
||||
#endif
|
||||
|
||||
/* Some fields in the aouthdr are sometimes 64 bits. */
|
||||
#ifndef GET_AOUTHDR_TSIZE
|
||||
#define GET_AOUTHDR_TSIZE bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_TSIZE
|
||||
#define PUT_AOUTHDR_TSIZE bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_DSIZE
|
||||
#define GET_AOUTHDR_DSIZE bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_DSIZE
|
||||
#define PUT_AOUTHDR_DSIZE bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_BSIZE
|
||||
#define GET_AOUTHDR_BSIZE bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_BSIZE
|
||||
#define PUT_AOUTHDR_BSIZE bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_ENTRY
|
||||
#define GET_AOUTHDR_ENTRY bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_ENTRY
|
||||
#define PUT_AOUTHDR_ENTRY bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_TEXT_START
|
||||
#define GET_AOUTHDR_TEXT_START bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_TEXT_START
|
||||
#define PUT_AOUTHDR_TEXT_START bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_AOUTHDR_DATA_START
|
||||
#define GET_AOUTHDR_DATA_START bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_AOUTHDR_DATA_START
|
||||
#define PUT_AOUTHDR_DATA_START bfd_h_put_32
|
||||
#endif
|
||||
|
||||
/* Some fields in the scnhdr are sometimes 64 bits. */
|
||||
#ifndef GET_SCNHDR_PADDR
|
||||
#define GET_SCNHDR_PADDR bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_PADDR
|
||||
#define PUT_SCNHDR_PADDR bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_VADDR
|
||||
#define GET_SCNHDR_VADDR bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_VADDR
|
||||
#define PUT_SCNHDR_VADDR bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_SIZE
|
||||
#define GET_SCNHDR_SIZE bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_SIZE
|
||||
#define PUT_SCNHDR_SIZE bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_SCNPTR
|
||||
#define GET_SCNHDR_SCNPTR bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_SCNPTR
|
||||
#define PUT_SCNHDR_SCNPTR bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_RELPTR
|
||||
#define GET_SCNHDR_RELPTR bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_RELPTR
|
||||
#define PUT_SCNHDR_RELPTR bfd_h_put_32
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_LNNOPTR
|
||||
#define GET_SCNHDR_LNNOPTR bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_LNNOPTR
|
||||
#define PUT_SCNHDR_LNNOPTR bfd_h_put_32
|
||||
#endif
|
||||
|
||||
#ifndef NO_COFF_RELOCS
|
||||
|
||||
static void
|
||||
coff_swap_reloc_in (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
PTR src;
|
||||
PTR dst;
|
||||
{
|
||||
RELOC *reloc_src = (RELOC *) src;
|
||||
struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
|
||||
|
||||
reloc_dst->r_vaddr = bfd_h_get_32(abfd, (bfd_byte *)reloc_src->r_vaddr);
|
||||
reloc_dst->r_symndx = bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx);
|
||||
|
||||
#ifdef RS6000COFF_C
|
||||
reloc_dst->r_type = bfd_h_get_8(abfd, reloc_src->r_type);
|
||||
reloc_dst->r_size = bfd_h_get_8(abfd, reloc_src->r_size);
|
||||
#else
|
||||
reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type);
|
||||
#endif
|
||||
|
||||
#ifdef SWAP_IN_RELOC_OFFSET
|
||||
reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET(abfd,
|
||||
(bfd_byte *) reloc_src->r_offset);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static unsigned int
|
||||
coff_swap_reloc_out (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
PTR src;
|
||||
PTR dst;
|
||||
{
|
||||
struct internal_reloc *reloc_src = (struct internal_reloc *)src;
|
||||
struct external_reloc *reloc_dst = (struct external_reloc *)dst;
|
||||
bfd_h_put_32(abfd, reloc_src->r_vaddr, (bfd_byte *) reloc_dst->r_vaddr);
|
||||
bfd_h_put_32(abfd, reloc_src->r_symndx, (bfd_byte *) reloc_dst->r_symndx);
|
||||
|
||||
#ifdef RS6000COFF_C
|
||||
bfd_h_put_8 (abfd, reloc_src->r_type, (bfd_byte *) reloc_dst->r_type);
|
||||
bfd_h_put_8 (abfd, reloc_src->r_size, (bfd_byte *) reloc_dst->r_size);
|
||||
#else
|
||||
bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *)
|
||||
reloc_dst->r_type);
|
||||
#endif
|
||||
|
||||
#ifdef SWAP_OUT_RELOC_OFFSET
|
||||
SWAP_OUT_RELOC_OFFSET(abfd,
|
||||
reloc_src->r_offset,
|
||||
(bfd_byte *) reloc_dst->r_offset);
|
||||
#endif
|
||||
#ifdef SWAP_OUT_RELOC_EXTRA
|
||||
SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst);
|
||||
#endif
|
||||
|
||||
return sizeof(struct external_reloc);
|
||||
}
|
||||
|
||||
#endif /* NO_COFF_RELOCS */
|
||||
|
||||
static void
|
||||
coff_swap_filehdr_in (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
PTR src;
|
||||
PTR dst;
|
||||
{
|
||||
FILHDR *filehdr_src = (FILHDR *) src;
|
||||
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
|
||||
filehdr_dst->f_magic = bfd_h_get_16(abfd, (bfd_byte *) filehdr_src->f_magic);
|
||||
filehdr_dst->f_nscns = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_nscns);
|
||||
filehdr_dst->f_timdat = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_timdat);
|
||||
filehdr_dst->f_symptr =
|
||||
GET_FILEHDR_SYMPTR (abfd, (bfd_byte *) filehdr_src->f_symptr);
|
||||
filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms);
|
||||
filehdr_dst->f_opthdr = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_opthdr);
|
||||
filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
coff_swap_filehdr_out (abfd, in, out)
|
||||
bfd *abfd;
|
||||
PTR in;
|
||||
PTR out;
|
||||
{
|
||||
struct internal_filehdr *filehdr_in = (struct internal_filehdr *)in;
|
||||
FILHDR *filehdr_out = (FILHDR *)out;
|
||||
|
||||
bfd_h_put_16(abfd, filehdr_in->f_magic, (bfd_byte *) filehdr_out->f_magic);
|
||||
bfd_h_put_16(abfd, filehdr_in->f_nscns, (bfd_byte *) filehdr_out->f_nscns);
|
||||
bfd_h_put_32(abfd, filehdr_in->f_timdat, (bfd_byte *) filehdr_out->f_timdat);
|
||||
PUT_FILEHDR_SYMPTR (abfd, (bfd_vma) filehdr_in->f_symptr,
|
||||
(bfd_byte *) filehdr_out->f_symptr);
|
||||
bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
|
||||
bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
|
||||
bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
|
||||
|
||||
return sizeof(FILHDR);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_COFF_SYMBOLS
|
||||
|
||||
static void
|
||||
coff_swap_sym_in (abfd, ext1, in1)
|
||||
bfd *abfd;
|
||||
PTR ext1;
|
||||
PTR in1;
|
||||
{
|
||||
SYMENT *ext = (SYMENT *)ext1;
|
||||
struct internal_syment *in = (struct internal_syment *)in1;
|
||||
|
||||
if( ext->e.e_name[0] == 0) {
|
||||
in->_n._n_n._n_zeroes = 0;
|
||||
in->_n._n_n._n_offset = bfd_h_get_32(abfd, (bfd_byte *) ext->e.e.e_offset);
|
||||
}
|
||||
else {
|
||||
#if SYMNMLEN != E_SYMNMLEN
|
||||
-> Error, we need to cope with truncating or extending SYMNMLEN!;
|
||||
#else
|
||||
memcpy(in->_n._n_name, ext->e.e_name, SYMNMLEN);
|
||||
#endif
|
||||
}
|
||||
in->n_value = bfd_h_get_32(abfd, (bfd_byte *) ext->e_value);
|
||||
in->n_scnum = bfd_h_get_16(abfd, (bfd_byte *) ext->e_scnum);
|
||||
if (sizeof(ext->e_type) == 2){
|
||||
in->n_type = bfd_h_get_16(abfd, (bfd_byte *) ext->e_type);
|
||||
}
|
||||
else {
|
||||
in->n_type = bfd_h_get_32(abfd, (bfd_byte *) ext->e_type);
|
||||
}
|
||||
in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
|
||||
in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
coff_swap_sym_out (abfd, inp, extp)
|
||||
bfd *abfd;
|
||||
PTR inp;
|
||||
PTR extp;
|
||||
{
|
||||
struct internal_syment *in = (struct internal_syment *)inp;
|
||||
SYMENT *ext =(SYMENT *)extp;
|
||||
if(in->_n._n_name[0] == 0) {
|
||||
bfd_h_put_32(abfd, 0, (bfd_byte *) ext->e.e.e_zeroes);
|
||||
bfd_h_put_32(abfd, in->_n._n_n._n_offset, (bfd_byte *) ext->e.e.e_offset);
|
||||
}
|
||||
else {
|
||||
#if SYMNMLEN != E_SYMNMLEN
|
||||
-> Error, we need to cope with truncating or extending SYMNMLEN!;
|
||||
#else
|
||||
memcpy(ext->e.e_name, in->_n._n_name, SYMNMLEN);
|
||||
#endif
|
||||
}
|
||||
bfd_h_put_32(abfd, in->n_value , (bfd_byte *) ext->e_value);
|
||||
bfd_h_put_16(abfd, in->n_scnum , (bfd_byte *) ext->e_scnum);
|
||||
if (sizeof(ext->e_type) == 2)
|
||||
{
|
||||
bfd_h_put_16(abfd, in->n_type , (bfd_byte *) ext->e_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
bfd_h_put_32(abfd, in->n_type , (bfd_byte *) ext->e_type);
|
||||
}
|
||||
bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass);
|
||||
bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux);
|
||||
return sizeof(SYMENT);
|
||||
}
|
||||
|
||||
static void
|
||||
coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
|
||||
bfd *abfd;
|
||||
PTR ext1;
|
||||
int type;
|
||||
int class;
|
||||
int indx;
|
||||
int numaux;
|
||||
PTR in1;
|
||||
{
|
||||
AUXENT *ext = (AUXENT *)ext1;
|
||||
union internal_auxent *in = (union internal_auxent *)in1;
|
||||
|
||||
switch (class) {
|
||||
case C_FILE:
|
||||
if (ext->x_file.x_fname[0] == 0) {
|
||||
in->x_file.x_n.x_zeroes = 0;
|
||||
in->x_file.x_n.x_offset =
|
||||
bfd_h_get_32(abfd, (bfd_byte *) ext->x_file.x_n.x_offset);
|
||||
} else {
|
||||
#if FILNMLEN != E_FILNMLEN
|
||||
-> Error, we need to cope with truncating or extending FILNMLEN!;
|
||||
#else
|
||||
memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
|
||||
/* RS/6000 "csect" auxents */
|
||||
#ifdef RS6000COFF_C
|
||||
case C_EXT:
|
||||
case C_HIDEXT:
|
||||
if (indx + 1 == numaux)
|
||||
{
|
||||
in->x_csect.x_scnlen.l = bfd_h_get_32 (abfd, ext->x_csect.x_scnlen);
|
||||
in->x_csect.x_parmhash = bfd_h_get_32 (abfd,
|
||||
ext->x_csect.x_parmhash);
|
||||
in->x_csect.x_snhash = bfd_h_get_16 (abfd, ext->x_csect.x_snhash);
|
||||
/* We don't have to hack bitfields in x_smtyp because it's
|
||||
defined by shifts-and-ands, which are equivalent on all
|
||||
byte orders. */
|
||||
in->x_csect.x_smtyp = bfd_h_get_8 (abfd, ext->x_csect.x_smtyp);
|
||||
in->x_csect.x_smclas = bfd_h_get_8 (abfd, ext->x_csect.x_smclas);
|
||||
in->x_csect.x_stab = bfd_h_get_32 (abfd, ext->x_csect.x_stab);
|
||||
in->x_csect.x_snstab = bfd_h_get_16 (abfd, ext->x_csect.x_snstab);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case C_STAT:
|
||||
#ifdef C_LEAFSTAT
|
||||
case C_LEAFSTAT:
|
||||
#endif
|
||||
case C_HIDDEN:
|
||||
if (type == T_NULL) {
|
||||
in->x_scn.x_scnlen = GET_SCN_SCNLEN(abfd, ext);
|
||||
in->x_scn.x_nreloc = GET_SCN_NRELOC(abfd, ext);
|
||||
in->x_scn.x_nlinno = GET_SCN_NLINNO(abfd, ext);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
in->x_sym.x_tagndx.l = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_tagndx);
|
||||
#ifndef NO_TVNDX
|
||||
in->x_sym.x_tvndx = bfd_h_get_16(abfd, (bfd_byte *) ext->x_sym.x_tvndx);
|
||||
#endif
|
||||
|
||||
if (class == C_BLOCK || ISFCN (type) || ISTAG (class))
|
||||
{
|
||||
in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext);
|
||||
in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DIMNUM != E_DIMNUM
|
||||
#error we need to cope with truncating or extending DIMNUM
|
||||
#endif
|
||||
in->x_sym.x_fcnary.x_ary.x_dimen[0] =
|
||||
bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
|
||||
in->x_sym.x_fcnary.x_ary.x_dimen[1] =
|
||||
bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
|
||||
in->x_sym.x_fcnary.x_ary.x_dimen[2] =
|
||||
bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
|
||||
in->x_sym.x_fcnary.x_ary.x_dimen[3] =
|
||||
bfd_h_get_16 (abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
|
||||
}
|
||||
|
||||
if (ISFCN(type)) {
|
||||
in->x_sym.x_misc.x_fsize = bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_fsize);
|
||||
}
|
||||
else {
|
||||
in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO(abfd, ext);
|
||||
in->x_sym.x_misc.x_lnsz.x_size = GET_LNSZ_SIZE(abfd, ext);
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
|
||||
bfd *abfd;
|
||||
PTR inp;
|
||||
int type;
|
||||
int class;
|
||||
int indx;
|
||||
int numaux;
|
||||
PTR extp;
|
||||
{
|
||||
union internal_auxent *in = (union internal_auxent *)inp;
|
||||
AUXENT *ext = (AUXENT *)extp;
|
||||
|
||||
memset((PTR)ext, 0, AUXESZ);
|
||||
switch (class) {
|
||||
case C_FILE:
|
||||
if (in->x_file.x_fname[0] == 0) {
|
||||
PUTWORD(abfd, 0, (bfd_byte *) ext->x_file.x_n.x_zeroes);
|
||||
PUTWORD(abfd,
|
||||
in->x_file.x_n.x_offset,
|
||||
(bfd_byte *) ext->x_file.x_n.x_offset);
|
||||
}
|
||||
else {
|
||||
#if FILNMLEN != E_FILNMLEN
|
||||
-> Error, we need to cope with truncating or extending FILNMLEN!;
|
||||
#else
|
||||
memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
|
||||
#endif
|
||||
}
|
||||
return sizeof (AUXENT);
|
||||
|
||||
#ifdef RS6000COFF_C
|
||||
/* RS/6000 "csect" auxents */
|
||||
case C_EXT:
|
||||
case C_HIDEXT:
|
||||
if (indx + 1 == numaux)
|
||||
{
|
||||
PUTWORD (abfd, in->x_csect.x_scnlen.l, ext->x_csect.x_scnlen);
|
||||
PUTWORD (abfd, in->x_csect.x_parmhash, ext->x_csect.x_parmhash);
|
||||
PUTHALF (abfd, in->x_csect.x_snhash, ext->x_csect.x_snhash);
|
||||
/* We don't have to hack bitfields in x_smtyp because it's
|
||||
defined by shifts-and-ands, which are equivalent on all
|
||||
byte orders. */
|
||||
PUTBYTE (abfd, in->x_csect.x_smtyp, ext->x_csect.x_smtyp);
|
||||
PUTBYTE (abfd, in->x_csect.x_smclas, ext->x_csect.x_smclas);
|
||||
PUTWORD (abfd, in->x_csect.x_stab, ext->x_csect.x_stab);
|
||||
PUTHALF (abfd, in->x_csect.x_snstab, ext->x_csect.x_snstab);
|
||||
return sizeof (AUXENT);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case C_STAT:
|
||||
#ifdef C_LEAFSTAT
|
||||
case C_LEAFSTAT:
|
||||
#endif
|
||||
case C_HIDDEN:
|
||||
if (type == T_NULL) {
|
||||
PUT_SCN_SCNLEN(abfd, in->x_scn.x_scnlen, ext);
|
||||
PUT_SCN_NRELOC(abfd, in->x_scn.x_nreloc, ext);
|
||||
PUT_SCN_NLINNO(abfd, in->x_scn.x_nlinno, ext);
|
||||
return sizeof (AUXENT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
PUTWORD(abfd, in->x_sym.x_tagndx.l, (bfd_byte *) ext->x_sym.x_tagndx);
|
||||
#ifndef NO_TVNDX
|
||||
bfd_h_put_16(abfd, in->x_sym.x_tvndx , (bfd_byte *) ext->x_sym.x_tvndx);
|
||||
#endif
|
||||
|
||||
if (class == C_BLOCK || ISFCN (type) || ISTAG (class))
|
||||
{
|
||||
PUT_FCN_LNNOPTR(abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext);
|
||||
PUT_FCN_ENDNDX(abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DIMNUM != E_DIMNUM
|
||||
#error we need to cope with truncating or extending DIMNUM
|
||||
#endif
|
||||
bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[0],
|
||||
(bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[0]);
|
||||
bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[1],
|
||||
(bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[1]);
|
||||
bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[2],
|
||||
(bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[2]);
|
||||
bfd_h_put_16 (abfd, in->x_sym.x_fcnary.x_ary.x_dimen[3],
|
||||
(bfd_byte *) ext->x_sym.x_fcnary.x_ary.x_dimen[3]);
|
||||
}
|
||||
|
||||
if (ISFCN (type))
|
||||
PUTWORD (abfd, in->x_sym.x_misc.x_fsize,
|
||||
(bfd_byte *) ext->x_sym.x_misc.x_fsize);
|
||||
else
|
||||
{
|
||||
PUT_LNSZ_LNNO (abfd, in->x_sym.x_misc.x_lnsz.x_lnno, ext);
|
||||
PUT_LNSZ_SIZE (abfd, in->x_sym.x_misc.x_lnsz.x_size, ext);
|
||||
}
|
||||
|
||||
return sizeof(AUXENT);
|
||||
}
|
||||
|
||||
#endif /* NO_COFF_SYMBOLS */
|
||||
|
||||
#ifndef NO_COFF_LINENOS
|
||||
|
||||
static void
|
||||
coff_swap_lineno_in (abfd, ext1, in1)
|
||||
bfd *abfd;
|
||||
PTR ext1;
|
||||
PTR in1;
|
||||
{
|
||||
LINENO *ext = (LINENO *)ext1;
|
||||
struct internal_lineno *in = (struct internal_lineno *)in1;
|
||||
|
||||
in->l_addr.l_symndx = bfd_h_get_32(abfd, (bfd_byte *) ext->l_addr.l_symndx);
|
||||
in->l_lnno = GET_LINENO_LNNO(abfd, ext);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
coff_swap_lineno_out (abfd, inp, outp)
|
||||
bfd *abfd;
|
||||
PTR inp;
|
||||
PTR outp;
|
||||
{
|
||||
struct internal_lineno *in = (struct internal_lineno *)inp;
|
||||
struct external_lineno *ext = (struct external_lineno *)outp;
|
||||
PUTWORD(abfd, in->l_addr.l_symndx, (bfd_byte *)
|
||||
ext->l_addr.l_symndx);
|
||||
|
||||
PUT_LINENO_LNNO (abfd, in->l_lnno, ext);
|
||||
return sizeof(struct external_lineno);
|
||||
}
|
||||
|
||||
#endif /* NO_COFF_LINENOS */
|
||||
|
||||
|
||||
static void
|
||||
coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
|
||||
bfd *abfd;
|
||||
PTR aouthdr_ext1;
|
||||
PTR aouthdr_int1;
|
||||
{
|
||||
AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
|
||||
struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1;
|
||||
|
||||
aouthdr_int->magic = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->magic);
|
||||
aouthdr_int->vstamp = bfd_h_get_16(abfd, (bfd_byte *) aouthdr_ext->vstamp);
|
||||
aouthdr_int->tsize =
|
||||
GET_AOUTHDR_TSIZE (abfd, (bfd_byte *) aouthdr_ext->tsize);
|
||||
aouthdr_int->dsize =
|
||||
GET_AOUTHDR_DSIZE (abfd, (bfd_byte *) aouthdr_ext->dsize);
|
||||
aouthdr_int->bsize =
|
||||
GET_AOUTHDR_BSIZE (abfd, (bfd_byte *) aouthdr_ext->bsize);
|
||||
aouthdr_int->entry =
|
||||
GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry);
|
||||
aouthdr_int->text_start =
|
||||
GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start);
|
||||
aouthdr_int->data_start =
|
||||
GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start);
|
||||
|
||||
#ifdef I960
|
||||
aouthdr_int->tagentries = bfd_h_get_32(abfd, (bfd_byte *) aouthdr_ext->tagentries);
|
||||
#endif
|
||||
|
||||
#ifdef APOLLO_M68
|
||||
bfd_h_put_32(abfd, aouthdr_int->o_inlib, (bfd_byte *) aouthdr_ext->o_inlib);
|
||||
bfd_h_put_32(abfd, aouthdr_int->o_sri, (bfd_byte *) aouthdr_ext->o_sri);
|
||||
bfd_h_put_32(abfd, aouthdr_int->vid[0], (bfd_byte *) aouthdr_ext->vid);
|
||||
bfd_h_put_32(abfd, aouthdr_int->vid[1], (bfd_byte *) aouthdr_ext->vid + 4);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RS6000COFF_C
|
||||
aouthdr_int->o_toc = bfd_h_get_32(abfd, aouthdr_ext->o_toc);
|
||||
aouthdr_int->o_snentry = bfd_h_get_16(abfd, aouthdr_ext->o_snentry);
|
||||
aouthdr_int->o_sntext = bfd_h_get_16(abfd, aouthdr_ext->o_sntext);
|
||||
aouthdr_int->o_sndata = bfd_h_get_16(abfd, aouthdr_ext->o_sndata);
|
||||
aouthdr_int->o_sntoc = bfd_h_get_16(abfd, aouthdr_ext->o_sntoc);
|
||||
aouthdr_int->o_snloader = bfd_h_get_16(abfd, aouthdr_ext->o_snloader);
|
||||
aouthdr_int->o_snbss = bfd_h_get_16(abfd, aouthdr_ext->o_snbss);
|
||||
aouthdr_int->o_algntext = bfd_h_get_16(abfd, aouthdr_ext->o_algntext);
|
||||
aouthdr_int->o_algndata = bfd_h_get_16(abfd, aouthdr_ext->o_algndata);
|
||||
aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype);
|
||||
aouthdr_int->o_cputype = bfd_h_get_16(abfd, aouthdr_ext->o_cputype);
|
||||
aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack);
|
||||
aouthdr_int->o_maxdata = bfd_h_get_32(abfd, aouthdr_ext->o_maxdata);
|
||||
#endif
|
||||
|
||||
#ifdef MIPSECOFF
|
||||
aouthdr_int->bss_start = bfd_h_get_32(abfd, aouthdr_ext->bss_start);
|
||||
aouthdr_int->gp_value = bfd_h_get_32(abfd, aouthdr_ext->gp_value);
|
||||
aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask);
|
||||
aouthdr_int->cprmask[0] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[0]);
|
||||
aouthdr_int->cprmask[1] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[1]);
|
||||
aouthdr_int->cprmask[2] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[2]);
|
||||
aouthdr_int->cprmask[3] = bfd_h_get_32(abfd, aouthdr_ext->cprmask[3]);
|
||||
#endif
|
||||
|
||||
#ifdef ALPHAECOFF
|
||||
aouthdr_int->bss_start = bfd_h_get_64(abfd, aouthdr_ext->bss_start);
|
||||
aouthdr_int->gp_value = bfd_h_get_64(abfd, aouthdr_ext->gp_value);
|
||||
aouthdr_int->gprmask = bfd_h_get_32(abfd, aouthdr_ext->gprmask);
|
||||
aouthdr_int->fprmask = bfd_h_get_32(abfd, aouthdr_ext->fprmask);
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
coff_swap_aouthdr_out (abfd, in, out)
|
||||
bfd *abfd;
|
||||
PTR in;
|
||||
PTR out;
|
||||
{
|
||||
struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *)in;
|
||||
AOUTHDR *aouthdr_out = (AOUTHDR *)out;
|
||||
|
||||
bfd_h_put_16(abfd, aouthdr_in->magic, (bfd_byte *) aouthdr_out->magic);
|
||||
bfd_h_put_16(abfd, aouthdr_in->vstamp, (bfd_byte *) aouthdr_out->vstamp);
|
||||
PUT_AOUTHDR_TSIZE (abfd, aouthdr_in->tsize, (bfd_byte *) aouthdr_out->tsize);
|
||||
PUT_AOUTHDR_DSIZE (abfd, aouthdr_in->dsize, (bfd_byte *) aouthdr_out->dsize);
|
||||
PUT_AOUTHDR_BSIZE (abfd, aouthdr_in->bsize, (bfd_byte *) aouthdr_out->bsize);
|
||||
PUT_AOUTHDR_ENTRY (abfd, aouthdr_in->entry, (bfd_byte *) aouthdr_out->entry);
|
||||
PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
|
||||
(bfd_byte *) aouthdr_out->text_start);
|
||||
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
|
||||
(bfd_byte *) aouthdr_out->data_start);
|
||||
|
||||
#ifdef I960
|
||||
bfd_h_put_32(abfd, aouthdr_in->tagentries, (bfd_byte *) aouthdr_out->tagentries);
|
||||
#endif
|
||||
|
||||
#ifdef RS6000COFF_C
|
||||
bfd_h_put_32 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_snentry, aouthdr_out->o_snentry);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_sntext, aouthdr_out->o_sntext);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_sndata, aouthdr_out->o_sndata);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_sntoc, aouthdr_out->o_sntoc);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_snloader, aouthdr_out->o_snloader);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_snbss, aouthdr_out->o_snbss);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_algntext, aouthdr_out->o_algntext);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype);
|
||||
bfd_h_put_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype);
|
||||
bfd_h_put_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
|
||||
bfd_h_put_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
|
||||
memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2);
|
||||
#endif
|
||||
|
||||
#ifdef MIPSECOFF
|
||||
bfd_h_put_32(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start);
|
||||
bfd_h_put_32(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value);
|
||||
bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask);
|
||||
bfd_h_put_32(abfd, aouthdr_in->cprmask[0], (bfd_byte *) aouthdr_out->cprmask[0]);
|
||||
bfd_h_put_32(abfd, aouthdr_in->cprmask[1], (bfd_byte *) aouthdr_out->cprmask[1]);
|
||||
bfd_h_put_32(abfd, aouthdr_in->cprmask[2], (bfd_byte *) aouthdr_out->cprmask[2]);
|
||||
bfd_h_put_32(abfd, aouthdr_in->cprmask[3], (bfd_byte *) aouthdr_out->cprmask[3]);
|
||||
#endif
|
||||
|
||||
#ifdef ALPHAECOFF
|
||||
/* FIXME: What does bldrev mean? */
|
||||
bfd_h_put_16(abfd, (bfd_vma) 2, (bfd_byte *) aouthdr_out->bldrev);
|
||||
bfd_h_put_16(abfd, (bfd_vma) 0, (bfd_byte *) aouthdr_out->padding);
|
||||
bfd_h_put_64(abfd, aouthdr_in->bss_start, (bfd_byte *) aouthdr_out->bss_start);
|
||||
bfd_h_put_64(abfd, aouthdr_in->gp_value, (bfd_byte *) aouthdr_out->gp_value);
|
||||
bfd_h_put_32(abfd, aouthdr_in->gprmask, (bfd_byte *) aouthdr_out->gprmask);
|
||||
bfd_h_put_32(abfd, aouthdr_in->fprmask, (bfd_byte *) aouthdr_out->fprmask);
|
||||
#endif
|
||||
|
||||
return sizeof(AOUTHDR);
|
||||
}
|
||||
|
||||
static void
|
||||
coff_swap_scnhdr_in (abfd, ext, in)
|
||||
bfd *abfd;
|
||||
PTR ext;
|
||||
PTR 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, (bfd_byte *) scnhdr_ext->s_vaddr);
|
||||
scnhdr_int->s_paddr =
|
||||
GET_SCNHDR_PADDR (abfd, (bfd_byte *) scnhdr_ext->s_paddr);
|
||||
scnhdr_int->s_size =
|
||||
GET_SCNHDR_SIZE (abfd, (bfd_byte *) scnhdr_ext->s_size);
|
||||
|
||||
scnhdr_int->s_scnptr =
|
||||
GET_SCNHDR_SCNPTR (abfd, (bfd_byte *) scnhdr_ext->s_scnptr);
|
||||
scnhdr_int->s_relptr =
|
||||
GET_SCNHDR_RELPTR (abfd, (bfd_byte *) scnhdr_ext->s_relptr);
|
||||
scnhdr_int->s_lnnoptr =
|
||||
GET_SCNHDR_LNNOPTR (abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr);
|
||||
scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags);
|
||||
#if defined(M88)
|
||||
scnhdr_int->s_nreloc = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
|
||||
scnhdr_int->s_nlnno = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
|
||||
#else
|
||||
scnhdr_int->s_nreloc = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
|
||||
scnhdr_int->s_nlnno = bfd_h_get_16(abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
|
||||
#endif
|
||||
#ifdef I960
|
||||
scnhdr_int->s_align = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_align);
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
coff_swap_scnhdr_out (abfd, in, out)
|
||||
bfd *abfd;
|
||||
PTR in;
|
||||
PTR out;
|
||||
{
|
||||
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in;
|
||||
SCNHDR *scnhdr_ext = (SCNHDR *)out;
|
||||
unsigned int ret = sizeof (SCNHDR);
|
||||
|
||||
memcpy(scnhdr_ext->s_name, scnhdr_int->s_name, sizeof(scnhdr_int->s_name));
|
||||
|
||||
PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr,
|
||||
(bfd_byte *) scnhdr_ext->s_vaddr);
|
||||
|
||||
|
||||
PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr,
|
||||
(bfd_byte *) scnhdr_ext->s_paddr);
|
||||
PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size,
|
||||
(bfd_byte *) scnhdr_ext->s_size);
|
||||
|
||||
PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr,
|
||||
(bfd_byte *) scnhdr_ext->s_scnptr);
|
||||
PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr,
|
||||
(bfd_byte *) scnhdr_ext->s_relptr);
|
||||
PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr,
|
||||
(bfd_byte *) scnhdr_ext->s_lnnoptr);
|
||||
PUTWORD(abfd, scnhdr_int->s_flags, (bfd_byte *) scnhdr_ext->s_flags);
|
||||
#if defined(M88)
|
||||
PUTWORD(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);
|
||||
PUTWORD(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
|
||||
#else
|
||||
if (scnhdr_int->s_nlnno <= 0xffff)
|
||||
PUTHALF(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);
|
||||
else
|
||||
{
|
||||
(*_bfd_error_handler) ("%s: line number overflow: 0x%lx > 0xffff",
|
||||
bfd_get_filename (abfd),
|
||||
scnhdr_int->s_nlnno);
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
|
||||
ret = 0;
|
||||
}
|
||||
if (scnhdr_int->s_nreloc <= 0xffff)
|
||||
PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
|
||||
else
|
||||
{
|
||||
(*_bfd_error_handler) ("%s: reloc overflow: 0x%lx > 0xffff",
|
||||
bfd_get_filename (abfd),
|
||||
scnhdr_int->s_nreloc);
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
|
||||
ret = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(I960)
|
||||
PUTWORD(abfd, scnhdr_int->s_align, (bfd_byte *) scnhdr_ext->s_align);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
@ -1,491 +0,0 @@
|
||||
# config.bfd
|
||||
# Convert a canonical host type into a BFD host type.
|
||||
# Set shell variable targ to canonical target name, and run
|
||||
# using ``. config.bfd''.
|
||||
# Sets the following shell variables:
|
||||
# targ_defvec Default vector for this target
|
||||
# targ_selvecs Vectors to build for this target
|
||||
# targ_archs Architectures for this target
|
||||
# targ_cflags $(CFLAGS) for this target (FIXME: pretty bogus)
|
||||
# targ_undercore Whether underscores are used: yes or no
|
||||
|
||||
# The binutils c++filt program wants to know whether underscores are
|
||||
# stripped or not. That is why we set targ_underscore. c++filt uses
|
||||
# this information to choose a default. This information is
|
||||
# duplicated in the symbol_leading_char field of the BFD target
|
||||
# vector, but c++filt does not deal with object files and is not
|
||||
# linked against libbfd.a. It is not terribly important that c++filt
|
||||
# get this right; it is just convenient.
|
||||
|
||||
targ_defvec=
|
||||
targ_selvecs=
|
||||
targ_cflags=
|
||||
targ_underscore=no
|
||||
|
||||
targ_cpu=`echo $targ | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
|
||||
case "${targ_cpu}" in
|
||||
arm*) targ_archs=bfd_arm_arch ;;
|
||||
hppa*) targ_archs=bfd_hppa_arch ;;
|
||||
i[345]86) targ_archs=bfd_i386_arch ;;
|
||||
m68*) targ_archs=bfd_m68k_arch ;;
|
||||
m88*) targ_archs=bfd_m88k_arch ;;
|
||||
mips*) targ_archs=bfd_mips_arch ;;
|
||||
powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
|
||||
rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
|
||||
sparc*) targ_archs=bfd_sparc_arch ;;
|
||||
z8k*) targ_archs=bfd_z8k_arch ;;
|
||||
*) targ_archs=bfd_${targ_cpu}_arch ;;
|
||||
esac
|
||||
|
||||
# WHEN ADDING ENTRIES TO THIS MATRIX:
|
||||
# Make sure that the left side always has two dashes. Otherwise you
|
||||
# can get spurious matches. Even for unambiguous cases, do this as a
|
||||
# convention, else the table becomes a real mess to understand and maintain.
|
||||
|
||||
case "${targ}" in
|
||||
alpha-*-netware*)
|
||||
targ_defvec=ecoffalpha_little_vec
|
||||
targ_selvecs=nlm32_alpha_vec
|
||||
;;
|
||||
alpha-*-*)
|
||||
targ_defvec=ecoffalpha_little_vec
|
||||
;;
|
||||
|
||||
|
||||
arm-*-riscix*)
|
||||
targ_defvec=riscix_vec
|
||||
;;
|
||||
arm-*-pe*)
|
||||
targ_defvec=armpe_little_vec
|
||||
targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
arm-*-aout | armel-*-aout)
|
||||
targ_defvec=aout_arm_little_vec
|
||||
targ_selvecs=aout_arm_big_vec
|
||||
;;
|
||||
armeb-*-aout)
|
||||
targ_defvec=aout_arm_big_vec
|
||||
targ_selvecs=aout_arm_little_vec
|
||||
;;
|
||||
arm-*-coff)
|
||||
targ_defvec=armcoff_little_vec
|
||||
targ_selvecs=armcoff_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
a29k-*-ebmon* | a29k-*-udi* | a29k-*-coff* | a29k-*-sym1* | \
|
||||
a29k-*-vxworks* | a29k-*-sysv*)
|
||||
targ_defvec=a29kcoff_big_vec
|
||||
targ_selvecs=sunos_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
a29k-*-aout* | a29k-*-bsd* | a29k-*-vsta*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
h8300*-*-*)
|
||||
targ_defvec=h8300coff_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
h8500-*-*)
|
||||
targ_defvec=h8500coff_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
sh-*-*)
|
||||
targ_defvec=shcoff_vec
|
||||
targ_selvecs="shcoff_vec shlcoff_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_hppa_vec
|
||||
;;
|
||||
hppa*-*-bsd*)
|
||||
targ_defvec=som_vec
|
||||
targ_selvecs=bfd_elf32_hppa_vec
|
||||
;;
|
||||
hppa*-*-hpux* | hppa*-*-hiux*)
|
||||
targ_defvec=som_vec
|
||||
;;
|
||||
hppa*-*-osf*)
|
||||
targ_defvec=som_vec
|
||||
targ_selvecs=bfd_elf32_hppa_vec
|
||||
;;
|
||||
|
||||
i[345]86-*-sysv4* | i[345]86-*-unixware | i[345]86-*-solaris2* | \
|
||||
i[345]86-*-elf | i[345]86-*-sco*elf*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs=i386coff_vec
|
||||
;;
|
||||
i[345]86-*-sysv* | i[345]86-*-isc* | i[345]86-*-sco* | i[345]86-*-coff | \
|
||||
i[345]86-*-aix* | i[345]86-*-go32*)
|
||||
targ_defvec=i386coff_vec
|
||||
;;
|
||||
i[345]86-sequent-bsd*)
|
||||
targ_defvec=i386dynix_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[345]86-*-bsd*)
|
||||
targ_defvec=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[345]86-*-freebsd*)
|
||||
targ_defvec=i386freebsd_vec
|
||||
targ_selvecs=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[345]86-*-netbsd*)
|
||||
targ_defvec=i386netbsd_vec
|
||||
targ_selvecs=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[345]86-*-netware*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs="nlm32_i386_vec i386coff_vec i386aout_vec"
|
||||
;;
|
||||
i[345]86-*-linuxaout*)
|
||||
targ_defvec=i386linux_vec
|
||||
targ_selvecs=bfd_elf32_i386_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[345]86-*-linux*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs=i386linux_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[345]86-*-lynxos*)
|
||||
targ_defvec=i386lynx_coff_vec
|
||||
targ_selvecs=i386lynx_aout_vec
|
||||
;;
|
||||
i[345]86-*-gnu*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs=i386mach3_vec
|
||||
targ_cflags=-DSTAT_FOR_EXEC
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[345]86-*-mach* | i[345]86-*-osf1mk*)
|
||||
targ_defvec=i386mach3_vec
|
||||
targ_cflags=-DSTAT_FOR_EXEC
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[345]86-*-os9k)
|
||||
targ_defvec=i386os9k_vec
|
||||
;;
|
||||
i[345]86-*-msdos*)
|
||||
targ_defvec=i386aout_vec
|
||||
targ_selvecs=i386msdos_vec
|
||||
;;
|
||||
i[345]86-*-moss*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs="i386msdos_vec i386aout_vec"
|
||||
;;
|
||||
i[345]86-*-cygwin32 | i[345]86-*-winnt | i[345]86-*-pe)
|
||||
targ_defvec=i386pe_vec
|
||||
targ_selvecs="i386pe_vec i386pei_vec"
|
||||
;;
|
||||
i[345]86-none-*)
|
||||
targ_defvec=i386coff_vec
|
||||
;;
|
||||
i[345]86-*-aout* | i[345]86*-*-vsta*)
|
||||
targ_defvec=i386aout_vec
|
||||
;;
|
||||
|
||||
i860-*-mach3* | i860-*-osf1* | i860-*-coff*)
|
||||
targ_defvec=i860coff_vec
|
||||
;;
|
||||
i860-*-sysv4* | i860-*-elf*)
|
||||
targ_defvec=bfd_elf32_i860_vec
|
||||
;;
|
||||
|
||||
i960-*-vxworks4* | i960-*-vxworks5.0)
|
||||
targ_defvec=b_out_vec_little_host
|
||||
targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv*)
|
||||
targ_defvec=icoff_little_vec
|
||||
targ_selvecs="icoff_big_vec b_out_vec_little_host b_out_vec_big_host"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i960-*-vxworks* | i960-*-aout* | i960-*-bout* | i960-*-nindy*)
|
||||
targ_defvec=b_out_vec_little_host
|
||||
targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
m68*-apollo-*)
|
||||
targ_defvec=apollocoff_vec
|
||||
;;
|
||||
m68*-bull-sysv*)
|
||||
targ_defvec=m68kcoffun_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-hp-bsd*)
|
||||
targ_defvec=hp300bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-aout*)
|
||||
targ_defvec=aout0_big_vec
|
||||
# We include this here, rather than making a separate cisco
|
||||
# configuration, so that cisco-core.c gets routinely tested at
|
||||
# least for compilation.
|
||||
targ_selvecs=cisco_core_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-elf* | m68*-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
targ_selvecs=m68kcoff_vec
|
||||
;;
|
||||
m68*-*-coff* | m68*-*-sysv*)
|
||||
targ_defvec=m68kcoff_vec
|
||||
targ_selvecs="m68kcoff_vec versados_vec"
|
||||
;;
|
||||
m68*-*-hpux*)
|
||||
targ_defvec=hp300hpux_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-linuxaout*)
|
||||
targ_defvec=m68klinux_vec
|
||||
targ_selvecs=bfd_elf32_m68k_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-linux*)
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
targ_selvecs=m68klinux_vec
|
||||
;;
|
||||
m68*-*-lynxos*)
|
||||
targ_defvec=m68klynx_coff_vec
|
||||
targ_selvecs=m68klynx_aout_vec
|
||||
;;
|
||||
m68*-hp*-netbsd*)
|
||||
targ_defvec=m68k4knetbsd_vec
|
||||
targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-netbsd*)
|
||||
targ_defvec=m68knetbsd_vec
|
||||
targ_selvecs="m68k4knetbsd_vec hp300bsd_vec sunos_big_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-sunos* | m68*-*-os68k* | m68*-*-vxworks* | m68*-netx-* | \
|
||||
m68*-*-bsd* | m68*-*-vsta*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-ericsson-*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_selvecs="m68kcoff_vec tekhex_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-cbm-*)
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
targ_selvecs=m68kcoff_vec
|
||||
;;
|
||||
m68*-apple-aux*)
|
||||
targ_defvec=m68kaux_coff_vec
|
||||
;;
|
||||
m68*-*-psos*)
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
targ_selvecs=ieee_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
m88*-harris-cxux* | m88*-*-dgux* | m88*-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_m88k_vec
|
||||
targ_selvecs=m88kbcs_vec
|
||||
;;
|
||||
m88*-*-mach3*)
|
||||
targ_defvec=m88kmach3_vec
|
||||
targ_cflags=-DSTAT_FOR_EXEC
|
||||
;;
|
||||
m88*-*-*)
|
||||
targ_defvec=m88kbcs_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
mips*-big-*)
|
||||
targ_defvec=ecoff_big_vec
|
||||
targ_selvecs=ecoff_little_vec
|
||||
;;
|
||||
mips-dec-netbsd*)
|
||||
targ_defvec=bfd_elf32_littlemips_vec
|
||||
targ_selvecs=bfd_elf32_bigmips_vec
|
||||
;;
|
||||
mips*-dec-bsd*)
|
||||
targ_defvec=aout_mips_little_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
mips*-dec-mach3*)
|
||||
targ_defvec=aout_mips_little_vec
|
||||
targ_cflags=-DSTAT_FOR_EXEC
|
||||
;;
|
||||
mips*-dec-* | mips*el-*-ecoff*)
|
||||
targ_defvec=ecoff_little_vec
|
||||
targ_selvecs=ecoff_big_vec
|
||||
;;
|
||||
mips*-*-ecoff*)
|
||||
targ_defvec=ecoff_big_vec
|
||||
targ_selvecs=ecoff_little_vec
|
||||
;;
|
||||
mips*-*-irix5*)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
|
||||
;;
|
||||
mips*-sgi-* | mips*-*-bsd*)
|
||||
targ_defvec=ecoff_big_vec
|
||||
targ_selvecs=ecoff_little_vec
|
||||
;;
|
||||
mips*-*-mach3*)
|
||||
targ_defvec=aout_mips_little_vec
|
||||
targ_cflags=-DSTAT_FOR_EXEC
|
||||
;;
|
||||
mips*-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
|
||||
;;
|
||||
mips*-*-sysv* | mips*-*-riscos*)
|
||||
targ_defvec=ecoff_big_vec
|
||||
targ_selvecs=ecoff_little_vec
|
||||
;;
|
||||
mips*el-*-elf*)
|
||||
targ_defvec=bfd_elf32_littlemips_vec
|
||||
targ_selvecs=bfd_elf32_bigmips_vec
|
||||
;;
|
||||
mips*-*-elf*)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs=bfd_elf32_littlemips_vec
|
||||
;;
|
||||
|
||||
ns32k-pc532-mach* | ns32k-pc532-ux*)
|
||||
targ_defvec=pc532machaout_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
ns32k-*-netbsd* | ns32k-*-lites*)
|
||||
targ_defvec=pc532netbsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
powerpc-*-aix*)
|
||||
targ_defvec=rs6000coff_vec
|
||||
;;
|
||||
powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | powerpc-*-solaris2*)
|
||||
targ_defvec=bfd_elf32_powerpc_vec
|
||||
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec"
|
||||
;;
|
||||
powerpc-*-macos* | powerpc-*-mpw*)
|
||||
targ_defvec=pmac_xcoff_vec
|
||||
;;
|
||||
powerpc-*-netware*)
|
||||
targ_defvec=bfd_elf32_powerpc_vec
|
||||
targ_selvecs="nlm32_powerpc_vec rs6000coff_vec"
|
||||
;;
|
||||
powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
|
||||
powerpcle-*-solaris2*)
|
||||
targ_defvec=bfd_elf32_powerpcle_vec
|
||||
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec"
|
||||
;;
|
||||
|
||||
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin32)
|
||||
targ_defvec=bfd_powerpcle_pe_vec
|
||||
targ_selvecs="bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec"
|
||||
;;
|
||||
|
||||
rs6000-*-*)
|
||||
targ_defvec=rs6000coff_vec
|
||||
;;
|
||||
|
||||
sparc-*-lynxos*)
|
||||
targ_defvec=sparclynx_coff_vec
|
||||
targ_selvecs=sparclynx_aout_vec
|
||||
;;
|
||||
sparc-*-netbsd*)
|
||||
targ_defvec=sparcnetbsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparc-*-elf* | sparc-*-sysv4* | sparc-*-solaris2*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
targ_selvecs=sunos_big_vec
|
||||
;;
|
||||
sparc64-*-aout*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparc64-*-elf*)
|
||||
targ_defvec=bfd_elf64_sparc_vec
|
||||
targ_selvecs=bfd_elf32_sparc_vec
|
||||
;;
|
||||
sparc64-*-solaris2* | sparc64-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
# Adding 64 bit support by default causes things like objdump to
|
||||
# print addresses as 64 bits.
|
||||
#targ_selvecs=bfd_elf64_sparc_vec
|
||||
;;
|
||||
sparc-*-netware*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
targ_selvecs="nlm32_sparc_vec sunos_big_vec"
|
||||
;;
|
||||
sparc*-*-coff*)
|
||||
targ_defvec=sparccoff_vec
|
||||
;;
|
||||
sparc*-*-*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
tahoe-*-*)
|
||||
targ_defvec=host_aout_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
vax-*-vms*)
|
||||
echo 1>&2 "*** BFD does not support target ${targ}."
|
||||
echo 1>&2 "*** Look in bfd/config.bfd for supported targets."
|
||||
exit 1
|
||||
;;
|
||||
vax-*-*)
|
||||
targ_defvec=host_aout_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
we32k-*-*)
|
||||
targ_defvec=we32kcoff_vec
|
||||
;;
|
||||
|
||||
w65-*-*)
|
||||
targ_defvec=w65_vec
|
||||
;;
|
||||
|
||||
z8k*-*-*)
|
||||
targ_defvec=z8kcoff_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
*-*-ieee*)
|
||||
targ_defvec=ieee_vec
|
||||
;;
|
||||
|
||||
*-adobe-*)
|
||||
targ_defvec=a_aout_adobe_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
*-sony-*)
|
||||
targ_defvec=newsos3_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
*-tandem-*)
|
||||
targ_defvec=m68kcoff_vec
|
||||
targ_selvecs=ieee_vec
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "*** BFD does not support target ${targ}."
|
||||
echo 1>&2 "*** Look in bfd/config.bfd for supported targets."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
@ -1,67 +0,0 @@
|
||||
/* config.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Whether malloc must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_MALLOC
|
||||
|
||||
/* Whether free must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_FREE
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Do we need to use the b modifier when opening binary files? */
|
||||
#undef USE_BINARY_FOPEN
|
||||
|
||||
/* Name of host specific header file to include in trad-core.c. */
|
||||
#undef TRAD_HEADER
|
||||
|
||||
/* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
|
||||
#undef HAVE_SYS_PROCFS_H
|
||||
|
||||
/* Do we really want to use mmap if it's available? */
|
||||
#undef USE_MMAP
|
||||
|
||||
/* Define if you have the fcntl function. */
|
||||
#undef HAVE_FCNTL
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if you have the madvise function. */
|
||||
#undef HAVE_MADVISE
|
||||
|
||||
/* Define if you have the mprotect function. */
|
||||
#undef HAVE_MPROTECT
|
||||
|
||||
/* Define if you have the valloc function. */
|
||||
#undef HAVE_VALLOC
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define if you have the <time.h> header file. */
|
||||
#undef HAVE_TIME_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
2439
contrib/gdb/bfd/configure
vendored
2439
contrib/gdb/bfd/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,128 +0,0 @@
|
||||
# This file is a shell script that overrides some of the tools and
|
||||
# flags used on a host specific basis.
|
||||
|
||||
# Since the "bfd/hosts" directory is shared by the bfd, opcodes, and
|
||||
# binutils directories (at least), the index to it is also shared.
|
||||
# This is that index. Each configure.in file should source this file
|
||||
# in its per-host part.
|
||||
|
||||
# This sets the following shell variables:
|
||||
# HDEFINES host specific compiler options
|
||||
# host64 set to true if this is a 64 bit host
|
||||
# HOST_64BIT_TYPE host 64 bit type
|
||||
# SHLIB_CC compiler to use when building shared library
|
||||
# SHLIB_CFLAGS flags to use when building shared library
|
||||
# PICFLAG may be set to flag to use to compile PIC
|
||||
# SHLINK may be set to the name to link the shared library to
|
||||
# ALLLIBS may be set to libraries to build
|
||||
# HLDFLAGS LDFLAGS specific to the host
|
||||
# RPATH_ENVVAR environment variable used to find shared libraries
|
||||
|
||||
HDEFINES=
|
||||
host64=false
|
||||
HOST_64BIT_TYPE=
|
||||
|
||||
case "${host}" in
|
||||
|
||||
alpha-*-*) host64=true; HOST_64BIT_TYPE=long ;;
|
||||
|
||||
hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;;
|
||||
hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;;
|
||||
hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
|
||||
hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
|
||||
|
||||
i[345]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
|
||||
i[345]86-sequent-sysv4*) ;;
|
||||
i[345]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
|
||||
|
||||
mips-dec-netbsd*) ;;
|
||||
mips-dec-*) HDEFINES="-G 4" ;;
|
||||
mips-sgi-irix3*) HDEFINES="-G 4" ;;
|
||||
mips-sgi-irix4*) HDEFINES="-G 4" ;;
|
||||
mips-*-sysv4*) ;;
|
||||
mips-*-sysv*) HDEFINES="-G 4" ;;
|
||||
mips-*-riscos*) HDEFINES="-G 4" ;;
|
||||
|
||||
m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;;
|
||||
|
||||
esac
|
||||
|
||||
# If we are configuring with --enable-shared, adjust the shared
|
||||
# library support based on the host. This support must work for both
|
||||
# the BFD and the opcodes libraries.
|
||||
HLDFLAGS=
|
||||
RPATH_ENVVAR=LD_LIBRARY_PATH
|
||||
SHLIB_CC='$(CC)'
|
||||
SHLIB_CFLAGS='-shared'
|
||||
if [ "${shared}" = "true" ]; then
|
||||
case "${host}" in
|
||||
hppa*-*-*) picfrag=../config/mh-papic ;;
|
||||
i[3456]86-*-*) picfrag=../config/mh-x86pic ;;
|
||||
*-*-*) picfrag=../config/mh-${host_cpu}pic ;;
|
||||
esac
|
||||
if [ -f "${picfrag}" ]; then
|
||||
pic=`sed -n -e 's/^PICFLAG[ ]*=[ ]*\(.*\)$/\1/p' ${picfrag}`
|
||||
if [ -n "${pic}" ]; then
|
||||
PICFLAG=${pic}
|
||||
fi
|
||||
fi
|
||||
|
||||
case "${host}" in
|
||||
*-dec-osf*)
|
||||
# -fpic is not needed on the Alpha.
|
||||
PICFLAG=
|
||||
;;
|
||||
*-*-hpux*)
|
||||
# HP/UX uses .sl for shared libraries.
|
||||
SHLINK=`echo ${SHLINK} | sed -e 's/so$/sl/'`
|
||||
SHLIB_CFLAGS='-shared $(PICFLAG)'
|
||||
HLDFLAGS='-Wl,+s,+b,$(libdir)'
|
||||
RPATH_ENVVAR=SHLIB_PATH
|
||||
;;
|
||||
*-*-irix5*)
|
||||
# -fpic is not needed on Irix 5.
|
||||
PICFLAG=
|
||||
SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
|
||||
HLDFLAGS='-Wl,-rpath,$(libdir)'
|
||||
;;
|
||||
*-*-linux*aout*)
|
||||
;;
|
||||
*-*-linux*)
|
||||
SHLIB_CFLAGS='-shared -Wl,-soname,$(SONAME)'
|
||||
case "$(libdir)" in
|
||||
/lib | /usr/lib) ;;
|
||||
*) HLDFLAGS='-Wl,-rpath,$(libdir)' ;;
|
||||
esac
|
||||
;;
|
||||
*-*-sysv4* | *-*-solaris*)
|
||||
SHLIB_CFLAGS='-shared -h $(SONAME)'
|
||||
HLDFLAGS='-R $(libdir)'
|
||||
;;
|
||||
*-*-sunos*)
|
||||
# Build a libTARGET-bfd.so.VERSION symlink in the object directory.
|
||||
ALLLIBS=`echo ${ALLLIBS} | sed -e 's/\$(SHLINK)/stamp-tshlink/'`
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# On SunOS, if the linker supports the -rpath option, use it to
|
||||
# prevent ../bfd and ../opcodes from being included in the run time
|
||||
# search path.
|
||||
case "${host}" in
|
||||
*-*-sunos*)
|
||||
echo 'main () { }' > conftest.c
|
||||
${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
|
||||
if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
|
||||
:
|
||||
elif grep 'No such file' conftest.t >/dev/null 2>&1; then
|
||||
:
|
||||
elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
|
||||
:
|
||||
elif [ "${shared}" = "true" ]; then
|
||||
HLDFLAGS='-Wl,-rpath=$(libdir)'
|
||||
else
|
||||
HLDFLAGS='-Wl,-rpath='
|
||||
fi
|
||||
rm -f conftest.t conftest.c conftest
|
||||
;;
|
||||
esac
|
@ -1,577 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
AC_PREREQ(2.3)
|
||||
AC_INIT(libbfd.c)
|
||||
|
||||
AC_ARG_ENABLE(64-bit-bfd,
|
||||
[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
|
||||
[case "${enableval}" in
|
||||
yes) want64=true ;;
|
||||
no) want64=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
|
||||
esac],[want64=false])dnl
|
||||
AC_ARG_ENABLE(targets,
|
||||
[ --enable-targets alternative target configurations],
|
||||
[case "${enableval}" in
|
||||
yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
|
||||
;;
|
||||
no) enable_targets= ;;
|
||||
*) enable_targets=$enableval ;;
|
||||
esac])dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
[ --enable-shared build shared BFD library],
|
||||
[case "${enableval}" in
|
||||
yes) shared=true ;;
|
||||
no) shared=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for BFD shared option]) ;;
|
||||
esac])dnl
|
||||
AC_ARG_ENABLE(commonbfdlib,
|
||||
[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
|
||||
[case "${enableval}" in
|
||||
yes) commonbfdlib=true ;;
|
||||
no) commonbfdlib=false ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
|
||||
esac])dnl
|
||||
AC_ARG_WITH(mmap,
|
||||
[ --with-mmap try using mmap for BFD input files if available],
|
||||
[case "${withval}" in
|
||||
yes) want_mmap=true ;;
|
||||
no) want_mmap=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;;
|
||||
esac],[want_mmap=false])dnl
|
||||
|
||||
AC_CONFIG_HEADER(config.h:config.in)
|
||||
|
||||
AC_CONFIG_AUX_DIR(`cd $srcdir/..;pwd`)
|
||||
AC_CANONICAL_SYSTEM
|
||||
if test -z "$target" ; then
|
||||
AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
|
||||
fi
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
host64=false
|
||||
target64=false
|
||||
|
||||
# host stuff:
|
||||
|
||||
ALLLIBS='$(TARGETLIB)'
|
||||
PICFLAG=
|
||||
SHLIB=unused-shlib
|
||||
SHLINK=unused-shlink
|
||||
if test "${shared}" = "true"; then
|
||||
PICFLAG=-fpic
|
||||
if test "${commonbfdlib}" = "true"; then
|
||||
ALLLIBS='$(TARGETLIB)'
|
||||
else
|
||||
ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)'
|
||||
changequote(,)dnl
|
||||
SHLIB=libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/VERSION`
|
||||
changequote([,])dnl
|
||||
SHLINK=libbfd.so
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
# Permit host specific settings.
|
||||
. ${srcdir}/configure.host
|
||||
|
||||
AC_SUBST(HDEFINES)
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
||||
AC_PROG_INSTALL
|
||||
|
||||
if test "${shared}" = "true"; then
|
||||
if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then
|
||||
AC_MSG_WARN([BFD --enable-shared only supported when using gcc])
|
||||
shared=false
|
||||
ALLLIBS='$(TARGETLIB)'
|
||||
PICFLAG=
|
||||
SHLIB=unused-shlib
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(ALLLIBS)
|
||||
AC_SUBST(PICFLAG)
|
||||
AC_SUBST(SHLIB)
|
||||
AC_SUBST(SHLIB_CC)
|
||||
AC_SUBST(SHLIB_CFLAGS)
|
||||
if test "${commonbfdlib}" = "true"; then
|
||||
COMMON_SHLIB=yes
|
||||
PICLIST=piclist
|
||||
else
|
||||
COMMON_SHLIB=
|
||||
PICLIST=
|
||||
fi
|
||||
AC_SUBST(COMMON_SHLIB)
|
||||
AC_SUBST(PICLIST)
|
||||
AC_SUBST(SHLINK)
|
||||
|
||||
HOST_64BIT_LONG=0
|
||||
if test "x${HOST_64BIT_TYPE}" = "xlong"; then
|
||||
HOST_64BIT_LONG=1
|
||||
fi
|
||||
AC_SUBST(HOST_64BIT_LONG)
|
||||
|
||||
BFD_CC_FOR_BUILD
|
||||
|
||||
AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h)
|
||||
AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h)
|
||||
AC_HEADER_TIME
|
||||
AC_CHECK_FUNCS(fcntl getpagesize)
|
||||
|
||||
BFD_BINARY_FOPEN
|
||||
|
||||
BFD_NEED_DECLARATION(malloc)
|
||||
BFD_NEED_DECLARATION(free)
|
||||
|
||||
# If we are configured native, pick a core file support file.
|
||||
COREFILE=
|
||||
COREFLAG=
|
||||
if test "${target}" = "${host}"; then
|
||||
case "${host}" in
|
||||
alpha*-*-linux*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/alphalinux.h")
|
||||
;;
|
||||
alpha*-*-*) COREFILE=osf-core.o ;;
|
||||
arm-*-riscix) COREFILE=trad-core.o ;;
|
||||
hppa*-*-hpux*) COREFILE=hpux-core.o ;;
|
||||
hppa*-*-hiux*) COREFILE=hpux-core.o ;;
|
||||
hppa*-*-bsd*) COREFILE="hpux-core.o hppabsd-core.o"
|
||||
COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
|
||||
changequote(,)dnl
|
||||
i[345]86-sequent-bsd*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.o;
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/symmetry.h")
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[345]86-sequent-sysv4*) ;;
|
||||
i[345]86-sequent-sysv*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/symmetry.h")
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[345]86-*-bsd* | i[345]86-*-freebsd*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i386bsd.h")
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[345]86-*-netbsd*)
|
||||
changequote([,])dnl
|
||||
COREFILE=netbsd-core.o
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[345]86-esix-sysv3*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/esix.h")
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[345]86-*-sco* | i[345]86-*-isc*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i386sco.h")
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[345]86-*-mach3*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i386mach3.h")
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[345]86-*-linux*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i386linux.h")
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[345]86-*-isc*) COREFILE=trad-core.o ;;
|
||||
i[345]86-*-aix*) COREFILE=aix386-core.o ;;
|
||||
changequote([,])dnl
|
||||
i860-*-mach3* | i860-*-osf1*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i860mach3.h")
|
||||
;;
|
||||
mips-dec-bsd*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/mipsbsd.h")
|
||||
;;
|
||||
mips-dec-mach3*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/mipsmach3.h")
|
||||
;;
|
||||
mips-*-netbsd*)
|
||||
COREFILE=netbsd-core.o
|
||||
;;
|
||||
mips-dec-*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/decstation.h")
|
||||
;;
|
||||
mips-sgi-irix4*) COREFILE=irix-core.o ;;
|
||||
mips-sgi-irix5*) COREFILE=irix-core.o ;;
|
||||
mips-*-mach3*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/mipsmach3.h")
|
||||
;;
|
||||
mips-*-sysv4*) ;;
|
||||
mips-*-sysv* | mips-*-riscos*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/riscos.h")
|
||||
;;
|
||||
mips-sony-bsd*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/news-mips.h")
|
||||
;;
|
||||
m68*-bull*-sysv*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/dpx2.h")
|
||||
;;
|
||||
m68*-hp-hpux*) COREFILE=hpux-core.o ;;
|
||||
m68*-hp-bsd*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/hp300bsd.h")
|
||||
;;
|
||||
m68*-*-linux*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/m68klinux.h")
|
||||
;;
|
||||
m68*-motorola-sysv*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER, "hosts/delta68.h")
|
||||
;;
|
||||
m68*-sony-*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/news.h")
|
||||
;;
|
||||
m68*-*-netbsd*)
|
||||
COREFILE=netbsd-core.o
|
||||
;;
|
||||
m68*-apple-aux*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/m68kaux.h")
|
||||
;;
|
||||
m88*-*-sysv4*) ;;
|
||||
m88*-motorola-sysv*) COREFILE=ptrace-core.o ;;
|
||||
m88*-*-mach3*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/m88kmach3.h")
|
||||
;;
|
||||
ns32k-pc532-mach)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/pc532mach.h")
|
||||
;;
|
||||
ns32k-*-netbsd*)
|
||||
COREFILE=netbsd-core.o
|
||||
;;
|
||||
rs6000-*-lynx*) COREFILE=lynx-core.o ;;
|
||||
rs6000-*-aix4*) COREFILE=rs6000-core.o ;;
|
||||
rs6000-*-*) COREFILE=rs6000-core.o ;;
|
||||
powerpc-*-aix4*) COREFILE=rs6000-core.o ;;
|
||||
powerpc-*-aix*) COREFILE=rs6000-core.o ;;
|
||||
sparc-*-netbsd*)
|
||||
COREFILE=netbsd-core.o
|
||||
;;
|
||||
tahoe-*-*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/tahoe.h")
|
||||
;;
|
||||
vax-*-ultrix2*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/vaxult2.h")
|
||||
;;
|
||||
vax-*-ultrix*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/vaxult2.h")
|
||||
;;
|
||||
vax-*-*)
|
||||
COREFILE=trad-core.o
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/vaxbsd.h")
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$COREFILE" in
|
||||
aix386-core.o) COREFLAG=-DAIX386_CORE ;;
|
||||
hppabsd-core.o) COREFLAG=-DHPPABSD_CORE ;;
|
||||
hpux-core.o) COREFLAG=-DHPUX_CORE ;;
|
||||
irix-core.o) COREFLAG=-DIRIX_CORE ;;
|
||||
lynx-core.o) COREFLAG=-DLYNX_CORE ;;
|
||||
osf-core.o) COREFLAG=-DOSF_CORE ;;
|
||||
ptrace-core.o) COREFLAG=-DPTRACE_CORE ;;
|
||||
rs6000-core.o) COREFLAG="$COREFLAG -DAIX_CORE" ;;
|
||||
trad-core.o) COREFLAG="$COREFLAG -DTRAD_CORE" ;;
|
||||
esac
|
||||
|
||||
# The ELF code uses the native <sys/procfs.h> to handle core files.
|
||||
# Define HAVE_SYS_PROCFS_H if the file exists and defines
|
||||
# prstatus_t.
|
||||
AC_MSG_CHECKING([for sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_header_sys_procfs_h,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[prstatus_t t;],
|
||||
bfd_cv_header_sys_procfs_h=yes, bfd_cv_header_sys_procfs_h=no)])
|
||||
AC_MSG_RESULT($bfd_cv_header_sys_procfs_h)
|
||||
if test $bfd_cv_header_sys_procfs_h = yes; then
|
||||
AC_DEFINE(HAVE_SYS_PROCFS_H)
|
||||
fi
|
||||
|
||||
fi
|
||||
AC_SUBST(COREFILE)
|
||||
AC_SUBST(COREFLAG)
|
||||
|
||||
# target stuff:
|
||||
|
||||
# Canonicalize the secondary target names.
|
||||
if test -n "$enable_targets" ; then
|
||||
for targ in `echo $enable_targets | sed 's/,/ /g'`
|
||||
do
|
||||
result=`$ac_config_sub $targ 2>/dev/null`
|
||||
if test -n "$result" ; then
|
||||
canon_targets="$canon_targets $result"
|
||||
else
|
||||
# Allow targets that config.sub doesn't recognize, like "all".
|
||||
canon_targets="$canon_targets $targ"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
all_targets=false
|
||||
defvec=
|
||||
selvecs=
|
||||
selarchs=
|
||||
TDEFINES=
|
||||
for targ in $target $canon_targets
|
||||
do
|
||||
if test "x$targ" = "xall"; then
|
||||
all_targets=true
|
||||
else
|
||||
. $srcdir/config.bfd
|
||||
if test "x$targ" = "x$target"; then
|
||||
defvec=$targ_defvec
|
||||
fi
|
||||
selvecs="$selvecs $targ_defvec $targ_selvecs"
|
||||
selarchs="$selarchs $targ_archs"
|
||||
TDEFINES="$TDEFINES $targ_cflags"
|
||||
fi
|
||||
done
|
||||
AC_SUBST(TDEFINES)
|
||||
|
||||
# This processing still needs to be done if we're to decide properly whether
|
||||
# 64-bit support needs to be compiled in. Currently, it will be included if
|
||||
# the default or any other explicitly requested target requires it; it
|
||||
# will not be included on a 32-bit host if no 64-bit target is requested, and
|
||||
# no "--with-64-bit-bfd" option is given, even if "--with-targets=all" is
|
||||
# used.
|
||||
|
||||
# uniq the default and selected vectors in all the configured targets.
|
||||
f=""
|
||||
for i in $selvecs ; do
|
||||
case " $f " in
|
||||
*" $i "*) ;;
|
||||
*) f="$f $i" ;;
|
||||
esac
|
||||
done
|
||||
selvecs="$f"
|
||||
|
||||
# uniq the architectures in all the configured targets.
|
||||
f=""
|
||||
for i in $selarchs ; do
|
||||
case " $f " in
|
||||
*" $i "*) ;;
|
||||
*) f="$f $i" ;;
|
||||
esac
|
||||
done
|
||||
selarchs="$f"
|
||||
|
||||
# Target backend .o files.
|
||||
tb=
|
||||
|
||||
elf="elf.o elflink.o"
|
||||
|
||||
for vec in $selvecs
|
||||
do
|
||||
case "$vec" in
|
||||
# This list is alphabetized to make it easy to compare
|
||||
# with the two vector lists in targets.c.
|
||||
a29kcoff_big_vec) tb="$tb coff-a29k.o cofflink.o" ;;
|
||||
a_out_adobe_vec) tb="$tb aout-adobe.o aout32.o" ;;
|
||||
armcoff_little_vec) tb="$tb coff-arm.o cofflink.o " ;;
|
||||
armcoff_big_vec) tb="$tb coff-arm.o cofflink.o " ;;
|
||||
armpe_little_vec) tb="$tb pe-arm.o cofflink.o " ;;
|
||||
armpe_big_vec) tb="$tb pe-arm.o cofflink.o " ;;
|
||||
armpei_little_vec) tb="$tb pei-arm.o cofflink.o " ;;
|
||||
armpei_big_vec) tb="$tb pei-arm.o cofflink.o " ;;
|
||||
aout0_big_vec) tb="$tb aout0.o aout32.o" ;;
|
||||
aout_arm_big_vec) tb="$tb aout-arm.o aout32.o" ;;
|
||||
aout_arm_little_vec) tb="$tb aout-arm.o aout32.o" ;;
|
||||
aout_mips_big_vec) tb="$tb mipsbsd.o aout32.o" ;;
|
||||
aout_mips_little_vec) tb="$tb mipsbsd.o aout32.o" ;;
|
||||
apollocoff_vec) tb="$tb coff-apollo.o" ;;
|
||||
b_out_vec_big_host) tb="$tb bout.o aout32.o" ;;
|
||||
b_out_vec_little_host) tb="$tb bout.o aout32.o" ;;
|
||||
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.o elf32.o $elf" ;;
|
||||
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;;
|
||||
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o $elf" ;;
|
||||
bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o $elf" ;;
|
||||
bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o $elf" ;;
|
||||
bfd_elf32_little_generic_vec) tb="$tb elf32-gen.o elf32.o $elf" ;;
|
||||
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;;
|
||||
bfd_elf32_m68k_vec) tb="$tb elf32-m68k.o elf32.o $elf" ;;
|
||||
bfd_elf32_m88k_vec) tb="$tb elf32-m88k.o elf32.o $elf" ;;
|
||||
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;;
|
||||
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;;
|
||||
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.o elf32.o $elf" ;;
|
||||
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.o elf64.o $elf"
|
||||
target64=true ;;
|
||||
bfd_elf64_little_generic_vec) tb="$tb elf64-gen.o elf64.o $elf"
|
||||
target64=true ;;
|
||||
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.o elf64.o $elf"
|
||||
target64=true ;;
|
||||
cisco_core_vec) tb="$tb cisco-core.o" ;;
|
||||
demo_64_vec) tb="$tb demo64.o aout64.o"
|
||||
target64=true ;;
|
||||
ecoff_big_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;;
|
||||
ecoff_little_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;;
|
||||
ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o"
|
||||
target64=true ;;
|
||||
h8300coff_vec) tb="$tb coff-h8300.o reloc16.o" ;;
|
||||
h8500coff_vec) tb="$tb coff-h8500.o reloc16.o" ;;
|
||||
host_aout_vec) tb="$tb host-aout.o aout32.o" ;;
|
||||
hp300bsd_vec) tb="$tb hp300bsd.o aout32.o" ;;
|
||||
hp300hpux_vec) tb="$tb hp300hpux.o aout32.o" ;;
|
||||
i386aout_vec) tb="$tb i386aout.o aout32.o" ;;
|
||||
i386bsd_vec) tb="$tb i386bsd.o aout32.o" ;;
|
||||
i386coff_vec) tb="$tb coff-i386.o cofflink.o" ;;
|
||||
i386dynix_vec) tb="$tb i386dynix.o aout32.o" ;;
|
||||
i386freebsd_vec) tb="$tb i386freebsd.o aout32.o" ;;
|
||||
i386msdos_vec) tb="$tb i386msdos.o" ;;
|
||||
i386pe_vec) tb="$tb pe-i386.o cofflink.o " ;;
|
||||
i386pei_vec) tb="$tb pei-i386.o cofflink.o" ;;
|
||||
i386linux_vec) tb="$tb i386linux.o aout32.o" ;;
|
||||
i386lynx_aout_vec) tb="$tb i386lynx.o lynx-core.o aout32.o" ;;
|
||||
i386lynx_coff_vec) tb="$tb cf-i386lynx.o cofflink.o lynx-core.o" ;;
|
||||
i386mach3_vec) tb="$tb i386mach3.o aout32.o" ;;
|
||||
i386netbsd_vec) tb="$tb i386netbsd.o aout32.o" ;;
|
||||
i386os9k_vec) tb="$tb i386os9k.o aout32.o" ;;
|
||||
i860coff_vec) tb="$tb coff-i860.o cofflink.o" ;;
|
||||
icoff_big_vec) tb="$tb coff-i960.o cofflink.o" ;;
|
||||
icoff_little_vec) tb="$tb coff-i960.o cofflink.o" ;;
|
||||
ieee_vec) tb="$tb ieee.o" ;;
|
||||
m68kcoff_vec) tb="$tb coff-m68k.o cofflink.o" ;;
|
||||
m68kcoffun_vec) tb="$tb coff-u68k.o coff-m68k.o cofflink.o" ;;
|
||||
m68klinux_vec) tb="$tb m68klinux.o aout32.o" ;;
|
||||
m68klynx_aout_vec) tb="$tb m68klynx.o lynx-core.o aout32.o" ;;
|
||||
m68klynx_coff_vec) tb="$tb cf-m68klynx.o coff-m68k.o cofflink.o lynx-core.o" ;;
|
||||
m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o" ;;
|
||||
m68k4knetbsd_vec) tb="$tb m68k4knetbsd.o aout32.o" ;;
|
||||
m68kaux_coff_vec) tb="$tb coff-aux.o coff-m68k.o cofflink.o" ;;
|
||||
m88kbcs_vec) tb="$tb coff-m88k.o" ;;
|
||||
newsos3_vec) tb="$tb newsos3.o aout32.o" ;;
|
||||
nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;;
|
||||
nlm32_sparc_vec) tb="$tb nlm32-sparc.o nlm32.o nlm.o" ;;
|
||||
nlm32_alpha_vec) tb="$tb nlm32-alpha.o nlm32.o nlm.o"
|
||||
target64=true ;;
|
||||
riscix_vec) tb="$tb aout32.o riscix.o" ;;
|
||||
nlm32_powerpc_vec) tb="$tb nlm32-ppc.o nlm32.o nlm.o" ;;
|
||||
pc532netbsd_vec) tb="$tb ns32knetbsd.o aout-ns32k.o" ;;
|
||||
pc532machaout_vec) tb="$tb pc532-mach.o aout-ns32k.o" ;;
|
||||
pmac_xcoff_vec) tb="$tb coff-pmac.o xcofflink.o" ;;
|
||||
rs6000coff_vec) tb="$tb coff-rs6000.o xcofflink.o" ;;
|
||||
bfd_powerpc_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;;
|
||||
bfd_powerpcle_pe_vec) tb="$tb pe-ppc.o cofflink.o" ;;
|
||||
bfd_powerpc_pei_vec) tb="$tb pei-ppc.o cofflink.o" ;;
|
||||
bfd_powerpcle_pei_vec) tb="$tb pei-ppc.o cofflink.o" ;;
|
||||
shcoff_vec) tb="$tb coff-sh.o cofflink.o" ;;
|
||||
shlcoff_vec) tb="$tb coff-sh.o cofflink.o" ;;
|
||||
som_vec) tb="$tb som.o" ;;
|
||||
sparclynx_aout_vec) tb="$tb sparclynx.o lynx-core.o aout32.o" ;;
|
||||
sparclynx_coff_vec) tb="$tb cf-sparclynx.o lynx-core.o" ;;
|
||||
sparcnetbsd_vec) tb="$tb sparcnetbsd.o aout32.o" ;;
|
||||
sparccoff_vec) tb="$tb coff-sparc.o" ;;
|
||||
srec_vec) tb="$tb srec.o" ;;
|
||||
sunos_big_vec) tb="$tb sunos.o aout32.o" ;;
|
||||
symbolsrec_vec) tb="$tb srec.o" ;;
|
||||
tekhex_vec) tb="$tb tekhex.o" ;;
|
||||
we32kcoff_vec) tb="$tb coff-we32k.o" ;;
|
||||
z8kcoff_vec) tb="$tb coff-z8k.o reloc16.o" ;;
|
||||
w65_vec) tb="$tb coff-w65.o reloc16.o" ;;
|
||||
versados_vec) tb="$tb versados.o" ;;
|
||||
|
||||
"") ;;
|
||||
*) AC_MSG_ERROR(*** unknown target vector $vec) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Target architecture .o files.
|
||||
ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g`
|
||||
|
||||
# Weed out duplicate .o files.
|
||||
f=""
|
||||
for i in $tb ; do
|
||||
case " $f " in
|
||||
*" $i "*) ;;
|
||||
*) f="$f $i" ;;
|
||||
esac
|
||||
done
|
||||
tb="$f"
|
||||
|
||||
f=""
|
||||
for i in $ta ; do
|
||||
case " $f " in
|
||||
*" $i "*) ;;
|
||||
*) f="$f $i" ;;
|
||||
esac
|
||||
done
|
||||
ta="$f"
|
||||
|
||||
bfd_backends="$tb"
|
||||
bfd_machines="$ta"
|
||||
|
||||
if test x${all_targets} = xtrue ; then
|
||||
bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)'
|
||||
bfd_machines="${bfd_machines}"' $(ALL_MACHINES)'
|
||||
selvecs=
|
||||
selarchs=
|
||||
else # all_targets is true
|
||||
# Only set these if they will be nonempty, for the clever echo.
|
||||
test -n "$selvecs" &&
|
||||
selvecs=`echo $selvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
|
||||
test -n "$selarchs" &&
|
||||
selarchs=`echo $selarchs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
|
||||
fi # all_targets is true
|
||||
|
||||
case ${host64}-${target64}-${want64} in
|
||||
*true*)
|
||||
wordsize=64
|
||||
all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
|
||||
;;
|
||||
false-false-false)
|
||||
wordsize=32
|
||||
all_backends='$(BFD32_BACKENDS)'
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(wordsize)
|
||||
AC_SUBST(all_backends)
|
||||
AC_SUBST(bfd_backends)
|
||||
AC_SUBST(bfd_machines)
|
||||
|
||||
tdefaults=""
|
||||
test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}"
|
||||
test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'"
|
||||
test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'"
|
||||
AC_SUBST(tdefaults)
|
||||
|
||||
dnl AC_CHECK_HEADERS(sys/mman.h)
|
||||
AC_FUNC_MMAP
|
||||
AC_CHECK_FUNCS(madvise mprotect)
|
||||
case ${want_mmap}+${ac_cv_func_mmap} in
|
||||
true+yes ) AC_DEFINE(USE_MMAP) ;;
|
||||
esac
|
||||
|
||||
rm -f doc/config.status
|
||||
AC_OUTPUT(Makefile doc/Makefile,
|
||||
[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])
|
@ -1,106 +0,0 @@
|
||||
/* Core file generic interface routines for BFD.
|
||||
Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
SECTION
|
||||
Core files
|
||||
|
||||
DESCRIPTION
|
||||
These are functions pertaining to core files.
|
||||
*/
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_core_file_failing_command
|
||||
|
||||
SYNOPSIS
|
||||
CONST char *bfd_core_file_failing_command(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return a read-only string explaining which program was running
|
||||
when it failed and produced the core file @var{abfd}.
|
||||
|
||||
*/
|
||||
|
||||
CONST char *
|
||||
bfd_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (abfd->format != bfd_core) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return NULL;
|
||||
}
|
||||
return BFD_SEND (abfd, _core_file_failing_command, (abfd));
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_core_file_failing_signal
|
||||
|
||||
SYNOPSIS
|
||||
int bfd_core_file_failing_signal(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Returns the signal number which caused the core dump which
|
||||
generated the file the BFD @var{abfd} is attached to.
|
||||
*/
|
||||
|
||||
int
|
||||
bfd_core_file_failing_signal (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (abfd->format != bfd_core) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return 0;
|
||||
}
|
||||
return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
core_file_matches_executable_p
|
||||
|
||||
SYNOPSIS
|
||||
boolean core_file_matches_executable_p
|
||||
(bfd *core_bfd, bfd *exec_bfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return <<true>> if the core file attached to @var{core_bfd}
|
||||
was generated by a run of the executable file attached to
|
||||
@var{exec_bfd}, <<false>> otherwise.
|
||||
*/
|
||||
boolean
|
||||
core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd, *exec_bfd;
|
||||
{
|
||||
if ((core_bfd->format != bfd_core) || (exec_bfd->format != bfd_object)) {
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return false;
|
||||
}
|
||||
|
||||
return BFD_SEND (core_bfd, _core_file_matches_executable_p,
|
||||
(core_bfd, exec_bfd));
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* BFD support for the Intel 386 architecture.
|
||||
Copyright 1992 Free Software Foundation, Inc.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
const bfd_arch_info_type bfd_i386_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_i386,
|
||||
0, /* only 1 machine */
|
||||
"i386",
|
||||
"i386",
|
||||
3,
|
||||
true, /* the one and only */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
};
|
@ -1,24 +0,0 @@
|
||||
:loop
|
||||
/\\$/N
|
||||
/\\$/b loop
|
||||
|
||||
s! @BFD_H@!!g
|
||||
s!@INCDIR@!$(INCDIR)!g
|
||||
s!@SRCDIR@/!!g
|
||||
s!hosts/[^ ]*\.h ! !g
|
||||
s/ sysdep.h//g
|
||||
s/ libbfd.h//g
|
||||
s/ config.h//g
|
||||
s! \$(INCDIR)/fopen-[^ ]*\.h!!g
|
||||
s! \$(INCDIR)/ansidecl\.h!!g
|
||||
s! \$(INCDIR)/obstack\.h!!g
|
||||
|
||||
s/\\\n */ /g
|
||||
|
||||
s/ *$//
|
||||
s/ */ /g
|
||||
s/ *:/:/g
|
||||
/:$/d
|
||||
|
||||
s/\(.\{50\}[^ ]*\) /\1 \\\
|
||||
/g
|
@ -1,268 +0,0 @@
|
||||
Tue Jan 30 14:10:46 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
From Ronald F. Guilmette <rfg@monkeys.com>:
|
||||
* Makefile.in (libbfd.h): Depend upon proto.str.
|
||||
(libcoff.h, bfd.h): Likewise.
|
||||
|
||||
Fri Nov 3 14:46:48 1995 Fred Fish <fnf@cygnus.com>
|
||||
|
||||
* Makefile.in (SRCDOC, SRCPROT, core.texi, bfd.h): Use corefile.c,
|
||||
renamed from core.c.
|
||||
|
||||
Wed Nov 1 14:28:23 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <manfred@lts.sel.alcatel.de>
|
||||
|
||||
* chew.c: Include <ctype.h>.
|
||||
|
||||
Fri Oct 6 16:23:34 1995 Ken Raeburn <raeburn@cygnus.com>
|
||||
|
||||
Mon Sep 25 22:49:32 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||
|
||||
* Makefile.in (Makefile): Only remake this Makefile.
|
||||
|
||||
Wed Oct 4 15:51:05 1995 Ken Raeburn <raeburn@cygnus.com>
|
||||
|
||||
* chew.c: Include <stdio.h>.
|
||||
|
||||
Tue Sep 12 18:14:50 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* Makefile.in (maintainer-clean): New target.
|
||||
|
||||
Thu Aug 31 12:18:43 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* Makefile.in (bfd.h): Add additional #endif at end of bfd.h if
|
||||
__cplusplus is defined.
|
||||
|
||||
Tue Nov 29 16:13:34 1994 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* chew.c (write_buffer): New argument `f', all callers changed.
|
||||
(stdout, stderr, print, drop, idrop): New forth words.
|
||||
* proto.str (COMMENT): New command.
|
||||
* doc.str (COMMENT): Likewise.
|
||||
|
||||
Mon Sep 12 11:44:17 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||
|
||||
* Makefile.in (DOCFILES): Remove ctor.texi.
|
||||
(IPROTOS): Remove ctor.ip.
|
||||
(SRCIPROT): Remove $(srcdir)/../ctor.c.
|
||||
(ctor.texi): Remove target.
|
||||
(libbfd.h): Remove dependency on $(srcdir)/../ctor.c. Remove
|
||||
$(MKDOC) run on $(srcdir)/../ctor.c.
|
||||
* bfd.texinfo (Constructors): Remove section.
|
||||
|
||||
Fri Sep 2 13:33:44 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
|
||||
|
||||
* chew.c: Include assert.h. Added prototypes for most functions.
|
||||
Changed most uses of int to long. Do bounds checking on the
|
||||
stacks. Added comment at the beginning documenting most of the
|
||||
intrinsics. Lots of whitespace changes. Re-ordered some
|
||||
functions.
|
||||
(die, check_range, icheck_range): New functions.
|
||||
(strip_trailing_newlines, print_stack_level): New functions.
|
||||
(translatecomments): Don't insert tab before "/*".
|
||||
(iscommand): Minimum command length is now 4.
|
||||
(nextword): Handle some \-sequences.
|
||||
(push_addr): Deleted.
|
||||
(main): Add new intrinsics strip_trailing_newlines and
|
||||
print_stack_level. Complain at end if stack contains more than
|
||||
one element, or less.
|
||||
(remchar): Make sure the string is not empty before chopping off a
|
||||
character.
|
||||
|
||||
* doc.str, proto.str: Handle new commands SENUM, ENUM, ENUMX,
|
||||
ENUMEQ, ENUMEQX, ENUMDOC.
|
||||
|
||||
Wed Jan 12 18:37:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfd.texinfo: Added Linker Functions node.
|
||||
* doc/Makefile.in (DOCFILES): Added linker.texi.
|
||||
(SRCDOC): Added linker.c.
|
||||
(linker.texi): New target.
|
||||
|
||||
Tue Jan 4 10:52:56 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* chew.c: Don't rely on a correct declaration of exit.
|
||||
(chew_exit): New function which just calls exit.
|
||||
(main): Use it.
|
||||
|
||||
Mon Jan 3 11:40:40 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfd.texinfo: Added Hash Tables node.
|
||||
* Makefile.in (DOCFILES): Added hash.texi.
|
||||
(SRCDOC): Added hash.c.
|
||||
(hash.texi): New target.
|
||||
|
||||
Thu Dec 30 16:57:04 1993 Ken Raeburn (raeburn@cujo.cygnus.com)
|
||||
|
||||
* Makefile.in: Delete all references to seclet.c, since it's just
|
||||
been deleted. Don't mention hash.c, linker.c, or genlink.h yet,
|
||||
since they don't contain documentation yet (hint, hint!).
|
||||
|
||||
Fri Nov 5 10:58:53 1993 David J. Mackenzie (djm@thepub.cygnus.com)
|
||||
|
||||
* bfd.texinfo: Small cleanups.
|
||||
|
||||
Fri Nov 19 03:46:11 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
|
||||
|
||||
* Makefile.in (archures.texi): Depends on $(MKDOC).
|
||||
|
||||
Tue Aug 10 14:22:39 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
|
||||
|
||||
* bfd.texinfo (BFD back end): Don't include elfcode.texi, since
|
||||
it's empty now and that triggers a makeinfo bug.
|
||||
|
||||
Mon Aug 9 16:27:30 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
|
||||
|
||||
* bfd.texinfo (BFD back end): New section on ELF, includes
|
||||
elf.texi and elfcode.texi.
|
||||
* Makefile.in (DOCFILES): Include elf.texi, elfcode.texi.
|
||||
(SRCDOC): Include elfcode.h, elf.c.
|
||||
(elf.texi, elfcode.texi): New intermediate targets.
|
||||
|
||||
Thu Jun 24 13:48:13 1993 David J. Mackenzie (djm@thepub.cygnus.com)
|
||||
|
||||
* Makefile.in (.c.o, chew.o): Put CFLAGS last.
|
||||
* bfdsumm.texi: New file, broken out of bfd.texinfo, to share
|
||||
with ld.texinfo.
|
||||
|
||||
Mon Jun 14 12:07:07 1993 david d `zoo' zuhn (zoo at rtl.cygnus.com)
|
||||
|
||||
* Makefile.in (install-info): remove parentdir cruft,
|
||||
|
||||
Wed Jun 9 16:00:32 1993 Jim Kingdon (kingdon@cygnus.com)
|
||||
|
||||
* Makefile.in (mostlyclean): Remove chew.o.
|
||||
|
||||
Tue May 25 14:46:58 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
|
||||
|
||||
* Makefile.in (libbfd.h): Use elfcode.h, not elf32.c.
|
||||
|
||||
Mon May 24 15:50:07 1993 Ken Raeburn (raeburn@cygnus.com)
|
||||
|
||||
* chew.c (compile): Add a couple of missing casts.
|
||||
|
||||
Wed May 12 14:45:14 1993 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* Makefile.in (CC_FOR_BUILD): New variable, define to be $(CC).
|
||||
(chew.o, $(MKDOC)): Build using CC_FOR_BUILD rather than CC, since
|
||||
it must run on the build machine.
|
||||
|
||||
Tue Apr 6 22:38:10 1993 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* Makefile.in (chew): Don't compile from .c to executable in a
|
||||
single step; it puts a temporary .o filename into the executable,
|
||||
which makes multi-stage comparisons fail. Compile chew.c to
|
||||
chew.o, and link that, which makes identical executables every time.
|
||||
|
||||
Wed Mar 24 17:26:29 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com)
|
||||
|
||||
* Makefile.in: fix typo (bfd.texinfo not bfd.texino)
|
||||
|
||||
Fri Mar 19 01:13:00 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
|
||||
|
||||
* bfd.texinfo: Since BFD version number has been bumped, do same
|
||||
to "version number" on title page, and elsewhere. Should be
|
||||
fixed to extract real version number.
|
||||
|
||||
Tue Mar 16 12:15:13 1993 Per Bothner (bothner@rtl.cygnus.com)
|
||||
|
||||
* Makefile.in: Add *clean rules.
|
||||
|
||||
Mon Jan 11 18:43:56 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* Makefile.in (libbfd.h): Removed duplicate init.c and libbfd.c.
|
||||
Added seclet.c.
|
||||
(bfd.h): Added dependency on bfd.c and seclet.c. Added seclet.c
|
||||
to build.
|
||||
|
||||
Thu Dec 17 19:35:43 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
|
||||
|
||||
* Makefile.in: added dvi target, define and use $(TEXI2DVI)
|
||||
|
||||
Thu Dec 3 17:42:48 1992 Ken Raeburn (raeburn@cambridge.cygnus.com)
|
||||
|
||||
* Makefile.in (TEXIDIR): New variable.
|
||||
(bfd.dvi): Look for bfd.texinfo in $(srcdir). Generate index.
|
||||
|
||||
* bfd.texinfo: Minor doc fixes.
|
||||
|
||||
Thu Nov 5 03:13:55 1992 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
Cleanup: Replace all uses of EXFUN in the BFD sources, with PARAMS.
|
||||
|
||||
* doc/chew.c (exfunstuff): Eliminate.
|
||||
(paramstuff): Replace exfunstuff with function to generate PARAMS.
|
||||
* doc/proto.str: Use paramstuff rather than exfunstuff.
|
||||
|
||||
Mon Aug 17 12:40:32 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* chew.c: various patches provided by Howard Chu.
|
||||
|
||||
Fri Jun 19 18:59:54 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* Makefile.in (libbfd.h): Add elf.c as a source of prototypes.
|
||||
|
||||
Mon May 11 18:55:59 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* chew.c: exit() should be declared by config files, not by
|
||||
portable source code. Its type could be int or void function.
|
||||
|
||||
Mon May 4 13:45:57 1992 K. Richard Pixley (rich@rtl.cygnus.com)
|
||||
|
||||
* Makefile.in: another CFLAGS correction.
|
||||
|
||||
Tue Apr 28 10:21:32 1992 K. Richard Pixley (rich@rtl.cygnus.com)
|
||||
|
||||
* Makefile.in: Do the CFLAGS thing.
|
||||
|
||||
Fri Apr 10 22:34:52 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* Makefile.in (MINUS_G): Add macro and default to -g.
|
||||
|
||||
Fri Mar 6 18:53:18 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* chew.c: now has -w switch turn on warnings
|
||||
|
||||
Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com)
|
||||
|
||||
* Makefile.in, configure.in: removed traces of namesubdir,
|
||||
-subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced
|
||||
copyrights to '92, changed some from Cygnus to FSF.
|
||||
|
||||
Tue Dec 10 22:11:05 1991 K. Richard Pixley (rich at rtl.cygnus.com)
|
||||
|
||||
* Makefile.in: build chew into the current directory. Complete
|
||||
the MKDOC macro transition.
|
||||
|
||||
Tue Dec 10 08:26:28 1991 Steve Chamberlain (sac at rtl.cygnus.com)
|
||||
|
||||
* chew.c: don't core dump when can't open file
|
||||
* Makefile.in: get proto.str from the right place when built in
|
||||
odd directories
|
||||
|
||||
Tue Dec 10 04:07:25 1991 K. Richard Pixley (rich at rtl.cygnus.com)
|
||||
|
||||
* Makefile.in: infodir belongs in datadir.
|
||||
|
||||
Sat Dec 7 17:01:23 1991 Steve Chamberlain (sac at rtl.cygnus.com)
|
||||
|
||||
* chew.c: Much modified
|
||||
* proto.str, doc.str: New files for extracting to product
|
||||
prototypes and documents respectively.
|
||||
|
||||
|
||||
Fri Dec 6 22:57:12 1991 K. Richard Pixley (rich at rtl.cygnus.com)
|
||||
|
||||
* Makefile.in: added standards.text support, host/site/target
|
||||
inclusion hooks, install using INSTALL_DATA rather than cp,
|
||||
don't echo on install.
|
||||
|
||||
Thu Dec 5 22:46:17 1991 K. Richard Pixley (rich at rtl.cygnus.com)
|
||||
|
||||
* Makefile.in: idestdir and ddestdir go away. Added copyrights
|
||||
and shift gpl to v2. Added ChangeLog if it didn't exist. docdir
|
||||
and mandir now keyed off datadir by default.
|
||||
|
||||
|
||||
Local Variables:
|
||||
version-control: never
|
||||
End:
|
@ -1,311 +0,0 @@
|
||||
#
|
||||
# Makefile
|
||||
# Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation
|
||||
#
|
||||
# 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
|
||||
# the Free Software Foundation; either version 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#
|
||||
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = $(exec_prefix)/bin
|
||||
libdir = $(exec_prefix)/lib
|
||||
|
||||
datadir = $(prefix)/lib
|
||||
mandir = $(prefix)/man
|
||||
man1dir = $(mandir)/man1
|
||||
man2dir = $(mandir)/man2
|
||||
man3dir = $(mandir)/man3
|
||||
man4dir = $(mandir)/man4
|
||||
man5dir = $(mandir)/man5
|
||||
man6dir = $(mandir)/man6
|
||||
man7dir = $(mandir)/man7
|
||||
man8dir = $(mandir)/man8
|
||||
man9dir = $(mandir)/man9
|
||||
infodir = $(prefix)/info
|
||||
includedir = $(prefix)/include
|
||||
docdir = $(datadir)/doc
|
||||
|
||||
MKDOC=./chew
|
||||
SHELL = /bin/sh
|
||||
|
||||
INSTALL = `cd $(srcdir)/../..;pwd`/install.sh -c
|
||||
INSTALL_PROGRAM = $(INSTALL)
|
||||
INSTALL_DATA = $(INSTALL)
|
||||
|
||||
MAKEINFO = makeinfo
|
||||
TEXI2DVI = texi2dvi
|
||||
CFLAGS = -g
|
||||
|
||||
CC_FOR_BUILD = $(CC)
|
||||
|
||||
#### Host, target, and site specific Makefile fragments come in here.
|
||||
###
|
||||
|
||||
.c.o:
|
||||
$(CC) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include $(H_CFLAGS) $(CFLAGS) $<
|
||||
|
||||
DOCFILES = aoutx.texi archive.texi archures.texi \
|
||||
bfd.texi cache.texi coffcode.texi \
|
||||
core.texi elf.texi elfcode.texi format.texi libbfd.texi \
|
||||
opncls.texi reloc.texi section.texi \
|
||||
syms.texi targets.texi init.texi hash.texi linker.texi
|
||||
|
||||
PROTOS = archive.p archures.p bfd.p \
|
||||
core.p format.p \
|
||||
libbfd.p opncls.p reloc.p \
|
||||
section.p syms.p targets.p \
|
||||
format.p core.p init.p
|
||||
|
||||
IPROTOS = cache.ip libbfd.ip reloc.ip init.ip archures.ip coffcode.ip
|
||||
|
||||
# SRCDOC, SRCPROT, SRCIPROT only used to sidestep Sun Make bug in interaction
|
||||
# between VPATH and suffix rules. If you use GNU Make, perhaps other Makes,
|
||||
# you don't need these three:
|
||||
SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
|
||||
$(srcdir)/../archures.c $(srcdir)/../bfd.c \
|
||||
$(srcdir)/../cache.c $(srcdir)/../coffcode.h \
|
||||
$(srcdir)/../corefile.c $(srcdir)/../elf.c \
|
||||
$(srcdir)/../elfcode.h $(srcdir)/../format.c \
|
||||
$(srcdir)/../libbfd.c $(srcdir)/../opncls.c \
|
||||
$(srcdir)/../reloc.c $(srcdir)/../section.c \
|
||||
$(srcdir)/../syms.c $(srcdir)/../targets.c \
|
||||
$(srcdir)/../hash.c $(srcdir)/../linker.c
|
||||
|
||||
SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \
|
||||
$(srcdir)/../bfd.c $(srcdir)/../coffcode.h $(srcdir)/../corefile.c \
|
||||
$(srcdir)/../format.c $(srcdir)/../libbfd.c \
|
||||
$(srcdir)/../opncls.c $(srcdir)/../reloc.c \
|
||||
$(srcdir)/../section.c $(srcdir)/../syms.c \
|
||||
$(srcdir)/../targets.c $(srcdir)/../init.c
|
||||
|
||||
SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \
|
||||
$(srcdir)/../reloc.c $(srcdir)/../cpu-h8300.c \
|
||||
$(srcdir)/../cpu-i960.c $(srcdir)/../archures.c \
|
||||
$(srcdir)/../init.c
|
||||
|
||||
STAGESTUFF = $(DOCFILES) *.info*
|
||||
|
||||
TEXIDIR = $(srcdir)/../../texinfo/fsf
|
||||
|
||||
all install:
|
||||
|
||||
info: bfd.info
|
||||
|
||||
dvi: bfd.dvi
|
||||
|
||||
install-info: info
|
||||
for i in *.info* ; do \
|
||||
$(INSTALL_DATA) $$i $(infodir)/$$i ; \
|
||||
done
|
||||
|
||||
docs: $(MKDOC) protos bfd.info bfd.dvi bfd.ps
|
||||
|
||||
$(MKDOC): chew.o
|
||||
$(CC_FOR_BUILD) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS)
|
||||
|
||||
chew.o: chew.c
|
||||
$(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
|
||||
|
||||
protos: libbfd.h libcoff.h bfd.h
|
||||
|
||||
|
||||
# We can't replace these rules with an implicit rule, because
|
||||
# makes without VPATH support couldn't find the .h files in `..'.
|
||||
|
||||
aoutx.texi: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.texi
|
||||
|
||||
archive.texi: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.texi
|
||||
|
||||
archures.texi: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.texi
|
||||
|
||||
bfd.texi: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.texi
|
||||
|
||||
cache.texi: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.texi
|
||||
|
||||
coffcode.texi: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.texi
|
||||
|
||||
core.texi: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.texi
|
||||
|
||||
elf.texi: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.texi
|
||||
|
||||
elfcode.texi: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.texi
|
||||
|
||||
format.texi: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.texi
|
||||
|
||||
libbfd.texi: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.texi
|
||||
|
||||
opncls.texi: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.texi
|
||||
|
||||
reloc.texi : $(MKDOC) $(srcdir)/../reloc.c
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.texi
|
||||
|
||||
section.texi: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.texi
|
||||
|
||||
syms.texi : $(MKDOC) $(srcdir)/../syms.c
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.texi
|
||||
|
||||
targets.texi: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.texi
|
||||
|
||||
init.texi: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.texi
|
||||
|
||||
hash.texi: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.texi
|
||||
|
||||
linker.texi: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
|
||||
$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.texi
|
||||
|
||||
libbfd.h: $(srcdir)/../libbfd-in.h \
|
||||
$(srcdir)/../init.c \
|
||||
$(srcdir)/../libbfd.c \
|
||||
$(srcdir)/../cache.c \
|
||||
$(srcdir)/../reloc.c \
|
||||
$(srcdir)/../cpu-h8300.c \
|
||||
$(srcdir)/../cpu-i960.c \
|
||||
$(srcdir)/../archures.c \
|
||||
$(srcdir)/../elfcode.h \
|
||||
$(srcdir)/proto.str \
|
||||
$(MKDOC)
|
||||
cat $(srcdir)/../libbfd-in.h >libbfd.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../init.c >>libbfd.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../libbfd.c >>libbfd.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cache.c >>libbfd.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../reloc.c >>libbfd.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cpu-h8300.c >>libbfd.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../cpu-i960.c >>libbfd.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../archures.c >>libbfd.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elf.c >>libbfd.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../elfcode.h >>libbfd.h
|
||||
|
||||
libcoff.h: $(srcdir)/../libcoff-in.h \
|
||||
$(srcdir)/../coffcode.h \
|
||||
$(srcdir)/proto.str \
|
||||
$(MKDOC)
|
||||
cat $(srcdir)/../libcoff-in.h >libcoff.h
|
||||
$(MKDOC) -i -f $(srcdir)/proto.str < $(srcdir)/../coffcode.h >>libcoff.h
|
||||
|
||||
bfd.h: $(srcdir)/../bfd-in.h \
|
||||
$(srcdir)/../init.c \
|
||||
$(srcdir)/../opncls.c \
|
||||
$(srcdir)/../libbfd.c \
|
||||
$(srcdir)/../section.c \
|
||||
$(srcdir)/../archures.c \
|
||||
$(srcdir)/../reloc.c \
|
||||
$(srcdir)/../syms.c \
|
||||
$(srcdir)/../bfd.c \
|
||||
$(srcdir)/../archive.c \
|
||||
$(srcdir)/../corefile.c \
|
||||
$(srcdir)/../targets.c \
|
||||
$(srcdir)/../format.c \
|
||||
$(srcdir)/proto.str \
|
||||
$(MKDOC)
|
||||
cat $(srcdir)/../bfd-in.h >bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../init.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../opncls.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../libbfd.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../section.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archures.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../reloc.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../syms.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../bfd.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../archive.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../corefile.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../targets.c >>bfd.h
|
||||
$(MKDOC) -f $(srcdir)/proto.str<$(srcdir)/../format.c >>bfd.h
|
||||
echo "#ifdef __cplusplus" >>bfd.h
|
||||
echo "}" >>bfd.h
|
||||
echo "#endif" >>bfd.h
|
||||
echo "#endif" >>bfd.h
|
||||
|
||||
|
||||
clean-info: clean
|
||||
|
||||
mostlyclean:
|
||||
rm -rf *.log *.ps *~* *.dvi *# $(MKDOC) *.o
|
||||
|
||||
clean: mostlyclean
|
||||
rm -rf $(STAGESTUFF)
|
||||
rm -f *.p *.ip bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.status
|
||||
|
||||
maintainer-clean realclean: clean
|
||||
rm -f Makefile config.status
|
||||
|
||||
bfd.info: $(DOCFILES) bfdsumm.texi bfd.texinfo
|
||||
$(MAKEINFO) -I$(srcdir) -o bfd.info $(srcdir)/bfd.texinfo
|
||||
|
||||
bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo
|
||||
$(TEXI2DVI) $(srcdir)/bfd.texinfo
|
||||
|
||||
bfd.ps: bfd.dvi
|
||||
dvips bfd -o
|
||||
|
||||
quickdoc: $(DOCFILES) bfdsumm.texi bfd.texinfo
|
||||
TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex bfd.texinfo
|
||||
|
||||
stage1: force
|
||||
- mkdir stage1
|
||||
- mv -f $(STAGESTUFF) stage1
|
||||
|
||||
stage2: force
|
||||
- mkdir stage2
|
||||
- mv -f $(STAGESTUFF) stage2
|
||||
|
||||
stage3: force
|
||||
- mkdir stage3
|
||||
- mv -f $(STAGESTUFF) stage3
|
||||
|
||||
against=stage2
|
||||
|
||||
comparison: force
|
||||
for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i || exit 1 ; done
|
||||
|
||||
de-stage1: force
|
||||
- (cd stage1 ; mv -f $(STAGESTUFF) ..)
|
||||
- rmdir stage1
|
||||
|
||||
de-stage2: force
|
||||
- (cd stage2 ; mv -f $(STAGESTUFF) ..)
|
||||
- rmdir stage2
|
||||
|
||||
de-stage3: force
|
||||
- (cd stage3 ; mv -f $(STAGESTUFF) ..)
|
||||
- rmdir stage3
|
||||
|
||||
force:
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in
|
||||
cd .. && CONFIG_FILES=doc/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
@ -1,348 +0,0 @@
|
||||
\input texinfo.tex
|
||||
@setfilename bfd.info
|
||||
@c $Id: bfd.texinfo,v 1.28 1995/11/10 20:04:12 victoria Exp $
|
||||
@tex
|
||||
% NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE
|
||||
\global\long\def\example{%
|
||||
\begingroup
|
||||
\let\aboveenvbreak=\par
|
||||
\let\afterenvbreak=\par
|
||||
\parskip=0pt
|
||||
\lisp}
|
||||
\global\long\def\Eexample{%
|
||||
\Elisp
|
||||
\endgroup
|
||||
\vskip -\parskip% to cancel out effect of following \par
|
||||
}
|
||||
@end tex
|
||||
@synindex fn cp
|
||||
|
||||
@ifinfo
|
||||
@format
|
||||
START-INFO-DIR-ENTRY
|
||||
* Bfd: (bfd). The Binary File Descriptor library.
|
||||
END-INFO-DIR-ENTRY
|
||||
@end format
|
||||
@end ifinfo
|
||||
|
||||
@ifinfo
|
||||
This file documents the BFD library.
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through Tex and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, subject to the terms
|
||||
of the GNU General Public License, which includes the provision that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions.
|
||||
@end ifinfo
|
||||
@iftex
|
||||
@c@finalout
|
||||
@setchapternewpage on
|
||||
@c@setchapternewpage odd
|
||||
@settitle LIB BFD, the Binary File Descriptor Library
|
||||
@titlepage
|
||||
@title{libbfd}
|
||||
@subtitle{The Binary File Descriptor Library}
|
||||
@sp 1
|
||||
@subtitle First Edition---BFD version < 3.0
|
||||
@subtitle April 1991
|
||||
@author {Steve Chamberlain}
|
||||
@author {Cygnus Support}
|
||||
@page
|
||||
|
||||
@tex
|
||||
\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
|
||||
\xdef\manvers{\$Revision: 1.28 $} % For use in headers, footers too
|
||||
{\parskip=0pt
|
||||
\hfill Cygnus Support\par
|
||||
\hfill sac\@cygnus.com\par
|
||||
\hfill {\it BFD}, \manvers\par
|
||||
\hfill \TeX{}info \texinfoversion\par
|
||||
}
|
||||
\global\parindent=0pt % Steve likes it this way
|
||||
@end tex
|
||||
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1991 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, subject to the terms
|
||||
of the GNU General Public License, which includes the provision that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions.
|
||||
@end titlepage
|
||||
@end iftex
|
||||
|
||||
@node Top, Overview, (dir), (dir)
|
||||
@ifinfo
|
||||
This file documents the binary file descriptor library libbfd.
|
||||
@end ifinfo
|
||||
|
||||
@menu
|
||||
* Overview:: Overview of BFD
|
||||
* BFD front end:: BFD front end
|
||||
* BFD back ends:: BFD back ends
|
||||
* Index:: Index
|
||||
@end menu
|
||||
|
||||
@node Overview, BFD front end, Top, Top
|
||||
@chapter Introduction
|
||||
@cindex BFD
|
||||
@cindex what is it?
|
||||
BFD is a package which allows applications to use the
|
||||
same routines to operate on object files whatever the object file
|
||||
format. A new object file format can be supported simply by
|
||||
creating a new BFD back end and adding it to the library.
|
||||
|
||||
BFD is split into two parts: the front end, and the back ends (one for
|
||||
each object file format).
|
||||
@itemize @bullet
|
||||
@item The front end of BFD provides the interface to the user. It manages
|
||||
memory and various canonical data structures. The front end also
|
||||
decides which back end to use and when to call back end routines.
|
||||
@item The back ends provide BFD its view of the real world. Each back
|
||||
end provides a set of calls which the BFD front end can use to maintain
|
||||
its canonical form. The back ends also may keep around information for
|
||||
their own use, for greater efficiency.
|
||||
@end itemize
|
||||
@menu
|
||||
* History:: History
|
||||
* How It Works:: How It Works
|
||||
* What BFD Version 2 Can Do:: What BFD Version 2 Can Do
|
||||
@end menu
|
||||
|
||||
@node History, How It Works, Overview, Overview
|
||||
@section History
|
||||
|
||||
One spur behind BFD was the desire, on the part of the GNU 960 team at
|
||||
Intel Oregon, for interoperability of applications on their COFF and
|
||||
b.out file formats. Cygnus was providing GNU support for the team, and
|
||||
was contracted to provide the required functionality.
|
||||
|
||||
The name came from a conversation David Wallace was having with Richard
|
||||
Stallman about the library: RMS said that it would be quite hard---David
|
||||
said ``BFD''. Stallman was right, but the name stuck.
|
||||
|
||||
At the same time, Ready Systems wanted much the same thing, but for
|
||||
different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k
|
||||
coff.
|
||||
|
||||
BFD was first implemented by members of Cygnus Support; Steve
|
||||
Chamberlain (@code{sac@@cygnus.com}), John Gilmore
|
||||
(@code{gnu@@cygnus.com}), K. Richard Pixley (@code{rich@@cygnus.com})
|
||||
and David Henkel-Wallace (@code{gumby@@cygnus.com}).
|
||||
|
||||
|
||||
|
||||
@node How It Works, What BFD Version 2 Can Do, History, Overview
|
||||
@section How To Use BFD
|
||||
|
||||
To use the library, include @file{bfd.h} and link with @file{libbfd.a}.
|
||||
|
||||
BFD provides a common interface to the parts of an object file
|
||||
for a calling application.
|
||||
|
||||
When an application sucessfully opens a target file (object, archive, or
|
||||
whatever), a pointer to an internal structure is returned. This pointer
|
||||
points to a structure called @code{bfd}, described in
|
||||
@file{bfd.h}. Our convention is to call this pointer a BFD, and
|
||||
instances of it within code @code{abfd}. All operations on
|
||||
the target object file are applied as methods to the BFD. The mapping is
|
||||
defined within @code{bfd.h} in a set of macros, all beginning
|
||||
with @samp{bfd_} to reduce namespace pollution.
|
||||
|
||||
For example, this sequence does what you would probably expect:
|
||||
return the number of sections in an object file attached to a BFD
|
||||
@code{abfd}.
|
||||
|
||||
@lisp
|
||||
@c @cartouche
|
||||
#include "bfd.h"
|
||||
|
||||
unsigned int number_of_sections(abfd)
|
||||
bfd *abfd;
|
||||
@{
|
||||
return bfd_count_sections(abfd);
|
||||
@}
|
||||
@c @end cartouche
|
||||
@end lisp
|
||||
|
||||
The abstraction used within BFD is that an object file has:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
a header,
|
||||
@item
|
||||
a number of sections containing raw data (@pxref{Sections}),
|
||||
@item
|
||||
a set of relocations (@pxref{Relocations}), and
|
||||
@item
|
||||
some symbol information (@pxref{Symbols}).
|
||||
@end itemize
|
||||
@noindent
|
||||
Also, BFDs opened for archives have the additional attribute of an index
|
||||
and contain subordinate BFDs. This approach is fine for a.out and coff,
|
||||
but loses efficiency when applied to formats such as S-records and
|
||||
IEEE-695.
|
||||
|
||||
@node What BFD Version 2 Can Do, , How It Works, Overview
|
||||
@section What BFD Version 2 Can Do
|
||||
@include bfdsumm.texi
|
||||
|
||||
@node BFD front end, BFD back ends, Overview, Top
|
||||
@chapter BFD front end
|
||||
@include bfd.texi
|
||||
|
||||
@menu
|
||||
* Memory Usage::
|
||||
* Initialization::
|
||||
* Sections::
|
||||
* Symbols::
|
||||
* Archives::
|
||||
* Formats::
|
||||
* Relocations::
|
||||
* Core Files::
|
||||
* Targets::
|
||||
* Architectures::
|
||||
* Opening and Closing::
|
||||
* Internal::
|
||||
* File Caching::
|
||||
* Linker Functions::
|
||||
* Hash Tables::
|
||||
@end menu
|
||||
|
||||
@node Memory Usage, Initialization, BFD front end, BFD front end
|
||||
@section Memory usage
|
||||
BFD keeps all of its internal structures in obstacks. There is one obstack
|
||||
per open BFD file, into which the current state is stored. When a BFD is
|
||||
closed, the obstack is deleted, and so everything which has been
|
||||
allocated by BFD for the closing file is thrown away.
|
||||
|
||||
BFD does not free anything created by an application, but pointers into
|
||||
@code{bfd} structures become invalid on a @code{bfd_close}; for example,
|
||||
after a @code{bfd_close} the vector passed to
|
||||
@code{bfd_canonicalize_symtab} is still around, since it has been
|
||||
allocated by the application, but the data that it pointed to are
|
||||
lost.
|
||||
|
||||
The general rule is to not close a BFD until all operations dependent
|
||||
upon data from the BFD have been completed, or all the data from within
|
||||
the file has been copied. To help with the management of memory, there
|
||||
is a function (@code{bfd_alloc_size}) which returns the number of bytes
|
||||
in obstacks associated with the supplied BFD. This could be used to
|
||||
select the greediest open BFD, close it to reclaim the memory, perform
|
||||
some operation and reopen the BFD again, to get a fresh copy of the data
|
||||
structures.
|
||||
|
||||
@node Initialization, Sections, Memory Usage, BFD front end
|
||||
@include init.texi
|
||||
|
||||
@node Sections, Symbols, Initialization, BFD front end
|
||||
@include section.texi
|
||||
|
||||
@node Symbols, Archives, Sections, BFD front end
|
||||
@include syms.texi
|
||||
|
||||
@node Archives, Formats, Symbols, BFD front end
|
||||
@include archive.texi
|
||||
|
||||
@node Formats, Relocations, Archives, BFD front end
|
||||
@include format.texi
|
||||
|
||||
@node Relocations, Core Files, Formats, BFD front end
|
||||
@include reloc.texi
|
||||
|
||||
@node Core Files, Targets, Relocations, BFD front end
|
||||
@include core.texi
|
||||
|
||||
@node Targets, Architectures, Core Files, BFD front end
|
||||
@include targets.texi
|
||||
|
||||
@node Architectures, Opening and Closing, Targets, BFD front end
|
||||
@include archures.texi
|
||||
|
||||
@node Opening and Closing, Internal, Architectures, BFD front end
|
||||
@include opncls.texi
|
||||
|
||||
@node Internal, File Caching, Opening and Closing, BFD front end
|
||||
@include libbfd.texi
|
||||
|
||||
@node File Caching, Linker Functions, Internal, BFD front end
|
||||
@include cache.texi
|
||||
|
||||
@node Linker Functions, Hash Tables, File Caching, BFD front end
|
||||
@include linker.texi
|
||||
|
||||
@node Hash Tables, , Linker Functions, BFD front end
|
||||
@include hash.texi
|
||||
|
||||
@node BFD back ends, Index, BFD front end, Top
|
||||
@chapter BFD back ends
|
||||
@menu
|
||||
* What to Put Where::
|
||||
* aout :: a.out backends
|
||||
* coff :: coff backends
|
||||
* elf :: elf backends
|
||||
@ignore
|
||||
* oasys :: oasys backends
|
||||
* ieee :: ieee backend
|
||||
* srecord :: s-record backend
|
||||
@end ignore
|
||||
@end menu
|
||||
@node What to Put Where, aout, BFD back ends, BFD back ends
|
||||
All of BFD lives in one directory.
|
||||
|
||||
@node aout, coff, What to Put Where, BFD back ends
|
||||
@include aoutx.texi
|
||||
|
||||
@node coff, elf, aout, BFD back ends
|
||||
@include coffcode.texi
|
||||
|
||||
@node elf, , coff, BFD back ends
|
||||
@include elf.texi
|
||||
@c Leave this out until the file has some actual contents...
|
||||
@c @include elfcode.texi
|
||||
|
||||
@node Index, , BFD back ends , Top
|
||||
@unnumbered Index
|
||||
@printindex cp
|
||||
|
||||
@tex
|
||||
% I think something like @colophon should be in texinfo. In the
|
||||
% meantime:
|
||||
\long\def\colophon{\hbox to0pt{}\vfill
|
||||
\centerline{The body of this manual is set in}
|
||||
\centerline{\fontname\tenrm,}
|
||||
\centerline{with headings in {\bf\fontname\tenbf}}
|
||||
\centerline{and examples in {\tt\fontname\tentt}.}
|
||||
\centerline{{\it\fontname\tenit\/} and}
|
||||
\centerline{{\sl\fontname\tensl\/}}
|
||||
\centerline{are used for emphasis.}\vfill}
|
||||
\page\colophon
|
||||
% Blame: doc@cygnus.com, 28mar91.
|
||||
@end tex
|
||||
|
||||
@contents
|
||||
@bye
|
@ -1,148 +0,0 @@
|
||||
@c This summary of BFD is shared by the BFD and LD docs.
|
||||
When an object file is opened, BFD subroutines automatically determine
|
||||
the format of the input object file. They then build a descriptor in
|
||||
memory with pointers to routines that will be used to access elements of
|
||||
the object file's data structures.
|
||||
|
||||
As different information from the the object files is required,
|
||||
BFD reads from different sections of the file and processes them.
|
||||
For example, a very common operation for the linker is processing symbol
|
||||
tables. Each BFD back end provides a routine for converting
|
||||
between the object file's representation of symbols and an internal
|
||||
canonical format. When the linker asks for the symbol table of an object
|
||||
file, it calls through a memory pointer to the routine from the
|
||||
relevant BFD back end which reads and converts the table into a canonical
|
||||
form. The linker then operates upon the canonical form. When the link is
|
||||
finished and the linker writes the output file's symbol table,
|
||||
another BFD back end routine is called to take the newly
|
||||
created symbol table and convert it into the chosen output format.
|
||||
|
||||
@menu
|
||||
* BFD information loss:: Information Loss
|
||||
* Canonical format:: The BFD canonical object-file format
|
||||
@end menu
|
||||
|
||||
@node BFD information loss
|
||||
@subsection Information Loss
|
||||
|
||||
@emph{Information can be lost during output.} The output formats
|
||||
supported by BFD do not provide identical facilities, and
|
||||
information which can be described in one form has nowhere to go in
|
||||
another format. One example of this is alignment information in
|
||||
@code{b.out}. There is nowhere in an @code{a.out} format file to store
|
||||
alignment information on the contained data, so when a file is linked
|
||||
from @code{b.out} and an @code{a.out} image is produced, alignment
|
||||
information will not propagate to the output file. (The linker will
|
||||
still use the alignment information internally, so the link is performed
|
||||
correctly).
|
||||
|
||||
Another example is COFF section names. COFF files may contain an
|
||||
unlimited number of sections, each one with a textual section name. If
|
||||
the target of the link is a format which does not have many sections (e.g.,
|
||||
@code{a.out}) or has sections without names (e.g., the Oasys format), the
|
||||
link cannot be done simply. You can circumvent this problem by
|
||||
describing the desired input-to-output section mapping with the linker command
|
||||
language.
|
||||
|
||||
@emph{Information can be lost during canonicalization.} The BFD
|
||||
internal canonical form of the external formats is not exhaustive; there
|
||||
are structures in input formats for which there is no direct
|
||||
representation internally. This means that the BFD back ends
|
||||
cannot maintain all possible data richness through the transformation
|
||||
between external to internal and back to external formats.
|
||||
|
||||
This limitation is only a problem when an application reads one
|
||||
format and writes another. Each BFD back end is responsible for
|
||||
maintaining as much data as possible, and the internal BFD
|
||||
canonical form has structures which are opaque to the BFD core,
|
||||
and exported only to the back ends. When a file is read in one format,
|
||||
the canonical form is generated for BFD and the application. At the
|
||||
same time, the back end saves away any information which may otherwise
|
||||
be lost. If the data is then written back in the same format, the back
|
||||
end routine will be able to use the canonical form provided by the
|
||||
BFD core as well as the information it prepared earlier. Since
|
||||
there is a great deal of commonality between back ends,
|
||||
there is no information lost when
|
||||
linking or copying big endian COFF to little endian COFF, or @code{a.out} to
|
||||
@code{b.out}. When a mixture of formats is linked, the information is
|
||||
only lost from the files whose format differs from the destination.
|
||||
|
||||
@node Canonical format
|
||||
@subsection The BFD canonical object-file format
|
||||
|
||||
The greatest potential for loss of information occurs when there is the least
|
||||
overlap between the information provided by the source format, that
|
||||
stored by the canonical format, and that needed by the
|
||||
destination format. A brief description of the canonical form may help
|
||||
you understand which kinds of data you can count on preserving across
|
||||
conversions.
|
||||
@cindex BFD canonical format
|
||||
@cindex internal object-file format
|
||||
|
||||
@table @emph
|
||||
@item files
|
||||
Information stored on a per-file basis includes target machine
|
||||
architecture, particular implementation format type, a demand pageable
|
||||
bit, and a write protected bit. Information like Unix magic numbers is
|
||||
not stored here---only the magic numbers' meaning, so a @code{ZMAGIC}
|
||||
file would have both the demand pageable bit and the write protected
|
||||
text bit set. The byte order of the target is stored on a per-file
|
||||
basis, so that big- and little-endian object files may be used with one
|
||||
another.
|
||||
|
||||
@item sections
|
||||
Each section in the input file contains the name of the section, the
|
||||
section's original address in the object file, size and alignment
|
||||
information, various flags, and pointers into other BFD data
|
||||
structures.
|
||||
|
||||
@item symbols
|
||||
Each symbol contains a pointer to the information for the object file
|
||||
which originally defined it, its name, its value, and various flag
|
||||
bits. When a BFD back end reads in a symbol table, it relocates all
|
||||
symbols to make them relative to the base of the section where they were
|
||||
defined. Doing this ensures that each symbol points to its containing
|
||||
section. Each symbol also has a varying amount of hidden private data
|
||||
for the BFD back end. Since the symbol points to the original file, the
|
||||
private data format for that symbol is accessible. @code{ld} can
|
||||
operate on a collection of symbols of wildly different formats without
|
||||
problems.
|
||||
|
||||
Normal global and simple local symbols are maintained on output, so an
|
||||
output file (no matter its format) will retain symbols pointing to
|
||||
functions and to global, static, and common variables. Some symbol
|
||||
information is not worth retaining; in @code{a.out}, type information is
|
||||
stored in the symbol table as long symbol names. This information would
|
||||
be useless to most COFF debuggers; the linker has command line switches
|
||||
to allow users to throw it away.
|
||||
|
||||
There is one word of type information within the symbol, so if the
|
||||
format supports symbol type information within symbols (for example, COFF,
|
||||
IEEE, Oasys) and the type is simple enough to fit within one word
|
||||
(nearly everything but aggregates), the information will be preserved.
|
||||
|
||||
@item relocation level
|
||||
Each canonical BFD relocation record contains a pointer to the symbol to
|
||||
relocate to, the offset of the data to relocate, the section the data
|
||||
is in, and a pointer to a relocation type descriptor. Relocation is
|
||||
performed by passing messages through the relocation type
|
||||
descriptor and the symbol pointer. Therefore, relocations can be performed
|
||||
on output data using a relocation method that is only available in one of the
|
||||
input formats. For instance, Oasys provides a byte relocation format.
|
||||
A relocation record requesting this relocation type would point
|
||||
indirectly to a routine to perform this, so the relocation may be
|
||||
performed on a byte being written to a 68k COFF file, even though 68k COFF
|
||||
has no such relocation type.
|
||||
|
||||
@item line numbers
|
||||
Object formats can contain, for debugging purposes, some form of mapping
|
||||
between symbols, source line numbers, and addresses in the output file.
|
||||
These addresses have to be relocated along with the symbol information.
|
||||
Each symbol with an associated list of line number records points to the
|
||||
first record of the list. The head of a line number list consists of a
|
||||
pointer to the symbol, which allows finding out the address of the
|
||||
function whose line number is being described. The rest of the list is
|
||||
made up of pairs: offsets into the section and line numbers. Any format
|
||||
which can simply derive this information can pass it successfully
|
||||
between formats (COFF, IEEE and Oasys).
|
||||
@end table
|
File diff suppressed because it is too large
Load Diff
@ -1,158 +0,0 @@
|
||||
: DOCDD
|
||||
skip_past_newline
|
||||
get_stuff_in_command kill_bogus_lines catstr
|
||||
;
|
||||
|
||||
: ENDDD
|
||||
skip_past_newline
|
||||
;
|
||||
|
||||
: EXAMPLE
|
||||
skip_past_newline
|
||||
get_stuff_in_command kill_bogus_lines do_fancy_stuff translatecomments
|
||||
courierize catstr
|
||||
|
||||
;
|
||||
|
||||
: INODE
|
||||
"@node " catstr skip_past_newline copy_past_newline catstr
|
||||
;
|
||||
|
||||
: CODE_FRAGMENT
|
||||
EXAMPLE
|
||||
;
|
||||
|
||||
: COMMENT
|
||||
skip_past_newline
|
||||
get_stuff_in_command
|
||||
drop
|
||||
;
|
||||
|
||||
: SYNOPSIS
|
||||
skip_past_newline
|
||||
"@strong{Synopsis}\n" catstr
|
||||
"@example\n" catstr
|
||||
get_stuff_in_command
|
||||
kill_bogus_lines
|
||||
indent
|
||||
catstr
|
||||
"@end example\n" catstr
|
||||
|
||||
;
|
||||
|
||||
: func
|
||||
"@findex " - a
|
||||
skip_past_newline
|
||||
copy_past_newline
|
||||
dup - a x x
|
||||
"@subsubsection @code{" - a x x b
|
||||
swap
|
||||
remchar
|
||||
"}\n" - a x b x c
|
||||
catstr catstr catstr catstr catstr
|
||||
;
|
||||
|
||||
: FUNCTION
|
||||
"@findex " - a
|
||||
skip_past_newline
|
||||
copy_past_newline
|
||||
dup - a x x
|
||||
"@subsubsection @code{" - a x x b
|
||||
swap
|
||||
remchar
|
||||
"}\n" - a x b x c
|
||||
catstr catstr catstr catstr catstr
|
||||
;
|
||||
|
||||
: bodytext
|
||||
get_stuff_in_command
|
||||
bulletize
|
||||
kill_bogus_lines
|
||||
do_fancy_stuff
|
||||
courierize
|
||||
catstr
|
||||
"@*\n" catstr
|
||||
;
|
||||
|
||||
: asection
|
||||
skip_past_newline
|
||||
catstr
|
||||
copy_past_newline
|
||||
do_fancy_stuff catstr
|
||||
bodytext
|
||||
;
|
||||
|
||||
: SECTION
|
||||
"@section " asection ;
|
||||
|
||||
: SUBSECTION
|
||||
"@subsection " asection ;
|
||||
|
||||
: SUBSUBSECTION
|
||||
"@subsubsection " asection ;
|
||||
|
||||
: subhead
|
||||
skip_past_newline
|
||||
bodytext
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
: DESCRIPTION
|
||||
"@strong{Description}@*\n" catstr subhead ;
|
||||
|
||||
: RETURNS
|
||||
"@strong{Returns}@*\n" catstr subhead ;
|
||||
|
||||
: INTERNAL_FUNCTION
|
||||
func ;
|
||||
|
||||
|
||||
: INTERNAL_DEFINITION
|
||||
func ;
|
||||
|
||||
|
||||
: INTERNAL
|
||||
func ;
|
||||
|
||||
: TYPEDEF
|
||||
FUNCTION ;
|
||||
|
||||
: SENUM
|
||||
skip_past_newline
|
||||
"Here are the possible values for @code{enum "
|
||||
copy_past_newline remchar catstr
|
||||
"}:\n\n" catstr catstr
|
||||
;
|
||||
: ENUM
|
||||
skip_past_newline
|
||||
"@deffn {} "
|
||||
copy_past_newline catstr catstr
|
||||
;
|
||||
: ENUMX
|
||||
skip_past_newline
|
||||
"@deffnx {} "
|
||||
copy_past_newline catstr
|
||||
catstr
|
||||
;
|
||||
: ENUMEQ
|
||||
skip_past_newline
|
||||
"@deffn {} "
|
||||
copy_past_newline catstr catstr
|
||||
skip_past_newline
|
||||
;
|
||||
: ENUMEQX
|
||||
skip_past_newline
|
||||
"@deffnx {} "
|
||||
copy_past_newline catstr
|
||||
catstr
|
||||
skip_past_newline
|
||||
;
|
||||
: ENUMDOC
|
||||
skip_past_newline
|
||||
get_stuff_in_command
|
||||
strip_trailing_newlines
|
||||
catstr
|
||||
"\n@end deffn\n" catstr
|
||||
;
|
@ -1,135 +0,0 @@
|
||||
|
||||
: SYNOPSIS
|
||||
skip_past_newline
|
||||
get_stuff_in_command
|
||||
paramstuff
|
||||
indent
|
||||
maybecatstr
|
||||
;
|
||||
|
||||
: ignore
|
||||
skip_past_newline
|
||||
get_stuff_in_command
|
||||
outputdots
|
||||
maybecatstr
|
||||
;
|
||||
|
||||
: CODE_FRAGMENT
|
||||
ignore ;
|
||||
|
||||
: external
|
||||
0 internalmode ignore ;
|
||||
|
||||
: internal
|
||||
1 internalmode ignore ;
|
||||
|
||||
- input stack { a b } output b if internal, a if external
|
||||
: ifinternal
|
||||
"" swap 1 internalmode maybecatstr
|
||||
swap
|
||||
"" swap 0 internalmode maybecatstr
|
||||
catstr
|
||||
;
|
||||
|
||||
- Put note in output string, regardless of internal mode.
|
||||
: COMMENT
|
||||
skip_past_newline
|
||||
get_stuff_in_command
|
||||
translatecomments
|
||||
catstr
|
||||
;
|
||||
|
||||
- SENUM enum-type-name
|
||||
- ENUM enum-name
|
||||
- ENUMX addl-enum-name
|
||||
- ENUMDOC doc for preceding enums
|
||||
- ENDSENUM max-enum-name
|
||||
|
||||
: make_enum_header
|
||||
dup
|
||||
"enum " swap catstr
|
||||
" {\n" catstr
|
||||
swap " _dummy_first_" swap catstr catstr
|
||||
",\n" catstr
|
||||
;
|
||||
: make_string_table_header
|
||||
dup
|
||||
"#ifdef _BFD_MAKE_TABLE_" swap catstr swap
|
||||
"\n\nstatic const char *const " swap catstr catstr
|
||||
"_names[] = { \"@@uninitialized@@\",\n" catstr
|
||||
;
|
||||
: SENUM
|
||||
skip_past_newline
|
||||
copy_past_newline
|
||||
remchar
|
||||
dup
|
||||
make_enum_header
|
||||
swap
|
||||
make_string_table_header
|
||||
ifinternal
|
||||
catstr
|
||||
get_stuff_in_command catstr
|
||||
translatecomments ;
|
||||
: ENDSENUM
|
||||
skip_past_newline
|
||||
copy_past_newline strip_trailing_newlines
|
||||
dup
|
||||
" " swap catstr " };\n" catstr swap
|
||||
" \"@@overflow: " swap catstr "@@\",\n};\n#endif\n\n" catstr
|
||||
ifinternal
|
||||
catstr
|
||||
;
|
||||
: make_enumerator
|
||||
" " swap catstr
|
||||
",\n" catstr
|
||||
;
|
||||
: make_enumerator_string
|
||||
" \"" swap catstr
|
||||
"\",\n" catstr
|
||||
;
|
||||
: ENUM
|
||||
skip_past_newline
|
||||
copy_past_newline
|
||||
remchar
|
||||
dup
|
||||
make_enumerator
|
||||
swap
|
||||
make_enumerator_string
|
||||
ifinternal
|
||||
;
|
||||
: ENUMX ENUM catstr ;
|
||||
: ENUMEQ
|
||||
skip_past_newline
|
||||
"#define "
|
||||
copy_past_newline remchar
|
||||
catstr
|
||||
" "
|
||||
catstr
|
||||
copy_past_newline
|
||||
catstr
|
||||
"" swap 0 internalmode maybecatstr
|
||||
;
|
||||
: ENUMEQX ENUMEQ catstr ;
|
||||
: ENUMDOC
|
||||
skip_past_newline
|
||||
get_stuff_in_command
|
||||
strip_trailing_newlines
|
||||
"\n{* " swap catstr " *}\n" catstr
|
||||
translatecomments
|
||||
- discard it if we're doing internal mode
|
||||
"" swap 0 internalmode maybecatstr
|
||||
swap
|
||||
catstr catstr
|
||||
;
|
||||
: ENDDD external ;
|
||||
: SECTION ignore ;
|
||||
: SUBSECTION ignore ;
|
||||
: SUBSUBSECTION ignore ;
|
||||
: INTERNAL_DEFINITION internal ;
|
||||
: DESCRIPTION ignore ;
|
||||
: FUNCTION external ;
|
||||
: RETURNS ignore ;
|
||||
: TYPEDEF external ;
|
||||
: INTERNAL_FUNCTION internal ;
|
||||
: INTERNAL internal ;
|
||||
: INODE ignore ;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,858 +0,0 @@
|
||||
/* BFD back-end data structures for ELF files.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _LIBELF_H_
|
||||
#define _LIBELF_H_ 1
|
||||
|
||||
#include "elf/common.h"
|
||||
#include "elf/internal.h"
|
||||
#include "elf/external.h"
|
||||
#include "bfdlink.h"
|
||||
|
||||
/* If size isn't specified as 64 or 32, NAME macro should fail. */
|
||||
#ifndef NAME
|
||||
#if ARCH_SIZE==64
|
||||
#define NAME(x,y) CAT4(x,64,_,y)
|
||||
#endif
|
||||
#if ARCH_SIZE==32
|
||||
#define NAME(x,y) CAT4(x,32,_,y)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NAME
|
||||
#define NAME(x,y) CAT4(x,NOSIZE,_,y)
|
||||
#endif
|
||||
|
||||
#define ElfNAME(X) NAME(Elf,X)
|
||||
#define elfNAME(X) NAME(elf,X)
|
||||
|
||||
/* Information held for an ELF symbol. The first field is the
|
||||
corresponding asymbol. Every symbol is an ELF file is actually a
|
||||
pointer to this structure, although it is often handled as a
|
||||
pointer to an asymbol. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* The BFD symbol. */
|
||||
asymbol symbol;
|
||||
/* ELF symbol information. */
|
||||
Elf_Internal_Sym internal_elf_sym;
|
||||
/* Backend specific information. */
|
||||
union
|
||||
{
|
||||
unsigned int hppa_arg_reloc;
|
||||
PTR mips_extr;
|
||||
PTR any;
|
||||
}
|
||||
tc_data;
|
||||
} elf_symbol_type;
|
||||
|
||||
/* ELF linker hash table entries. */
|
||||
|
||||
struct elf_link_hash_entry
|
||||
{
|
||||
struct bfd_link_hash_entry root;
|
||||
|
||||
/* Symbol index in output file. This is initialized to -1. It is
|
||||
set to -2 if the symbol is used by a reloc. */
|
||||
long indx;
|
||||
|
||||
/* Symbol size. */
|
||||
bfd_size_type size;
|
||||
|
||||
/* Symbol index as a dynamic symbol. Initialized to -1, and remains
|
||||
-1 if this is not a dynamic symbol. */
|
||||
long dynindx;
|
||||
|
||||
/* String table index in .dynstr if this is a dynamic symbol. */
|
||||
unsigned long dynstr_index;
|
||||
|
||||
/* If this is a weak defined symbol from a dynamic object, this
|
||||
field points to a defined symbol with the same value, if there is
|
||||
one. Otherwise it is NULL. */
|
||||
struct elf_link_hash_entry *weakdef;
|
||||
|
||||
/* If this symbol requires an entry in the global offset table, the
|
||||
processor specific backend uses this field to hold the offset
|
||||
into the .got section. If this field is -1, then the symbol does
|
||||
not require a global offset table entry. */
|
||||
bfd_vma got_offset;
|
||||
|
||||
/* If this symbol requires an entry in the procedure linkage table,
|
||||
the processor specific backend uses these two fields to hold the
|
||||
offset into the procedure linkage section and the offset into the
|
||||
.got section. If plt_offset is -1, then the symbol does not
|
||||
require an entry in the procedure linkage table. */
|
||||
bfd_vma plt_offset;
|
||||
|
||||
/* If this symbol is used in the linker created sections, the processor
|
||||
specific backend uses this field to map the field into the offset
|
||||
from the beginning of the section. */
|
||||
struct elf_linker_section_pointers *linker_section_pointer;
|
||||
|
||||
/* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
|
||||
char type;
|
||||
|
||||
/* Some flags; legal values follow. */
|
||||
unsigned char elf_link_hash_flags;
|
||||
/* Symbol is referenced by a non-shared object. */
|
||||
#define ELF_LINK_HASH_REF_REGULAR 01
|
||||
/* Symbol is defined by a non-shared object. */
|
||||
#define ELF_LINK_HASH_DEF_REGULAR 02
|
||||
/* Symbol is referenced by a shared object. */
|
||||
#define ELF_LINK_HASH_REF_DYNAMIC 04
|
||||
/* Symbol is defined by a shared object. */
|
||||
#define ELF_LINK_HASH_DEF_DYNAMIC 010
|
||||
/* Dynamic symbol has been adjustd. */
|
||||
#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 020
|
||||
/* Symbol needs a copy reloc. */
|
||||
#define ELF_LINK_HASH_NEEDS_COPY 040
|
||||
/* Symbol needs a procedure linkage table entry. */
|
||||
#define ELF_LINK_HASH_NEEDS_PLT 0100
|
||||
/* Symbol appears in a non-ELF input file. */
|
||||
#define ELF_LINK_NON_ELF 0200
|
||||
/* Note: If you add more flags, you must change the type of
|
||||
elf_link_hash_flags. */
|
||||
};
|
||||
|
||||
/* ELF linker hash table. */
|
||||
|
||||
struct elf_link_hash_table
|
||||
{
|
||||
struct bfd_link_hash_table root;
|
||||
/* Whether we have created the special dynamic sections required
|
||||
when linking against or generating a shared object. */
|
||||
boolean dynamic_sections_created;
|
||||
/* The BFD used to hold special sections created by the linker.
|
||||
This will be the first BFD found which requires these sections to
|
||||
be created. */
|
||||
bfd *dynobj;
|
||||
/* The number of symbols found in the link which must be put into
|
||||
the .dynsym section. */
|
||||
bfd_size_type dynsymcount;
|
||||
/* The string table of dynamic symbols, which becomes the .dynstr
|
||||
section. */
|
||||
struct bfd_strtab_hash *dynstr;
|
||||
/* The number of buckets in the hash table in the .hash section.
|
||||
This is based on the number of dynamic symbols. */
|
||||
bfd_size_type bucketcount;
|
||||
/* A linked list of DT_NEEDED names found in dynamic objects
|
||||
included in the link. */
|
||||
struct bfd_link_needed_list *needed;
|
||||
};
|
||||
|
||||
/* Look up an entry in an ELF linker hash table. */
|
||||
|
||||
#define elf_link_hash_lookup(table, string, create, copy, follow) \
|
||||
((struct elf_link_hash_entry *) \
|
||||
bfd_link_hash_lookup (&(table)->root, (string), (create), \
|
||||
(copy), (follow)))
|
||||
|
||||
/* Traverse an ELF linker hash table. */
|
||||
|
||||
#define elf_link_hash_traverse(table, func, info) \
|
||||
(bfd_link_hash_traverse \
|
||||
(&(table)->root, \
|
||||
(boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
||||
(info)))
|
||||
|
||||
/* Get the ELF linker hash table from a link_info structure. */
|
||||
|
||||
#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
|
||||
|
||||
/* Constant information held for an ELF backend. */
|
||||
|
||||
struct elf_size_info {
|
||||
unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
|
||||
unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
|
||||
|
||||
unsigned char arch_size, file_align;
|
||||
unsigned char elfclass, ev_current;
|
||||
int (*write_out_phdrs) PARAMS ((bfd *, Elf_Internal_Phdr *, int));
|
||||
boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *));
|
||||
void (*write_relocs) PARAMS ((bfd *, asection *, PTR));
|
||||
void (*swap_symbol_out) PARAMS ((bfd *, Elf_Internal_Sym *, PTR));
|
||||
boolean (*slurp_reloc_table) PARAMS ((bfd *, asection *, asymbol **));
|
||||
long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean));
|
||||
void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
|
||||
};
|
||||
|
||||
#define elf_symbol_from(ABFD,S) \
|
||||
(((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
|
||||
&& (S)->the_bfd->tdata.elf_obj_data != 0) \
|
||||
? (elf_symbol_type *) (S) \
|
||||
: 0)
|
||||
|
||||
struct elf_backend_data
|
||||
{
|
||||
/* Whether the backend uses REL or RELA relocations. FIXME: some
|
||||
ELF backends use both. When we need to support one, this whole
|
||||
approach will need to be changed. */
|
||||
int use_rela_p;
|
||||
|
||||
/* The architecture for this backend. */
|
||||
enum bfd_architecture arch;
|
||||
|
||||
/* The ELF machine code (EM_xxxx) for this backend. */
|
||||
int elf_machine_code;
|
||||
|
||||
/* The maximum page size for this backend. */
|
||||
bfd_vma maxpagesize;
|
||||
|
||||
/* This is true if the linker should act like collect and gather
|
||||
global constructors and destructors by name. This is true for
|
||||
MIPS ELF because the Irix 5 tools can not handle the .init
|
||||
section. */
|
||||
boolean collect;
|
||||
|
||||
/* This is true if the linker should ignore changes to the type of a
|
||||
symbol. This is true for MIPS ELF because some Irix 5 objects
|
||||
record undefined functions as STT_OBJECT although the definitions
|
||||
are STT_FUNC. */
|
||||
boolean type_change_ok;
|
||||
|
||||
/* A function to translate an ELF RELA relocation to a BFD arelent
|
||||
structure. */
|
||||
void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
|
||||
Elf_Internal_Rela *));
|
||||
|
||||
/* A function to translate an ELF REL relocation to a BFD arelent
|
||||
structure. */
|
||||
void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *,
|
||||
Elf_Internal_Rel *));
|
||||
|
||||
/* A function to determine whether a symbol is global when
|
||||
partitioning the symbol table into local and global symbols.
|
||||
This should be NULL for most targets, in which case the correct
|
||||
thing will be done. MIPS ELF, at least on the Irix 5, has
|
||||
special requirements. */
|
||||
boolean (*elf_backend_sym_is_global) PARAMS ((bfd *, asymbol *));
|
||||
|
||||
/* The remaining functions are hooks which are called only if they
|
||||
are not NULL. */
|
||||
|
||||
/* A function to permit a backend specific check on whether a
|
||||
particular BFD format is relevant for an object file, and to
|
||||
permit the backend to set any global information it wishes. When
|
||||
this is called elf_elfheader is set, but anything else should be
|
||||
used with caution. If this returns false, the check_format
|
||||
routine will return a bfd_error_wrong_format error. */
|
||||
boolean (*elf_backend_object_p) PARAMS ((bfd *));
|
||||
|
||||
/* A function to do additional symbol processing when reading the
|
||||
ELF symbol table. This is where any processor-specific special
|
||||
section indices are handled. */
|
||||
void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *));
|
||||
|
||||
/* A function to do additional symbol processing after reading the
|
||||
entire ELF symbol table. */
|
||||
boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *,
|
||||
elf_symbol_type *,
|
||||
unsigned int));
|
||||
|
||||
/* A function to do additional processing on the ELF section header
|
||||
just before writing it out. This is used to set the flags and
|
||||
type fields for some sections, or to actually write out data for
|
||||
unusual sections. */
|
||||
boolean (*elf_backend_section_processing) PARAMS ((bfd *,
|
||||
Elf32_Internal_Shdr *));
|
||||
|
||||
/* A function to handle unusual section types when creating BFD
|
||||
sections from ELF sections. */
|
||||
boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *,
|
||||
Elf32_Internal_Shdr *,
|
||||
char *));
|
||||
|
||||
/* A function to set up the ELF section header for a BFD section in
|
||||
preparation for writing it out. This is where the flags and type
|
||||
fields are set for unusual sections. */
|
||||
boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *,
|
||||
asection *));
|
||||
|
||||
/* A function to get the ELF section index for a BFD section. If
|
||||
this returns true, the section was found. If it is a normal ELF
|
||||
section, *RETVAL should be left unchanged. If it is not a normal
|
||||
ELF section *RETVAL should be set to the SHN_xxxx index. */
|
||||
boolean (*elf_backend_section_from_bfd_section)
|
||||
PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
|
||||
|
||||
/* If this field is not NULL, it is called by the add_symbols phase
|
||||
of a link just before adding a symbol to the global linker hash
|
||||
table. It may modify any of the fields as it wishes. If *NAME
|
||||
is set to NULL, the symbol will be skipped rather than being
|
||||
added to the hash table. This function is responsible for
|
||||
handling all processor dependent symbol bindings and section
|
||||
indices, and must set at least *FLAGS and *SEC for each processor
|
||||
dependent case; failure to do so will cause a link error. */
|
||||
boolean (*elf_add_symbol_hook)
|
||||
PARAMS ((bfd *abfd, struct bfd_link_info *info,
|
||||
const Elf_Internal_Sym *, const char **name,
|
||||
flagword *flags, asection **sec, bfd_vma *value));
|
||||
|
||||
/* If this field is not NULL, it is called by the elf_link_output_sym
|
||||
phase of a link for each symbol which will appear in the object file. */
|
||||
boolean (*elf_backend_link_output_symbol_hook)
|
||||
PARAMS ((bfd *, struct bfd_link_info *info, const char *,
|
||||
Elf_Internal_Sym *, asection *));
|
||||
|
||||
/* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
|
||||
linker the first time it encounters a dynamic object in the link.
|
||||
This function must create any sections required for dynamic
|
||||
linking. The ABFD argument is a dynamic object. The .interp,
|
||||
.dynamic, .dynsym, .dynstr, and .hash functions have already been
|
||||
created, and this function may modify the section flags if
|
||||
desired. This function will normally create the .got and .plt
|
||||
sections, but different backends have different requirements. */
|
||||
boolean (*elf_backend_create_dynamic_sections)
|
||||
PARAMS ((bfd *abfd, struct bfd_link_info *info));
|
||||
|
||||
/* The CHECK_RELOCS function is called by the add_symbols phase of
|
||||
the ELF backend linker. It is called once for each section with
|
||||
relocs of an object file, just after the symbols for the object
|
||||
file have been added to the global linker hash table. The
|
||||
function must look through the relocs and do any special handling
|
||||
required. This generally means allocating space in the global
|
||||
offset table, and perhaps allocating space for a reloc. The
|
||||
relocs are always passed as Rela structures; if the section
|
||||
actually uses Rel structures, the r_addend field will always be
|
||||
zero. */
|
||||
boolean (*check_relocs)
|
||||
PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
|
||||
const Elf_Internal_Rela *relocs));
|
||||
|
||||
/* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
|
||||
linker for every symbol which is defined by a dynamic object and
|
||||
referenced by a regular object. This is called after all the
|
||||
input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
|
||||
function has been called. The hash table entry should be
|
||||
bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
|
||||
defined in a section from a dynamic object. Dynamic object
|
||||
sections are not included in the final link, and this function is
|
||||
responsible for changing the value to something which the rest of
|
||||
the link can deal with. This will normally involve adding an
|
||||
entry to the .plt or .got or some such section, and setting the
|
||||
symbol to point to that. */
|
||||
boolean (*elf_backend_adjust_dynamic_symbol)
|
||||
PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
|
||||
|
||||
/* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
|
||||
linker after all the linker input files have been seen but before
|
||||
the sections sizes have been set. This is called after
|
||||
ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
|
||||
It is only called when linking against a dynamic object. It must
|
||||
set the sizes of the dynamic sections, and may fill in their
|
||||
contents as well. The generic ELF linker can handle the .dynsym,
|
||||
.dynstr and .hash sections. This function must handle the
|
||||
.interp section and any sections created by the
|
||||
CREATE_DYNAMIC_SECTIONS entry point. */
|
||||
boolean (*elf_backend_size_dynamic_sections)
|
||||
PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
|
||||
|
||||
/* The RELOCATE_SECTION function is called by the ELF backend linker
|
||||
to handle the relocations for a section.
|
||||
|
||||
The relocs are always passed as Rela structures; if the section
|
||||
actually uses Rel structures, the r_addend field will always be
|
||||
zero.
|
||||
|
||||
This function is responsible for adjust the section contents as
|
||||
necessary, and (if using Rela relocs and generating a
|
||||
relocateable output file) adjusting the reloc addend as
|
||||
necessary.
|
||||
|
||||
This function does not have to worry about setting the reloc
|
||||
address or the reloc symbol index.
|
||||
|
||||
LOCAL_SYMS is a pointer to the swapped in local symbols.
|
||||
|
||||
LOCAL_SECTIONS is an array giving the section in the input file
|
||||
corresponding to the st_shndx field of each local symbol.
|
||||
|
||||
The global hash table entry for the global symbols can be found
|
||||
via elf_sym_hashes (input_bfd).
|
||||
|
||||
When generating relocateable output, this function must handle
|
||||
STB_LOCAL/STT_SECTION symbols specially. The output symbol is
|
||||
going to be the section symbol corresponding to the output
|
||||
section, which means that the addend must be adjusted
|
||||
accordingly. */
|
||||
boolean (*elf_backend_relocate_section)
|
||||
PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
|
||||
bfd *input_bfd, asection *input_section, bfd_byte *contents,
|
||||
Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
|
||||
asection **local_sections));
|
||||
|
||||
/* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
|
||||
linker just before it writes a symbol out to the .dynsym section.
|
||||
The processor backend may make any required adjustment to the
|
||||
symbol. It may also take the opportunity to set contents of the
|
||||
dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
|
||||
all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
|
||||
on those symbols which are defined by a dynamic object. */
|
||||
boolean (*elf_backend_finish_dynamic_symbol)
|
||||
PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
|
||||
struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
|
||||
|
||||
/* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
|
||||
linker just before it writes all the dynamic sections out to the
|
||||
output file. The FINISH_DYNAMIC_SYMBOL will have been called on
|
||||
all dynamic symbols. */
|
||||
boolean (*elf_backend_finish_dynamic_sections)
|
||||
PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
|
||||
|
||||
/* A function to do any beginning processing needed for the ELF file
|
||||
before building the ELF headers and computing file positions. */
|
||||
void (*elf_backend_begin_write_processing)
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* A function to do any final processing needed for the ELF file
|
||||
before writing it out. The LINKER argument is true if this BFD
|
||||
was created by the ELF backend linker. */
|
||||
void (*elf_backend_final_write_processing)
|
||||
PARAMS ((bfd *, boolean linker));
|
||||
|
||||
/* This function is called by get_program_header_size. It should
|
||||
return the number of additional program segments which this BFD
|
||||
will need. It should return -1 on error. */
|
||||
int (*elf_backend_additional_program_headers) PARAMS ((bfd *));
|
||||
|
||||
/* This function is called to modify an existing segment map in a
|
||||
backend specific fashion. */
|
||||
boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *));
|
||||
|
||||
/* The swapping table to use when dealing with ECOFF information.
|
||||
Used for the MIPS ELF .mdebug section. */
|
||||
const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
|
||||
|
||||
/* Alternate EM_xxxx machine codes for this backend. */
|
||||
int elf_machine_alt1;
|
||||
int elf_machine_alt2;
|
||||
|
||||
const struct elf_size_info *s;
|
||||
|
||||
unsigned want_got_plt : 1;
|
||||
unsigned plt_readonly : 1;
|
||||
unsigned want_plt_sym : 1;
|
||||
};
|
||||
|
||||
/* Information stored for each BFD section in an ELF file. This
|
||||
structure is allocated by elf_new_section_hook. */
|
||||
|
||||
struct bfd_elf_section_data
|
||||
{
|
||||
/* The ELF header for this section. */
|
||||
Elf_Internal_Shdr this_hdr;
|
||||
/* The ELF header for the reloc section associated with this
|
||||
section, if any. */
|
||||
Elf_Internal_Shdr rel_hdr;
|
||||
/* The ELF section number of this section. Only used for an output
|
||||
file. */
|
||||
int this_idx;
|
||||
/* The ELF section number of the reloc section associated with this
|
||||
section, if any. Only used for an output file. */
|
||||
int rel_idx;
|
||||
/* Used by the backend linker to store the symbol hash table entries
|
||||
associated with relocs against global symbols. */
|
||||
struct elf_link_hash_entry **rel_hashes;
|
||||
/* A pointer to the swapped relocs. If the section uses REL relocs,
|
||||
rather than RELA, all the r_addend fields will be zero. This
|
||||
pointer may be NULL. It is used by the backend linker. */
|
||||
Elf_Internal_Rela *relocs;
|
||||
/* Used by the backend linker when generating a shared library to
|
||||
record the dynamic symbol index for a section symbol
|
||||
corresponding to this section. */
|
||||
long dynindx;
|
||||
/* A pointer available for the processor specific ELF backend. */
|
||||
PTR tdata;
|
||||
};
|
||||
|
||||
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
|
||||
|
||||
#define get_elf_backend_data(abfd) \
|
||||
((struct elf_backend_data *) (abfd)->xvec->backend_data)
|
||||
|
||||
/* Enumeration to specify the special section. */
|
||||
typedef enum elf_linker_section_enum
|
||||
{
|
||||
LINKER_SECTION_UNKNOWN, /* not used */
|
||||
LINKER_SECTION_GOT, /* .got section for global offset pointers */
|
||||
LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */
|
||||
LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */
|
||||
LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */
|
||||
LINKER_SECTION_MAX /* # of linker sections */
|
||||
} elf_linker_section_enum_t;
|
||||
|
||||
/* Sections created by the linker. */
|
||||
|
||||
typedef struct elf_linker_section
|
||||
{
|
||||
char *name; /* name of the section */
|
||||
char *rel_name; /* name of the associated .rel{,a}. section */
|
||||
char *bss_name; /* name of a related .bss section */
|
||||
char *sym_name; /* name of symbol to reference this section */
|
||||
asection *section; /* pointer to the section */
|
||||
asection *bss_section; /* pointer to the bss section associated with this */
|
||||
asection *rel_section; /* pointer to the relocations needed for this section */
|
||||
struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */
|
||||
bfd_vma initial_size; /* initial size before any linker generated allocations */
|
||||
bfd_vma sym_offset; /* offset of symbol from beginning of section */
|
||||
bfd_vma hole_size; /* size of reserved address hole in allocation */
|
||||
bfd_vma hole_offset; /* current offset for the hole */
|
||||
bfd_vma max_hole_offset; /* maximum offset for the hole */
|
||||
elf_linker_section_enum_t which; /* which section this is */
|
||||
boolean hole_written_p; /* whether the hole has been initialized */
|
||||
int alignment; /* alignment for the section */
|
||||
flagword flags; /* flags to use to create the section */
|
||||
} elf_linker_section_t;
|
||||
|
||||
/* Linked list of allocated pointer entries. This hangs off of the symbol lists, and
|
||||
provides allows us to return different pointers, based on different addend's. */
|
||||
|
||||
typedef struct elf_linker_section_pointers
|
||||
{
|
||||
struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */
|
||||
bfd_vma offset; /* offset of pointer from beginning of section */
|
||||
bfd_signed_vma addend; /* addend used */
|
||||
elf_linker_section_enum_t which; /* which linker section this is */
|
||||
boolean written_address_p; /* whether address was written yet */
|
||||
} elf_linker_section_pointers_t;
|
||||
|
||||
/* Some private data is stashed away for future use using the tdata pointer
|
||||
in the bfd structure. */
|
||||
|
||||
struct elf_obj_tdata
|
||||
{
|
||||
Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */
|
||||
Elf_Internal_Shdr **elf_sect_ptr;
|
||||
Elf_Internal_Phdr *phdr;
|
||||
struct elf_segment_map *segment_map;
|
||||
struct bfd_strtab_hash *strtab_ptr;
|
||||
int num_locals;
|
||||
int num_globals;
|
||||
asymbol **section_syms; /* STT_SECTION symbols for each section */
|
||||
Elf_Internal_Shdr symtab_hdr;
|
||||
Elf_Internal_Shdr shstrtab_hdr;
|
||||
Elf_Internal_Shdr strtab_hdr;
|
||||
Elf_Internal_Shdr dynsymtab_hdr;
|
||||
Elf_Internal_Shdr dynstrtab_hdr;
|
||||
unsigned int symtab_section, shstrtab_section;
|
||||
unsigned int strtab_section, dynsymtab_section;
|
||||
file_ptr next_file_pos;
|
||||
void *prstatus; /* The raw /proc prstatus structure */
|
||||
void *prpsinfo; /* The raw /proc prpsinfo structure */
|
||||
bfd_vma gp; /* The gp value (MIPS only, for now) */
|
||||
unsigned int gp_size; /* The gp size (MIPS only, for now) */
|
||||
|
||||
/* This is set to true if the object was created by the backend
|
||||
linker. */
|
||||
boolean linker;
|
||||
|
||||
/* A mapping from external symbols to entries in the linker hash
|
||||
table, used when linking. This is indexed by the symbol index
|
||||
minus the sh_info field of the symbol table header. */
|
||||
struct elf_link_hash_entry **sym_hashes;
|
||||
|
||||
/* A mapping from local symbols to offsets into the global offset
|
||||
table, used when linking. This is indexed by the symbol index. */
|
||||
bfd_vma *local_got_offsets;
|
||||
|
||||
/* A mapping from local symbols to offsets into the various linker
|
||||
sections added. This is index by the symbol index. */
|
||||
elf_linker_section_pointers_t **linker_section_pointers;
|
||||
|
||||
/* The linker ELF emulation code needs to let the backend ELF linker
|
||||
know what filename should be used for a dynamic object if the
|
||||
dynamic object is found using a search. The emulation code then
|
||||
sometimes needs to know what name was actually used. Until the
|
||||
file has been added to the linker symbol table, this field holds
|
||||
the name the linker wants. After it has been added, it holds the
|
||||
name actually used, which will be the DT_SONAME entry if there is
|
||||
one. */
|
||||
const char *dt_name;
|
||||
|
||||
/* Irix 5 often screws up the symbol table, sorting local symbols
|
||||
after global symbols. This flag is set if the symbol table in
|
||||
this BFD appears to be screwed up. If it is, we ignore the
|
||||
sh_info field in the symbol table header, and always read all the
|
||||
symbols. */
|
||||
boolean bad_symtab;
|
||||
|
||||
/* Records the result of `get_program_header_size'. */
|
||||
bfd_size_type program_header_size;
|
||||
|
||||
/* Used by find_nearest_line entry point. */
|
||||
PTR line_info;
|
||||
|
||||
/* Used by MIPS ELF find_nearest_line entry point. The structure
|
||||
could be included directly in this one, but there's no point to
|
||||
wasting the memory just for the infrequently called
|
||||
find_nearest_line. */
|
||||
struct mips_elf_find_line *find_line_info;
|
||||
|
||||
/* Used to determine if the e_flags field has been initialized */
|
||||
boolean flags_init;
|
||||
|
||||
/* Linker sections that we are interested in. */
|
||||
struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
|
||||
};
|
||||
|
||||
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
|
||||
#define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
|
||||
#define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
|
||||
#define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
|
||||
#define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
|
||||
#define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
|
||||
#define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
|
||||
#define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
|
||||
#define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
|
||||
#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
|
||||
#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
|
||||
#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
|
||||
#define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
|
||||
#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
|
||||
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got_offsets)
|
||||
#define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
|
||||
#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
|
||||
#define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
|
||||
#define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
|
||||
#define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
|
||||
|
||||
extern int _bfd_elf_section_from_bfd_section PARAMS ((bfd *, asection *));
|
||||
extern char *bfd_elf_string_from_elf_section
|
||||
PARAMS ((bfd *, unsigned, unsigned));
|
||||
extern char *bfd_elf_get_str_section PARAMS ((bfd *, unsigned));
|
||||
|
||||
extern boolean _bfd_elf_print_private_bfd_data PARAMS ((bfd *, PTR));
|
||||
extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *,
|
||||
bfd_print_symbol_type));
|
||||
#define elf_string_from_elf_strtab(abfd,strindex) \
|
||||
bfd_elf_string_from_elf_section(abfd,elf_elfheader(abfd)->e_shstrndx,strindex)
|
||||
|
||||
#define bfd_elf32_print_symbol bfd_elf_print_symbol
|
||||
#define bfd_elf64_print_symbol bfd_elf_print_symbol
|
||||
#define bfd_elf32_mkobject bfd_elf_mkobject
|
||||
#define bfd_elf64_mkobject bfd_elf_mkobject
|
||||
#define elf_mkobject bfd_elf_mkobject
|
||||
|
||||
extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *));
|
||||
|
||||
extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
|
||||
arelent *,
|
||||
asymbol *,
|
||||
PTR,
|
||||
asection *,
|
||||
bfd *,
|
||||
char **));
|
||||
extern boolean bfd_elf_mkobject PARAMS ((bfd *));
|
||||
extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
|
||||
extern boolean _bfd_elf_make_section_from_shdr
|
||||
PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name));
|
||||
extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
extern boolean _bfd_elf_link_hash_table_init
|
||||
PARAMS ((struct elf_link_hash_table *, bfd *,
|
||||
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
||||
struct bfd_hash_table *,
|
||||
const char *)));
|
||||
|
||||
extern boolean _bfd_elf_copy_private_symbol_data
|
||||
PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
|
||||
extern boolean _bfd_elf_copy_private_section_data
|
||||
PARAMS ((bfd *, asection *, bfd *, asection *));
|
||||
extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *));
|
||||
extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
|
||||
file_ptr,
|
||||
bfd_size_type));
|
||||
extern long _bfd_elf_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern long _bfd_elf_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern long _bfd_elf_get_dynamic_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern long _bfd_elf_canonicalize_dynamic_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern long _bfd_elf_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern long _bfd_elf_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
|
||||
arelent **, asymbol **));
|
||||
extern asymbol *_bfd_elf_make_empty_symbol PARAMS ((bfd *));
|
||||
extern void _bfd_elf_get_symbol_info PARAMS ((bfd *, asymbol *,
|
||||
symbol_info *));
|
||||
extern alent *_bfd_elf_get_lineno PARAMS ((bfd *, asymbol *));
|
||||
extern boolean _bfd_elf_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
|
||||
unsigned long));
|
||||
extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *,
|
||||
asymbol **,
|
||||
bfd_vma, CONST char **,
|
||||
CONST char **,
|
||||
unsigned int *));
|
||||
#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
|
||||
#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||
extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean));
|
||||
extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *));
|
||||
|
||||
/* If the target doesn't have reloc handling written yet: */
|
||||
extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *,
|
||||
Elf_Internal_Rela *));
|
||||
|
||||
asection *bfd_section_from_elf_index PARAMS ((bfd *, unsigned int));
|
||||
boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
|
||||
struct bfd_link_info *));
|
||||
struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void));
|
||||
boolean
|
||||
_bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *,
|
||||
struct elf_link_hash_entry *));
|
||||
boolean
|
||||
_bfd_elf_compute_section_file_positions PARAMS ((bfd *,
|
||||
struct bfd_link_info *));
|
||||
void _bfd_elf_assign_file_positions_for_relocs PARAMS ((bfd *));
|
||||
file_ptr _bfd_elf_assign_file_position_for_section PARAMS ((Elf_Internal_Shdr *,
|
||||
file_ptr,
|
||||
boolean));
|
||||
|
||||
boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
|
||||
struct bfd_link_info *));
|
||||
boolean _bfd_elf_create_got_section PARAMS ((bfd *,
|
||||
struct bfd_link_info *));
|
||||
|
||||
elf_linker_section_t *_bfd_elf_create_linker_section
|
||||
PARAMS ((bfd *abfd,
|
||||
struct bfd_link_info *info,
|
||||
enum elf_linker_section_enum,
|
||||
elf_linker_section_t *defaults));
|
||||
|
||||
elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
|
||||
PARAMS ((elf_linker_section_pointers_t *linker_pointers,
|
||||
bfd_signed_vma addend,
|
||||
elf_linker_section_enum_t which));
|
||||
|
||||
boolean bfd_elf32_create_pointer_linker_section
|
||||
PARAMS ((bfd *abfd,
|
||||
struct bfd_link_info *info,
|
||||
elf_linker_section_t *lsect,
|
||||
struct elf_link_hash_entry *h,
|
||||
const Elf32_Internal_Rela *rel));
|
||||
|
||||
bfd_vma bfd_elf32_finish_pointer_linker_section
|
||||
PARAMS ((bfd *output_abfd,
|
||||
bfd *input_bfd,
|
||||
struct bfd_link_info *info,
|
||||
elf_linker_section_t *lsect,
|
||||
struct elf_link_hash_entry *h,
|
||||
bfd_vma relocation,
|
||||
const Elf32_Internal_Rela *rel,
|
||||
int relative_reloc));
|
||||
|
||||
boolean bfd_elf64_create_pointer_linker_section
|
||||
PARAMS ((bfd *abfd,
|
||||
struct bfd_link_info *info,
|
||||
elf_linker_section_t *lsect,
|
||||
struct elf_link_hash_entry *h,
|
||||
const Elf64_Internal_Rela *rel));
|
||||
|
||||
bfd_vma bfd_elf64_finish_pointer_linker_section
|
||||
PARAMS ((bfd *output_abfd,
|
||||
bfd *input_bfd,
|
||||
struct bfd_link_info *info,
|
||||
elf_linker_section_t *lsect,
|
||||
struct elf_link_hash_entry *h,
|
||||
bfd_vma relocation,
|
||||
const Elf64_Internal_Rela *rel,
|
||||
int relative_reloc));
|
||||
|
||||
boolean _bfd_elf_make_linker_section_rela
|
||||
PARAMS ((bfd *dynobj,
|
||||
elf_linker_section_t *lsect,
|
||||
int alignment));
|
||||
|
||||
extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
|
||||
extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
|
||||
extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
|
||||
extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *));
|
||||
extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *,
|
||||
bfd *));
|
||||
|
||||
extern boolean bfd_elf32_bfd_link_add_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean bfd_elf32_bfd_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
extern void bfd_elf32_swap_symbol_in
|
||||
PARAMS ((bfd *, Elf32_External_Sym *, Elf_Internal_Sym *));
|
||||
extern void bfd_elf32_swap_symbol_out
|
||||
PARAMS ((bfd *, Elf_Internal_Sym *, PTR));
|
||||
extern void bfd_elf32_swap_reloc_in
|
||||
PARAMS ((bfd *, Elf32_External_Rel *, Elf_Internal_Rel *));
|
||||
extern void bfd_elf32_swap_reloc_out
|
||||
PARAMS ((bfd *, Elf_Internal_Rel *, Elf32_External_Rel *));
|
||||
extern void bfd_elf32_swap_reloca_in
|
||||
PARAMS ((bfd *, Elf32_External_Rela *, Elf_Internal_Rela *));
|
||||
extern void bfd_elf32_swap_reloca_out
|
||||
PARAMS ((bfd *, Elf_Internal_Rela *, Elf32_External_Rela *));
|
||||
extern void bfd_elf32_swap_phdr_in
|
||||
PARAMS ((bfd *, Elf32_External_Phdr *, Elf_Internal_Phdr *));
|
||||
extern void bfd_elf32_swap_phdr_out
|
||||
PARAMS ((bfd *, Elf_Internal_Phdr *, Elf32_External_Phdr *));
|
||||
extern void bfd_elf32_swap_dyn_in
|
||||
PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
|
||||
extern void bfd_elf32_swap_dyn_out
|
||||
PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf32_External_Dyn *));
|
||||
extern boolean bfd_elf32_add_dynamic_entry
|
||||
PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
|
||||
extern boolean bfd_elf32_link_create_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
extern const bfd_target *bfd_elf64_object_p PARAMS ((bfd *));
|
||||
extern const bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *));
|
||||
extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *));
|
||||
extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *));
|
||||
extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *,
|
||||
bfd *));
|
||||
extern boolean bfd_elf64_bfd_link_add_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean bfd_elf64_bfd_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
extern void bfd_elf64_swap_symbol_in
|
||||
PARAMS ((bfd *, Elf64_External_Sym *, Elf_Internal_Sym *));
|
||||
extern void bfd_elf64_swap_symbol_out
|
||||
PARAMS ((bfd *, Elf_Internal_Sym *, PTR));
|
||||
extern void bfd_elf64_swap_reloc_in
|
||||
PARAMS ((bfd *, Elf64_External_Rel *, Elf_Internal_Rel *));
|
||||
extern void bfd_elf64_swap_reloc_out
|
||||
PARAMS ((bfd *, Elf_Internal_Rel *, Elf64_External_Rel *));
|
||||
extern void bfd_elf64_swap_reloca_in
|
||||
PARAMS ((bfd *, Elf64_External_Rela *, Elf_Internal_Rela *));
|
||||
extern void bfd_elf64_swap_reloca_out
|
||||
PARAMS ((bfd *, Elf_Internal_Rela *, Elf64_External_Rela *));
|
||||
extern void bfd_elf64_swap_phdr_in
|
||||
PARAMS ((bfd *, Elf64_External_Phdr *, Elf_Internal_Phdr *));
|
||||
extern void bfd_elf64_swap_phdr_out
|
||||
PARAMS ((bfd *, Elf_Internal_Phdr *, Elf64_External_Phdr *));
|
||||
extern void bfd_elf64_swap_dyn_in
|
||||
PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
|
||||
extern void bfd_elf64_swap_dyn_out
|
||||
PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf64_External_Dyn *));
|
||||
extern boolean bfd_elf64_add_dynamic_entry
|
||||
PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
|
||||
extern boolean bfd_elf64_link_create_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
#define bfd_elf32_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
|
||||
#define bfd_elf64_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
|
||||
|
||||
#endif /* _LIBELF_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,319 +0,0 @@
|
||||
/* Generic BFD support for file formats.
|
||||
Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
SECTION
|
||||
File formats
|
||||
|
||||
A format is a BFD concept of high level file contents type. The
|
||||
formats supported by BFD are:
|
||||
|
||||
o <<bfd_object>>
|
||||
|
||||
The BFD may contain data, symbols, relocations and debug info.
|
||||
|
||||
o <<bfd_archive>>
|
||||
|
||||
The BFD contains other BFDs and an optional index.
|
||||
|
||||
o <<bfd_core>>
|
||||
|
||||
The BFD contains the result of an executable core dump.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
/* IMPORT from targets.c. */
|
||||
extern const size_t _bfd_target_vector_entries;
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_check_format
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_check_format(bfd *abfd, bfd_format format);
|
||||
|
||||
DESCRIPTION
|
||||
Verify if the file attached to the BFD @var{abfd} is compatible
|
||||
with the format @var{format} (i.e., one of <<bfd_object>>,
|
||||
<<bfd_archive>> or <<bfd_core>>).
|
||||
|
||||
If the BFD has been set to a specific target before the
|
||||
call, only the named target and format combination is
|
||||
checked. If the target has not been set, or has been set to
|
||||
<<default>>, then all the known target backends is
|
||||
interrogated to determine a match. If the default target
|
||||
matches, it is used. If not, exactly one target must recognize
|
||||
the file, or an error results.
|
||||
|
||||
The function returns <<true>> on success, otherwise <<false>>
|
||||
with one of the following error codes:
|
||||
|
||||
o <<bfd_error_invalid_operation>> -
|
||||
if <<format>> is not one of <<bfd_object>>, <<bfd_archive>> or
|
||||
<<bfd_core>>.
|
||||
|
||||
o <<bfd_error_system_call>> -
|
||||
if an error occured during a read - even some file mismatches
|
||||
can cause bfd_error_system_calls.
|
||||
|
||||
o <<file_not_recognised>> -
|
||||
none of the backends recognised the file format.
|
||||
|
||||
o <<bfd_error_file_ambiguously_recognized>> -
|
||||
more than one backend recognised the file format.
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_check_format (abfd, format)
|
||||
bfd *abfd;
|
||||
bfd_format format;
|
||||
{
|
||||
return bfd_check_format_matches (abfd, format, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_check_format_matches
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_check_format_matches(bfd *abfd, bfd_format format, char ***matching);
|
||||
|
||||
DESCRIPTION
|
||||
Like <<bfd_check_format>>, except when it returns false with
|
||||
<<bfd_errno>> set to <<bfd_error_file_ambiguously_recognized>>. In that
|
||||
case, if @var{matching} is not NULL, it will be filled in with
|
||||
a NULL-terminated list of the names of the formats that matched,
|
||||
allocated with <<malloc>>.
|
||||
Then the user may choose a format and try again.
|
||||
|
||||
When done with the list that @var{matching} points to, the caller
|
||||
should free it.
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_check_format_matches (abfd, format, matching)
|
||||
bfd *abfd;
|
||||
bfd_format format;
|
||||
char ***matching;
|
||||
{
|
||||
const bfd_target * const *target, *save_targ, *right_targ;
|
||||
char **matching_vector = NULL;
|
||||
int match_count;
|
||||
|
||||
if (!bfd_read_p (abfd) ||
|
||||
((int)(abfd->format) < (int)bfd_unknown) ||
|
||||
((int)(abfd->format) >= (int)bfd_type_end)) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (abfd->format != bfd_unknown)
|
||||
return (abfd->format == format)? true: false;
|
||||
|
||||
|
||||
/* Since the target type was defaulted, check them
|
||||
all in the hope that one will be uniquely recognized. */
|
||||
|
||||
save_targ = abfd->xvec;
|
||||
match_count = 0;
|
||||
if (matching)
|
||||
{
|
||||
matching_vector =
|
||||
(char **) bfd_malloc (sizeof (char *) *
|
||||
(_bfd_target_vector_entries + 1));
|
||||
if (!matching_vector)
|
||||
return false;
|
||||
matching_vector[0] = NULL;
|
||||
*matching = matching_vector;
|
||||
}
|
||||
right_targ = 0;
|
||||
|
||||
|
||||
/* presume the answer is yes */
|
||||
abfd->format = format;
|
||||
|
||||
/* If the target type was explicitly specified, just check that target. */
|
||||
|
||||
if (!abfd->target_defaulted) {
|
||||
if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0) /* rewind! */
|
||||
return false;
|
||||
right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
|
||||
if (right_targ) {
|
||||
abfd->xvec = right_targ; /* Set the target as returned */
|
||||
if (matching)
|
||||
free (matching_vector);
|
||||
return true; /* File position has moved, BTW */
|
||||
}
|
||||
}
|
||||
|
||||
for (target = bfd_target_vector; *target != NULL; target++) {
|
||||
extern const bfd_target binary_vec;
|
||||
const bfd_target *temp;
|
||||
|
||||
if (*target == &binary_vec)
|
||||
continue;
|
||||
|
||||
abfd->xvec = *target; /* Change BFD's target temporarily */
|
||||
if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0)
|
||||
return false;
|
||||
/* If _bfd_check_format neglects to set bfd_error, assume bfd_error_wrong_format.
|
||||
We didn't used to even pay any attention to bfd_error, so I suspect
|
||||
that some _bfd_check_format might have this problem. */
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
|
||||
if (temp) { /* This format checks out as ok! */
|
||||
right_targ = temp;
|
||||
if (matching)
|
||||
{
|
||||
matching_vector[match_count] = temp->name;
|
||||
matching_vector[match_count + 1] = NULL;
|
||||
}
|
||||
match_count++;
|
||||
/* If this is the default target, accept it, even if other targets
|
||||
might match. People who want those other targets have to set
|
||||
the GNUTARGET variable. */
|
||||
if (temp == bfd_default_vector[0])
|
||||
{
|
||||
if (matching)
|
||||
{
|
||||
matching_vector[0] = temp->name;
|
||||
matching_vector[1] = NULL;
|
||||
}
|
||||
match_count = 1;
|
||||
break;
|
||||
}
|
||||
#ifdef GNU960
|
||||
/* Big- and little-endian b.out archives look the same, but it doesn't
|
||||
* matter: there is no difference in their headers, and member file byte
|
||||
* orders will (I hope) be handled appropriately by bfd. Ditto for big
|
||||
* and little coff archives. And the 4 coff/b.out object formats are
|
||||
* unambiguous. So accept the first match we find.
|
||||
*/
|
||||
break;
|
||||
#endif
|
||||
} else if (bfd_get_error () != bfd_error_wrong_format) {
|
||||
abfd->xvec = save_targ;
|
||||
abfd->format = bfd_unknown;
|
||||
if (matching && bfd_get_error () != bfd_error_file_ambiguously_recognized)
|
||||
free (matching_vector);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (match_count == 1) {
|
||||
abfd->xvec = right_targ; /* Change BFD's target permanently */
|
||||
if (matching)
|
||||
free (matching_vector);
|
||||
return true; /* File position has moved, BTW */
|
||||
}
|
||||
|
||||
abfd->xvec = save_targ; /* Restore original target type */
|
||||
abfd->format = bfd_unknown; /* Restore original format */
|
||||
if (match_count == 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_file_not_recognized);
|
||||
if (matching)
|
||||
free (matching_vector);
|
||||
}
|
||||
else
|
||||
bfd_set_error (bfd_error_file_ambiguously_recognized);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_set_format
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_set_format(bfd *abfd, bfd_format format);
|
||||
|
||||
DESCRIPTION
|
||||
This function sets the file format of the BFD @var{abfd} to the
|
||||
format @var{format}. If the target set in the BFD does not
|
||||
support the format requested, the format is invalid, or the BFD
|
||||
is not open for writing, then an error occurs.
|
||||
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_set_format (abfd, format)
|
||||
bfd *abfd;
|
||||
bfd_format format;
|
||||
{
|
||||
|
||||
if (bfd_read_p (abfd) ||
|
||||
((int)abfd->format < (int)bfd_unknown) ||
|
||||
((int)abfd->format >= (int)bfd_type_end)) {
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (abfd->format != bfd_unknown)
|
||||
return (abfd->format == format) ? true:false;
|
||||
|
||||
/* presume the answer is yes */
|
||||
abfd->format = format;
|
||||
|
||||
if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd))) {
|
||||
abfd->format = bfd_unknown;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_format_string
|
||||
|
||||
SYNOPSIS
|
||||
CONST char *bfd_format_string(bfd_format format);
|
||||
|
||||
DESCRIPTION
|
||||
Return a pointer to a const string
|
||||
<<invalid>>, <<object>>, <<archive>>, <<core>>, or <<unknown>>,
|
||||
depending upon the value of @var{format}.
|
||||
*/
|
||||
|
||||
CONST char *
|
||||
bfd_format_string (format)
|
||||
bfd_format format;
|
||||
{
|
||||
if (((int)format <(int) bfd_unknown)
|
||||
|| ((int)format >=(int) bfd_type_end))
|
||||
return "invalid";
|
||||
|
||||
switch (format) {
|
||||
case bfd_object:
|
||||
return "object"; /* linker/assember/compiler output */
|
||||
case bfd_archive:
|
||||
return "archive"; /* object archive file */
|
||||
case bfd_core:
|
||||
return "core"; /* core dump */
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
/* BFD back-end definitions used by all FreeBSD targets.
|
||||
Copyright (C) 1990, 1991, 1992, 1996 Free Software Foundation, Inc.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* FreeBSD ZMAGIC files never have the header in the text. */
|
||||
#define N_HEADER_IN_TEXT(x) 0
|
||||
|
||||
/* A ZMAGIC file can start at almost any address if it is a kernel. */
|
||||
#define TEXT_START_ADDR dont use TEXT_START_ADDR
|
||||
|
||||
/* The following definitions are essentially the same as the ones in
|
||||
FreeBSD's <sys/imgact_aout.h>. They override gdb's versions, which
|
||||
don't work for kernels. See ../include/aout/aout64.h. */
|
||||
#define N_TXTADDR(x) \
|
||||
(N_GETMAGIC(x) == OMAGIC || N_GETMAGIC(x) == NMAGIC \
|
||||
|| N_GETMAGIC(x) == ZMAGIC \
|
||||
? ((x).a_entry < (x).a_text ? 0 : (x).a_entry & ~TARGET_PAGE_SIZE) \
|
||||
: TARGET_PAGE_SIZE)
|
||||
#define N_TXTOFF(x) \
|
||||
(N_GETMAGIC(x) == ZMAGIC ? TARGET_PAGE_SIZE \
|
||||
: (N_GETMAGIC(x) == QMAGIC || N_GETMAGIC_NET(x) == ZMAGIC) ? 0 \
|
||||
: sizeof(struct external_exec))
|
||||
#define N_TXTSIZE(x) ((x).a_text)
|
||||
|
||||
#define N_GETMAGIC(exec) \
|
||||
((exec).a_info & 0xffff)
|
||||
#define N_GETMAGIC_NET(exec) \
|
||||
(ntohl ((exec).a_info) & 0xffff)
|
||||
#define N_GETMID_NET(exec) \
|
||||
((ntohl ((exec).a_info) >> 16) & 0x3ff)
|
||||
#define N_GETFLAG_NET(ex) \
|
||||
((ntohl ((exec).a_info) >> 26) & 0x3f)
|
||||
|
||||
#define N_MACHTYPE(exec) \
|
||||
((enum machine_type) \
|
||||
((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETMID_NET (exec) : \
|
||||
((exec).a_info >> 16) & 0x3ff))
|
||||
#define N_FLAGS(exec) \
|
||||
((N_GETMAGIC_NET (exec) == ZMAGIC) ? N_GETFLAG_NET (exec) : \
|
||||
((exec).a_info >> 26) & 0x3f)
|
||||
|
||||
#define N_SET_INFO(exec, magic, type, flags) \
|
||||
((exec).a_info = ((magic) & 0xffff) \
|
||||
| (((int)(type) & 0x3ff) << 16) \
|
||||
| (((flags) & 0x3f) << 26))
|
||||
#define N_SET_MACHTYPE(exec, machtype) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info & 0xfb00ffff) | ((((int)(machtype))&0x3ff) << 16))
|
||||
#define N_SET_FLAGS(exec, flags) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "libaout.h"
|
||||
|
||||
/* On FreeBSD, the magic number is always in correct endian format */
|
||||
#define NO_SWAP_MAGIC
|
||||
|
||||
|
||||
#define MY_write_object_contents MY(write_object_contents)
|
||||
static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
|
||||
|
||||
#include "aout-target.h"
|
||||
|
||||
/* Write an object file.
|
||||
Section contents have already been written. We write the
|
||||
file header, symbols, and relocation. */
|
||||
|
||||
static boolean
|
||||
MY(write_object_contents) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
#if CHOOSE_RELOC_SIZE
|
||||
CHOOSE_RELOC_SIZE(abfd);
|
||||
#else
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
#endif
|
||||
|
||||
/* Magic number, maestro, please! */
|
||||
switch (bfd_get_arch(abfd)) {
|
||||
case bfd_arch_m68k:
|
||||
if (strcmp (abfd->xvec->name, "a.out-m68k4k-netbsd") == 0)
|
||||
N_SET_MACHTYPE(*execp, M_68K4K_NETBSD);
|
||||
else
|
||||
N_SET_MACHTYPE(*execp, M_68K_NETBSD);
|
||||
break;
|
||||
case bfd_arch_sparc:
|
||||
N_SET_MACHTYPE(*execp, M_SPARC_NETBSD);
|
||||
break;
|
||||
case bfd_arch_i386:
|
||||
N_SET_MACHTYPE(*execp, M_386_NETBSD);
|
||||
break;
|
||||
case bfd_arch_ns32k:
|
||||
N_SET_MACHTYPE(*execp, M_532_NETBSD);
|
||||
break;
|
||||
default:
|
||||
N_SET_MACHTYPE(*execp, M_UNKNOWN);
|
||||
break;
|
||||
}
|
||||
|
||||
WRITE_HEADERS(abfd, execp);
|
||||
|
||||
return true;
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
/* genlink.h -- interface to the BFD generic linker
|
||||
Copyright 1993, 1994 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef GENLINK_H
|
||||
#define GENLINK_H
|
||||
|
||||
/* This header file is internal to BFD. It describes the internal
|
||||
structures and functions used by the BFD generic linker, in case
|
||||
any of the more specific linkers want to use or call them. Note
|
||||
that some functions, such as _bfd_generic_link_hash_table_create,
|
||||
are declared in libbfd.h, because they are expected to be widely
|
||||
used. The functions and structures in this file will probably only
|
||||
be used by a few files besides linker.c itself. In fact, this file
|
||||
is not particularly complete; I have only put in the interfaces I
|
||||
actually needed. */
|
||||
|
||||
/* The generic linker uses a hash table which is a derived class of
|
||||
the standard linker hash table, just as the other backend specific
|
||||
linkers do. Do not confuse the generic linker hash table with the
|
||||
standard BFD linker hash table it is built upon. */
|
||||
|
||||
/* Generic linker hash table entries. */
|
||||
|
||||
struct generic_link_hash_entry
|
||||
{
|
||||
struct bfd_link_hash_entry root;
|
||||
/* Whether this symbol has been written out. */
|
||||
boolean written;
|
||||
/* Symbol from input BFD. */
|
||||
asymbol *sym;
|
||||
};
|
||||
|
||||
/* Generic linker hash table. */
|
||||
|
||||
struct generic_link_hash_table
|
||||
{
|
||||
struct bfd_link_hash_table root;
|
||||
};
|
||||
|
||||
/* Look up an entry in an generic link hash table. */
|
||||
|
||||
#define _bfd_generic_link_hash_lookup(table, string, create, copy, follow) \
|
||||
((struct generic_link_hash_entry *) \
|
||||
bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
|
||||
|
||||
/* Traverse an generic link hash table. */
|
||||
|
||||
#define _bfd_generic_link_hash_traverse(table, func, info) \
|
||||
(bfd_link_hash_traverse \
|
||||
(&(table)->root, \
|
||||
(boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
||||
(info)))
|
||||
|
||||
/* Get the generic link hash table from the info structure. This is
|
||||
just a cast. */
|
||||
|
||||
#define _bfd_generic_hash_table(p) \
|
||||
((struct generic_link_hash_table *) ((p)->hash))
|
||||
|
||||
/* The generic linker reads in the asymbol structures for an input BFD
|
||||
and keeps them in the outsymbol and symcount fields. */
|
||||
|
||||
#define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols)
|
||||
#define _bfd_generic_link_get_symcount(abfd) ((abfd)->symcount)
|
||||
|
||||
/* Add the symbols of input_bfd to the symbols being built for
|
||||
output_bfd. */
|
||||
extern boolean _bfd_generic_link_output_symbols
|
||||
PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
|
||||
size_t *psymalloc));
|
||||
|
||||
/* This structure is used to pass information to
|
||||
_bfd_generic_link_write_global_symbol, which may be called via
|
||||
_bfd_generic_link_hash_traverse. */
|
||||
|
||||
struct generic_write_global_symbol_info
|
||||
{
|
||||
struct bfd_link_info *info;
|
||||
bfd *output_bfd;
|
||||
size_t *psymalloc;
|
||||
};
|
||||
|
||||
/* Write out a single global symbol. This is expected to be called
|
||||
via _bfd_generic_link_hash_traverse. The second argument must
|
||||
actually be a struct generic_write_global_symbol_info *. */
|
||||
extern boolean _bfd_generic_link_write_global_symbol
|
||||
PARAMS ((struct generic_link_hash_entry *, PTR));
|
||||
|
||||
#endif
|
@ -1,734 +0,0 @@
|
||||
/* hash.c -- hash table routines for BFD
|
||||
Copyright (C) 1993, 94 Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain <sac@cygnus.com>
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "obstack.h"
|
||||
|
||||
/*
|
||||
SECTION
|
||||
Hash Tables
|
||||
|
||||
@cindex Hash tables
|
||||
BFD provides a simple set of hash table functions. Routines
|
||||
are provided to initialize a hash table, to free a hash table,
|
||||
to look up a string in a hash table and optionally create an
|
||||
entry for it, and to traverse a hash table. There is
|
||||
currently no routine to delete an string from a hash table.
|
||||
|
||||
The basic hash table does not permit any data to be stored
|
||||
with a string. However, a hash table is designed to present a
|
||||
base class from which other types of hash tables may be
|
||||
derived. These derived types may store additional information
|
||||
with the string. Hash tables were implemented in this way,
|
||||
rather than simply providing a data pointer in a hash table
|
||||
entry, because they were designed for use by the linker back
|
||||
ends. The linker may create thousands of hash table entries,
|
||||
and the overhead of allocating private data and storing and
|
||||
following pointers becomes noticeable.
|
||||
|
||||
The basic hash table code is in <<hash.c>>.
|
||||
|
||||
@menu
|
||||
@* Creating and Freeing a Hash Table::
|
||||
@* Looking Up or Entering a String::
|
||||
@* Traversing a Hash Table::
|
||||
@* Deriving a New Hash Table Type::
|
||||
@end menu
|
||||
|
||||
INODE
|
||||
Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables
|
||||
SUBSECTION
|
||||
Creating and freeing a hash table
|
||||
|
||||
@findex bfd_hash_table_init
|
||||
@findex bfd_hash_table_init_n
|
||||
To create a hash table, create an instance of a <<struct
|
||||
bfd_hash_table>> (defined in <<bfd.h>>) and call
|
||||
<<bfd_hash_table_init>> (if you know approximately how many
|
||||
entries you will need, the function <<bfd_hash_table_init_n>>,
|
||||
which takes a @var{size} argument, may be used).
|
||||
<<bfd_hash_table_init>> returns <<false>> if some sort of
|
||||
error occurs.
|
||||
|
||||
@findex bfd_hash_newfunc
|
||||
The function <<bfd_hash_table_init>> take as an argument a
|
||||
function to use to create new entries. For a basic hash
|
||||
table, use the function <<bfd_hash_newfunc>>. @xref{Deriving
|
||||
a New Hash Table Type} for why you would want to use a
|
||||
different value for this argument.
|
||||
|
||||
@findex bfd_hash_allocate
|
||||
<<bfd_hash_table_init>> will create an obstack which will be
|
||||
used to allocate new entries. You may allocate memory on this
|
||||
obstack using <<bfd_hash_allocate>>.
|
||||
|
||||
@findex bfd_hash_table_free
|
||||
Use <<bfd_hash_table_free>> to free up all the memory that has
|
||||
been allocated for a hash table. This will not free up the
|
||||
<<struct bfd_hash_table>> itself, which you must provide.
|
||||
|
||||
INODE
|
||||
Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables
|
||||
SUBSECTION
|
||||
Looking up or entering a string
|
||||
|
||||
@findex bfd_hash_lookup
|
||||
The function <<bfd_hash_lookup>> is used both to look up a
|
||||
string in the hash table and to create a new entry.
|
||||
|
||||
If the @var{create} argument is <<false>>, <<bfd_hash_lookup>>
|
||||
will look up a string. If the string is found, it will
|
||||
returns a pointer to a <<struct bfd_hash_entry>>. If the
|
||||
string is not found in the table <<bfd_hash_lookup>> will
|
||||
return <<NULL>>. You should not modify any of the fields in
|
||||
the returns <<struct bfd_hash_entry>>.
|
||||
|
||||
If the @var{create} argument is <<true>>, the string will be
|
||||
entered into the hash table if it is not already there.
|
||||
Either way a pointer to a <<struct bfd_hash_entry>> will be
|
||||
returned, either to the existing structure or to a newly
|
||||
created one. In this case, a <<NULL>> return means that an
|
||||
error occurred.
|
||||
|
||||
If the @var{create} argument is <<true>>, and a new entry is
|
||||
created, the @var{copy} argument is used to decide whether to
|
||||
copy the string onto the hash table obstack or not. If
|
||||
@var{copy} is passed as <<false>>, you must be careful not to
|
||||
deallocate or modify the string as long as the hash table
|
||||
exists.
|
||||
|
||||
INODE
|
||||
Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables
|
||||
SUBSECTION
|
||||
Traversing a hash table
|
||||
|
||||
@findex bfd_hash_traverse
|
||||
The function <<bfd_hash_traverse>> may be used to traverse a
|
||||
hash table, calling a function on each element. The traversal
|
||||
is done in a random order.
|
||||
|
||||
<<bfd_hash_traverse>> takes as arguments a function and a
|
||||
generic <<void *>> pointer. The function is called with a
|
||||
hash table entry (a <<struct bfd_hash_entry *>>) and the
|
||||
generic pointer passed to <<bfd_hash_traverse>>. The function
|
||||
must return a <<boolean>> value, which indicates whether to
|
||||
continue traversing the hash table. If the function returns
|
||||
<<false>>, <<bfd_hash_traverse>> will stop the traversal and
|
||||
return immediately.
|
||||
|
||||
INODE
|
||||
Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables
|
||||
SUBSECTION
|
||||
Deriving a new hash table type
|
||||
|
||||
Many uses of hash tables want to store additional information
|
||||
which each entry in the hash table. Some also find it
|
||||
convenient to store additional information with the hash table
|
||||
itself. This may be done using a derived hash table.
|
||||
|
||||
Since C is not an object oriented language, creating a derived
|
||||
hash table requires sticking together some boilerplate
|
||||
routines with a few differences specific to the type of hash
|
||||
table you want to create.
|
||||
|
||||
An example of a derived hash table is the linker hash table.
|
||||
The structures for this are defined in <<bfdlink.h>>. The
|
||||
functions are in <<linker.c>>.
|
||||
|
||||
You may also derive a hash table from an already derived hash
|
||||
table. For example, the a.out linker backend code uses a hash
|
||||
table derived from the linker hash table.
|
||||
|
||||
@menu
|
||||
@* Define the Derived Structures::
|
||||
@* Write the Derived Creation Routine::
|
||||
@* Write Other Derived Routines::
|
||||
@end menu
|
||||
|
||||
INODE
|
||||
Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type
|
||||
SUBSUBSECTION
|
||||
Define the derived structures
|
||||
|
||||
You must define a structure for an entry in the hash table,
|
||||
and a structure for the hash table itself.
|
||||
|
||||
The first field in the structure for an entry in the hash
|
||||
table must be of the type used for an entry in the hash table
|
||||
you are deriving from. If you are deriving from a basic hash
|
||||
table this is <<struct bfd_hash_entry>>, which is defined in
|
||||
<<bfd.h>>. The first field in the structure for the hash
|
||||
table itself must be of the type of the hash table you are
|
||||
deriving from itself. If you are deriving from a basic hash
|
||||
table, this is <<struct bfd_hash_table>>.
|
||||
|
||||
For example, the linker hash table defines <<struct
|
||||
bfd_link_hash_entry>> (in <<bfdlink.h>>). The first field,
|
||||
<<root>>, is of type <<struct bfd_hash_entry>>. Similarly,
|
||||
the first field in <<struct bfd_link_hash_table>>, <<table>>,
|
||||
is of type <<struct bfd_hash_table>>.
|
||||
|
||||
INODE
|
||||
Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type
|
||||
SUBSUBSECTION
|
||||
Write the derived creation routine
|
||||
|
||||
You must write a routine which will create and initialize an
|
||||
entry in the hash table. This routine is passed as the
|
||||
function argument to <<bfd_hash_table_init>>.
|
||||
|
||||
In order to permit other hash tables to be derived from the
|
||||
hash table you are creating, this routine must be written in a
|
||||
standard way.
|
||||
|
||||
The first argument to the creation routine is a pointer to a
|
||||
hash table entry. This may be <<NULL>>, in which case the
|
||||
routine should allocate the right amount of space. Otherwise
|
||||
the space has already been allocated by a hash table type
|
||||
derived from this one.
|
||||
|
||||
After allocating space, the creation routine must call the
|
||||
creation routine of the hash table type it is derived from,
|
||||
passing in a pointer to the space it just allocated. This
|
||||
will initialize any fields used by the base hash table.
|
||||
|
||||
Finally the creation routine must initialize any local fields
|
||||
for the new hash table type.
|
||||
|
||||
Here is a boilerplate example of a creation routine.
|
||||
@var{function_name} is the name of the routine.
|
||||
@var{entry_type} is the type of an entry in the hash table you
|
||||
are creating. @var{base_newfunc} is the name of the creation
|
||||
routine of the hash table type your hash table is derived
|
||||
from.
|
||||
|
||||
EXAMPLE
|
||||
|
||||
.struct bfd_hash_entry *
|
||||
.@var{function_name} (entry, table, string)
|
||||
. struct bfd_hash_entry *entry;
|
||||
. struct bfd_hash_table *table;
|
||||
. const char *string;
|
||||
.{
|
||||
. struct @var{entry_type} *ret = (@var{entry_type} *) entry;
|
||||
.
|
||||
. {* Allocate the structure if it has not already been allocated by a
|
||||
. derived class. *}
|
||||
. if (ret == (@var{entry_type} *) NULL)
|
||||
. {
|
||||
. ret = ((@var{entry_type} *)
|
||||
. bfd_hash_allocate (table, sizeof (@var{entry_type})));
|
||||
. if (ret == (@var{entry_type} *) NULL)
|
||||
. return NULL;
|
||||
. }
|
||||
.
|
||||
. {* Call the allocation method of the base class. *}
|
||||
. ret = ((@var{entry_type} *)
|
||||
. @var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string));
|
||||
.
|
||||
. {* Initialize the local fields here. *}
|
||||
.
|
||||
. return (struct bfd_hash_entry *) ret;
|
||||
.}
|
||||
|
||||
DESCRIPTION
|
||||
The creation routine for the linker hash table, which is in
|
||||
<<linker.c>>, looks just like this example.
|
||||
@var{function_name} is <<_bfd_link_hash_newfunc>>.
|
||||
@var{entry_type} is <<struct bfd_link_hash_entry>>.
|
||||
@var{base_newfunc} is <<bfd_hash_newfunc>>, the creation
|
||||
routine for a basic hash table.
|
||||
|
||||
<<_bfd_link_hash_newfunc>> also initializes the local fields
|
||||
in a linker hash table entry: <<type>>, <<written>> and
|
||||
<<next>>.
|
||||
|
||||
INODE
|
||||
Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type
|
||||
SUBSUBSECTION
|
||||
Write other derived routines
|
||||
|
||||
You will want to write other routines for your new hash table,
|
||||
as well.
|
||||
|
||||
You will want an initialization routine which calls the
|
||||
initialization routine of the hash table you are deriving from
|
||||
and initializes any other local fields. For the linker hash
|
||||
table, this is <<_bfd_link_hash_table_init>> in <<linker.c>>.
|
||||
|
||||
You will want a lookup routine which calls the lookup routine
|
||||
of the hash table you are deriving from and casts the result.
|
||||
The linker hash table uses <<bfd_link_hash_lookup>> in
|
||||
<<linker.c>> (this actually takes an additional argument which
|
||||
it uses to decide how to return the looked up value).
|
||||
|
||||
You may want a traversal routine. This should just call the
|
||||
traversal routine of the hash table you are deriving from with
|
||||
appropriate casts. The linker hash table uses
|
||||
<<bfd_link_hash_traverse>> in <<linker.c>>.
|
||||
|
||||
These routines may simply be defined as macros. For example,
|
||||
the a.out backend linker hash table, which is derived from the
|
||||
linker hash table, uses macros for the lookup and traversal
|
||||
routines. These are <<aout_link_hash_lookup>> and
|
||||
<<aout_link_hash_traverse>> in aoutx.h.
|
||||
*/
|
||||
|
||||
/* Obstack allocation and deallocation routines. */
|
||||
#define obstack_chunk_alloc malloc
|
||||
#define obstack_chunk_free free
|
||||
|
||||
/* The default number of entries to use when creating a hash table. */
|
||||
#define DEFAULT_SIZE (4051)
|
||||
|
||||
/* Create a new hash table, given a number of entries. */
|
||||
|
||||
boolean
|
||||
bfd_hash_table_init_n (table, newfunc, size)
|
||||
struct bfd_hash_table *table;
|
||||
struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
|
||||
struct bfd_hash_table *,
|
||||
const char *));
|
||||
unsigned int size;
|
||||
{
|
||||
unsigned int alloc;
|
||||
|
||||
alloc = size * sizeof (struct bfd_hash_entry *);
|
||||
if (!obstack_begin (&table->memory, alloc))
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
table->table = ((struct bfd_hash_entry **)
|
||||
obstack_alloc (&table->memory, alloc));
|
||||
if (!table->table)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return false;
|
||||
}
|
||||
memset ((PTR) table->table, 0, alloc);
|
||||
table->size = size;
|
||||
table->newfunc = newfunc;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Create a new hash table with the default number of entries. */
|
||||
|
||||
boolean
|
||||
bfd_hash_table_init (table, newfunc)
|
||||
struct bfd_hash_table *table;
|
||||
struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
|
||||
struct bfd_hash_table *,
|
||||
const char *));
|
||||
{
|
||||
return bfd_hash_table_init_n (table, newfunc, DEFAULT_SIZE);
|
||||
}
|
||||
|
||||
/* Free a hash table. */
|
||||
|
||||
void
|
||||
bfd_hash_table_free (table)
|
||||
struct bfd_hash_table *table;
|
||||
{
|
||||
obstack_free (&table->memory, (PTR) NULL);
|
||||
}
|
||||
|
||||
/* Look up a string in a hash table. */
|
||||
|
||||
struct bfd_hash_entry *
|
||||
bfd_hash_lookup (table, string, create, copy)
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
boolean create;
|
||||
boolean copy;
|
||||
{
|
||||
register const unsigned char *s;
|
||||
register unsigned long hash;
|
||||
register unsigned int c;
|
||||
struct bfd_hash_entry *hashp;
|
||||
unsigned int len;
|
||||
unsigned int index;
|
||||
|
||||
hash = 0;
|
||||
len = 0;
|
||||
s = (const unsigned char *) string;
|
||||
while ((c = *s++) != '\0')
|
||||
{
|
||||
hash += c + (c << 17);
|
||||
hash ^= hash >> 2;
|
||||
++len;
|
||||
}
|
||||
hash += len + (len << 17);
|
||||
hash ^= hash >> 2;
|
||||
|
||||
index = hash % table->size;
|
||||
for (hashp = table->table[index];
|
||||
hashp != (struct bfd_hash_entry *) NULL;
|
||||
hashp = hashp->next)
|
||||
{
|
||||
if (hashp->hash == hash
|
||||
&& strcmp (hashp->string, string) == 0)
|
||||
return hashp;
|
||||
}
|
||||
|
||||
if (! create)
|
||||
return (struct bfd_hash_entry *) NULL;
|
||||
|
||||
hashp = (*table->newfunc) ((struct bfd_hash_entry *) NULL, table, string);
|
||||
if (hashp == (struct bfd_hash_entry *) NULL)
|
||||
return (struct bfd_hash_entry *) NULL;
|
||||
if (copy)
|
||||
{
|
||||
char *new;
|
||||
|
||||
new = (char *) obstack_alloc (&table->memory, len + 1);
|
||||
if (!new)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return (struct bfd_hash_entry *) NULL;
|
||||
}
|
||||
strcpy (new, string);
|
||||
string = new;
|
||||
}
|
||||
hashp->string = string;
|
||||
hashp->hash = hash;
|
||||
hashp->next = table->table[index];
|
||||
table->table[index] = hashp;
|
||||
|
||||
return hashp;
|
||||
}
|
||||
|
||||
/* Replace an entry in a hash table. */
|
||||
|
||||
void
|
||||
bfd_hash_replace (table, old, nw)
|
||||
struct bfd_hash_table *table;
|
||||
struct bfd_hash_entry *old;
|
||||
struct bfd_hash_entry *nw;
|
||||
{
|
||||
unsigned int index;
|
||||
struct bfd_hash_entry **pph;
|
||||
|
||||
index = old->hash % table->size;
|
||||
for (pph = &table->table[index];
|
||||
(*pph) != (struct bfd_hash_entry *) NULL;
|
||||
pph = &(*pph)->next)
|
||||
{
|
||||
if (*pph == old)
|
||||
{
|
||||
*pph = nw;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Base method for creating a new hash table entry. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
struct bfd_hash_entry *
|
||||
bfd_hash_newfunc (entry, table, string)
|
||||
struct bfd_hash_entry *entry;
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
{
|
||||
if (entry == (struct bfd_hash_entry *) NULL)
|
||||
entry = ((struct bfd_hash_entry *)
|
||||
bfd_hash_allocate (table, sizeof (struct bfd_hash_entry)));
|
||||
return entry;
|
||||
}
|
||||
|
||||
/* Allocate space in a hash table. */
|
||||
|
||||
PTR
|
||||
bfd_hash_allocate (table, size)
|
||||
struct bfd_hash_table *table;
|
||||
unsigned int size;
|
||||
{
|
||||
PTR ret;
|
||||
|
||||
ret = obstack_alloc (&table->memory, size);
|
||||
if (ret == NULL && size != 0)
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Traverse a hash table. */
|
||||
|
||||
void
|
||||
bfd_hash_traverse (table, func, info)
|
||||
struct bfd_hash_table *table;
|
||||
boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR));
|
||||
PTR info;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < table->size; i++)
|
||||
{
|
||||
struct bfd_hash_entry *p;
|
||||
|
||||
for (p = table->table[i]; p != NULL; p = p->next)
|
||||
{
|
||||
if (! (*func) (p, info))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* A few different object file formats (a.out, COFF, ELF) use a string
|
||||
table. These functions support adding strings to a string table,
|
||||
returning the byte offset, and writing out the table.
|
||||
|
||||
Possible improvements:
|
||||
+ look for strings matching trailing substrings of other strings
|
||||
+ better data structures? balanced trees?
|
||||
+ look at reducing memory use elsewhere -- maybe if we didn't have
|
||||
to construct the entire symbol table at once, we could get by
|
||||
with smaller amounts of VM? (What effect does that have on the
|
||||
string table reductions?) */
|
||||
|
||||
/* An entry in the strtab hash table. */
|
||||
|
||||
struct strtab_hash_entry
|
||||
{
|
||||
struct bfd_hash_entry root;
|
||||
/* Index in string table. */
|
||||
bfd_size_type index;
|
||||
/* Next string in strtab. */
|
||||
struct strtab_hash_entry *next;
|
||||
};
|
||||
|
||||
/* The strtab hash table. */
|
||||
|
||||
struct bfd_strtab_hash
|
||||
{
|
||||
struct bfd_hash_table table;
|
||||
/* Size of strtab--also next available index. */
|
||||
bfd_size_type size;
|
||||
/* First string in strtab. */
|
||||
struct strtab_hash_entry *first;
|
||||
/* Last string in strtab. */
|
||||
struct strtab_hash_entry *last;
|
||||
/* Whether to precede strings with a two byte length, as in the
|
||||
XCOFF .debug section. */
|
||||
boolean xcoff;
|
||||
};
|
||||
|
||||
static struct bfd_hash_entry *strtab_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
|
||||
/* Routine to create an entry in a strtab. */
|
||||
|
||||
static struct bfd_hash_entry *
|
||||
strtab_hash_newfunc (entry, table, string)
|
||||
struct bfd_hash_entry *entry;
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
{
|
||||
struct strtab_hash_entry *ret = (struct strtab_hash_entry *) entry;
|
||||
|
||||
/* Allocate the structure if it has not already been allocated by a
|
||||
subclass. */
|
||||
if (ret == (struct strtab_hash_entry *) NULL)
|
||||
ret = ((struct strtab_hash_entry *)
|
||||
bfd_hash_allocate (table, sizeof (struct strtab_hash_entry)));
|
||||
if (ret == (struct strtab_hash_entry *) NULL)
|
||||
return NULL;
|
||||
|
||||
/* Call the allocation method of the superclass. */
|
||||
ret = ((struct strtab_hash_entry *)
|
||||
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
|
||||
|
||||
if (ret)
|
||||
{
|
||||
/* Initialize the local fields. */
|
||||
ret->index = (bfd_size_type) -1;
|
||||
ret->next = NULL;
|
||||
}
|
||||
|
||||
return (struct bfd_hash_entry *) ret;
|
||||
}
|
||||
|
||||
/* Look up an entry in an strtab. */
|
||||
|
||||
#define strtab_hash_lookup(t, string, create, copy) \
|
||||
((struct strtab_hash_entry *) \
|
||||
bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
|
||||
|
||||
/* Create a new strtab. */
|
||||
|
||||
struct bfd_strtab_hash *
|
||||
_bfd_stringtab_init ()
|
||||
{
|
||||
struct bfd_strtab_hash *table;
|
||||
|
||||
table = ((struct bfd_strtab_hash *)
|
||||
bfd_malloc (sizeof (struct bfd_strtab_hash)));
|
||||
if (table == NULL)
|
||||
return NULL;
|
||||
|
||||
if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc))
|
||||
{
|
||||
free (table);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
table->size = 0;
|
||||
table->first = NULL;
|
||||
table->last = NULL;
|
||||
table->xcoff = false;
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
/* Create a new strtab in which the strings are output in the format
|
||||
used in the XCOFF .debug section: a two byte length precedes each
|
||||
string. */
|
||||
|
||||
struct bfd_strtab_hash *
|
||||
_bfd_xcoff_stringtab_init ()
|
||||
{
|
||||
struct bfd_strtab_hash *ret;
|
||||
|
||||
ret = _bfd_stringtab_init ();
|
||||
if (ret != NULL)
|
||||
ret->xcoff = true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Free a strtab. */
|
||||
|
||||
void
|
||||
_bfd_stringtab_free (table)
|
||||
struct bfd_strtab_hash *table;
|
||||
{
|
||||
bfd_hash_table_free (&table->table);
|
||||
free (table);
|
||||
}
|
||||
|
||||
/* Get the index of a string in a strtab, adding it if it is not
|
||||
already present. If HASH is false, we don't really use the hash
|
||||
table, and we don't eliminate duplicate strings. */
|
||||
|
||||
bfd_size_type
|
||||
_bfd_stringtab_add (tab, str, hash, copy)
|
||||
struct bfd_strtab_hash *tab;
|
||||
const char *str;
|
||||
boolean hash;
|
||||
boolean copy;
|
||||
{
|
||||
register struct strtab_hash_entry *entry;
|
||||
|
||||
if (hash)
|
||||
{
|
||||
entry = strtab_hash_lookup (tab, str, true, copy);
|
||||
if (entry == NULL)
|
||||
return (bfd_size_type) -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = ((struct strtab_hash_entry *)
|
||||
bfd_hash_allocate (&tab->table,
|
||||
sizeof (struct strtab_hash_entry)));
|
||||
if (entry == NULL)
|
||||
return (bfd_size_type) -1;
|
||||
if (! copy)
|
||||
entry->root.string = str;
|
||||
else
|
||||
{
|
||||
char *n;
|
||||
|
||||
n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
|
||||
if (n == NULL)
|
||||
return (bfd_size_type) -1;
|
||||
entry->root.string = n;
|
||||
}
|
||||
entry->index = (bfd_size_type) -1;
|
||||
entry->next = NULL;
|
||||
}
|
||||
|
||||
if (entry->index == (bfd_size_type) -1)
|
||||
{
|
||||
entry->index = tab->size;
|
||||
tab->size += strlen (str) + 1;
|
||||
if (tab->xcoff)
|
||||
{
|
||||
entry->index += 2;
|
||||
tab->size += 2;
|
||||
}
|
||||
if (tab->first == NULL)
|
||||
tab->first = entry;
|
||||
else
|
||||
tab->last->next = entry;
|
||||
tab->last = entry;
|
||||
}
|
||||
|
||||
return entry->index;
|
||||
}
|
||||
|
||||
/* Get the number of bytes in a strtab. */
|
||||
|
||||
bfd_size_type
|
||||
_bfd_stringtab_size (tab)
|
||||
struct bfd_strtab_hash *tab;
|
||||
{
|
||||
return tab->size;
|
||||
}
|
||||
|
||||
/* Write out a strtab. ABFD must already be at the right location in
|
||||
the file. */
|
||||
|
||||
boolean
|
||||
_bfd_stringtab_emit (abfd, tab)
|
||||
register bfd *abfd;
|
||||
struct bfd_strtab_hash *tab;
|
||||
{
|
||||
register boolean xcoff;
|
||||
register struct strtab_hash_entry *entry;
|
||||
|
||||
xcoff = tab->xcoff;
|
||||
|
||||
for (entry = tab->first; entry != NULL; entry = entry->next)
|
||||
{
|
||||
register const char *str;
|
||||
register size_t len;
|
||||
|
||||
str = entry->root.string;
|
||||
len = strlen (str) + 1;
|
||||
|
||||
if (xcoff)
|
||||
{
|
||||
bfd_byte buf[2];
|
||||
|
||||
/* The output length includes the null byte. */
|
||||
bfd_put_16 (abfd, len, buf);
|
||||
if (bfd_write ((PTR) buf, 1, 2, abfd) != 2)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bfd_write ((PTR) str, 1, len, abfd) != len)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
/* Linux dumps "struct task_struct" at the end of the core-file. This
|
||||
structure is currently 920 bytes long, but we allow up to 1024
|
||||
bytes to allow for some future growth. */
|
||||
#define TRAD_CORE_EXTRA_SIZE_ALLOWED 1024
|
||||
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
|
||||
((abfd)->tdata.trad_core_data->u.signal)
|
@ -1,17 +0,0 @@
|
||||
/* Hopefully this should include either machine/param.h (Ultrix) or
|
||||
machine/machparam.h (Mach), whichever is its name on this system. */
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <machine/vmparam.h>
|
||||
|
||||
#define HOST_PAGE_SIZE NBPG
|
||||
/* #define HOST_SEGMENT_SIZE NBPG -- we use HOST_DATA_START_ADDR */
|
||||
#define HOST_MACHINE_ARCH bfd_arch_mips
|
||||
/* #define HOST_MACHINE_MACHINE */
|
||||
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_DATA_START_ADDR USRDATA
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
||||
|
||||
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
|
||||
((core_bfd)->tdata.trad_core_data->u.u_arg[0])
|
@ -1,18 +0,0 @@
|
||||
/* Definitions for a Motorola Delta 3300 box running System V R3.0.
|
||||
Contributed by manfred@lts.sel.alcatel.de. */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
/* Definitions used by trad-core.c. */
|
||||
#define NBPG NBPC
|
||||
#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg
|
||||
#define HOST_TEXT_START_ADDR u.u_exdata.ux_txtorg
|
||||
#if 0
|
||||
#define HOST_STACK_END_ADDR 0x40000000
|
||||
#else
|
||||
/* User's stack, copied from sys/param.h */
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
||||
#endif
|
||||
#define UPAGES USIZE
|
||||
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
|
||||
abfd->tdata.trad_core_data->u.u_abort
|
@ -1,8 +0,0 @@
|
||||
/* Definitions that are needed for core files. Core section sizes for
|
||||
the DPX2 are in bytes. */
|
||||
|
||||
#include <sys/param.h>
|
||||
#define NBPG 1
|
||||
#define UPAGES (USIZE * NBPP)
|
||||
#define HOST_DATA_START_ADDR (u.u_exdata.ux_datorg)
|
||||
#define HOST_STACK_END_ADDR (USERSTACK)
|
@ -1,13 +0,0 @@
|
||||
#include <sys/param.h>
|
||||
#ifdef BSD4_4
|
||||
#define NO_CORE_COMMAND
|
||||
#endif
|
||||
|
||||
#define HOST_PAGE_SIZE NBPG
|
||||
#define HOST_SEGMENT_SIZE NBPG /* Data seg start addr rounds to NBPG */
|
||||
#define HOST_MACHINE_ARCH bfd_arch_m68k
|
||||
/* #define HOST_MACHINE_MACHINE */
|
||||
|
||||
#define HOST_TEXT_START_ADDR 0
|
||||
#define HOST_STACK_END_ADDR 0xfff00000
|
||||
#define HOST_BIG_ENDIAN_P
|
@ -1,25 +0,0 @@
|
||||
/* Intel 386 running any BSD Unix */
|
||||
|
||||
#include <machine/param.h>
|
||||
#include <machine/vmparam.h>
|
||||
|
||||
#define HOST_PAGE_SIZE NBPG
|
||||
#define HOST_MACHINE_ARCH bfd_arch_i386
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
|
||||
/* Jolitz suggested defining HOST_STACK_END_ADDR to
|
||||
(u.u_kproc.kp_eproc.e_vm.vm_maxsaddr + MAXSSIZ), which should work on
|
||||
both BSDI and 386BSD, but that is believed not to work for BSD 4.4. */
|
||||
|
||||
#ifdef __bsdi__
|
||||
/* This seems to be the right thing for BSDI. */
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
||||
#define HOST_DATA_START_ADDR ((bfd_vma)u.u_kproc.kp_eproc.e_vm.vm_daddr)
|
||||
#else
|
||||
/* This seems to be the right thing for 386BSD release 0.1. */
|
||||
#define HOST_STACK_END_ADDR (USRSTACK - MAXSSIZ)
|
||||
#endif
|
||||
|
||||
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
|
||||
((core_bfd)->tdata.trad_core_data->u.u_sig)
|
||||
#define u_comm u_kproc.kp_proc.p_comm
|
@ -1,8 +0,0 @@
|
||||
/* Linux writes the task structure at the end of the core file. Currently it
|
||||
is 2912 bytes. It is possible that this should be a pickier check, but
|
||||
we should probably not be too picky (the size of the task structure might
|
||||
vary, and if it's not the length we expect it to be, it doesn't affect
|
||||
our ability to process the core file). So allow 0-4096 extra bytes at
|
||||
the end. */
|
||||
|
||||
#define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096
|
@ -1,25 +0,0 @@
|
||||
#include <machine/vmparam.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
/* This is an ugly way to hack around the incorrect
|
||||
* definition of UPAGES in i386/machparam.h.
|
||||
*
|
||||
* The definition should specify the size reserved
|
||||
* for "struct user" in core files in PAGES,
|
||||
* but instead it gives it in 512-byte core-clicks
|
||||
* for i386 and i860. UPAGES is used only in trad-core.c.
|
||||
*/
|
||||
#if UPAGES == 16
|
||||
#undef UPAGES
|
||||
#define UPAGES 2
|
||||
#endif
|
||||
|
||||
#if UPAGES != 2
|
||||
FIXME!! UPAGES is neither 2 nor 16
|
||||
#endif
|
||||
|
||||
#define HOST_PAGE_SIZE 1
|
||||
#define HOST_SEGMENT_SIZE NBPG
|
||||
#define HOST_MACHINE_ARCH bfd_arch_i386
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
@ -1,19 +0,0 @@
|
||||
/* Core file stuff. At least some, perhaps all, of the following
|
||||
defines work on many more systems than just SCO. */
|
||||
|
||||
#define NBPG NBPC
|
||||
#define UPAGES USIZE
|
||||
#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg
|
||||
#define HOST_STACK_START_ADDR u.u_sub
|
||||
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
|
||||
((core_upage(abfd)->u_sysabort != 0) \
|
||||
? core_upage(abfd)->u_sysabort \
|
||||
: -1)
|
||||
|
||||
/* According to the manpage, a version 2 SCO corefile can contain
|
||||
various additional sections (it is cleverly arranged so the u area,
|
||||
data, and stack are first where we can find them). So without
|
||||
writing lots of code to parse all their headers and stuff, we can't
|
||||
know whether a corefile is bigger than it should be. */
|
||||
|
||||
#define TRAD_CORE_ALLOW_ANY_EXTRA_SIZE 1
|
@ -1,27 +0,0 @@
|
||||
/* This file was hacked from i386mach3.h [dolan@ssd.intel.com] */
|
||||
|
||||
#include <machine/vmparam.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
/* This is an ugly way to hack around the incorrect
|
||||
* definition of UPAGES in i386/machparam.h.
|
||||
*
|
||||
* The definition should specify the size reserved
|
||||
* for "struct user" in core files in PAGES,
|
||||
* but instead it gives it in 512-byte core-clicks
|
||||
* for i386 and i860. UPAGES is used only in trad-core.c.
|
||||
*/
|
||||
#if UPAGES == 16
|
||||
#undef UPAGES
|
||||
#define UPAGES 2
|
||||
#endif
|
||||
|
||||
#if UPAGES != 2
|
||||
FIXME!! UPAGES is neither 2 nor 16
|
||||
#endif
|
||||
|
||||
#define HOST_PAGE_SIZE 1
|
||||
#define HOST_SEGMENT_SIZE NBPG
|
||||
#define HOST_MACHINE_ARCH bfd_arch_i860
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
@ -1,16 +0,0 @@
|
||||
/* Definitions for an Apple Macintosh running A/UX 3.x. */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/page.h>
|
||||
|
||||
/* Definitions used by trad-core.c. */
|
||||
#define NBPG NBPP
|
||||
|
||||
#define HOST_DATA_START_ADDR u.u_exdata.ux_datorg
|
||||
#define HOST_TEXT_START_ADDR u.u_exdata.ux_txtorg
|
||||
#define HOST_STACK_END_ADDR 0x100000000
|
||||
|
||||
#define UPAGES USIZE
|
||||
|
||||
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
|
||||
(abfd->tdata.trad_core_data->u.u_arg[0])
|
@ -1,6 +0,0 @@
|
||||
/* Linux dumps "struct task_struct" at the end of the core-file. This
|
||||
structure is currently 2512 bytes long, but we allow up to 4096
|
||||
bytes to allow for some future growth. */
|
||||
#define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096
|
||||
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
|
||||
((abfd)->tdata.trad_core_data->u.signal)
|
@ -1,11 +0,0 @@
|
||||
#include <machine/vmparam.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#undef UPAGES
|
||||
#define UPAGES 3
|
||||
|
||||
#define HOST_PAGE_SIZE NBPG
|
||||
#define HOST_SEGMENT_SIZE NBPG
|
||||
#define HOST_MACHINE_ARCH bfd_arch_m88k
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
@ -1,12 +0,0 @@
|
||||
#include <machine/param.h>
|
||||
#include <machine/vmparam.h>
|
||||
#undef ALIGN
|
||||
|
||||
#define HOST_PAGE_SIZE NBPG
|
||||
/* #define HOST_SEGMENT_SIZE NBPG -- we use HOST_DATA_START_ADDR */
|
||||
#define HOST_MACHINE_ARCH bfd_arch_mips
|
||||
/* #define HOST_MACHINE_MACHINE */
|
||||
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
||||
#define NO_CORE_COMMAND
|
@ -1,10 +0,0 @@
|
||||
#include <machine/vmparam.h>
|
||||
#include <machine/machparam.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#define HOST_PAGE_SIZE NBPG
|
||||
/* #define HOST_SEGMENT_SIZE NBPG */
|
||||
#define HOST_MACHINE_ARCH bfd_arch_mips
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_DATA_START_ADDR USRDATA
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
@ -1,12 +0,0 @@
|
||||
/* Sony News running NewsOS 3.2. */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <machine/vmparam.h>
|
||||
|
||||
#define HOST_PAGE_SIZE NBPG
|
||||
|
||||
#define HOST_MACHINE_ARCH bfd_arch_mips
|
||||
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_DATA_START_ADDR USRDATA
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
@ -1,9 +0,0 @@
|
||||
/* Sony News running NewsOS 3.2. */
|
||||
|
||||
#include <machine/vmparam.h>
|
||||
|
||||
#define HOST_PAGE_SIZE NBPG
|
||||
#define HOST_SEGMENT_SIZE NBPG
|
||||
#define HOST_MACHINE_ARCH bfd_arch_m68k
|
||||
#define HOST_TEXT_START_ADDR 0
|
||||
#define HOST_STACK_END_ADDR (KERNBASE - (UPAGES * NBPG))
|
@ -1,24 +0,0 @@
|
||||
#include <machine/vmparam.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
/* This is an ugly way to hack around the incorrect
|
||||
* definition of UPAGES in ns532/machparam.h.
|
||||
*
|
||||
* The definition should specify the size reserved
|
||||
* for "struct user" in core files in PAGES,
|
||||
* but instead it gives it in 512-byte core-clicks
|
||||
* for ns532, i386 and i860. UPAGES is used only in trad-core.c.
|
||||
*/
|
||||
#if UPAGES == 16
|
||||
#undef UPAGES
|
||||
#define UPAGES 2
|
||||
#endif
|
||||
|
||||
#if UPAGES != 2
|
||||
#error UPAGES is neither 2 nor 16
|
||||
#endif
|
||||
|
||||
#define HOST_PAGE_SIZE 1
|
||||
#define HOST_SEGMENT_SIZE NBPG
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
@ -1,10 +0,0 @@
|
||||
/* RISC/os 4.52C, and presumably other versions. */
|
||||
|
||||
#include <bsd43/machine/machparam.h>
|
||||
#include <bsd43/machine/vmparam.h>
|
||||
|
||||
#define NBPG BSD43_NBPG
|
||||
#define UPAGES BSD43_UPAGES
|
||||
#define HOST_TEXT_START_ADDR BSD43_USRTEXT
|
||||
#define HOST_DATA_START_ADDR BSD43_USRDATA
|
||||
#define HOST_STACK_END_ADDR BSD43_USRSTACK
|
@ -1,20 +0,0 @@
|
||||
/* Symmetry running either dynix 3.1 (bsd) or ptx (sysv). */
|
||||
|
||||
#define NBPG 4096
|
||||
#define UPAGES 1
|
||||
|
||||
#ifdef _SEQUENT_
|
||||
/* ptx */
|
||||
#define HOST_TEXT_START_ADDR 0
|
||||
#define HOST_STACK_END_ADDR 0x3fffe000
|
||||
#define TRAD_CORE_USER_OFFSET ((UPAGES * NBPG) - sizeof (struct user))
|
||||
#else
|
||||
/* dynix */
|
||||
#define HOST_TEXT_START_ADDR 0x1000
|
||||
#define HOST_DATA_START_ADDR (NBPG * u.u_tsize)
|
||||
#define HOST_STACK_END_ADDR 0x3ffff000
|
||||
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
|
||||
((core_bfd)->tdata.trad_core_data->u.u_arg[0])
|
||||
#endif
|
||||
|
||||
#define TRAD_CORE_DSIZE_INCLUDES_TSIZE
|
@ -1,12 +0,0 @@
|
||||
#define NO_CORE_COMMAND
|
||||
|
||||
#undef ALIGN /* They use it, we use it too */
|
||||
#include <machine/param.h>
|
||||
#undef ALIGN /* They use it, we use it too */
|
||||
|
||||
#define HOST_PAGE_SIZE NBPG
|
||||
#define HOST_MACHINE_ARCH bfd_arch_tahoe
|
||||
|
||||
#define HOST_TEXT_START_ADDR 0
|
||||
#define HOST_STACK_END_ADDR (KERNBASE - (UPAGES * NBPG))
|
||||
#define HOST_BIG_ENDIAN_P
|
@ -1,19 +0,0 @@
|
||||
#define NO_CORE_COMMAND /* No command name in core file */
|
||||
|
||||
#if 0
|
||||
#undef ALIGN /* They use it, we use it too */
|
||||
/* Does not exist on BSD 4.3, it uses machine/machparam.h.
|
||||
Whatever it is, it's included by <sys/param.h>, which trad-core.c,
|
||||
the only place that uses this (I think), already includes. */
|
||||
#include <machine/param.h>
|
||||
#endif
|
||||
#undef ALIGN /* They use it, we use it too */
|
||||
|
||||
/* Note that HOST_PAGE_SIZE -- the page size as far as executable files
|
||||
are concerned -- is not the same as NBPG, because of page clustering. */
|
||||
#define HOST_PAGE_SIZE 1024
|
||||
#define HOST_MACHINE_ARCH bfd_arch_vax
|
||||
|
||||
#define HOST_TEXT_START_ADDR 0
|
||||
#define HOST_STACK_END_ADDR (0x80000000 - (UPAGES * NBPG))
|
||||
#undef HOST_BIG_ENDIAN_P
|
@ -1,8 +0,0 @@
|
||||
#include <machine/param.h>
|
||||
#include <machine/vmparam.h>
|
||||
#define HOST_PAGE_SIZE (NBPG*CLSIZE)
|
||||
#define HOST_MACHINE_ARCH bfd_arch_vax
|
||||
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
||||
#undef HOST_BIG_ENDIAN_P
|
@ -1,8 +0,0 @@
|
||||
#include <machine/param.h>
|
||||
#include <machine/vmparam.h>
|
||||
#define HOST_PAGE_SIZE (NBPG*CLSIZE)
|
||||
#define HOST_MACHINE_ARCH bfd_arch_vax
|
||||
|
||||
#define HOST_TEXT_START_ADDR USRTEXT
|
||||
#define HOST_STACK_END_ADDR USRSTACK
|
||||
#undef HOST_BIG_ENDIAN_P
|
@ -1,68 +0,0 @@
|
||||
/* BFD back-end for i386 a.out binaries.
|
||||
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* The only 386 aout system we have here is GO32 from DJ.
|
||||
These numbers make BFD work with that. If your aout 386 system
|
||||
doesn't work with these, we'll have to split them into different
|
||||
files. Send me (sac@cygnus.com) the runes to make it work on your
|
||||
system, and I'll stick it in for the next release. */
|
||||
|
||||
#define N_HEADER_IN_TEXT(x) 0
|
||||
#define BYTES_IN_WORD 4
|
||||
|
||||
#define N_TXTOFF(x) 0x20
|
||||
#define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0)
|
||||
|
||||
#define N_TXTSIZE(x) ((x).a_text)
|
||||
#if 0
|
||||
#define N_DATADDR(x) (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) : (SEGMENT_SIZE + ((0x1020+(x).a_text-1) & ~(SEGMENT_SIZE-1))))
|
||||
#define NOSUBEXECB
|
||||
|
||||
#endif
|
||||
#define TARGET_PAGE_SIZE 4096
|
||||
#define SEGMENT_SIZE 0x400000
|
||||
#define DEFAULT_ARCH bfd_arch_i386
|
||||
|
||||
#define MY(OP) CAT(i386aout_,OP)
|
||||
#define TARGETNAME "a.out-i386"
|
||||
#define NO_WRITE_HEADER_KLUDGE 1
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "libaout.h"
|
||||
static boolean MY(set_sizes)();
|
||||
#define MY_backend_data &MY(backend_data)
|
||||
static CONST struct aout_backend_data MY(backend_data) = {
|
||||
0, /* zmagic contiguous */
|
||||
1, /* text incl header */
|
||||
0, /* exec_hdr_flags */
|
||||
0, /* text vma? */
|
||||
MY(set_sizes),
|
||||
1, /* exec header not counted */
|
||||
0, /* add_dynamic_symbols */
|
||||
0, /* add_one_symbol */
|
||||
0, /* link_dynamic_object */
|
||||
0, /* write_dynamic_symbol */
|
||||
0, /* check_dynamic_reloc */
|
||||
0 /* finish_dynamic_link */
|
||||
};
|
||||
|
||||
#include "aout-target.h"
|
@ -1,46 +0,0 @@
|
||||
/* BFD back-end for i386 a.out binaries under BSD.
|
||||
Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This data should be correct for the format used under all the various
|
||||
BSD ports for 386 machines. */
|
||||
|
||||
#define BYTES_IN_WORD 4
|
||||
|
||||
/* ZMAGIC files never have the header in the text. */
|
||||
#define N_HEADER_IN_TEXT(x) 0
|
||||
|
||||
/* ZMAGIC files start at address 0. This does not apply to QMAGIC. */
|
||||
#define TEXT_START_ADDR 0
|
||||
#define N_SHARED_LIB(x) 0
|
||||
|
||||
#define TARGET_PAGE_SIZE 4096
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
|
||||
#define DEFAULT_ARCH bfd_arch_i386
|
||||
#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN)
|
||||
|
||||
#define MY(OP) CAT(i386bsd_,OP)
|
||||
#define TARGETNAME "a.out-i386-bsd"
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "libaout.h"
|
||||
|
||||
#include "aout-target.h"
|
@ -1,33 +0,0 @@
|
||||
/* BFD back-end for FreeBSD/386 a.out-ish binaries.
|
||||
Copyright (C) 1990, 1991, 1992, 1996 Free Software Foundation, Inc.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define BYTES_IN_WORD 4
|
||||
#undef TARGET_IS_BIG_ENDIAN_P
|
||||
|
||||
#define TARGET_PAGE_SIZE 4096
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
|
||||
#define DEFAULT_ARCH bfd_arch_i386
|
||||
#define MACHTYPE_OK(mtype) ((mtype) == M_386_NETBSD || (mtype) == M_UNKNOWN)
|
||||
|
||||
#define MY(OP) CAT(i386freebsd_,OP)
|
||||
/* This needs to start with a.out so GDB knows it is an a.out variant. */
|
||||
#define TARGETNAME "a.out-i386-freebsd"
|
||||
|
||||
#include "freebsd.h"
|
File diff suppressed because it is too large
Load Diff
@ -1,50 +0,0 @@
|
||||
/* bfd initialization stuff
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain of Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
/*
|
||||
SECTION
|
||||
Initialization
|
||||
|
||||
These are the functions that handle initializing a BFD.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_init
|
||||
|
||||
SYNOPSIS
|
||||
void bfd_init(void);
|
||||
|
||||
DESCRIPTION
|
||||
This routine must be called before any other BFD function to
|
||||
initialize magical internal data structures.
|
||||
*/
|
||||
|
||||
/* Actually, there is currently nothing for this function to do.
|
||||
However, someday it may be needed, so keep it around. */
|
||||
|
||||
void
|
||||
bfd_init ()
|
||||
{
|
||||
}
|
@ -1,608 +0,0 @@
|
||||
/* BFD back-end data structures for a.out (and similar) files.
|
||||
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef LIBAOUT_H
|
||||
#define LIBAOUT_H
|
||||
|
||||
/* We try to encapsulate the differences in the various a.out file
|
||||
variants in a few routines, and otherwise share large masses of code.
|
||||
This means we only have to fix bugs in one place, most of the time. */
|
||||
|
||||
#include "bfdlink.h"
|
||||
|
||||
/* Parameterize the a.out code based on whether it is being built
|
||||
for a 32-bit architecture or a 64-bit architecture. */
|
||||
#if ARCH_SIZE==64
|
||||
#define GET_WORD bfd_h_get_64
|
||||
#define GET_SWORD bfd_h_get_signed_64
|
||||
#define PUT_WORD bfd_h_put_64
|
||||
#ifndef NAME
|
||||
#define NAME(x,y) CAT3(x,_64_,y)
|
||||
#endif
|
||||
#define JNAME(x) CAT(x,_64)
|
||||
#define BYTES_IN_WORD 8
|
||||
#else /* ARCH_SIZE == 32 */
|
||||
#define GET_WORD bfd_h_get_32
|
||||
#define GET_SWORD bfd_h_get_signed_32
|
||||
#define PUT_WORD bfd_h_put_32
|
||||
#ifndef NAME
|
||||
#define NAME(x,y) CAT3(x,_32_,y)
|
||||
#endif
|
||||
#define JNAME(x) CAT(x,_32)
|
||||
#define BYTES_IN_WORD 4
|
||||
#endif /* ARCH_SIZE==32 */
|
||||
|
||||
/* Declare at file level, since used in parameter lists, which have
|
||||
weird scope. */
|
||||
struct external_exec;
|
||||
struct external_nlist;
|
||||
struct reloc_ext_external;
|
||||
struct reloc_std_external;
|
||||
|
||||
/* a.out backend linker hash table entries. */
|
||||
|
||||
struct aout_link_hash_entry
|
||||
{
|
||||
struct bfd_link_hash_entry root;
|
||||
/* Whether this symbol has been written out. */
|
||||
boolean written;
|
||||
/* Symbol index in output file. */
|
||||
int indx;
|
||||
};
|
||||
|
||||
/* a.out backend linker hash table. */
|
||||
|
||||
struct aout_link_hash_table
|
||||
{
|
||||
struct bfd_link_hash_table root;
|
||||
};
|
||||
|
||||
/* Look up an entry in an a.out link hash table. */
|
||||
|
||||
#define aout_link_hash_lookup(table, string, create, copy, follow) \
|
||||
((struct aout_link_hash_entry *) \
|
||||
bfd_link_hash_lookup (&(table)->root, (string), (create), (copy), (follow)))
|
||||
|
||||
/* Traverse an a.out link hash table. */
|
||||
|
||||
#define aout_link_hash_traverse(table, func, info) \
|
||||
(bfd_link_hash_traverse \
|
||||
(&(table)->root, \
|
||||
(boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
||||
(info)))
|
||||
|
||||
/* Get the a.out link hash table from the info structure. This is
|
||||
just a cast. */
|
||||
|
||||
#define aout_hash_table(p) ((struct aout_link_hash_table *) ((p)->hash))
|
||||
|
||||
/* Back-end information for various a.out targets. */
|
||||
struct aout_backend_data
|
||||
{
|
||||
/* Are ZMAGIC files mapped contiguously? If so, the text section may
|
||||
need more padding, if the segment size (granularity for memory access
|
||||
control) is larger than the page size. */
|
||||
unsigned char zmagic_mapped_contiguous;
|
||||
/* If this flag is set, ZMAGIC/NMAGIC file headers get mapped in with the
|
||||
text section, which starts immediately after the file header.
|
||||
If not, the text section starts on the next page. */
|
||||
unsigned char text_includes_header;
|
||||
|
||||
/* The value to pass to N_SET_FLAGS. */
|
||||
unsigned char exec_hdr_flags;
|
||||
|
||||
/* If the text section VMA isn't specified, and we need an absolute
|
||||
address, use this as the default. If we're producing a relocatable
|
||||
file, zero is always used. */
|
||||
/* ?? Perhaps a callback would be a better choice? Will this do anything
|
||||
reasonable for a format that handles multiple CPUs with different
|
||||
load addresses for each? */
|
||||
bfd_vma default_text_vma;
|
||||
|
||||
/* Callback for setting the page and segment sizes, if they can't be
|
||||
trivially determined from the architecture. */
|
||||
boolean (*set_sizes) PARAMS ((bfd *));
|
||||
|
||||
/* zmagic files only. For go32, the length of the exec header contributes
|
||||
to the size of the text section in the file for alignment purposes but
|
||||
does *not* get counted in the length of the text section. */
|
||||
unsigned char exec_header_not_counted;
|
||||
|
||||
/* Callback from the add symbols phase of the linker code to handle
|
||||
a dynamic object. */
|
||||
boolean (*add_dynamic_symbols) PARAMS ((bfd *, struct bfd_link_info *,
|
||||
struct external_nlist **,
|
||||
bfd_size_type *, char **));
|
||||
|
||||
/* Callback from the add symbols phase of the linker code to handle
|
||||
adding a single symbol to the global linker hash table. */
|
||||
boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *,
|
||||
const char *, flagword, asection *,
|
||||
bfd_vma, const char *, boolean,
|
||||
boolean,
|
||||
struct bfd_link_hash_entry **));
|
||||
|
||||
/* Called to handle linking a dynamic object. */
|
||||
boolean (*link_dynamic_object) PARAMS ((struct bfd_link_info *, bfd *));
|
||||
|
||||
/* Called for each global symbol being written out by the linker.
|
||||
This should write out the dynamic symbol information. */
|
||||
boolean (*write_dynamic_symbol) PARAMS ((bfd *, struct bfd_link_info *,
|
||||
struct aout_link_hash_entry *));
|
||||
|
||||
/* If this callback is not NULL, the linker calls it for each reloc.
|
||||
RELOC is a pointer to the unswapped reloc. If *SKIP is set to
|
||||
true, the reloc will be skipped. *RELOCATION may be changed to
|
||||
change the effects of the relocation. */
|
||||
boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *info,
|
||||
bfd *input_bfd,
|
||||
asection *input_section,
|
||||
struct aout_link_hash_entry *h,
|
||||
PTR reloc, bfd_byte *contents,
|
||||
boolean *skip,
|
||||
bfd_vma *relocation));
|
||||
|
||||
/* Called at the end of a link to finish up any dynamic linking
|
||||
information. */
|
||||
boolean (*finish_dynamic_link) PARAMS ((bfd *, struct bfd_link_info *));
|
||||
};
|
||||
#define aout_backend_info(abfd) \
|
||||
((CONST struct aout_backend_data *)((abfd)->xvec->backend_data))
|
||||
|
||||
/* This is the layout in memory of a "struct exec" while we process it.
|
||||
All 'lengths' are given as a number of bytes.
|
||||
All 'alignments' are for relinkable files only; an alignment of
|
||||
'n' indicates the corresponding segment must begin at an
|
||||
address that is a multiple of (2**n). */
|
||||
|
||||
struct internal_exec
|
||||
{
|
||||
long a_info; /* Magic number and flags, packed */
|
||||
bfd_vma a_text; /* length of text, in bytes */
|
||||
bfd_vma a_data; /* length of data, in bytes */
|
||||
bfd_vma a_bss; /* length of uninitialized data area in mem */
|
||||
bfd_vma a_syms; /* length of symbol table data in file */
|
||||
bfd_vma a_entry; /* start address */
|
||||
bfd_vma a_trsize; /* length of text's relocation info, in bytes */
|
||||
bfd_vma a_drsize; /* length of data's relocation info, in bytes */
|
||||
/* Added for i960 */
|
||||
bfd_vma a_tload; /* Text runtime load address */
|
||||
bfd_vma a_dload; /* Data runtime load address */
|
||||
unsigned char a_talign; /* Alignment of text segment */
|
||||
unsigned char a_dalign; /* Alignment of data segment */
|
||||
unsigned char a_balign; /* Alignment of bss segment */
|
||||
char a_relaxable; /* Enough info for linker relax */
|
||||
};
|
||||
|
||||
/* Magic number is written
|
||||
< MSB >
|
||||
3130292827262524232221201918171615141312111009080706050403020100
|
||||
< FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
|
||||
*/
|
||||
/* Magic number for NetBSD is
|
||||
<MSB >
|
||||
3130292827262524232221201918171615141312111009080706050403020100
|
||||
< FLAGS >< >< MAGIC NUMBER >
|
||||
*/
|
||||
|
||||
enum machine_type {
|
||||
M_UNKNOWN = 0,
|
||||
M_68010 = 1,
|
||||
M_68020 = 2,
|
||||
M_SPARC = 3,
|
||||
/* skip a bunch so we don't run into any of suns numbers */
|
||||
/* make these up for the ns32k*/
|
||||
M_NS32032 = (64), /* ns32032 running ? */
|
||||
M_NS32532 = (64 + 5), /* ns32532 running mach */
|
||||
|
||||
M_386 = 100,
|
||||
M_29K = 101, /* AMD 29000 */
|
||||
M_386_DYNIX = 102, /* Sequent running dynix */
|
||||
M_ARM = 103, /* Advanced Risc Machines ARM */
|
||||
M_386_NETBSD = 134, /* NetBSD/i386 binary */
|
||||
M_68K_NETBSD = 135, /* NetBSD/m68k binary */
|
||||
M_68K4K_NETBSD = 136, /* NetBSD/m68k4k binary */
|
||||
M_532_NETBSD = 137, /* NetBSD/ns32k binary */
|
||||
M_SPARC_NETBSD = 138, /* NetBSD/sparc binary */
|
||||
M_MIPS1 = 151, /* MIPS R2000/R3000 binary */
|
||||
M_MIPS2 = 152, /* MIPS R4000/R6000 binary */
|
||||
M_HP200 = 200, /* HP 200 (68010) BSD binary */
|
||||
M_HP300 = (300 % 256), /* HP 300 (68020+68881) BSD binary */
|
||||
M_HPUX = (0x20c % 256)/* HP 200/300 HPUX binary */
|
||||
};
|
||||
|
||||
#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
|
||||
|
||||
#ifndef N_MAGIC
|
||||
# define N_MAGIC(exec) ((exec).a_info & 0xffff)
|
||||
#endif
|
||||
|
||||
#ifndef N_MACHTYPE
|
||||
# define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
|
||||
#endif
|
||||
|
||||
#ifndef N_FLAGS
|
||||
# define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
|
||||
#endif
|
||||
|
||||
#ifndef N_SET_INFO
|
||||
# define N_SET_INFO(exec, magic, type, flags) \
|
||||
((exec).a_info = ((magic) & 0xffff) \
|
||||
| (((int)(type) & 0xff) << 16) \
|
||||
| (((flags) & 0xff) << 24))
|
||||
#endif
|
||||
|
||||
#ifndef N_SET_DYNAMIC
|
||||
# define N_SET_DYNAMIC(exec, dynamic) \
|
||||
((exec).a_info = (dynamic) ? ((exec).a_info | 0x80000000) : \
|
||||
((exec).a_info & 0x7fffffff))
|
||||
#endif
|
||||
|
||||
#ifndef N_SET_MAGIC
|
||||
# define N_SET_MAGIC(exec, magic) \
|
||||
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
|
||||
#endif
|
||||
|
||||
#ifndef N_SET_MACHTYPE
|
||||
# define N_SET_MACHTYPE(exec, machtype) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
|
||||
#endif
|
||||
|
||||
#ifndef N_SET_FLAGS
|
||||
# define N_SET_FLAGS(exec, flags) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
|
||||
#endif
|
||||
|
||||
typedef struct aout_symbol {
|
||||
asymbol symbol;
|
||||
short desc;
|
||||
char other;
|
||||
unsigned char type;
|
||||
} aout_symbol_type;
|
||||
|
||||
/* The `tdata' struct for all a.out-like object file formats.
|
||||
Various things depend on this struct being around any time an a.out
|
||||
file is being handled. An example is dbxread.c in GDB. */
|
||||
|
||||
struct aoutdata {
|
||||
struct internal_exec *hdr; /* exec file header */
|
||||
aout_symbol_type *symbols; /* symtab for input bfd */
|
||||
|
||||
/* For ease, we do this */
|
||||
asection *textsec;
|
||||
asection *datasec;
|
||||
asection *bsssec;
|
||||
|
||||
/* We remember these offsets so that after check_file_format, we have
|
||||
no dependencies on the particular format of the exec_hdr. */
|
||||
file_ptr sym_filepos;
|
||||
file_ptr str_filepos;
|
||||
|
||||
/* Size of a relocation entry in external form */
|
||||
unsigned reloc_entry_size;
|
||||
|
||||
/* Size of a symbol table entry in external form */
|
||||
unsigned symbol_entry_size;
|
||||
|
||||
/* Page size - needed for alignment of demand paged files. */
|
||||
unsigned long page_size;
|
||||
|
||||
/* Segment size - needed for alignment of demand paged files. */
|
||||
unsigned long segment_size;
|
||||
|
||||
/* Zmagic disk block size - need to align the start of the text
|
||||
section in ZMAGIC binaries. Normally the same as page_size. */
|
||||
unsigned long zmagic_disk_block_size;
|
||||
|
||||
unsigned exec_bytes_size;
|
||||
unsigned vma_adjusted : 1;
|
||||
|
||||
/* used when a bfd supports several highly similar formats */
|
||||
enum
|
||||
{
|
||||
default_format = 0,
|
||||
/* Used on HP 9000/300 running HP/UX. See hp300hpux.c. */
|
||||
gnu_encap_format,
|
||||
/* Used on Linux, 386BSD, etc. See include/aout/aout64.h. */
|
||||
q_magic_format
|
||||
} subformat;
|
||||
|
||||
enum
|
||||
{
|
||||
undecided_magic = 0,
|
||||
z_magic,
|
||||
o_magic,
|
||||
n_magic
|
||||
} magic;
|
||||
|
||||
/* A buffer for find_nearest_line. */
|
||||
char *line_buf;
|
||||
|
||||
/* The external symbol information. */
|
||||
struct external_nlist *external_syms;
|
||||
bfd_size_type external_sym_count;
|
||||
bfd_window sym_window;
|
||||
char *external_strings;
|
||||
bfd_size_type external_string_size;
|
||||
bfd_window string_window;
|
||||
struct aout_link_hash_entry **sym_hashes;
|
||||
|
||||
/* A pointer for shared library information. */
|
||||
PTR dynamic_info;
|
||||
|
||||
/* A mapping from local symbols to offsets into the global offset
|
||||
table, used when linking on SunOS. This is indexed by the symbol
|
||||
index. */
|
||||
bfd_vma *local_got_offsets;
|
||||
};
|
||||
|
||||
struct aout_data_struct {
|
||||
struct aoutdata a;
|
||||
struct internal_exec e;
|
||||
};
|
||||
|
||||
#define adata(bfd) ((bfd)->tdata.aout_data->a)
|
||||
#define exec_hdr(bfd) (adata(bfd).hdr)
|
||||
#define obj_aout_symbols(bfd) (adata(bfd).symbols)
|
||||
#define obj_textsec(bfd) (adata(bfd).textsec)
|
||||
#define obj_datasec(bfd) (adata(bfd).datasec)
|
||||
#define obj_bsssec(bfd) (adata(bfd).bsssec)
|
||||
#define obj_sym_filepos(bfd) (adata(bfd).sym_filepos)
|
||||
#define obj_str_filepos(bfd) (adata(bfd).str_filepos)
|
||||
#define obj_reloc_entry_size(bfd) (adata(bfd).reloc_entry_size)
|
||||
#define obj_symbol_entry_size(bfd) (adata(bfd).symbol_entry_size)
|
||||
#define obj_aout_subformat(bfd) (adata(bfd).subformat)
|
||||
#define obj_aout_external_syms(bfd) (adata(bfd).external_syms)
|
||||
#define obj_aout_external_sym_count(bfd) (adata(bfd).external_sym_count)
|
||||
#define obj_aout_sym_window(bfd) (adata(bfd).sym_window)
|
||||
#define obj_aout_external_strings(bfd) (adata(bfd).external_strings)
|
||||
#define obj_aout_external_string_size(bfd) (adata(bfd).external_string_size)
|
||||
#define obj_aout_string_window(bfd) (adata(bfd).string_window)
|
||||
#define obj_aout_sym_hashes(bfd) (adata(bfd).sym_hashes)
|
||||
#define obj_aout_dynamic_info(bfd) (adata(bfd).dynamic_info)
|
||||
|
||||
/* We take the address of the first element of an asymbol to ensure that the
|
||||
macro is only ever applied to an asymbol */
|
||||
#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
|
||||
|
||||
/* Information we keep for each a.out section. This is currently only
|
||||
used by the a.out backend linker. */
|
||||
|
||||
struct aout_section_data_struct
|
||||
{
|
||||
/* The unswapped relocation entries for this section. */
|
||||
PTR relocs;
|
||||
};
|
||||
|
||||
#define aout_section_data(s) \
|
||||
((struct aout_section_data_struct *) (s)->used_by_bfd)
|
||||
|
||||
#define set_aout_section_data(s,v) \
|
||||
((s)->used_by_bfd = (PTR)&(v)->relocs)
|
||||
|
||||
/* Prototype declarations for functions defined in aoutx.h */
|
||||
|
||||
boolean
|
||||
NAME(aout,squirt_out_relocs) PARAMS ((bfd *abfd, asection *section));
|
||||
|
||||
boolean
|
||||
NAME(aout,make_sections) PARAMS ((bfd *));
|
||||
|
||||
const bfd_target *
|
||||
NAME(aout,some_aout_object_p) PARAMS ((bfd *abfd,
|
||||
struct internal_exec *execp,
|
||||
const bfd_target *(*callback)(bfd *)));
|
||||
|
||||
boolean
|
||||
NAME(aout,mkobject) PARAMS ((bfd *abfd));
|
||||
|
||||
enum machine_type
|
||||
NAME(aout,machine_type) PARAMS ((enum bfd_architecture arch,
|
||||
unsigned long machine,
|
||||
boolean *unknown));
|
||||
|
||||
boolean
|
||||
NAME(aout,set_arch_mach) PARAMS ((bfd *abfd, enum bfd_architecture arch,
|
||||
unsigned long machine));
|
||||
|
||||
boolean
|
||||
NAME(aout,new_section_hook) PARAMS ((bfd *abfd, asection *newsect));
|
||||
|
||||
boolean
|
||||
NAME(aout,set_section_contents) PARAMS ((bfd *abfd, sec_ptr section,
|
||||
PTR location, file_ptr offset, bfd_size_type count));
|
||||
|
||||
asymbol *
|
||||
NAME(aout,make_empty_symbol) PARAMS ((bfd *abfd));
|
||||
|
||||
boolean
|
||||
NAME(aout,translate_symbol_table) PARAMS ((bfd *, aout_symbol_type *,
|
||||
struct external_nlist *,
|
||||
bfd_size_type, char *,
|
||||
bfd_size_type,
|
||||
boolean dynamic));
|
||||
|
||||
boolean
|
||||
NAME(aout,slurp_symbol_table) PARAMS ((bfd *abfd));
|
||||
|
||||
boolean
|
||||
NAME(aout,write_syms) PARAMS ((bfd *abfd));
|
||||
|
||||
void
|
||||
NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd));
|
||||
|
||||
long
|
||||
NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd));
|
||||
|
||||
long
|
||||
NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location));
|
||||
|
||||
void
|
||||
NAME(aout,swap_ext_reloc_in) PARAMS ((bfd *, struct reloc_ext_external *,
|
||||
arelent *, asymbol **, bfd_size_type));
|
||||
void
|
||||
NAME(aout,swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
|
||||
arelent *, asymbol **, bfd_size_type));
|
||||
|
||||
reloc_howto_type *
|
||||
NAME(aout,reloc_type_lookup) PARAMS ((bfd *abfd,
|
||||
bfd_reloc_code_real_type code));
|
||||
|
||||
boolean
|
||||
NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect,
|
||||
asymbol **symbols));
|
||||
|
||||
long
|
||||
NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section,
|
||||
arelent **relptr, asymbol **symbols));
|
||||
|
||||
long
|
||||
NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect));
|
||||
|
||||
void
|
||||
NAME(aout,reclaim_reloc) PARAMS ((bfd *ignore_abfd, sec_ptr ignore));
|
||||
|
||||
alent *
|
||||
NAME(aout,get_lineno) PARAMS ((bfd *ignore_abfd, asymbol *ignore_symbol));
|
||||
|
||||
void
|
||||
NAME(aout,print_symbol) PARAMS ((bfd *ignore_abfd, PTR file,
|
||||
asymbol *symbol, bfd_print_symbol_type how));
|
||||
|
||||
void
|
||||
NAME(aout,get_symbol_info) PARAMS ((bfd *ignore_abfd,
|
||||
asymbol *symbol, symbol_info *ret));
|
||||
|
||||
boolean
|
||||
NAME(aout,find_nearest_line) PARAMS ((bfd *abfd, asection *section,
|
||||
asymbol **symbols, bfd_vma offset, CONST char **filename_ptr,
|
||||
CONST char **functionname_ptr, unsigned int *line_ptr));
|
||||
|
||||
long
|
||||
NAME(aout,read_minisymbols) PARAMS ((bfd *, boolean, PTR *, unsigned int *));
|
||||
|
||||
asymbol *
|
||||
NAME(aout,minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
|
||||
asymbol *));
|
||||
|
||||
int
|
||||
NAME(aout,sizeof_headers) PARAMS ((bfd *abfd, boolean exec));
|
||||
|
||||
boolean
|
||||
NAME(aout,adjust_sizes_and_vmas) PARAMS ((bfd *abfd,
|
||||
bfd_size_type *text_size, file_ptr *text_end));
|
||||
|
||||
void
|
||||
NAME(aout,swap_exec_header_in) PARAMS ((bfd *abfd,
|
||||
struct external_exec *raw_bytes, struct internal_exec *execp));
|
||||
|
||||
void
|
||||
NAME(aout,swap_exec_header_out) PARAMS ((bfd *abfd,
|
||||
struct internal_exec *execp, struct external_exec *raw_bytes));
|
||||
|
||||
struct bfd_hash_entry *
|
||||
NAME(aout,link_hash_newfunc)
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
|
||||
boolean
|
||||
NAME(aout,link_hash_table_init)
|
||||
PARAMS ((struct aout_link_hash_table *, bfd *,
|
||||
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
||||
struct bfd_hash_table *,
|
||||
const char *)));
|
||||
|
||||
struct bfd_link_hash_table *
|
||||
NAME(aout,link_hash_table_create) PARAMS ((bfd *));
|
||||
|
||||
boolean
|
||||
NAME(aout,link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
boolean
|
||||
NAME(aout,final_link) PARAMS ((bfd *, struct bfd_link_info *,
|
||||
void (*) (bfd *, file_ptr *, file_ptr *,
|
||||
file_ptr *)));
|
||||
|
||||
boolean
|
||||
NAME(aout,bfd_free_cached_info) PARAMS ((bfd *));
|
||||
|
||||
/* A.out uses the generic versions of these routines... */
|
||||
|
||||
#define aout_32_get_section_contents _bfd_generic_get_section_contents
|
||||
|
||||
#define aout_64_get_section_contents _bfd_generic_get_section_contents
|
||||
#ifndef NO_WRITE_HEADER_KLUDGE
|
||||
#define NO_WRITE_HEADER_KLUDGE 0
|
||||
#endif
|
||||
|
||||
#ifndef aout_32_bfd_is_local_label
|
||||
#define aout_32_bfd_is_local_label bfd_generic_is_local_label
|
||||
#endif
|
||||
|
||||
#ifndef WRITE_HEADERS
|
||||
#define WRITE_HEADERS(abfd, execp) \
|
||||
{ \
|
||||
bfd_size_type text_size; /* dummy vars */ \
|
||||
file_ptr text_end; \
|
||||
if (adata(abfd).magic == undecided_magic) \
|
||||
NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \
|
||||
\
|
||||
execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
|
||||
execp->a_entry = bfd_get_start_address (abfd); \
|
||||
\
|
||||
execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
|
||||
obj_reloc_entry_size (abfd)); \
|
||||
execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
|
||||
obj_reloc_entry_size (abfd)); \
|
||||
NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
|
||||
\
|
||||
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; \
|
||||
if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) \
|
||||
!= EXEC_BYTES_SIZE) \
|
||||
return false; \
|
||||
/* Now write out reloc info, followed by syms and strings */ \
|
||||
\
|
||||
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
|
||||
&& bfd_get_symcount (abfd) != 0) \
|
||||
{ \
|
||||
if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) \
|
||||
!= 0) \
|
||||
return false; \
|
||||
\
|
||||
if (! NAME(aout,write_syms)(abfd)) return false; \
|
||||
\
|
||||
if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) \
|
||||
!= 0) \
|
||||
return false; \
|
||||
\
|
||||
if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
|
||||
return false; \
|
||||
if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) \
|
||||
!= 0) \
|
||||
return false; \
|
||||
\
|
||||
if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) \
|
||||
return false; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! defined (LIBAOUT_H) */
|
File diff suppressed because it is too large
Load Diff
@ -1,735 +0,0 @@
|
||||
/* libbfd.h -- Declarations used by bfd library *implementation*.
|
||||
(This include file is not for users of the library.)
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
** NOTE: libbfd.h is a GENERATED file. Don't change it; instead,
|
||||
** change libbfd-in.h or the other BFD source files processed to
|
||||
** generate this file.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Align an address upward to a boundary, expressed as a number of bytes.
|
||||
E.g. align to an 8-byte boundary with argument of 8. */
|
||||
#define BFD_ALIGN(this, boundary) \
|
||||
((( (this) + ((boundary) -1)) & (~((boundary)-1))))
|
||||
|
||||
/* If you want to read and write large blocks, you might want to do it
|
||||
in quanta of this amount */
|
||||
#define DEFAULT_BUFFERSIZE 8192
|
||||
|
||||
/* Set a tdata field. Can't use the other macros for this, since they
|
||||
do casts, and casting to the left of assignment isn't portable. */
|
||||
#define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v))
|
||||
|
||||
/* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points
|
||||
to an instance of this structure. */
|
||||
|
||||
struct bfd_in_memory
|
||||
{
|
||||
/* Size of buffer. */
|
||||
bfd_size_type size;
|
||||
/* Buffer holding contents of BFD. */
|
||||
bfd_byte *buffer;
|
||||
};
|
||||
|
||||
/* tdata for an archive. For an input archive, cache
|
||||
needs to be free()'d. For an output archive, symdefs do. */
|
||||
|
||||
struct artdata {
|
||||
file_ptr first_file_filepos;
|
||||
/* Speed up searching the armap */
|
||||
struct ar_cache *cache;
|
||||
bfd *archive_head; /* Only interesting in output routines */
|
||||
carsym *symdefs; /* the symdef entries */
|
||||
symindex symdef_count; /* how many there are */
|
||||
char *extended_names; /* clever intel extension */
|
||||
/* when more compilers are standard C, this can be a time_t */
|
||||
long armap_timestamp; /* Timestamp value written into armap.
|
||||
This is used for BSD archives to check
|
||||
that the timestamp is recent enough
|
||||
for the BSD linker to not complain,
|
||||
just before we finish writing an
|
||||
archive. */
|
||||
file_ptr armap_datepos; /* Position within archive to seek to
|
||||
rewrite the date field. */
|
||||
PTR tdata; /* Backend specific information. */
|
||||
};
|
||||
|
||||
#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
|
||||
|
||||
/* Goes in bfd's arelt_data slot */
|
||||
struct areltdata {
|
||||
char * arch_header; /* it's actually a string */
|
||||
unsigned int parsed_size; /* octets of filesize not including ar_hdr */
|
||||
char *filename; /* null-terminated */
|
||||
};
|
||||
|
||||
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
|
||||
|
||||
extern PTR bfd_malloc PARAMS ((size_t));
|
||||
extern PTR bfd_realloc PARAMS ((PTR, size_t));
|
||||
extern PTR bfd_zmalloc PARAMS ((size_t));
|
||||
|
||||
extern bfd_error_handler_type _bfd_error_handler;
|
||||
|
||||
/* These routines allocate and free things on the BFD's obstack. */
|
||||
|
||||
PTR bfd_alloc PARAMS ((bfd *abfd, size_t size));
|
||||
PTR bfd_zalloc PARAMS ((bfd *abfd, size_t size));
|
||||
void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, size_t size));
|
||||
PTR bfd_alloc_finish PARAMS ((bfd *abfd));
|
||||
PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t wanted));
|
||||
|
||||
#define bfd_release(x,y) (void) obstack_free(&(x->memory),y)
|
||||
|
||||
bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd));
|
||||
bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index));
|
||||
boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *));
|
||||
boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd));
|
||||
const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd));
|
||||
boolean bfd_slurp_armap PARAMS ((bfd *abfd));
|
||||
boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd));
|
||||
#define bfd_slurp_bsd_armap bfd_slurp_armap
|
||||
#define bfd_slurp_coff_armap bfd_slurp_armap
|
||||
boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd));
|
||||
extern boolean _bfd_construct_extended_name_table
|
||||
PARAMS ((bfd *, boolean, char **, bfd_size_type *));
|
||||
boolean _bfd_write_archive_contents PARAMS ((bfd *abfd));
|
||||
boolean _bfd_compute_and_write_armap PARAMS ((bfd *, unsigned int elength));
|
||||
bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos));
|
||||
extern bfd *_bfd_generic_get_elt_at_index PARAMS ((bfd *, symindex));
|
||||
bfd * _bfd_new_bfd PARAMS ((void));
|
||||
|
||||
boolean bfd_false PARAMS ((bfd *ignore));
|
||||
boolean bfd_true PARAMS ((bfd *ignore));
|
||||
PTR bfd_nullvoidptr PARAMS ((bfd *ignore));
|
||||
int bfd_0 PARAMS ((bfd *ignore));
|
||||
unsigned int bfd_0u PARAMS ((bfd *ignore));
|
||||
long bfd_0l PARAMS ((bfd *ignore));
|
||||
long _bfd_n1 PARAMS ((bfd *ignore));
|
||||
void bfd_void PARAMS ((bfd *ignore));
|
||||
|
||||
bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *));
|
||||
const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd));
|
||||
|
||||
void bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
|
||||
char *hdr));
|
||||
void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
|
||||
char *hdr));
|
||||
void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
|
||||
char *hdr));
|
||||
|
||||
boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength,
|
||||
struct orl *map, unsigned int orl_count, int stridx));
|
||||
|
||||
boolean coff_write_armap PARAMS ((bfd *arch, unsigned int elength,
|
||||
struct orl *map, unsigned int orl_count, int stridx));
|
||||
|
||||
extern PTR _bfd_generic_read_ar_hdr PARAMS ((bfd *));
|
||||
|
||||
extern PTR _bfd_generic_read_ar_hdr_mag PARAMS ((bfd *, const char *));
|
||||
|
||||
bfd * bfd_generic_openr_next_archived_file PARAMS ((bfd *archive,
|
||||
bfd *last_file));
|
||||
|
||||
int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
|
||||
|
||||
#define _bfd_read_ar_hdr(abfd) \
|
||||
BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
|
||||
|
||||
/* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use
|
||||
BFD_JUMP_TABLE_GENERIC (_bfd_generic). */
|
||||
|
||||
#define _bfd_generic_close_and_cleanup bfd_true
|
||||
#define _bfd_generic_bfd_free_cached_info bfd_true
|
||||
#define _bfd_generic_new_section_hook \
|
||||
((boolean (*) PARAMS ((bfd *, asection *))) bfd_true)
|
||||
extern boolean _bfd_generic_get_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR location, file_ptr offset,
|
||||
bfd_size_type count));
|
||||
extern boolean _bfd_generic_get_section_contents_in_window
|
||||
PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type));
|
||||
|
||||
/* Generic routines to use for BFD_JUMP_TABLE_COPY. Use
|
||||
BFD_JUMP_TABLE_COPY (_bfd_generic). */
|
||||
|
||||
#define _bfd_generic_bfd_copy_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
|
||||
#define _bfd_generic_bfd_merge_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
|
||||
#define _bfd_generic_bfd_set_private_flags \
|
||||
((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
|
||||
#define _bfd_generic_bfd_copy_private_section_data \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
|
||||
#define _bfd_generic_bfd_copy_private_symbol_data \
|
||||
((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true)
|
||||
#define _bfd_generic_bfd_print_private_bfd_data \
|
||||
((boolean (*) PARAMS ((bfd *, PTR))) bfd_true)
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
|
||||
support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
|
||||
|
||||
extern char *_bfd_nocore_core_file_failing_command PARAMS ((bfd *));
|
||||
extern int _bfd_nocore_core_file_failing_signal PARAMS ((bfd *));
|
||||
extern boolean _bfd_nocore_core_file_matches_executable_p
|
||||
PARAMS ((bfd *, bfd *));
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
|
||||
file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */
|
||||
|
||||
#define _bfd_noarchive_slurp_armap bfd_false
|
||||
#define _bfd_noarchive_slurp_extended_name_table bfd_false
|
||||
#define _bfd_noarchive_construct_extended_name_table \
|
||||
((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
|
||||
bfd_false)
|
||||
#define _bfd_noarchive_truncate_arname \
|
||||
((void (*) PARAMS ((bfd *, const char *, char *))) bfd_void)
|
||||
#define _bfd_noarchive_write_armap \
|
||||
((boolean (*) \
|
||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
|
||||
bfd_false)
|
||||
#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr
|
||||
#define _bfd_noarchive_openr_next_archived_file \
|
||||
((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr)
|
||||
#define _bfd_noarchive_get_elt_at_index \
|
||||
((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr)
|
||||
#define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
|
||||
#define _bfd_noarchive_update_armap_timestamp bfd_false
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style
|
||||
archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */
|
||||
|
||||
#define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap
|
||||
#define _bfd_archive_bsd_slurp_extended_name_table \
|
||||
_bfd_slurp_extended_name_table
|
||||
extern boolean _bfd_archive_bsd_construct_extended_name_table
|
||||
PARAMS ((bfd *, char **, bfd_size_type *, const char **));
|
||||
#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
|
||||
#define _bfd_archive_bsd_write_armap bsd_write_armap
|
||||
#define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
|
||||
#define _bfd_archive_bsd_openr_next_archived_file \
|
||||
bfd_generic_openr_next_archived_file
|
||||
#define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
|
||||
#define _bfd_archive_bsd_generic_stat_arch_elt \
|
||||
bfd_generic_stat_arch_elt
|
||||
extern boolean _bfd_archive_bsd_update_armap_timestamp PARAMS ((bfd *));
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
|
||||
archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */
|
||||
|
||||
#define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap
|
||||
#define _bfd_archive_coff_slurp_extended_name_table \
|
||||
_bfd_slurp_extended_name_table
|
||||
extern boolean _bfd_archive_coff_construct_extended_name_table
|
||||
PARAMS ((bfd *, char **, bfd_size_type *, const char **));
|
||||
#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
|
||||
#define _bfd_archive_coff_write_armap coff_write_armap
|
||||
#define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
|
||||
#define _bfd_archive_coff_openr_next_archived_file \
|
||||
bfd_generic_openr_next_archived_file
|
||||
#define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
|
||||
#define _bfd_archive_coff_generic_stat_arch_elt \
|
||||
bfd_generic_stat_arch_elt
|
||||
#define _bfd_archive_coff_update_armap_timestamp bfd_true
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
|
||||
support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
|
||||
|
||||
#define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1
|
||||
#define _bfd_nosymbols_get_symtab \
|
||||
((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1)
|
||||
#define _bfd_nosymbols_make_empty_symbol \
|
||||
((asymbol *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
|
||||
#define _bfd_nosymbols_print_symbol \
|
||||
((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void)
|
||||
#define _bfd_nosymbols_get_symbol_info \
|
||||
((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void)
|
||||
#define _bfd_nosymbols_bfd_is_local_label \
|
||||
((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
|
||||
#define _bfd_nosymbols_get_lineno \
|
||||
((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr)
|
||||
#define _bfd_nosymbols_find_nearest_line \
|
||||
((boolean (*) \
|
||||
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, \
|
||||
const char **, unsigned int *))) \
|
||||
bfd_false)
|
||||
#define _bfd_nosymbols_bfd_make_debug_symbol \
|
||||
((asymbol *(*) PARAMS ((bfd *, PTR, unsigned long))) bfd_nullvoidptr)
|
||||
#define _bfd_nosymbols_read_minisymbols \
|
||||
((long (*) PARAMS ((bfd *, boolean, PTR *, unsigned int *))) _bfd_n1)
|
||||
#define _bfd_nosymbols_minisymbol_to_symbol \
|
||||
((asymbol *(*) PARAMS ((bfd *, boolean, const PTR, asymbol *))) \
|
||||
bfd_nullvoidptr)
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
|
||||
support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
|
||||
|
||||
#define _bfd_norelocs_get_reloc_upper_bound \
|
||||
((long (*) PARAMS ((bfd *, asection *))) _bfd_n1)
|
||||
#define _bfd_norelocs_canonicalize_reloc \
|
||||
((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) _bfd_n1)
|
||||
#define _bfd_norelocs_bfd_reloc_type_lookup \
|
||||
((reloc_howto_type *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) \
|
||||
bfd_nullvoidptr)
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
|
||||
be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
|
||||
|
||||
#define _bfd_nowrite_set_arch_mach \
|
||||
((boolean (*) PARAMS ((bfd *, enum bfd_architecture, unsigned long))) \
|
||||
bfd_false)
|
||||
#define _bfd_nowrite_set_section_contents \
|
||||
((boolean (*) PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type))) \
|
||||
bfd_false)
|
||||
|
||||
/* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use
|
||||
BFD_JUMP_TABLE_WRITE (_bfd_generic). */
|
||||
|
||||
#define _bfd_generic_set_arch_mach bfd_default_set_arch_mach
|
||||
extern boolean _bfd_generic_set_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
|
||||
support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */
|
||||
|
||||
#define _bfd_nolink_sizeof_headers ((int (*) PARAMS ((bfd *, boolean))) bfd_0)
|
||||
#define _bfd_nolink_bfd_get_relocated_section_contents \
|
||||
((bfd_byte *(*) \
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, \
|
||||
bfd_byte *, boolean, asymbol **))) \
|
||||
bfd_nullvoidptr)
|
||||
#define _bfd_nolink_bfd_relax_section \
|
||||
((boolean (*) \
|
||||
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *))) \
|
||||
bfd_false)
|
||||
#define _bfd_nolink_bfd_link_hash_table_create \
|
||||
((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
|
||||
#define _bfd_nolink_bfd_link_add_symbols \
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define _bfd_nolink_bfd_final_link \
|
||||
((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
|
||||
#define _bfd_nolink_bfd_link_split_section \
|
||||
((boolean (*) PARAMS ((bfd *, struct sec *))) bfd_false)
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
|
||||
have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
|
||||
(_bfd_nodynamic). */
|
||||
|
||||
#define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1
|
||||
#define _bfd_nodynamic_canonicalize_dynamic_symtab \
|
||||
((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1)
|
||||
#define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1
|
||||
#define _bfd_nodynamic_canonicalize_dynamic_reloc \
|
||||
((long (*) PARAMS ((bfd *, arelent **, asymbol **))) _bfd_n1)
|
||||
|
||||
/* Generic routine to determine of the given symbol is a local
|
||||
label. */
|
||||
extern boolean bfd_generic_is_local_label PARAMS ((bfd *, asymbol *));
|
||||
|
||||
/* Generic minisymbol routines. */
|
||||
extern long _bfd_generic_read_minisymbols
|
||||
PARAMS ((bfd *, boolean, PTR *, unsigned int *));
|
||||
extern asymbol *_bfd_generic_minisymbol_to_symbol
|
||||
PARAMS ((bfd *, boolean, const PTR, asymbol *));
|
||||
|
||||
/* Find the nearest line using .stab/.stabstr sections. */
|
||||
extern boolean _bfd_stab_section_find_nearest_line
|
||||
PARAMS ((bfd *, asymbol **, asection *, bfd_vma, boolean *, const char **,
|
||||
const char **, unsigned int *, PTR *));
|
||||
|
||||
/* A routine to create entries for a bfd_link_hash_table. */
|
||||
extern struct bfd_hash_entry *_bfd_link_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *entry,
|
||||
struct bfd_hash_table *table,
|
||||
const char *string));
|
||||
|
||||
/* Initialize a bfd_link_hash_table. */
|
||||
extern boolean _bfd_link_hash_table_init
|
||||
PARAMS ((struct bfd_link_hash_table *, bfd *,
|
||||
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
||||
struct bfd_hash_table *,
|
||||
const char *)));
|
||||
|
||||
/* Generic link hash table creation routine. */
|
||||
extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
|
||||
/* Generic add symbol routine. */
|
||||
extern boolean _bfd_generic_link_add_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* Generic add symbol routine. This version is used by targets for
|
||||
which the linker must collect constructors and destructors by name,
|
||||
as the collect2 program does. */
|
||||
extern boolean _bfd_generic_link_add_symbols_collect
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* Generic archive add symbol routine. */
|
||||
extern boolean _bfd_generic_link_add_archive_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *,
|
||||
boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *)));
|
||||
|
||||
/* Forward declaration to avoid prototype errors. */
|
||||
typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
|
||||
|
||||
/* Generic routine to add a single symbol. */
|
||||
extern boolean _bfd_generic_link_add_one_symbol
|
||||
PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword,
|
||||
asection *, bfd_vma, const char *, boolean copy,
|
||||
boolean constructor, struct bfd_link_hash_entry **));
|
||||
|
||||
/* Generic link routine. */
|
||||
extern boolean _bfd_generic_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
extern boolean _bfd_generic_link_split_section
|
||||
PARAMS ((bfd *, struct sec *));
|
||||
|
||||
/* Generic reloc_link_order processing routine. */
|
||||
extern boolean _bfd_generic_reloc_link_order
|
||||
PARAMS ((bfd *, struct bfd_link_info *, asection *,
|
||||
struct bfd_link_order *));
|
||||
|
||||
/* Default link order processing routine. */
|
||||
extern boolean _bfd_default_link_order
|
||||
PARAMS ((bfd *, struct bfd_link_info *, asection *,
|
||||
struct bfd_link_order *));
|
||||
|
||||
/* Count the number of reloc entries in a link order list. */
|
||||
extern unsigned int _bfd_count_link_order_relocs
|
||||
PARAMS ((struct bfd_link_order *));
|
||||
|
||||
/* Final link relocation routine. */
|
||||
extern bfd_reloc_status_type _bfd_final_link_relocate
|
||||
PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
|
||||
bfd_vma address, bfd_vma value, bfd_vma addend));
|
||||
|
||||
/* Relocate a particular location by a howto and a value. */
|
||||
extern bfd_reloc_status_type _bfd_relocate_contents
|
||||
PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *));
|
||||
|
||||
/* Create a string table. */
|
||||
extern struct bfd_strtab_hash *_bfd_stringtab_init PARAMS ((void));
|
||||
|
||||
/* Create an XCOFF .debug section style string table. */
|
||||
extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init PARAMS ((void));
|
||||
|
||||
/* Free a string table. */
|
||||
extern void _bfd_stringtab_free PARAMS ((struct bfd_strtab_hash *));
|
||||
|
||||
/* Get the size of a string table. */
|
||||
extern bfd_size_type _bfd_stringtab_size PARAMS ((struct bfd_strtab_hash *));
|
||||
|
||||
/* Add a string to a string table. */
|
||||
extern bfd_size_type _bfd_stringtab_add
|
||||
PARAMS ((struct bfd_strtab_hash *, const char *, boolean hash,
|
||||
boolean copy));
|
||||
|
||||
/* Write out a string table. */
|
||||
extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *));
|
||||
|
||||
/* Macros to tell if bfds are read or write enabled.
|
||||
|
||||
Note that bfds open for read may be scribbled into if the fd passed
|
||||
to bfd_fdopenr is actually open both for read and write
|
||||
simultaneously. However an output bfd will never be open for
|
||||
read. Therefore sometimes you want to check bfd_read_p or
|
||||
!bfd_read_p, and only sometimes bfd_write_p.
|
||||
*/
|
||||
|
||||
#define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
|
||||
#define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
|
||||
|
||||
void bfd_assert PARAMS ((const char*,int));
|
||||
|
||||
#define BFD_ASSERT(x) \
|
||||
{ if (!(x)) bfd_assert(__FILE__,__LINE__); }
|
||||
|
||||
#define BFD_FAIL() \
|
||||
{ bfd_assert(__FILE__,__LINE__); }
|
||||
|
||||
FILE * bfd_cache_lookup_worker PARAMS ((bfd *));
|
||||
|
||||
extern bfd *bfd_last_cache;
|
||||
|
||||
/* Now Steve, what's the story here? */
|
||||
#ifdef lint
|
||||
#define itos(x) "l"
|
||||
#define stoi(x) 1
|
||||
#else
|
||||
#define itos(x) ((char*)(x))
|
||||
#define stoi(x) ((int)(x))
|
||||
#endif
|
||||
|
||||
/* List of supported target vectors, and the default vector (if
|
||||
bfd_default_vector[0] is NULL, there is no default). */
|
||||
extern const bfd_target * const bfd_target_vector[];
|
||||
extern const bfd_target * const bfd_default_vector[];
|
||||
|
||||
/* Functions shared by the ECOFF and MIPS ELF backends, which have no
|
||||
other common header files. */
|
||||
|
||||
#if defined(__STDC__) || defined(ALMOST_STDC)
|
||||
struct ecoff_find_line;
|
||||
#endif
|
||||
|
||||
extern boolean _bfd_ecoff_locate_line
|
||||
PARAMS ((bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
|
||||
const struct ecoff_debug_swap * const, struct ecoff_find_line *,
|
||||
const char **, const char **, unsigned int *));
|
||||
extern boolean _bfd_ecoff_get_accumulated_pdr PARAMS ((PTR, bfd_byte *));
|
||||
extern boolean _bfd_ecoff_get_accumulated_sym PARAMS ((PTR, bfd_byte *));
|
||||
extern boolean _bfd_ecoff_get_accumulated_ss PARAMS ((PTR, bfd_byte *));
|
||||
|
||||
extern bfd_vma _bfd_get_gp_value PARAMS ((bfd *));
|
||||
extern void _bfd_set_gp_value PARAMS ((bfd *, bfd_vma));
|
||||
|
||||
/* And more follows */
|
||||
|
||||
void
|
||||
bfd_write_bigendian_4byte_int PARAMS ((bfd *abfd, int i));
|
||||
|
||||
unsigned int
|
||||
bfd_log2 PARAMS ((bfd_vma x));
|
||||
|
||||
#define BFD_CACHE_MAX_OPEN 10
|
||||
extern bfd *bfd_last_cache;
|
||||
|
||||
#define bfd_cache_lookup(x) \
|
||||
((x)==bfd_last_cache? \
|
||||
(FILE*)(bfd_last_cache->iostream): \
|
||||
bfd_cache_lookup_worker(x))
|
||||
boolean
|
||||
bfd_cache_init PARAMS ((bfd *abfd));
|
||||
|
||||
boolean
|
||||
bfd_cache_close PARAMS ((bfd *abfd));
|
||||
|
||||
FILE*
|
||||
bfd_open_file PARAMS ((bfd *abfd));
|
||||
|
||||
FILE *
|
||||
bfd_cache_lookup_worker PARAMS ((bfd *abfd));
|
||||
|
||||
#ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real
|
||||
|
||||
static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
|
||||
"BFD_RELOC_64",
|
||||
"BFD_RELOC_32",
|
||||
"BFD_RELOC_26",
|
||||
"BFD_RELOC_16",
|
||||
"BFD_RELOC_14",
|
||||
"BFD_RELOC_8",
|
||||
"BFD_RELOC_64_PCREL",
|
||||
"BFD_RELOC_32_PCREL",
|
||||
"BFD_RELOC_24_PCREL",
|
||||
"BFD_RELOC_16_PCREL",
|
||||
"BFD_RELOC_12_PCREL",
|
||||
"BFD_RELOC_8_PCREL",
|
||||
"BFD_RELOC_32_GOT_PCREL",
|
||||
"BFD_RELOC_16_GOT_PCREL",
|
||||
"BFD_RELOC_8_GOT_PCREL",
|
||||
"BFD_RELOC_32_GOTOFF",
|
||||
"BFD_RELOC_16_GOTOFF",
|
||||
"BFD_RELOC_LO16_GOTOFF",
|
||||
"BFD_RELOC_HI16_GOTOFF",
|
||||
"BFD_RELOC_HI16_S_GOTOFF",
|
||||
"BFD_RELOC_8_GOTOFF",
|
||||
"BFD_RELOC_32_PLT_PCREL",
|
||||
"BFD_RELOC_24_PLT_PCREL",
|
||||
"BFD_RELOC_16_PLT_PCREL",
|
||||
"BFD_RELOC_8_PLT_PCREL",
|
||||
"BFD_RELOC_32_PLTOFF",
|
||||
"BFD_RELOC_16_PLTOFF",
|
||||
"BFD_RELOC_LO16_PLTOFF",
|
||||
"BFD_RELOC_HI16_PLTOFF",
|
||||
"BFD_RELOC_HI16_S_PLTOFF",
|
||||
"BFD_RELOC_8_PLTOFF",
|
||||
"BFD_RELOC_68K_GLOB_DAT",
|
||||
"BFD_RELOC_68K_JMP_SLOT",
|
||||
"BFD_RELOC_68K_RELATIVE",
|
||||
"BFD_RELOC_32_BASEREL",
|
||||
"BFD_RELOC_16_BASEREL",
|
||||
"BFD_RELOC_LO16_BASEREL",
|
||||
"BFD_RELOC_HI16_BASEREL",
|
||||
"BFD_RELOC_HI16_S_BASEREL",
|
||||
"BFD_RELOC_8_BASEREL",
|
||||
"BFD_RELOC_RVA",
|
||||
"BFD_RELOC_8_FFnn",
|
||||
"BFD_RELOC_32_PCREL_S2",
|
||||
"BFD_RELOC_16_PCREL_S2",
|
||||
"BFD_RELOC_23_PCREL_S2",
|
||||
"BFD_RELOC_HI22",
|
||||
"BFD_RELOC_LO10",
|
||||
"BFD_RELOC_GPREL16",
|
||||
"BFD_RELOC_GPREL32",
|
||||
"BFD_RELOC_I960_CALLJ",
|
||||
"BFD_RELOC_NONE",
|
||||
"BFD_RELOC_SPARC_WDISP22",
|
||||
"BFD_RELOC_SPARC22",
|
||||
"BFD_RELOC_SPARC13",
|
||||
"BFD_RELOC_SPARC_GOT10",
|
||||
"BFD_RELOC_SPARC_GOT13",
|
||||
"BFD_RELOC_SPARC_GOT22",
|
||||
"BFD_RELOC_SPARC_PC10",
|
||||
"BFD_RELOC_SPARC_PC22",
|
||||
"BFD_RELOC_SPARC_WPLT30",
|
||||
"BFD_RELOC_SPARC_COPY",
|
||||
"BFD_RELOC_SPARC_GLOB_DAT",
|
||||
"BFD_RELOC_SPARC_JMP_SLOT",
|
||||
"BFD_RELOC_SPARC_RELATIVE",
|
||||
"BFD_RELOC_SPARC_UA32",
|
||||
"BFD_RELOC_SPARC_BASE13",
|
||||
"BFD_RELOC_SPARC_BASE22",
|
||||
"BFD_RELOC_SPARC_10",
|
||||
"BFD_RELOC_SPARC_11",
|
||||
"BFD_RELOC_SPARC_OLO10",
|
||||
"BFD_RELOC_SPARC_HH22",
|
||||
"BFD_RELOC_SPARC_HM10",
|
||||
"BFD_RELOC_SPARC_LM22",
|
||||
"BFD_RELOC_SPARC_PC_HH22",
|
||||
"BFD_RELOC_SPARC_PC_HM10",
|
||||
"BFD_RELOC_SPARC_PC_LM22",
|
||||
"BFD_RELOC_SPARC_WDISP16",
|
||||
"BFD_RELOC_SPARC_WDISP19",
|
||||
"BFD_RELOC_SPARC_GLOB_JMP",
|
||||
"BFD_RELOC_SPARC_7",
|
||||
"BFD_RELOC_SPARC_6",
|
||||
"BFD_RELOC_SPARC_5",
|
||||
"BFD_RELOC_ALPHA_GPDISP_HI16",
|
||||
"BFD_RELOC_ALPHA_GPDISP_LO16",
|
||||
"BFD_RELOC_ALPHA_LITERAL",
|
||||
"BFD_RELOC_ALPHA_LITUSE",
|
||||
"BFD_RELOC_ALPHA_HINT",
|
||||
"BFD_RELOC_MIPS_JMP",
|
||||
"BFD_RELOC_HI16",
|
||||
"BFD_RELOC_HI16_S",
|
||||
"BFD_RELOC_LO16",
|
||||
"BFD_RELOC_PCREL_HI16_S",
|
||||
"BFD_RELOC_PCREL_LO16",
|
||||
"BFD_RELOC_MIPS_LITERAL",
|
||||
"BFD_RELOC_MIPS_GOT16",
|
||||
"BFD_RELOC_MIPS_CALL16",
|
||||
"BFD_RELOC_MIPS_GOT_HI16",
|
||||
"BFD_RELOC_MIPS_GOT_LO16",
|
||||
"BFD_RELOC_MIPS_CALL_HI16",
|
||||
"BFD_RELOC_MIPS_CALL_LO16",
|
||||
"BFD_RELOC_386_GOT32",
|
||||
"BFD_RELOC_386_PLT32",
|
||||
"BFD_RELOC_386_COPY",
|
||||
"BFD_RELOC_386_GLOB_DAT",
|
||||
"BFD_RELOC_386_JUMP_SLOT",
|
||||
"BFD_RELOC_386_RELATIVE",
|
||||
"BFD_RELOC_386_GOTOFF",
|
||||
"BFD_RELOC_386_GOTPC",
|
||||
"BFD_RELOC_NS32K_IMM_8",
|
||||
"BFD_RELOC_NS32K_IMM_16",
|
||||
"BFD_RELOC_NS32K_IMM_32",
|
||||
"BFD_RELOC_NS32K_IMM_8_PCREL",
|
||||
"BFD_RELOC_NS32K_IMM_16_PCREL",
|
||||
"BFD_RELOC_NS32K_IMM_32_PCREL",
|
||||
"BFD_RELOC_NS32K_DISP_8",
|
||||
"BFD_RELOC_NS32K_DISP_16",
|
||||
"BFD_RELOC_NS32K_DISP_32",
|
||||
"BFD_RELOC_NS32K_DISP_8_PCREL",
|
||||
"BFD_RELOC_NS32K_DISP_16_PCREL",
|
||||
"BFD_RELOC_NS32K_DISP_32_PCREL",
|
||||
"BFD_RELOC_PPC_B26",
|
||||
"BFD_RELOC_PPC_BA26",
|
||||
"BFD_RELOC_PPC_TOC16",
|
||||
"BFD_RELOC_PPC_B16",
|
||||
"BFD_RELOC_PPC_B16_BRTAKEN",
|
||||
"BFD_RELOC_PPC_B16_BRNTAKEN",
|
||||
"BFD_RELOC_PPC_BA16",
|
||||
"BFD_RELOC_PPC_BA16_BRTAKEN",
|
||||
"BFD_RELOC_PPC_BA16_BRNTAKEN",
|
||||
"BFD_RELOC_PPC_COPY",
|
||||
"BFD_RELOC_PPC_GLOB_DAT",
|
||||
"BFD_RELOC_PPC_JMP_SLOT",
|
||||
"BFD_RELOC_PPC_RELATIVE",
|
||||
"BFD_RELOC_PPC_LOCAL24PC",
|
||||
"BFD_RELOC_PPC_EMB_NADDR32",
|
||||
"BFD_RELOC_PPC_EMB_NADDR16",
|
||||
"BFD_RELOC_PPC_EMB_NADDR16_LO",
|
||||
"BFD_RELOC_PPC_EMB_NADDR16_HI",
|
||||
"BFD_RELOC_PPC_EMB_NADDR16_HA",
|
||||
"BFD_RELOC_PPC_EMB_SDAI16",
|
||||
"BFD_RELOC_PPC_EMB_SDA2I16",
|
||||
"BFD_RELOC_PPC_EMB_SDA2REL",
|
||||
"BFD_RELOC_PPC_EMB_SDA21",
|
||||
"BFD_RELOC_PPC_EMB_MRKREF",
|
||||
"BFD_RELOC_PPC_EMB_RELSEC16",
|
||||
"BFD_RELOC_PPC_EMB_RELST_LO",
|
||||
"BFD_RELOC_PPC_EMB_RELST_HI",
|
||||
"BFD_RELOC_PPC_EMB_RELST_HA",
|
||||
"BFD_RELOC_PPC_EMB_BIT_FLD",
|
||||
"BFD_RELOC_PPC_EMB_RELSDA",
|
||||
"BFD_RELOC_CTOR",
|
||||
"BFD_RELOC_ARM_PCREL_BRANCH",
|
||||
"BFD_RELOC_ARM_IMMEDIATE",
|
||||
"BFD_RELOC_ARM_OFFSET_IMM",
|
||||
"BFD_RELOC_ARM_SHIFT_IMM",
|
||||
"BFD_RELOC_ARM_SWI",
|
||||
"BFD_RELOC_ARM_MULTI",
|
||||
"BFD_RELOC_ARM_CP_OFF_IMM",
|
||||
"BFD_RELOC_ARM_ADR_IMM",
|
||||
"BFD_RELOC_ARM_LDR_IMM",
|
||||
"BFD_RELOC_ARM_LITERAL",
|
||||
"BFD_RELOC_ARM_IN_POOL",
|
||||
"@@overflow: BFD_RELOC_UNUSED@@",
|
||||
};
|
||||
#endif
|
||||
|
||||
reloc_howto_type *
|
||||
bfd_default_reloc_type_lookup
|
||||
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
|
||||
|
||||
boolean
|
||||
bfd_generic_relax_section
|
||||
PARAMS ((bfd *abfd,
|
||||
asection *section,
|
||||
struct bfd_link_info *,
|
||||
boolean *));
|
||||
|
||||
bfd_byte *
|
||||
|
||||
bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
|
||||
struct bfd_link_info *link_info,
|
||||
struct bfd_link_order *link_order,
|
||||
bfd_byte *data,
|
||||
boolean relocateable,
|
||||
asymbol **symbols));
|
||||
|
||||
extern const bfd_arch_info_type bfd_default_arch_struct;
|
||||
boolean
|
||||
bfd_default_set_arch_mach PARAMS ((bfd *abfd,
|
||||
enum bfd_architecture arch,
|
||||
unsigned long mach));
|
||||
|
||||
const bfd_arch_info_type *
|
||||
bfd_default_compatible
|
||||
PARAMS ((const bfd_arch_info_type *a,
|
||||
const bfd_arch_info_type *b));
|
||||
|
||||
boolean
|
||||
bfd_default_scan PARAMS ((const struct bfd_arch_info *info, const char *string));
|
||||
|
||||
struct elf_internal_shdr *
|
||||
bfd_elf_find_section PARAMS ((bfd *abfd, char *name));
|
||||
|
@ -1,823 +0,0 @@
|
||||
/* BFD COFF object file private structure.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
** NOTE: libcoff.h is a GENERATED file. Don't change it; instead,
|
||||
** change libcoff-in.h or coffcode.h.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfdlink.h"
|
||||
|
||||
/* Object file tdata; access macros */
|
||||
|
||||
#define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
|
||||
#define exec_hdr(bfd) (coff_data(bfd)->hdr)
|
||||
#define obj_pe(bfd) (coff_data(bfd)->pe)
|
||||
#define obj_symbols(bfd) (coff_data(bfd)->symbols)
|
||||
#define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos)
|
||||
|
||||
#define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
|
||||
#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
|
||||
#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
|
||||
#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
|
||||
#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
|
||||
|
||||
#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms)
|
||||
#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms)
|
||||
#define obj_coff_strings(bfd) (coff_data (bfd)->strings)
|
||||
#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings)
|
||||
#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes)
|
||||
|
||||
#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map)
|
||||
|
||||
/* `Tdata' information kept for COFF files. */
|
||||
|
||||
typedef struct coff_tdata
|
||||
{
|
||||
struct coff_symbol_struct *symbols; /* symtab for input bfd */
|
||||
unsigned int *conversion_table;
|
||||
int conv_table_size;
|
||||
file_ptr sym_filepos;
|
||||
|
||||
struct coff_ptr_struct *raw_syments;
|
||||
unsigned int raw_syment_count;
|
||||
|
||||
/* These are only valid once writing has begun */
|
||||
long int relocbase;
|
||||
|
||||
/* These members communicate important constants about the symbol table
|
||||
to GDB's symbol-reading code. These `constants' unfortunately vary
|
||||
from coff implementation to implementation... */
|
||||
unsigned local_n_btmask;
|
||||
unsigned local_n_btshft;
|
||||
unsigned local_n_tmask;
|
||||
unsigned local_n_tshift;
|
||||
unsigned local_symesz;
|
||||
unsigned local_auxesz;
|
||||
unsigned local_linesz;
|
||||
|
||||
/* The unswapped external symbols. May be NULL. Read by
|
||||
_bfd_coff_get_external_symbols. */
|
||||
PTR external_syms;
|
||||
/* If this is true, the external_syms may not be freed. */
|
||||
boolean keep_syms;
|
||||
|
||||
/* The string table. May be NULL. Read by
|
||||
_bfd_coff_read_string_table. */
|
||||
char *strings;
|
||||
/* If this is true, the strings may not be freed. */
|
||||
boolean keep_strings;
|
||||
|
||||
/* is this a PE format coff file */
|
||||
int pe;
|
||||
/* Used by the COFF backend linker. */
|
||||
struct coff_link_hash_entry **sym_hashes;
|
||||
|
||||
/* used by the pe linker for PowerPC */
|
||||
int *local_toc_sym_map;
|
||||
|
||||
struct bfd_link_info *link_info;
|
||||
|
||||
/* Used by coff_find_nearest_line. */
|
||||
PTR line_info;
|
||||
} coff_data_type;
|
||||
|
||||
/* Tdata for pe image files. */
|
||||
typedef struct pe_tdata
|
||||
{
|
||||
coff_data_type coff;
|
||||
struct internal_extra_pe_aouthdr pe_opthdr;
|
||||
int dll;
|
||||
int has_reloc_section;
|
||||
boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
|
||||
flagword real_flags;
|
||||
} pe_data_type;
|
||||
|
||||
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
|
||||
|
||||
/* Tdata for XCOFF files. */
|
||||
|
||||
struct xcoff_tdata
|
||||
{
|
||||
/* Basic COFF information. */
|
||||
coff_data_type coff;
|
||||
|
||||
/* True if a large a.out header should be generated. */
|
||||
boolean full_aouthdr;
|
||||
|
||||
/* TOC value. */
|
||||
bfd_vma toc;
|
||||
|
||||
/* Index of section holding TOC. */
|
||||
int sntoc;
|
||||
|
||||
/* Index of section holding entry point. */
|
||||
int snentry;
|
||||
|
||||
/* .text alignment from optional header. */
|
||||
int text_align_power;
|
||||
|
||||
/* .data alignment from optional header. */
|
||||
int data_align_power;
|
||||
|
||||
/* modtype from optional header. */
|
||||
short modtype;
|
||||
|
||||
/* cputype from optional header. */
|
||||
short cputype;
|
||||
|
||||
/* maxdata from optional header. */
|
||||
bfd_size_type maxdata;
|
||||
|
||||
/* maxstack from optional header. */
|
||||
bfd_size_type maxstack;
|
||||
|
||||
/* Used by the XCOFF backend linker. */
|
||||
asection **csects;
|
||||
unsigned long *debug_indices;
|
||||
unsigned int import_file_id;
|
||||
};
|
||||
|
||||
#define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data)
|
||||
|
||||
/* We take the address of the first element of a asymbol to ensure that the
|
||||
* macro is only ever applied to an asymbol. */
|
||||
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
|
||||
|
||||
/* The used_by_bfd field of a section may be set to a pointer to this
|
||||
structure. */
|
||||
|
||||
struct coff_section_tdata
|
||||
{
|
||||
/* The relocs, swapped into COFF internal form. This may be NULL. */
|
||||
struct internal_reloc *relocs;
|
||||
/* If this is true, the relocs entry may not be freed. */
|
||||
boolean keep_relocs;
|
||||
/* The section contents. This may be NULL. */
|
||||
bfd_byte *contents;
|
||||
/* If this is true, the contents entry may not be freed. */
|
||||
boolean keep_contents;
|
||||
/* Information cached by coff_find_nearest_line. */
|
||||
bfd_vma offset;
|
||||
unsigned int i;
|
||||
const char *function;
|
||||
int line_base;
|
||||
/* Available for individual backends. */
|
||||
PTR tdata;
|
||||
};
|
||||
|
||||
/* An accessor macro for the coff_section_tdata structure. */
|
||||
#define coff_section_data(abfd, sec) \
|
||||
((struct coff_section_tdata *) (sec)->used_by_bfd)
|
||||
|
||||
/* Tdata for sections in XCOFF files. This is used by the linker. */
|
||||
|
||||
struct xcoff_section_tdata
|
||||
{
|
||||
/* Used for XCOFF csects created by the linker; points to the real
|
||||
XCOFF section which contains this csect. */
|
||||
asection *enclosing;
|
||||
/* The lineno_count field for the enclosing section, because we are
|
||||
going to clobber it there. */
|
||||
unsigned int lineno_count;
|
||||
/* The first and one past the last symbol indices for symbols used
|
||||
by this csect. */
|
||||
unsigned long first_symndx;
|
||||
unsigned long last_symndx;
|
||||
};
|
||||
|
||||
/* An accessor macro the xcoff_section_tdata structure. */
|
||||
#define xcoff_section_data(abfd, sec) \
|
||||
((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
|
||||
|
||||
/* COFF linker hash table entries. */
|
||||
|
||||
struct coff_link_hash_entry
|
||||
{
|
||||
struct bfd_link_hash_entry root;
|
||||
|
||||
/* Symbol index in output file. Set to -1 initially. Set to -2 if
|
||||
there is a reloc against this symbol. */
|
||||
long indx;
|
||||
|
||||
/* Symbol type. */
|
||||
unsigned short type;
|
||||
|
||||
/* Symbol class. */
|
||||
unsigned char class;
|
||||
|
||||
/* Number of auxiliary entries. */
|
||||
char numaux;
|
||||
|
||||
/* BFD to take auxiliary entries from. */
|
||||
bfd *auxbfd;
|
||||
|
||||
/* Pointer to array of auxiliary entries, if any. */
|
||||
union internal_auxent *aux;
|
||||
};
|
||||
|
||||
/* COFF linker hash table. */
|
||||
|
||||
struct coff_link_hash_table
|
||||
{
|
||||
struct bfd_link_hash_table root;
|
||||
};
|
||||
|
||||
/* Look up an entry in a COFF linker hash table. */
|
||||
|
||||
#define coff_link_hash_lookup(table, string, create, copy, follow) \
|
||||
((struct coff_link_hash_entry *) \
|
||||
bfd_link_hash_lookup (&(table)->root, (string), (create), \
|
||||
(copy), (follow)))
|
||||
|
||||
/* Traverse a COFF linker hash table. */
|
||||
|
||||
#define coff_link_hash_traverse(table, func, info) \
|
||||
(bfd_link_hash_traverse \
|
||||
(&(table)->root, \
|
||||
(boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
||||
(info)))
|
||||
|
||||
/* Get the COFF linker hash table from a link_info structure. */
|
||||
|
||||
#define coff_hash_table(p) ((struct coff_link_hash_table *) ((p)->hash))
|
||||
|
||||
/* Functions in coffgen.c. */
|
||||
extern const bfd_target *coff_object_p PARAMS ((bfd *));
|
||||
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
|
||||
extern long coff_get_symtab_upper_bound PARAMS ((bfd *));
|
||||
extern long coff_get_symtab PARAMS ((bfd *, asymbol **));
|
||||
extern int coff_count_linenumbers PARAMS ((bfd *));
|
||||
extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
|
||||
extern boolean coff_renumber_symbols PARAMS ((bfd *, int *));
|
||||
extern void coff_mangle_symbols PARAMS ((bfd *));
|
||||
extern boolean coff_write_symbols PARAMS ((bfd *));
|
||||
extern boolean coff_write_linenumbers PARAMS ((bfd *));
|
||||
extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
|
||||
extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
|
||||
extern boolean _bfd_coff_get_external_symbols PARAMS ((bfd *));
|
||||
extern const char *_bfd_coff_read_string_table PARAMS ((bfd *));
|
||||
extern boolean _bfd_coff_free_symbols PARAMS ((bfd *));
|
||||
extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *));
|
||||
extern long coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
|
||||
extern asymbol *coff_make_empty_symbol PARAMS ((bfd *));
|
||||
extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *,
|
||||
bfd_print_symbol_type how));
|
||||
extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *,
|
||||
symbol_info *ret));
|
||||
extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR,
|
||||
unsigned long));
|
||||
extern boolean coff_find_nearest_line PARAMS ((bfd *,
|
||||
asection *,
|
||||
asymbol **,
|
||||
bfd_vma offset,
|
||||
CONST char **filename_ptr,
|
||||
CONST char **functionname_ptr,
|
||||
unsigned int *line_ptr));
|
||||
extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc));
|
||||
extern boolean bfd_coff_reloc16_relax_section
|
||||
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
|
||||
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
|
||||
bfd_byte *, boolean relocateable, asymbol **));
|
||||
extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *,
|
||||
struct bfd_link_info *,
|
||||
asection *));
|
||||
extern void bfd_perform_slip PARAMS ((bfd *abfd, unsigned int slip,
|
||||
asection *input_section,
|
||||
bfd_vma val));
|
||||
|
||||
/* Functions and types in cofflink.c. */
|
||||
|
||||
#define STRING_SIZE_SIZE (4)
|
||||
|
||||
/* We use a hash table to merge identical enum, struct, and union
|
||||
definitions in the linker. */
|
||||
|
||||
/* Information we keep for a single element (an enum value, a
|
||||
structure or union field) in the debug merge hash table. */
|
||||
|
||||
struct coff_debug_merge_element
|
||||
{
|
||||
/* Next element. */
|
||||
struct coff_debug_merge_element *next;
|
||||
|
||||
/* Name. */
|
||||
const char *name;
|
||||
|
||||
/* Type. */
|
||||
unsigned int type;
|
||||
|
||||
/* Symbol index for complex type. */
|
||||
long tagndx;
|
||||
};
|
||||
|
||||
/* A linked list of debug merge entries for a given name. */
|
||||
|
||||
struct coff_debug_merge_type
|
||||
{
|
||||
/* Next type with the same name. */
|
||||
struct coff_debug_merge_type *next;
|
||||
|
||||
/* Class of type. */
|
||||
int class;
|
||||
|
||||
/* Symbol index where this type is defined. */
|
||||
long indx;
|
||||
|
||||
/* List of elements. */
|
||||
struct coff_debug_merge_element *elements;
|
||||
};
|
||||
|
||||
/* Information we store in the debug merge hash table. */
|
||||
|
||||
struct coff_debug_merge_hash_entry
|
||||
{
|
||||
struct bfd_hash_entry root;
|
||||
|
||||
/* A list of types with this name. */
|
||||
struct coff_debug_merge_type *types;
|
||||
};
|
||||
|
||||
/* The debug merge hash table. */
|
||||
|
||||
struct coff_debug_merge_hash_table
|
||||
{
|
||||
struct bfd_hash_table root;
|
||||
};
|
||||
|
||||
/* Initialize a COFF debug merge hash table. */
|
||||
|
||||
#define coff_debug_merge_hash_table_init(table) \
|
||||
(bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc))
|
||||
|
||||
/* Free a COFF debug merge hash table. */
|
||||
|
||||
#define coff_debug_merge_hash_table_free(table) \
|
||||
(bfd_hash_table_free (&(table)->root))
|
||||
|
||||
/* Look up an entry in a COFF debug merge hash table. */
|
||||
|
||||
#define coff_debug_merge_hash_lookup(table, string, create, copy) \
|
||||
((struct coff_debug_merge_hash_entry *) \
|
||||
bfd_hash_lookup (&(table)->root, (string), (create), (copy)))
|
||||
|
||||
/* Information we keep for each section in the output file when doing
|
||||
a relocateable link. */
|
||||
|
||||
struct coff_link_section_info
|
||||
{
|
||||
/* The relocs to be output. */
|
||||
struct internal_reloc *relocs;
|
||||
/* For each reloc against a global symbol whose index was not known
|
||||
when the reloc was handled, the global hash table entry. */
|
||||
struct coff_link_hash_entry **rel_hashes;
|
||||
};
|
||||
|
||||
/* Information that we pass around while doing the final link step. */
|
||||
|
||||
struct coff_final_link_info
|
||||
{
|
||||
/* General link information. */
|
||||
struct bfd_link_info *info;
|
||||
/* Output BFD. */
|
||||
bfd *output_bfd;
|
||||
/* Used to indicate failure in traversal routine. */
|
||||
boolean failed;
|
||||
/* Hash table for long symbol names. */
|
||||
struct bfd_strtab_hash *strtab;
|
||||
/* When doing a relocateable link, an array of information kept for
|
||||
each output section, indexed by the target_index field. */
|
||||
struct coff_link_section_info *section_info;
|
||||
/* Symbol index of last C_FILE symbol (-1 if none). */
|
||||
long last_file_index;
|
||||
/* Contents of last C_FILE symbol. */
|
||||
struct internal_syment last_file;
|
||||
/* Hash table used to merge debug information. */
|
||||
struct coff_debug_merge_hash_table debug_merge;
|
||||
/* Buffer large enough to hold swapped symbols of any input file. */
|
||||
struct internal_syment *internal_syms;
|
||||
/* Buffer large enough to hold sections of symbols of any input file. */
|
||||
asection **sec_ptrs;
|
||||
/* Buffer large enough to hold output indices of symbols of any
|
||||
input file. */
|
||||
long *sym_indices;
|
||||
/* Buffer large enough to hold output symbols for any input file. */
|
||||
bfd_byte *outsyms;
|
||||
/* Buffer large enough to hold external line numbers for any input
|
||||
section. */
|
||||
bfd_byte *linenos;
|
||||
/* Buffer large enough to hold any input section. */
|
||||
bfd_byte *contents;
|
||||
/* Buffer large enough to hold external relocs of any input section. */
|
||||
bfd_byte *external_relocs;
|
||||
/* Buffer large enough to hold swapped relocs of any input section. */
|
||||
struct internal_reloc *internal_relocs;
|
||||
};
|
||||
|
||||
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
extern boolean _bfd_coff_link_hash_table_init
|
||||
PARAMS ((struct coff_link_hash_table *, bfd *,
|
||||
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
||||
struct bfd_hash_table *,
|
||||
const char *)));
|
||||
extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
extern const char *_bfd_coff_internal_syment_name
|
||||
PARAMS ((bfd *, const struct internal_syment *, char *));
|
||||
extern boolean _bfd_coff_link_add_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_coff_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern struct internal_reloc *_bfd_coff_read_internal_relocs
|
||||
PARAMS ((bfd *, asection *, boolean, bfd_byte *, boolean,
|
||||
struct internal_reloc *));
|
||||
extern boolean _bfd_coff_generic_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
struct internal_reloc *, struct internal_syment *, asection **));
|
||||
|
||||
extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
extern boolean _bfd_coff_write_global_sym
|
||||
PARAMS ((struct coff_link_hash_entry *, PTR));
|
||||
extern boolean _bfd_coff_link_input_bfd
|
||||
PARAMS ((struct coff_final_link_info *, bfd *));
|
||||
extern boolean _bfd_coff_reloc_link_order
|
||||
PARAMS ((bfd *, struct coff_final_link_info *, asection *,
|
||||
struct bfd_link_order *));
|
||||
|
||||
|
||||
#define coff_get_section_contents_in_window \
|
||||
_bfd_generic_get_section_contents_in_window
|
||||
|
||||
/* Functions in xcofflink.c. */
|
||||
|
||||
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
extern boolean _bfd_xcoff_bfd_link_add_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_xcoff_bfd_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_ppc_xcoff_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
struct internal_reloc *, struct internal_syment *, asection **));
|
||||
|
||||
/* And more taken from the source .. */
|
||||
|
||||
typedef struct coff_ptr_struct
|
||||
{
|
||||
|
||||
/* Remembers the offset from the first symbol in the file for
|
||||
this symbol. Generated by coff_renumber_symbols. */
|
||||
unsigned int offset;
|
||||
|
||||
/* Should the value of this symbol be renumbered. Used for
|
||||
XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
|
||||
unsigned int fix_value : 1;
|
||||
|
||||
/* Should the tag field of this symbol be renumbered.
|
||||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_tag : 1;
|
||||
|
||||
/* Should the endidx field of this symbol be renumbered.
|
||||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_end : 1;
|
||||
|
||||
/* Should the x_csect.x_scnlen field be renumbered.
|
||||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_scnlen : 1;
|
||||
|
||||
/* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
|
||||
index into the line number entries. Set by
|
||||
coff_slurp_symbol_table. */
|
||||
unsigned int fix_line : 1;
|
||||
|
||||
/* The container for the symbol structure as read and translated
|
||||
from the file. */
|
||||
|
||||
union {
|
||||
union internal_auxent auxent;
|
||||
struct internal_syment syment;
|
||||
} u;
|
||||
} combined_entry_type;
|
||||
|
||||
|
||||
/* Each canonical asymbol really looks like this: */
|
||||
|
||||
typedef struct coff_symbol_struct
|
||||
{
|
||||
/* The actual symbol which the rest of BFD works with */
|
||||
asymbol symbol;
|
||||
|
||||
/* A pointer to the hidden information for this symbol */
|
||||
combined_entry_type *native;
|
||||
|
||||
/* A pointer to the linenumber information for this symbol */
|
||||
struct lineno_cache_entry *lineno;
|
||||
|
||||
/* Have the line numbers been relocated yet ? */
|
||||
boolean done_lineno;
|
||||
} coff_symbol_type;
|
||||
typedef struct
|
||||
{
|
||||
void (*_bfd_coff_swap_aux_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
int type,
|
||||
int class,
|
||||
int indaux,
|
||||
int numaux,
|
||||
PTR in));
|
||||
|
||||
void (*_bfd_coff_swap_sym_in) PARAMS ((
|
||||
bfd *abfd ,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
|
||||
void (*_bfd_coff_swap_lineno_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_aux_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
int type,
|
||||
int class,
|
||||
int indaux,
|
||||
int numaux,
|
||||
PTR ext));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_sym_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR ext));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_lineno_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR ext));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_reloc_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR src,
|
||||
PTR dst));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR out));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR out));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR out));
|
||||
|
||||
unsigned int _bfd_filhsz;
|
||||
unsigned int _bfd_aoutsz;
|
||||
unsigned int _bfd_scnhsz;
|
||||
unsigned int _bfd_symesz;
|
||||
unsigned int _bfd_auxesz;
|
||||
unsigned int _bfd_relsz;
|
||||
unsigned int _bfd_linesz;
|
||||
boolean _bfd_coff_long_filenames;
|
||||
void (*_bfd_coff_swap_filehdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
void (*_bfd_coff_swap_aouthdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
void (*_bfd_coff_swap_scnhdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
void (*_bfd_coff_swap_reloc_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
boolean (*_bfd_coff_bad_format_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_filehdr));
|
||||
boolean (*_bfd_coff_set_arch_mach_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_filehdr));
|
||||
PTR (*_bfd_coff_mkobject_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_filehdr,
|
||||
PTR internal_aouthdr));
|
||||
flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_scnhdr,
|
||||
const char *name));
|
||||
void (*_bfd_set_alignment_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *sec,
|
||||
PTR internal_scnhdr));
|
||||
boolean (*_bfd_coff_slurp_symbol_table) PARAMS ((
|
||||
bfd *abfd));
|
||||
boolean (*_bfd_coff_symname_in_debug) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct internal_syment *sym));
|
||||
boolean (*_bfd_coff_pointerize_aux_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
combined_entry_type *table_base,
|
||||
combined_entry_type *symbol,
|
||||
unsigned int indaux,
|
||||
combined_entry_type *aux));
|
||||
boolean (*_bfd_coff_print_aux) PARAMS ((
|
||||
bfd *abfd,
|
||||
FILE *file,
|
||||
combined_entry_type *table_base,
|
||||
combined_entry_type *symbol,
|
||||
combined_entry_type *aux,
|
||||
unsigned int indaux));
|
||||
void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct bfd_link_info *link_info,
|
||||
struct bfd_link_order *link_order,
|
||||
arelent *reloc,
|
||||
bfd_byte *data,
|
||||
unsigned int *src_ptr,
|
||||
unsigned int *dst_ptr));
|
||||
int (*_bfd_coff_reloc16_estimate) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *input_section,
|
||||
arelent *r,
|
||||
unsigned int shrink,
|
||||
struct bfd_link_info *link_info));
|
||||
boolean (*_bfd_coff_sym_is_global) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct internal_syment *));
|
||||
void (*_bfd_coff_compute_section_file_positions) PARAMS ((
|
||||
bfd *abfd));
|
||||
boolean (*_bfd_coff_start_final_link) PARAMS ((
|
||||
bfd *output_bfd,
|
||||
struct bfd_link_info *info));
|
||||
boolean (*_bfd_coff_relocate_section) PARAMS ((
|
||||
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));
|
||||
reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *sec,
|
||||
struct internal_reloc *rel,
|
||||
struct coff_link_hash_entry *h,
|
||||
struct internal_syment *sym,
|
||||
bfd_vma *addendp));
|
||||
boolean (*_bfd_coff_adjust_symndx) PARAMS ((
|
||||
bfd *obfd,
|
||||
struct bfd_link_info *info,
|
||||
bfd *ibfd,
|
||||
asection *sec,
|
||||
struct internal_reloc *reloc,
|
||||
boolean *adjustedp));
|
||||
boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((
|
||||
struct bfd_link_info *info,
|
||||
bfd *abfd,
|
||||
const char *name,
|
||||
flagword flags,
|
||||
asection *section,
|
||||
bfd_vma value,
|
||||
const char *string,
|
||||
boolean copy,
|
||||
boolean collect,
|
||||
struct bfd_link_hash_entry **hashp));
|
||||
|
||||
} bfd_coff_backend_data;
|
||||
|
||||
#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
|
||||
|
||||
#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
|
||||
((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
|
||||
|
||||
#define bfd_coff_swap_sym_in(a,e,i) \
|
||||
((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
|
||||
|
||||
#define bfd_coff_swap_lineno_in(a,e,i) \
|
||||
((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
|
||||
|
||||
#define bfd_coff_swap_reloc_out(abfd, i, o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_lineno_out(abfd, i, o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
|
||||
((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
|
||||
|
||||
#define bfd_coff_swap_sym_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_filehdr_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
|
||||
#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
|
||||
#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
|
||||
#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
|
||||
#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
|
||||
#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
|
||||
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
||||
#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
|
||||
#define bfd_coff_swap_filehdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_reloc_in(abfd, i, o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_bad_format_hook(abfd, filehdr) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
|
||||
|
||||
#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
|
||||
#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
|
||||
|
||||
#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
|
||||
((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
|
||||
|
||||
#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
|
||||
((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
|
||||
|
||||
#define bfd_coff_slurp_symbol_table(abfd)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
|
||||
|
||||
#define bfd_coff_symname_in_debug(abfd, sym)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
|
||||
|
||||
#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_print_aux)\
|
||||
(abfd, file, base, symbol, aux, indaux))
|
||||
|
||||
#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
|
||||
(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
|
||||
|
||||
#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
|
||||
(abfd, section, reloc, shrink, link_info))
|
||||
|
||||
#define bfd_coff_sym_is_global(abfd, sym)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\
|
||||
(abfd, sym))
|
||||
|
||||
#define bfd_coff_compute_section_file_positions(abfd)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
|
||||
(abfd))
|
||||
|
||||
#define bfd_coff_start_final_link(obfd, info)\
|
||||
((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
|
||||
(obfd, info))
|
||||
#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
|
||||
((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
|
||||
(obfd, info, ibfd, o, con, rel, isyms, secs))
|
||||
#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
|
||||
(abfd, sec, rel, h, sym, addendp))
|
||||
#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
|
||||
(obfd, info, ibfd, sec, rel, adjustedp))
|
||||
#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
|
||||
(info, abfd, name, flags, section, value, string, cp, coll, hashp))
|
||||
|
@ -1,352 +0,0 @@
|
||||
/* BFD ECOFF object file private structure.
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfdlink.h"
|
||||
|
||||
#ifndef ECOFF_H
|
||||
#include "coff/ecoff.h"
|
||||
#endif
|
||||
|
||||
/* This is the backend information kept for ECOFF files. This
|
||||
structure is constant for a particular backend. The first element
|
||||
is the COFF backend data structure, so that ECOFF targets can use
|
||||
the generic COFF code. */
|
||||
|
||||
#define ecoff_backend(abfd) \
|
||||
((struct ecoff_backend_data *) (abfd)->xvec->backend_data)
|
||||
|
||||
struct ecoff_backend_data
|
||||
{
|
||||
/* COFF backend information. This must be the first field. */
|
||||
bfd_coff_backend_data coff;
|
||||
/* Supported architecture. */
|
||||
enum bfd_architecture arch;
|
||||
/* Initial portion of armap string. */
|
||||
const char *armap_start;
|
||||
/* The page boundary used to align sections in a demand-paged
|
||||
executable file. E.g., 0x1000. */
|
||||
bfd_vma round;
|
||||
/* True if the .rdata section is part of the text segment, as on the
|
||||
Alpha. False if .rdata is part of the data segment, as on the
|
||||
MIPS. */
|
||||
boolean rdata_in_text;
|
||||
/* Bitsize of constructor entries. */
|
||||
unsigned int constructor_bitsize;
|
||||
/* Reloc to use for constructor entries. */
|
||||
reloc_howto_type *constructor_reloc;
|
||||
/* How to swap debugging information. */
|
||||
struct ecoff_debug_swap debug_swap;
|
||||
/* External reloc size. */
|
||||
bfd_size_type external_reloc_size;
|
||||
/* Reloc swapping functions. */
|
||||
void (*swap_reloc_in) PARAMS ((bfd *, PTR, struct internal_reloc *));
|
||||
void (*swap_reloc_out) PARAMS ((bfd *, const struct internal_reloc *, PTR));
|
||||
/* Backend reloc tweaking. */
|
||||
void (*adjust_reloc_in) PARAMS ((bfd *, const struct internal_reloc *,
|
||||
arelent *));
|
||||
void (*adjust_reloc_out) PARAMS ((bfd *, const arelent *,
|
||||
struct internal_reloc *));
|
||||
/* Relocate section contents while linking. */
|
||||
boolean (*relocate_section) PARAMS ((bfd *output_bfd, struct bfd_link_info *,
|
||||
bfd *input_bfd, asection *input_section,
|
||||
bfd_byte *contents,
|
||||
PTR external_relocs));
|
||||
/* Do final adjustments to filehdr and aouthdr. */
|
||||
boolean (*adjust_headers) PARAMS ((bfd *, struct internal_filehdr *,
|
||||
struct internal_aouthdr *));
|
||||
/* Read an element from an archive at a given file position. This
|
||||
is needed because OSF/1 3.2 uses a weird archive format. */
|
||||
bfd *(*get_elt_at_filepos) PARAMS ((bfd *, file_ptr));
|
||||
};
|
||||
|
||||
/* This is the target specific information kept for ECOFF files. */
|
||||
|
||||
#define ecoff_data(abfd) ((abfd)->tdata.ecoff_obj_data)
|
||||
|
||||
typedef struct ecoff_tdata
|
||||
{
|
||||
/* The reloc file position, set by
|
||||
ecoff_compute_section_file_positions. */
|
||||
file_ptr reloc_filepos;
|
||||
|
||||
/* The symbol table file position, set by _bfd_ecoff_mkobject_hook. */
|
||||
file_ptr sym_filepos;
|
||||
|
||||
/* The start and end of the text segment. Only valid for an
|
||||
existing file, not for one we are creating. */
|
||||
unsigned long text_start;
|
||||
unsigned long text_end;
|
||||
|
||||
/* The cached gp value. This is used when relocating. */
|
||||
bfd_vma gp;
|
||||
|
||||
/* The maximum size of objects to optimize using gp. This is
|
||||
typically set by the -G option to the compiler, assembler or
|
||||
linker. */
|
||||
unsigned int gp_size;
|
||||
|
||||
/* The register masks. When linking, all the masks found in the
|
||||
input files are combined into the masks of the output file.
|
||||
These are not all used for all targets, but that's OK, because
|
||||
the relevant ones are the only ones swapped in and out. */
|
||||
unsigned long gprmask;
|
||||
unsigned long fprmask;
|
||||
unsigned long cprmask[4];
|
||||
|
||||
/* The ECOFF symbolic debugging information. */
|
||||
struct ecoff_debug_info debug_info;
|
||||
|
||||
/* The unswapped ECOFF symbolic information. */
|
||||
PTR raw_syments;
|
||||
|
||||
/* The canonical BFD symbols. */
|
||||
struct ecoff_symbol_struct *canonical_symbols;
|
||||
|
||||
/* A mapping from external symbol numbers to entries in the linker
|
||||
hash table, used when linking. */
|
||||
struct ecoff_link_hash_entry **sym_hashes;
|
||||
|
||||
/* A mapping from reloc symbol indices to sections, used when
|
||||
linking. */
|
||||
asection **symndx_to_section;
|
||||
|
||||
/* True if this BFD was written by the backend linker. */
|
||||
boolean linker;
|
||||
|
||||
/* True if a warning that multiple global pointer values are
|
||||
needed in the output binary was issued already. */
|
||||
boolean issued_multiple_gp_warning;
|
||||
|
||||
/* Used by find_nearest_line entry point. The structure could be
|
||||
included directly in this one, but there's no point to wasting
|
||||
the memory just for the infrequently called find_nearest_line. */
|
||||
struct ecoff_find_line *find_line_info;
|
||||
|
||||
} ecoff_data_type;
|
||||
|
||||
/* Each canonical asymbol really looks like this. */
|
||||
|
||||
typedef struct ecoff_symbol_struct
|
||||
{
|
||||
/* The actual symbol which the rest of BFD works with */
|
||||
asymbol symbol;
|
||||
|
||||
/* The fdr for this symbol. */
|
||||
FDR *fdr;
|
||||
|
||||
/* true if this is a local symbol rather than an external one. */
|
||||
boolean local;
|
||||
|
||||
/* A pointer to the unswapped hidden information for this symbol.
|
||||
This is either a struct sym_ext or a struct ext_ext, depending on
|
||||
the value of the local field above. */
|
||||
PTR native;
|
||||
} ecoff_symbol_type;
|
||||
|
||||
/* We take the address of the first element of a asymbol to ensure that the
|
||||
macro is only ever applied to an asymbol. */
|
||||
#define ecoffsymbol(asymbol) ((ecoff_symbol_type *) (&((asymbol)->the_bfd)))
|
||||
|
||||
/* We need to save the index of an external symbol when we write it
|
||||
out so that can set the symbol index correctly when we write out
|
||||
the relocs. */
|
||||
#define ecoff_get_sym_index(symbol) ((symbol)->udata.i)
|
||||
#define ecoff_set_sym_index(symbol, idx) ((symbol)->udata.i = (idx))
|
||||
|
||||
/* When generating MIPS embedded PIC code, the linker relaxes the code
|
||||
to turn PC relative branches into longer code sequences when the PC
|
||||
relative branch is out of range. This involves reading the relocs
|
||||
in bfd_relax_section as well as in bfd_final_link, and requires the
|
||||
code to keep track of which relocs have been expanded. A pointer
|
||||
to this structure is put in the used_by_bfd pointer of a section to
|
||||
keep track of this information. The user_by_bfd pointer will be
|
||||
NULL if the information was not needed. */
|
||||
|
||||
struct ecoff_section_tdata
|
||||
{
|
||||
/* The unswapped relocs for this section. These are stored in
|
||||
memory so the input file does not have to be read twice. */
|
||||
PTR external_relocs;
|
||||
|
||||
/* The contents of the section. These bytes may or may not be saved
|
||||
in memory, but if it is this is a pointer to them. */
|
||||
bfd_byte *contents;
|
||||
|
||||
/* Offset adjustments for PC relative branches. A number other than
|
||||
1 is an addend for a PC relative branch, or a switch table entry
|
||||
which is the difference of two .text locations; this addend
|
||||
arises because the branch or difference crosses one or more
|
||||
branches which were expanded into a larger code sequence. A 1
|
||||
means that this branch was itself expanded into a larger code
|
||||
sequence. 1 is not a possible offset, since all offsets must be
|
||||
multiples of the instruction size, which is 4; also, the only
|
||||
relocs with non-zero offsets will be PC relative branches or
|
||||
switch table entries within the same object file. If this field
|
||||
is NULL, no branches were expanded and no offsets are required.
|
||||
Otherwise there are as many entries as there are relocs in the
|
||||
section, and the entry for any reloc that is not PC relative is
|
||||
zero. */
|
||||
long *offsets;
|
||||
|
||||
/* When producing an executable (i.e., final, non-relocatable link)
|
||||
on the Alpha, we may need to use multiple global pointer values
|
||||
to span the entire .lita section. In essence, we allow each
|
||||
input .lita section to have its own gp value. To support this,
|
||||
we need to keep track of the gp values that we picked for each
|
||||
input .lita section . */
|
||||
bfd_vma gp;
|
||||
};
|
||||
|
||||
/* An accessor macro for the ecoff_section_tdata structure. */
|
||||
#define ecoff_section_data(abfd, sec) \
|
||||
((struct ecoff_section_tdata *) (sec)->used_by_bfd)
|
||||
|
||||
/* ECOFF linker hash table entries. */
|
||||
|
||||
struct ecoff_link_hash_entry
|
||||
{
|
||||
struct bfd_link_hash_entry root;
|
||||
/* Symbol index in output file. */
|
||||
long indx;
|
||||
/* BFD that ext field value came from. */
|
||||
bfd *abfd;
|
||||
/* ECOFF external symbol information. */
|
||||
EXTR esym;
|
||||
/* Nonzero if this symbol has been written out. */
|
||||
char written;
|
||||
/* Nonzero if this symbol was referred to as small undefined. */
|
||||
char small;
|
||||
};
|
||||
|
||||
/* ECOFF linker hash table. */
|
||||
|
||||
struct ecoff_link_hash_table
|
||||
{
|
||||
struct bfd_link_hash_table root;
|
||||
};
|
||||
|
||||
/* Make an ECOFF object. */
|
||||
extern boolean _bfd_ecoff_mkobject PARAMS ((bfd *));
|
||||
|
||||
/* Read in the ECOFF symbolic debugging information. */
|
||||
extern boolean _bfd_ecoff_slurp_symbolic_info
|
||||
PARAMS ((bfd *, asection *, struct ecoff_debug_info *));
|
||||
|
||||
/* Generic ECOFF BFD backend vectors. */
|
||||
|
||||
extern boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd));
|
||||
extern const bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd));
|
||||
|
||||
#define _bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup
|
||||
#define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
|
||||
extern boolean _bfd_ecoff_new_section_hook
|
||||
PARAMS ((bfd *, asection *));
|
||||
extern boolean _bfd_ecoff_get_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type));
|
||||
|
||||
#define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section
|
||||
|
||||
extern boolean _bfd_ecoff_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *));
|
||||
#define _bfd_ecoff_bfd_copy_private_section_data \
|
||||
_bfd_generic_bfd_copy_private_section_data
|
||||
|
||||
#define _bfd_ecoff_bfd_copy_private_symbol_data \
|
||||
_bfd_generic_bfd_copy_private_symbol_data
|
||||
|
||||
#define _bfd_ecoff_bfd_print_private_bfd_data \
|
||||
_bfd_generic_bfd_print_private_bfd_data
|
||||
|
||||
#define _bfd_ecoff_bfd_merge_private_bfd_data \
|
||||
_bfd_generic_bfd_merge_private_bfd_data
|
||||
|
||||
#define _bfd_ecoff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
|
||||
extern boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd));
|
||||
#define _bfd_ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table
|
||||
#define _bfd_ecoff_construct_extended_name_table \
|
||||
_bfd_archive_bsd_construct_extended_name_table
|
||||
#define _bfd_ecoff_truncate_arname bfd_dont_truncate_arname
|
||||
extern boolean _bfd_ecoff_write_armap
|
||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
|
||||
#define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr
|
||||
#define _bfd_ecoff_openr_next_archived_file \
|
||||
bfd_generic_openr_next_archived_file
|
||||
#define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index
|
||||
#define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt
|
||||
#define _bfd_ecoff_update_armap_timestamp bfd_true
|
||||
|
||||
extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
|
||||
extern long _bfd_ecoff_get_symtab PARAMS ((bfd *abfd, asymbol **alocation));
|
||||
extern asymbol *_bfd_ecoff_make_empty_symbol PARAMS ((bfd *abfd));
|
||||
extern void _bfd_ecoff_print_symbol
|
||||
PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type));
|
||||
extern void _bfd_ecoff_get_symbol_info
|
||||
PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||
extern boolean _bfd_ecoff_bfd_is_local_label
|
||||
PARAMS ((bfd *, asymbol *));
|
||||
#define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno
|
||||
extern boolean _bfd_ecoff_find_nearest_line
|
||||
PARAMS ((bfd *, asection *, asymbol **, bfd_vma offset,
|
||||
const char **filename_ptr, const char **fnname_ptr,
|
||||
unsigned int *retline_ptr));
|
||||
#define _bfd_ecoff_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
|
||||
#define _bfd_ecoff_read_minisymbols _bfd_generic_read_minisymbols
|
||||
#define _bfd_ecoff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||
|
||||
#define _bfd_ecoff_get_reloc_upper_bound coff_get_reloc_upper_bound
|
||||
extern long _bfd_ecoff_canonicalize_reloc
|
||||
PARAMS ((bfd *, asection *, arelent **, asymbol **symbols));
|
||||
/* ecoff_bfd_reloc_type_lookup defined by backend. */
|
||||
|
||||
extern boolean _bfd_ecoff_set_arch_mach
|
||||
PARAMS ((bfd *, enum bfd_architecture, unsigned long machine));
|
||||
extern boolean _bfd_ecoff_set_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type));
|
||||
|
||||
extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, boolean reloc));
|
||||
/* ecoff_bfd_get_relocated_section_contents defined by backend. */
|
||||
/* ecoff_bfd_relax_section defined by backend. */
|
||||
extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
extern boolean _bfd_ecoff_bfd_link_add_symbols
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_ecoff_bfd_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* Hook functions for the generic COFF section reading code. */
|
||||
|
||||
extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
|
||||
#define _bfd_ecoff_set_alignment_hook \
|
||||
((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
|
||||
extern boolean _bfd_ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr));
|
||||
extern flagword _bfd_ecoff_styp_to_sec_flags
|
||||
PARAMS ((bfd *abfd, PTR hdr, const char *name));
|
||||
extern boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd));
|
||||
|
||||
/* ECOFF auxiliary information swapping routines. These are the same
|
||||
for all ECOFF targets, so they are defined in ecofflink.c. */
|
||||
|
||||
extern void _bfd_ecoff_swap_tir_in
|
||||
PARAMS ((int, const struct tir_ext *, TIR *));
|
||||
extern void _bfd_ecoff_swap_tir_out
|
||||
PARAMS ((int, const TIR *, struct tir_ext *));
|
||||
extern void _bfd_ecoff_swap_rndx_in
|
||||
PARAMS ((int, const struct rndx_ext *, RNDXR *));
|
||||
extern void _bfd_ecoff_swap_rndx_out
|
||||
PARAMS ((int, const RNDXR *, struct rndx_ext *));
|
File diff suppressed because it is too large
Load Diff
@ -1,604 +0,0 @@
|
||||
/* opncls.c -- open and close a BFD.
|
||||
Copyright (C) 1990 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "obstack.h"
|
||||
|
||||
#ifndef S_IXUSR
|
||||
#define S_IXUSR 0100 /* Execute by owner. */
|
||||
#endif
|
||||
#ifndef S_IXGRP
|
||||
#define S_IXGRP 0010 /* Execute by group. */
|
||||
#endif
|
||||
#ifndef S_IXOTH
|
||||
#define S_IXOTH 0001 /* Execute by others. */
|
||||
#endif
|
||||
|
||||
/* fdopen is a loser -- we should use stdio exclusively. Unfortunately
|
||||
if we do that we can't use fcntl. */
|
||||
|
||||
|
||||
#define obstack_chunk_alloc malloc
|
||||
#define obstack_chunk_free free
|
||||
|
||||
#ifndef HAVE_GETPAGESIZE
|
||||
#define getpagesize() 2048
|
||||
#endif
|
||||
|
||||
long _bfd_chunksize = -1;
|
||||
|
||||
/* Return a new BFD. All BFD's are allocated through this routine. */
|
||||
|
||||
bfd *
|
||||
_bfd_new_bfd ()
|
||||
{
|
||||
bfd *nbfd;
|
||||
|
||||
nbfd = (bfd *)bfd_zmalloc (sizeof (bfd));
|
||||
if (!nbfd)
|
||||
return 0;
|
||||
|
||||
if (_bfd_chunksize <= 0)
|
||||
{
|
||||
_bfd_chunksize = getpagesize ();
|
||||
if (_bfd_chunksize <= 0)
|
||||
_bfd_chunksize = 2048;
|
||||
/* Leave some slush space, since many malloc implementations
|
||||
prepend a header, and may wind up wasting another page
|
||||
because of it. */
|
||||
_bfd_chunksize -= 32;
|
||||
}
|
||||
|
||||
if (!obstack_begin(&nbfd->memory, _bfd_chunksize))
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nbfd->arch_info = &bfd_default_arch_struct;
|
||||
|
||||
nbfd->direction = no_direction;
|
||||
nbfd->iostream = NULL;
|
||||
nbfd->where = 0;
|
||||
nbfd->sections = (asection *)NULL;
|
||||
nbfd->format = bfd_unknown;
|
||||
nbfd->my_archive = (bfd *)NULL;
|
||||
nbfd->origin = 0;
|
||||
nbfd->opened_once = false;
|
||||
nbfd->output_has_begun = false;
|
||||
nbfd->section_count = 0;
|
||||
nbfd->usrdata = (PTR)NULL;
|
||||
nbfd->cacheable = false;
|
||||
nbfd->flags = NO_FLAGS;
|
||||
nbfd->mtime_set = false;
|
||||
|
||||
return nbfd;
|
||||
}
|
||||
|
||||
/* Allocate a new BFD as a member of archive OBFD. */
|
||||
|
||||
bfd *
|
||||
_bfd_new_bfd_contained_in (obfd)
|
||||
bfd *obfd;
|
||||
{
|
||||
bfd *nbfd;
|
||||
|
||||
nbfd = _bfd_new_bfd();
|
||||
nbfd->xvec = obfd->xvec;
|
||||
nbfd->my_archive = obfd;
|
||||
nbfd->direction = read_direction;
|
||||
nbfd->target_defaulted = obfd->target_defaulted;
|
||||
return nbfd;
|
||||
}
|
||||
|
||||
/*
|
||||
SECTION
|
||||
Opening and closing BFDs
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_openr
|
||||
|
||||
SYNOPSIS
|
||||
bfd *bfd_openr(CONST char *filename, CONST char *target);
|
||||
|
||||
DESCRIPTION
|
||||
Open the file @var{filename} (using <<fopen>>) with the target
|
||||
@var{target}. Return a pointer to the created BFD.
|
||||
|
||||
Calls <<bfd_find_target>>, so @var{target} is interpreted as by
|
||||
that function.
|
||||
|
||||
If <<NULL>> is returned then an error has occured. Possible errors
|
||||
are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> or <<system_call>> error.
|
||||
*/
|
||||
|
||||
bfd *
|
||||
bfd_openr (filename, target)
|
||||
CONST char *filename;
|
||||
CONST char *target;
|
||||
{
|
||||
bfd *nbfd;
|
||||
const bfd_target *target_vec;
|
||||
|
||||
nbfd = _bfd_new_bfd();
|
||||
if (nbfd == NULL)
|
||||
return NULL;
|
||||
|
||||
target_vec = bfd_find_target (target, nbfd);
|
||||
if (target_vec == NULL) {
|
||||
bfd_set_error (bfd_error_invalid_target);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nbfd->filename = filename;
|
||||
nbfd->direction = read_direction;
|
||||
|
||||
if (bfd_open_file (nbfd) == NULL) {
|
||||
bfd_set_error (bfd_error_system_call); /* File didn't exist, or some such */
|
||||
bfd_release(nbfd,0);
|
||||
return NULL;
|
||||
}
|
||||
return nbfd;
|
||||
}
|
||||
|
||||
|
||||
/* Don't try to `optimize' this function:
|
||||
|
||||
o - We lock using stack space so that interrupting the locking
|
||||
won't cause a storage leak.
|
||||
o - We open the file stream last, since we don't want to have to
|
||||
close it if anything goes wrong. Closing the stream means closing
|
||||
the file descriptor too, even though we didn't open it.
|
||||
*/
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_fdopenr
|
||||
|
||||
SYNOPSIS
|
||||
bfd *bfd_fdopenr(CONST char *filename, CONST char *target, int fd);
|
||||
|
||||
DESCRIPTION
|
||||
<<bfd_fdopenr>> is to <<bfd_fopenr>> much like <<fdopen>> is to <<fopen>>.
|
||||
It opens a BFD on a file already described by the @var{fd}
|
||||
supplied.
|
||||
|
||||
When the file is later <<bfd_close>>d, the file descriptor will be closed.
|
||||
|
||||
If the caller desires that this file descriptor be cached by BFD
|
||||
(opened as needed, closed as needed to free descriptors for
|
||||
other opens), with the supplied @var{fd} used as an initial
|
||||
file descriptor (but subject to closure at any time), call
|
||||
bfd_set_cacheable(bfd, 1) on the returned BFD. The default is to
|
||||
assume no cacheing; the file descriptor will remain open until
|
||||
<<bfd_close>>, and will not be affected by BFD operations on other
|
||||
files.
|
||||
|
||||
Possible errors are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> and <<bfd_error_system_call>>.
|
||||
*/
|
||||
|
||||
bfd *
|
||||
bfd_fdopenr (filename, target, fd)
|
||||
CONST char *filename;
|
||||
CONST char *target;
|
||||
int fd;
|
||||
{
|
||||
bfd *nbfd;
|
||||
const bfd_target *target_vec;
|
||||
int fdflags;
|
||||
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
#if ! defined(HAVE_FCNTL) || ! defined(F_GETFL)
|
||||
fdflags = O_RDWR; /* Assume full access */
|
||||
#else
|
||||
fdflags = fcntl (fd, F_GETFL, NULL);
|
||||
#endif
|
||||
if (fdflags == -1) return NULL;
|
||||
|
||||
nbfd = _bfd_new_bfd();
|
||||
|
||||
if (nbfd == NULL)
|
||||
return NULL;
|
||||
|
||||
target_vec = bfd_find_target (target, nbfd);
|
||||
if (target_vec == NULL) {
|
||||
bfd_set_error (bfd_error_invalid_target);
|
||||
return NULL;
|
||||
}
|
||||
#if defined(VMS) || defined(__GO32__) || defined (WINGDB)
|
||||
nbfd->iostream = (PTR)fopen(filename, FOPEN_RB);
|
||||
#else
|
||||
/* (O_ACCMODE) parens are to avoid Ultrix header file bug */
|
||||
switch (fdflags & (O_ACCMODE)) {
|
||||
case O_RDONLY: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RB); break;
|
||||
case O_WRONLY: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RUB); break;
|
||||
case O_RDWR: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RUB); break;
|
||||
default: abort ();
|
||||
}
|
||||
#endif
|
||||
if (nbfd->iostream == NULL) {
|
||||
(void) obstack_free (&nbfd->memory, (PTR)0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* OK, put everything where it belongs */
|
||||
|
||||
nbfd->filename = filename;
|
||||
|
||||
/* As a special case we allow a FD open for read/write to
|
||||
be written through, although doing so requires that we end
|
||||
the previous clause with a preposition. */
|
||||
/* (O_ACCMODE) parens are to avoid Ultrix header file bug */
|
||||
switch (fdflags & (O_ACCMODE)) {
|
||||
case O_RDONLY: nbfd->direction = read_direction; break;
|
||||
case O_WRONLY: nbfd->direction = write_direction; break;
|
||||
case O_RDWR: nbfd->direction = both_direction; break;
|
||||
default: abort ();
|
||||
}
|
||||
|
||||
if (! bfd_cache_init (nbfd))
|
||||
return NULL;
|
||||
|
||||
return nbfd;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_openstreamr
|
||||
|
||||
SYNOPSIS
|
||||
bfd *bfd_openstreamr();
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Open a BFD for read access on an existing stdio stream. When
|
||||
the BFD is passed to <<bfd_close>>, the stream will be closed.
|
||||
*/
|
||||
|
||||
bfd *
|
||||
bfd_openstreamr (filename, target, stream)
|
||||
const char *filename;
|
||||
const char *target;
|
||||
FILE *stream;
|
||||
{
|
||||
bfd *nbfd;
|
||||
const bfd_target *target_vec;
|
||||
|
||||
nbfd = _bfd_new_bfd ();
|
||||
if (nbfd == NULL)
|
||||
return NULL;
|
||||
|
||||
target_vec = bfd_find_target (target, nbfd);
|
||||
if (target_vec == NULL)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_target);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nbfd->iostream = (PTR) stream;
|
||||
nbfd->filename = filename;
|
||||
nbfd->direction = read_direction;
|
||||
|
||||
if (! bfd_cache_init (nbfd))
|
||||
return NULL;
|
||||
|
||||
return nbfd;
|
||||
}
|
||||
|
||||
/** bfd_openw -- open for writing.
|
||||
Returns a pointer to a freshly-allocated BFD on success, or NULL.
|
||||
|
||||
See comment by bfd_fdopenr before you try to modify this function. */
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_openw
|
||||
|
||||
SYNOPSIS
|
||||
bfd *bfd_openw(CONST char *filename, CONST char *target);
|
||||
|
||||
DESCRIPTION
|
||||
Create a BFD, associated with file @var{filename}, using the
|
||||
file format @var{target}, and return a pointer to it.
|
||||
|
||||
Possible errors are <<bfd_error_system_call>>, <<bfd_error_no_memory>>,
|
||||
<<bfd_error_invalid_target>>.
|
||||
*/
|
||||
|
||||
bfd *
|
||||
bfd_openw (filename, target)
|
||||
CONST char *filename;
|
||||
CONST char *target;
|
||||
{
|
||||
bfd *nbfd;
|
||||
const bfd_target *target_vec;
|
||||
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
|
||||
/* nbfd has to point to head of malloc'ed block so that bfd_close may
|
||||
reclaim it correctly. */
|
||||
|
||||
nbfd = _bfd_new_bfd();
|
||||
if (nbfd == NULL)
|
||||
return NULL;
|
||||
|
||||
target_vec = bfd_find_target (target, nbfd);
|
||||
if (target_vec == NULL) return NULL;
|
||||
|
||||
nbfd->filename = filename;
|
||||
nbfd->direction = write_direction;
|
||||
|
||||
if (bfd_open_file (nbfd) == NULL) {
|
||||
bfd_set_error (bfd_error_system_call); /* File not writeable, etc */
|
||||
(void) obstack_free (&nbfd->memory, (PTR)0);
|
||||
return NULL;
|
||||
}
|
||||
return nbfd;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
FUNCTION
|
||||
bfd_close
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_close(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Close a BFD. If the BFD was open for writing,
|
||||
then pending operations are completed and the file written out
|
||||
and closed. If the created file is executable, then
|
||||
<<chmod>> is called to mark it as such.
|
||||
|
||||
All memory attached to the BFD's obstacks is released.
|
||||
|
||||
The file descriptor associated with the BFD is closed (even
|
||||
if it was passed in to BFD by <<bfd_fdopenr>>).
|
||||
|
||||
RETURNS
|
||||
<<true>> is returned if all is ok, otherwise <<false>>.
|
||||
*/
|
||||
|
||||
|
||||
boolean
|
||||
bfd_close (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
boolean ret;
|
||||
|
||||
if (!bfd_read_p (abfd))
|
||||
{
|
||||
if (! BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
|
||||
return false;
|
||||
|
||||
ret = bfd_cache_close (abfd);
|
||||
|
||||
/* If the file was open for writing and is now executable,
|
||||
make it so */
|
||||
if (ret
|
||||
&& abfd->direction == write_direction
|
||||
&& abfd->flags & EXEC_P)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (stat (abfd->filename, &buf) == 0)
|
||||
{
|
||||
int mask = umask (0);
|
||||
umask (mask);
|
||||
chmod (abfd->filename,
|
||||
(0777
|
||||
& (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask))));
|
||||
}
|
||||
}
|
||||
|
||||
(void) obstack_free (&abfd->memory, (PTR)0);
|
||||
(void) free (abfd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_close_all_done
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_close_all_done(bfd *);
|
||||
|
||||
DESCRIPTION
|
||||
Close a BFD. Differs from <<bfd_close>>
|
||||
since it does not complete any pending operations. This
|
||||
routine would be used if the application had just used BFD for
|
||||
swapping and didn't want to use any of the writing code.
|
||||
|
||||
If the created file is executable, then <<chmod>> is called
|
||||
to mark it as such.
|
||||
|
||||
All memory attached to the BFD's obstacks is released.
|
||||
|
||||
RETURNS
|
||||
<<true>> is returned if all is ok, otherwise <<false>>.
|
||||
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_close_all_done (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
boolean ret;
|
||||
|
||||
ret = bfd_cache_close (abfd);
|
||||
|
||||
/* If the file was open for writing and is now executable,
|
||||
make it so */
|
||||
if (ret
|
||||
&& abfd->direction == write_direction
|
||||
&& abfd->flags & EXEC_P)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (stat (abfd->filename, &buf) == 0)
|
||||
{
|
||||
int mask = umask (0);
|
||||
umask (mask);
|
||||
chmod (abfd->filename,
|
||||
(0x777
|
||||
& (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask))));
|
||||
}
|
||||
}
|
||||
(void) obstack_free (&abfd->memory, (PTR)0);
|
||||
(void) free(abfd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_alloc_size
|
||||
|
||||
SYNOPSIS
|
||||
bfd_size_type bfd_alloc_size(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return the number of bytes in the obstacks connected to @var{abfd}.
|
||||
|
||||
*/
|
||||
|
||||
bfd_size_type
|
||||
bfd_alloc_size (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct _obstack_chunk *chunk = abfd->memory.chunk;
|
||||
size_t size = 0;
|
||||
while (chunk) {
|
||||
size += chunk->limit - &(chunk->contents[0]);
|
||||
chunk = chunk->prev;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_create
|
||||
|
||||
SYNOPSIS
|
||||
bfd *bfd_create(CONST char *filename, bfd *templ);
|
||||
|
||||
DESCRIPTION
|
||||
Create a new BFD in the manner of
|
||||
<<bfd_openw>>, but without opening a file. The new BFD
|
||||
takes the target from the target used by @var{template}. The
|
||||
format is always set to <<bfd_object>>.
|
||||
|
||||
*/
|
||||
|
||||
bfd *
|
||||
bfd_create (filename, templ)
|
||||
CONST char *filename;
|
||||
bfd *templ;
|
||||
{
|
||||
bfd *nbfd = _bfd_new_bfd();
|
||||
if (nbfd == (bfd *)NULL)
|
||||
return (bfd *)NULL;
|
||||
nbfd->filename = filename;
|
||||
if(templ) {
|
||||
nbfd->xvec = templ->xvec;
|
||||
}
|
||||
nbfd->direction = no_direction;
|
||||
bfd_set_format(nbfd, bfd_object);
|
||||
return nbfd;
|
||||
}
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_alloc_by_size_t
|
||||
|
||||
SYNOPSIS
|
||||
PTR bfd_alloc_by_size_t(bfd *abfd, size_t wanted);
|
||||
|
||||
DESCRIPTION
|
||||
Allocate a block of @var{wanted} bytes of memory in the obstack
|
||||
attatched to <<abfd>> and return a pointer to it.
|
||||
*/
|
||||
|
||||
|
||||
PTR
|
||||
bfd_alloc_by_size_t (abfd, size)
|
||||
bfd *abfd;
|
||||
size_t size;
|
||||
{
|
||||
PTR ret;
|
||||
|
||||
ret = obstack_alloc (&(abfd->memory), size);
|
||||
if (ret == NULL)
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
bfd_alloc_grow (abfd, ptr, size)
|
||||
bfd *abfd;
|
||||
PTR ptr;
|
||||
size_t size;
|
||||
{
|
||||
(void) obstack_grow(&(abfd->memory), ptr, size);
|
||||
}
|
||||
|
||||
PTR
|
||||
bfd_alloc_finish (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
PTR ret;
|
||||
|
||||
ret = obstack_finish (&(abfd->memory));
|
||||
if (ret == NULL)
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
return ret;
|
||||
}
|
||||
|
||||
PTR
|
||||
bfd_alloc (abfd, size)
|
||||
bfd *abfd;
|
||||
size_t size;
|
||||
{
|
||||
return bfd_alloc_by_size_t(abfd, (size_t)size);
|
||||
}
|
||||
|
||||
PTR
|
||||
bfd_zalloc (abfd, size)
|
||||
bfd *abfd;
|
||||
size_t size;
|
||||
{
|
||||
PTR res;
|
||||
res = bfd_alloc(abfd, size);
|
||||
if (res)
|
||||
memset(res, 0, (size_t)size);
|
||||
return res;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,976 +0,0 @@
|
||||
/* Object file "section" support for the BFD library.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
SECTION
|
||||
Sections
|
||||
|
||||
The raw data contained within a BFD is maintained through the
|
||||
section abstraction. A single BFD may have any number of
|
||||
sections. It keeps hold of them by pointing to the first;
|
||||
each one points to the next in the list.
|
||||
|
||||
Sections are supported in BFD in <<section.c>>.
|
||||
|
||||
@menu
|
||||
@* Section Input::
|
||||
@* Section Output::
|
||||
@* typedef asection::
|
||||
@* section prototypes::
|
||||
@end menu
|
||||
|
||||
INODE
|
||||
Section Input, Section Output, Sections, Sections
|
||||
SUBSECTION
|
||||
Section input
|
||||
|
||||
When a BFD is opened for reading, the section structures are
|
||||
created and attached to the BFD.
|
||||
|
||||
Each section has a name which describes the section in the
|
||||
outside world---for example, <<a.out>> would contain at least
|
||||
three sections, called <<.text>>, <<.data>> and <<.bss>>.
|
||||
|
||||
Names need not be unique; for example a COFF file may have several
|
||||
sections named <<.data>>.
|
||||
|
||||
Sometimes a BFD will contain more than the ``natural'' number of
|
||||
sections. A back end may attach other sections containing
|
||||
constructor data, or an application may add a section (using
|
||||
<<bfd_make_section>>) to the sections attached to an already open
|
||||
BFD. For example, the linker creates an extra section
|
||||
<<COMMON>> for each input file's BFD to hold information about
|
||||
common storage.
|
||||
|
||||
The raw data is not necessarily read in when
|
||||
the section descriptor is created. Some targets may leave the
|
||||
data in place until a <<bfd_get_section_contents>> call is
|
||||
made. Other back ends may read in all the data at once. For
|
||||
example, an S-record file has to be read once to determine the
|
||||
size of the data. An IEEE-695 file doesn't contain raw data in
|
||||
sections, but data and relocation expressions intermixed, so
|
||||
the data area has to be parsed to get out the data and
|
||||
relocations.
|
||||
|
||||
INODE
|
||||
Section Output, typedef asection, Section Input, Sections
|
||||
|
||||
SUBSECTION
|
||||
Section output
|
||||
|
||||
To write a new object style BFD, the various sections to be
|
||||
written have to be created. They are attached to the BFD in
|
||||
the same way as input sections; data is written to the
|
||||
sections using <<bfd_set_section_contents>>.
|
||||
|
||||
Any program that creates or combines sections (e.g., the assembler
|
||||
and linker) must use the <<asection>> fields <<output_section>> and
|
||||
<<output_offset>> to indicate the file sections to which each
|
||||
section must be written. (If the section is being created from
|
||||
scratch, <<output_section>> should probably point to the section
|
||||
itself and <<output_offset>> should probably be zero.)
|
||||
|
||||
The data to be written comes from input sections attached
|
||||
(via <<output_section>> pointers) to
|
||||
the output sections. The output section structure can be
|
||||
considered a filter for the input section: the output section
|
||||
determines the vma of the output data and the name, but the
|
||||
input section determines the offset into the output section of
|
||||
the data to be written.
|
||||
|
||||
E.g., to create a section "O", starting at 0x100, 0x123 long,
|
||||
containing two subsections, "A" at offset 0x0 (i.e., at vma
|
||||
0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the <<asection>>
|
||||
structures would look like:
|
||||
|
||||
| section name "A"
|
||||
| output_offset 0x00
|
||||
| size 0x20
|
||||
| output_section -----------> section name "O"
|
||||
| | vma 0x100
|
||||
| section name "B" | size 0x123
|
||||
| output_offset 0x20 |
|
||||
| size 0x103 |
|
||||
| output_section --------|
|
||||
|
||||
|
||||
SUBSECTION
|
||||
Link orders
|
||||
|
||||
The data within a section is stored in a @dfn{link_order}.
|
||||
These are much like the fixups in <<gas>>. The link_order
|
||||
abstraction allows a section to grow and shrink within itself.
|
||||
|
||||
A link_order knows how big it is, and which is the next
|
||||
link_order and where the raw data for it is; it also points to
|
||||
a list of relocations which apply to it.
|
||||
|
||||
The link_order is used by the linker to perform relaxing on
|
||||
final code. The compiler creates code which is as big as
|
||||
necessary to make it work without relaxing, and the user can
|
||||
select whether to relax. Sometimes relaxing takes a lot of
|
||||
time. The linker runs around the relocations to see if any
|
||||
are attached to data which can be shrunk, if so it does it on
|
||||
a link_order by link_order basis.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
|
||||
/*
|
||||
DOCDD
|
||||
INODE
|
||||
typedef asection, section prototypes, Section Output, Sections
|
||||
SUBSECTION
|
||||
typedef asection
|
||||
|
||||
Here is the section structure:
|
||||
|
||||
CODE_FRAGMENT
|
||||
.
|
||||
.typedef struct sec
|
||||
.{
|
||||
. {* The name of the section; the name isn't a copy, the pointer is
|
||||
. the same as that passed to bfd_make_section. *}
|
||||
.
|
||||
. CONST char *name;
|
||||
.
|
||||
. {* Which section is it; 0..nth. *}
|
||||
.
|
||||
. int index;
|
||||
.
|
||||
. {* The next section in the list belonging to the BFD, or NULL. *}
|
||||
.
|
||||
. struct sec *next;
|
||||
.
|
||||
. {* The field flags contains attributes of the section. Some
|
||||
. flags are read in from the object file, and some are
|
||||
. synthesized from other information. *}
|
||||
.
|
||||
. flagword flags;
|
||||
.
|
||||
.#define SEC_NO_FLAGS 0x000
|
||||
.
|
||||
. {* Tells the OS to allocate space for this section when loading.
|
||||
. This is clear for a section containing debug information
|
||||
. only. *}
|
||||
.#define SEC_ALLOC 0x001
|
||||
.
|
||||
. {* Tells the OS to load the section from the file when loading.
|
||||
. This is clear for a .bss section. *}
|
||||
.#define SEC_LOAD 0x002
|
||||
.
|
||||
. {* The section contains data still to be relocated, so there is
|
||||
. some relocation information too. *}
|
||||
.#define SEC_RELOC 0x004
|
||||
.
|
||||
.#if 0 {* Obsolete ? *}
|
||||
.#define SEC_BALIGN 0x008
|
||||
.#endif
|
||||
.
|
||||
. {* A signal to the OS that the section contains read only
|
||||
. data. *}
|
||||
.#define SEC_READONLY 0x010
|
||||
.
|
||||
. {* The section contains code only. *}
|
||||
.#define SEC_CODE 0x020
|
||||
.
|
||||
. {* The section contains data only. *}
|
||||
.#define SEC_DATA 0x040
|
||||
.
|
||||
. {* The section will reside in ROM. *}
|
||||
.#define SEC_ROM 0x080
|
||||
.
|
||||
. {* The section contains constructor information. This section
|
||||
. type is used by the linker to create lists of constructors and
|
||||
. destructors used by <<g++>>. When a back end sees a symbol
|
||||
. which should be used in a constructor list, it creates a new
|
||||
. section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
|
||||
. the symbol to it, and builds a relocation. To build the lists
|
||||
. of constructors, all the linker has to do is catenate all the
|
||||
. sections called <<__CTOR_LIST__>> and relocate the data
|
||||
. contained within - exactly the operations it would peform on
|
||||
. standard data. *}
|
||||
.#define SEC_CONSTRUCTOR 0x100
|
||||
.
|
||||
. {* The section is a constuctor, and should be placed at the
|
||||
. end of the text, data, or bss section(?). *}
|
||||
.#define SEC_CONSTRUCTOR_TEXT 0x1100
|
||||
.#define SEC_CONSTRUCTOR_DATA 0x2100
|
||||
.#define SEC_CONSTRUCTOR_BSS 0x3100
|
||||
.
|
||||
. {* The section has contents - a data section could be
|
||||
. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
|
||||
. <<SEC_HAS_CONTENTS>> *}
|
||||
.#define SEC_HAS_CONTENTS 0x200
|
||||
.
|
||||
. {* An instruction to the linker to not output the section
|
||||
. even if it has information which would normally be written. *}
|
||||
.#define SEC_NEVER_LOAD 0x400
|
||||
.
|
||||
. {* The section is a COFF shared library section. This flag is
|
||||
. only for the linker. If this type of section appears in
|
||||
. the input file, the linker must copy it to the output file
|
||||
. without changing the vma or size. FIXME: Although this
|
||||
. was originally intended to be general, it really is COFF
|
||||
. specific (and the flag was renamed to indicate this). It
|
||||
. might be cleaner to have some more general mechanism to
|
||||
. allow the back end to control what the linker does with
|
||||
. sections. *}
|
||||
.#define SEC_COFF_SHARED_LIBRARY 0x800
|
||||
.
|
||||
. {* The section is a common section (symbols may be defined
|
||||
. multiple times, the value of a symbol is the amount of
|
||||
. space it requires, and the largest symbol value is the one
|
||||
. used). Most targets have exactly one of these (which we
|
||||
. translate to bfd_com_section_ptr), but ECOFF has two. *}
|
||||
.#define SEC_IS_COMMON 0x8000
|
||||
.
|
||||
. {* The section contains only debugging information. For
|
||||
. example, this is set for ELF .debug and .stab sections.
|
||||
. strip tests this flag to see if a section can be
|
||||
. discarded. *}
|
||||
.#define SEC_DEBUGGING 0x10000
|
||||
.
|
||||
. {* The contents of this section are held in memory pointed to
|
||||
. by the contents field. This is checked by
|
||||
. bfd_get_section_contents, and the data is retrieved from
|
||||
. memory if appropriate. *}
|
||||
.#define SEC_IN_MEMORY 0x20000
|
||||
.
|
||||
. {* The contents of this section are to be excluded by the
|
||||
. linker for executable and shared objects unless those
|
||||
. objects are to be further relocated. *}
|
||||
.#define SEC_EXCLUDE 0x40000
|
||||
.
|
||||
. {* The contents of this section are to be sorted by the
|
||||
. based on the address specified in the associated symbol
|
||||
. table. *}
|
||||
.#define SEC_SORT_ENTRIES 0x80000
|
||||
.
|
||||
. {* End of section flags. *}
|
||||
.
|
||||
. {* The virtual memory address of the section - where it will be
|
||||
. at run time. The symbols are relocated against this. The
|
||||
. user_set_vma flag is maintained by bfd; if it's not set, the
|
||||
. backend can assign addresses (for example, in <<a.out>>, where
|
||||
. the default address for <<.data>> is dependent on the specific
|
||||
. target and various flags). *}
|
||||
.
|
||||
. bfd_vma vma;
|
||||
. boolean user_set_vma;
|
||||
.
|
||||
. {* The load address of the section - where it would be in a
|
||||
. rom image; really only used for writing section header
|
||||
. information. *}
|
||||
.
|
||||
. bfd_vma lma;
|
||||
.
|
||||
. {* The size of the section in bytes, as it will be output.
|
||||
. contains a value even if the section has no contents (e.g., the
|
||||
. size of <<.bss>>). This will be filled in after relocation *}
|
||||
.
|
||||
. bfd_size_type _cooked_size;
|
||||
.
|
||||
. {* The original size on disk of the section, in bytes. Normally this
|
||||
. value is the same as the size, but if some relaxing has
|
||||
. been done, then this value will be bigger. *}
|
||||
.
|
||||
. bfd_size_type _raw_size;
|
||||
.
|
||||
. {* If this section is going to be output, then this value is the
|
||||
. offset into the output section of the first byte in the input
|
||||
. section. E.g., if this was going to start at the 100th byte in
|
||||
. the output section, this value would be 100. *}
|
||||
.
|
||||
. bfd_vma output_offset;
|
||||
.
|
||||
. {* The output section through which to map on output. *}
|
||||
.
|
||||
. struct sec *output_section;
|
||||
.
|
||||
. {* The alignment requirement of the section, as an exponent of 2 -
|
||||
. e.g., 3 aligns to 2^3 (or 8). *}
|
||||
.
|
||||
. unsigned int alignment_power;
|
||||
.
|
||||
. {* If an input section, a pointer to a vector of relocation
|
||||
. records for the data in this section. *}
|
||||
.
|
||||
. struct reloc_cache_entry *relocation;
|
||||
.
|
||||
. {* If an output section, a pointer to a vector of pointers to
|
||||
. relocation records for the data in this section. *}
|
||||
.
|
||||
. struct reloc_cache_entry **orelocation;
|
||||
.
|
||||
. {* The number of relocation records in one of the above *}
|
||||
.
|
||||
. unsigned reloc_count;
|
||||
.
|
||||
. {* Information below is back end specific - and not always used
|
||||
. or updated. *}
|
||||
.
|
||||
. {* File position of section data *}
|
||||
.
|
||||
. file_ptr filepos;
|
||||
.
|
||||
. {* File position of relocation info *}
|
||||
.
|
||||
. file_ptr rel_filepos;
|
||||
.
|
||||
. {* File position of line data *}
|
||||
.
|
||||
. file_ptr line_filepos;
|
||||
.
|
||||
. {* Pointer to data for applications *}
|
||||
.
|
||||
. PTR userdata;
|
||||
.
|
||||
. {* If the SEC_IN_MEMORY flag is set, this points to the actual
|
||||
. contents. *}
|
||||
. unsigned char *contents;
|
||||
.
|
||||
. {* Attached line number information *}
|
||||
.
|
||||
. alent *lineno;
|
||||
.
|
||||
. {* Number of line number records *}
|
||||
.
|
||||
. unsigned int lineno_count;
|
||||
.
|
||||
. {* When a section is being output, this value changes as more
|
||||
. linenumbers are written out *}
|
||||
.
|
||||
. file_ptr moving_line_filepos;
|
||||
.
|
||||
. {* What the section number is in the target world *}
|
||||
.
|
||||
. int target_index;
|
||||
.
|
||||
. PTR used_by_bfd;
|
||||
.
|
||||
. {* If this is a constructor section then here is a list of the
|
||||
. relocations created to relocate items within it. *}
|
||||
.
|
||||
. struct relent_chain *constructor_chain;
|
||||
.
|
||||
. {* The BFD which owns the section. *}
|
||||
.
|
||||
. bfd *owner;
|
||||
.
|
||||
. boolean reloc_done;
|
||||
. {* A symbol which points at this section only *}
|
||||
. struct symbol_cache_entry *symbol;
|
||||
. struct symbol_cache_entry **symbol_ptr_ptr;
|
||||
.
|
||||
. struct bfd_link_order *link_order_head;
|
||||
. struct bfd_link_order *link_order_tail;
|
||||
.} asection ;
|
||||
.
|
||||
. {* These sections are global, and are managed by BFD. The application
|
||||
. and target back end are not permitted to change the values in
|
||||
. these sections. New code should use the section_ptr macros rather
|
||||
. than referring directly to the const sections. The const sections
|
||||
. may eventually vanish. *}
|
||||
.#define BFD_ABS_SECTION_NAME "*ABS*"
|
||||
.#define BFD_UND_SECTION_NAME "*UND*"
|
||||
.#define BFD_COM_SECTION_NAME "*COM*"
|
||||
.#define BFD_IND_SECTION_NAME "*IND*"
|
||||
.
|
||||
. {* the absolute section *}
|
||||
.extern const asection bfd_abs_section;
|
||||
.#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
|
||||
.#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
|
||||
. {* Pointer to the undefined section *}
|
||||
.extern const asection bfd_und_section;
|
||||
.#define bfd_und_section_ptr ((asection *) &bfd_und_section)
|
||||
.#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
|
||||
. {* Pointer to the common section *}
|
||||
.extern const asection bfd_com_section;
|
||||
.#define bfd_com_section_ptr ((asection *) &bfd_com_section)
|
||||
. {* Pointer to the indirect section *}
|
||||
.extern const asection bfd_ind_section;
|
||||
.#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
|
||||
.#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
|
||||
.
|
||||
.extern const struct symbol_cache_entry * const bfd_abs_symbol;
|
||||
.extern const struct symbol_cache_entry * const bfd_com_symbol;
|
||||
.extern const struct symbol_cache_entry * const bfd_und_symbol;
|
||||
.extern const struct symbol_cache_entry * const bfd_ind_symbol;
|
||||
.#define bfd_get_section_size_before_reloc(section) \
|
||||
. (section->reloc_done ? (abort(),1): (section)->_raw_size)
|
||||
.#define bfd_get_section_size_after_reloc(section) \
|
||||
. ((section->reloc_done) ? (section)->_cooked_size: (abort(),1))
|
||||
*/
|
||||
|
||||
/* These symbols are global, not specific to any BFD. Therefore, anything
|
||||
that tries to change them is broken, and should be repaired. */
|
||||
static const asymbol global_syms[] =
|
||||
{
|
||||
/* the_bfd, name, value, attr, section [, udata] */
|
||||
{0, BFD_COM_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_com_section},
|
||||
{0, BFD_UND_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_und_section},
|
||||
{0, BFD_ABS_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_abs_section},
|
||||
{0, BFD_IND_SECTION_NAME, 0, BSF_SECTION_SYM, (asection *) &bfd_ind_section},
|
||||
};
|
||||
|
||||
#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
|
||||
const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
|
||||
const asection SEC = \
|
||||
{ NAME, 0, 0, FLAGS, 0, false, 0, 0, 0, 0, (asection *) &SEC, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (boolean) 0, \
|
||||
(asymbol *) &global_syms[IDX], (asymbol **) &SYM, }
|
||||
|
||||
STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol,
|
||||
BFD_COM_SECTION_NAME, 0);
|
||||
STD_SECTION (bfd_und_section, 0, bfd_und_symbol, BFD_UND_SECTION_NAME, 1);
|
||||
STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2);
|
||||
STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3);
|
||||
#undef STD_SECTION
|
||||
|
||||
/*
|
||||
DOCDD
|
||||
INODE
|
||||
section prototypes, , typedef asection, Sections
|
||||
SUBSECTION
|
||||
Section prototypes
|
||||
|
||||
These are the functions exported by the section handling part of BFD.
|
||||
*/
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_get_section_by_name
|
||||
|
||||
SYNOPSIS
|
||||
asection *bfd_get_section_by_name(bfd *abfd, CONST char *name);
|
||||
|
||||
DESCRIPTION
|
||||
Run through @var{abfd} and return the one of the
|
||||
<<asection>>s whose name matches @var{name}, otherwise <<NULL>>.
|
||||
@xref{Sections}, for more information.
|
||||
|
||||
This should only be used in special cases; the normal way to process
|
||||
all sections of a given name is to use <<bfd_map_over_sections>> and
|
||||
<<strcmp>> on the name (or better yet, base it on the section flags
|
||||
or something else) for each section.
|
||||
*/
|
||||
|
||||
asection *
|
||||
bfd_get_section_by_name (abfd, name)
|
||||
bfd *abfd;
|
||||
CONST char *name;
|
||||
{
|
||||
asection *sect;
|
||||
|
||||
for (sect = abfd->sections; sect != NULL; sect = sect->next)
|
||||
if (!strcmp (sect->name, name))
|
||||
return sect;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_make_section_old_way
|
||||
|
||||
SYNOPSIS
|
||||
asection *bfd_make_section_old_way(bfd *abfd, CONST char *name);
|
||||
|
||||
DESCRIPTION
|
||||
Create a new empty section called @var{name}
|
||||
and attach it to the end of the chain of sections for the
|
||||
BFD @var{abfd}. An attempt to create a section with a name which
|
||||
is already in use returns its pointer without changing the
|
||||
section chain.
|
||||
|
||||
It has the funny name since this is the way it used to be
|
||||
before it was rewritten....
|
||||
|
||||
Possible errors are:
|
||||
o <<bfd_error_invalid_operation>> -
|
||||
If output has already started for this BFD.
|
||||
o <<bfd_error_no_memory>> -
|
||||
If obstack alloc fails.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
asection *
|
||||
bfd_make_section_old_way (abfd, name)
|
||||
bfd *abfd;
|
||||
CONST char *name;
|
||||
{
|
||||
asection *sec = bfd_get_section_by_name (abfd, name);
|
||||
if (sec == (asection *) NULL)
|
||||
{
|
||||
sec = bfd_make_section (abfd, name);
|
||||
}
|
||||
return sec;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_make_section_anyway
|
||||
|
||||
SYNOPSIS
|
||||
asection *bfd_make_section_anyway(bfd *abfd, CONST char *name);
|
||||
|
||||
DESCRIPTION
|
||||
Create a new empty section called @var{name} and attach it to the end of
|
||||
the chain of sections for @var{abfd}. Create a new section even if there
|
||||
is already a section with that name.
|
||||
|
||||
Return <<NULL>> and set <<bfd_error>> on error; possible errors are:
|
||||
o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}.
|
||||
o <<bfd_error_no_memory>> - If obstack alloc fails.
|
||||
*/
|
||||
|
||||
sec_ptr
|
||||
bfd_make_section_anyway (abfd, name)
|
||||
bfd *abfd;
|
||||
CONST char *name;
|
||||
{
|
||||
asection *newsect;
|
||||
asection **prev = &abfd->sections;
|
||||
asection *sect = abfd->sections;
|
||||
|
||||
if (abfd->output_has_begun)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (sect)
|
||||
{
|
||||
prev = §->next;
|
||||
sect = sect->next;
|
||||
}
|
||||
|
||||
newsect = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (newsect == NULL)
|
||||
return NULL;
|
||||
|
||||
newsect->name = name;
|
||||
newsect->index = abfd->section_count++;
|
||||
newsect->flags = SEC_NO_FLAGS;
|
||||
|
||||
newsect->userdata = NULL;
|
||||
newsect->contents = NULL;
|
||||
newsect->next = (asection *) NULL;
|
||||
newsect->relocation = (arelent *) NULL;
|
||||
newsect->reloc_count = 0;
|
||||
newsect->line_filepos = 0;
|
||||
newsect->owner = abfd;
|
||||
|
||||
/* Create a symbol whos only job is to point to this section. This is
|
||||
useful for things like relocs which are relative to the base of a
|
||||
section. */
|
||||
newsect->symbol = bfd_make_empty_symbol (abfd);
|
||||
if (newsect->symbol == NULL)
|
||||
return NULL;
|
||||
newsect->symbol->name = name;
|
||||
newsect->symbol->value = 0;
|
||||
newsect->symbol->section = newsect;
|
||||
newsect->symbol->flags = BSF_SECTION_SYM;
|
||||
|
||||
newsect->symbol_ptr_ptr = &newsect->symbol;
|
||||
|
||||
if (BFD_SEND (abfd, _new_section_hook, (abfd, newsect)) != true)
|
||||
{
|
||||
free (newsect);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*prev = newsect;
|
||||
return newsect;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_make_section
|
||||
|
||||
SYNOPSIS
|
||||
asection *bfd_make_section(bfd *, CONST char *name);
|
||||
|
||||
DESCRIPTION
|
||||
Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling
|
||||
bfd_set_error ()) without changing the section chain if there is already a
|
||||
section named @var{name}. If there is an error, return <<NULL>> and set
|
||||
<<bfd_error>>.
|
||||
*/
|
||||
|
||||
asection *
|
||||
bfd_make_section (abfd, name)
|
||||
bfd *abfd;
|
||||
CONST char *name;
|
||||
{
|
||||
asection *sect = abfd->sections;
|
||||
|
||||
if (strcmp (name, BFD_ABS_SECTION_NAME) == 0)
|
||||
{
|
||||
return bfd_abs_section_ptr;
|
||||
}
|
||||
if (strcmp (name, BFD_COM_SECTION_NAME) == 0)
|
||||
{
|
||||
return bfd_com_section_ptr;
|
||||
}
|
||||
if (strcmp (name, BFD_UND_SECTION_NAME) == 0)
|
||||
{
|
||||
return bfd_und_section_ptr;
|
||||
}
|
||||
|
||||
if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
|
||||
{
|
||||
return bfd_ind_section_ptr;
|
||||
}
|
||||
|
||||
while (sect)
|
||||
{
|
||||
if (!strcmp (sect->name, name))
|
||||
return NULL;
|
||||
sect = sect->next;
|
||||
}
|
||||
|
||||
/* The name is not already used; go ahead and make a new section. */
|
||||
return bfd_make_section_anyway (abfd, name);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_set_section_flags
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_set_section_flags(bfd *abfd, asection *sec, flagword flags);
|
||||
|
||||
DESCRIPTION
|
||||
Set the attributes of the section @var{sec} in the BFD
|
||||
@var{abfd} to the value @var{flags}. Return <<true>> on success,
|
||||
<<false>> on error. Possible error returns are:
|
||||
|
||||
o <<bfd_error_invalid_operation>> -
|
||||
The section cannot have one or more of the attributes
|
||||
requested. For example, a .bss section in <<a.out>> may not
|
||||
have the <<SEC_HAS_CONTENTS>> field set.
|
||||
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
boolean
|
||||
bfd_set_section_flags (abfd, section, flags)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
flagword flags;
|
||||
{
|
||||
#if 0
|
||||
/* If you try to copy a text section from an input file (where it
|
||||
has the SEC_CODE flag set) to an output file, this loses big if
|
||||
the bfd_applicable_section_flags (abfd) doesn't have the SEC_CODE
|
||||
set - which it doesn't, at least not for a.out. FIXME */
|
||||
|
||||
if ((flags & bfd_applicable_section_flags (abfd)) != flags)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
section->flags = flags;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_map_over_sections
|
||||
|
||||
SYNOPSIS
|
||||
void bfd_map_over_sections(bfd *abfd,
|
||||
void (*func)(bfd *abfd,
|
||||
asection *sect,
|
||||
PTR obj),
|
||||
PTR obj);
|
||||
|
||||
DESCRIPTION
|
||||
Call the provided function @var{func} for each section
|
||||
attached to the BFD @var{abfd}, passing @var{obj} as an
|
||||
argument. The function will be called as if by
|
||||
|
||||
| func(abfd, the_section, obj);
|
||||
|
||||
This is the prefered method for iterating over sections; an
|
||||
alternative would be to use a loop:
|
||||
|
||||
| section *p;
|
||||
| for (p = abfd->sections; p != NULL; p = p->next)
|
||||
| func(abfd, p, ...)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*VARARGS2*/
|
||||
void
|
||||
bfd_map_over_sections (abfd, operation, user_storage)
|
||||
bfd *abfd;
|
||||
void (*operation) PARAMS ((bfd * abfd, asection * sect, PTR obj));
|
||||
PTR user_storage;
|
||||
{
|
||||
asection *sect;
|
||||
unsigned int i = 0;
|
||||
|
||||
for (sect = abfd->sections; sect != NULL; i++, sect = sect->next)
|
||||
(*operation) (abfd, sect, user_storage);
|
||||
|
||||
if (i != abfd->section_count) /* Debugging */
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_set_section_size
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_set_section_size(bfd *abfd, asection *sec, bfd_size_type val);
|
||||
|
||||
DESCRIPTION
|
||||
Set @var{sec} to the size @var{val}. If the operation is
|
||||
ok, then <<true>> is returned, else <<false>>.
|
||||
|
||||
Possible error returns:
|
||||
o <<bfd_error_invalid_operation>> -
|
||||
Writing has started to the BFD, so setting the size is invalid.
|
||||
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_set_section_size (abfd, ptr, val)
|
||||
bfd *abfd;
|
||||
sec_ptr ptr;
|
||||
bfd_size_type val;
|
||||
{
|
||||
/* Once you've started writing to any section you cannot create or change
|
||||
the size of any others. */
|
||||
|
||||
if (abfd->output_has_begun)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
|
||||
ptr->_cooked_size = val;
|
||||
ptr->_raw_size = val;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_set_section_contents
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_set_section_contents
|
||||
(bfd *abfd,
|
||||
asection *section,
|
||||
PTR data,
|
||||
file_ptr offset,
|
||||
bfd_size_type count);
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
Sets the contents of the section @var{section} in BFD
|
||||
@var{abfd} to the data starting in memory at @var{data}. The
|
||||
data is written to the output section starting at offset
|
||||
@var{offset} for @var{count} bytes.
|
||||
|
||||
|
||||
|
||||
Normally <<true>> is returned, else <<false>>. Possible error
|
||||
returns are:
|
||||
o <<bfd_error_no_contents>> -
|
||||
The output section does not have the <<SEC_HAS_CONTENTS>>
|
||||
attribute, so nothing can be written to it.
|
||||
o and some more too
|
||||
|
||||
This routine is front end to the back end function
|
||||
<<_bfd_set_section_contents>>.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#define bfd_get_section_size_now(abfd,sec) \
|
||||
(sec->reloc_done \
|
||||
? bfd_get_section_size_after_reloc (sec) \
|
||||
: bfd_get_section_size_before_reloc (sec))
|
||||
|
||||
boolean
|
||||
bfd_set_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
bfd_size_type sz;
|
||||
|
||||
if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS))
|
||||
{
|
||||
bfd_set_error (bfd_error_no_contents);
|
||||
return (false);
|
||||
}
|
||||
|
||||
if (offset < 0)
|
||||
{
|
||||
bad_val:
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
sz = bfd_get_section_size_now (abfd, section);
|
||||
if ((bfd_size_type) offset > sz
|
||||
|| count > sz
|
||||
|| offset + count > sz)
|
||||
goto bad_val;
|
||||
|
||||
switch (abfd->direction)
|
||||
{
|
||||
case read_direction:
|
||||
case no_direction:
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
|
||||
case write_direction:
|
||||
break;
|
||||
|
||||
case both_direction:
|
||||
/* File is opened for update. `output_has_begun' some time ago when
|
||||
the file was created. Do not recompute sections sizes or alignments
|
||||
in _bfd_set_section_content. */
|
||||
abfd->output_has_begun = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (BFD_SEND (abfd, _bfd_set_section_contents,
|
||||
(abfd, section, location, offset, count)))
|
||||
{
|
||||
abfd->output_has_begun = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_get_section_contents
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_get_section_contents
|
||||
(bfd *abfd, asection *section, PTR location,
|
||||
file_ptr offset, bfd_size_type count);
|
||||
|
||||
DESCRIPTION
|
||||
Read data from @var{section} in BFD @var{abfd}
|
||||
into memory starting at @var{location}. The data is read at an
|
||||
offset of @var{offset} from the start of the input section,
|
||||
and is read for @var{count} bytes.
|
||||
|
||||
If the contents of a constructor with the <<SEC_CONSTRUCTOR>>
|
||||
flag set are requested or if the section does not have the
|
||||
<<SEC_HAS_CONTENTS>> flag set, then the @var{location} is filled
|
||||
with zeroes. If no errors occur, <<true>> is returned, else
|
||||
<<false>>.
|
||||
|
||||
|
||||
|
||||
*/
|
||||
boolean
|
||||
bfd_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
bfd_size_type sz;
|
||||
|
||||
if (section->flags & SEC_CONSTRUCTOR)
|
||||
{
|
||||
memset (location, 0, (unsigned) count);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (offset < 0)
|
||||
{
|
||||
bad_val:
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
/* Even if reloc_done is true, this function reads unrelocated
|
||||
contents, so we want the raw size. */
|
||||
sz = section->_raw_size;
|
||||
if ((bfd_size_type) offset > sz || count > sz || offset + count > sz)
|
||||
goto bad_val;
|
||||
|
||||
if (count == 0)
|
||||
/* Don't bother. */
|
||||
return true;
|
||||
|
||||
if ((section->flags & SEC_HAS_CONTENTS) == 0)
|
||||
{
|
||||
memset (location, 0, (unsigned) count);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((section->flags & SEC_IN_MEMORY) != 0)
|
||||
{
|
||||
memcpy (location, section->contents + offset, (size_t) count);
|
||||
return true;
|
||||
}
|
||||
|
||||
return BFD_SEND (abfd, _bfd_get_section_contents,
|
||||
(abfd, section, location, offset, count));
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_copy_private_section_data
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_copy_private_section_data(bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
|
||||
|
||||
DESCRIPTION
|
||||
Copy private section information from @var{isec} in the BFD
|
||||
@var{ibfd} to the section @var{osec} in the BFD @var{obfd}.
|
||||
Return <<true>> on success, <<false>> on error. Possible error
|
||||
returns are:
|
||||
|
||||
o <<bfd_error_no_memory>> -
|
||||
Not enough memory exists to create private data for @var{osec}.
|
||||
|
||||
.#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
|
||||
. BFD_SEND (ibfd, _bfd_copy_private_section_data, \
|
||||
. (ibfd, isection, obfd, osection))
|
||||
*/
|
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
/* Table of stab names for the BFD library.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
|
||||
#define ARCH_SIZE 32 /* Value doesn't matter. */
|
||||
#include "libaout.h"
|
||||
#include "aout/aout64.h"
|
||||
|
||||
/* Ignore duplicate stab codes; just return the string for the first
|
||||
one. */
|
||||
#define __define_stab(NAME, CODE, STRING) __define_name(CODE, STRING)
|
||||
#define __define_stab_duplicate(NAME, CODE, STRING)
|
||||
|
||||
/* These are not really stab symbols, but it is
|
||||
convenient to have them here for the sake of nm.
|
||||
For completeness, we could also add N_TEXT etc, but those
|
||||
are never needed, since nm treats those specially. */
|
||||
#define EXTRA_SYMBOLS \
|
||||
__define_name (N_SETA, "SETA")/* Absolute set element symbol */ \
|
||||
__define_name (N_SETT, "SETT")/* Text set element symbol */ \
|
||||
__define_name (N_SETD, "SETD")/* Data set element symbol */ \
|
||||
__define_name (N_SETB, "SETB")/* Bss set element symbol */ \
|
||||
__define_name (N_SETV, "SETV")/* Pointer to set vector in data area. */ \
|
||||
__define_name (N_INDR, "INDR") \
|
||||
__define_name (N_WARNING, "WARNING")
|
||||
|
||||
const char *
|
||||
bfd_get_stab_name (code)
|
||||
int code;
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
#define __define_name(val, str) case val: return str;
|
||||
#include "aout/stab.def"
|
||||
EXTRA_SYMBOLS
|
||||
}
|
||||
|
||||
return (const char *) 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,114 +0,0 @@
|
||||
/* sysdep.h -- handle host dependencies for the BFD library
|
||||
Copyright 1995 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef BFD_SYSDEP_H
|
||||
#define BFD_SYSDEP_H
|
||||
|
||||
#include "ansidecl.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#else
|
||||
extern char *strchr ();
|
||||
extern char *strrchr ();
|
||||
extern char *strstr ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if TIME_WITH_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#else
|
||||
#if HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_BINARY_FOPEN
|
||||
#include "fopen-bin.h"
|
||||
#else
|
||||
#include "fopen-same.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef O_RDONLY
|
||||
#define O_RDONLY 0
|
||||
#endif
|
||||
#ifndef O_WRONLY
|
||||
#define O_WRONLY 1
|
||||
#endif
|
||||
#ifndef O_RDWR
|
||||
#define O_RDWR 2
|
||||
#endif
|
||||
#ifndef O_ACCMODE
|
||||
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0
|
||||
#endif
|
||||
#ifndef SEEK_CUR
|
||||
#define SEEK_CUR 1
|
||||
#endif
|
||||
|
||||
#ifdef NEED_DECLARATION_MALLOC
|
||||
extern PTR malloc ();
|
||||
#endif
|
||||
|
||||
#ifdef NEED_DECLARATION_FREE
|
||||
extern void free ();
|
||||
#endif
|
||||
|
||||
#endif /* ! defined (BFD_SYSDEP_H) */
|
@ -1,886 +0,0 @@
|
||||
/* Generic target-file-type support for the BFD library.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
/*
|
||||
SECTION
|
||||
Targets
|
||||
|
||||
DESCRIPTION
|
||||
Each port of BFD to a different machine requries the creation
|
||||
of a target back end. All the back end provides to the root
|
||||
part of BFD is a structure containing pointers to functions
|
||||
which perform certain low level operations on files. BFD
|
||||
translates the applications's requests through a pointer into
|
||||
calls to the back end routines.
|
||||
|
||||
When a file is opened with <<bfd_openr>>, its format and
|
||||
target are unknown. BFD uses various mechanisms to determine
|
||||
how to interpret the file. The operations performed are:
|
||||
|
||||
o Create a BFD by calling the internal routine
|
||||
<<_bfd_new_bfd>>, then call <<bfd_find_target>> with the
|
||||
target string supplied to <<bfd_openr>> and the new BFD pointer.
|
||||
|
||||
o If a null target string was provided to <<bfd_find_target>>,
|
||||
look up the environment variable <<GNUTARGET>> and use
|
||||
that as the target string.
|
||||
|
||||
o If the target string is still <<NULL>>, or the target string is
|
||||
<<default>>, then use the first item in the target vector
|
||||
as the target type, and set <<target_defaulted>> in the BFD to
|
||||
cause <<bfd_check_format>> to loop through all the targets.
|
||||
@xref{bfd_target}. @xref{Formats}.
|
||||
|
||||
o Otherwise, inspect the elements in the target vector
|
||||
one by one, until a match on target name is found. When found,
|
||||
use it.
|
||||
|
||||
o Otherwise return the error <<bfd_error_invalid_target>> to
|
||||
<<bfd_openr>>.
|
||||
|
||||
o <<bfd_openr>> attempts to open the file using
|
||||
<<bfd_open_file>>, and returns the BFD.
|
||||
|
||||
Once the BFD has been opened and the target selected, the file
|
||||
format may be determined. This is done by calling
|
||||
<<bfd_check_format>> on the BFD with a suggested format.
|
||||
If <<target_defaulted>> has been set, each possible target
|
||||
type is tried to see if it recognizes the specified format.
|
||||
<<bfd_check_format>> returns <<true>> when the caller guesses right.
|
||||
@menu
|
||||
@* bfd_target::
|
||||
@end menu
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
INODE
|
||||
bfd_target, , Targets, Targets
|
||||
DOCDD
|
||||
SUBSECTION
|
||||
bfd_target
|
||||
|
||||
DESCRIPTION
|
||||
This structure contains everything that BFD knows about a
|
||||
target. It includes things like its byte order, name, and which
|
||||
routines to call to do various operations.
|
||||
|
||||
Every BFD points to a target structure with its <<xvec>>
|
||||
member.
|
||||
|
||||
The macros below are used to dispatch to functions through the
|
||||
<<bfd_target>> vector. They are used in a number of macros further
|
||||
down in @file{bfd.h}, and are also used when calling various
|
||||
routines by hand inside the BFD implementation. The @var{arglist}
|
||||
argument must be parenthesized; it contains all the arguments
|
||||
to the called function.
|
||||
|
||||
They make the documentation (more) unpleasant to read, so if
|
||||
someone wants to fix this and not break the above, please do.
|
||||
|
||||
.#define BFD_SEND(bfd, message, arglist) \
|
||||
. ((*((bfd)->xvec->message)) arglist)
|
||||
.
|
||||
.#ifdef DEBUG_BFD_SEND
|
||||
.#undef BFD_SEND
|
||||
.#define BFD_SEND(bfd, message, arglist) \
|
||||
. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
|
||||
. ((*((bfd)->xvec->message)) arglist) : \
|
||||
. (bfd_assert (__FILE__,__LINE__), NULL))
|
||||
.#endif
|
||||
|
||||
For operations which index on the BFD format:
|
||||
|
||||
.#define BFD_SEND_FMT(bfd, message, arglist) \
|
||||
. (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
|
||||
.
|
||||
.#ifdef DEBUG_BFD_SEND
|
||||
.#undef BFD_SEND_FMT
|
||||
.#define BFD_SEND_FMT(bfd, message, arglist) \
|
||||
. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
|
||||
. (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
|
||||
. (bfd_assert (__FILE__,__LINE__), NULL))
|
||||
.#endif
|
||||
|
||||
This is the structure which defines the type of BFD this is. The
|
||||
<<xvec>> member of the struct <<bfd>> itself points here. Each
|
||||
module that implements access to a different target under BFD,
|
||||
defines one of these.
|
||||
|
||||
|
||||
FIXME, these names should be rationalised with the names of
|
||||
the entry points which call them. Too bad we can't have one
|
||||
macro to define them both!
|
||||
|
||||
.enum bfd_flavour {
|
||||
. bfd_target_unknown_flavour,
|
||||
. bfd_target_aout_flavour,
|
||||
. bfd_target_coff_flavour,
|
||||
. bfd_target_ecoff_flavour,
|
||||
. bfd_target_elf_flavour,
|
||||
. bfd_target_ieee_flavour,
|
||||
. bfd_target_nlm_flavour,
|
||||
. bfd_target_oasys_flavour,
|
||||
. bfd_target_tekhex_flavour,
|
||||
. bfd_target_srec_flavour,
|
||||
. bfd_target_ihex_flavour,
|
||||
. bfd_target_som_flavour,
|
||||
. bfd_target_os9k_flavour,
|
||||
. bfd_target_versados_flavour,
|
||||
. bfd_target_msdos_flavour
|
||||
.};
|
||||
.
|
||||
.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
|
||||
.
|
||||
.{* Forward declaration. *}
|
||||
.typedef struct bfd_link_info _bfd_link_info;
|
||||
.
|
||||
.typedef struct bfd_target
|
||||
.{
|
||||
|
||||
Identifies the kind of target, e.g., SunOS4, Ultrix, etc.
|
||||
|
||||
. char *name;
|
||||
|
||||
The "flavour" of a back end is a general indication about the contents
|
||||
of a file.
|
||||
|
||||
. enum bfd_flavour flavour;
|
||||
|
||||
The order of bytes within the data area of a file.
|
||||
|
||||
. enum bfd_endian byteorder;
|
||||
|
||||
The order of bytes within the header parts of a file.
|
||||
|
||||
. enum bfd_endian header_byteorder;
|
||||
|
||||
A mask of all the flags which an executable may have set -
|
||||
from the set <<NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.
|
||||
|
||||
. flagword object_flags;
|
||||
|
||||
A mask of all the flags which a section may have set - from
|
||||
the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.
|
||||
|
||||
. flagword section_flags;
|
||||
|
||||
The character normally found at the front of a symbol
|
||||
(if any), perhaps `_'.
|
||||
|
||||
. char symbol_leading_char;
|
||||
|
||||
The pad character for file names within an archive header.
|
||||
|
||||
. char ar_pad_char;
|
||||
|
||||
The maximum number of characters in an archive header.
|
||||
|
||||
. unsigned short ar_max_namelen;
|
||||
|
||||
Entries for byte swapping for data. These are different from the other
|
||||
entry points, since they don't take a BFD asthe first argument.
|
||||
Certain other handlers could do the same.
|
||||
|
||||
. bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
|
||||
. bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
|
||||
. void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
||||
. bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
|
||||
. bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
|
||||
. void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
||||
. bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
|
||||
. bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
|
||||
. void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
||||
|
||||
Byte swapping for the headers
|
||||
|
||||
. bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
|
||||
. bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
|
||||
. void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
||||
. bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
|
||||
. bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
|
||||
. void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
||||
. bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
|
||||
. bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
|
||||
. void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
||||
|
||||
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_target *>> or zero.
|
||||
|
||||
. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
|
||||
|
||||
Set the format of a file being written.
|
||||
|
||||
. boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
|
||||
|
||||
Write cached information into a file being written, at <<bfd_close>>.
|
||||
|
||||
. boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
|
||||
|
||||
The general target vector.
|
||||
|
||||
.
|
||||
. {* Generic entry points. *}
|
||||
.#define BFD_JUMP_TABLE_GENERIC(NAME)\
|
||||
.CAT(NAME,_close_and_cleanup),\
|
||||
.CAT(NAME,_bfd_free_cached_info),\
|
||||
.CAT(NAME,_new_section_hook),\
|
||||
.CAT(NAME,_get_section_contents),\
|
||||
.CAT(NAME,_get_section_contents_in_window)
|
||||
.
|
||||
. {* Called when the BFD is being closed to do any necessary cleanup. *}
|
||||
. boolean (*_close_and_cleanup) PARAMS ((bfd *));
|
||||
. {* Ask the BFD to free all cached information. *}
|
||||
. boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
|
||||
. {* Called when a new section is created. *}
|
||||
. boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
|
||||
. {* Read the contents of a section. *}
|
||||
. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
|
||||
. file_ptr, bfd_size_type));
|
||||
. boolean (*_bfd_get_section_contents_in_window)
|
||||
. PARAMS ((bfd *, sec_ptr, bfd_window *,
|
||||
. file_ptr, bfd_size_type));
|
||||
.
|
||||
. {* Entry points to copy private data. *}
|
||||
.#define BFD_JUMP_TABLE_COPY(NAME)\
|
||||
.CAT(NAME,_bfd_copy_private_bfd_data),\
|
||||
.CAT(NAME,_bfd_merge_private_bfd_data),\
|
||||
.CAT(NAME,_bfd_copy_private_section_data),\
|
||||
.CAT(NAME,_bfd_copy_private_symbol_data),\
|
||||
.CAT(NAME,_bfd_set_private_flags),\
|
||||
.CAT(NAME,_bfd_print_private_bfd_data)\
|
||||
. {* Called to copy BFD general private data from one object file
|
||||
. to another. *}
|
||||
. boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
|
||||
. {* Called to merge BFD general private data from one object file
|
||||
. to a common output file when linking. *}
|
||||
. boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
|
||||
. {* Called to copy BFD private section data from one object file
|
||||
. to another. *}
|
||||
. boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
|
||||
. bfd *, sec_ptr));
|
||||
. {* Called to copy BFD private symbol data from one symbol
|
||||
. to another. *}
|
||||
. boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
|
||||
. bfd *, asymbol *));
|
||||
. {* Called to set private backend flags *}
|
||||
. boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
|
||||
.
|
||||
. {* Called to print private BFD data *}
|
||||
. boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
|
||||
.
|
||||
. {* Core file entry points. *}
|
||||
.#define BFD_JUMP_TABLE_CORE(NAME)\
|
||||
.CAT(NAME,_core_file_failing_command),\
|
||||
.CAT(NAME,_core_file_failing_signal),\
|
||||
.CAT(NAME,_core_file_matches_executable_p)
|
||||
. char * (*_core_file_failing_command) PARAMS ((bfd *));
|
||||
. int (*_core_file_failing_signal) PARAMS ((bfd *));
|
||||
. boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
|
||||
.
|
||||
. {* Archive entry points. *}
|
||||
.#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
|
||||
.CAT(NAME,_slurp_armap),\
|
||||
.CAT(NAME,_slurp_extended_name_table),\
|
||||
.CAT(NAME,_construct_extended_name_table),\
|
||||
.CAT(NAME,_truncate_arname),\
|
||||
.CAT(NAME,_write_armap),\
|
||||
.CAT(NAME,_read_ar_hdr),\
|
||||
.CAT(NAME,_openr_next_archived_file),\
|
||||
.CAT(NAME,_get_elt_at_index),\
|
||||
.CAT(NAME,_generic_stat_arch_elt),\
|
||||
.CAT(NAME,_update_armap_timestamp)
|
||||
. boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
|
||||
. boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
|
||||
. boolean (*_bfd_construct_extended_name_table)
|
||||
. PARAMS ((bfd *, char **, bfd_size_type *, const char **));
|
||||
. void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
|
||||
. boolean (*write_armap) PARAMS ((bfd *arch,
|
||||
. unsigned int elength,
|
||||
. struct orl *map,
|
||||
. unsigned int orl_count,
|
||||
. int stridx));
|
||||
. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
|
||||
. bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
|
||||
.#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
|
||||
. bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
|
||||
. int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
|
||||
. boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
|
||||
.
|
||||
. {* Entry points used for symbols. *}
|
||||
.#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
|
||||
.CAT(NAME,_get_symtab_upper_bound),\
|
||||
.CAT(NAME,_get_symtab),\
|
||||
.CAT(NAME,_make_empty_symbol),\
|
||||
.CAT(NAME,_print_symbol),\
|
||||
.CAT(NAME,_get_symbol_info),\
|
||||
.CAT(NAME,_bfd_is_local_label),\
|
||||
.CAT(NAME,_get_lineno),\
|
||||
.CAT(NAME,_find_nearest_line),\
|
||||
.CAT(NAME,_bfd_make_debug_symbol),\
|
||||
.CAT(NAME,_read_minisymbols),\
|
||||
.CAT(NAME,_minisymbol_to_symbol)
|
||||
. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
|
||||
. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
|
||||
. struct symbol_cache_entry **));
|
||||
. struct symbol_cache_entry *
|
||||
. (*_bfd_make_empty_symbol) PARAMS ((bfd *));
|
||||
. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
|
||||
. struct symbol_cache_entry *,
|
||||
. bfd_print_symbol_type));
|
||||
.#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
|
||||
. void (*_bfd_get_symbol_info) PARAMS ((bfd *,
|
||||
. struct symbol_cache_entry *,
|
||||
. symbol_info *));
|
||||
.#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
|
||||
. boolean (*_bfd_is_local_label) PARAMS ((bfd *, asymbol *));
|
||||
.
|
||||
. alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
|
||||
. boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,
|
||||
. struct sec *section, struct symbol_cache_entry **symbols,
|
||||
. bfd_vma offset, CONST char **file, CONST char **func,
|
||||
. unsigned int *line));
|
||||
. {* Back-door to allow format-aware applications to create debug symbols
|
||||
. while using BFD for everything else. Currently used by the assembler
|
||||
. when creating COFF files. *}
|
||||
. asymbol * (*_bfd_make_debug_symbol) PARAMS ((
|
||||
. bfd *abfd,
|
||||
. void *ptr,
|
||||
. unsigned long size));
|
||||
.#define bfd_read_minisymbols(b, d, m, s) \
|
||||
. BFD_SEND (b, _read_minisymbols, (b, d, m, s))
|
||||
. long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
|
||||
. unsigned int *));
|
||||
.#define bfd_minisymbol_to_symbol(b, d, m, f) \
|
||||
. BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
|
||||
. asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
|
||||
. asymbol *));
|
||||
.
|
||||
. {* Routines for relocs. *}
|
||||
.#define BFD_JUMP_TABLE_RELOCS(NAME)\
|
||||
.CAT(NAME,_get_reloc_upper_bound),\
|
||||
.CAT(NAME,_canonicalize_reloc),\
|
||||
.CAT(NAME,_bfd_reloc_type_lookup)
|
||||
. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
|
||||
. long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
|
||||
. struct symbol_cache_entry **));
|
||||
. {* See documentation on reloc types. *}
|
||||
. reloc_howto_type *
|
||||
. (*reloc_type_lookup) PARAMS ((bfd *abfd,
|
||||
. bfd_reloc_code_real_type code));
|
||||
.
|
||||
. {* Routines used when writing an object file. *}
|
||||
.#define BFD_JUMP_TABLE_WRITE(NAME)\
|
||||
.CAT(NAME,_set_arch_mach),\
|
||||
.CAT(NAME,_set_section_contents)
|
||||
. boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
|
||||
. unsigned long));
|
||||
. boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
|
||||
. file_ptr, bfd_size_type));
|
||||
.
|
||||
. {* Routines used by the linker. *}
|
||||
.#define BFD_JUMP_TABLE_LINK(NAME)\
|
||||
.CAT(NAME,_sizeof_headers),\
|
||||
.CAT(NAME,_bfd_get_relocated_section_contents),\
|
||||
.CAT(NAME,_bfd_relax_section),\
|
||||
.CAT(NAME,_bfd_link_hash_table_create),\
|
||||
.CAT(NAME,_bfd_link_add_symbols),\
|
||||
.CAT(NAME,_bfd_final_link),\
|
||||
.CAT(NAME,_bfd_link_split_section)
|
||||
. int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
|
||||
. bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
|
||||
. struct bfd_link_info *, struct bfd_link_order *,
|
||||
. bfd_byte *data, boolean relocateable,
|
||||
. struct symbol_cache_entry **));
|
||||
.
|
||||
. boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
|
||||
. struct bfd_link_info *, boolean *again));
|
||||
.
|
||||
. {* Create a hash table for the linker. Different backends store
|
||||
. different information in this table. *}
|
||||
. struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
|
||||
.
|
||||
. {* Add symbols from this object file into the hash table. *}
|
||||
. boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
|
||||
.
|
||||
. {* Do a link based on the link_order structures attached to each
|
||||
. section of the BFD. *}
|
||||
. boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
|
||||
.
|
||||
. {* Should this section be split up into smaller pieces during linking. *}
|
||||
. boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
|
||||
.
|
||||
. {* Routines to handle dynamic symbols and relocs. *}
|
||||
.#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
|
||||
.CAT(NAME,_get_dynamic_symtab_upper_bound),\
|
||||
.CAT(NAME,_canonicalize_dynamic_symtab),\
|
||||
.CAT(NAME,_get_dynamic_reloc_upper_bound),\
|
||||
.CAT(NAME,_canonicalize_dynamic_reloc)
|
||||
. {* Get the amount of memory required to hold the dynamic symbols. *}
|
||||
. long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
|
||||
. {* Read in the dynamic symbols. *}
|
||||
. long (*_bfd_canonicalize_dynamic_symtab)
|
||||
. PARAMS ((bfd *, struct symbol_cache_entry **));
|
||||
. {* Get the amount of memory required to hold the dynamic relocs. *}
|
||||
. long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
|
||||
. {* Read in the dynamic relocs. *}
|
||||
. long (*_bfd_canonicalize_dynamic_reloc)
|
||||
. PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
|
||||
.
|
||||
|
||||
Data for use by back-end routines, which isn't generic enough to belong
|
||||
in this structure.
|
||||
|
||||
. PTR backend_data;
|
||||
.} bfd_target;
|
||||
|
||||
*/
|
||||
|
||||
/* All known xvecs (even those that don't compile on all systems).
|
||||
Alphabetized for easy reference.
|
||||
They are listed a second time below, since
|
||||
we can't intermix extern's and initializers. */
|
||||
extern const bfd_target a29kcoff_big_vec;
|
||||
extern const bfd_target a_out_adobe_vec;
|
||||
extern const bfd_target aout_arm_big_vec;
|
||||
extern const bfd_target aout_arm_little_vec;
|
||||
extern const bfd_target aout_mips_big_vec;
|
||||
extern const bfd_target aout_mips_little_vec;
|
||||
extern const bfd_target aout0_big_vec;
|
||||
extern const bfd_target apollocoff_vec;
|
||||
extern const bfd_target armcoff_little_vec;
|
||||
extern const bfd_target armcoff_big_vec;
|
||||
extern const bfd_target armpe_little_vec;
|
||||
extern const bfd_target armpe_big_vec;
|
||||
extern const bfd_target armpei_little_vec;
|
||||
extern const bfd_target armpei_big_vec;
|
||||
extern const bfd_target b_out_vec_big_host;
|
||||
extern const bfd_target b_out_vec_little_host;
|
||||
extern const bfd_target bfd_elf32_big_generic_vec;
|
||||
extern const bfd_target bfd_elf32_bigmips_vec;
|
||||
extern const bfd_target bfd_elf32_hppa_vec;
|
||||
extern const bfd_target bfd_elf32_i386_vec;
|
||||
extern const bfd_target bfd_elf32_i860_vec;
|
||||
extern const bfd_target bfd_elf32_little_generic_vec;
|
||||
extern const bfd_target bfd_elf32_littlemips_vec;
|
||||
extern const bfd_target bfd_elf32_m68k_vec;
|
||||
extern const bfd_target bfd_elf32_m88k_vec;
|
||||
extern const bfd_target bfd_elf32_powerpc_vec;
|
||||
extern const bfd_target bfd_elf32_powerpcle_vec;
|
||||
extern const bfd_target bfd_elf32_sparc_vec;
|
||||
extern const bfd_target bfd_elf64_big_generic_vec;
|
||||
extern const bfd_target bfd_elf64_little_generic_vec;
|
||||
extern const bfd_target bfd_elf64_sparc_vec;
|
||||
extern const bfd_target demo_64_vec;
|
||||
extern const bfd_target ecoff_big_vec;
|
||||
extern const bfd_target ecoff_little_vec;
|
||||
extern const bfd_target ecoffalpha_little_vec;
|
||||
extern const bfd_target h8300coff_vec;
|
||||
extern const bfd_target h8500coff_vec;
|
||||
extern const bfd_target host_aout_vec;
|
||||
extern const bfd_target hp300bsd_vec;
|
||||
extern const bfd_target hp300hpux_vec;
|
||||
extern const bfd_target som_vec;
|
||||
extern const bfd_target i386aout_vec;
|
||||
extern const bfd_target i386bsd_vec;
|
||||
extern const bfd_target i386dynix_vec;
|
||||
extern const bfd_target i386freebsd_vec;
|
||||
extern const bfd_target i386os9k_vec;
|
||||
extern const bfd_target i386coff_vec;
|
||||
extern const bfd_target bfd_powerpc_pe_vec;
|
||||
extern const bfd_target bfd_powerpcle_pe_vec;
|
||||
extern const bfd_target bfd_powerpc_pei_vec;
|
||||
extern const bfd_target bfd_powerpcle_pei_vec;
|
||||
extern const bfd_target i386pe_vec;
|
||||
extern const bfd_target i386pei_vec;
|
||||
extern const bfd_target go32coff_vec;
|
||||
extern const bfd_target i386linux_vec;
|
||||
extern const bfd_target i386lynx_aout_vec;
|
||||
extern const bfd_target i386lynx_coff_vec;
|
||||
extern const bfd_target i386mach3_vec;
|
||||
extern const bfd_target i386msdos_vec;
|
||||
extern const bfd_target i386netbsd_vec;
|
||||
extern const bfd_target i860coff_vec;
|
||||
extern const bfd_target icoff_big_vec;
|
||||
extern const bfd_target icoff_little_vec;
|
||||
extern const bfd_target ieee_vec;
|
||||
extern const bfd_target m68kaux_coff_vec;
|
||||
extern const bfd_target m68kcoff_vec;
|
||||
extern const bfd_target m68kcoffun_vec;
|
||||
extern const bfd_target m68klinux_vec;
|
||||
extern const bfd_target m68klynx_aout_vec;
|
||||
extern const bfd_target m68klynx_coff_vec;
|
||||
extern const bfd_target m68knetbsd_vec;
|
||||
extern const bfd_target m68k4knetbsd_vec;
|
||||
extern const bfd_target m88kbcs_vec;
|
||||
extern const bfd_target m88kmach3_vec;
|
||||
extern const bfd_target newsos3_vec;
|
||||
extern const bfd_target nlm32_i386_vec;
|
||||
extern const bfd_target nlm32_sparc_vec;
|
||||
extern const bfd_target nlm32_alpha_vec;
|
||||
extern const bfd_target nlm32_powerpc_vec;
|
||||
extern const bfd_target pc532netbsd_vec;
|
||||
extern const bfd_target oasys_vec;
|
||||
extern const bfd_target pc532machaout_vec;
|
||||
extern const bfd_target riscix_vec;
|
||||
extern const bfd_target pmac_xcoff_vec;
|
||||
extern const bfd_target rs6000coff_vec;
|
||||
extern const bfd_target shcoff_vec;
|
||||
extern const bfd_target shlcoff_vec;
|
||||
extern const bfd_target sparclynx_aout_vec;
|
||||
extern const bfd_target sparclynx_coff_vec;
|
||||
extern const bfd_target sparcnetbsd_vec;
|
||||
extern const bfd_target sparccoff_vec;
|
||||
extern const bfd_target sunos_big_vec;
|
||||
extern const bfd_target tekhex_vec;
|
||||
extern const bfd_target versados_vec;
|
||||
extern const bfd_target we32kcoff_vec;
|
||||
extern const bfd_target w65_vec;
|
||||
extern const bfd_target z8kcoff_vec;
|
||||
|
||||
/* srec is always included. */
|
||||
extern const bfd_target srec_vec;
|
||||
extern const bfd_target symbolsrec_vec;
|
||||
|
||||
/* binary is always included. */
|
||||
extern const bfd_target binary_vec;
|
||||
|
||||
/* ihex is always included. */
|
||||
extern const bfd_target ihex_vec;
|
||||
|
||||
/* All of the xvecs for core files. */
|
||||
extern const bfd_target aix386_core_vec;
|
||||
extern const bfd_target cisco_core_vec;
|
||||
extern const bfd_target hpux_core_vec;
|
||||
extern const bfd_target hppabsd_core_vec;
|
||||
extern const bfd_target irix_core_vec;
|
||||
extern const bfd_target osf_core_vec;
|
||||
extern const bfd_target sco_core_vec;
|
||||
extern const bfd_target trad_core_vec;
|
||||
extern const bfd_target ptrace_core_vec;
|
||||
|
||||
const bfd_target * const bfd_target_vector[] = {
|
||||
|
||||
#ifdef SELECT_VECS
|
||||
|
||||
SELECT_VECS,
|
||||
|
||||
#else /* not SELECT_VECS */
|
||||
|
||||
#ifdef DEFAULT_VECTOR
|
||||
&DEFAULT_VECTOR,
|
||||
#endif
|
||||
/* This list is alphabetized to make it easy to compare
|
||||
with other vector lists -- the decls above and
|
||||
the case statement in configure.in.
|
||||
Vectors that don't compile on all systems, or aren't finished,
|
||||
should have an entry here with #if 0 around it, to show that
|
||||
it wasn't omitted by mistake. */
|
||||
&a29kcoff_big_vec,
|
||||
&a_out_adobe_vec,
|
||||
#if 0 /* No one seems to use this. */
|
||||
&aout_mips_big_vec,
|
||||
#endif
|
||||
&aout_mips_little_vec,
|
||||
&b_out_vec_big_host,
|
||||
&b_out_vec_little_host,
|
||||
|
||||
/* This, and other vectors, may not be used in any *.mt configuration.
|
||||
But that does not mean they are unnecessary. If configured with
|
||||
--enable-targets=all, objdump or gdb should be able to examine
|
||||
the file even if we don't recognize the machine type. */
|
||||
&bfd_elf32_big_generic_vec,
|
||||
&bfd_elf32_bigmips_vec,
|
||||
&bfd_elf32_hppa_vec,
|
||||
&bfd_elf32_i386_vec,
|
||||
&bfd_elf32_i860_vec,
|
||||
&bfd_elf32_little_generic_vec,
|
||||
&bfd_elf32_littlemips_vec,
|
||||
&bfd_elf32_m68k_vec,
|
||||
&bfd_elf32_m88k_vec,
|
||||
&bfd_elf32_sparc_vec,
|
||||
&bfd_elf32_powerpc_vec,
|
||||
#ifdef BFD64 /* No one seems to use this. */
|
||||
&bfd_elf64_big_generic_vec,
|
||||
&bfd_elf64_little_generic_vec,
|
||||
#endif
|
||||
#if 0
|
||||
&bfd_elf64_sparc_vec,
|
||||
#endif
|
||||
/* We don't include cisco_core_vec. Although it has a magic number,
|
||||
the magic number isn't at the beginning of the file, and thus
|
||||
might spuriously match other kinds of files. */
|
||||
#ifdef BFD64
|
||||
&demo_64_vec, /* Only compiled if host has long-long support */
|
||||
#endif
|
||||
&ecoff_big_vec,
|
||||
&ecoff_little_vec,
|
||||
#if 0
|
||||
&ecoffalpha_little_vec,
|
||||
#endif
|
||||
&h8300coff_vec,
|
||||
&h8500coff_vec,
|
||||
#if 0
|
||||
/* Since a.out files lack decent magic numbers, no way to recognize
|
||||
which kind of a.out file it is. */
|
||||
&host_aout_vec,
|
||||
#endif
|
||||
#if 0 /* Clashes with sunos_big_vec magic no. */
|
||||
&hp300bsd_vec,
|
||||
#endif
|
||||
&hp300hpux_vec,
|
||||
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
|
||||
&som_vec,
|
||||
#endif
|
||||
&i386aout_vec,
|
||||
&i386bsd_vec,
|
||||
&i386coff_vec,
|
||||
&i386freebsd_vec,
|
||||
&i860coff_vec,
|
||||
&bfd_powerpc_pe_vec,
|
||||
&bfd_powerpcle_pe_vec,
|
||||
&bfd_powerpc_pei_vec,
|
||||
&bfd_powerpcle_pei_vec,
|
||||
&go32coff_vec,
|
||||
#if 0
|
||||
/* Since a.out files lack decent magic numbers, no way to recognize
|
||||
which kind of a.out file it is. */
|
||||
&i386linux_vec,
|
||||
#endif
|
||||
&i386lynx_aout_vec,
|
||||
&i386lynx_coff_vec,
|
||||
#if 0
|
||||
/* No distinguishing features for Mach 3 executables. */
|
||||
&i386mach3_vec,
|
||||
#endif
|
||||
&i386msdos_vec,
|
||||
&i386netbsd_vec,
|
||||
&i386os9k_vec,
|
||||
&i386pe_vec,
|
||||
&i386pei_vec,
|
||||
&armcoff_little_vec,
|
||||
&armcoff_big_vec,
|
||||
&armpe_little_vec,
|
||||
&armpe_big_vec,
|
||||
&armpei_little_vec,
|
||||
&armpei_big_vec,
|
||||
&icoff_big_vec,
|
||||
&icoff_little_vec,
|
||||
&ieee_vec,
|
||||
&m68kcoff_vec,
|
||||
&m68kcoffun_vec,
|
||||
#if 0
|
||||
/* Since a.out files lack decent magic numbers, no way to recognize
|
||||
which kind of a.out file it is. */
|
||||
&m68klinux_vec,
|
||||
#endif
|
||||
&m68klynx_aout_vec,
|
||||
&m68klynx_coff_vec,
|
||||
&m68knetbsd_vec,
|
||||
&m88kbcs_vec,
|
||||
&m88kmach3_vec,
|
||||
&newsos3_vec,
|
||||
&nlm32_i386_vec,
|
||||
&nlm32_sparc_vec,
|
||||
#ifdef BFD64
|
||||
&nlm32_alpha_vec,
|
||||
#endif
|
||||
&pc532netbsd_vec,
|
||||
#if 0
|
||||
/* We have no oasys tools anymore, so we can't test any of this
|
||||
anymore. If you want to test the stuff yourself, go ahead...
|
||||
steve@cygnus.com
|
||||
Worse, since there is no magic number for archives, there
|
||||
can be annoying target mis-matches. */
|
||||
&oasys_vec,
|
||||
#endif
|
||||
&pc532machaout_vec,
|
||||
#if 0
|
||||
/* We have no way of distinguishing these from other a.out variants */
|
||||
&aout_arm_big_vec,
|
||||
&aout_arm_little_vec,
|
||||
&riscix_vec,
|
||||
#endif
|
||||
#if 0
|
||||
/* This has the same magic number as RS/6000. */
|
||||
&pmac_xcoff_vec,
|
||||
#endif
|
||||
&rs6000coff_vec,
|
||||
&shcoff_vec,
|
||||
&shlcoff_vec,
|
||||
&sparclynx_aout_vec,
|
||||
&sparclynx_coff_vec,
|
||||
&sparcnetbsd_vec,
|
||||
&sunos_big_vec,
|
||||
&aout0_big_vec,
|
||||
&tekhex_vec,
|
||||
&we32kcoff_vec,
|
||||
&versados_vec,
|
||||
&z8kcoff_vec,
|
||||
|
||||
#endif /* not SELECT_VECS */
|
||||
|
||||
/* Always support S-records, for convenience. */
|
||||
&srec_vec,
|
||||
&symbolsrec_vec,
|
||||
/* And tekhex */
|
||||
&tekhex_vec,
|
||||
/* Likewise for binary output. */
|
||||
&binary_vec,
|
||||
/* Likewise for ihex. */
|
||||
&ihex_vec,
|
||||
|
||||
/* Add any required traditional-core-file-handler. */
|
||||
|
||||
#ifdef AIX386_CORE
|
||||
&aix386_core_vec,
|
||||
#endif
|
||||
#ifdef HPUX_CORE
|
||||
&hpux_core_vec,
|
||||
#endif
|
||||
#ifdef HPPABSD_CORE
|
||||
&hppabsd_core_vec,
|
||||
#endif
|
||||
#ifdef IRIX_CORE
|
||||
&irix_core_vec,
|
||||
#endif
|
||||
#ifdef OSF_CORE
|
||||
&osf_core_vec,
|
||||
#endif
|
||||
#ifdef TRAD_CORE
|
||||
&trad_core_vec,
|
||||
#endif
|
||||
|
||||
#ifdef PTRACE_CORE
|
||||
&ptrace_core_vec,
|
||||
#endif
|
||||
|
||||
NULL /* end of list marker */
|
||||
};
|
||||
|
||||
/* bfd_default_vector[0] contains either the address of the default vector,
|
||||
if there is one, or zero if there isn't. */
|
||||
|
||||
const bfd_target * const bfd_default_vector[] = {
|
||||
#ifdef DEFAULT_VECTOR
|
||||
&DEFAULT_VECTOR,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
/* When there is an ambiguous match, bfd_check_format_matches puts the
|
||||
names of the matching targets in an array. This variable is the maximum
|
||||
number of entries that the array could possibly need. */
|
||||
const size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector);
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_find_target
|
||||
|
||||
SYNOPSIS
|
||||
const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Return a pointer to the transfer vector for the object target
|
||||
named @var{target_name}. If @var{target_name} is <<NULL>>, choose the
|
||||
one in the environment variable <<GNUTARGET>>; if that is null or not
|
||||
defined, then choose the first entry in the target list.
|
||||
Passing in the string "default" or setting the environment
|
||||
variable to "default" will cause the first entry in the target
|
||||
list to be returned, and "target_defaulted" will be set in the
|
||||
BFD. This causes <<bfd_check_format>> to loop over all the
|
||||
targets to find the one that matches the file being read.
|
||||
*/
|
||||
|
||||
const bfd_target *
|
||||
bfd_find_target (target_name, abfd)
|
||||
CONST char *target_name;
|
||||
bfd *abfd;
|
||||
{
|
||||
const bfd_target * const *target;
|
||||
extern char *getenv ();
|
||||
CONST char *targname = (target_name ? target_name :
|
||||
(CONST char *) getenv ("GNUTARGET"));
|
||||
|
||||
/* This is safe; the vector cannot be null */
|
||||
if (targname == NULL || !strcmp (targname, "default")) {
|
||||
abfd->target_defaulted = true;
|
||||
return abfd->xvec = bfd_target_vector[0];
|
||||
}
|
||||
|
||||
abfd->target_defaulted = false;
|
||||
|
||||
for (target = &bfd_target_vector[0]; *target != NULL; target++) {
|
||||
if (!strcmp (targname, (*target)->name))
|
||||
return abfd->xvec = *target;
|
||||
}
|
||||
|
||||
bfd_set_error (bfd_error_invalid_target);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_target_list
|
||||
|
||||
SYNOPSIS
|
||||
const char **bfd_target_list(void);
|
||||
|
||||
DESCRIPTION
|
||||
Return a freshly malloced NULL-terminated
|
||||
vector of the names of all the valid BFD targets. Do not
|
||||
modify the names.
|
||||
|
||||
*/
|
||||
|
||||
const char **
|
||||
bfd_target_list ()
|
||||
{
|
||||
int vec_length= 0;
|
||||
#if defined (HOST_HPPAHPUX) && ! defined (__STDC__)
|
||||
/* The native compiler on the HP9000/700 has a bug which causes it
|
||||
to loop endlessly when compiling this file. This avoids it. */
|
||||
volatile
|
||||
#endif
|
||||
const bfd_target * const *target;
|
||||
CONST char **name_list, **name_ptr;
|
||||
|
||||
for (target = &bfd_target_vector[0]; *target != NULL; target++)
|
||||
vec_length++;
|
||||
|
||||
name_ptr = name_list = (CONST char **)
|
||||
bfd_zmalloc ((vec_length + 1) * sizeof (char **));
|
||||
|
||||
if (name_list == NULL)
|
||||
return NULL;
|
||||
|
||||
for (target = &bfd_target_vector[0]; *target != NULL; target++)
|
||||
*(name_ptr++) = (*target)->name;
|
||||
|
||||
return name_list;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,315 +0,0 @@
|
||||
/* BFD back end for traditional Unix core files (U-area and raw sections)
|
||||
Copyright 1988, 1989, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
Written by John Gilmore of Cygnus Support.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/user.h> /* After a.out.h */
|
||||
|
||||
#ifdef TRAD_HEADER
|
||||
#include TRAD_HEADER
|
||||
#endif
|
||||
|
||||
struct trad_core_struct
|
||||
{
|
||||
asection *data_section;
|
||||
asection *stack_section;
|
||||
asection *reg_section;
|
||||
struct user u;
|
||||
};
|
||||
|
||||
#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
|
||||
#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
|
||||
#define core_stacksec(bfd) ((bfd)->tdata.trad_core_data->stack_section)
|
||||
#define core_regsec(bfd) ((bfd)->tdata.trad_core_data->reg_section)
|
||||
|
||||
/* forward declarations */
|
||||
|
||||
const bfd_target *trad_unix_core_file_p PARAMS ((bfd *abfd));
|
||||
char * trad_unix_core_file_failing_command PARAMS ((bfd *abfd));
|
||||
int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||
boolean trad_unix_core_file_matches_executable_p
|
||||
PARAMS ((bfd *core_bfd, bfd *exec_bfd));
|
||||
|
||||
/* Handle 4.2-style (and perhaps also sysV-style) core dump file. */
|
||||
|
||||
/* ARGSUSED */
|
||||
const bfd_target *
|
||||
trad_unix_core_file_p (abfd)
|
||||
bfd *abfd;
|
||||
|
||||
{
|
||||
int val;
|
||||
struct user u;
|
||||
struct trad_core_struct *rawptr;
|
||||
|
||||
#ifdef TRAD_CORE_USER_OFFSET
|
||||
/* If defined, this macro is the file position of the user struct. */
|
||||
if (bfd_seek (abfd, TRAD_CORE_USER_OFFSET, SEEK_SET) != 0)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
val = bfd_read ((void *)&u, 1, sizeof u, abfd);
|
||||
if (val != sizeof u)
|
||||
{
|
||||
/* Too small to be a core file */
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Sanity check perhaps??? */
|
||||
if (u.u_dsize > 0x1000000) /* Remember, it's in pages... */
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
if (u.u_ssize > 0x1000000)
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check that the size claimed is no greater than the file size. */
|
||||
{
|
||||
FILE *stream = bfd_cache_lookup (abfd);
|
||||
struct stat statbuf;
|
||||
if (stream == NULL)
|
||||
return 0;
|
||||
if (fstat (fileno (stream), &statbuf) < 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
return 0;
|
||||
}
|
||||
if (NBPG * (UPAGES + u.u_dsize
|
||||
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
|
||||
- u.u_tsize
|
||||
#endif
|
||||
+ u.u_ssize) > statbuf.st_size)
|
||||
{
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
return 0;
|
||||
}
|
||||
#ifndef TRAD_CORE_ALLOW_ANY_EXTRA_SIZE
|
||||
if (NBPG * (UPAGES + u.u_dsize + u.u_ssize)
|
||||
#ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED
|
||||
/* Some systems write the file too big. */
|
||||
+ TRAD_CORE_EXTRA_SIZE_ALLOWED
|
||||
#endif
|
||||
< statbuf.st_size)
|
||||
{
|
||||
/* The file is too big. Maybe it's not a core file
|
||||
or we otherwise have bad values for u_dsize and u_ssize). */
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* OK, we believe you. You're a core file (sure, sure). */
|
||||
|
||||
/* Allocate both the upage and the struct core_data at once, so
|
||||
a single free() will free them both. */
|
||||
rawptr = (struct trad_core_struct *)
|
||||
bfd_zmalloc (sizeof (struct trad_core_struct));
|
||||
if (rawptr == NULL)
|
||||
return 0;
|
||||
|
||||
abfd->tdata.trad_core_data = rawptr;
|
||||
|
||||
rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */
|
||||
|
||||
/* Create the sections. This is raunchy, but bfd_close wants to free
|
||||
them separately. */
|
||||
|
||||
core_stacksec(abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_stacksec (abfd) == NULL)
|
||||
return NULL;
|
||||
core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_datasec (abfd) == NULL)
|
||||
return NULL;
|
||||
core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_regsec (abfd) == NULL)
|
||||
return NULL;
|
||||
|
||||
core_stacksec (abfd)->name = ".stack";
|
||||
core_datasec (abfd)->name = ".data";
|
||||
core_regsec (abfd)->name = ".reg";
|
||||
|
||||
core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
|
||||
core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
|
||||
core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
|
||||
|
||||
core_datasec (abfd)->_raw_size = NBPG * u.u_dsize
|
||||
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
|
||||
- NBPG * u.u_tsize
|
||||
#endif
|
||||
;
|
||||
core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize;
|
||||
core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */
|
||||
|
||||
/* What a hack... we'd like to steal it from the exec file,
|
||||
since the upage does not seem to provide it. FIXME. */
|
||||
#ifdef HOST_DATA_START_ADDR
|
||||
core_datasec (abfd)->vma = HOST_DATA_START_ADDR;
|
||||
#else
|
||||
core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (NBPG * u.u_tsize);
|
||||
#endif
|
||||
|
||||
#ifdef HOST_STACK_START_ADDR
|
||||
core_stacksec (abfd)->vma = HOST_STACK_START_ADDR;
|
||||
#else
|
||||
core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (NBPG * u.u_ssize);
|
||||
#endif
|
||||
|
||||
/* This is tricky. As the "register section", we give them the entire
|
||||
upage and stack. u.u_ar0 points to where "register 0" is stored.
|
||||
There are two tricks with this, though. One is that the rest of the
|
||||
registers might be at positive or negative (or both) displacements
|
||||
from *u_ar0. The other is that u_ar0 is sometimes an absolute address
|
||||
in kernel memory, and on other systems it is an offset from the beginning
|
||||
of the `struct user'.
|
||||
|
||||
As a practical matter, we don't know where the registers actually are,
|
||||
so we have to pass the whole area to GDB. We encode the value of u_ar0
|
||||
by setting the .regs section up so that its virtual memory address
|
||||
0 is at the place pointed to by u_ar0 (by setting the vma of the start
|
||||
of the section to -u_ar0). GDB uses this info to locate the regs,
|
||||
using minor trickery to get around the offset-or-absolute-addr problem. */
|
||||
core_regsec (abfd)->vma = 0 - (bfd_vma) u.u_ar0;
|
||||
|
||||
core_datasec (abfd)->filepos = NBPG * UPAGES;
|
||||
core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize
|
||||
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
|
||||
- NBPG * u.u_tsize
|
||||
#endif
|
||||
;
|
||||
core_regsec (abfd)->filepos = 0; /* Register segment is the upage */
|
||||
|
||||
/* Align to word at least */
|
||||
core_stacksec (abfd)->alignment_power = 2;
|
||||
core_datasec (abfd)->alignment_power = 2;
|
||||
core_regsec (abfd)->alignment_power = 2;
|
||||
|
||||
abfd->sections = core_stacksec (abfd);
|
||||
core_stacksec (abfd)->next = core_datasec (abfd);
|
||||
core_datasec (abfd)->next = core_regsec (abfd);
|
||||
abfd->section_count = 3;
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
char *
|
||||
trad_unix_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
#ifndef NO_CORE_COMMAND
|
||||
char *com = abfd->tdata.trad_core_data->u.u_comm;
|
||||
if (*com)
|
||||
return com;
|
||||
else
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
trad_unix_core_file_failing_signal (ignore_abfd)
|
||||
bfd *ignore_abfd;
|
||||
{
|
||||
#ifdef TRAD_UNIX_CORE_FILE_FAILING_SIGNAL
|
||||
return TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(ignore_abfd);
|
||||
#else
|
||||
return -1; /* FIXME, where is it? */
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
boolean
|
||||
trad_unix_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd, *exec_bfd;
|
||||
{
|
||||
return true; /* FIXME, We have no way of telling at this point */
|
||||
}
|
||||
|
||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||
void
|
||||
swap_abort()
|
||||
{
|
||||
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
|
||||
}
|
||||
#define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
|
||||
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
|
||||
#define NO_SIGNED_GET \
|
||||
((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
|
||||
|
||||
const bfd_target trad_core_vec =
|
||||
{
|
||||
"trad-core",
|
||||
bfd_target_unknown_flavour,
|
||||
BFD_ENDIAN_UNKNOWN, /* target byte order */
|
||||
BFD_ENDIAN_UNKNOWN, /* target headers byte order */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* symbol prefix */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
|
||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
|
||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
|
||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */
|
||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */
|
||||
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */
|
||||
|
||||
{ /* bfd_check_format */
|
||||
_bfd_dummy_target, /* unknown format */
|
||||
_bfd_dummy_target, /* object file */
|
||||
_bfd_dummy_target, /* archive */
|
||||
trad_unix_core_file_p /* a core file */
|
||||
},
|
||||
{ /* bfd_set_format */
|
||||
bfd_false, bfd_false,
|
||||
bfd_false, bfd_false
|
||||
},
|
||||
{ /* bfd_write_contents */
|
||||
bfd_false, bfd_false,
|
||||
bfd_false, bfd_false
|
||||
},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
|
||||
BFD_JUMP_TABLE_COPY (_bfd_generic),
|
||||
BFD_JUMP_TABLE_CORE (trad_unix),
|
||||
BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
|
||||
BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
|
||||
BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
|
||||
BFD_JUMP_TABLE_WRITE (_bfd_generic),
|
||||
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
(PTR) 0 /* backend_data */
|
||||
};
|
@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
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 2 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, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
@ -1,973 +0,0 @@
|
||||
Tue Mar 12 17:29:46 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* bfdlink.h (bfd_wrapped_link_hash_lookup): Declare.
|
||||
(struct bfd_link_info): Add wrap_hash field.
|
||||
|
||||
Wed Feb 14 16:49:17 1996 Martin Anantharaman <martin@mail.imech.uni-duisburg.de>
|
||||
|
||||
* ieee.h (ieee_record_enum_type): Define
|
||||
ieee_external_reference_info_enum.
|
||||
|
||||
Fri Feb 2 17:09:25 1996 Doug Evans <dje@charmed.cygnus.com>
|
||||
|
||||
* dis-asm.h (DISASM_RAW_INSN): Delete.
|
||||
|
||||
Tue Jan 23 09:21:47 1996 Doug Evans <dje@charmed.cygnus.com>
|
||||
|
||||
* dis-asm.h (INIT_DISASSEMBLE_INFO): Set endian to BFD_ENDIAN_UNKNOWN.
|
||||
New argument FPRINTF_FUNC.
|
||||
|
||||
Mon Jan 22 16:37:59 1996 Doug Evans <dje@charmed.cygnus.com>
|
||||
|
||||
* dis-asm.h (disassemble_info): New members arch, mach, endian.
|
||||
(INIT_DISASSEMBLE_INFO): Initialize them.
|
||||
(DISASM_RAW_INSN{,FLAG}): Define.
|
||||
|
||||
Thu Jan 18 11:32:38 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* demangle.h (cplus_demangle_opname): Change opname parameter to
|
||||
const char *.
|
||||
(cplus_mangle_opname): Change return type and opname parameter to
|
||||
const char *.
|
||||
|
||||
Fri Jan 5 00:01:22 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* ieee.h (enum ieee_record): Add ieee_asn_record_enum,
|
||||
ieee_at_record_enum, ieee_ty_record_enum, ieee_atn_record_enum,
|
||||
ieee_bb_record_enum, and ieee_be_record_enum.
|
||||
|
||||
Wed Jan 3 13:12:09 1996 Fred Fish <fnf@cygnus.com>
|
||||
|
||||
* obstack.h: Update copyright to 1996.
|
||||
(_obstack_memory_used): Declare.
|
||||
(obstack_memory_used): Define macro.
|
||||
|
||||
Thu Dec 28 11:42:12 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* libiberty.h (xstrdup): Declare.
|
||||
|
||||
Thu Dec 21 14:47:17 1995 Michael Meissner <meissner@tiktok.cygnus.com>
|
||||
|
||||
* wait.h: Protect all macros with #ifndef.
|
||||
|
||||
Tue Oct 24 21:45:40 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_info): Add static_link field.
|
||||
|
||||
Tue Sep 12 16:28:04 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_callbacks): Add symbol parameter to
|
||||
warning callback.
|
||||
|
||||
Fri Sep 1 13:11:51 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_callbacks): Change warning callback
|
||||
to take BFD, section, and address arguments.
|
||||
|
||||
Thu Aug 31 16:45:12 1995 steve chamberlain <sac@slash.cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_info): Remove PE stuff.
|
||||
|
||||
Tue Aug 22 03:18:23 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com>
|
||||
|
||||
* libiberty.h: Declare xstrerror. From Pat Rankin.
|
||||
|
||||
Mon Aug 21 18:11:36 1995 steve chamberlain <sac@slash.cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_info): Remove PE stuff.
|
||||
|
||||
Wed Aug 2 08:14:12 1995 Doug Evans <dje@canuck.cygnus.com>
|
||||
|
||||
* dis-asm.h (print_insn_sparc64): Declare.
|
||||
|
||||
Mon Jul 10 13:26:49 1995 Eric Youngdale <eric@aib.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_info): Add new field symbolic.
|
||||
|
||||
Sun Jul 2 17:48:40 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_info): Change type of base_file to
|
||||
PTR.
|
||||
|
||||
Thu Jun 29 00:02:45 1995 Steve Chamberlain <sac@slash.cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_info): Added base_file member.
|
||||
|
||||
Tue Jun 20 16:40:04 1995 Steve Chamberlain <sac@slash.cygnus.com>
|
||||
|
||||
* ansidecl.h: win32s is ANSI enough.
|
||||
|
||||
Thu May 18 04:25:50 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com>
|
||||
|
||||
Wed May 10 14:28:16 1995 Richard Earnshaw (rearnsha@armltd.co.uk)
|
||||
|
||||
* dis-asm.h (print_insn_arm): Delete declaration.
|
||||
(print_insn_{little,big}_arm): New declarations.
|
||||
|
||||
* floatformat.h (floatformat_arm_ext): Declare.
|
||||
|
||||
Sat May 13 10:14:08 1995 Steve Chamberlain <sac@slash.cygnus.com>
|
||||
|
||||
* coff/pe.h: New file.
|
||||
* bfdlink.h (subsytem, stack_heap_parameters): New.
|
||||
* coff/i386.h (NT_SECTION_ALIGNMENT, NT_FILE_ALIGNMENT,
|
||||
NT_DEF_RESERVE, NT_DEF_COMMIT): New.
|
||||
* coff/internal.h (internal_filehdr): New fields for PE.
|
||||
(IMAGE_DATA_DIRECTORY): New.
|
||||
(internal_aouthdr): New fields for PE.
|
||||
|
||||
Thu May 4 14:36:42 1995 Jason Merrill <jason@phydeaux.cygnus.com>
|
||||
|
||||
* demangle.h: Don't include ansidecl.h if IN_GCC.
|
||||
|
||||
|
||||
Tue Feb 21 00:37:28 1995 Jeff Law (law@snake.cs.utah.edu)
|
||||
|
||||
* hp-symtab.h: Don't use bitfield enumerations, the HP C compiler
|
||||
does not handle them correctly.
|
||||
|
||||
|
||||
Thu Feb 9 14:20:27 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* libiberty.h (basename): Don't declare parameter type; some
|
||||
systems have this in their header files.
|
||||
|
||||
Wed Feb 8 17:35:38 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_hash_entry): Change format of common
|
||||
symbol information, to remove restrictions on maximum size and
|
||||
alignment power, by using a pointer to a structure instead.
|
||||
|
||||
Mon Feb 6 14:55:32 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* bfdlink.h (enum bfd_link_hash_type): Rename bfd_link_hash_weak
|
||||
to bfd_link_hash_undefweak. Add bfd_link_hash_defweak.
|
||||
|
||||
Mon Jan 16 21:00:23 1995 Stan Shebs <shebs@andros.cygnus.com>
|
||||
|
||||
* dis-asm.h (GDB_INIT_DISASSEMBLE_INFO, etc): Remove all
|
||||
GDB-specific definitions.
|
||||
|
||||
Sun Jan 15 18:39:35 1995 Steve Chamberlain <sac@splat>
|
||||
|
||||
* dis-asm.h (print_insn_w65): Declare.
|
||||
|
||||
Thu Jan 12 17:51:17 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
|
||||
|
||||
* libiberty.h (hex_p): Fix sense of test.
|
||||
|
||||
Wed Jan 11 22:36:40 1995 Ken Raeburn <raeburn@cujo.cygnus.com>
|
||||
|
||||
* libiberty.h (_hex_array_size, _hex_bad, _hex_value, hex_init,
|
||||
hex_p, hex_value): New macros and declarations, for hex.c.
|
||||
|
||||
Fri Jan 6 17:44:14 1995 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||
|
||||
* dis-asm.h: Make idempotent.
|
||||
|
||||
Wed Dec 14 13:08:43 1994 Stan Shebs <shebs@andros.cygnus.com>
|
||||
|
||||
* progress.h: New file, empty definitions for progress macros.
|
||||
|
||||
|
||||
Fri Nov 25 00:14:05 1994 Jeff Law (law@snake.cs.utah.edu)
|
||||
|
||||
* hp-symtab.h: New file describing the debug symbols emitted
|
||||
by the HP C compilers.
|
||||
|
||||
Fri Nov 11 15:48:37 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_hash_entry): Change u.c.size from 24
|
||||
to 26 bits, and change u.c.alignment_power from 8 to 6 bits. 6
|
||||
bit in the alignment power is enough for a 64 bit address space.
|
||||
|
||||
Mon Oct 31 13:02:51 1994 Stan Shebs (shebs@andros.cygnus.com)
|
||||
|
||||
* demangle.h (cplus_mangle_opname): Declare.
|
||||
|
||||
Tue Oct 25 11:38:02 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
|
||||
|
||||
* bfdlink.h (struct bfd_link_callbacks): Fix comments for
|
||||
multiple_common field.
|
||||
|
||||
Sun Sep 04 17:58:10 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org)
|
||||
|
||||
* aout/aout64.h: Only define QMAGIC if it isn't already defined.
|
||||
|
||||
* dis-asm.h: Add support for the ARM.
|
||||
|
||||
Wed Aug 10 12:51:41 1994 Doug Evans (dje@canuck.cygnus.com)
|
||||
|
||||
* libiberty.h (strsignal): Document its existence even if we
|
||||
can't declare it.
|
||||
|
||||
Tue Aug 2 14:40:03 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* os9k.h: Remove u_int16, u_int32, and owner_id typedefs and
|
||||
expand their uses. Those names conflict with Mach headers.
|
||||
|
||||
Fri Jul 22 14:17:12 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||
|
||||
* bfdlink.h (struct bfd_link_hash_entry): Change u.c.size into a
|
||||
bitfield. Add field u.c.alignment_power.
|
||||
|
||||
Sun Jul 10 00:26:39 1994 Ian Dall (dall@hfrd.dsto.gov.au)
|
||||
|
||||
* dis-asm.h: Add print_insn_ns32k declaration.
|
||||
|
||||
Mon Jun 20 17:13:29 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
|
||||
|
||||
* bfdlink.h (bfd_link_hash_table): Make creator a const pointer.
|
||||
|
||||
Sat Jun 18 16:09:32 1994 Stan Shebs (shebs@andros.cygnus.com)
|
||||
|
||||
* demangle.h (cplus_demangle_opname): Declare.
|
||||
|
||||
Thu Jun 16 15:19:03 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfdlink.h (struct bfd_link_info): Add new field shared.
|
||||
|
||||
Mon Jun 6 14:39:44 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfdlink.h (struct bfd_link_hash_entry): Remove written field:
|
||||
not needed for all backends.
|
||||
|
||||
Thu Apr 28 19:06:50 1994 Ken Raeburn (raeburn@cujo.cygnus.com)
|
||||
|
||||
* dis-asm.h (disassembler): Declare.
|
||||
|
||||
Fri Apr 1 00:38:17 1994 Jim Wilson (wilson@mole.gnu.ai.mit.edu)
|
||||
|
||||
* obstack.h: Delete use of IN_GCC to control whether
|
||||
stddef.h or gstddef.h is included.
|
||||
|
||||
Tue Mar 22 13:06:02 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfdlink.h (enum bfd_link_order_type): Add bfd_data_link_order.
|
||||
(struct bfd_link_order): Add data field to union.
|
||||
|
||||
Mon Mar 21 18:45:26 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfdlink.h (struct bfd_link_callbacks): Change bitsize argument
|
||||
to add_to_set to reloc. Remove bitsize argument from constructor.
|
||||
Comment that reloc_overflow, reloc_dangerous and unattached_reloc
|
||||
must handle NULL pointers for reloc location.
|
||||
(enum bfd_link_order_type): Add bfd_section_reloc_link_order and
|
||||
bfd_symbol_reloc_link_order.
|
||||
(struct bfd_link_order): Add reloc field to union.
|
||||
(struct bfd_link_order_reloc): Define.
|
||||
|
||||
Mon Mar 14 12:27:50 1994 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* ieee-float.h: Removed; no longer used.
|
||||
|
||||
Tue Mar 1 18:10:49 1994 Kung Hsu (kung@mexican.cygnus.com)
|
||||
|
||||
* os9k.h: os9000 target specific header file, the header of the
|
||||
object file is used now.
|
||||
|
||||
Sun Feb 27 21:52:26 1994 Jim Kingdon (kingdon@deneb.cygnus.com)
|
||||
|
||||
* floatformat.h: New file, intended to replace ieee-float.h.
|
||||
|
||||
Sun Feb 20 17:15:42 1994 Ian Lance Taylor (ian@lisa.cygnus.com)
|
||||
|
||||
* ansidecl.h (ANSI_PROTOTYPES): Define if using ANSI prototypes.
|
||||
|
||||
Wed Feb 16 01:07:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* libiberty.h: Don't declare strsignal, to avoid conflicts with
|
||||
Solaris system header files.
|
||||
|
||||
Sat Feb 12 22:11:32 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
|
||||
|
||||
* libiberty.h (xexit): Use __volatile__ to avoid losing if
|
||||
compiling with gcc -traditional.
|
||||
|
||||
Thu Feb 10 14:05:41 1994 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* libiberty.h: New file. Declares functions provided by
|
||||
libiberty.
|
||||
|
||||
Tue Feb 8 05:19:52 1994 David J. Mackenzie (djm@thepub.cygnus.com)
|
||||
|
||||
Handle obstack_chunk_alloc returning NULL. This allows
|
||||
obstacks to be used by libraries, without forcing them
|
||||
to call exit or longjmp.
|
||||
* obstack.h (struct obstack): Add alloc_failed flag.
|
||||
_obstack_begin, _obstack_begin_1): Declare to return int, not void.
|
||||
(obstack_finish): If alloc_failed, return NULL.
|
||||
(obstack_base, obstack_next_free, objstack_object_size):
|
||||
If alloc_failed, return 0.
|
||||
(obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow,
|
||||
obstack_int_grow, obstack_blank): If alloc_failed, do nothing that
|
||||
could corrupt the obstack.
|
||||
|
||||
Mon Jan 24 15:06:05 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfdlink.h (struct bfd_link_callbacks): Add name, reloc_name and
|
||||
addend argments to reloc_overflow callback.
|
||||
|
||||
Fri Jan 21 19:13:12 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* dis-asm.h (print_insn_big_powerpc, print_insn_little_powerpc,
|
||||
print_insn_rs6000): Declare.
|
||||
|
||||
Thu Jan 6 14:15:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfdlink.h (struct bfd_link_callbacks): Add bitsize argument to
|
||||
add_to_set field. Add new callback named constructor.
|
||||
|
||||
Thu Dec 30 10:44:06 1993 Ian Lance Taylor (ian@rtl.cygnus.com)
|
||||
|
||||
* bfdlink.h: New file for new BFD linker backend routines.
|
||||
|
||||
Mon Nov 29 10:43:57 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* dis-asm.h (enum dis_insn_tyupe): Remove non-ANSI trailing comma.
|
||||
|
||||
Sat Oct 2 20:42:26 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* dis-asm.h: Move comment to right place.
|
||||
|
||||
Mon Aug 9 19:03:35 1993 David J. Mackenzie (djm@thepub.cygnus.com)
|
||||
|
||||
* obstack.h (obstack_chunkfun, obstack_freefun): Add defns from
|
||||
previous version. Are these Cygnus local changes?
|
||||
|
||||
Fri Aug 6 17:05:47 1993 David J. Mackenzie (djm@thepub.cygnus.com)
|
||||
|
||||
* getopt.h, obstack.h: Update to latest FSF version.
|
||||
|
||||
Mon Aug 2 16:37:14 1993 Stu Grossman (grossman at cygnus.com)
|
||||
|
||||
* coff/i386.h: Add Lynx magic number.
|
||||
|
||||
Mon Aug 2 14:45:29 1993 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* dis-asm.h: Move enum outside of struct defn to avoid warnings.
|
||||
|
||||
Mon Aug 2 08:49:30 1993 Stu Grossman (grossman at cygnus.com)
|
||||
|
||||
* wait.h (WEXITSTATUS, WSTOPSIG): Mask down to 8 bits. This is
|
||||
for systems that store stuff into the high 16 bits of a wait
|
||||
status.
|
||||
|
||||
Fri Jul 30 18:38:02 1993 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* dis-asm.h: Add new fields insn_info_valid, branch_delay_insns,
|
||||
data_size, insn_type, target, target2. These are used to return
|
||||
information from the instruction decoders back to the calling
|
||||
program. Add comments, make more readable.
|
||||
|
||||
Mon Jul 19 22:14:14 1993 Fred Fish (fnf@deneb.cygnus.com)
|
||||
|
||||
* nlm: New directory containing NLM/NetWare includes.
|
||||
|
||||
Thu Jul 15 12:10:04 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
|
||||
|
||||
* dis-asm.h (struct disassemble_info): New field application_data.
|
||||
|
||||
Thu Jul 15 12:41:15 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* dis-asm.h: Added declaration of print_insn_m88k.
|
||||
|
||||
Thu Jul 8 09:05:26 1993 Doug Evans (dje@canuck.cygnus.com)
|
||||
|
||||
* opcode/h8300.h: Lots of little fixes for the h8/300h.
|
||||
|
||||
Fri Jul 2 10:31:59 1993 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* ansidecl.h: Use ANSI macros if __mips and _SYSTYPE_SVR4 are
|
||||
defined, since RISC/OS cc handles ANSI declarations in SVR4 mode
|
||||
but does not define __STDC__.
|
||||
|
||||
Sun Jun 20 18:27:52 1993 Ken Raeburn (raeburn@poseidon.cygnus.com)
|
||||
|
||||
* dis-asm.h: Don't need to include ansidecl.h any more.
|
||||
|
||||
Fri Jun 18 03:22:10 1993 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* oasys.h: Eliminate "int8_type", "int16_type", "int32_type", and
|
||||
their variants. These changes are coordinated with corresponding
|
||||
changes in ../bfd/oasys.c.
|
||||
|
||||
Wed Jun 16 10:43:08 1993 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* bfd.h: Note that it has been removed.
|
||||
|
||||
Tue Jun 8 12:16:03 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
|
||||
|
||||
Support for H8/300-H
|
||||
* dis-asm.h (print_insn_h8300, print_insn_h8300h): Declare it.
|
||||
* coff/h8300.h: New magic number.
|
||||
* coff/internal.h: New relocations.
|
||||
* opcode/h8300.h: Lots of new opcodes.
|
||||
|
||||
Tue Jun 1 07:35:03 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
|
||||
|
||||
* ansidecl.h (const): Don't define it if it's already defined.
|
||||
|
||||
Thu May 27 18:19:51 1993 Ken Raeburn (raeburn@cambridge.cygnus.com)
|
||||
|
||||
* dis-asm.h (print_insn_hppa): Declare it.
|
||||
|
||||
* bfd.h: Moved to bfd directory. Small stub here includes it
|
||||
without requiring "-I../bfd".
|
||||
|
||||
Thu Apr 29 12:06:13 1993 Ken Raeburn (raeburn@deneb.cygnus.com)
|
||||
|
||||
* bfd.h: Updated with BSF_FUNCTION.
|
||||
|
||||
Mon Apr 26 18:15:50 1993 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* bfd.h, dis-asm.h: Updated with Hitachi SH.
|
||||
|
||||
Fri Apr 23 18:41:38 1993 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* bfd.h: Updated with alpha changes.
|
||||
* dis-asm.h: Added alpha.
|
||||
|
||||
Fri Apr 16 17:35:30 1993 Jim Kingdon (kingdon@cygnus.com)
|
||||
|
||||
* bfd.h: Update for signed bfd_*get_*.
|
||||
|
||||
Thu Apr 15 09:24:21 1993 Jim Kingdon (kingdon@cygnus.com)
|
||||
|
||||
* bfd.h: Updated for file_truncated error.
|
||||
|
||||
Thu Apr 8 10:53:47 1993 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* ansidecl.h: If no ANSI, define const to be empty.
|
||||
|
||||
Thu Apr 1 09:00:10 1993 Jim Kingdon (kingdon@cygnus.com)
|
||||
|
||||
* dis-asm.h: Declare a29k and i960 print_insn_*.
|
||||
|
||||
* dis-asm.h: Add print_address_func and related stuff.
|
||||
|
||||
* dis-asm.h (dis_asm_read_memory): Fix prototype.
|
||||
|
||||
Wed Mar 31 17:40:16 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* dis-asm.h: Add print_insn_sparc.
|
||||
|
||||
Wed Mar 31 17:51:42 1993 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* bfd.h: Updated for BFD_RELOC_MIPS_GPREL and bfd_[gs]et_gp_size
|
||||
prototypes.
|
||||
|
||||
Wed Mar 31 16:35:12 1993 Stu Grossman (grossman@cygnus.com)
|
||||
|
||||
* dis-asm.h: (disassemble_info): Fix typo in prototype of
|
||||
dis_asm_memory_error().
|
||||
|
||||
Tue Mar 30 19:09:23 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* dis-asm.h (disassembler_info): Add read_memory_func,
|
||||
memory_error_func, buffer, and length.
|
||||
({GDB_,}INIT_DISASSEMBLE_INFO): Set them.
|
||||
print_insn_*: Remove second argument.
|
||||
|
||||
Tue Mar 30 14:48:55 1993 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* bfd.h: Update for lma field of section.
|
||||
|
||||
Tue Mar 30 12:22:55 1993 Jim Kingdon (kingdon@cygnus.com)
|
||||
|
||||
* ansidecl.h: Use ANSI versions on AIX regardless of __STDC__.
|
||||
|
||||
Fri Mar 19 14:49:49 1993 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* dis-asm.h: Add h8500.
|
||||
|
||||
Thu Mar 18 13:49:09 1993 Per Bothner (bothner@rtl.cygnus.com)
|
||||
|
||||
* ieee-float.h: Moved from ../gdb.
|
||||
* dis-asm.h: New file. Interface to dis-assembler.
|
||||
|
||||
Thu Mar 11 10:52:57 1993 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* demangle.h (DMGL_NO_OPTS): Add define (set to 0) to use
|
||||
in place of bare 0, for readability reasons.
|
||||
|
||||
Tue Mar 2 17:50:11 1993 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* demangle.h: Replace all references to cfront with ARM.
|
||||
|
||||
Tue Feb 23 12:21:14 1993 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* bfd.h: Update for new elements in JUMP_TABLE.
|
||||
|
||||
Tue Feb 16 00:51:30 1993 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* bfd.h: Update for BFD_VERSION 2.1.
|
||||
|
||||
Tue Jan 26 11:49:20 1993 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* bfd.h: Update for SEC_IS_COMMON flag.
|
||||
|
||||
Tue Jan 19 12:25:12 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfd.h: Update for bfd_asymbol_value bug fix.
|
||||
|
||||
Fri Jan 8 16:37:18 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* bfd.h: Update to include ECOFF tdata and target_flavour.
|
||||
|
||||
Sun Dec 27 17:52:30 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* bfd.h: Add declaration for bfd_get_size().
|
||||
|
||||
Tue Dec 22 22:42:46 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* demangle.h: Protect file from multiple inclusions with
|
||||
#if !defined(DEMANGLE_H)...#define DEMANGLE_H...#endif.
|
||||
|
||||
Mon Dec 21 21:25:50 1992 Stu Grossman (grossman at cygnus.com)
|
||||
|
||||
* bfd.h: Update to get hppa_core_struct from bfd.c.
|
||||
|
||||
Thu Dec 17 00:42:35 1992 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* bfd.h: Update to get tekhex tdata name change from bfd.
|
||||
|
||||
Mon Nov 9 23:55:42 1992 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* ansidecl.h: Update comments to discourage use of EXFUN.
|
||||
|
||||
Thu Nov 5 16:35:44 1992 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* bfd.h: Update to bring in SEC_SHARED_LIBRARY.
|
||||
|
||||
Thu Nov 5 03:21:32 1992 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* bfd.h: Update to match EXFUN, bfd_seclet_struct, and SDEF
|
||||
cleanups in bfd.
|
||||
|
||||
Wed Nov 4 07:28:05 1992 Ken Raeburn (raeburn@cygnus.com)
|
||||
|
||||
* bout.h (N_CALLNAME, N_BALNAME): Define as char-type values, so
|
||||
widening works consistently.
|
||||
|
||||
Fri Oct 16 03:17:08 1992 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* getopt.h: Update to Revised Standard FSF Version.
|
||||
|
||||
Thu Oct 15 21:43:22 1992 K. Richard Pixley (rich@sendai.cygnus.com)
|
||||
|
||||
* getopt.h (struct option): use the provided enum for has_arg.
|
||||
|
||||
* demangle.h (AUTO_DEMANGLING, GNU_DEMANGLING,
|
||||
LUCID_DEMANGLING): ultrix compilers require enums to be
|
||||
enums and ints to be ints and casts where they meet. cast some
|
||||
enums into ints.
|
||||
|
||||
Thu Oct 15 04:35:51 1992 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* bfd.h: Update after comment changes.
|
||||
|
||||
Thu Oct 8 09:03:02 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* bfd.h (bfd_get_symbol_leading_char): new macro for getting in xvec
|
||||
|
||||
Thu Sep 3 09:10:50 1992 Stu Grossman (grossman at cygnus.com)
|
||||
|
||||
* bfd.h (struct reloc_howto_struct): size needs to be signed if
|
||||
it's going to hold negative values.
|
||||
|
||||
Sun Aug 30 17:50:27 1992 Per Bothner (bothner@rtl.cygnus.com)
|
||||
|
||||
* demangle.h: New file, moved from ../gdb. Made independent
|
||||
of gdb. Allow demangling style option to be passed as a
|
||||
parameter to cplus_demangle(), but using the
|
||||
current_demangling_style global as the default.
|
||||
|
||||
Sat Aug 29 10:07:55 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* obstack.h: Merge comment change from current FSF version.
|
||||
|
||||
Thu Aug 27 12:59:29 1992 Brendan Kehoe (brendan@cygnus.com)
|
||||
|
||||
* bfd.h: add we32k
|
||||
|
||||
Tue Aug 25 15:07:47 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* bfd.h: new after Z8000 stuff
|
||||
|
||||
Mon Aug 17 09:01:23 1992 Ken Raeburn (raeburn@cygnus.com)
|
||||
|
||||
* bfd.h: Regenerated after page/segment size changes.
|
||||
|
||||
Sat Aug 1 13:46:31 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* obstack.h: Merge changes from current FSF version.
|
||||
|
||||
Mon Jul 20 21:06:23 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* obstack.h (area_id, flags): Remove, replace with extra_arg,
|
||||
use_extra_arg, and maybe_empty_object.
|
||||
* obstack.h (OBSTACK_MAYBE_EMPTY_OBJECT, OBSTACK_MMALLOC_LIKE):
|
||||
Remove, replaced by maybe_empty_object and use_extra_arg bitfields.
|
||||
* obstack.h (obstack_full_begin, _obstack_begin): Remove area_id
|
||||
and flags arguments.
|
||||
* obstack.h (obstack_alloc_arg): New macro to set extra_arg.
|
||||
|
||||
Thu Jul 16 08:12:44 1992 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* bfd.h: new after adding BFD_IS_RELAXABLE
|
||||
|
||||
Sat Jul 4 03:22:23 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* bfd.h: Regen after adding BSF_FILE.
|
||||
|
||||
Mon Jun 29 14:18:36 1992 Fred Fish (fnf at sunfish)
|
||||
|
||||
* obstack.h: Convert bcopy() use to memcpy(), which is more
|
||||
portable, more standard, and can take advantage of gcc's builtin
|
||||
functions for increased performance.
|
||||
|
||||
Thu Jun 25 04:46:08 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* ansidecl.h (PARAMS): Incorporate this macro from gdb's defs.h.
|
||||
It's a cleaner way to forward-declare function prototypes.
|
||||
|
||||
Fri Jun 19 15:46:32 1992 Stu Grossman (grossman at cygnus.com)
|
||||
|
||||
* bfd.h: HPPA merge.
|
||||
|
||||
Tue Jun 16 21:30:56 1992 K. Richard Pixley (rich@cygnus.com)
|
||||
|
||||
* getopt.h: gratuitous white space changes merged from other prep
|
||||
releases.
|
||||
|
||||
Thu Jun 11 01:10:55 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* bfd.h: Regen'd from bfd.c after removing elf_core_tdata_struct.
|
||||
|
||||
Mon May 18 17:29:03 1992 K. Richard Pixley (rich@cygnus.com)
|
||||
|
||||
* getopt.h: merged changes from make-3.62.11.
|
||||
|
||||
* getopt.h: merged changes from grep-1.6 (alpha).
|
||||
|
||||
Fri May 8 14:53:32 1992 K. Richard Pixley (rich@cygnus.com)
|
||||
|
||||
* getopt.h: merged changes from bison-1.18.
|
||||
|
||||
Sat Mar 14 17:25:20 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* obstack.h: Add "area_id" and "flags" members to obstack
|
||||
structure. Add obstack_chunkfun() and obstack_freefun() to
|
||||
set functions explicitly. Convert maybe_empty_object to
|
||||
a bit in "flags".
|
||||
|
||||
Thu Feb 27 22:01:02 1992 Per Bothner (bothner@cygnus.com)
|
||||
|
||||
* wait.h (WIFSTOPPED): Add IBM rs6000-specific version.
|
||||
|
||||
Fri Feb 21 20:49:20 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* obstack.h: Add obstack_full_begin.
|
||||
* bfd.h, obstack.h: Protolint.
|
||||
|
||||
Thu Jan 30 01:18:42 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* bfd.h: Remove comma from enum declaration.
|
||||
|
||||
Mon Jan 27 22:01:13 1992 Steve Chamberlain (sac at cygnus.com)
|
||||
|
||||
* bfd.h : new target entr, bfd_relax_section
|
||||
|
||||
Wed Dec 18 17:19:44 1991 Stu Grossman (grossman at cygnus.com)
|
||||
|
||||
* bfd.h, ieee.h, opcode/m68k.h, opcode/sparc.h: ANSIfy enums.
|
||||
|
||||
Thu Dec 12 20:59:56 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* fopen-same.h, fopen-bin.h: New files for configuring
|
||||
whether fopen distinguishes binary files or not. For use
|
||||
by host-dependent config files.
|
||||
|
||||
Sat Nov 30 20:46:43 1991 Steve Chamberlain (sac at rtl.cygnus.com)
|
||||
|
||||
* bfd.h: change the documentation format.
|
||||
|
||||
* created coff, elf and opcode and aout directories. Moved:
|
||||
|
||||
aout64.h ==> aout/aout64.h
|
||||
ar.h ==> aout/ar.h
|
||||
a.out.encap.h ==> aout/encap.h
|
||||
a.out.host.h ==> aout/host.h
|
||||
a.out.hp.h ==> aout/hp.h
|
||||
a.out.sun4.h ==> aout/sun4.h
|
||||
ranlib.h ==> aout/ranlib.h
|
||||
reloc.h ==> aout/reloc.h
|
||||
stab.def ==> aout/stab.def
|
||||
stab.gnu.h ==> aout/stab_gnu.h
|
||||
|
||||
coff-a29k.h ==> coff/a29k.h
|
||||
coff-h8300.h ==> coff/h8300.h
|
||||
coff-i386.h ==> coff/i386.h
|
||||
coff-i960.h ==> coff/i960.h
|
||||
internalcoff.h ==> coff/internal.h
|
||||
coff-m68k.h ==> coff/m68k.h
|
||||
coff-m88k.h ==> coff/m88k.h
|
||||
coff-mips.h ==> coff/mips.h
|
||||
coff-rs6000.h ==> coff/rs6000.h
|
||||
|
||||
elf-common.h ==> elf/common.h
|
||||
dwarf.h ==> elf/dwarf.h
|
||||
elf-external.h ==> elf/external.h
|
||||
elf-internal.h ==> elf/internal.h
|
||||
|
||||
a29k-opcode.h ==> opcode/a29k.h
|
||||
arm-opcode.h ==> opcode/arm.h
|
||||
h8300-opcode.h ==> opcode/h8300.h
|
||||
i386-opcode.h ==> opcode/i386.h
|
||||
i860-opcode.h ==> opcode/i860.h
|
||||
i960-opcode.h ==> opcode/i960.h
|
||||
m68k-opcode.h ==> opcode/m68k.h
|
||||
m88k-opcode.h ==> opcode/m88k.h
|
||||
mips-opcode.h ==> opcode/mips.h
|
||||
np1-opcode.h ==> opcode/np1.h
|
||||
ns32k-opcode.h ==> opcode/ns32k.h
|
||||
pn-opcode.h ==> opcode/pn.h
|
||||
pyr-opcode.h ==> opcode/pyr.h
|
||||
sparc-opcode.h ==> opcode/sparc.h
|
||||
tahoe-opcode.h ==> opcode/tahoe.h
|
||||
vax-opcode.h ==> opcode/vax.h
|
||||
|
||||
|
||||
|
||||
Wed Nov 27 10:38:31 1991 Steve Chamberlain (sac at rtl.cygnus.com)
|
||||
|
||||
* internalcoff.h: (internal_scnhdr) took out #def dependency, now
|
||||
s_nreloc and s_nlnno are always long. (internal_reloc): allways
|
||||
has an offset field now.
|
||||
|
||||
Fri Nov 22 08:12:58 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* coff-rs6000.h: Lint; use unsigned chars for external fields.
|
||||
* internalcoff.h: Lint; cast storage classes to signed char.
|
||||
|
||||
Thu Nov 21 21:01:05 1991 Per Bothner (bothner at cygnus.com)
|
||||
|
||||
* stab.def: Remove the GNU extended type codes (e.g. N_SETT).
|
||||
* aout64.h: The heuristic for distinguishing between
|
||||
sunos-style and bsd-style ZMAGIC files (wrt. where the
|
||||
text segment starts) is moved into (the default definition of)
|
||||
the macro N_HEADER_IN_TEXT. This definition is only used
|
||||
if no other definition is used - e.g. bfd/newsos3.c defines
|
||||
N_HEADER_IN_TEXT(x) to be always 0 (as before).
|
||||
|
||||
Thu Nov 21 11:53:03 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* aout64.h (N_TXTADDR, N_TXTOFF, N_TXTSIZE): New definitions
|
||||
that should handle all uses. LOGICAL_ versions deleted.
|
||||
Eliminate N_HEADER_IN_TEXT, using a_entry to determine which
|
||||
kind of zmagic a.out file we are looking at.
|
||||
* coff-rs6000.h: Typo.
|
||||
|
||||
Tue Nov 19 18:43:37 1991 Per Bothner (bothner at cygnus.com)
|
||||
|
||||
(Note: This is a revised entry, as was aout64.h.)
|
||||
* aout64.h: Some cleanups of N_TXTADDR and N_TXTOFF:
|
||||
Will now work for both old- and new-style ZMAGIC files,
|
||||
depending on N_HEADER_IN_TEXT macro.
|
||||
Add LOGICAL_TXTADDR, LOICAL_TXTOFF and LOGICAL_TXTSIZE
|
||||
that don't count the exec header as part
|
||||
of the text segment, to be consistent with bfd.
|
||||
* a.out.sun4.h: Simplified/fixed for previous change.
|
||||
|
||||
Mon Nov 18 00:02:06 1991 Fred Fish (fnf at cygnus.com)
|
||||
|
||||
* dwarf.h: Update to DWARF draft 5 version from gcc2.
|
||||
|
||||
Thu Nov 14 19:44:59 1991 Per Bothner (bothner at cygnus.com)
|
||||
|
||||
* stab.def: Added defs for extended GNU symbol types,
|
||||
such as N_SETT. These are normally ifdef'd out (because
|
||||
of conflicts with a.out.gnu.h), but are used by bfb_stab_name().
|
||||
|
||||
Thu Nov 14 19:17:03 1991 Fred Fish (fnf at cygnus.com)
|
||||
|
||||
* elf-common.h: Add defines to support ELF symbol table code.
|
||||
|
||||
Mon Nov 11 19:01:06 1991 Fred Fish (fnf at cygnus.com)
|
||||
|
||||
* elf-internal.h, elf-external.h, elf-common.h: Add support for
|
||||
note sections, which are used in ELF core files to hold copies
|
||||
of various /proc structures.
|
||||
|
||||
Thu Nov 7 08:58:26 1991 Steve Chamberlain (sac at cygnus.com)
|
||||
|
||||
* internalcoff.h: took out the M88 dependency in the lineno
|
||||
struct.
|
||||
* coff-m88k.h: defines GET_LINENO_LNNO and PUT_LINENO_LNNO to use
|
||||
32bit linno entries.
|
||||
* a29k-opcode.h: fixed encoding of mtacc
|
||||
|
||||
Sun Nov 3 11:54:22 1991 Per Bothner (bothner at cygnus.com)
|
||||
|
||||
* bfd.h: Updated from ../bfd/bfd-in.h (q.v).
|
||||
|
||||
Fri Nov 1 11:13:53 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* internalcoff.h: Add x_csect defines.
|
||||
|
||||
Fri Oct 25 03:18:20 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* Rename COFF-related files in `coff-ARCH.h' form.
|
||||
coff-a29k.h, coff-i386.h, coff-i960.h, coff-m68k.h, coff-m88k.h,
|
||||
coff-mips.h, coff-rs6000.h to be exact.
|
||||
|
||||
Thu Oct 24 22:11:11 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
RS/6000 support, by Metin G. Ozisik, Mimi Phûông-Thåo Võ, and
|
||||
John Gilmore.
|
||||
|
||||
* a.out.gnu.h: Update slightly.
|
||||
* bfd.h: Add new error code, fix doc, add bfd_arch_rs6000.
|
||||
* internalcoff.h: Add more F_ codes for filehdr. Add
|
||||
rs/6000-dependent fields to aouthdr. Add storage classes
|
||||
to syments. Add 6000-specific auxent. Add r_size in reloc.
|
||||
* rs6000coff.c: New file.
|
||||
|
||||
Thu Oct 24 04:13:20 1991 Fred Fish (fnf at cygnus.com)
|
||||
|
||||
* dwarf.h: New file for dwarf support. Copied from gcc2
|
||||
distribution.
|
||||
|
||||
Wed Oct 16 13:31:45 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* aout64.h: Remove PAGE_SIZE defines; they are target-dependent.
|
||||
Add N_FN_SEQ for N_FN symbol type used on Sequent machines.
|
||||
* stab.def: Include N_FN_SEQ in table.
|
||||
* bout.h: External formats of structures use unsigned chars.
|
||||
|
||||
Fri Oct 11 12:40:43 1991 Steve Chamberlain (steve at cygnus.com)
|
||||
|
||||
* bfd.h:upgrade from bfd.c
|
||||
* internalcoff.h: add n_name, n_zeroes and n_offset macros
|
||||
* amdcoff.h: Define OMAGIC and AOUTHDRSZ.
|
||||
|
||||
Fri Oct 11 10:58:06 1991 Per Bothner (bothner at cygnus.com)
|
||||
|
||||
* a.out.host.h: Change SEGMENT_SIZE to 0x1000 for Sony.
|
||||
* bfd.h (align_power): Add (actually move) comment.
|
||||
|
||||
Tue Oct 8 15:29:32 1991 Per Bothner (bothner at cygnus.com)
|
||||
|
||||
* sys/h-rtbsd.h: Define MISSING_VFPRINT (for binutils/bucomm.c).
|
||||
|
||||
Sun Oct 6 19:24:39 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* aout64.h: Move struct internal_exec to ../bfd/libaout.h so
|
||||
it can be shared by all `a.out-family' code. Rename
|
||||
EXTERNAL_LIST_SIZE to EXTERNAL_NLIST_SIZE. Use basic types
|
||||
for nlist members, and make strx integral rather than pointer.
|
||||
More commentary on n_type values.
|
||||
* bout.h: Provide a struct external_exec rather than an
|
||||
internal_exec.
|
||||
* m68kcoff.h: Remove `tagentries' which snuck in from the i960
|
||||
COFF port.
|
||||
|
||||
Fri Oct 4 01:25:59 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* h8300-opcode.h: Remove `_enum' from the typedef for an enum.
|
||||
* bfd.h: Update to match bfd changes.
|
||||
|
||||
* sys/h-i386mach.h, sysdep.h: Add 386 Mach host support.
|
||||
|
||||
Tue Oct 1 04:58:42 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* bfd.h, elf-common.h, elf-external.h, elf-internal.h:
|
||||
Add preliminary ELF support, sufficient for GDB, from Fred Fish.
|
||||
* sysdep.h, sys/h-amix.h: Support Amiga SVR4.
|
||||
|
||||
* sys/h-vaxult.h: Make it work. (David Taylor <taylor@think.com>)
|
||||
* a.out.vax.h: Remove unused and confusing file.
|
||||
|
||||
Mon Sep 30 12:52:35 1991 Per Bothner (bothner at cygnus.com)
|
||||
|
||||
* sysdep.h: Define NEWSOS3_SYS, and use it.
|
||||
|
||||
Fri Sep 20 13:38:21 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* a.out.gnu.h (N_FN): Its value *really is* 0x1F.
|
||||
Fix it, and add comments warning about or-ing N_EXT with it
|
||||
and/or N_WARNING.
|
||||
* aout64.h (N_FN): Fix value, add comments about N_EXT.
|
||||
* stab.def (table at end): Update to show all the type
|
||||
values <0x20, including low order bits. Move N_FN to
|
||||
its rightful place.
|
||||
|
||||
Tue Sep 17 17:41:37 1991 Stu Grossman (grossman at cygnus.com)
|
||||
|
||||
* sys/h-irix3.h: sgi/irix support.
|
||||
|
||||
Tue Sep 17 07:52:59 1991 John Gilmore (gnu at cygint.cygnus.com)
|
||||
|
||||
* stab.def (N_DEFD): Add GNU Modula-2 debug stab, from Andrew
|
||||
Beers.
|
||||
|
||||
Thu Sep 12 14:12:59 1991 John Gilmore (gnu at cygint.cygnus.com)
|
||||
|
||||
* internalcoff.h (SYMNMLEN, FILNMLEN, DIMNUM): Define these
|
||||
for internalcoff, separately from the various external coff's.
|
||||
* amdcoff.h, bcs88kcoff.h, i386coff.h, intel-coff.h, m68kcoff.h,
|
||||
m88k-bcs.h: Prefix SYMNMLEN, FILNMLEN, and DIMNUM with E_'s for
|
||||
the external struct definitions.
|
||||
* ecoff.h: Remove these #define's, kludge no longer needed.
|
||||
|
||||
* sys/h-ultra3.h: Add new Ultracomputer host.
|
||||
* sysdep.h: Add ULTRA3_SYM1_SYS and use it.
|
||||
|
||||
Tue Sep 10 10:11:46 1991 John Gilmore (gnu at cygint.cygnus.com)
|
||||
|
||||
* i386coff.h (LINESZ): Always 6, not based on sizeof().
|
||||
(Fix from Peter Schauer <pes@regent.e-technik.tu-muenchen.de>.)
|
||||
|
||||
Wed Sep 4 08:58:37 1991 John Gilmore (gnu at cygint.cygnus.com)
|
||||
|
||||
* a.out.gnu.h, aout64.h: Add N_WARNING. Change N_FN to 0x0E,
|
||||
to match SunOS and BSD. Add N_COMM as 0x12 for SunOS shared lib
|
||||
support.
|
||||
* stab.def: Add N_COMM to table, fix overlap comment.
|
||||
|
||||
Tue Sep 3 06:29:20 1991 John Gilmore (gnu at cygint.cygnus.com)
|
||||
|
||||
Merge with latest FSF versions of these files.
|
||||
|
||||
* stab.gnu.h: Add LAST_UNUSED_STAB_CODE.
|
||||
* stab.def: Update to GPL2. Move N_WARNING out, since not a
|
||||
debug symbol. Change comments, and reorder table to numeric
|
||||
order. Update final table comment.
|
||||
(N_DSLINE, N_BSLINE): Renumber from 0x66 and 0x68, to 0x46 and 0x48.
|
||||
|
||||
* obstack.h: GPL2. Merge.
|
||||
|
||||
Fri Aug 23 01:54:23 1991 John Gilmore (gnu at cygint.cygnus.com)
|
||||
|
||||
* a.out.gnu.h, a.out.sun4.h: Make SEGMENT_SIZE able to depend
|
||||
on the particular a.out being examined.
|
||||
* a.out.sun4.h: Define segment sizes for Sun-3's and Sun-4's.
|
||||
* FIXME: a.out.gnu.h is almost obsolete.
|
||||
* FIXME: a.out.sun4.h should be renamed a.out.sun.h now.
|
||||
|
||||
Wed Aug 21 20:32:13 1991 John Gilmore (gnu at cygint.cygnus.com)
|
||||
|
||||
* Start a ChangeLog for the includes directory.
|
||||
|
||||
* a.out.gnu.h (N_FN): Fix value -- was 15, should be 0x1E.
|
||||
* stab.def: Update allocation table in comments at end,
|
||||
to reflect reality as I know it.
|
||||
|
||||
|
||||
Local Variables:
|
||||
mode: indented-text
|
||||
left-margin: 8
|
||||
fill-column: 74
|
||||
version-control: never
|
||||
End:
|
@ -1,141 +0,0 @@
|
||||
/* ANSI and traditional C compatability macros
|
||||
Copyright 1991, 1992 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C 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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* ANSI and traditional C compatibility macros
|
||||
|
||||
ANSI C is assumed if __STDC__ is #defined.
|
||||
|
||||
Macro ANSI C definition Traditional C definition
|
||||
----- ---- - ---------- ----------- - ----------
|
||||
PTR `void *' `char *'
|
||||
LONG_DOUBLE `long double' `double'
|
||||
VOLATILE `volatile' `'
|
||||
SIGNED `signed' `'
|
||||
PTRCONST `void *const' `char *'
|
||||
ANSI_PROTOTYPES 1 not defined
|
||||
|
||||
CONST is also defined, but is obsolete. Just use const.
|
||||
|
||||
DEFUN (name, arglist, args)
|
||||
|
||||
Defines function NAME.
|
||||
|
||||
ARGLIST lists the arguments, separated by commas and enclosed in
|
||||
parentheses. ARGLIST becomes the argument list in traditional C.
|
||||
|
||||
ARGS list the arguments with their types. It becomes a prototype in
|
||||
ANSI C, and the type declarations in traditional C. Arguments should
|
||||
be separated with `AND'. For functions with a variable number of
|
||||
arguments, the last thing listed should be `DOTS'.
|
||||
|
||||
DEFUN_VOID (name)
|
||||
|
||||
Defines a function NAME, which takes no arguments.
|
||||
|
||||
obsolete -- EXFUN (name, (prototype)) -- obsolete.
|
||||
|
||||
Replaced by PARAMS. Do not use; will disappear someday soon.
|
||||
Was used in external function declarations.
|
||||
In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in
|
||||
parentheses). In traditional C it is `NAME()'.
|
||||
For a function that takes no arguments, PROTOTYPE should be `(void)'.
|
||||
|
||||
PARAMS ((args))
|
||||
|
||||
We could use the EXFUN macro to handle prototype declarations, but
|
||||
the name is misleading and the result is ugly. So we just define a
|
||||
simple macro to handle the parameter lists, as in:
|
||||
|
||||
static int foo PARAMS ((int, char));
|
||||
|
||||
This produces: `static int foo();' or `static int foo (int, char);'
|
||||
|
||||
EXFUN would have done it like this:
|
||||
|
||||
static int EXFUN (foo, (int, char));
|
||||
|
||||
but the function is not external...and it's hard to visually parse
|
||||
the function name out of the mess. EXFUN should be considered
|
||||
obsolete; new code should be written to use PARAMS.
|
||||
|
||||
For example:
|
||||
extern int printf PARAMS ((CONST char *format DOTS));
|
||||
int DEFUN(fprintf, (stream, format),
|
||||
FILE *stream AND CONST char *format DOTS) { ... }
|
||||
void DEFUN_VOID(abort) { ... }
|
||||
*/
|
||||
|
||||
#ifndef _ANSIDECL_H
|
||||
|
||||
#define _ANSIDECL_H 1
|
||||
|
||||
|
||||
/* Every source file includes this file,
|
||||
so they will all get the switch for lint. */
|
||||
/* LINTLIBRARY */
|
||||
|
||||
|
||||
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32)
|
||||
/* All known AIX compilers implement these things (but don't always
|
||||
define __STDC__). The RISC/OS MIPS compiler defines these things
|
||||
in SVR4 mode, but does not define __STDC__. */
|
||||
|
||||
#define PTR void *
|
||||
#define PTRCONST void *CONST
|
||||
#define LONG_DOUBLE long double
|
||||
|
||||
#define AND ,
|
||||
#define NOARGS void
|
||||
#define CONST const
|
||||
#define VOLATILE volatile
|
||||
#define SIGNED signed
|
||||
#define DOTS , ...
|
||||
|
||||
#define EXFUN(name, proto) name proto
|
||||
#define DEFUN(name, arglist, args) name(args)
|
||||
#define DEFUN_VOID(name) name(void)
|
||||
|
||||
#define PROTO(type, name, arglist) type name arglist
|
||||
#define PARAMS(paramlist) paramlist
|
||||
#define ANSI_PROTOTYPES 1
|
||||
|
||||
#else /* Not ANSI C. */
|
||||
|
||||
#define PTR char *
|
||||
#define PTRCONST PTR
|
||||
#define LONG_DOUBLE double
|
||||
|
||||
#define AND ;
|
||||
#define NOARGS
|
||||
#define CONST
|
||||
#ifndef const /* some systems define it in header files for non-ansi mode */
|
||||
#define const
|
||||
#endif
|
||||
#define VOLATILE
|
||||
#define SIGNED
|
||||
#define DOTS
|
||||
|
||||
#define EXFUN(name, proto) name()
|
||||
#define DEFUN(name, arglist, args) name arglist args;
|
||||
#define DEFUN_VOID(name) name()
|
||||
#define PROTO(type, name, arglist) type name ()
|
||||
#define PARAMS(paramlist) ()
|
||||
|
||||
#endif /* ANSI C. */
|
||||
|
||||
#endif /* ansidecl.h */
|
@ -1,174 +0,0 @@
|
||||
Mon Mar 11 12:15:52 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* stab.def: Use __define_stab_duplicate rather than __define_stab
|
||||
for duplicate entries N_BROWS and N_MOD2.
|
||||
* stab_gnu.h (__define_stab_duplicate): Define before including
|
||||
stab.def.
|
||||
|
||||
Fri Oct 27 17:47:16 1995 Niklas Hallqvist <niklas@appli.se>
|
||||
|
||||
* aout64.h, host.h, hp300hpux.h, sun4.h: Changed PAGE_SIZE to
|
||||
TARGET_PAGE_SIZE.
|
||||
|
||||
Tue Sep 12 12:07:02 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* sun4.h (struct internal_sun4_dynamic_link): Change all fields
|
||||
from long to unsigned long.
|
||||
|
||||
Wed Jul 12 00:15:13 1995 Ken Raeburn <raeburn@kr-pc.cygnus.com>
|
||||
|
||||
* sun4.h (PAGE_SIZE): Undefine before defining.
|
||||
|
||||
Thu Jun 16 14:22:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* aout64.h (BMAGIC): Define.
|
||||
|
||||
Sat Jun 11 16:16:09 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
Add weak symbols as an extension to a.out.
|
||||
* aout64.h (N_WEAKU, N_WEAKA, N_WEAKT, N_WEAKD, N_WEAKB): Define.
|
||||
* stab.def: Update symbol value table.
|
||||
|
||||
Thu Jun 2 17:13:38 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* sun4.h (EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE): Correct from 28 to
|
||||
24. Fix up ld_got comment.
|
||||
|
||||
Wed Mar 30 00:31:49 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
|
||||
|
||||
* dynix3.h: Cleanup, adapt to current bfd version.
|
||||
|
||||
Sat Feb 26 10:25:53 1994 Ian Lance Taylor (ian@cygnus.com)
|
||||
|
||||
* aout64.h: Add casts to avoid warnings from SVR4 cc.
|
||||
|
||||
Fri Feb 11 12:56:04 1994 Stan Shebs (shebs@andros.cygnus.com)
|
||||
|
||||
* ar.h (ARMAG, ARMAGB, ARFMAG): Change '\n' to '\012', for greater
|
||||
portability.
|
||||
|
||||
Fri Jan 21 00:59:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* sun4.h: Added information about SunOS shared libraries.
|
||||
|
||||
Fri Jan 7 08:20:13 1994 Jim Kingdon (kingdon@deneb.cygnus.com)
|
||||
|
||||
* aout64.h (N_TXTADDR): Add comment regarding OMAGIC and NMAGIC.
|
||||
|
||||
Sat Dec 25 14:55:41 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* aout64.h (N_DATOFF): Don't pad (revert change of 8 Jul 1993).
|
||||
|
||||
Tue Nov 16 15:43:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* aout64.h: New macros ZMAGIC_DISK_BLOCK_SIZE and N_DISK_BLOCK_SIZE
|
||||
for Linux ZMAGIC.
|
||||
(N_TXTOFF, N_DATOFF): Use them.
|
||||
|
||||
Thu Nov 4 00:33:48 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
|
||||
|
||||
* aout64.h (RELOC_STD_BITS_RELATIVE_LITTLE): Fixed value to match
|
||||
sun3 system; used to overlap other fields.
|
||||
(RELOC_STD_BITS_JMPTABLE_LITTLE): Likewise.
|
||||
|
||||
Wed Nov 3 13:48:27 1993 David J. Mackenzie (djm@thepub.cygnus.com)
|
||||
|
||||
* aout64.h (RELOC_STD_BITS_BASEREL_LITTLE): Make it 0x10 (Ken's
|
||||
suggestion) to avoid conflict with RELOC_STD_BITS_EXTERN_LITTLE.
|
||||
|
||||
Fri Oct 29 15:09:52 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
|
||||
|
||||
* hp300hpux.h (N_SHARED_LIB): Define to be 0.
|
||||
|
||||
Mon Sep 13 21:00:56 1993 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* ar.h (ARMAP_TIME_OFFSET): Add and describe.
|
||||
|
||||
Mon Aug 23 Sean Fagan (sef@cygnus.com)
|
||||
|
||||
* aout64.h [ARCH_SIZE != 64]: Allow N_BADMAG to be overridden.
|
||||
|
||||
Mon Aug 16 14:30:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* stab_gnu.h: Include aout/stab.def not just stab.def.
|
||||
|
||||
Sun Jul 18 21:41:47 1993 Jim Kingdon (kingdon@rtl.cygnus.com)
|
||||
|
||||
* dynix3.h: New, for symmetry running dynix.
|
||||
|
||||
Thu Jul 8 12:52:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* aout64.h (N_BADMAG): Recognize QMAGIC.
|
||||
N_TXTOFF, N_TXTADDR, N_TXTSIZE: Special code for QMAGIC.
|
||||
N_DATOFF: Pad text size if we need to.
|
||||
|
||||
Fri Jun 18 19:19:38 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* stab.def (N_ECOML): Fix comment.
|
||||
|
||||
Mon May 31 09:21:30 1993 Jim Kingdon (kingdon@cygnus.com)
|
||||
|
||||
* stab.def: Remove Solaris information on N_FUN stabstring grammar;
|
||||
I've transferred it to gdb/doc/stabs.texinfo, where it belongs.
|
||||
|
||||
Mon May 10 05:48:43 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
|
||||
|
||||
* hp300hpux.h: Patch from Glenn Engel for linker problem and
|
||||
compatibility fix:
|
||||
(OMAGIC, NMAGIC): New definitions.
|
||||
(SHAREMAGIC): Deleted.
|
||||
(HPUX_DOT_O_MAGIC): New macro.
|
||||
(_N_BADMAG): Adjusted.
|
||||
(N_HEADER_IN_TEXT, N_DATADDR): New macros.
|
||||
|
||||
Thu Apr 29 12:07:37 1993 Ken Raeburn (raeburn@deneb.cygnus.com)
|
||||
|
||||
* hp300hpux.h: New file from Glenn Engel, glenne@lsid.hp.com.
|
||||
|
||||
Tue Apr 27 05:51:04 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
|
||||
|
||||
* aout64.h (struct external_exec, *MAGIC, N_BADMAG): Don't define
|
||||
if `external_exec' is already defined as a macro.
|
||||
(N_DATOFF, N_TRELOFF, N_DRELOFF, N_SYMOFF, N_STROFF): Don't define
|
||||
if already defined.
|
||||
(struct external_nlist, EXTERNAL_NLIST_SIZE): Don't define if
|
||||
`external_nlist' is already defined as a macro.
|
||||
|
||||
Sat Aug 15 04:23:02 1992 John Gilmore (gnu@cygnus.com)
|
||||
|
||||
* adobe.h: Add description of a.out.adobe format.
|
||||
|
||||
Fri Jul 3 00:36:52 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* stab.def: Update more Solaris definitions.
|
||||
* stab_gnu.h: Add N_SO language types, and Solaris basic float types.
|
||||
|
||||
Sun Jun 14 10:53:53 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* stab.def: Update descriptions of Solaris-2 stabs; add N_UNDF.
|
||||
|
||||
Thu Jun 11 01:12:07 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* stab.def: Add N_OBJ and N_OPT from Solaris-2.
|
||||
|
||||
Thu Jan 30 18:12:44 1992 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* aout/aout64.h: N_TXTSIZE needs some more parentheses.
|
||||
I don't trust C precedence.
|
||||
|
||||
Wed Dec 18 14:32:01 1991 Per Bothner (bothner at cygnus.com)
|
||||
|
||||
* aout/aout64.h: Move common sunos-specific test
|
||||
to recognize shared libraries into new macro N_SHARED_LIB.
|
||||
Use it to simplify&reformat N_TXTADDR, N_TXTOFF, N_TXTSIZE.
|
||||
|
||||
Sat Nov 30 20:34:52 1991 Steve Chamberlain (sac at rtl.cygnus.com)
|
||||
|
||||
* ChangeLog, aout64.h, ar.h, encap.h, host.h, hp.h, ranlib.h,
|
||||
reloc.h, stab.def, stab_gnu.h, sun4.h: All moved from the
|
||||
devo/include directory
|
||||
|
||||
|
||||
Local Variables:
|
||||
version-control: never
|
||||
End:
|
@ -1,297 +0,0 @@
|
||||
/* `a.out.adobe' differences from standard a.out files */
|
||||
|
||||
#ifndef __A_OUT_ADOBE_H__
|
||||
#define __A_OUT_ADOBE_H__
|
||||
|
||||
#define BYTES_IN_WORD 4
|
||||
|
||||
/* Struct external_exec is the same. */
|
||||
|
||||
/* This is the layout on disk of the 32-bit or 64-bit exec header. */
|
||||
|
||||
struct external_exec
|
||||
{
|
||||
bfd_byte e_info[4]; /* magic number and stuff */
|
||||
bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes */
|
||||
bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes */
|
||||
bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes */
|
||||
bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes */
|
||||
bfd_byte e_entry[BYTES_IN_WORD]; /* start address */
|
||||
bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info */
|
||||
bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info */
|
||||
};
|
||||
|
||||
#define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7)
|
||||
|
||||
/* Magic numbers for a.out files */
|
||||
|
||||
#undef ZMAGIC
|
||||
#define ZMAGIC 0xAD0BE /* Cute, eh? */
|
||||
#undef OMAGIC
|
||||
#undef NMAGIC
|
||||
|
||||
#define N_BADMAG(x) ((x).a_info != ZMAGIC)
|
||||
|
||||
/* By default, segment size is constant. But some machines override this
|
||||
to be a function of the a.out header (e.g. machine type). */
|
||||
#ifndef N_SEGSIZE
|
||||
#define N_SEGSIZE(x) SEGMENT_SIZE
|
||||
#endif
|
||||
#undef N_SEGSIZE /* FIXMEXXXX */
|
||||
|
||||
/* Segment information for the a.out.Adobe format is specified after the
|
||||
file header. It contains N segment descriptors, followed by one with
|
||||
a type of zero.
|
||||
|
||||
The actual text of the segments starts at N_TXTOFF in the file,
|
||||
regardless of how many or how few segment headers there are. */
|
||||
|
||||
struct external_segdesc {
|
||||
unsigned char e_type[1];
|
||||
unsigned char e_size[3];
|
||||
unsigned char e_virtbase[4];
|
||||
unsigned char e_filebase[4];
|
||||
};
|
||||
|
||||
struct internal_segdesc {
|
||||
unsigned int a_type:8; /* Segment type N_TEXT, N_DATA, 0 */
|
||||
unsigned int a_size:24; /* Segment size */
|
||||
bfd_vma a_virtbase; /* Virtual address */
|
||||
unsigned int a_filebase; /* Base address in object file */
|
||||
};
|
||||
|
||||
#define N_TXTADDR(x) \
|
||||
|
||||
/* This is documented to be at 1024, but appears to really be at 2048.
|
||||
FIXME?! */
|
||||
#define N_TXTOFF(x) 2048
|
||||
|
||||
#define N_TXTSIZE(x) ((x).a_text)
|
||||
|
||||
#define N_DATADDR(x)
|
||||
|
||||
#define N_BSSADDR(x)
|
||||
|
||||
/* Offsets of the various portions of the file after the text segment. */
|
||||
|
||||
#define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) )
|
||||
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data )
|
||||
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
|
||||
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize )
|
||||
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
|
||||
|
||||
/* Symbols */
|
||||
struct external_nlist {
|
||||
bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */
|
||||
bfd_byte e_type[1]; /* type of symbol */
|
||||
bfd_byte e_other[1]; /* misc info (usually empty) */
|
||||
bfd_byte e_desc[2]; /* description field */
|
||||
bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */
|
||||
};
|
||||
|
||||
#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)
|
||||
|
||||
struct internal_nlist {
|
||||
unsigned long n_strx; /* index into string table of name */
|
||||
unsigned char n_type; /* type of symbol */
|
||||
unsigned char n_other; /* misc info (usually empty) */
|
||||
unsigned short n_desc; /* description field */
|
||||
bfd_vma n_value; /* value of symbol */
|
||||
};
|
||||
|
||||
/* The n_type field is the symbol type, containing: */
|
||||
|
||||
#define N_UNDF 0 /* Undefined symbol */
|
||||
#define N_ABS 2 /* Absolute symbol -- defined at particular addr */
|
||||
#define N_TEXT 4 /* Text sym -- defined at offset in text seg */
|
||||
#define N_DATA 6 /* Data sym -- defined at offset in data seg */
|
||||
#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */
|
||||
#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */
|
||||
#define N_FN 0x1f /* File name of .o file */
|
||||
#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */
|
||||
/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
|
||||
N_DATA, or N_BSS. When the low-order bit of other types is set,
|
||||
(e.g. N_WARNING versus N_FN), they are two different types. */
|
||||
#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */
|
||||
#define N_TYPE 0x1e
|
||||
#define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */
|
||||
|
||||
#define N_INDR 0x0a
|
||||
|
||||
/* The following symbols refer to set elements.
|
||||
All the N_SET[ATDB] symbols with the same name form one set.
|
||||
Space is allocated for the set in the text section, and each set
|
||||
elements value is stored into one word of the space.
|
||||
The first word of the space is the length of the set (number of elements).
|
||||
|
||||
The address of the set is made into an N_SETV symbol
|
||||
whose name is the same as the name of the set.
|
||||
This symbol acts like a N_DATA global symbol
|
||||
in that it can satisfy undefined external references. */
|
||||
|
||||
/* These appear as input to LD, in a .o file. */
|
||||
#define N_SETA 0x14 /* Absolute set element symbol */
|
||||
#define N_SETT 0x16 /* Text set element symbol */
|
||||
#define N_SETD 0x18 /* Data set element symbol */
|
||||
#define N_SETB 0x1A /* Bss set element symbol */
|
||||
|
||||
/* This is output from LD. */
|
||||
#define N_SETV 0x1C /* Pointer to set vector in data area. */
|
||||
|
||||
/* Warning symbol. The text gives a warning message, the next symbol
|
||||
in the table will be undefined. When the symbol is referenced, the
|
||||
message is printed. */
|
||||
|
||||
#define N_WARNING 0x1e
|
||||
|
||||
/* Relocations
|
||||
|
||||
There are two types of relocation flavours for a.out systems,
|
||||
standard and extended. The standard form is used on systems where the
|
||||
instruction has room for all the bits of an offset to the operand, whilst
|
||||
the extended form is used when an address operand has to be split over n
|
||||
instructions. Eg, on the 68k, each move instruction can reference
|
||||
the target with a displacement of 16 or 32 bits. On the sparc, move
|
||||
instructions use an offset of 14 bits, so the offset is stored in
|
||||
the reloc field, and the data in the section is ignored.
|
||||
*/
|
||||
|
||||
/* This structure describes a single relocation to be performed.
|
||||
The text-relocation section of the file is a vector of these structures,
|
||||
all of which apply to the text section.
|
||||
Likewise, the data-relocation section applies to the data section. */
|
||||
|
||||
struct reloc_std_external {
|
||||
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */
|
||||
bfd_byte r_index[3]; /* symbol table index of symbol */
|
||||
bfd_byte r_type[1]; /* relocation type */
|
||||
};
|
||||
|
||||
#define RELOC_STD_BITS_PCREL_BIG 0x80
|
||||
#define RELOC_STD_BITS_PCREL_LITTLE 0x01
|
||||
|
||||
#define RELOC_STD_BITS_LENGTH_BIG 0x60
|
||||
#define RELOC_STD_BITS_LENGTH_SH_BIG 5 /* To shift to units place */
|
||||
#define RELOC_STD_BITS_LENGTH_LITTLE 0x06
|
||||
#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1
|
||||
|
||||
#define RELOC_STD_BITS_EXTERN_BIG 0x10
|
||||
#define RELOC_STD_BITS_EXTERN_LITTLE 0x08
|
||||
|
||||
#define RELOC_STD_BITS_BASEREL_BIG 0x08
|
||||
#define RELOC_STD_BITS_BASEREL_LITTLE 0x08
|
||||
|
||||
#define RELOC_STD_BITS_JMPTABLE_BIG 0x04
|
||||
#define RELOC_STD_BITS_JMPTABLE_LITTLE 0x04
|
||||
|
||||
#define RELOC_STD_BITS_RELATIVE_BIG 0x02
|
||||
#define RELOC_STD_BITS_RELATIVE_LITTLE 0x02
|
||||
|
||||
#define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */
|
||||
|
||||
struct reloc_std_internal
|
||||
{
|
||||
bfd_vma r_address; /* Address (within segment) to be relocated. */
|
||||
/* The meaning of r_symbolnum depends on r_extern. */
|
||||
unsigned int r_symbolnum:24;
|
||||
/* Nonzero means value is a pc-relative offset
|
||||
and it should be relocated for changes in its own address
|
||||
as well as for changes in the symbol or section specified. */
|
||||
unsigned int r_pcrel:1;
|
||||
/* Length (as exponent of 2) of the field to be relocated.
|
||||
Thus, a value of 2 indicates 1<<2 bytes. */
|
||||
unsigned int r_length:2;
|
||||
/* 1 => relocate with value of symbol.
|
||||
r_symbolnum is the index of the symbol
|
||||
in files the symbol table.
|
||||
0 => relocate with the address of a segment.
|
||||
r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
|
||||
(the N_EXT bit may be set also, but signifies nothing). */
|
||||
unsigned int r_extern:1;
|
||||
/* The next three bits are for SunOS shared libraries, and seem to
|
||||
be undocumented. */
|
||||
unsigned int r_baserel:1; /* Linkage table relative */
|
||||
unsigned int r_jmptable:1; /* pc-relative to jump table */
|
||||
unsigned int r_relative:1; /* "relative relocation" */
|
||||
/* unused */
|
||||
unsigned int r_pad:1; /* Padding -- set to zero */
|
||||
};
|
||||
|
||||
|
||||
/* EXTENDED RELOCS */
|
||||
|
||||
struct reloc_ext_external {
|
||||
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */
|
||||
bfd_byte r_index[3]; /* symbol table index of symbol */
|
||||
bfd_byte r_type[1]; /* relocation type */
|
||||
bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */
|
||||
};
|
||||
|
||||
#define RELOC_EXT_BITS_EXTERN_BIG 0x80
|
||||
#define RELOC_EXT_BITS_EXTERN_LITTLE 0x01
|
||||
|
||||
#define RELOC_EXT_BITS_TYPE_BIG 0x1F
|
||||
#define RELOC_EXT_BITS_TYPE_SH_BIG 0
|
||||
#define RELOC_EXT_BITS_TYPE_LITTLE 0xF8
|
||||
#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3
|
||||
|
||||
/* Bytes per relocation entry */
|
||||
#define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD)
|
||||
|
||||
enum reloc_type
|
||||
{
|
||||
/* simple relocations */
|
||||
RELOC_8, /* data[0:7] = addend + sv */
|
||||
RELOC_16, /* data[0:15] = addend + sv */
|
||||
RELOC_32, /* data[0:31] = addend + sv */
|
||||
/* pc-rel displacement */
|
||||
RELOC_DISP8, /* data[0:7] = addend - pc + sv */
|
||||
RELOC_DISP16, /* data[0:15] = addend - pc + sv */
|
||||
RELOC_DISP32, /* data[0:31] = addend - pc + sv */
|
||||
/* Special */
|
||||
RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */
|
||||
RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */
|
||||
RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */
|
||||
RELOC_22, /* data[0:21] = (addend + sv) */
|
||||
RELOC_13, /* data[0:12] = (addend + sv) */
|
||||
RELOC_LO10, /* data[0:9] = (addend + sv) */
|
||||
RELOC_SFA_BASE,
|
||||
RELOC_SFA_OFF13,
|
||||
/* P.I.C. (base-relative) */
|
||||
RELOC_BASE10, /* Not sure - maybe we can do this the */
|
||||
RELOC_BASE13, /* right way now */
|
||||
RELOC_BASE22,
|
||||
/* for some sort of pc-rel P.I.C. (?) */
|
||||
RELOC_PC10,
|
||||
RELOC_PC22,
|
||||
/* P.I.C. jump table */
|
||||
RELOC_JMP_TBL,
|
||||
/* reputedly for shared libraries somehow */
|
||||
RELOC_SEGOFF16,
|
||||
RELOC_GLOB_DAT,
|
||||
RELOC_JMP_SLOT,
|
||||
RELOC_RELATIVE,
|
||||
|
||||
RELOC_11,
|
||||
RELOC_WDISP2_14,
|
||||
RELOC_WDISP19,
|
||||
RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */
|
||||
RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */
|
||||
|
||||
/* 29K relocation types */
|
||||
RELOC_JUMPTARG,
|
||||
RELOC_CONST,
|
||||
RELOC_CONSTH,
|
||||
|
||||
NO_RELOC
|
||||
};
|
||||
|
||||
|
||||
struct reloc_internal {
|
||||
bfd_vma r_address; /* offset of of data to relocate */
|
||||
long r_index; /* symbol table index of symbol */
|
||||
enum reloc_type r_type; /* relocation type */
|
||||
bfd_vma r_addend; /* datum addend */
|
||||
};
|
||||
|
||||
#endif /* __A_OUT_ADOBE_H__ */
|
@ -1,475 +0,0 @@
|
||||
/* `a.out' object-file definitions, including extensions to 64-bit fields */
|
||||
|
||||
#ifndef __A_OUT_64_H__
|
||||
#define __A_OUT_64_H__
|
||||
|
||||
/* This is the layout on disk of the 32-bit or 64-bit exec header. */
|
||||
|
||||
#ifndef external_exec
|
||||
struct external_exec
|
||||
{
|
||||
bfd_byte e_info[4]; /* magic number and stuff */
|
||||
bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes */
|
||||
bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes */
|
||||
bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes */
|
||||
bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes */
|
||||
bfd_byte e_entry[BYTES_IN_WORD]; /* start address */
|
||||
bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info */
|
||||
bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info */
|
||||
};
|
||||
|
||||
#define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7)
|
||||
|
||||
/* Magic numbers for a.out files */
|
||||
|
||||
#if ARCH_SIZE==64
|
||||
#define OMAGIC 0x1001 /* Code indicating object file */
|
||||
#define ZMAGIC 0x1002 /* Code indicating demand-paged executable. */
|
||||
#define NMAGIC 0x1003 /* Code indicating pure executable. */
|
||||
|
||||
/* There is no 64-bit QMAGIC as far as I know. */
|
||||
|
||||
#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
|
||||
&& N_MAGIC(x) != NMAGIC \
|
||||
&& N_MAGIC(x) != ZMAGIC)
|
||||
#else
|
||||
#define OMAGIC 0407 /* ...object file or impure executable. */
|
||||
#define NMAGIC 0410 /* Code indicating pure executable. */
|
||||
#define ZMAGIC 0413 /* Code indicating demand-paged executable. */
|
||||
#define BMAGIC 0415 /* Used by a b.out object. */
|
||||
|
||||
/* This indicates a demand-paged executable with the header in the text.
|
||||
It is used by 386BSD (and variants) and Linux, at least. */
|
||||
#ifndef QMAGIC
|
||||
#define QMAGIC 0314
|
||||
#endif
|
||||
# ifndef N_BADMAG
|
||||
# define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
|
||||
&& N_MAGIC(x) != NMAGIC \
|
||||
&& N_MAGIC(x) != ZMAGIC \
|
||||
&& N_MAGIC(x) != QMAGIC)
|
||||
# endif /* N_BADMAG */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef QMAGIC
|
||||
#define N_IS_QMAGIC(x) (N_MAGIC (x) == QMAGIC)
|
||||
#else
|
||||
#define N_IS_QMAGIC(x) (0)
|
||||
#endif
|
||||
|
||||
/* The difference between TARGET_PAGE_SIZE and N_SEGSIZE is that TARGET_PAGE_SIZE is
|
||||
the finest granularity at which you can page something, thus it
|
||||
controls the padding (if any) before the text segment of a ZMAGIC
|
||||
file. N_SEGSIZE is the resolution at which things can be marked as
|
||||
read-only versus read/write, so it controls the padding between the
|
||||
text segment and the data segment (in memory; on disk the padding
|
||||
between them is TARGET_PAGE_SIZE). TARGET_PAGE_SIZE and N_SEGSIZE are the same
|
||||
for most machines, but different for sun3. */
|
||||
|
||||
/* By default, segment size is constant. But some machines override this
|
||||
to be a function of the a.out header (e.g. machine type). */
|
||||
|
||||
#ifndef N_SEGSIZE
|
||||
#define N_SEGSIZE(x) SEGMENT_SIZE
|
||||
#endif
|
||||
|
||||
/* Virtual memory address of the text section.
|
||||
This is getting very complicated. A good reason to discard a.out format
|
||||
for something that specifies these fields explicitly. But til then...
|
||||
|
||||
* OMAGIC and NMAGIC files:
|
||||
(object files: text for "relocatable addr 0" right after the header)
|
||||
start at 0, offset is EXEC_BYTES_SIZE, size as stated.
|
||||
* The text address, offset, and size of ZMAGIC files depend
|
||||
on the entry point of the file:
|
||||
* entry point below TEXT_START_ADDR:
|
||||
(hack for SunOS shared libraries)
|
||||
start at 0, offset is 0, size as stated.
|
||||
* If N_HEADER_IN_TEXT(x) is true (which defaults to being the
|
||||
case when the entry point is EXEC_BYTES_SIZE or further into a page):
|
||||
no padding is needed; text can start after exec header. Sun
|
||||
considers the text segment of such files to include the exec header;
|
||||
for BFD's purposes, we don't, which makes more work for us.
|
||||
start at TEXT_START_ADDR + EXEC_BYTES_SIZE, offset is EXEC_BYTES_SIZE,
|
||||
size as stated minus EXEC_BYTES_SIZE.
|
||||
* If N_HEADER_IN_TEXT(x) is false (which defaults to being the case when
|
||||
the entry point is less than EXEC_BYTES_SIZE into a page (e.g. page
|
||||
aligned)): (padding is needed so that text can start at a page boundary)
|
||||
start at TEXT_START_ADDR, offset TARGET_PAGE_SIZE, size as stated.
|
||||
|
||||
Specific configurations may want to hardwire N_HEADER_IN_TEXT,
|
||||
for efficiency or to allow people to play games with the entry point.
|
||||
In that case, you would #define N_HEADER_IN_TEXT(x) as 1 for sunos,
|
||||
and as 0 for most other hosts (Sony News, Vax Ultrix, etc).
|
||||
(Do this in the appropriate bfd target file.)
|
||||
(The default is a heuristic that will break if people try changing
|
||||
the entry point, perhaps with the ld -e flag.)
|
||||
|
||||
* QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true,
|
||||
and for which the starting address is TARGET_PAGE_SIZE (or should this be
|
||||
SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC).
|
||||
*/
|
||||
|
||||
/* This macro is only relevant for ZMAGIC files; QMAGIC always has the header
|
||||
in the text. */
|
||||
#ifndef N_HEADER_IN_TEXT
|
||||
#define N_HEADER_IN_TEXT(x) (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
|
||||
#endif
|
||||
|
||||
/* Sun shared libraries, not linux. This macro is only relevant for ZMAGIC
|
||||
files. */
|
||||
#ifndef N_SHARED_LIB
|
||||
#define N_SHARED_LIB(x) ((x).a_entry < TEXT_START_ADDR)
|
||||
#endif
|
||||
|
||||
/* Returning 0 not TEXT_START_ADDR for OMAGIC and NMAGIC is based on
|
||||
the assumption that we are dealing with a .o file, not an
|
||||
executable. This is necessary for OMAGIC (but means we don't work
|
||||
right on the output from ld -N); more questionable for NMAGIC. */
|
||||
|
||||
#ifndef N_TXTADDR
|
||||
#define N_TXTADDR(x) \
|
||||
(/* The address of a QMAGIC file is always one page in, */ \
|
||||
/* with the header in the text. */ \
|
||||
N_IS_QMAGIC (x) ? TARGET_PAGE_SIZE + EXEC_BYTES_SIZE : \
|
||||
N_MAGIC(x) != ZMAGIC ? 0 : /* object file or NMAGIC */\
|
||||
N_SHARED_LIB(x) ? 0 : \
|
||||
N_HEADER_IN_TEXT(x) ? \
|
||||
TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\
|
||||
TEXT_START_ADDR /* a page of padding */\
|
||||
)
|
||||
#endif
|
||||
|
||||
/* If N_HEADER_IN_TEXT is not true for ZMAGIC, there is some padding
|
||||
to make the text segment start at a certain boundary. For most
|
||||
systems, this boundary is TARGET_PAGE_SIZE. But for Linux, in the
|
||||
time-honored tradition of crazy ZMAGIC hacks, it is 1024 which is
|
||||
not what TARGET_PAGE_SIZE needs to be for QMAGIC. */
|
||||
|
||||
#ifndef ZMAGIC_DISK_BLOCK_SIZE
|
||||
#define ZMAGIC_DISK_BLOCK_SIZE TARGET_PAGE_SIZE
|
||||
#endif
|
||||
|
||||
#define N_DISK_BLOCK_SIZE(x) \
|
||||
(N_MAGIC(x) == ZMAGIC ? ZMAGIC_DISK_BLOCK_SIZE : TARGET_PAGE_SIZE)
|
||||
|
||||
/* Offset in an a.out of the start of the text section. */
|
||||
#ifndef N_TXTOFF
|
||||
#define N_TXTOFF(x) \
|
||||
(/* For {O,N,Q}MAGIC, no padding. */ \
|
||||
N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \
|
||||
N_SHARED_LIB(x) ? 0 : \
|
||||
N_HEADER_IN_TEXT(x) ? \
|
||||
EXEC_BYTES_SIZE : /* no padding */\
|
||||
ZMAGIC_DISK_BLOCK_SIZE /* a page of padding */\
|
||||
)
|
||||
#endif
|
||||
/* Size of the text section. It's always as stated, except that we
|
||||
offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF
|
||||
for ZMAGIC files that nominally include the exec header
|
||||
as part of the first page of text. (BFD doesn't consider the
|
||||
exec header to be part of the text segment.) */
|
||||
#ifndef N_TXTSIZE
|
||||
#define N_TXTSIZE(x) \
|
||||
(/* For QMAGIC, we don't consider the header part of the text section. */\
|
||||
N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \
|
||||
(N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \
|
||||
N_HEADER_IN_TEXT(x) ? \
|
||||
(x).a_text - EXEC_BYTES_SIZE: /* no padding */\
|
||||
(x).a_text /* a page of padding */\
|
||||
)
|
||||
#endif
|
||||
/* The address of the data segment in virtual memory.
|
||||
It is the text segment address, plus text segment size, rounded
|
||||
up to a N_SEGSIZE boundary for pure or pageable files. */
|
||||
#ifndef N_DATADDR
|
||||
#define N_DATADDR(x) \
|
||||
(N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+N_TXTSIZE(x)) \
|
||||
: (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1))))
|
||||
#endif
|
||||
/* The address of the BSS segment -- immediately after the data segment. */
|
||||
|
||||
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
|
||||
|
||||
/* Offsets of the various portions of the file after the text segment. */
|
||||
|
||||
/* For {Q,Z}MAGIC, there is padding to make the data segment start on
|
||||
a page boundary. Most of the time the a_text field (and thus
|
||||
N_TXTSIZE) already contains this padding. It is possible that for
|
||||
BSDI and/or 386BSD it sometimes doesn't contain the padding, and
|
||||
perhaps we should be adding it here. But this seems kind of
|
||||
questionable and probably should be BSDI/386BSD-specific if we do
|
||||
do it.
|
||||
|
||||
For NMAGIC (at least for hp300 BSD, probably others), there is
|
||||
padding in memory only, not on disk, so we must *not* ever pad here
|
||||
for NMAGIC. */
|
||||
|
||||
#ifndef N_DATOFF
|
||||
#define N_DATOFF(x) \
|
||||
(N_TXTOFF(x) + N_TXTSIZE(x))
|
||||
#endif
|
||||
|
||||
#ifndef N_TRELOFF
|
||||
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data )
|
||||
#endif
|
||||
#ifndef N_DRELOFF
|
||||
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
|
||||
#endif
|
||||
#ifndef N_SYMOFF
|
||||
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize )
|
||||
#endif
|
||||
#ifndef N_STROFF
|
||||
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
|
||||
#endif
|
||||
|
||||
/* Symbols */
|
||||
#ifndef external_nlist
|
||||
struct external_nlist {
|
||||
bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */
|
||||
bfd_byte e_type[1]; /* type of symbol */
|
||||
bfd_byte e_other[1]; /* misc info (usually empty) */
|
||||
bfd_byte e_desc[2]; /* description field */
|
||||
bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */
|
||||
};
|
||||
#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)
|
||||
#endif
|
||||
|
||||
struct internal_nlist {
|
||||
unsigned long n_strx; /* index into string table of name */
|
||||
unsigned char n_type; /* type of symbol */
|
||||
unsigned char n_other; /* misc info (usually empty) */
|
||||
unsigned short n_desc; /* description field */
|
||||
bfd_vma n_value; /* value of symbol */
|
||||
};
|
||||
|
||||
/* The n_type field is the symbol type, containing: */
|
||||
|
||||
#define N_UNDF 0 /* Undefined symbol */
|
||||
#define N_ABS 2 /* Absolute symbol -- defined at particular addr */
|
||||
#define N_TEXT 4 /* Text sym -- defined at offset in text seg */
|
||||
#define N_DATA 6 /* Data sym -- defined at offset in data seg */
|
||||
#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */
|
||||
#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */
|
||||
#define N_FN 0x1f /* File name of .o file */
|
||||
#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */
|
||||
/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
|
||||
N_DATA, or N_BSS. When the low-order bit of other types is set,
|
||||
(e.g. N_WARNING versus N_FN), they are two different types. */
|
||||
#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */
|
||||
#define N_TYPE 0x1e
|
||||
#define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */
|
||||
|
||||
#define N_INDR 0x0a
|
||||
|
||||
/* The following symbols refer to set elements.
|
||||
All the N_SET[ATDB] symbols with the same name form one set.
|
||||
Space is allocated for the set in the text section, and each set
|
||||
elements value is stored into one word of the space.
|
||||
The first word of the space is the length of the set (number of elements).
|
||||
|
||||
The address of the set is made into an N_SETV symbol
|
||||
whose name is the same as the name of the set.
|
||||
This symbol acts like a N_DATA global symbol
|
||||
in that it can satisfy undefined external references. */
|
||||
|
||||
/* These appear as input to LD, in a .o file. */
|
||||
#define N_SETA 0x14 /* Absolute set element symbol */
|
||||
#define N_SETT 0x16 /* Text set element symbol */
|
||||
#define N_SETD 0x18 /* Data set element symbol */
|
||||
#define N_SETB 0x1A /* Bss set element symbol */
|
||||
|
||||
/* This is output from LD. */
|
||||
#define N_SETV 0x1C /* Pointer to set vector in data area. */
|
||||
|
||||
/* Warning symbol. The text gives a warning message, the next symbol
|
||||
in the table will be undefined. When the symbol is referenced, the
|
||||
message is printed. */
|
||||
|
||||
#define N_WARNING 0x1e
|
||||
|
||||
/* Weak symbols. These are a GNU extension to the a.out format. The
|
||||
semantics are those of ELF weak symbols. Weak symbols are always
|
||||
externally visible. The N_WEAK? values are squeezed into the
|
||||
available slots. The value of a N_WEAKU symbol is 0. The values
|
||||
of the other types are the definitions. */
|
||||
#define N_WEAKU 0x0d /* Weak undefined symbol. */
|
||||
#define N_WEAKA 0x0e /* Weak absolute symbol. */
|
||||
#define N_WEAKT 0x0f /* Weak text symbol. */
|
||||
#define N_WEAKD 0x10 /* Weak data symbol. */
|
||||
#define N_WEAKB 0x11 /* Weak bss symbol. */
|
||||
|
||||
/* Relocations
|
||||
|
||||
There are two types of relocation flavours for a.out systems,
|
||||
standard and extended. The standard form is used on systems where the
|
||||
instruction has room for all the bits of an offset to the operand, whilst
|
||||
the extended form is used when an address operand has to be split over n
|
||||
instructions. Eg, on the 68k, each move instruction can reference
|
||||
the target with a displacement of 16 or 32 bits. On the sparc, move
|
||||
instructions use an offset of 14 bits, so the offset is stored in
|
||||
the reloc field, and the data in the section is ignored.
|
||||
*/
|
||||
|
||||
/* This structure describes a single relocation to be performed.
|
||||
The text-relocation section of the file is a vector of these structures,
|
||||
all of which apply to the text section.
|
||||
Likewise, the data-relocation section applies to the data section. */
|
||||
|
||||
struct reloc_std_external {
|
||||
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */
|
||||
bfd_byte r_index[3]; /* symbol table index of symbol */
|
||||
bfd_byte r_type[1]; /* relocation type */
|
||||
};
|
||||
|
||||
#define RELOC_STD_BITS_PCREL_BIG ((unsigned int) 0x80)
|
||||
#define RELOC_STD_BITS_PCREL_LITTLE ((unsigned int) 0x01)
|
||||
|
||||
#define RELOC_STD_BITS_LENGTH_BIG ((unsigned int) 0x60)
|
||||
#define RELOC_STD_BITS_LENGTH_SH_BIG 5
|
||||
#define RELOC_STD_BITS_LENGTH_LITTLE ((unsigned int) 0x06)
|
||||
#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1
|
||||
|
||||
#define RELOC_STD_BITS_EXTERN_BIG ((unsigned int) 0x10)
|
||||
#define RELOC_STD_BITS_EXTERN_LITTLE ((unsigned int) 0x08)
|
||||
|
||||
#define RELOC_STD_BITS_BASEREL_BIG ((unsigned int) 0x08)
|
||||
#define RELOC_STD_BITS_BASEREL_LITTLE ((unsigned int) 0x10)
|
||||
|
||||
#define RELOC_STD_BITS_JMPTABLE_BIG ((unsigned int) 0x04)
|
||||
#define RELOC_STD_BITS_JMPTABLE_LITTLE ((unsigned int) 0x20)
|
||||
|
||||
#define RELOC_STD_BITS_RELATIVE_BIG ((unsigned int) 0x02)
|
||||
#define RELOC_STD_BITS_RELATIVE_LITTLE ((unsigned int) 0x40)
|
||||
|
||||
#define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */
|
||||
|
||||
struct reloc_std_internal
|
||||
{
|
||||
bfd_vma r_address; /* Address (within segment) to be relocated. */
|
||||
/* The meaning of r_symbolnum depends on r_extern. */
|
||||
unsigned int r_symbolnum:24;
|
||||
/* Nonzero means value is a pc-relative offset
|
||||
and it should be relocated for changes in its own address
|
||||
as well as for changes in the symbol or section specified. */
|
||||
unsigned int r_pcrel:1;
|
||||
/* Length (as exponent of 2) of the field to be relocated.
|
||||
Thus, a value of 2 indicates 1<<2 bytes. */
|
||||
unsigned int r_length:2;
|
||||
/* 1 => relocate with value of symbol.
|
||||
r_symbolnum is the index of the symbol
|
||||
in files the symbol table.
|
||||
0 => relocate with the address of a segment.
|
||||
r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
|
||||
(the N_EXT bit may be set also, but signifies nothing). */
|
||||
unsigned int r_extern:1;
|
||||
/* The next three bits are for SunOS shared libraries, and seem to
|
||||
be undocumented. */
|
||||
unsigned int r_baserel:1; /* Linkage table relative */
|
||||
unsigned int r_jmptable:1; /* pc-relative to jump table */
|
||||
unsigned int r_relative:1; /* "relative relocation" */
|
||||
/* unused */
|
||||
unsigned int r_pad:1; /* Padding -- set to zero */
|
||||
};
|
||||
|
||||
|
||||
/* EXTENDED RELOCS */
|
||||
|
||||
struct reloc_ext_external {
|
||||
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */
|
||||
bfd_byte r_index[3]; /* symbol table index of symbol */
|
||||
bfd_byte r_type[1]; /* relocation type */
|
||||
bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */
|
||||
};
|
||||
|
||||
#define RELOC_EXT_BITS_EXTERN_BIG ((unsigned int) 0x80)
|
||||
#define RELOC_EXT_BITS_EXTERN_LITTLE ((unsigned int) 0x01)
|
||||
|
||||
#define RELOC_EXT_BITS_TYPE_BIG ((unsigned int) 0x1F)
|
||||
#define RELOC_EXT_BITS_TYPE_SH_BIG 0
|
||||
#define RELOC_EXT_BITS_TYPE_LITTLE ((unsigned int) 0xF8)
|
||||
#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3
|
||||
|
||||
/* Bytes per relocation entry */
|
||||
#define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD)
|
||||
|
||||
enum reloc_type
|
||||
{
|
||||
/* simple relocations */
|
||||
RELOC_8, /* data[0:7] = addend + sv */
|
||||
RELOC_16, /* data[0:15] = addend + sv */
|
||||
RELOC_32, /* data[0:31] = addend + sv */
|
||||
/* pc-rel displacement */
|
||||
RELOC_DISP8, /* data[0:7] = addend - pc + sv */
|
||||
RELOC_DISP16, /* data[0:15] = addend - pc + sv */
|
||||
RELOC_DISP32, /* data[0:31] = addend - pc + sv */
|
||||
/* Special */
|
||||
RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */
|
||||
RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */
|
||||
RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */
|
||||
RELOC_22, /* data[0:21] = (addend + sv) */
|
||||
RELOC_13, /* data[0:12] = (addend + sv) */
|
||||
RELOC_LO10, /* data[0:9] = (addend + sv) */
|
||||
RELOC_SFA_BASE,
|
||||
RELOC_SFA_OFF13,
|
||||
/* P.I.C. (base-relative) */
|
||||
RELOC_BASE10, /* Not sure - maybe we can do this the */
|
||||
RELOC_BASE13, /* right way now */
|
||||
RELOC_BASE22,
|
||||
/* for some sort of pc-rel P.I.C. (?) */
|
||||
RELOC_PC10,
|
||||
RELOC_PC22,
|
||||
/* P.I.C. jump table */
|
||||
RELOC_JMP_TBL,
|
||||
/* reputedly for shared libraries somehow */
|
||||
RELOC_SEGOFF16,
|
||||
RELOC_GLOB_DAT,
|
||||
RELOC_JMP_SLOT,
|
||||
RELOC_RELATIVE,
|
||||
|
||||
RELOC_11,
|
||||
RELOC_WDISP2_14,
|
||||
RELOC_WDISP19,
|
||||
RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */
|
||||
RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */
|
||||
|
||||
/* 29K relocation types */
|
||||
RELOC_JUMPTARG,
|
||||
RELOC_CONST,
|
||||
RELOC_CONSTH,
|
||||
|
||||
/* All the new ones I can think of, for sparc v9 */
|
||||
|
||||
RELOC_64, /* data[0:63] = addend + sv */
|
||||
RELOC_DISP64, /* data[0:63] = addend - pc + sv */
|
||||
RELOC_WDISP21, /* data[0:20] = (addend + sv - pc)>>2 */
|
||||
RELOC_DISP21, /* data[0:20] = addend - pc + sv */
|
||||
RELOC_DISP14, /* data[0:13] = addend - pc + sv */
|
||||
/* Q .
|
||||
What are the other ones,
|
||||
Since this is a clean slate, can we throw away the ones we dont
|
||||
understand ? Should we sort the values ? What about using a
|
||||
microcode format like the 68k ?
|
||||
*/
|
||||
NO_RELOC
|
||||
};
|
||||
|
||||
|
||||
struct reloc_internal {
|
||||
bfd_vma r_address; /* offset of of data to relocate */
|
||||
long r_index; /* symbol table index of symbol */
|
||||
enum reloc_type r_type; /* relocation type */
|
||||
bfd_vma r_addend; /* datum addend */
|
||||
};
|
||||
|
||||
/* Q.
|
||||
Should the length of the string table be 4 bytes or 8 bytes ?
|
||||
|
||||
Q.
|
||||
What about archive indexes ?
|
||||
|
||||
*/
|
||||
|
||||
#endif /* __A_OUT_64_H__ */
|
@ -1,36 +0,0 @@
|
||||
/* archive file definition for GNU software */
|
||||
|
||||
/* So far this is correct for BSDish archives. Don't forget that
|
||||
files must begin on an even byte boundary. */
|
||||
|
||||
#ifndef __GNU_AR_H__
|
||||
#define __GNU_AR_H__
|
||||
|
||||
/* Note that the usual '\n' in magic strings may translate to different
|
||||
characters, as allowed by ANSI. '\012' has a fixed value, and remains
|
||||
compatible with existing BSDish archives. */
|
||||
|
||||
#define ARMAG "!<arch>\012" /* For COFF and a.out archives */
|
||||
#define ARMAGB "!<bout>\012" /* For b.out archives */
|
||||
#define SARMAG 8
|
||||
#define ARFMAG "`\012"
|
||||
|
||||
/* The ar_date field of the armap (__.SYMDEF) member of an archive
|
||||
must be greater than the modified date of the entire file, or
|
||||
BSD-derived linkers complain. We originally write the ar_date with
|
||||
this offset from the real file's mod-time. After finishing the
|
||||
file, we rewrite ar_date if it's not still greater than the mod date. */
|
||||
|
||||
#define ARMAP_TIME_OFFSET 60
|
||||
|
||||
struct ar_hdr {
|
||||
char ar_name[16]; /* name of this member */
|
||||
char ar_date[12]; /* file mtime */
|
||||
char ar_uid[6]; /* owner uid; printed as decimal */
|
||||
char ar_gid[6]; /* owner gid; printed as decimal */
|
||||
char ar_mode[8]; /* file mode, printed as octal */
|
||||
char ar_size[10]; /* file size, printed as decimal */
|
||||
char ar_fmag[2]; /* should contain ARFMAG */
|
||||
};
|
||||
|
||||
#endif /* __GNU_AR_H__ */
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* a.out specifics for Sequent Symmetry running Dynix 3.x
|
||||
*/
|
||||
#ifndef A_OUT_DYNIX3_H
|
||||
#define A_OUT_DYNIX3_H
|
||||
|
||||
#define external_exec dynix_external_exec
|
||||
|
||||
/* struct exec for Dynix 3
|
||||
*
|
||||
* a_gdtbl and a_bootstrap are only for standalone binaries.
|
||||
* Shared data fields are not supported by the kernel as of Dynix 3.1,
|
||||
* but are supported by Dynix compiler programs.
|
||||
*/
|
||||
struct dynix_external_exec {
|
||||
unsigned char e_info[4];
|
||||
unsigned char e_text[4];
|
||||
unsigned char e_data[4];
|
||||
unsigned char e_bss[4];
|
||||
unsigned char e_syms[4];
|
||||
unsigned char e_entry[4];
|
||||
unsigned char e_trsize[4];
|
||||
unsigned char e_drsize[4];
|
||||
unsigned char e_g_code[8], e_g_data[8], e_g_desc[8];
|
||||
unsigned char e_shdata[4];
|
||||
unsigned char e_shbss[4];
|
||||
unsigned char e_shdrsize[4];
|
||||
unsigned char e_bootstrap[44];
|
||||
unsigned char e_reserved[12];
|
||||
unsigned char e_version[4];
|
||||
};
|
||||
|
||||
#define EXEC_BYTES_SIZE (128)
|
||||
|
||||
/*
|
||||
* All executables under Dynix are demand paged with read-only text,
|
||||
* Thus no NMAGIC.
|
||||
*
|
||||
* ZMAGIC has a page of 0s at virtual 0,
|
||||
* XMAGIC has an invalid page at virtual 0
|
||||
*/
|
||||
#define OMAGIC 0x12eb /* .o */
|
||||
#define ZMAGIC 0x22eb /* zero @ 0, demand load */
|
||||
#define XMAGIC 0x32eb /* invalid @ 0, demand load */
|
||||
#define SMAGIC 0x42eb /* standalone, not supported here */
|
||||
|
||||
#define N_BADMAG(x) ((OMAGIC != N_MAGIC(x)) && \
|
||||
(ZMAGIC != N_MAGIC(x)) && \
|
||||
(XMAGIC != N_MAGIC(x)) && \
|
||||
(SMAGIC != N_MAGIC(x)))
|
||||
|
||||
#define N_ADDRADJ(x) ((ZMAGIC == N_MAGIC(x) || XMAGIC == N_MAGIC(x)) ? 0x1000 : 0)
|
||||
|
||||
#define N_TXTOFF(x) (EXEC_BYTES_SIZE)
|
||||
#define N_DATOFF(x) (N_TXTOFF(x) + N_TXTSIZE(x))
|
||||
#define N_SHDATOFF(x) (N_DATOFF(x) + (x).a_data)
|
||||
#define N_TRELOFF(x) (N_SHDATOFF(x) + (x).a_shdata)
|
||||
#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
|
||||
#define N_SHDRELOFF(x) (N_DRELOFF(x) + (x).a_drsize)
|
||||
#define N_SYMOFF(x) (N_SHDRELOFF(x) + (x).a_shdrsize)
|
||||
#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
|
||||
|
||||
#define N_TXTADDR(x) \
|
||||
(((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? 0 \
|
||||
: TEXT_START_ADDR + EXEC_BYTES_SIZE)
|
||||
|
||||
#define N_TXTSIZE(x) \
|
||||
(((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? ((x).a_text) \
|
||||
: ((x).a_text - N_ADDRADJ(x) - EXEC_BYTES_SIZE))
|
||||
|
||||
#endif /* A_OUT_DYNIX3_H */
|
@ -1,135 +0,0 @@
|
||||
/* Yet Another Try at encapsulating bsd object files in coff.
|
||||
Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc.
|
||||
Written by Pace Willisson 12/9/88
|
||||
|
||||
This file is obsolete. It needs to be converted to just define a bunch
|
||||
of stuff that BFD can use to do coff-encapsulated files. --gnu@cygnus.com
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
* We only use the coff headers to tell the kernel
|
||||
* how to exec the file. Therefore, the only fields that need to
|
||||
* be filled in are the scnptr and vaddr for the text and data
|
||||
* sections, and the vaddr for the bss. As far as coff is concerned,
|
||||
* there is no symbol table, relocation, or line numbers.
|
||||
*
|
||||
* A normal bsd header (struct exec) is placed after the coff headers,
|
||||
* and before the real text. I defined a the new fields 'a_machtype'
|
||||
* and a_flags. If a_machtype is M_386, and a_flags & A_ENCAP is
|
||||
* true, then the bsd header is preceeded by a coff header. Macros
|
||||
* like N_TXTOFF and N_TXTADDR use this field to find the bsd header.
|
||||
*
|
||||
* The only problem is to track down the bsd exec header. The
|
||||
* macros HEADER_OFFSET, etc do this.
|
||||
*/
|
||||
|
||||
#define N_FLAGS_COFF_ENCAPSULATE 0x20 /* coff header precedes bsd header */
|
||||
|
||||
/* Describe the COFF header used for encapsulation. */
|
||||
|
||||
struct coffheader
|
||||
{
|
||||
/* filehdr */
|
||||
unsigned short f_magic;
|
||||
unsigned short f_nscns;
|
||||
long f_timdat;
|
||||
long f_symptr;
|
||||
long f_nsyms;
|
||||
unsigned short f_opthdr;
|
||||
unsigned short f_flags;
|
||||
/* aouthdr */
|
||||
short magic;
|
||||
short vstamp;
|
||||
long tsize;
|
||||
long dsize;
|
||||
long bsize;
|
||||
long entry;
|
||||
long text_start;
|
||||
long data_start;
|
||||
struct coffscn
|
||||
{
|
||||
char s_name[8];
|
||||
long s_paddr;
|
||||
long s_vaddr;
|
||||
long s_size;
|
||||
long s_scnptr;
|
||||
long s_relptr;
|
||||
long s_lnnoptr;
|
||||
unsigned short s_nreloc;
|
||||
unsigned short s_nlnno;
|
||||
long s_flags;
|
||||
} scns[3];
|
||||
};
|
||||
|
||||
/* Describe some of the parameters of the encapsulation,
|
||||
including how to find the encapsulated BSD header. */
|
||||
|
||||
/* FIXME, this is dumb. The same tools can't handle a.outs for different
|
||||
architectures, just because COFF_MAGIC is different; so you need a
|
||||
separate GNU nm for every architecture!!? Unfortunately, it needs to
|
||||
be this way, since the COFF_MAGIC value is determined by the kernel
|
||||
we're trying to fool here. */
|
||||
|
||||
#define COFF_MAGIC_I386 0514 /* I386MAGIC */
|
||||
#define COFF_MAGIC_M68K 0520 /* MC68MAGIC */
|
||||
#define COFF_MAGIC_A29K 0x17A /* Used by asm29k cross-tools */
|
||||
|
||||
#ifdef COFF_MAGIC
|
||||
short __header_offset_temp;
|
||||
#define HEADER_OFFSET(f) \
|
||||
(__header_offset_temp = 0, \
|
||||
fread ((char *)&__header_offset_temp, sizeof (short), 1, (f)), \
|
||||
fseek ((f), -sizeof (short), 1), \
|
||||
__header_offset_temp==COFF_MAGIC ? sizeof(struct coffheader) : 0)
|
||||
#else
|
||||
#define HEADER_OFFSET(f) 0
|
||||
#endif
|
||||
|
||||
#define HEADER_SEEK(f) (fseek ((f), HEADER_OFFSET((f)), 1))
|
||||
|
||||
/* Describe the characteristics of the BSD header
|
||||
that appears inside the encapsulation. */
|
||||
|
||||
/* Encapsulated coff files that are linked ZMAGIC have a text segment
|
||||
offset just past the header (and a matching TXTADDR), excluding
|
||||
the headers from the text segment proper but keeping the physical
|
||||
layout and the virtual memory layout page-aligned.
|
||||
|
||||
Non-encapsulated a.out files that are linked ZMAGIC have a text
|
||||
segment that starts at 0 and an N_TXTADR similarly offset to 0.
|
||||
They too are page-aligned with each other, but they include the
|
||||
a.out header as part of the text.
|
||||
|
||||
The _N_HDROFF gets sizeof struct exec added to it, so we have
|
||||
to compensate here. See <a.out.gnu.h>. */
|
||||
|
||||
#undef _N_HDROFF
|
||||
#undef N_TXTADDR
|
||||
#undef N_DATADDR
|
||||
|
||||
#define _N_HDROFF(x) ((N_FLAGS(x) & N_FLAGS_COFF_ENCAPSULATE) ? \
|
||||
sizeof (struct coffheader) : 0)
|
||||
|
||||
/* Address of text segment in memory after it is loaded. */
|
||||
#define N_TXTADDR(x) \
|
||||
((N_FLAGS(x) & N_FLAGS_COFF_ENCAPSULATE) ? \
|
||||
sizeof (struct coffheader) + sizeof (struct exec) : 0)
|
||||
#define SEGMENT_SIZE 0x400000
|
||||
|
||||
#define N_DATADDR(x) \
|
||||
((N_FLAGS(x) & N_FLAGS_COFF_ENCAPSULATE) ? \
|
||||
(SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1))) : \
|
||||
(N_TXTADDR(x)+(x).a_text))
|
@ -1,22 +0,0 @@
|
||||
/* Parameters about the a.out format, based on the host system on which
|
||||
the program is compiled. */
|
||||
|
||||
/* Address of data segment in memory after it is loaded.
|
||||
It is up to you to define SEGMENT_SIZE
|
||||
on machines not listed here. */
|
||||
#ifndef SEGMENT_SIZE
|
||||
#if defined(hp300) || defined(pyr)
|
||||
#define SEGMENT_SIZE page_size
|
||||
#endif
|
||||
#ifdef sony
|
||||
#define SEGMENT_SIZE 0x1000
|
||||
#endif /* Sony. */
|
||||
#ifdef is68k
|
||||
#define SEGMENT_SIZE 0x20000
|
||||
#endif
|
||||
#if defined(m68k) && defined(PORTAR)
|
||||
#define TARGET_PAGE_SIZE 0x400
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#endif
|
||||
#endif /*!defined(SEGMENT_SIZE)*/
|
||||
|
@ -1,82 +0,0 @@
|
||||
/* Special version of <a.out.h> for use under hp-ux.
|
||||
Copyright 1988, 1991 Free Software Foundation, Inc.
|
||||
|
||||
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 2 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* THIS FILE IS OBSOLETE. It needs to be revised as a variant "external"
|
||||
a.out format for use with BFD. */
|
||||
|
||||
/* The `exec' structure and overall layout must be close to HP's when
|
||||
we are running on an HP system, otherwise we will not be able to
|
||||
execute the resulting file. */
|
||||
|
||||
/* Allow this file to be included twice. */
|
||||
#ifndef __GNU_EXEC_MACROS__
|
||||
|
||||
struct exec
|
||||
{
|
||||
unsigned short a_machtype; /* machine type */
|
||||
unsigned short a_magic; /* magic number */
|
||||
unsigned long a_spare1;
|
||||
unsigned long a_spare2;
|
||||
unsigned long a_text; /* length of text, in bytes */
|
||||
unsigned long a_data; /* length of data, in bytes */
|
||||
unsigned long a_bss; /* length of uninitialized data area for file, in bytes */
|
||||
unsigned long a_trsize; /* length of relocation info for text, in bytes */
|
||||
unsigned long a_drsize; /* length of relocation info for data, in bytes */
|
||||
unsigned long a_spare3; /* HP = pascal interface size */
|
||||
unsigned long a_spare4; /* HP = symbol table size */
|
||||
unsigned long a_spare5; /* HP = debug name table size */
|
||||
unsigned long a_entry; /* start address */
|
||||
unsigned long a_spare6; /* HP = source line table size */
|
||||
unsigned long a_spare7; /* HP = value table size */
|
||||
unsigned long a_syms; /* length of symbol table data in file, in bytes */
|
||||
unsigned long a_spare8;
|
||||
};
|
||||
|
||||
/* Tell a.out.gnu.h not to define `struct exec'. */
|
||||
#define __STRUCT_EXEC_OVERRIDE__
|
||||
|
||||
#include "../a.out.gnu.h"
|
||||
|
||||
#undef N_MAGIC
|
||||
#undef N_MACHTYPE
|
||||
#undef N_FLAGS
|
||||
#undef N_SET_INFO
|
||||
#undef N_SET_MAGIC
|
||||
#undef N_SET_MACHTYPE
|
||||
#undef N_SET_FLAGS
|
||||
|
||||
#define N_MAGIC(exec) ((exec) . a_magic)
|
||||
#define N_MACHTYPE(exec) ((exec) . a_machtype)
|
||||
#define N_SET_MAGIC(exec, magic) (((exec) . a_magic) = (magic))
|
||||
#define N_SET_MACHTYPE(exec, machtype) (((exec) . a_machtype) = (machtype))
|
||||
|
||||
#undef N_BADMAG
|
||||
#define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x)))
|
||||
|
||||
#define _N_BADMACH(x) \
|
||||
(((N_MACHTYPE (x)) != HP9000S200_ID) && \
|
||||
((N_MACHTYPE (x)) != HP98x6_ID))
|
||||
|
||||
#define HP98x6_ID 0x20A
|
||||
#define HP9000S200_ID 0x20C
|
||||
|
||||
#undef _N_HDROFF
|
||||
#define _N_HDROFF(x) (SEGMENT_SIZE - (sizeof (struct exec)))
|
||||
|
||||
#define SEGMENT_SIZE 0x1000
|
||||
|
||||
#endif /* __GNU_EXEC_MACROS__ */
|
@ -1,119 +0,0 @@
|
||||
/* Special version of <a.out.h> for use under hp-ux.
|
||||
Copyright (C) 1988,1993 Free Software Foundation, Inc. */
|
||||
|
||||
struct hp300hpux_exec_bytes
|
||||
{
|
||||
unsigned char e_info[4]; /* a_machtype/a_magic */
|
||||
unsigned char e_spare1[4];
|
||||
unsigned char e_spare2[4];
|
||||
unsigned char e_text[4]; /* length of text, in bytes */
|
||||
unsigned char e_data[4]; /* length of data, in bytes */
|
||||
unsigned char e_bss[4]; /* length of uninitialized data area , in bytes */
|
||||
unsigned char e_trsize[4]; /* length of relocation info for text, in bytes*/
|
||||
unsigned char e_drsize[4]; /* length of relocation info for data, in bytes*/
|
||||
unsigned char e_passize[4];/* HP = pascal interface size */
|
||||
unsigned char e_syms[4]; /* HP = symbol table size */
|
||||
unsigned char e_spare5[4]; /* HP = debug name table size */
|
||||
unsigned char e_entry[4]; /* start address */
|
||||
unsigned char e_spare6[4]; /* HP = source line table size */
|
||||
unsigned char e_supsize[4];/* HP = value table size */
|
||||
unsigned char e_drelocs[4];
|
||||
unsigned char e_extension[4]; /* file offset of extension */
|
||||
};
|
||||
#define EXEC_BYTES_SIZE 64
|
||||
|
||||
struct hp300hpux_nlist_bytes
|
||||
{
|
||||
unsigned char e_value[4];
|
||||
unsigned char e_type[1];
|
||||
unsigned char e_length[1]; /* length of ascii symbol name */
|
||||
unsigned char e_almod[2]; /* alignment mod */
|
||||
unsigned char e_shlib[2]; /* info about dynamic linking */
|
||||
};
|
||||
#define EXTERNAL_NLIST_SIZE 10
|
||||
|
||||
struct hp300hpux_reloc
|
||||
{
|
||||
unsigned char r_address[4];/* offset of of data to relocate */
|
||||
unsigned char r_index[2]; /* symbol table index of symbol */
|
||||
unsigned char r_type[1]; /* relocation type */
|
||||
unsigned char r_length[1]; /* length of item to reloc */
|
||||
};
|
||||
|
||||
struct hp300hpux_header_extension
|
||||
{
|
||||
unsigned char e_syms[4];
|
||||
unsigned char unique_headers[12*4];
|
||||
unsigned char e_header[2]; /* type of header */
|
||||
unsigned char e_version[2]; /* version */
|
||||
unsigned char e_size[4]; /* bytes following*/
|
||||
unsigned char e_extension[4];/* file offset of next extension */
|
||||
};
|
||||
#define EXTERNAL_EXTENSION_HEADER_SIZE (16*4)
|
||||
|
||||
/* hpux separates object files (0x106) and impure executables (0x107) */
|
||||
/* but the bfd code does not distinguish between them. Since we want to*/
|
||||
/* read hpux .o files, we add an special define and use it below in */
|
||||
/* offset and address calculations. */
|
||||
|
||||
#define HPUX_DOT_O_MAGIC 0x106
|
||||
#define OMAGIC 0x107 /* object file or impure executable. */
|
||||
#define NMAGIC 0x108 /* Code indicating pure executable. */
|
||||
#define ZMAGIC 0x10B /* demand-paged executable. */
|
||||
|
||||
#define N_HEADER_IN_TEXT(x) 0
|
||||
|
||||
#if 0 /* libaout.h only uses the lower 8 bits */
|
||||
#define HP98x6_ID 0x20A
|
||||
#define HP9000S200_ID 0x20C
|
||||
#endif
|
||||
#define HP98x6_ID 0x0A
|
||||
#define HP9000S200_ID 0x0C
|
||||
|
||||
#define N_BADMAG(x) ((_N_BADMAG (x)) || (_N_BADMACH (x)))
|
||||
|
||||
#define N_DATADDR(x) \
|
||||
((N_MAGIC(x)==OMAGIC || N_MAGIC(x)==HPUX_DOT_O_MAGIC) ? \
|
||||
(N_TXTADDR(x)+N_TXTSIZE(x)) \
|
||||
: (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1))))
|
||||
|
||||
#define _N_BADMACH(x) \
|
||||
(((N_MACHTYPE (x)) != HP9000S200_ID) && \
|
||||
((N_MACHTYPE (x)) != HP98x6_ID))
|
||||
|
||||
#define _N_BADMAG(x) (N_MAGIC(x) != HPUX_DOT_O_MAGIC \
|
||||
&& N_MAGIC(x) != OMAGIC \
|
||||
&& N_MAGIC(x) != NMAGIC \
|
||||
&& N_MAGIC(x) != ZMAGIC )
|
||||
|
||||
#undef _N_HDROFF
|
||||
#define _N_HDROFF(x) (SEGMENT_SIZE - (sizeof (struct exec)))
|
||||
|
||||
#undef N_DATOFF
|
||||
#undef N_PASOFF
|
||||
#undef N_SYMOFF
|
||||
#undef N_SUPOFF
|
||||
#undef N_TRELOFF
|
||||
#undef N_DRELOFF
|
||||
#undef N_STROFF
|
||||
|
||||
#define N_DATOFF(x) ( N_TXTOFF(x) + N_TXTSIZE(x) )
|
||||
#define N_PASOFF(x) ( N_DATOFF(x) + (x).a_data)
|
||||
#define N_SYMOFF(x) ( N_PASOFF(x) /* + (x).a_passize*/ )
|
||||
#define N_SUPOFF(x) ( N_SYMOFF(x) + (x).a_syms )
|
||||
#define N_TRELOFF(x) ( N_SUPOFF(x) /* + 0 (x).a_supsize*/ )
|
||||
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
|
||||
#define N_EXTHOFF(x) ( N_DRELOFF(x) /* + 0 (x).a_drsize */)
|
||||
#define N_STROFF(x) ( 0 /* no string table */ )
|
||||
|
||||
/* use these when the file has gnu symbol tables */
|
||||
#define N_GNU_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
|
||||
#define N_GNU_DRELOFF(x) (N_GNU_TRELOFF(x) + (x).a_trsize)
|
||||
#define N_GNU_SYMOFF(x) (N_GNU_DRELOFF(x) + (x).a_drsize)
|
||||
|
||||
#define TARGET_PAGE_SIZE 0x1000
|
||||
#define SEGMENT_SIZE 0x1000
|
||||
#define TEXT_START_ADDR 0
|
||||
|
||||
#undef N_SHARED_LIB
|
||||
#define N_SHARED_LIB(x) ( 0 /* no shared libraries */ )
|
@ -1,7 +0,0 @@
|
||||
#include "filehdr.h"
|
||||
#include "aouthdr.h"
|
||||
#include "scnhdr.h"
|
||||
#include "spacehdr.h"
|
||||
#include "syms.h"
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user