This commit was generated by cvs2svn to track changes on a CVS vendor
branch.
This commit is contained in:
commit
5b64ad42d3
|
@ -0,0 +1,30 @@
|
|||
*-all
|
||||
*-co
|
||||
*-dirs
|
||||
*-done
|
||||
*-install-info
|
||||
*-src
|
||||
*-stamp-*
|
||||
*-tagged
|
||||
blockit
|
||||
cfg-paper.info
|
||||
config.status
|
||||
configure.aux
|
||||
configure.cp
|
||||
configure.cps
|
||||
configure.dvi
|
||||
configure.fn
|
||||
configure.fns
|
||||
configure.ky
|
||||
configure.kys
|
||||
configure.log
|
||||
configure.pg
|
||||
configure.pgs
|
||||
configure.toc
|
||||
configure.tp
|
||||
configure.tps
|
||||
configure.vr
|
||||
configure.vrs
|
||||
dir.info
|
||||
Makefile
|
||||
lost+found
|
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 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
|
||||
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
|
|
@ -0,0 +1,482 @@
|
|||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, 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 library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, 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 companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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 Library or any portion
|
||||
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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.
|
||||
|
||||
11. 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,47 @@
|
|||
README for GNU development tools
|
||||
|
||||
This directory contains various GNU compilers, assemblers, linkers,
|
||||
debuggers, etc., plus their support routines, definitions, and documentation.
|
||||
|
||||
If you are receiving this as part of a GDB release, see the file gdb/README.
|
||||
If with a binutils release, see binutils/README; if with a libg++ release,
|
||||
see libg++/README, etc. That'll give you info about this
|
||||
package -- supported targets, how to use it, how to report bugs, etc.
|
||||
|
||||
It is now possible to automatically configure and build a variety of
|
||||
tools with one command. To build all of the tools contained herein,
|
||||
run the ``configure'' script here, e.g.:
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
To install them (by default in /usr/local/bin, /usr/local/lib, etc),
|
||||
then do:
|
||||
make install
|
||||
|
||||
(If the configure script can't determine your type of computer, give it
|
||||
the name as an argument, for instance ``./configure sun4''. You can
|
||||
use the script ``config.sub'' to test whether a name is recognized; if
|
||||
it is, config.sub translates it to a triplet specifying CPU, vendor,
|
||||
and OS.)
|
||||
|
||||
If you have more than one compiler on your system, it is often best to
|
||||
explicitly set CC in the environment before running configure, and to
|
||||
also set CC when running make. For example (assuming sh/bash/ksh):
|
||||
|
||||
CC=gcc ./configure
|
||||
make
|
||||
|
||||
A similar example using csh:
|
||||
|
||||
setenv CC gcc
|
||||
./configure
|
||||
make
|
||||
|
||||
Much of the code and documentation enclosed is copyright by
|
||||
the Free Software Foundation, Inc. See the file COPYING or
|
||||
COPYING.LIB in the various directories, for a description of the
|
||||
GNU General Public License terms under which you can copy the files.
|
||||
|
||||
REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
|
||||
on where and how to report problems.
|
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 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
|
||||
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,83 @@
|
|||
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>"
|
|
@ -0,0 +1,49 @@
|
|||
BFD is a an object file library. It permits applications to use the
|
||||
same routines to process object files regardless of their format.
|
||||
|
||||
BFD is used by the GNU debugger, assembler, linker, and the binary
|
||||
utilities.
|
||||
|
||||
The documentation on using BFD is scanty and may be occasionally
|
||||
incorrect. Pointers to documentation problems, or an entirely
|
||||
rewritten manual, would be appreciated.
|
||||
|
||||
There is some BFD internals documentation in doc/bfdint.texi which may
|
||||
help programmers who want to modify BFD.
|
||||
|
||||
BFD is normally built as part of another package. See the build
|
||||
instructions for that package, probably in a README file in the
|
||||
appropriate directory.
|
||||
|
||||
BFD supports the following configure options:
|
||||
|
||||
--target=TARGET
|
||||
The default target for which to build the library. TARGET is
|
||||
a configuration target triplet, such as sparc-sun-solaris.
|
||||
--enable-targets=TARGET,TARGET,TARGET...
|
||||
Additional targets the library should support. To include
|
||||
support for all known targets, use --enable-targets=all.
|
||||
--enable-64-bit-bfd
|
||||
Include support for 64 bit targets. This is automatically
|
||||
turned on if you explicitly request a 64 bit target, but not
|
||||
for --enable-targets=all. This requires a compiler with a 64
|
||||
bit integer type, such as gcc.
|
||||
--enable-shared
|
||||
Build BFD as a shared library.
|
||||
--with-mmap
|
||||
Use mmap when accessing files. This is faster on some hosts,
|
||||
but slower on others. It may not work on all hosts.
|
||||
|
||||
Report bugs with BFD to bug-gnu-utils@gnu.org.
|
||||
|
||||
Patches are encouraged. When sending patches, always send the output
|
||||
of diff -u or diff -c from the original file to the new file. Do not
|
||||
send default diff output. Do not make the diff from the new file to
|
||||
the original file. Remember that any patch must not break other
|
||||
systems. Remember that BFD must support cross compilation from any
|
||||
host to any target, so patches which use ``#ifdef HOST'' are not
|
||||
acceptable. Please also read the ``Reporting Bugs'' section of the
|
||||
gcc manual.
|
||||
|
||||
Bug reports without patches will be remembered, but they may never get
|
||||
fixed until somebody volunteers to fix them.
|
|
@ -0,0 +1,25 @@
|
|||
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 unneeded 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.
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
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
|
||||
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows)
|
||||
changequote([,])dnl
|
||||
AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
|
||||
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.
|
||||
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)
|
||||
# Also set EXEEXT_FOR_BUILD.
|
||||
if test "x$cross_compiling" = "xno"; then
|
||||
EXEEXT_FOR_BUILD='$(EXEEXT)'
|
||||
else
|
||||
AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
|
||||
[cat > ac_c_test.c << 'EOF'
|
||||
int main() {
|
||||
/* Nothing needed here */
|
||||
}
|
||||
EOF
|
||||
${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
|
||||
bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
|
||||
rm -f ac_c_test*
|
||||
test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
|
||||
EXEEXT_FOR_BUILD=""
|
||||
test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
|
||||
fi
|
||||
AC_SUBST(EXEEXT_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_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
#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
|
||||
AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
|
||||
[Define if $1 is not declared in system header files.])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
dnl Check for existence of a type $1 in sys/procfs.h
|
||||
|
||||
AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
|
||||
[AC_MSG_CHECKING([for $1 in sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[$1 avar],
|
||||
bfd_cv_have_sys_procfs_type_$1=yes,
|
||||
bfd_cv_have_sys_procfs_type_$1=no
|
||||
)])
|
||||
if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
|
||||
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
|
||||
[Define if <sys/procfs.h> has $1.])
|
||||
fi
|
||||
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
|
||||
])
|
||||
|
||||
|
||||
dnl Check for existence of member $2 in type $1 in sys/procfs.h
|
||||
|
||||
AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
|
||||
[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[$1 avar; void* aref = (void*) &avar.$2],
|
||||
bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
|
||||
bfd_cv_have_sys_procfs_type_member_$1_$2=no
|
||||
)])
|
||||
if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
|
||||
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
|
||||
[Define if <sys/procfs.h> has $1.$2.])
|
||||
fi
|
||||
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
|
||||
])
|
||||
|
||||
|
|
@ -0,0 +1,861 @@
|
|||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
||||
|
||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
dnl PARTICULAR PURPOSE.
|
||||
|
||||
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
|
||||
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows)
|
||||
changequote([,])dnl
|
||||
AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
|
||||
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.
|
||||
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)
|
||||
# Also set EXEEXT_FOR_BUILD.
|
||||
if test "x$cross_compiling" = "xno"; then
|
||||
EXEEXT_FOR_BUILD='$(EXEEXT)'
|
||||
else
|
||||
AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
|
||||
[cat > ac_c_test.c << 'EOF'
|
||||
int main() {
|
||||
/* Nothing needed here */
|
||||
}
|
||||
EOF
|
||||
${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
|
||||
bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
|
||||
rm -f ac_c_test*
|
||||
test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
|
||||
EXEEXT_FOR_BUILD=""
|
||||
test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
|
||||
fi
|
||||
AC_SUBST(EXEEXT_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_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
#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
|
||||
AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
|
||||
[Define if $1 is not declared in system header files.])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
dnl Check for existence of a type $1 in sys/procfs.h
|
||||
|
||||
AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
|
||||
[AC_MSG_CHECKING([for $1 in sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[$1 avar],
|
||||
bfd_cv_have_sys_procfs_type_$1=yes,
|
||||
bfd_cv_have_sys_procfs_type_$1=no
|
||||
)])
|
||||
if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
|
||||
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
|
||||
[Define if <sys/procfs.h> has $1.])
|
||||
fi
|
||||
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
|
||||
])
|
||||
|
||||
|
||||
dnl Check for existence of member $2 in type $1 in sys/procfs.h
|
||||
|
||||
AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
|
||||
[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[$1 avar; void* aref = (void*) &avar.$2],
|
||||
bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
|
||||
bfd_cv_have_sys_procfs_type_member_$1_$2=no
|
||||
)])
|
||||
if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
|
||||
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
|
||||
[Define if <sys/procfs.h> has $1.$2.])
|
||||
fi
|
||||
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
|
||||
])
|
||||
|
||||
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
VERSION=[$2]
|
||||
AC_SUBST(VERSION)
|
||||
dnl test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
ifelse([$3],,
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
|
||||
AC_REQUIRE([AM_SANITY_CHECK])
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])
|
||||
dnl FIXME This is truly gross.
|
||||
missing_dir=`cd $ac_aux_dir && pwd`
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
|
||||
AC_DEFUN(AM_SANITY_CHECK,
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftestfile
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
||||
if test "[$]*" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftestfile`
|
||||
fi
|
||||
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
||||
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "[$]2" = conftestfile
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
rm -f conftest*
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
||||
dnl The program must properly implement --version.
|
||||
AC_DEFUN(AM_MISSING_PROG,
|
||||
[AC_MSG_CHECKING(for working $2)
|
||||
# Run test in a subshell; some versions of sh will print an error if
|
||||
# an executable is not found, even if stderr is redirected.
|
||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
||||
$1=$2
|
||||
AC_MSG_RESULT(found)
|
||||
else
|
||||
$1="$3/missing $2"
|
||||
AC_MSG_RESULT(missing)
|
||||
fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# serial 25 AM_PROG_LIBTOOL
|
||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AM_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AM_PROG_LD])dnl
|
||||
AC_REQUIRE([AM_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags=
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$host" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
;;
|
||||
|
||||
*-*-cygwin*)
|
||||
AM_SYS_LIBTOOL_CYGWIN
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
# AM_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AM_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AM_ENABLE_SHARED,
|
||||
[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AM_DISABLE_SHARED,
|
||||
[AM_ENABLE_SHARED(no)])
|
||||
|
||||
# AM_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AM_DISABLE_STATIC,
|
||||
[AM_ENABLE_STATIC(no)])
|
||||
|
||||
# AM_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AM_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AM_ENABLE_STATIC,
|
||||
[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AM_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
/* | [A-Za-z]:\\*)
|
||||
changequote([,])dnl
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_SUBST(LD)
|
||||
AM_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AM_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AM_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
else
|
||||
ac_cv_path_NM="$ac_dir/nm"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(NM)
|
||||
])
|
||||
|
||||
# AM_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin
|
||||
AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN,
|
||||
[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
])
|
||||
|
||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
||||
|
||||
AC_DEFUN(AM_CONFIG_HEADER,
|
||||
[AC_PREREQ([2.12])
|
||||
AC_CONFIG_HEADER([$1])
|
||||
dnl When config.status generates a header, we must update the stamp-h file.
|
||||
dnl This file resides in the same directory as the config header
|
||||
dnl that is generated. We must strip everything past the first ":",
|
||||
dnl and everything past the last "/".
|
||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
||||
<<am_indx=1
|
||||
for am_file in <<$1>>; do
|
||||
case " <<$>>CONFIG_HEADERS " in
|
||||
*" <<$>>am_file "*<<)>>
|
||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
||||
;;
|
||||
esac
|
||||
am_indx=`expr "<<$>>am_indx" + 1`
|
||||
done<<>>dnl>>)
|
||||
changequote([,]))])
|
||||
|
||||
# Add --enable-maintainer-mode option to configure.
|
||||
# From Jim Meyering
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode is disabled by default
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
||||
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
|
||||
MAINT=$MAINTAINER_MODE_TRUE
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
|
||||
# Define a conditional.
|
||||
|
||||
AC_DEFUN(AM_CONDITIONAL,
|
||||
[AC_SUBST($1_TRUE)
|
||||
AC_SUBST($1_FALSE)
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi])
|
||||
|
||||
# This file is derived from `gettext.m4'. The difference is that the
|
||||
# included macros assume Cygnus-style source and build trees.
|
||||
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 3
|
||||
|
||||
AC_DEFUN(CY_WITH_NLS,
|
||||
[AC_MSG_CHECKING([whether NLS is requested])
|
||||
dnl Default is enabled NLS
|
||||
AC_ARG_ENABLE(nls,
|
||||
[ --disable-nls do not use Native Language Support],
|
||||
USE_NLS=$enableval, USE_NLS=yes)
|
||||
AC_MSG_RESULT($USE_NLS)
|
||||
AC_SUBST(USE_NLS)
|
||||
|
||||
USE_INCLUDED_LIBINTL=no
|
||||
|
||||
dnl If we use NLS figure out what method
|
||||
if test "$USE_NLS" = "yes"; then
|
||||
AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
|
||||
AC_MSG_CHECKING([whether included gettext is requested])
|
||||
AC_ARG_WITH(included-gettext,
|
||||
[ --with-included-gettext use the GNU gettext library included here],
|
||||
nls_cv_force_use_gnu_gettext=$withval,
|
||||
nls_cv_force_use_gnu_gettext=no)
|
||||
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
||||
|
||||
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
||||
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
||||
dnl User does not insist on using GNU NLS library. Figure out what
|
||||
dnl to use. If gettext or catgets are available (in this order) we
|
||||
dnl use this. Else we have to fall back to GNU NLS library.
|
||||
dnl catgets is only used if permitted by option --with-catgets.
|
||||
nls_cv_header_intl=
|
||||
nls_cv_header_libgt=
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_TRY_LINK([], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)])])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT, 1,
|
||||
[Define as 1 if you have gettext and don't want to use GNU gettext.])
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
if test "$MSGFMT" != "no"; then
|
||||
AC_CHECK_FUNCS(dcgettext)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
||||
return _nl_msg_cat_cntr],
|
||||
[CATOBJEXT=.gmo
|
||||
DATADIRNAME=share],
|
||||
[CATOBJEXT=.mo
|
||||
DATADIRNAME=lib])
|
||||
INSTOBJEXT=.mo
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
dnl In the standard gettext, we would now check for catgets.
|
||||
dnl However, we never want to use catgets for our releases.
|
||||
|
||||
if test "$CATOBJEXT" = "NONE"; then
|
||||
dnl Neither gettext nor catgets in included in the C library.
|
||||
dnl Fall back on GNU gettext library.
|
||||
nls_cv_use_gnu_gettext=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
||||
dnl Mark actions used to generate GNU NLS library.
|
||||
INTLOBJS="\$(GETTOBJS)"
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
||||
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
||||
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
||||
AC_SUBST(MSGFMT)
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
CATOBJEXT=.gmo
|
||||
INSTOBJEXT=.mo
|
||||
DATADIRNAME=share
|
||||
INTLDEPS='$(top_builddir)/../intl/libintl.a'
|
||||
INTLLIBS=$INTLDEPS
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
nls_cv_header_intl=libintl.h
|
||||
nls_cv_header_libgt=libgettext.h
|
||||
fi
|
||||
|
||||
dnl Test whether we really found GNU xgettext.
|
||||
if test "$XGETTEXT" != ":"; then
|
||||
dnl If it is no GNU xgettext we define it as : so that the
|
||||
dnl Makefiles still can work.
|
||||
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
|
||||
: ;
|
||||
else
|
||||
AC_MSG_RESULT(
|
||||
[found xgettext programs is not GNU xgettext; ignore it])
|
||||
XGETTEXT=":"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We need to process the po/ directory.
|
||||
POSUB=po
|
||||
else
|
||||
DATADIRNAME=share
|
||||
nls_cv_header_intl=libintl.h
|
||||
nls_cv_header_libgt=libgettext.h
|
||||
fi
|
||||
|
||||
# If this is used in GNU gettext we have to set USE_NLS to `yes'
|
||||
# because some of the sources are only built for this goal.
|
||||
if test "$PACKAGE" = gettext; then
|
||||
USE_NLS=yes
|
||||
USE_INCLUDED_LIBINTL=yes
|
||||
fi
|
||||
|
||||
dnl These rules are solely for the distribution goal. While doing this
|
||||
dnl we only have to keep exactly one list of the available catalogs
|
||||
dnl in configure.in.
|
||||
for lang in $ALL_LINGUAS; do
|
||||
GMOFILES="$GMOFILES $lang.gmo"
|
||||
POFILES="$POFILES $lang.po"
|
||||
done
|
||||
|
||||
dnl Make all variables we use known to autoconf.
|
||||
AC_SUBST(USE_INCLUDED_LIBINTL)
|
||||
AC_SUBST(CATALOGS)
|
||||
AC_SUBST(CATOBJEXT)
|
||||
AC_SUBST(DATADIRNAME)
|
||||
AC_SUBST(GMOFILES)
|
||||
AC_SUBST(INSTOBJEXT)
|
||||
AC_SUBST(INTLDEPS)
|
||||
AC_SUBST(INTLLIBS)
|
||||
AC_SUBST(INTLOBJS)
|
||||
AC_SUBST(POFILES)
|
||||
AC_SUBST(POSUB)
|
||||
])
|
||||
|
||||
AC_DEFUN(CY_GNU_GETTEXT,
|
||||
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_C_CONST])dnl
|
||||
AC_REQUIRE([AC_C_INLINE])dnl
|
||||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h values.h sys/param.h])
|
||||
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
|
||||
__argz_count __argz_stringify __argz_next])
|
||||
|
||||
if test "${ac_cv_func_stpcpy+set}" != "set"; then
|
||||
AC_CHECK_FUNCS(stpcpy)
|
||||
fi
|
||||
if test "${ac_cv_func_stpcpy}" = "yes"; then
|
||||
AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
|
||||
fi
|
||||
|
||||
AM_LC_MESSAGES
|
||||
CY_WITH_NLS
|
||||
|
||||
if test "x$CATOBJEXT" != "x"; then
|
||||
if test "x$ALL_LINGUAS" = "x"; then
|
||||
LINGUAS=
|
||||
else
|
||||
AC_MSG_CHECKING(for catalogs to be installed)
|
||||
NEW_LINGUAS=
|
||||
for lang in ${LINGUAS=$ALL_LINGUAS}; do
|
||||
case "$ALL_LINGUAS" in
|
||||
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
|
||||
esac
|
||||
done
|
||||
LINGUAS=$NEW_LINGUAS
|
||||
AC_MSG_RESULT($LINGUAS)
|
||||
fi
|
||||
|
||||
dnl Construct list of names of catalog files to be constructed.
|
||||
if test -n "$LINGUAS"; then
|
||||
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl The reference to <locale.h> in the installed <libintl.h> file
|
||||
dnl must be resolved because we cannot expect the users of this
|
||||
dnl to define HAVE_LOCALE_H.
|
||||
if test $ac_cv_header_locale_h = yes; then
|
||||
INCLUDE_LOCALE_H="#include <locale.h>"
|
||||
else
|
||||
INCLUDE_LOCALE_H="\
|
||||
/* The system does not provide the header <locale.h>. Take care yourself. */"
|
||||
fi
|
||||
AC_SUBST(INCLUDE_LOCALE_H)
|
||||
|
||||
dnl Determine which catalog format we have (if any is needed)
|
||||
dnl For now we know about two different formats:
|
||||
dnl Linux libc-5 and the normal X/Open format
|
||||
if test -f $srcdir/po2tbl.sed.in; then
|
||||
if test "$CATOBJEXT" = ".cat"; then
|
||||
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
|
||||
|
||||
dnl Transform the SED scripts while copying because some dumb SEDs
|
||||
dnl cannot handle comments.
|
||||
sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
|
||||
fi
|
||||
dnl po2tbl.sed is always needed.
|
||||
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
|
||||
$srcdir/po2tbl.sed.in > po2tbl.sed
|
||||
fi
|
||||
|
||||
dnl In the intl/Makefile.in we have a special dependency which makes
|
||||
dnl only sense for gettext. We comment this out for non-gettext
|
||||
dnl packages.
|
||||
if test "$PACKAGE" = "gettext"; then
|
||||
GT_NO="#NO#"
|
||||
GT_YES=
|
||||
else
|
||||
GT_NO=
|
||||
GT_YES="#YES#"
|
||||
fi
|
||||
AC_SUBST(GT_NO)
|
||||
AC_SUBST(GT_YES)
|
||||
|
||||
MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
|
||||
AC_SUBST(MKINSTALLDIRS)
|
||||
|
||||
dnl *** For now the libtool support in intl/Makefile is not for real.
|
||||
l=
|
||||
AC_SUBST(l)
|
||||
|
||||
dnl Generate list of files to be processed by xgettext which will
|
||||
dnl be included in po/Makefile. But only do this if the po directory
|
||||
dnl exists in srcdir.
|
||||
if test -d $srcdir/po; then
|
||||
test -d po || mkdir po
|
||||
if test "x$srcdir" != "x."; then
|
||||
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
|
||||
posrcprefix="$srcdir/"
|
||||
else
|
||||
posrcprefix="../$srcdir/"
|
||||
fi
|
||||
else
|
||||
posrcprefix="../"
|
||||
fi
|
||||
rm -f po/POTFILES
|
||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
fi
|
||||
])
|
||||
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test -n "[$]$1"; then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file file be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU Public License
|
||||
# but which still want to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code is *not* freely available.
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_LC_MESSAGES,
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
||||
[Define if your locale.h file contains LC_MESSAGES.])
|
||||
fi
|
||||
fi])
|
||||
|
|
@ -0,0 +1,283 @@
|
|||
/* BFD back-end for AIX on PS/2 core files.
|
||||
This was based on trad-core.c, which was written by John Gilmore of
|
||||
Cygnus Support.
|
||||
Copyright 1988, 89, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Free Software Foundation, Inc.
|
||||
Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
|
||||
Converted to back end form by Ian Lance Taylor <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. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/i386.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#if defined (_AIX) && defined (_I386)
|
||||
#define NOCHECKS /* this is for coredump.h */
|
||||
#define _h_USER /* avoid including user.h from coredump.h */
|
||||
#include <uinfo.h>
|
||||
#include <sys/i386/coredump.h>
|
||||
#endif /* _AIX && _I386 */
|
||||
|
||||
/* maybe this could work on some other i386 but I have not tried it
|
||||
* mtranle@paris - Tue Sep 24 12:49:35 1991
|
||||
*/
|
||||
|
||||
#ifndef COR_MAGIC
|
||||
# define COR_MAGIC "core"
|
||||
#endif
|
||||
|
||||
/* need this cast because ptr is really void * */
|
||||
#define core_hdr(bfd) \
|
||||
(((bfd->tdata.trad_core_data))->hdr)
|
||||
#define core_section(bfd,n) \
|
||||
(((bfd)->tdata.trad_core_data)->sections[n])
|
||||
#define core_regsec(bfd) \
|
||||
(((bfd)->tdata.trad_core_data)->reg_section)
|
||||
#define core_reg2sec(bfd) \
|
||||
(((bfd)->tdata.trad_core_data)->reg2_section)
|
||||
|
||||
/* These are stored in the bfd's tdata */
|
||||
struct trad_core_struct {
|
||||
struct corehdr *hdr; /* core file header */
|
||||
asection *reg_section;
|
||||
asection *reg2_section;
|
||||
asection *sections[MAX_CORE_SEGS];
|
||||
};
|
||||
|
||||
static void swap_abort PARAMS ((void));
|
||||
|
||||
static const bfd_target *
|
||||
aix386_core_file_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
int i,n;
|
||||
unsigned char longbuf[4]; /* Raw bytes of various header fields */
|
||||
int core_size = sizeof (struct corehdr);
|
||||
struct corehdr *core;
|
||||
struct mergem {
|
||||
struct trad_core_struct coredata;
|
||||
struct corehdr internal_core;
|
||||
} *mergem;
|
||||
|
||||
if (bfd_read ((PTR)longbuf, 1, sizeof (longbuf), abfd) != sizeof (longbuf))
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strncmp(longbuf,COR_MAGIC,4)) return 0;
|
||||
|
||||
if (bfd_seek (abfd, 0L, false) < 0) return 0;
|
||||
|
||||
mergem = (struct mergem *)bfd_zalloc (abfd, sizeof (struct mergem));
|
||||
if (mergem == NULL)
|
||||
return 0;
|
||||
|
||||
core = &mergem->internal_core;
|
||||
|
||||
if ((bfd_read ((PTR) core, 1, core_size, abfd)) != core_size)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
bfd_release (abfd, (char *)mergem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
set_tdata (abfd, &mergem->coredata);
|
||||
core_hdr (abfd) = core;
|
||||
|
||||
/* create the sections. This is raunchy, but bfd_close wants to reclaim
|
||||
them */
|
||||
core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_regsec (abfd) == NULL)
|
||||
{
|
||||
loser:
|
||||
bfd_release (abfd, (char *)mergem);
|
||||
return 0;
|
||||
}
|
||||
core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_reg2sec (abfd) == NULL)
|
||||
{
|
||||
loser1:
|
||||
bfd_release (abfd, core_regsec (abfd));
|
||||
goto loser;
|
||||
}
|
||||
|
||||
for (i=0, n=0 ; (i < MAX_CORE_SEGS) && (core->cd_segs[i].cs_type) ; i++)
|
||||
{
|
||||
if (core->cd_segs[i].cs_offset == 0)
|
||||
continue;
|
||||
core_section (abfd,n) =
|
||||
(asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_section (abfd,n) == NULL)
|
||||
{
|
||||
int j;
|
||||
if (n > 0)
|
||||
{
|
||||
for (j=0; j < n; j++)
|
||||
bfd_release (abfd, core_section(abfd, j));
|
||||
}
|
||||
bfd_release (abfd, (char *)mergem);
|
||||
goto loser1;
|
||||
}
|
||||
|
||||
switch (core->cd_segs[i].cs_type)
|
||||
{
|
||||
case COR_TYPE_DATA:
|
||||
core_section (abfd, n)->name = ".data";
|
||||
core_section (abfd, n)->flags = (SEC_ALLOC + SEC_LOAD +
|
||||
SEC_HAS_CONTENTS);
|
||||
break;
|
||||
case COR_TYPE_STACK:
|
||||
core_section (abfd, n)->name = ".stack";
|
||||
core_section (abfd, n)->flags = (SEC_ALLOC + SEC_LOAD +
|
||||
SEC_HAS_CONTENTS);
|
||||
break;
|
||||
case COR_TYPE_LIBDATA:
|
||||
core_section (abfd, n)->name = ".libdata";
|
||||
core_section (abfd, n)->flags = (SEC_ALLOC + SEC_HAS_CONTENTS);
|
||||
break;
|
||||
case COR_TYPE_WRITE:
|
||||
core_section (abfd, n)->name = ".writeable";
|
||||
core_section (abfd, n)->flags = (SEC_ALLOC + SEC_HAS_CONTENTS);
|
||||
break;
|
||||
case COR_TYPE_MSC:
|
||||
core_section (abfd, n)->name = ".misc";
|
||||
core_section (abfd, n)->flags = (SEC_ALLOC + SEC_HAS_CONTENTS);
|
||||
break;
|
||||
default:
|
||||
core_section (abfd, n)->name = ".unknown";
|
||||
core_section (abfd, n)->flags = (SEC_ALLOC + SEC_HAS_CONTENTS);
|
||||
break;
|
||||
}
|
||||
core_section (abfd, n)->_raw_size = core->cd_segs[i].cs_len;
|
||||
core_section (abfd, n)->vma = core->cd_segs[i].cs_address;
|
||||
core_section (abfd, n)->filepos = core->cd_segs[i].cs_offset;
|
||||
core_section (abfd, n)->alignment_power = 2;
|
||||
core_section (abfd, n)->next = NULL;
|
||||
if (n > 0)
|
||||
core_section (abfd, (n-1))->next = core_section (abfd, n);
|
||||
|
||||
abfd->section_count = ++n;
|
||||
}
|
||||
|
||||
core_regsec (abfd)->name = ".reg";
|
||||
core_reg2sec (abfd)->name = ".reg2";
|
||||
|
||||
core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
|
||||
core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
|
||||
|
||||
core_regsec (abfd)->_raw_size = sizeof(core->cd_regs);
|
||||
core_reg2sec (abfd)->_raw_size = sizeof(core->cd_fpregs);
|
||||
|
||||
core_regsec (abfd)->vma = -1;
|
||||
core_reg2sec (abfd)->vma = -1;
|
||||
|
||||
/* We'll access the regs afresh in the core file, like any section: */
|
||||
core_regsec (abfd)->filepos = (file_ptr)offsetof(struct corehdr,cd_regs[0]);
|
||||
core_reg2sec (abfd)->filepos = (file_ptr)offsetof(struct corehdr,
|
||||
cd_fpregs);
|
||||
|
||||
/* add the 2 reg fake sections to abfd */
|
||||
abfd->section_count += 2;
|
||||
abfd->sections = core_regsec (abfd);
|
||||
core_regsec (abfd)->next = core_reg2sec (abfd);
|
||||
core_reg2sec (abfd)->next = core_section (abfd, 0);
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
static char *
|
||||
aix386_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return core_hdr (abfd)->cd_comm;
|
||||
}
|
||||
|
||||
static int
|
||||
aix386_core_file_failing_signal (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return core_hdr (abfd)->cd_cursig;
|
||||
}
|
||||
|
||||
static boolean
|
||||
aix386_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd;
|
||||
bfd *exec_bfd;
|
||||
{
|
||||
return true; /* FIXME, We have no way of telling at this
|
||||
point */
|
||||
}
|
||||
|
||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||
static void
|
||||
swap_abort()
|
||||
{
|
||||
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
|
||||
}
|
||||
#define NO_GET ((PROTO(bfd_vma, (*), ( const bfd_byte *))) swap_abort )
|
||||
#define NO_GETS ((PROTO(bfd_signed_vma, (*), (const bfd_byte *))) swap_abort )
|
||||
#define NO_PUT ((PROTO(void, (*), (bfd_vma, bfd_byte *))) swap_abort )
|
||||
|
||||
const bfd_target aix386_core_vec =
|
||||
{
|
||||
"aix386-core",
|
||||
bfd_target_unknown_flavour,
|
||||
BFD_ENDIAN_BIG, /* target byte order */
|
||||
BFD_ENDIANG_BIG, /* target headers byte order */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
' ', /* ar_pad_char */
|
||||
16, /* ar_max_namelen */
|
||||
NO_GET, NO_GETS, NO_PUT,
|
||||
NO_GET, NO_GETS, NO_PUT,
|
||||
NO_GET, NO_GETS, NO_PUT, /* data */
|
||||
NO_GET, NO_GETS, NO_PUT,
|
||||
NO_GET, NO_GETS, NO_PUT,
|
||||
NO_GET, NO_GETS, NO_PUT, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, _bfd_dummy_target,
|
||||
_bfd_dummy_target, aix386_core_file_p},
|
||||
{bfd_false, bfd_false, /* bfd_create_object */
|
||||
bfd_false, bfd_false},
|
||||
{bfd_false, bfd_false, /* bfd_write_contents */
|
||||
bfd_false, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (_bfd_generic),
|
||||
BFD_JUMP_TABLE_COPY (_bfd_generic),
|
||||
BFD_JUMP_TABLE_CORE (aix386),
|
||||
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
|
||||
};
|
|
@ -0,0 +1,527 @@
|
|||
/* BFD back-end for a.out.adobe binaries.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support. Based on bout.c.
|
||||
|
||||
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 "aout/adobe.h"
|
||||
|
||||
#include "aout/stab_gnu.h"
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
|
||||
extern const bfd_target a_out_adobe_vec; /* Forward decl */
|
||||
|
||||
static const bfd_target *aout_adobe_callback PARAMS ((bfd *));
|
||||
|
||||
extern boolean aout_32_slurp_symbol_table PARAMS ((bfd *abfd));
|
||||
extern boolean aout_32_write_syms PARAMS ((bfd *));
|
||||
static void aout_adobe_write_section PARAMS ((bfd *abfd, sec_ptr sect));
|
||||
|
||||
/* Swaps the information in an executable header taken from a raw byte
|
||||
stream memory image, into the internal exec_header structure. */
|
||||
|
||||
void aout_adobe_swap_exec_header_in
|
||||
PARAMS ((bfd *abfd, struct external_exec *raw_bytes,
|
||||
struct internal_exec *execp));
|
||||
|
||||
void
|
||||
aout_adobe_swap_exec_header_in (abfd, raw_bytes, execp)
|
||||
bfd *abfd;
|
||||
struct external_exec *raw_bytes;
|
||||
struct internal_exec *execp;
|
||||
{
|
||||
struct external_exec *bytes = (struct external_exec *)raw_bytes;
|
||||
|
||||
/* Now fill in fields in the execp, from the bytes in the raw data. */
|
||||
execp->a_info = bfd_h_get_32 (abfd, bytes->e_info);
|
||||
execp->a_text = GET_WORD (abfd, bytes->e_text);
|
||||
execp->a_data = GET_WORD (abfd, bytes->e_data);
|
||||
execp->a_bss = GET_WORD (abfd, bytes->e_bss);
|
||||
execp->a_syms = GET_WORD (abfd, bytes->e_syms);
|
||||
execp->a_entry = GET_WORD (abfd, bytes->e_entry);
|
||||
execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
|
||||
execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
|
||||
}
|
||||
|
||||
/* Swaps the information in an internal exec header structure into the
|
||||
supplied buffer ready for writing to disk. */
|
||||
|
||||
PROTO(void, aout_adobe_swap_exec_header_out,
|
||||
(bfd *abfd,
|
||||
struct internal_exec *execp,
|
||||
struct external_exec *raw_bytes));
|
||||
void
|
||||
aout_adobe_swap_exec_header_out (abfd, execp, raw_bytes)
|
||||
bfd *abfd;
|
||||
struct internal_exec *execp;
|
||||
struct external_exec *raw_bytes;
|
||||
{
|
||||
struct external_exec *bytes = (struct external_exec *)raw_bytes;
|
||||
|
||||
/* Now fill in fields in the raw data, from the fields in the exec struct. */
|
||||
bfd_h_put_32 (abfd, execp->a_info , bytes->e_info);
|
||||
PUT_WORD (abfd, execp->a_text , bytes->e_text);
|
||||
PUT_WORD (abfd, execp->a_data , bytes->e_data);
|
||||
PUT_WORD (abfd, execp->a_bss , bytes->e_bss);
|
||||
PUT_WORD (abfd, execp->a_syms , bytes->e_syms);
|
||||
PUT_WORD (abfd, execp->a_entry , bytes->e_entry);
|
||||
PUT_WORD (abfd, execp->a_trsize, bytes->e_trsize);
|
||||
PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize);
|
||||
}
|
||||
|
||||
|
||||
static const bfd_target *
|
||||
aout_adobe_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec anexec;
|
||||
struct external_exec exec_bytes;
|
||||
char *targ;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
anexec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
|
||||
|
||||
/* Normally we just compare for the magic number.
|
||||
However, a bunch of Adobe tools aren't fixed up yet; they generate
|
||||
files using ZMAGIC(!).
|
||||
If the environment variable GNUTARGET is set to "a.out.adobe", we will
|
||||
take just about any a.out file as an Adobe a.out file. FIXME! */
|
||||
|
||||
if (N_BADMAG (anexec)) {
|
||||
targ = getenv ("GNUTARGET");
|
||||
if (targ && !strcmp (targ, a_out_adobe_vec.name))
|
||||
; /* Just continue anyway, if specifically set to this format */
|
||||
else
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
aout_adobe_swap_exec_header_in (abfd, &exec_bytes, &anexec);
|
||||
return aout_32_some_aout_object_p (abfd, &anexec, aout_adobe_callback);
|
||||
}
|
||||
|
||||
|
||||
/* Finish up the opening of a b.out file for reading. Fill in all the
|
||||
fields that are not handled by common code. */
|
||||
|
||||
static const bfd_target *
|
||||
aout_adobe_callback (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
asection *sect;
|
||||
struct external_segdesc ext[1];
|
||||
char *section_name;
|
||||
char try_again[30]; /* name and number */
|
||||
char *newname;
|
||||
int trynum;
|
||||
flagword flags;
|
||||
|
||||
/* Architecture and machine type -- unknown in this format. */
|
||||
bfd_set_arch_mach(abfd, bfd_arch_unknown, 0);
|
||||
|
||||
/* The positions of the string table and symbol table. */
|
||||
obj_str_filepos (abfd) = N_STROFF (*execp);
|
||||
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
|
||||
|
||||
/* Suck up the section information from the file, one section at a time. */
|
||||
|
||||
for (;;) {
|
||||
if (bfd_read ((PTR) ext, 1, sizeof (*ext), abfd) != sizeof (*ext)) {
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
switch (ext->e_type[0]) {
|
||||
case N_TEXT:
|
||||
section_name = ".text";
|
||||
flags = SEC_CODE | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
|
||||
break;
|
||||
|
||||
case N_DATA:
|
||||
section_name = ".data";
|
||||
flags = SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_HAS_CONTENTS;
|
||||
break;
|
||||
|
||||
case N_BSS:
|
||||
section_name = ".bss";
|
||||
flags = SEC_DATA | SEC_HAS_CONTENTS;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
goto no_more_sections;
|
||||
|
||||
default:
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: Unknown section type in a.out.adobe file: %x\n"),
|
||||
bfd_get_filename (abfd), ext->e_type[0]);
|
||||
goto no_more_sections;
|
||||
}
|
||||
|
||||
/* First one is called ".text" or whatever; subsequent ones are
|
||||
".text1", ".text2", ... */
|
||||
|
||||
bfd_set_error (bfd_error_no_error);
|
||||
sect = bfd_make_section (abfd, section_name);
|
||||
trynum = 0;
|
||||
while (!sect) {
|
||||
if (bfd_get_error () != bfd_error_no_error)
|
||||
return 0; /* Some other error -- slide into the sunset */
|
||||
sprintf (try_again, "%s%d", section_name, ++trynum);
|
||||
sect = bfd_make_section (abfd, try_again);
|
||||
}
|
||||
|
||||
/* Fix the name, if it is a sprintf'd name. */
|
||||
if (sect->name == try_again) {
|
||||
newname = (char *) bfd_zalloc(abfd, strlen (sect->name));
|
||||
if (newname == NULL)
|
||||
return 0;
|
||||
strcpy (newname, sect->name);
|
||||
sect->name = newname;
|
||||
}
|
||||
|
||||
/* Now set the section's attributes. */
|
||||
bfd_set_section_flags (abfd, sect, flags);
|
||||
sect->_raw_size = ((ext->e_size[0] << 8) /* Assumed big-endian */
|
||||
| ext->e_size[1] << 8)
|
||||
| ext->e_size[2];
|
||||
sect->_cooked_size = sect->_raw_size;
|
||||
sect->vma = bfd_h_get_32 (abfd, ext->e_virtbase);
|
||||
sect->filepos = bfd_h_get_32 (abfd, ext->e_filebase);
|
||||
/* FIXME XXX alignment? */
|
||||
|
||||
/* Set relocation information for first section of each type. */
|
||||
if (trynum == 0) switch (ext->e_type[0]) {
|
||||
case N_TEXT:
|
||||
sect->rel_filepos = N_TRELOFF (*execp);
|
||||
sect->reloc_count = execp->a_trsize;
|
||||
break;
|
||||
|
||||
case N_DATA:
|
||||
sect->rel_filepos = N_DRELOFF (*execp);
|
||||
sect->reloc_count = execp->a_drsize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
no_more_sections:
|
||||
|
||||
adata(abfd).reloc_entry_size = sizeof (struct reloc_std_external);
|
||||
adata(abfd).symbol_entry_size = sizeof (struct external_nlist);
|
||||
adata(abfd).page_size = 1; /* Not applicable. */
|
||||
adata(abfd).segment_size = 1; /* Not applicable. */
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
struct bout_data_struct {
|
||||
struct aoutdata a;
|
||||
struct internal_exec e;
|
||||
};
|
||||
|
||||
static boolean
|
||||
aout_adobe_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct bout_data_struct *rawptr;
|
||||
|
||||
rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
|
||||
if (rawptr == NULL)
|
||||
return false;
|
||||
|
||||
abfd->tdata.bout_data = rawptr;
|
||||
exec_hdr (abfd) = &rawptr->e;
|
||||
|
||||
adata(abfd).reloc_entry_size = sizeof (struct reloc_std_external);
|
||||
adata(abfd).symbol_entry_size = sizeof (struct external_nlist);
|
||||
adata(abfd).page_size = 1; /* Not applicable. */
|
||||
adata(abfd).segment_size = 1; /* Not applicable. */
|
||||
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static boolean
|
||||
aout_adobe_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec swapped_hdr;
|
||||
static struct external_segdesc sentinel[1]; /* Initialized to zero */
|
||||
asection *sect;
|
||||
|
||||
exec_hdr (abfd)->a_info = ZMAGIC;
|
||||
|
||||
/* Calculate text size as total of text sections, etc. */
|
||||
|
||||
exec_hdr (abfd)->a_text = 0;
|
||||
exec_hdr (abfd)->a_data = 0;
|
||||
exec_hdr (abfd)->a_bss = 0;
|
||||
exec_hdr (abfd)->a_trsize = 0;
|
||||
exec_hdr (abfd)->a_drsize = 0;
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_CODE) {
|
||||
exec_hdr (abfd)->a_text += sect->_raw_size;
|
||||
exec_hdr (abfd)->a_trsize += sect->reloc_count *
|
||||
sizeof (struct reloc_std_external);
|
||||
} else if (sect->flags & SEC_DATA) {
|
||||
exec_hdr (abfd)->a_data += sect->_raw_size;
|
||||
exec_hdr (abfd)->a_drsize += sect->reloc_count *
|
||||
sizeof (struct reloc_std_external);
|
||||
} else if (sect->flags & SEC_ALLOC && !(sect->flags & SEC_LOAD)) {
|
||||
exec_hdr (abfd)->a_bss += sect->_raw_size;
|
||||
}
|
||||
}
|
||||
|
||||
exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd)
|
||||
* sizeof (struct external_nlist);
|
||||
exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd);
|
||||
|
||||
aout_adobe_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
|
||||
|
||||
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
|
||||
|| (bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd)
|
||||
!= EXEC_BYTES_SIZE))
|
||||
return false;
|
||||
|
||||
/* Now write out the section information. Text first, data next, rest
|
||||
afterward. */
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_CODE) {
|
||||
aout_adobe_write_section (abfd, sect);
|
||||
}
|
||||
}
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_DATA) {
|
||||
aout_adobe_write_section (abfd, sect);
|
||||
}
|
||||
}
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (!(sect->flags & (SEC_CODE|SEC_DATA))) {
|
||||
aout_adobe_write_section (abfd, sect);
|
||||
}
|
||||
}
|
||||
|
||||
/* Write final `sentinel` section header (with type of 0). */
|
||||
if (bfd_write ((PTR) sentinel, 1, sizeof (*sentinel), abfd)
|
||||
!= sizeof (*sentinel))
|
||||
return false;
|
||||
|
||||
/* Now write out reloc info, followed by syms and strings */
|
||||
if (bfd_get_symcount (abfd) != 0)
|
||||
{
|
||||
if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
|
||||
!= 0)
|
||||
return false;
|
||||
|
||||
if (! aout_32_write_syms (abfd))
|
||||
return false;
|
||||
|
||||
if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*exec_hdr(abfd))), SEEK_SET)
|
||||
!= 0)
|
||||
return false;
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_CODE) {
|
||||
if (!aout_32_squirt_out_relocs (abfd, sect))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*exec_hdr(abfd))), SEEK_SET)
|
||||
!= 0)
|
||||
return false;
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_DATA) {
|
||||
if (!aout_32_squirt_out_relocs (abfd, sect))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
aout_adobe_write_section (abfd, sect)
|
||||
bfd *abfd;
|
||||
sec_ptr sect;
|
||||
{
|
||||
/* FIXME XXX */
|
||||
}
|
||||
|
||||
static boolean
|
||||
aout_adobe_set_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
file_ptr section_start;
|
||||
sec_ptr sect;
|
||||
|
||||
if (abfd->output_has_begun == false) { /* set by bfd.c handler */
|
||||
|
||||
/* Assign file offsets to sections. Text sections are first, and
|
||||
are contiguous. Then data sections. Everything else at the end. */
|
||||
|
||||
section_start = N_TXTOFF (ignore<-->me);
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_CODE) {
|
||||
sect->filepos = section_start;
|
||||
/* FIXME: Round to alignment */
|
||||
section_start += sect->_raw_size;
|
||||
}
|
||||
}
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_DATA) {
|
||||
sect->filepos = section_start;
|
||||
/* FIXME: Round to alignment */
|
||||
section_start += sect->_raw_size;
|
||||
}
|
||||
}
|
||||
|
||||
for (sect = abfd->sections; sect; sect = sect->next) {
|
||||
if (sect->flags & SEC_HAS_CONTENTS &&
|
||||
!(sect->flags & (SEC_CODE|SEC_DATA))) {
|
||||
sect->filepos = section_start;
|
||||
/* FIXME: Round to alignment */
|
||||
section_start += sect->_raw_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* regardless, once we know what we're doing, we might as well get going */
|
||||
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
|
||||
return false;
|
||||
|
||||
if (count != 0) {
|
||||
return (bfd_write ((PTR)location, 1, count, abfd) == count) ?true:false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean
|
||||
aout_adobe_set_arch_mach (abfd, arch, machine)
|
||||
bfd *abfd;
|
||||
enum bfd_architecture arch;
|
||||
unsigned long machine;
|
||||
{
|
||||
if (! bfd_default_set_arch_mach (abfd, arch, machine))
|
||||
return false;
|
||||
|
||||
if (arch == bfd_arch_unknown
|
||||
|| arch == bfd_arch_m68k)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
aout_adobe_sizeof_headers (ignore_abfd, ignore)
|
||||
bfd *ignore_abfd;
|
||||
boolean ignore;
|
||||
{
|
||||
return sizeof(struct internal_exec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Build the transfer vector for Adobe A.Out files. */
|
||||
|
||||
#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
|
||||
|
||||
#define aout_32_bfd_make_debug_symbol \
|
||||
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
|
||||
|
||||
#define aout_32_bfd_reloc_type_lookup \
|
||||
((reloc_howto_type *(*) \
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
|
||||
|
||||
#define aout_32_set_arch_mach aout_adobe_set_arch_mach
|
||||
#define aout_32_set_section_contents aout_adobe_set_section_contents
|
||||
|
||||
#define aout_32_sizeof_headers aout_adobe_sizeof_headers
|
||||
#define aout_32_bfd_get_relocated_section_contents \
|
||||
bfd_generic_get_relocated_section_contents
|
||||
#define aout_32_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
||||
#define aout_32_bfd_relax_section bfd_generic_relax_section
|
||||
#define aout_32_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define aout_32_bfd_link_hash_table_create \
|
||||
_bfd_generic_link_hash_table_create
|
||||
#define aout_32_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define aout_32_bfd_final_link _bfd_generic_final_link
|
||||
#define aout_32_bfd_link_split_section _bfd_generic_link_split_section
|
||||
|
||||
const bfd_target a_out_adobe_vec =
|
||||
{
|
||||
"a.out.adobe", /* name */
|
||||
bfd_target_aout_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is unknown (big assumed) */
|
||||
BFD_ENDIAN_BIG, /* hdr byte order is big */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT ),
|
||||
/* section flags */
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_DATA | SEC_RELOC),
|
||||
'_', /* 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_dummy_target, aout_adobe_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, aout_adobe_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, aout_adobe_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (aout_32),
|
||||
BFD_JUMP_TABLE_COPY (_bfd_generic),
|
||||
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
||||
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
|
||||
BFD_JUMP_TABLE_SYMBOLS (aout_32),
|
||||
BFD_JUMP_TABLE_RELOCS (aout_32),
|
||||
BFD_JUMP_TABLE_WRITE (aout_32),
|
||||
BFD_JUMP_TABLE_LINK (aout_32),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
(PTR) 0
|
||||
};
|
|
@ -0,0 +1,546 @@
|
|||
/* BFD back-end for raw ARM a.out binaries.
|
||||
Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
|
||||
|
||||
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 N_TXTADDR(x) \
|
||||
((N_MAGIC(x) == NMAGIC) ? 0x8000 : \
|
||||
(N_MAGIC(x) != ZMAGIC) ? 0 : \
|
||||
(N_SHARED_LIB(x)) ? ((x).a_entry & ~(TARGET_PAGE_SIZE - 1)) : \
|
||||
TEXT_START_ADDR)
|
||||
|
||||
#define TEXT_START_ADDR 0x8000
|
||||
#define TARGET_PAGE_SIZE 0x8000
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#define DEFAULT_ARCH bfd_arch_arm
|
||||
|
||||
#define MY(OP) CAT(aoutarm_,OP)
|
||||
#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \
|
||||
(((x).a_info & ~006000) != OMAGIC) && \
|
||||
((x).a_info != NMAGIC))
|
||||
#define N_MAGIC(x) ((x).a_info & ~07200)
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
#define MYARM(OP) CAT(aoutarm_,OP)
|
||||
reloc_howto_type *MYARM(bfd_reloc_type_lookup)
|
||||
PARAMS((bfd *, bfd_reloc_code_real_type));
|
||||
static boolean MYARM(write_object_contents) PARAMS((bfd *));
|
||||
|
||||
/* Avoid multiple defininitions from aoutx if supporting standarad a.out
|
||||
as well as our own. */
|
||||
#define NAME(x,y) CAT3(aoutarm,_32_,y)
|
||||
|
||||
#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
|
||||
|
||||
#include "libaout.h"
|
||||
#include "aout/aout64.h"
|
||||
|
||||
static bfd_reloc_status_type
|
||||
MY(fix_pcrel_26_done) PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
|
||||
static bfd_reloc_status_type
|
||||
MY(fix_pcrel_26) PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
static void MY(swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
|
||||
arelent *, asymbol **,
|
||||
bfd_size_type));
|
||||
void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *,
|
||||
struct reloc_std_external *));
|
||||
|
||||
reloc_howto_type MY(howto_table)[] =
|
||||
{
|
||||
/* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask
|
||||
pcdone */
|
||||
HOWTO (0, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true,
|
||||
0x000000ff, 0x000000ff, false),
|
||||
HOWTO (1, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true,
|
||||
0x0000ffff, 0x0000ffff, false),
|
||||
HOWTO (2, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "32", true,
|
||||
0xffffffff, 0xffffffff, false),
|
||||
HOWTO (3, 2, 2, 26, true, 0, complain_overflow_signed, MY(fix_pcrel_26),
|
||||
"ARM26", true, 0x00ffffff, 0x00ffffff, true),
|
||||
HOWTO (4, 0, 0, 8, true, 0, complain_overflow_signed, 0, "DISP8", true,
|
||||
0x000000ff, 0x000000ff, true),
|
||||
HOWTO (5, 0, 1, 16, true, 0, complain_overflow_signed, 0, "DISP16", true,
|
||||
0x0000ffff, 0x0000ffff, true),
|
||||
HOWTO (6, 0, 2, 32, true, 0, complain_overflow_signed, 0, "DISP32", true,
|
||||
0xffffffff, 0xffffffff, true),
|
||||
HOWTO (7, 2, 2, 26, false, 0, complain_overflow_signed,
|
||||
MY(fix_pcrel_26_done), "ARM26D", true, 0x0, 0x0,
|
||||
false),
|
||||
{-1},
|
||||
HOWTO (9, 0, -1, 16, false, 0, complain_overflow_bitfield, 0, "NEG16", true,
|
||||
0x0000ffff, 0x0000ffff, false),
|
||||
HOWTO (10, 0, -2, 32, false, 0, complain_overflow_bitfield, 0, "NEG32", true,
|
||||
0xffffffff, 0xffffffff, false)
|
||||
};
|
||||
|
||||
#define RELOC_ARM_BITS_NEG_BIG ((unsigned int) 0x08)
|
||||
#define RELOC_ARM_BITS_NEG_LITTLE ((unsigned int) 0x10)
|
||||
|
||||
reloc_howto_type *
|
||||
MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
|
||||
bfd *abfd;
|
||||
struct reloc_std_external *rel;
|
||||
int *r_index;
|
||||
int *r_extern;
|
||||
int *r_pcrel;
|
||||
{
|
||||
unsigned int r_length;
|
||||
unsigned int r_pcrel_done;
|
||||
unsigned int r_neg;
|
||||
int index;
|
||||
|
||||
*r_pcrel = 0;
|
||||
if (bfd_header_big_endian (abfd))
|
||||
{
|
||||
*r_index = ((rel->r_index[0] << 16)
|
||||
| (rel->r_index[1] << 8)
|
||||
| rel->r_index[2]);
|
||||
*r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
|
||||
r_pcrel_done = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
|
||||
r_neg = (0 != (rel->r_type[0] & RELOC_ARM_BITS_NEG_BIG));
|
||||
r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_BIG)
|
||||
>> RELOC_STD_BITS_LENGTH_SH_BIG);
|
||||
}
|
||||
else
|
||||
{
|
||||
*r_index = ((rel->r_index[2] << 16)
|
||||
| (rel->r_index[1] << 8)
|
||||
| rel->r_index[0]);
|
||||
*r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
|
||||
r_pcrel_done = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
|
||||
r_neg = (0 != (rel->r_type[0] & RELOC_ARM_BITS_NEG_LITTLE));
|
||||
r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
|
||||
>> RELOC_STD_BITS_LENGTH_SH_LITTLE);
|
||||
}
|
||||
index = r_length + 4 * r_pcrel_done + 8 * r_neg;
|
||||
if (index == 3)
|
||||
*r_pcrel = 1;
|
||||
|
||||
return MY(howto_table) + index;
|
||||
}
|
||||
|
||||
#define MY_reloc_howto(BFD, REL, IN, EX, PC) \
|
||||
MY(reloc_howto) (BFD, REL, &IN, &EX, &PC)
|
||||
|
||||
void
|
||||
MY(put_reloc)(abfd, r_extern, r_index, value, howto, reloc)
|
||||
bfd *abfd;
|
||||
int r_extern;
|
||||
int r_index;
|
||||
long value;
|
||||
reloc_howto_type *howto;
|
||||
struct reloc_std_external *reloc;
|
||||
{
|
||||
unsigned int r_length;
|
||||
int r_pcrel;
|
||||
int r_neg;
|
||||
|
||||
PUT_WORD (abfd, value, reloc->r_address);
|
||||
r_length = howto->size ; /* Size as a power of two */
|
||||
|
||||
/* Special case for branch relocations. */
|
||||
if (howto->type == 3 || howto->type == 7)
|
||||
r_length = 3;
|
||||
|
||||
r_pcrel = howto->type & 4; /* PC Relative done? */
|
||||
r_neg = howto->type & 8; /* Negative relocation */
|
||||
if (bfd_header_big_endian (abfd))
|
||||
{
|
||||
reloc->r_index[0] = r_index >> 16;
|
||||
reloc->r_index[1] = r_index >> 8;
|
||||
reloc->r_index[2] = r_index;
|
||||
reloc->r_type[0] =
|
||||
((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0)
|
||||
| (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0)
|
||||
| (r_neg ? RELOC_ARM_BITS_NEG_BIG : 0)
|
||||
| (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
|
||||
}
|
||||
else
|
||||
{
|
||||
reloc->r_index[2] = r_index >> 16;
|
||||
reloc->r_index[1] = r_index >> 8;
|
||||
reloc->r_index[0] = r_index;
|
||||
reloc->r_type[0] =
|
||||
((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0)
|
||||
| (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0)
|
||||
| (r_neg ? RELOC_ARM_BITS_NEG_LITTLE : 0)
|
||||
| (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
|
||||
}
|
||||
}
|
||||
|
||||
#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
|
||||
MY(put_reloc)(BFD, EXT, IDX, VAL, HOWTO, RELOC)
|
||||
|
||||
void
|
||||
MY(relocatable_reloc)(howto, abfd, reloc, amount, r_addr)
|
||||
reloc_howto_type *howto;
|
||||
bfd *abfd;
|
||||
struct reloc_std_external *reloc;
|
||||
bfd_vma *amount;
|
||||
bfd_vma r_addr;
|
||||
{
|
||||
if (howto->type == 3)
|
||||
{
|
||||
if (reloc->r_type[0]
|
||||
& (bfd_header_big_endian (abfd)
|
||||
? RELOC_STD_BITS_EXTERN_BIG : RELOC_STD_BITS_EXTERN_LITTLE))
|
||||
{
|
||||
/* The reloc is still external, so don't modify anything. */
|
||||
*amount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*amount -= r_addr;
|
||||
/* Change the r_pcrel value -- on the ARM, this bit is set once the
|
||||
relocation is done. */
|
||||
if (bfd_header_big_endian (abfd))
|
||||
reloc->r_type[0] |= RELOC_STD_BITS_PCREL_BIG;
|
||||
else
|
||||
reloc->r_type[0] |= RELOC_STD_BITS_PCREL_LITTLE;
|
||||
}
|
||||
}
|
||||
else if (howto->type == 7)
|
||||
*amount = 0;
|
||||
}
|
||||
|
||||
#define MY_relocatable_reloc(HOW, BFD, REL, AMOUNT, ADDR) \
|
||||
MY(relocatable_reloc)(HOW, BFD, REL, &(AMOUNT), ADDR)
|
||||
|
||||
static bfd_reloc_status_type
|
||||
MY(fix_pcrel_26_done) (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;
|
||||
{
|
||||
/* This is dead simple at present. */
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
static bfd_reloc_status_type
|
||||
MY(fix_pcrel_26) (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;
|
||||
{
|
||||
bfd_vma relocation;
|
||||
bfd_size_type addr = reloc_entry->address;
|
||||
long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
|
||||
bfd_reloc_status_type flag = bfd_reloc_ok;
|
||||
|
||||
/* If this is an undefined symbol, return error */
|
||||
if (symbol->section == &bfd_und_section
|
||||
&& (symbol->flags & BSF_WEAK) == 0)
|
||||
return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
|
||||
|
||||
/* If the sections are different, and we are doing a partial relocation,
|
||||
just ignore it for now. */
|
||||
if (symbol->section->name != input_section->name
|
||||
&& output_bfd != (bfd *)NULL)
|
||||
return bfd_reloc_ok;
|
||||
|
||||
relocation = (target & 0x00ffffff) << 2;
|
||||
relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */
|
||||
relocation += symbol->value;
|
||||
relocation += symbol->section->output_section->vma;
|
||||
relocation += symbol->section->output_offset;
|
||||
relocation += reloc_entry->addend;
|
||||
relocation -= input_section->output_section->vma;
|
||||
relocation -= input_section->output_offset;
|
||||
relocation -= addr;
|
||||
if (relocation & 3)
|
||||
return bfd_reloc_overflow;
|
||||
|
||||
/* Check for overflow */
|
||||
if (relocation & 0x02000000)
|
||||
{
|
||||
if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff)
|
||||
flag = bfd_reloc_overflow;
|
||||
}
|
||||
else if (relocation & ~0x03ffffff)
|
||||
flag = bfd_reloc_overflow;
|
||||
|
||||
target &= ~0x00ffffff;
|
||||
target |= (relocation >> 2) & 0x00ffffff;
|
||||
bfd_put_32 (abfd, target, (bfd_byte *) data + addr);
|
||||
|
||||
/* Now the ARM magic... Change the reloc type so that it is marked as done.
|
||||
Strictly this is only necessary if we are doing a partial relocation. */
|
||||
reloc_entry->howto = &MY(howto_table)[7];
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
reloc_howto_type *
|
||||
MY(bfd_reloc_type_lookup)(abfd,code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
#define ASTD(i,j) case i: return &MY(howto_table)[j]
|
||||
if (code == BFD_RELOC_CTOR)
|
||||
switch (bfd_get_arch_info (abfd)->bits_per_address)
|
||||
{
|
||||
case 32:
|
||||
code = BFD_RELOC_32;
|
||||
break;
|
||||
default: return (CONST struct reloc_howto_struct *) 0;
|
||||
}
|
||||
|
||||
switch (code)
|
||||
{
|
||||
ASTD (BFD_RELOC_16, 1);
|
||||
ASTD (BFD_RELOC_32, 2);
|
||||
ASTD (BFD_RELOC_ARM_PCREL_BRANCH, 3);
|
||||
ASTD (BFD_RELOC_8_PCREL, 4);
|
||||
ASTD (BFD_RELOC_16_PCREL, 5);
|
||||
ASTD (BFD_RELOC_32_PCREL, 6);
|
||||
default: return (CONST struct reloc_howto_struct *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
#define MY_swap_std_reloc_in MY(swap_std_reloc_in)
|
||||
#define MY_swap_std_reloc_out MY(swap_std_reloc_out)
|
||||
#define MY_get_section_contents _bfd_generic_get_section_contents
|
||||
/* #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create */
|
||||
/* #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols */
|
||||
/* #define MY_bfd_final_link _bfd_generic_final_link */
|
||||
|
||||
#include "aoutx.h"
|
||||
|
||||
static void
|
||||
MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
|
||||
bfd *abfd;
|
||||
struct reloc_std_external *bytes;
|
||||
arelent *cache_ptr;
|
||||
asymbol **symbols;
|
||||
bfd_size_type symcount;
|
||||
{
|
||||
int r_index;
|
||||
int r_extern;
|
||||
int r_pcrel;
|
||||
struct aoutdata *su = &(abfd->tdata.aout_data->a);
|
||||
|
||||
cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address);
|
||||
|
||||
cache_ptr->howto = MY_reloc_howto (abfd, bytes, r_index, r_extern, r_pcrel);
|
||||
|
||||
MOVE_ADDRESS (0);
|
||||
}
|
||||
|
||||
void
|
||||
MY_swap_std_reloc_out (abfd, g, natptr)
|
||||
bfd *abfd;
|
||||
arelent *g;
|
||||
struct reloc_std_external *natptr;
|
||||
{
|
||||
int r_index;
|
||||
asymbol *sym = *(g->sym_ptr_ptr);
|
||||
int r_extern;
|
||||
int r_length;
|
||||
int r_pcrel;
|
||||
int r_neg = 0; /* Negative relocs use the BASEREL bit. */
|
||||
asection *output_section = sym->section->output_section;
|
||||
|
||||
PUT_WORD(abfd, g->address, natptr->r_address);
|
||||
|
||||
r_length = g->howto->size ; /* Size as a power of two */
|
||||
if (r_length < 0)
|
||||
{
|
||||
r_length = -r_length;
|
||||
r_neg = 1;
|
||||
}
|
||||
|
||||
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
|
||||
|
||||
/* For RISC iX, in pc-relative relocs the r_pcrel bit means that the
|
||||
relocation has been done already (Only for the 26-bit one I think)???!!!
|
||||
*/
|
||||
|
||||
if (g->howto->type == 3)
|
||||
{
|
||||
r_length = 3;
|
||||
r_pcrel = 0;
|
||||
}
|
||||
else if (g->howto->type == 7)
|
||||
{
|
||||
r_length = 3;
|
||||
r_pcrel = 1;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* For a standard reloc, the addend is in the object file. */
|
||||
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
|
||||
#endif
|
||||
|
||||
/* name was clobbered by aout_write_syms to be symbol index */
|
||||
|
||||
/* If this relocation is relative to a symbol then set the
|
||||
r_index to the symbols index, and the r_extern bit.
|
||||
|
||||
Absolute symbols can come in in two ways, either as an offset
|
||||
from the abs section, or as a symbol which has an abs value.
|
||||
check for that here
|
||||
*/
|
||||
|
||||
if (bfd_is_com_section (output_section)
|
||||
|| output_section == &bfd_abs_section
|
||||
|| output_section == &bfd_und_section)
|
||||
{
|
||||
if (bfd_abs_section.symbol == sym)
|
||||
{
|
||||
/* Whoops, looked like an abs symbol, but is really an offset
|
||||
from the abs section */
|
||||
r_index = 0;
|
||||
r_extern = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fill in symbol */
|
||||
r_extern = 1;
|
||||
r_index = (*(g->sym_ptr_ptr))->KEEPIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Just an ordinary section */
|
||||
r_extern = 0;
|
||||
r_index = output_section->target_index;
|
||||
}
|
||||
|
||||
/* now the fun stuff */
|
||||
if (bfd_header_big_endian (abfd))
|
||||
{
|
||||
natptr->r_index[0] = r_index >> 16;
|
||||
natptr->r_index[1] = r_index >> 8;
|
||||
natptr->r_index[2] = r_index;
|
||||
natptr->r_type[0] =
|
||||
( (r_extern ? RELOC_STD_BITS_EXTERN_BIG: 0)
|
||||
| (r_pcrel ? RELOC_STD_BITS_PCREL_BIG: 0)
|
||||
| (r_neg ? RELOC_ARM_BITS_NEG_BIG: 0)
|
||||
| (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
|
||||
}
|
||||
else
|
||||
{
|
||||
natptr->r_index[2] = r_index >> 16;
|
||||
natptr->r_index[1] = r_index >> 8;
|
||||
natptr->r_index[0] = r_index;
|
||||
natptr->r_type[0] =
|
||||
( (r_extern ? RELOC_STD_BITS_EXTERN_LITTLE: 0)
|
||||
| (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE: 0)
|
||||
| (r_neg ? RELOC_ARM_BITS_NEG_LITTLE: 0)
|
||||
| (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
|
||||
}
|
||||
}
|
||||
|
||||
#define MY_BFD_TARGET
|
||||
|
||||
#include "aout-target.h"
|
||||
|
||||
const bfd_target aout_arm_little_vec =
|
||||
{
|
||||
"a.out-arm-little", /* name */
|
||||
bfd_target_aout_flavour,
|
||||
BFD_ENDIAN_LITTLE, /* target byte order (little) */
|
||||
BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
|
||||
(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 | SEC_CODE | SEC_DATA),
|
||||
MY_symbol_leading_char,
|
||||
AR_PAD_CHAR, /* 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 */
|
||||
{_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,
|
||||
};
|
||||
|
||||
const bfd_target aout_arm_big_vec =
|
||||
{
|
||||
"a.out-arm-big", /* name */
|
||||
bfd_target_aout_flavour,
|
||||
BFD_ENDIAN_BIG, /* target byte order (big) */
|
||||
BFD_ENDIAN_BIG, /* target headers byte order (big) */
|
||||
(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 | SEC_CODE | SEC_DATA),
|
||||
MY_symbol_leading_char,
|
||||
AR_PAD_CHAR, /* ar_pad_char */
|
||||
15, /* 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_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,
|
||||
};
|
|
@ -0,0 +1,236 @@
|
|||
/* BFD back-end for a.out files encapsulated with COFF headers.
|
||||
Copyright (C) 1990, 1991 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 MODULE IS NOT FINISHED. IT PROBABLY DOESN'T EVEN COMPILE. */
|
||||
|
||||
#if 0
|
||||
#define TARGET_PAGE_SIZE 4096
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#define TEXT_START_ADDR 0
|
||||
#define BYTES_IN_WORD 4
|
||||
#endif
|
||||
|
||||
#include "bfd.h"
|
||||
#include <sysdep.h>
|
||||
#include "libbfd.h"
|
||||
#include <aout/aout64.h>
|
||||
#include "aout/stab_gnu.h"
|
||||
#include "aout/ar.h"
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
|
||||
const bfd_target *encap_real_callback ();
|
||||
|
||||
const bfd_target *
|
||||
encap_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
unsigned char magicbuf[4]; /* Raw bytes of magic number from file */
|
||||
unsigned long magic; /* Swapped magic number */
|
||||
short coff_magic;
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec exec;
|
||||
|
||||
if (bfd_read ((PTR)magicbuf, 1, sizeof (magicbuf), abfd) !=
|
||||
sizeof (magicbuf))
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
coff_magic = bfd_h_get_16 (abfd, magicbuf);
|
||||
if (coff_magic != COFF_MAGIC)
|
||||
return 0; /* Not an encap coff file */
|
||||
|
||||
__header_offset_temp==COFF_MAGIC ? sizeof(struct coffheader) : 0)
|
||||
(fseek ((f), HEADER_OFFSET((f)), 1))
|
||||
|
||||
magic = bfd_h_get_32 (abfd, magicbuf);
|
||||
|
||||
if (N_BADMAG (*((struct internal_exec *) &magic))) return 0;
|
||||
|
||||
struct external_exec exec_bytes;
|
||||
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;
|
||||
}
|
||||
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
|
||||
|
||||
return aout_32_some_aout_object_p (abfd, &exec, encap_realcallback);
|
||||
}
|
||||
|
||||
/* Finish up the reading of a encapsulated-coff a.out file header */
|
||||
const bfd_target *
|
||||
encap_real_callback (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
MY(callback)(abfd, execp);
|
||||
|
||||
/* If we have a coff header, it can give us better values for
|
||||
text_start and exec_data_start. This is particularly useful
|
||||
for remote debugging of embedded systems. */
|
||||
if (N_FLAGS(exec_aouthdr) & N_FLAGS_COFF_ENCAPSULATE)
|
||||
{
|
||||
struct coffheader ch;
|
||||
int val;
|
||||
val = lseek (execchan, -(sizeof (AOUTHDR) + sizeof (ch)), 1);
|
||||
if (val == -1)
|
||||
perror_with_name (filename);
|
||||
val = myread (execchan, &ch, sizeof (ch));
|
||||
if (val < 0)
|
||||
perror_with_name (filename);
|
||||
text_start = ch.text_start;
|
||||
exec_data_start = ch.data_start;
|
||||
} else
|
||||
{
|
||||
text_start =
|
||||
IS_OBJECT_FILE (exec_aouthdr) ? 0 : N_TXTADDR (exec_aouthdr);
|
||||
exec_data_start = IS_OBJECT_FILE (exec_aouthdr)
|
||||
? exec_aouthdr.a_text : N_DATADDR (exec_aouthdr);
|
||||
}
|
||||
|
||||
/* Determine the architecture and machine type of the object file. */
|
||||
bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0); /* FIXME */
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
/* Write an object file in Encapsulated COFF format.
|
||||
Section contents have already been written. We write the
|
||||
file header, symbols, and relocation. */
|
||||
|
||||
boolean
|
||||
encap_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
bfd_size_type data_pad = 0;
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
/****** FIXME: Fragments from the old GNU LD program for dealing with
|
||||
encap coff. */
|
||||
struct coffheader coffheader;
|
||||
int need_coff_header;
|
||||
|
||||
/* Determine whether to count the header as part of
|
||||
the text size, and initialize the text size accordingly.
|
||||
This depends on the kind of system and on the output format selected. */
|
||||
|
||||
N_SET_MAGIC (outheader, magic);
|
||||
#ifdef INITIALIZE_HEADER
|
||||
INITIALIZE_HEADER;
|
||||
#endif
|
||||
|
||||
text_size = sizeof (struct exec);
|
||||
#ifdef COFF_ENCAPSULATE
|
||||
if (relocatable_output == 0 && file_table[0].just_syms_flag == 0)
|
||||
{
|
||||
need_coff_header = 1;
|
||||
/* set this flag now, since it will change the values of N_TXTOFF, etc */
|
||||
N_SET_FLAGS (outheader, aout_backend_info (abfd)->exec_hdr_flags);
|
||||
text_size += sizeof (struct coffheader);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COFF_ENCAPSULATE
|
||||
if (need_coff_header)
|
||||
{
|
||||
/* We are encapsulating BSD format within COFF format. */
|
||||
struct coffscn *tp, *dp, *bp;
|
||||
|
||||
tp = &coffheader.scns[0];
|
||||
dp = &coffheader.scns[1];
|
||||
bp = &coffheader.scns[2];
|
||||
|
||||
strcpy (tp->s_name, ".text");
|
||||
tp->s_paddr = text_start;
|
||||
tp->s_vaddr = text_start;
|
||||
tp->s_size = text_size;
|
||||
tp->s_scnptr = sizeof (struct coffheader) + sizeof (struct exec);
|
||||
tp->s_relptr = 0;
|
||||
tp->s_lnnoptr = 0;
|
||||
tp->s_nreloc = 0;
|
||||
tp->s_nlnno = 0;
|
||||
tp->s_flags = 0x20;
|
||||
strcpy (dp->s_name, ".data");
|
||||
dp->s_paddr = data_start;
|
||||
dp->s_vaddr = data_start;
|
||||
dp->s_size = data_size;
|
||||
dp->s_scnptr = tp->s_scnptr + tp->s_size;
|
||||
dp->s_relptr = 0;
|
||||
dp->s_lnnoptr = 0;
|
||||
dp->s_nreloc = 0;
|
||||
dp->s_nlnno = 0;
|
||||
dp->s_flags = 0x40;
|
||||
strcpy (bp->s_name, ".bss");
|
||||
bp->s_paddr = dp->s_vaddr + dp->s_size;
|
||||
bp->s_vaddr = bp->s_paddr;
|
||||
bp->s_size = bss_size;
|
||||
bp->s_scnptr = 0;
|
||||
bp->s_relptr = 0;
|
||||
bp->s_lnnoptr = 0;
|
||||
bp->s_nreloc = 0;
|
||||
bp->s_nlnno = 0;
|
||||
bp->s_flags = 0x80;
|
||||
|
||||
coffheader.f_magic = COFF_MAGIC;
|
||||
coffheader.f_nscns = 3;
|
||||
/* store an unlikely time so programs can
|
||||
* tell that there is a bsd header
|
||||
*/
|
||||
coffheader.f_timdat = 1;
|
||||
coffheader.f_symptr = 0;
|
||||
coffheader.f_nsyms = 0;
|
||||
coffheader.f_opthdr = 28;
|
||||
coffheader.f_flags = 0x103;
|
||||
/* aouthdr */
|
||||
coffheader.magic = ZMAGIC;
|
||||
coffheader.vstamp = 0;
|
||||
coffheader.tsize = tp->s_size;
|
||||
coffheader.dsize = dp->s_size;
|
||||
coffheader.bsize = bp->s_size;
|
||||
coffheader.entry = outheader.a_entry;
|
||||
coffheader.text_start = tp->s_vaddr;
|
||||
coffheader.data_start = dp->s_vaddr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COFF_ENCAPSULATE
|
||||
if (need_coff_header)
|
||||
mywrite (&coffheader, sizeof coffheader, 1, outdesc);
|
||||
#endif
|
||||
|
||||
#ifndef COFF_ENCAPSULATE
|
||||
padfile (N_TXTOFF (outheader) - sizeof outheader, outdesc);
|
||||
#endif
|
||||
|
||||
text_size -= N_TXTOFF (outheader);
|
||||
WRITE_HEADERS(abfd, execp);
|
||||
return true;
|
||||
}
|
||||
|
||||
#define MY_write_object_content encap_write_object_contents
|
||||
#define MY_object_p encap_object_p
|
||||
#define MY_exec_hdr_flags N_FLAGS_COFF_ENCAPSULATE
|
||||
|
||||
#include "aout-target.h"
|
|
@ -0,0 +1,370 @@
|
|||
/* BFD back-end for ns32k a.out-ish binaries.
|
||||
Copyright (C) 1990, 91, 92, 94, 95, 96, 1998 Free Software Foundation, Inc.
|
||||
Contributed by Ian Dall (idall@eleceng.adelaide.edu.au).
|
||||
|
||||
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
|
||||
|
||||
#include "bfd.h"
|
||||
#include "aout/aout64.h"
|
||||
#include "ns32k.h"
|
||||
|
||||
#define MYNS(OP) CAT(ns32kaout_,OP)
|
||||
reloc_howto_type *
|
||||
MYNS(bfd_reloc_type_lookup)
|
||||
PARAMS((bfd *abfd AND
|
||||
bfd_reloc_code_real_type code));
|
||||
|
||||
boolean
|
||||
MYNS(write_object_contents)
|
||||
PARAMS((bfd *abfd));
|
||||
|
||||
/* Avoid multiple definitions from aoutx if supporting standard a.out format(s)
|
||||
* as well as this one
|
||||
*/
|
||||
#define NAME(x,y) CAT3(ns32kaout,_32_,y)
|
||||
|
||||
void bfd_ns32k_arch PARAMS ((void));
|
||||
|
||||
#include "libaout.h"
|
||||
|
||||
#define MY(OP) MYNS(OP)
|
||||
|
||||
#define MY_swap_std_reloc_in MY(swap_std_reloc_in)
|
||||
#define MY_swap_std_reloc_out MY(swap_std_reloc_out)
|
||||
|
||||
static void
|
||||
MY_swap_std_reloc_in PARAMS ((bfd *abfd, struct reloc_std_external *bytes,
|
||||
arelent *cache_ptr, asymbol **symbols,
|
||||
bfd_size_type symcount));
|
||||
|
||||
static void
|
||||
MY_swap_std_reloc_out PARAMS ((bfd *abfd, arelent *g,
|
||||
struct reloc_std_external *natptr));
|
||||
|
||||
/* The ns32k series is ah, unusual, when it comes to relocation.
|
||||
* There are three storage methods for relocateable objects. There
|
||||
* are displacements, immediate operands and ordinary twos complement
|
||||
* data. Of these, only the last fits into the standard relocation
|
||||
* scheme. Immediate operands are stored huffman encoded and
|
||||
* immediate operands are stored big endian (where as the natural byte
|
||||
* order is little endian for this achitecture).
|
||||
|
||||
* Note that the ns32k displacement storage method is orthogonal to
|
||||
* whether the relocation is pc relative or not. The "displacement"
|
||||
* storage scheme is used for essentially all address constants. The
|
||||
* displacement can be relative to zero (absolute displacement),
|
||||
* relative to the pc (pc relative), the stack pointer, the frame
|
||||
* pointer, the static base register and general purpose register etc.
|
||||
|
||||
* For example:
|
||||
*
|
||||
* sym1: .long . # pc relative 2's complement
|
||||
* sym1: .long foo # 2's complement not pc relative
|
||||
*
|
||||
* self: movd @self, r0 # pc relative displacement
|
||||
* movd foo, r0 # non pc relative displacement
|
||||
*
|
||||
* self: movd self, r0 # pc relative immediate
|
||||
* movd foo, r0 # non pc relative immediate
|
||||
*
|
||||
* In addition, for historical reasons the encoding of the relocation types
|
||||
* in the a.out format relocation entries is such that even the relocation
|
||||
* methods which are standard are not encoded the standard way.
|
||||
*
|
||||
*/
|
||||
|
||||
reloc_howto_type MY(howto_table)[] =
|
||||
{
|
||||
/* ns32k immediate operands */
|
||||
HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 0, 8, false, 0, true,
|
||||
_bfd_ns32k_reloc_imm, "NS32K_IMM_8",
|
||||
true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_IMM_16, 0, 1, 16, false, 0, true,
|
||||
_bfd_ns32k_reloc_imm, "NS32K_IMM_16",
|
||||
true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_IMM_32, 0, 2, 32, false, 0, true,
|
||||
_bfd_ns32k_reloc_imm, "NS32K_IMM_32",
|
||||
true, 0xffffffff,0xffffffff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_IMM_8_PCREL, 0, 0, 8, true, 0, false,
|
||||
_bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_8",
|
||||
true, 0x000000ff, 0x000000ff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_IMM_16_PCREL, 0, 1, 16, true, 0, false,
|
||||
_bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_16",
|
||||
true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_IMM_32_PCREL, 0, 2, 32, true, 0, false,
|
||||
_bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_32",
|
||||
true, 0xffffffff,0xffffffff, false),
|
||||
|
||||
/* ns32k displacements */
|
||||
HOWTO (BFD_RELOC_NS32K_DISP_8, 0, 0, 8, false, 0, true,
|
||||
_bfd_ns32k_reloc_disp, "NS32K_DISP_8",
|
||||
true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_DISP_16, 0, 1, 16, false, 0, true,
|
||||
_bfd_ns32k_reloc_disp, "NS32K_DISP_16",
|
||||
true, 0x0000ffff, 0x0000ffff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_DISP_32, 0, 2, 32, false, 0, true,
|
||||
_bfd_ns32k_reloc_disp, "NS32K_DISP_32",
|
||||
true, 0xffffffff, 0xffffffff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_DISP_8_PCREL, 0, 0, 8, true, 0, false,
|
||||
_bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_8",
|
||||
true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_DISP_16_PCREL, 0, 1, 16, true, 0, false,
|
||||
_bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_16",
|
||||
true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO (BFD_RELOC_NS32K_DISP_32_PCREL, 0, 2, 32, true, 0, false,
|
||||
_bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_32",
|
||||
true, 0xffffffff,0xffffffff, false),
|
||||
|
||||
/* Normal 2's complement */
|
||||
HOWTO (BFD_RELOC_8, 0, 0, 8, false, 0, complain_overflow_bitfield,0,
|
||||
"8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO (BFD_RELOC_16, 0, 1, 16, false, 0, complain_overflow_bitfield,0,
|
||||
"16", true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO (BFD_RELOC_32, 0, 2, 32, false, 0, complain_overflow_bitfield,0,
|
||||
"32", true, 0xffffffff,0xffffffff, false),
|
||||
HOWTO (BFD_RELOC_8_PCREL, 0, 0, 8, true, 0, complain_overflow_signed, 0,
|
||||
"PCREL_8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO (BFD_RELOC_16_PCREL, 0, 1, 16, true, 0, complain_overflow_signed, 0,
|
||||
"PCREL_16", true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO (BFD_RELOC_32_PCREL, 0, 2, 32, true, 0, complain_overflow_signed, 0,
|
||||
"PCREL_32", true, 0xffffffff,0xffffffff, false),
|
||||
};
|
||||
|
||||
|
||||
#define CTOR_TABLE_RELOC_HOWTO(BFD) (MY(howto_table) + 14)
|
||||
|
||||
#define RELOC_STD_BITS_NS32K_TYPE_BIG 0x06
|
||||
#define RELOC_STD_BITS_NS32K_TYPE_LITTLE 0x60
|
||||
#define RELOC_STD_BITS_NS32K_TYPE_SH_BIG 1
|
||||
#define RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE 5
|
||||
|
||||
reloc_howto_type *
|
||||
MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
|
||||
bfd *abfd;
|
||||
struct reloc_std_external *rel;
|
||||
int *r_index;
|
||||
int *r_extern;
|
||||
int *r_pcrel;
|
||||
{
|
||||
unsigned int r_length;
|
||||
int r_ns32k_type;
|
||||
/* BFD_ASSERT(bfd_header_little_endian (abfd)); */
|
||||
*r_index = ((rel->r_index[2] << 16)
|
||||
| (rel->r_index[1] << 8)
|
||||
| rel->r_index[0] );
|
||||
*r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
|
||||
*r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
|
||||
r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
|
||||
>> RELOC_STD_BITS_LENGTH_SH_LITTLE);
|
||||
r_ns32k_type = ((rel->r_type[0] & RELOC_STD_BITS_NS32K_TYPE_LITTLE)
|
||||
>> RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE);
|
||||
return (MY(howto_table) + r_length + 3 * (*r_pcrel) + 6 * r_ns32k_type);
|
||||
}
|
||||
|
||||
#define MY_reloc_howto(BFD,REL,IN,EX,PC) MY(reloc_howto)(BFD, REL, &IN, &EX, &PC)
|
||||
|
||||
void
|
||||
MY(put_reloc)(abfd, r_extern, r_index, value, howto, reloc)
|
||||
bfd *abfd;
|
||||
int r_extern;
|
||||
int r_index;
|
||||
long value;
|
||||
reloc_howto_type *howto;
|
||||
struct reloc_std_external *reloc;
|
||||
{
|
||||
unsigned int r_length;
|
||||
int r_pcrel;
|
||||
int r_ns32k_type;
|
||||
PUT_WORD (abfd, value, reloc->r_address);
|
||||
r_length = howto->size ; /* Size as a power of two */
|
||||
r_pcrel = (int) howto->pc_relative; /* Relative to PC? */
|
||||
r_ns32k_type = (howto - MY(howto_table) )/6;
|
||||
/* BFD_ASSERT (bfd_header_little_endian (abfd)); */
|
||||
reloc->r_index[2] = r_index >> 16;
|
||||
reloc->r_index[1] = r_index >> 8;
|
||||
reloc->r_index[0] = r_index;
|
||||
reloc->r_type[0] =
|
||||
(r_extern? RELOC_STD_BITS_EXTERN_LITTLE: 0)
|
||||
| (r_pcrel? RELOC_STD_BITS_PCREL_LITTLE: 0)
|
||||
| (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)
|
||||
| (r_ns32k_type << RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE);
|
||||
}
|
||||
|
||||
#define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \
|
||||
MY(put_reloc)(BFD, EXT, IDX, VAL, HOWTO, RELOC)
|
||||
|
||||
#define STAT_FOR_EXEC
|
||||
|
||||
#define MY_final_link_relocate _bfd_ns32k_final_link_relocate
|
||||
#define MY_relocate_contents _bfd_ns32k_relocate_contents
|
||||
|
||||
#include <aoutx.h>
|
||||
|
||||
reloc_howto_type *
|
||||
MY(bfd_reloc_type_lookup)(abfd,code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
|
||||
#define ENTRY(i,j) case i: return &MY(howto_table)[j]
|
||||
|
||||
int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE;
|
||||
|
||||
BFD_ASSERT(ext == 0);
|
||||
if (code == BFD_RELOC_CTOR)
|
||||
switch (bfd_get_arch_info (abfd)->bits_per_address)
|
||||
{
|
||||
case 32:
|
||||
code = BFD_RELOC_32;
|
||||
break;
|
||||
}
|
||||
switch (code)
|
||||
{
|
||||
ENTRY(BFD_RELOC_NS32K_IMM_8, 0);
|
||||
ENTRY(BFD_RELOC_NS32K_IMM_16, 1);
|
||||
ENTRY(BFD_RELOC_NS32K_IMM_32, 2);
|
||||
ENTRY(BFD_RELOC_NS32K_IMM_8_PCREL, 3);
|
||||
ENTRY(BFD_RELOC_NS32K_IMM_16_PCREL, 4);
|
||||
ENTRY(BFD_RELOC_NS32K_IMM_32_PCREL, 5);
|
||||
ENTRY(BFD_RELOC_NS32K_DISP_8, 6);
|
||||
ENTRY(BFD_RELOC_NS32K_DISP_16, 7);
|
||||
ENTRY(BFD_RELOC_NS32K_DISP_32, 8);
|
||||
ENTRY(BFD_RELOC_NS32K_DISP_8_PCREL, 9);
|
||||
ENTRY(BFD_RELOC_NS32K_DISP_16_PCREL, 10);
|
||||
ENTRY(BFD_RELOC_NS32K_DISP_32_PCREL, 11);
|
||||
ENTRY(BFD_RELOC_8, 12);
|
||||
ENTRY(BFD_RELOC_16, 13);
|
||||
ENTRY(BFD_RELOC_32, 14);
|
||||
ENTRY(BFD_RELOC_8_PCREL, 15);
|
||||
ENTRY(BFD_RELOC_16_PCREL, 16);
|
||||
ENTRY(BFD_RELOC_32_PCREL, 17);
|
||||
default: return (reloc_howto_type *) NULL;
|
||||
}
|
||||
#undef ENTRY
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
|
||||
bfd *abfd;
|
||||
struct reloc_std_external *bytes;
|
||||
arelent *cache_ptr;
|
||||
asymbol **symbols;
|
||||
bfd_size_type symcount;
|
||||
{
|
||||
int r_index;
|
||||
int r_extern;
|
||||
int r_pcrel;
|
||||
struct aoutdata *su = &(abfd->tdata.aout_data->a);
|
||||
|
||||
cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address);
|
||||
|
||||
/* now the fun stuff */
|
||||
|
||||
cache_ptr->howto = MY_reloc_howto(abfd, bytes, r_index, r_extern, r_pcrel);
|
||||
|
||||
MOVE_ADDRESS(0);
|
||||
}
|
||||
|
||||
static void
|
||||
MY_swap_std_reloc_out (abfd, g, natptr)
|
||||
bfd *abfd;
|
||||
arelent *g;
|
||||
struct reloc_std_external *natptr;
|
||||
{
|
||||
int r_index;
|
||||
asymbol *sym = *(g->sym_ptr_ptr);
|
||||
int r_extern;
|
||||
unsigned int r_addend;
|
||||
asection *output_section = sym->section->output_section;
|
||||
|
||||
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
|
||||
|
||||
/* name was clobbered by aout_write_syms to be symbol index */
|
||||
|
||||
/* If this relocation is relative to a symbol then set the
|
||||
r_index to the symbols index, and the r_extern bit.
|
||||
|
||||
Absolute symbols can come in in two ways, either as an offset
|
||||
from the abs section, or as a symbol which has an abs value.
|
||||
Check for that here. */
|
||||
|
||||
if (bfd_is_com_section (output_section)
|
||||
|| output_section == &bfd_abs_section
|
||||
|| output_section == &bfd_und_section)
|
||||
{
|
||||
if (bfd_abs_section.symbol == sym)
|
||||
{
|
||||
/* Whoops, looked like an abs symbol, but is really an offset
|
||||
from the abs section */
|
||||
r_index = 0;
|
||||
r_extern = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fill in symbol */
|
||||
r_extern = 1;
|
||||
#undef KEEPIT
|
||||
#define KEEPIT udata.i
|
||||
r_index = (*(g->sym_ptr_ptr))->KEEPIT;
|
||||
#undef KEEPIT
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Just an ordinary section */
|
||||
r_extern = 0;
|
||||
r_index = output_section->target_index;
|
||||
}
|
||||
|
||||
MY_put_reloc (abfd, r_extern, r_index, g->address, g->howto, natptr);
|
||||
}
|
||||
|
||||
bfd_reloc_status_type
|
||||
_bfd_ns32k_relocate_contents (howto, input_bfd, relocation, location)
|
||||
reloc_howto_type *howto;
|
||||
bfd *input_bfd;
|
||||
bfd_vma relocation;
|
||||
bfd_byte *location;
|
||||
{
|
||||
int r_ns32k_type = (howto - MY(howto_table)) / 6;
|
||||
long (*get_data) PARAMS ((bfd_byte *, long, long));
|
||||
int (*put_data) PARAMS ((long, bfd_byte *, long, long));
|
||||
|
||||
switch (r_ns32k_type)
|
||||
{
|
||||
case 0:
|
||||
get_data = _bfd_ns32k_get_immediate;
|
||||
put_data = _bfd_ns32k_put_immediate;
|
||||
break;
|
||||
case 1:
|
||||
get_data = _bfd_ns32k_get_displacement;
|
||||
put_data = _bfd_ns32k_put_displacement;
|
||||
break;
|
||||
case 2:
|
||||
return _bfd_relocate_contents (howto, input_bfd, relocation,
|
||||
location);
|
||||
/* NOT REACHED */
|
||||
break;
|
||||
default:
|
||||
return bfd_reloc_notsupported;
|
||||
}
|
||||
return _bfd_do_ns32k_reloc_contents (howto, input_bfd, relocation,
|
||||
location, get_data, put_data);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* BFD backend for sparc little-endian aout binaries.
|
||||
Copyright (C) 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. */
|
||||
|
||||
#define TARGETNAME "a.out-sparc-little"
|
||||
#define MY(OP) CAT(sparcle_aout_,OP)
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bfdlink.h"
|
||||
#include "libaout.h"
|
||||
|
||||
#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_SPARCLET)
|
||||
|
||||
/* Include the usual a.out support. */
|
||||
#define TARGET_IS_LITTLE_ENDIAN_P
|
||||
#include "aoutf1.h"
|
|
@ -0,0 +1,650 @@
|
|||
/* Define a target vector and some small routines for a variant of a.out.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997
|
||||
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"*/
|
||||
|
||||
#ifndef SEGMENT_SIZE
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#endif
|
||||
|
||||
extern reloc_howto_type * NAME(aout,reloc_type_lookup)
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
|
||||
/* 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) PARAMS ((bfd *));
|
||||
|
||||
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);
|
||||
|
||||
/* For some targets, if the entry point is not in the same page
|
||||
as the start of the text, then adjust the VMA so that it is.
|
||||
FIXME: Do this with a macro like SET_ARCH_MACH instead? */
|
||||
if (aout_backend_info (abfd)->entry_is_text_address
|
||||
&& execp->a_entry > obj_textsec (abfd)->vma)
|
||||
{
|
||||
bfd_vma adjust;
|
||||
|
||||
adjust = execp->a_entry - obj_textsec (abfd)->vma;
|
||||
/* Adjust only by whole pages. */
|
||||
adjust &= ~(TARGET_PAGE_SIZE - 1);
|
||||
obj_textsec (abfd)->vma += adjust;
|
||||
obj_datasec (abfd)->vma += adjust;
|
||||
obj_bsssec (abfd)->vma += adjust;
|
||||
}
|
||||
|
||||
/* Set the load addresses to be the same as the virtual addresses. */
|
||||
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
|
||||
|
||||
/* The number of relocation records. This must be called after
|
||||
SET_ARCH_MACH. It assumes that SET_ARCH_MACH will set
|
||||
obj_reloc_entry_size correctly, if the reloc size is not
|
||||
RELOC_STD_SIZE. */
|
||||
obj_textsec (abfd)->reloc_count =
|
||||
execp->a_trsize / obj_reloc_entry_size (abfd);
|
||||
obj_datasec (abfd)->reloc_count =
|
||||
execp->a_drsize / obj_reloc_entry_size (abfd);
|
||||
|
||||
/* 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;
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
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) PARAMS ((bfd *));
|
||||
|
||||
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) PARAMS ((bfd *));
|
||||
|
||||
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;
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
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. */
|
||||
|
||||
static boolean MY_bfd_copy_private_section_data
|
||||
PARAMS ((bfd *, asection *, bfd *, asection *));
|
||||
|
||||
/*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 (ibfd) == bfd_target_aout_flavour
|
||||
&& 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) PARAMS ((bfd *));
|
||||
|
||||
static boolean
|
||||
MY(set_sizes) (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
adata(abfd).page_size = TARGET_PAGE_SIZE;
|
||||
adata(abfd).segment_size = SEGMENT_SIZE;
|
||||
|
||||
#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_entry_is_text_address
|
||||
#define MY_entry_is_text_address 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_entry_is_text_address,
|
||||
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 PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
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_gc_sections
|
||||
#define MY_bfd_gc_sections bfd_generic_gc_sections
|
||||
#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_name
|
||||
#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
|
||||
#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 | SEC_CODE | SEC_DATA),
|
||||
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 */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,32 @@
|
|||
/* BFD backend for SunOS style a.out with flags set to 0
|
||||
Copyright (C) 1990, 91, 92, 93, 1994 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 TARGETNAME "a.out-zero-big"
|
||||
#define MY(OP) CAT(aout0_big_,OP)
|
||||
|
||||
#include "bfd.h"
|
||||
|
||||
#define MY_exec_hdr_flags 0
|
||||
|
||||
#define MACHTYPE_OK(mtype) \
|
||||
((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020)
|
||||
|
||||
/* Include the usual a.out support. */
|
||||
#include "aoutf1.h"
|
|
@ -0,0 +1,23 @@
|
|||
/* 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"
|
|
@ -0,0 +1,31 @@
|
|||
/* BFD back-end for 64-bit a.out 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. */
|
||||
|
||||
#define ARCH_SIZE 64
|
||||
|
||||
/* aoutx.h requires definitions for BMAGIC and QMAGIC. */
|
||||
#ifndef BMAGIC
|
||||
#define BMAGIC 0
|
||||
#endif
|
||||
#ifndef QMAGIC
|
||||
#define QMAGIC 0
|
||||
#endif
|
||||
|
||||
#include "aoutx.h"
|
|
@ -0,0 +1,859 @@
|
|||
/* A.out "format 1" file handling code for BFD.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
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 "aout/sun4.h"
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
|
||||
#include "aout/aout64.h"
|
||||
#include "aout/stab_gnu.h"
|
||||
#include "aout/ar.h"
|
||||
|
||||
/* This is needed to reject a NewsOS file, e.g. in
|
||||
gdb/testsuite/gdb.t10/crossload.exp. <kingdon@cygnus.com>
|
||||
I needed to add M_UNKNOWN to recognize a 68000 object, so this will
|
||||
probably no longer reject a NewsOS object. <ian@cygnus.com>. */
|
||||
#ifndef MACHTYPE_OK
|
||||
#define MACHTYPE_OK(mtype) \
|
||||
(((mtype) == M_SPARC && bfd_lookup_arch (bfd_arch_sparc, 0) != NULL) \
|
||||
|| (((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020) \
|
||||
&& bfd_lookup_arch (bfd_arch_m68k, 0) != NULL))
|
||||
#endif
|
||||
|
||||
/*
|
||||
The file @code{aoutf1.h} contains the code for BFD's
|
||||
a.out back end. Control over the generated back end is given by these
|
||||
two preprocessor names:
|
||||
@table @code
|
||||
@item ARCH_SIZE
|
||||
This value should be either 32 or 64, depending upon the size of an
|
||||
int in the target format. It changes the sizes of the structs which
|
||||
perform the memory/disk mapping of structures.
|
||||
|
||||
The 64 bit backend may only be used if the host compiler supports 64
|
||||
ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}.
|
||||
With this name defined, @emph{all} bfd operations are performed with 64bit
|
||||
arithmetic, not just those to a 64bit target.
|
||||
|
||||
@item TARGETNAME
|
||||
The name put into the target vector.
|
||||
@item
|
||||
@end table
|
||||
|
||||
*/
|
||||
|
||||
/*SUPPRESS558*/
|
||||
/*SUPPRESS529*/
|
||||
|
||||
#if ARCH_SIZE == 64
|
||||
#define sunos_set_arch_mach sunos_64_set_arch_mach
|
||||
#define sunos_write_object_contents aout_64_sunos4_write_object_contents
|
||||
#else
|
||||
#define sunos_set_arch_mach sunos_32_set_arch_mach
|
||||
#define sunos_write_object_contents aout_32_sunos4_write_object_contents
|
||||
#endif
|
||||
|
||||
static boolean sunos_merge_private_bfd_data PARAMS ((bfd *, bfd *));
|
||||
static void sunos_set_arch_mach PARAMS ((bfd *, int));
|
||||
static void choose_reloc_size PARAMS ((bfd *));
|
||||
static boolean sunos_write_object_contents PARAMS ((bfd *));
|
||||
static const bfd_target *sunos4_core_file_p PARAMS ((bfd *));
|
||||
static char *sunos4_core_file_failing_command PARAMS ((bfd *));
|
||||
static int sunos4_core_file_failing_signal PARAMS ((bfd *));
|
||||
static boolean sunos4_core_file_matches_executable_p PARAMS ((bfd *, bfd *));
|
||||
static boolean sunos4_set_sizes PARAMS ((bfd *));
|
||||
|
||||
/* Merge backend data into the output file.
|
||||
This is necessary on sparclet-aout where we want the resultant machine
|
||||
number to be M_SPARCLET if any input file is M_SPARCLET. */
|
||||
|
||||
#define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data
|
||||
|
||||
static boolean
|
||||
sunos_merge_private_bfd_data (ibfd, obfd)
|
||||
bfd *ibfd, *obfd;
|
||||
{
|
||||
if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour
|
||||
|| bfd_get_flavour (obfd) != bfd_target_aout_flavour)
|
||||
return true;
|
||||
|
||||
if (bfd_get_arch (obfd) == bfd_arch_sparc)
|
||||
{
|
||||
if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
|
||||
bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* This is either sunos_32_set_arch_mach or sunos_64_set_arch_mach,
|
||||
depending upon ARCH_SIZE. */
|
||||
|
||||
static void
|
||||
sunos_set_arch_mach (abfd, machtype)
|
||||
bfd *abfd;
|
||||
int machtype;
|
||||
{
|
||||
/* Determine the architecture and machine type of the object file. */
|
||||
enum bfd_architecture arch;
|
||||
long machine;
|
||||
switch (machtype)
|
||||
{
|
||||
|
||||
case M_UNKNOWN:
|
||||
/* Some Sun3s make magic numbers without cpu types in them, so
|
||||
we'll default to the 68000. */
|
||||
arch = bfd_arch_m68k;
|
||||
machine = bfd_mach_m68000;
|
||||
break;
|
||||
|
||||
case M_68010:
|
||||
case M_HP200:
|
||||
arch = bfd_arch_m68k;
|
||||
machine = bfd_mach_m68010;
|
||||
break;
|
||||
|
||||
case M_68020:
|
||||
case M_HP300:
|
||||
arch = bfd_arch_m68k;
|
||||
machine = bfd_mach_m68020;
|
||||
break;
|
||||
|
||||
case M_SPARC:
|
||||
arch = bfd_arch_sparc;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
case M_SPARCLET:
|
||||
arch = bfd_arch_sparc;
|
||||
machine = bfd_mach_sparc_sparclet;
|
||||
break;
|
||||
|
||||
case M_SPARCLITE_LE:
|
||||
arch = bfd_arch_sparc;
|
||||
machine = bfd_mach_sparc_sparclite_le;
|
||||
break;
|
||||
|
||||
case M_386:
|
||||
case M_386_DYNIX:
|
||||
arch = bfd_arch_i386;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
case M_29K:
|
||||
arch = bfd_arch_a29k;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
case M_HPUX:
|
||||
arch = bfd_arch_m68k;
|
||||
machine = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
arch = bfd_arch_obscure;
|
||||
machine = 0;
|
||||
break;
|
||||
}
|
||||
bfd_set_arch_mach (abfd, arch, machine);
|
||||
}
|
||||
|
||||
#define SET_ARCH_MACH(ABFD, EXEC) \
|
||||
NAME(sunos,set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \
|
||||
choose_reloc_size(ABFD);
|
||||
|
||||
/* Determine the size of a relocation entry, based on the architecture */
|
||||
static void
|
||||
choose_reloc_size (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
switch (bfd_get_arch (abfd))
|
||||
{
|
||||
case bfd_arch_sparc:
|
||||
case bfd_arch_a29k:
|
||||
obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
|
||||
break;
|
||||
default:
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Write an object file in SunOS format. Section contents have
|
||||
already been written. We write the file header, symbols, and
|
||||
relocation. The real name of this function is either
|
||||
aout_64_sunos4_write_object_contents or
|
||||
aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */
|
||||
|
||||
static boolean
|
||||
sunos_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
/* Magic number, maestro, please! */
|
||||
switch (bfd_get_arch (abfd))
|
||||
{
|
||||
case bfd_arch_m68k:
|
||||
switch (bfd_get_mach (abfd))
|
||||
{
|
||||
case bfd_mach_m68000:
|
||||
N_SET_MACHTYPE (*execp, M_UNKNOWN);
|
||||
break;
|
||||
case bfd_mach_m68010:
|
||||
N_SET_MACHTYPE (*execp, M_68010);
|
||||
break;
|
||||
default:
|
||||
case bfd_mach_m68020:
|
||||
N_SET_MACHTYPE (*execp, M_68020);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case bfd_arch_sparc:
|
||||
switch (bfd_get_mach (abfd))
|
||||
{
|
||||
case bfd_mach_sparc_sparclet:
|
||||
N_SET_MACHTYPE (*execp, M_SPARCLET);
|
||||
break;
|
||||
case bfd_mach_sparc_sparclite_le:
|
||||
N_SET_MACHTYPE (*execp, M_SPARCLITE_LE);
|
||||
break;
|
||||
default:
|
||||
N_SET_MACHTYPE (*execp, M_SPARC);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case bfd_arch_i386:
|
||||
N_SET_MACHTYPE (*execp, M_386);
|
||||
break;
|
||||
case bfd_arch_a29k:
|
||||
N_SET_MACHTYPE (*execp, M_29K);
|
||||
break;
|
||||
default:
|
||||
N_SET_MACHTYPE (*execp, M_UNKNOWN);
|
||||
}
|
||||
|
||||
choose_reloc_size (abfd);
|
||||
|
||||
N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
|
||||
|
||||
N_SET_DYNAMIC (*execp, bfd_get_file_flags (abfd) & DYNAMIC);
|
||||
|
||||
WRITE_HEADERS (abfd, execp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* core files */
|
||||
|
||||
#define CORE_MAGIC 0x080456
|
||||
#define CORE_NAMELEN 16
|
||||
|
||||
/* The core structure is taken from the Sun documentation.
|
||||
Unfortunately, they don't document the FPA structure, or at least I
|
||||
can't find it easily. Fortunately the core header contains its own
|
||||
length. So this shouldn't cause problems, except for c_ucode, which
|
||||
so far we don't use but is easy to find with a little arithmetic. */
|
||||
|
||||
/* But the reg structure can be gotten from the SPARC processor handbook.
|
||||
This really should be in a GNU include file though so that gdb can use
|
||||
the same info. */
|
||||
struct regs
|
||||
{
|
||||
int r_psr;
|
||||
int r_pc;
|
||||
int r_npc;
|
||||
int r_y;
|
||||
int r_g1;
|
||||
int r_g2;
|
||||
int r_g3;
|
||||
int r_g4;
|
||||
int r_g5;
|
||||
int r_g6;
|
||||
int r_g7;
|
||||
int r_o0;
|
||||
int r_o1;
|
||||
int r_o2;
|
||||
int r_o3;
|
||||
int r_o4;
|
||||
int r_o5;
|
||||
int r_o6;
|
||||
int r_o7;
|
||||
};
|
||||
|
||||
/* Taken from Sun documentation: */
|
||||
|
||||
/* FIXME: It's worse than we expect. This struct contains TWO substructs
|
||||
neither of whose size we know, WITH STUFF IN BETWEEN THEM! We can't
|
||||
even portably access the stuff in between! */
|
||||
|
||||
struct external_sparc_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
#define SPARC_CORE_LEN 432
|
||||
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
|
||||
struct external_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's alignment
|
||||
is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
portably know the size of fp_stuff.) */
|
||||
};
|
||||
|
||||
/* Core files generated by the BCP (the part of Solaris which allows
|
||||
it to run SunOS4 a.out files). */
|
||||
struct external_solaris_bcp_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
#define SOLARIS_BCP_CORE_LEN 456
|
||||
int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */
|
||||
int c_exdata_vp; /* exdata structure */
|
||||
int c_exdata_tsize;
|
||||
int c_exdata_dsize;
|
||||
int c_exdata_bsize;
|
||||
int c_exdata_lsize;
|
||||
int c_exdata_nshlibs;
|
||||
short c_exdata_mach;
|
||||
short c_exdata_mag;
|
||||
int c_exdata_toffset;
|
||||
int c_exdata_doffset;
|
||||
int c_exdata_loffset;
|
||||
int c_exdata_txtorg;
|
||||
int c_exdata_datorg;
|
||||
int c_exdata_entloc;
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's alignment
|
||||
is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
portably know the size of fp_stuff.) */
|
||||
};
|
||||
|
||||
struct external_sun3_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1 */
|
||||
int c_regs[18]; /* General purpose registers -- MACHDEP SIZE */
|
||||
struct external_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
double fp_stuff[1]; /* external FPU state (size unknown by us) */
|
||||
/* The type "double" is critical here, for alignment.
|
||||
SunOS declares a struct here, but the struct's alignment
|
||||
is double since it contains doubles. */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
/* (this member is not accessible by name since we don't
|
||||
portably know the size of fp_stuff.) */
|
||||
};
|
||||
|
||||
struct internal_sunos_core
|
||||
{
|
||||
int c_magic; /* Corefile magic number */
|
||||
int c_len; /* Sizeof (struct core) */
|
||||
long c_regs_pos; /* file offset of General purpose registers */
|
||||
int c_regs_size; /* size of General purpose registers */
|
||||
struct internal_exec c_aouthdr; /* A.out header */
|
||||
int c_signo; /* Killing signal, if any */
|
||||
int c_tsize; /* Text size (bytes) */
|
||||
int c_dsize; /* Data size (bytes) */
|
||||
bfd_vma c_data_addr; /* Data start (address) */
|
||||
int c_ssize; /* Stack size (bytes) */
|
||||
bfd_vma c_stacktop; /* Stack top (address) */
|
||||
char c_cmdname[CORE_NAMELEN + 1]; /* Command name */
|
||||
long fp_stuff_pos; /* file offset of external FPU state (regs) */
|
||||
int fp_stuff_size; /* Size of it */
|
||||
int c_ucode; /* Exception no. from u_code */
|
||||
};
|
||||
|
||||
static void swapcore_sun3
|
||||
PARAMS ((bfd *, char *, struct internal_sunos_core *));
|
||||
static void swapcore_sparc
|
||||
PARAMS ((bfd *, char *, struct internal_sunos_core *));
|
||||
static void swapcore_solaris_bcp
|
||||
PARAMS ((bfd *, char *, struct internal_sunos_core *));
|
||||
|
||||
/* byte-swap in the Sun-3 core structure */
|
||||
static void
|
||||
swapcore_sun3 (abfd, ext, intcore)
|
||||
bfd *abfd;
|
||||
char *ext;
|
||||
struct internal_sunos_core *intcore;
|
||||
{
|
||||
struct external_sun3_core *extcore = (struct external_sun3_core *) ext;
|
||||
|
||||
intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic);
|
||||
intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len);
|
||||
intcore->c_regs_pos = (long) (((struct external_sun3_core *) 0)->c_regs);
|
||||
intcore->c_regs_size = sizeof (extcore->c_regs);
|
||||
#if ARCH_SIZE == 64
|
||||
aout_64_swap_exec_header_in
|
||||
#else
|
||||
aout_32_swap_exec_header_in
|
||||
#endif
|
||||
(abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
|
||||
intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo);
|
||||
intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize);
|
||||
intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize);
|
||||
intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr);
|
||||
intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
|
||||
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
|
||||
intcore->fp_stuff_pos = (long) (((struct external_sun3_core *) 0)->fp_stuff);
|
||||
/* FP stuff takes up whole rest of struct, except c_ucode. */
|
||||
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
|
||||
(file_ptr) (((struct external_sun3_core *) 0)->fp_stuff);
|
||||
/* Ucode is the last thing in the struct -- just before the end */
|
||||
intcore->c_ucode =
|
||||
bfd_h_get_32 (abfd,
|
||||
intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore);
|
||||
intcore->c_stacktop = 0x0E000000; /* By experimentation */
|
||||
}
|
||||
|
||||
|
||||
/* byte-swap in the Sparc core structure */
|
||||
static void
|
||||
swapcore_sparc (abfd, ext, intcore)
|
||||
bfd *abfd;
|
||||
char *ext;
|
||||
struct internal_sunos_core *intcore;
|
||||
{
|
||||
struct external_sparc_core *extcore = (struct external_sparc_core *) ext;
|
||||
|
||||
intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic);
|
||||
intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len);
|
||||
intcore->c_regs_pos = (long) (((struct external_sparc_core *) 0)->c_regs);
|
||||
intcore->c_regs_size = sizeof (extcore->c_regs);
|
||||
#if ARCH_SIZE == 64
|
||||
aout_64_swap_exec_header_in
|
||||
#else
|
||||
aout_32_swap_exec_header_in
|
||||
#endif
|
||||
(abfd, &extcore->c_aouthdr, &intcore->c_aouthdr);
|
||||
intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo);
|
||||
intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize);
|
||||
intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize);
|
||||
intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr);
|
||||
intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
|
||||
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
|
||||
intcore->fp_stuff_pos = (long) (((struct external_sparc_core *) 0)->fp_stuff);
|
||||
/* FP stuff takes up whole rest of struct, except c_ucode. */
|
||||
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
|
||||
(file_ptr) (((struct external_sparc_core *) 0)->fp_stuff);
|
||||
/* Ucode is the last thing in the struct -- just before the end */
|
||||
intcore->c_ucode =
|
||||
bfd_h_get_32 (abfd,
|
||||
intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore);
|
||||
|
||||
/* Supposedly the user stack grows downward from the bottom of kernel memory.
|
||||
Presuming that this remains true, this definition will work. */
|
||||
/* Now sun has provided us with another challenge. The value is different
|
||||
for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or
|
||||
the other based on the current value of the stack pointer. This
|
||||
loses (a) if the stack pointer has been clobbered, or (b) if the stack
|
||||
is larger than 128 megabytes.
|
||||
|
||||
It's times like these you're glad they're switching to ELF.
|
||||
|
||||
Note that using include files or nlist on /vmunix would be wrong,
|
||||
because we want the value for this core file, no matter what kind of
|
||||
machine we were compiled on or are running on. */
|
||||
#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
|
||||
#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
|
||||
{
|
||||
bfd_vma sp = bfd_h_get_32
|
||||
(abfd, (unsigned char *) &((struct regs *) &extcore->c_regs[0])->r_o6);
|
||||
if (sp < SPARC_USRSTACK_SPARC10)
|
||||
intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
|
||||
else
|
||||
intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
|
||||
}
|
||||
}
|
||||
|
||||
/* byte-swap in the Solaris BCP core structure */
|
||||
static void
|
||||
swapcore_solaris_bcp (abfd, ext, intcore)
|
||||
bfd *abfd;
|
||||
char *ext;
|
||||
struct internal_sunos_core *intcore;
|
||||
{
|
||||
struct external_solaris_bcp_core *extcore =
|
||||
(struct external_solaris_bcp_core *) ext;
|
||||
|
||||
intcore->c_magic = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_magic);
|
||||
intcore->c_len = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_len);
|
||||
intcore->c_regs_pos = (long) (((struct external_solaris_bcp_core *) 0)->c_regs);
|
||||
intcore->c_regs_size = sizeof (extcore->c_regs);
|
||||
|
||||
/* The Solaris BCP exdata structure does not contain an a_syms field,
|
||||
so we are unable to synthesize an internal exec header.
|
||||
Luckily we are able to figure out the start address of the data section,
|
||||
which is the only thing needed from the internal exec header,
|
||||
from the exdata structure.
|
||||
|
||||
As of Solaris 2.3, BCP core files for statically linked executables
|
||||
are buggy. The exdata structure is not properly filled in, and
|
||||
the data section is written from address zero instead of the data
|
||||
start address. */
|
||||
memset ((PTR) &intcore->c_aouthdr, 0, sizeof (struct internal_exec));
|
||||
intcore->c_data_addr =
|
||||
bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_exdata_datorg);
|
||||
intcore->c_signo = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_signo);
|
||||
intcore->c_tsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_tsize);
|
||||
intcore->c_dsize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_dsize);
|
||||
intcore->c_ssize = bfd_h_get_32 (abfd, (unsigned char *) &extcore->c_ssize);
|
||||
memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname));
|
||||
intcore->fp_stuff_pos =
|
||||
(long) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
|
||||
/* FP stuff takes up whole rest of struct, except c_ucode. */
|
||||
intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) -
|
||||
(file_ptr) (((struct external_solaris_bcp_core *) 0)->fp_stuff);
|
||||
/* Ucode is the last thing in the struct -- just before the end */
|
||||
intcore->c_ucode =
|
||||
bfd_h_get_32 (abfd,
|
||||
intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore);
|
||||
|
||||
/* Supposedly the user stack grows downward from the bottom of kernel memory.
|
||||
Presuming that this remains true, this definition will work. */
|
||||
/* Now sun has provided us with another challenge. The value is different
|
||||
for sparc2 and sparc10 (both running SunOS 4.1.3). We pick one or
|
||||
the other based on the current value of the stack pointer. This
|
||||
loses (a) if the stack pointer has been clobbered, or (b) if the stack
|
||||
is larger than 128 megabytes.
|
||||
|
||||
It's times like these you're glad they're switching to ELF.
|
||||
|
||||
Note that using include files or nlist on /vmunix would be wrong,
|
||||
because we want the value for this core file, no matter what kind of
|
||||
machine we were compiled on or are running on. */
|
||||
#define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000)
|
||||
#define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000)
|
||||
{
|
||||
bfd_vma sp = bfd_h_get_32
|
||||
(abfd, (unsigned char *) &((struct regs *) &extcore->c_regs[0])->r_o6);
|
||||
if (sp < SPARC_USRSTACK_SPARC10)
|
||||
intcore->c_stacktop = SPARC_USRSTACK_SPARC10;
|
||||
else
|
||||
intcore->c_stacktop = SPARC_USRSTACK_SPARC2;
|
||||
}
|
||||
}
|
||||
|
||||
/* need this cast because ptr is really void * */
|
||||
#define core_hdr(bfd) ((bfd)->tdata.sun_core_data)
|
||||
#define core_datasec(bfd) (core_hdr(bfd)->data_section)
|
||||
#define core_stacksec(bfd) (core_hdr(bfd)->stack_section)
|
||||
#define core_regsec(bfd) (core_hdr(bfd)->reg_section)
|
||||
#define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section)
|
||||
|
||||
/* These are stored in the bfd's tdata */
|
||||
struct sun_core_struct
|
||||
{
|
||||
struct internal_sunos_core *hdr; /* core file header */
|
||||
asection *data_section;
|
||||
asection *stack_section;
|
||||
asection *reg_section;
|
||||
asection *reg2_section;
|
||||
};
|
||||
|
||||
static const bfd_target *
|
||||
sunos4_core_file_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
unsigned char longbuf[4]; /* Raw bytes of various header fields */
|
||||
bfd_size_type core_size;
|
||||
unsigned long core_mag;
|
||||
struct internal_sunos_core *core;
|
||||
char *extcore;
|
||||
struct mergem
|
||||
{
|
||||
struct sun_core_struct suncoredata;
|
||||
struct internal_sunos_core internal_sunos_core;
|
||||
char external_core[1];
|
||||
}
|
||||
*mergem;
|
||||
|
||||
if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) !=
|
||||
sizeof (longbuf))
|
||||
return 0;
|
||||
core_mag = bfd_h_get_32 (abfd, longbuf);
|
||||
|
||||
if (core_mag != CORE_MAGIC)
|
||||
return 0;
|
||||
|
||||
/* SunOS core headers can vary in length; second word is size; */
|
||||
if (bfd_read ((PTR) longbuf, 1, sizeof (longbuf), abfd) !=
|
||||
sizeof (longbuf))
|
||||
return 0;
|
||||
core_size = bfd_h_get_32 (abfd, longbuf);
|
||||
/* Sanity check */
|
||||
if (core_size > 20000)
|
||||
return 0;
|
||||
|
||||
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0)
|
||||
return 0;
|
||||
|
||||
mergem = (struct mergem *) bfd_zalloc (abfd, core_size + sizeof (struct mergem));
|
||||
if (mergem == NULL)
|
||||
return 0;
|
||||
|
||||
extcore = mergem->external_core;
|
||||
|
||||
if ((bfd_read ((PTR) extcore, 1, core_size, abfd)) != core_size)
|
||||
{
|
||||
bfd_release (abfd, (char *) mergem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Validate that it's a core file we know how to handle, due to sun
|
||||
botching the positioning of registers and other fields in a machine
|
||||
dependent way. */
|
||||
core = &mergem->internal_sunos_core;
|
||||
switch (core_size)
|
||||
{
|
||||
case SPARC_CORE_LEN:
|
||||
swapcore_sparc (abfd, extcore, core);
|
||||
break;
|
||||
case SUN3_CORE_LEN:
|
||||
swapcore_sun3 (abfd, extcore, core);
|
||||
break;
|
||||
case SOLARIS_BCP_CORE_LEN:
|
||||
swapcore_solaris_bcp (abfd, extcore, core);
|
||||
break;
|
||||
default:
|
||||
bfd_set_error (bfd_error_system_call); /* FIXME */
|
||||
bfd_release (abfd, (char *) mergem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
abfd->tdata.sun_core_data = &mergem->suncoredata;
|
||||
abfd->tdata.sun_core_data->hdr = core;
|
||||
|
||||
/* create the sections. This is raunchy, but bfd_close wants to reclaim
|
||||
them */
|
||||
core_stacksec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_stacksec (abfd) == NULL)
|
||||
{
|
||||
loser:
|
||||
bfd_release (abfd, (char *) mergem);
|
||||
return 0;
|
||||
}
|
||||
core_datasec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_datasec (abfd) == NULL)
|
||||
{
|
||||
loser1:
|
||||
bfd_release (abfd, core_stacksec (abfd));
|
||||
goto loser;
|
||||
}
|
||||
core_regsec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_regsec (abfd) == NULL)
|
||||
{
|
||||
loser2:
|
||||
bfd_release (abfd, core_datasec (abfd));
|
||||
goto loser1;
|
||||
}
|
||||
core_reg2sec (abfd) = (asection *) bfd_zalloc (abfd, sizeof (asection));
|
||||
if (core_reg2sec (abfd) == NULL)
|
||||
{
|
||||
bfd_release (abfd, core_regsec (abfd));
|
||||
goto loser2;
|
||||
}
|
||||
|
||||
core_stacksec (abfd)->name = ".stack";
|
||||
core_datasec (abfd)->name = ".data";
|
||||
core_regsec (abfd)->name = ".reg";
|
||||
core_reg2sec (abfd)->name = ".reg2";
|
||||
|
||||
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_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
|
||||
|
||||
core_stacksec (abfd)->_raw_size = core->c_ssize;
|
||||
core_datasec (abfd)->_raw_size = core->c_dsize;
|
||||
core_regsec (abfd)->_raw_size = core->c_regs_size;
|
||||
core_reg2sec (abfd)->_raw_size = core->fp_stuff_size;
|
||||
|
||||
core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize);
|
||||
core_datasec (abfd)->vma = core->c_data_addr;
|
||||
core_regsec (abfd)->vma = 0;
|
||||
core_reg2sec (abfd)->vma = 0;
|
||||
|
||||
core_stacksec (abfd)->filepos = core->c_len + core->c_dsize;
|
||||
core_datasec (abfd)->filepos = core->c_len;
|
||||
/* We'll access the regs afresh in the core file, like any section: */
|
||||
core_regsec (abfd)->filepos = (file_ptr) core->c_regs_pos;
|
||||
core_reg2sec (abfd)->filepos = (file_ptr) core->fp_stuff_pos;
|
||||
|
||||
/* Align to word at least */
|
||||
core_stacksec (abfd)->alignment_power = 2;
|
||||
core_datasec (abfd)->alignment_power = 2;
|
||||
core_regsec (abfd)->alignment_power = 2;
|
||||
core_reg2sec (abfd)->alignment_power = 2;
|
||||
|
||||
abfd->sections = core_stacksec (abfd);
|
||||
core_stacksec (abfd)->next = core_datasec (abfd);
|
||||
core_datasec (abfd)->next = core_regsec (abfd);
|
||||
core_regsec (abfd)->next = core_reg2sec (abfd);
|
||||
|
||||
abfd->section_count = 4;
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
static char *
|
||||
sunos4_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return core_hdr (abfd)->hdr->c_cmdname;
|
||||
}
|
||||
|
||||
static int
|
||||
sunos4_core_file_failing_signal (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return core_hdr (abfd)->hdr->c_signo;
|
||||
}
|
||||
|
||||
static boolean
|
||||
sunos4_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd;
|
||||
bfd *exec_bfd;
|
||||
{
|
||||
if (core_bfd->xvec != exec_bfd->xvec)
|
||||
{
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Solaris core files do not include an aouthdr. */
|
||||
if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN)
|
||||
return true;
|
||||
|
||||
return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr),
|
||||
(char *) exec_hdr (exec_bfd),
|
||||
sizeof (struct internal_exec)) == 0) ? true : false;
|
||||
}
|
||||
|
||||
#define MY_set_sizes sunos4_set_sizes
|
||||
static boolean
|
||||
sunos4_set_sizes (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
switch (bfd_get_arch (abfd))
|
||||
{
|
||||
default:
|
||||
return false;
|
||||
case bfd_arch_sparc:
|
||||
adata (abfd).page_size = 0x2000;
|
||||
adata (abfd).segment_size = 0x2000;
|
||||
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
return true;
|
||||
case bfd_arch_m68k:
|
||||
adata (abfd).page_size = 0x2000;
|
||||
adata (abfd).segment_size = 0x20000;
|
||||
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* We default to setting the toolversion field to 1, as is required by
|
||||
SunOS. */
|
||||
#ifndef MY_exec_hdr_flags
|
||||
#define MY_exec_hdr_flags 1
|
||||
#endif
|
||||
|
||||
#ifndef MY_entry_is_text_address
|
||||
#define MY_entry_is_text_address 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 sunos4_aout_backend =
|
||||
{
|
||||
0, /* zmagic files are not contiguous */
|
||||
1, /* text includes header */
|
||||
MY_entry_is_text_address,
|
||||
MY_exec_hdr_flags,
|
||||
0, /* default text vma */
|
||||
sunos4_set_sizes,
|
||||
0, /* header is counted in zmagic text */
|
||||
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_core_file_failing_command sunos4_core_file_failing_command
|
||||
#define MY_core_file_failing_signal sunos4_core_file_failing_signal
|
||||
#define MY_core_file_matches_executable_p sunos4_core_file_matches_executable_p
|
||||
|
||||
#define MY_bfd_debug_info_start bfd_void
|
||||
#define MY_bfd_debug_info_end bfd_void
|
||||
#define MY_bfd_debug_info_accumulate \
|
||||
(void (*) PARAMS ((bfd *, struct sec *))) bfd_void
|
||||
#define MY_core_file_p sunos4_core_file_p
|
||||
#define MY_write_object_contents NAME(aout,sunos4_write_object_contents)
|
||||
#define MY_backend_data &sunos4_aout_backend
|
||||
|
||||
#ifndef TARGET_IS_LITTLE_ENDIAN_P
|
||||
#define TARGET_IS_BIG_ENDIAN_P
|
||||
#endif
|
||||
|
||||
#include "aout-target.h"
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,896 @@
|
|||
/* BFD library support routines for architectures.
|
||||
Copyright (C) 1990, 91-98, 1999 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 *}
|
||||
.#define bfd_mach_m68000 1
|
||||
.#define bfd_mach_m68008 2
|
||||
.#define bfd_mach_m68010 3
|
||||
.#define bfd_mach_m68020 4
|
||||
.#define bfd_mach_m68030 5
|
||||
.#define bfd_mach_m68040 6
|
||||
.#define bfd_mach_m68060 7
|
||||
.#define bfd_mach_cpu32 8
|
||||
. 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_sparclet 2
|
||||
.#define bfd_mach_sparc_sparclite 3
|
||||
.#define bfd_mach_sparc_v8plus 4
|
||||
.#define bfd_mach_sparc_v8plusa 5 {* with ultrasparc add'ns *}
|
||||
.#define bfd_mach_sparc_sparclite_le 6
|
||||
.#define bfd_mach_sparc_v9 7
|
||||
.#define bfd_mach_sparc_v9a 8 {* with ultrasparc add'ns *}
|
||||
.{* Nonzero if MACH has the v9 instruction set. *}
|
||||
.#define bfd_mach_sparc_v9_p(mach) \
|
||||
. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
|
||||
. bfd_arch_mips, {* MIPS Rxxxx *}
|
||||
.#define bfd_mach_mips3000 3000
|
||||
.#define bfd_mach_mips3900 3900
|
||||
.#define bfd_mach_mips4000 4000
|
||||
.#define bfd_mach_mips4010 4010
|
||||
.#define bfd_mach_mips4100 4100
|
||||
.#define bfd_mach_mips4111 4111
|
||||
.#define bfd_mach_mips4300 4300
|
||||
.#define bfd_mach_mips4400 4400
|
||||
.#define bfd_mach_mips4600 4600
|
||||
.#define bfd_mach_mips4650 4650
|
||||
.#define bfd_mach_mips5000 5000
|
||||
.#define bfd_mach_mips6000 6000
|
||||
.#define bfd_mach_mips8000 8000
|
||||
.#define bfd_mach_mips10000 10000
|
||||
.#define bfd_mach_mips16 16
|
||||
. bfd_arch_i386, {* Intel 386 *}
|
||||
.#define bfd_mach_i386_i386 0
|
||||
.#define bfd_mach_i386_i8086 1
|
||||
.#define bfd_mach_i386_i386_intel_syntax 2
|
||||
. 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
|
||||
.#define bfd_mach_h8300s 3
|
||||
. bfd_arch_powerpc, {* PowerPC *}
|
||||
. bfd_arch_rs6000, {* IBM RS/6000 *}
|
||||
. bfd_arch_hppa, {* HP PA RISC *}
|
||||
. bfd_arch_d10v, {* Mitsubishi D10V *}
|
||||
. bfd_arch_d30v, {* Mitsubishi D30V *}
|
||||
. 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 *}
|
||||
.#define bfd_mach_sh 0
|
||||
.#define bfd_mach_sh3 0x30
|
||||
.#define bfd_mach_sh3e 0x3e
|
||||
. bfd_arch_alpha, {* Dec Alpha *}
|
||||
.#define bfd_mach_alpha_ev4 0x10
|
||||
.#define bfd_mach_alpha_ev5 0x20
|
||||
.#define bfd_mach_alpha_ev6 0x30
|
||||
. bfd_arch_arm, {* Advanced Risc Machines ARM *}
|
||||
.#define bfd_mach_arm_2 1
|
||||
.#define bfd_mach_arm_2a 2
|
||||
.#define bfd_mach_arm_3 3
|
||||
.#define bfd_mach_arm_3M 4
|
||||
.#define bfd_mach_arm_4 5
|
||||
.#define bfd_mach_arm_4T 6
|
||||
. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
|
||||
. bfd_arch_w65, {* WDC 65816 *}
|
||||
. bfd_arch_tic30, {* Texas Instruments TMS320C30 *}
|
||||
. bfd_arch_tic80, {* TI TMS320c80 (MVP) *}
|
||||
. bfd_arch_v850, {* NEC V850 *}
|
||||
.#define bfd_mach_v850 0
|
||||
.#define bfd_mach_v850e 'E'
|
||||
.#define bfd_mach_v850ea 'A'
|
||||
. bfd_arch_arc, {* Argonaut RISC Core *}
|
||||
.#define bfd_mach_arc_base 0
|
||||
. bfd_arch_m32r, {* Mitsubishi M32R/D *}
|
||||
.#define bfd_mach_m32r 0 {* backwards compatibility *}
|
||||
. bfd_arch_mn10200, {* Matsushita MN10200 *}
|
||||
. bfd_arch_mn10300, {* Matsushita MN10300 *}
|
||||
.#define bfd_mach_mn10300 300
|
||||
. bfd_arch_fr30,
|
||||
.#define bfd_mach_fr30 0x46523330
|
||||
. bfd_arch_mcore,
|
||||
. 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_arc_arch;
|
||||
extern const bfd_arch_info_type bfd_arm_arch;
|
||||
extern const bfd_arch_info_type bfd_d10v_arch;
|
||||
extern const bfd_arch_info_type bfd_d30v_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_m32r_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_mn10200_arch;
|
||||
extern const bfd_arch_info_type bfd_mn10300_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_tic30_arch;
|
||||
extern const bfd_arch_info_type bfd_tic80_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;
|
||||
extern const bfd_arch_info_type bfd_v850_arch;
|
||||
extern const bfd_arch_info_type bfd_fr30_arch;
|
||||
extern const bfd_arch_info_type bfd_mcore_arch;
|
||||
|
||||
static const bfd_arch_info_type * const bfd_archures_list[] =
|
||||
{
|
||||
#ifdef SELECT_ARCHITECTURES
|
||||
SELECT_ARCHITECTURES,
|
||||
#else
|
||||
&bfd_a29k_arch,
|
||||
&bfd_alpha_arch,
|
||||
&bfd_arc_arch,
|
||||
&bfd_arm_arch,
|
||||
&bfd_d10v_arch,
|
||||
&bfd_d30v_arch,
|
||||
&bfd_h8300_arch,
|
||||
&bfd_h8500_arch,
|
||||
&bfd_hppa_arch,
|
||||
&bfd_i386_arch,
|
||||
&bfd_i860_arch,
|
||||
&bfd_i960_arch,
|
||||
&bfd_m32r_arch,
|
||||
&bfd_m68k_arch,
|
||||
&bfd_m88k_arch,
|
||||
&bfd_mips_arch,
|
||||
&bfd_mn10200_arch,
|
||||
&bfd_mn10300_arch,
|
||||
&bfd_powerpc_arch,
|
||||
&bfd_rs6000_arch,
|
||||
&bfd_sh_arch,
|
||||
&bfd_sparc_arch,
|
||||
&bfd_tic30_arch,
|
||||
&bfd_tic80_arch,
|
||||
&bfd_vax_arch,
|
||||
&bfd_we32k_arch,
|
||||
&bfd_z8k_arch,
|
||||
&bfd_ns32k_arch,
|
||||
&bfd_w65_arch,
|
||||
&bfd_v850_arch,
|
||||
&bfd_fr30_arch,
|
||||
& bfd_mcore_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_list
|
||||
|
||||
SYNOPSIS
|
||||
const char **bfd_arch_list(void);
|
||||
|
||||
DESCRIPTION
|
||||
Return a freshly malloced NULL-terminated vector of the names
|
||||
of all the valid BFD architectures. Do not modify the names.
|
||||
|
||||
*/
|
||||
|
||||
const char **
|
||||
bfd_arch_list ()
|
||||
{
|
||||
int vec_length = 0;
|
||||
const char **name_ptr;
|
||||
const char **name_list;
|
||||
const bfd_arch_info_type * const *app;
|
||||
|
||||
/* Determine the number of architectures */
|
||||
vec_length = 0;
|
||||
for (app = bfd_archures_list; *app != NULL; app++)
|
||||
{
|
||||
const bfd_arch_info_type *ap;
|
||||
for (ap = *app; ap != NULL; ap = ap->next)
|
||||
{
|
||||
vec_length++;
|
||||
}
|
||||
}
|
||||
|
||||
name_list = (CONST char **)
|
||||
bfd_malloc ((vec_length + 1) * sizeof (char **));
|
||||
if (name_list == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Point the list at each of the names */
|
||||
name_ptr = name_list;
|
||||
for (app = bfd_archures_list; *app != NULL; app++)
|
||||
{
|
||||
const bfd_arch_info_type *ap;
|
||||
for (ap = *app; ap != NULL; ap = ap->next)
|
||||
{
|
||||
*name_ptr = ap->printable_name;
|
||||
name_ptr++;
|
||||
}
|
||||
}
|
||||
*name_ptr = NULL;
|
||||
|
||||
return name_list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
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;
|
||||
const char *printable_name_colon;
|
||||
|
||||
/* Exact match of the architecture name (ARCH_NAME) and also the
|
||||
default architecture? */
|
||||
if (strcasecmp (string, info->arch_name) == 0
|
||||
&& info->the_default)
|
||||
return true;
|
||||
|
||||
/* Exact match of the machine name (PRINTABLE_NAME)? */
|
||||
if (strcasecmp (string, info->printable_name) == 0)
|
||||
return true;
|
||||
|
||||
/* Given that printable_name contains no colon, attempt to match:
|
||||
ARCH_NAME [ ":" ] PRINTABLE_NAME? */
|
||||
printable_name_colon = strchr (info->printable_name, ':');
|
||||
if (printable_name_colon == NULL)
|
||||
{
|
||||
int strlen_arch_name = strlen (info->arch_name);
|
||||
if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0)
|
||||
{
|
||||
if (string[strlen_arch_name] == ':')
|
||||
{
|
||||
if (strcasecmp (string + strlen_arch_name + 1,
|
||||
info->printable_name) == 0)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcasecmp (string + strlen_arch_name,
|
||||
info->printable_name) == 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>;
|
||||
Attempt to match: <arch> <mach>? */
|
||||
if (printable_name_colon != NULL)
|
||||
{
|
||||
int colon_index = printable_name_colon - info->printable_name;
|
||||
if (strncasecmp (string, info->printable_name, colon_index) == 0
|
||||
&& strcasecmp (string + colon_index,
|
||||
info->printable_name + colon_index + 1) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
|
||||
attempt to match just <mach>, it could be ambigious. This test
|
||||
is left until later. */
|
||||
|
||||
/* NOTE: The below is retained for compatibility only. Please do not
|
||||
add to this code */
|
||||
|
||||
/* 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 ((unsigned char) *ptr_src))
|
||||
{
|
||||
number = number * 10 + *ptr_src - '0';
|
||||
ptr_src++;
|
||||
}
|
||||
|
||||
/* NOTE: The below is retained for compatibility only.
|
||||
PLEASE DO NOT ADD TO THIS CODE. */
|
||||
|
||||
switch (number)
|
||||
{
|
||||
/* FIXME: These are needed to parse IEEE objects. */
|
||||
case 68000:
|
||||
arch = bfd_arch_m68k;
|
||||
number = bfd_mach_m68000;
|
||||
break;
|
||||
case 68010:
|
||||
arch = bfd_arch_m68k;
|
||||
number = bfd_mach_m68010;
|
||||
break;
|
||||
case 68020:
|
||||
arch = bfd_arch_m68k;
|
||||
number = bfd_mach_m68020;
|
||||
break;
|
||||
case 68030:
|
||||
arch = bfd_arch_m68k;
|
||||
number = bfd_mach_m68030;
|
||||
break;
|
||||
case 68040:
|
||||
arch = bfd_arch_m68k;
|
||||
number = bfd_mach_m68040;
|
||||
break;
|
||||
case 68060:
|
||||
arch = bfd_arch_m68k;
|
||||
number = bfd_mach_m68060;
|
||||
break;
|
||||
case 68332:
|
||||
arch = bfd_arch_m68k;
|
||||
number = bfd_mach_cpu32;
|
||||
break;
|
||||
|
||||
case 32000:
|
||||
arch = bfd_arch_we32k;
|
||||
break;
|
||||
|
||||
case 3000:
|
||||
arch = bfd_arch_mips;
|
||||
number = bfd_mach_mips3000;
|
||||
break;
|
||||
|
||||
case 4000:
|
||||
arch = bfd_arch_mips;
|
||||
number = bfd_mach_mips4000;
|
||||
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!";
|
||||
}
|
|
@ -0,0 +1,727 @@
|
|||
/* Main header file for the bfd library -- portable access to object files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
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"
|
||||
|
||||
/* 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_HOST_64_BIT_DEFINED@
|
||||
#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
|
||||
#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
|
||||
#endif
|
||||
|
||||
#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, BFD_HOST_64_BIT must be
|
||||
defined above. */
|
||||
|
||||
#ifndef BFD_HOST_64_BIT
|
||||
# if BFD_HOST_64BIT_LONG
|
||||
# define BFD_HOST_64_BIT long
|
||||
# define BFD_HOST_U_64_BIT unsigned long
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# if __GNUC__ >= 2
|
||||
# define BFD_HOST_64_BIT long long
|
||||
# define BFD_HOST_U_64_BIT unsigned long long
|
||||
# endif /* __GNUC__ >= 2 */
|
||||
# endif /* ! defined (__GNUC__) */
|
||||
# endif /* ! BFD_HOST_64BIT_LONG */
|
||||
#endif /* ! defined (BFD_HOST_64_BIT) */
|
||||
|
||||
#ifdef BFD64
|
||||
|
||||
#ifndef BFD_HOST_64_BIT
|
||||
#error No 64 bit integer type available
|
||||
#endif /* ! defined (BFD_HOST_64_BIT) */
|
||||
|
||||
typedef BFD_HOST_U_64_BIT bfd_vma;
|
||||
typedef BFD_HOST_64_BIT bfd_signed_vma;
|
||||
typedef BFD_HOST_U_64_BIT bfd_size_type;
|
||||
typedef BFD_HOST_U_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 BFD_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_lma(bfd, ptr) ((ptr)->lma)
|
||||
#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 objalloc for this hash table. This is a struct objalloc *,
|
||||
but we use PTR to avoid requiring the inclusion of objalloc.h. */
|
||||
PTR 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;
|
||||
struct bfd_elf_version_tree;
|
||||
#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_elf_get_bfd_needed_list
|
||||
PARAMS ((bfd *, struct bfd_link_needed_list **));
|
||||
extern boolean bfd_elf32_size_dynamic_sections
|
||||
PARAMS ((bfd *, const char *, const char *, boolean, const char *,
|
||||
const char * const *, struct bfd_link_info *, struct sec **,
|
||||
struct bfd_elf_version_tree *));
|
||||
extern boolean bfd_elf64_size_dynamic_sections
|
||||
PARAMS ((bfd *, const char *, const char *, boolean, const char *,
|
||||
const char * const *, struct bfd_link_info *, struct sec **,
|
||||
struct bfd_elf_version_tree *));
|
||||
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 *));
|
||||
extern boolean bfd_sparclinux_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 **));
|
||||
|
||||
/* Externally visible COFF routines. */
|
||||
|
||||
#if defined(__STDC__) || defined(ALMOST_STDC)
|
||||
struct internal_syment;
|
||||
union internal_auxent;
|
||||
#endif
|
||||
|
||||
extern boolean bfd_coff_get_syment
|
||||
PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
|
||||
|
||||
extern boolean bfd_coff_get_auxent
|
||||
PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
|
||||
|
||||
extern boolean bfd_coff_set_symbol_class
|
||||
PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
|
||||
|
||||
/* ARM Interworking support. Called from linker. */
|
||||
extern boolean bfd_arm_allocate_interworking_sections
|
||||
PARAMS ((struct bfd_link_info *));
|
||||
|
||||
extern boolean bfd_arm_process_before_allocation
|
||||
PARAMS ((bfd *, struct bfd_link_info *, int));
|
||||
|
||||
extern boolean bfd_arm_get_bfd_for_interworking
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* ELF ARM Interworking support. Called from linker. */
|
||||
extern boolean bfd_elf32_arm_allocate_interworking_sections
|
||||
PARAMS ((struct bfd_link_info *));
|
||||
|
||||
extern boolean bfd_elf32_arm_process_before_allocation
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
extern boolean bfd_elf32_arm_get_bfd_for_interworking
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* And more from the source. */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,386 @@
|
|||
/* BFD back-end for binary objects.
|
||||
Copyright 1994, 95, 96, 97, 98, 1999 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 ((unsigned char) *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_name bfd_generic_is_local_label_name
|
||||
#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)
|
||||
{
|
||||
boolean found_low;
|
||||
bfd_vma low;
|
||||
asection *s;
|
||||
|
||||
/* The lowest section LMA sets the virtual address of the start
|
||||
of the file. We use this to set the file position of all the
|
||||
sections. */
|
||||
found_low = false;
|
||||
low = 0;
|
||||
for (s = abfd->sections; s != NULL; s = s->next)
|
||||
if (((s->flags
|
||||
& (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD))
|
||||
== (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
|
||||
&& (! found_low || s->lma < low))
|
||||
{
|
||||
low = s->lma;
|
||||
found_low = true;
|
||||
}
|
||||
|
||||
for (s = abfd->sections; s != NULL; s = s->next)
|
||||
{
|
||||
s->filepos = s->lma - low;
|
||||
|
||||
/* Skip following warning check for sections that will not
|
||||
occupy file space. */
|
||||
if ((s->flags
|
||||
& (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
|
||||
!= (SEC_HAS_CONTENTS | SEC_ALLOC))
|
||||
continue;
|
||||
|
||||
/* If attempting to generate a binary file from a bfd with
|
||||
LMA's all over the place, huge (sparse?) binary files may
|
||||
result. This condition attempts to detect this situation
|
||||
and print a warning. Better heuristics would be nice to
|
||||
have. */
|
||||
|
||||
if (s->filepos < 0)
|
||||
(*_bfd_error_handler)
|
||||
(_("Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."),
|
||||
bfd_get_section_name (abfd, s),
|
||||
(unsigned long) s->filepos);
|
||||
}
|
||||
|
||||
abfd->output_has_begun = true;
|
||||
}
|
||||
|
||||
/* We don't want to output anything for a section that is neither
|
||||
loaded nor allocated. The contents of such a section are not
|
||||
meaningful in the binary format. */
|
||||
if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
|
||||
return true;
|
||||
if ((sec->flags & SEC_NEVER_LOAD) != 0)
|
||||
return 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_gc_sections bfd_generic_gc_sections
|
||||
#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
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,350 @@
|
|||
/* 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
|
||||
{
|
||||
/* Create the file. Unlink it first, for the convenience of
|
||||
operating systems which worry about overwriting running
|
||||
binaries. */
|
||||
unlink (abfd->filename);
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/* BFD back-end for Intel 386 COFF LynxOS files.
|
||||
Copyright 1993, 1994 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"
|
||||
|
||||
#define TARGET_SYM i386lynx_coff_vec
|
||||
#define TARGET_NAME "coff-i386-lynx"
|
||||
|
||||
#define LYNXOS
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
#include "coff-i386.c"
|
|
@ -0,0 +1,28 @@
|
|||
/* BFD back-end for Motorola M68K COFF LynxOS files.
|
||||
Copyright 1993, 1994, 1995, 1996, 1997 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 TARGET_SYM m68klynx_coff_vec
|
||||
#define TARGET_NAME "coff-m68k-lynx"
|
||||
#define LYNXOS
|
||||
#define COFF_LONG_FILENAMES
|
||||
#define STATIC_RELOCS
|
||||
#define COFF_COMMON_ADDEND
|
||||
|
||||
#include "coff-m68k.c"
|
|
@ -0,0 +1,28 @@
|
|||
/* BFD back-end for Sparc COFF LynxOS files.
|
||||
Copyright 1993 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 TARGET_SYM sparclynx_coff_vec
|
||||
#define TARGET_NAME "coff-sparc-lynx"
|
||||
|
||||
#define LYNXOS
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
#include "coff-sparc.c"
|
|
@ -0,0 +1,327 @@
|
|||
/* BFD back-end for CISCO crash dumps.
|
||||
|
||||
Copyright 1994 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"
|
||||
/* core_file_failing_signal returns a host signal (this probably should
|
||||
be fixed). */
|
||||
#include <signal.h>
|
||||
|
||||
/* for MSVC builds */
|
||||
#ifndef SIGTRAP
|
||||
# define SIGTRAP 5
|
||||
#endif
|
||||
#ifndef SIGEMT
|
||||
# define SIGEMT 6
|
||||
#endif
|
||||
#ifndef SIGBUS
|
||||
# define SIGBUS 10
|
||||
#endif
|
||||
|
||||
#define CRASH_INFO (0xffc)
|
||||
#define CRASH_MAGIC 0xdead1234
|
||||
|
||||
typedef enum {
|
||||
CRASH_REASON_NOTCRASHED = 0,
|
||||
CRASH_REASON_EXCEPTION = 1,
|
||||
CRASH_REASON_CORRUPT = 2,
|
||||
} crashreason;
|
||||
|
||||
struct crashinfo_external
|
||||
{
|
||||
char magic[4]; /* Magic number */
|
||||
char version[4]; /* Version number */
|
||||
char reason[4]; /* Crash reason */
|
||||
char cpu_vector[4]; /* CPU vector for exceptions */
|
||||
char registers[4]; /* Pointer to saved registers */
|
||||
char rambase[4]; /* Base of RAM (not in V1 crash info) */
|
||||
};
|
||||
|
||||
struct cisco_core_struct
|
||||
{
|
||||
int sig;
|
||||
};
|
||||
|
||||
static const bfd_target *
|
||||
cisco_core_file_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
char buf[4];
|
||||
unsigned int crashinfo_offset;
|
||||
struct crashinfo_external crashinfo;
|
||||
int nread;
|
||||
unsigned int rambase;
|
||||
sec_ptr asect;
|
||||
struct stat statbuf;
|
||||
|
||||
if (bfd_seek (abfd, CRASH_INFO, SEEK_SET) != 0)
|
||||
return NULL;
|
||||
|
||||
nread = bfd_read (buf, 1, 4, abfd);
|
||||
if (nread != 4)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
crashinfo_offset = bfd_get_32 (abfd, buf);
|
||||
|
||||
if (bfd_seek (abfd, crashinfo_offset, SEEK_SET) != 0)
|
||||
return NULL;
|
||||
|
||||
nread = bfd_read (&crashinfo, 1, sizeof (crashinfo), abfd);
|
||||
if (nread != sizeof (crashinfo))
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bfd_stat (abfd, &statbuf) < 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bfd_get_32 (abfd, crashinfo.magic) != CRASH_MAGIC)
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (bfd_get_32 (abfd, crashinfo.version))
|
||||
{
|
||||
case 0:
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
case 1:
|
||||
rambase = 0;
|
||||
break;
|
||||
default:
|
||||
case 2:
|
||||
rambase = bfd_get_32 (abfd, crashinfo.rambase);
|
||||
break;
|
||||
}
|
||||
|
||||
/* OK, we believe you. You're a core file. */
|
||||
|
||||
abfd->tdata.cisco_core_data =
|
||||
((struct cisco_core_struct *)
|
||||
bfd_zmalloc (sizeof (struct cisco_core_struct)));
|
||||
if (abfd->tdata.cisco_core_data == NULL)
|
||||
return NULL;
|
||||
|
||||
switch ((crashreason) bfd_get_32 (abfd, crashinfo.reason))
|
||||
{
|
||||
case CRASH_REASON_NOTCRASHED:
|
||||
/* Crash file probably came from write core. */
|
||||
abfd->tdata.cisco_core_data->sig = 0;
|
||||
break;
|
||||
case CRASH_REASON_CORRUPT:
|
||||
/* The crash context area was corrupt -- proceed with caution.
|
||||
We have no way of passing this information back to the caller. */
|
||||
abfd->tdata.cisco_core_data->sig = 0;
|
||||
break;
|
||||
case CRASH_REASON_EXCEPTION:
|
||||
/* Crash occured due to CPU exception. */
|
||||
|
||||
/* This is 68k-specific; for MIPS we'll need to interpret
|
||||
cpu_vector differently based on the target configuration
|
||||
(since CISCO core files don't seem to have the processor
|
||||
encoded in them). */
|
||||
|
||||
switch (bfd_get_32 (abfd, crashinfo.cpu_vector))
|
||||
{
|
||||
/* bus error */
|
||||
case 2 : abfd->tdata.cisco_core_data->sig = SIGBUS; break;
|
||||
/* address error */
|
||||
case 3 : abfd->tdata.cisco_core_data->sig = SIGBUS; break;
|
||||
/* illegal instruction */
|
||||
case 4 : abfd->tdata.cisco_core_data->sig = SIGILL; break;
|
||||
/* zero divide */
|
||||
case 5 : abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
/* chk instruction */
|
||||
case 6 : abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
/* trapv instruction */
|
||||
case 7 : abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
/* privilege violation */
|
||||
case 8 : abfd->tdata.cisco_core_data->sig = SIGSEGV; break;
|
||||
/* trace trap */
|
||||
case 9 : abfd->tdata.cisco_core_data->sig = SIGTRAP; break;
|
||||
/* line 1010 emulator */
|
||||
case 10: abfd->tdata.cisco_core_data->sig = SIGILL; break;
|
||||
/* line 1111 emulator */
|
||||
case 11: abfd->tdata.cisco_core_data->sig = SIGILL; break;
|
||||
|
||||
/* Coprocessor protocol violation. Using a standard MMU or FPU
|
||||
this cannot be triggered by software. Call it a SIGBUS. */
|
||||
case 13: abfd->tdata.cisco_core_data->sig = SIGBUS; break;
|
||||
|
||||
/* interrupt */
|
||||
case 31: abfd->tdata.cisco_core_data->sig = SIGINT; break;
|
||||
/* breakpoint */
|
||||
case 33: abfd->tdata.cisco_core_data->sig = SIGTRAP; break;
|
||||
|
||||
/* floating point err */
|
||||
case 48: abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
/* floating point err */
|
||||
case 49: abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
/* zero divide */
|
||||
case 50: abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
/* underflow */
|
||||
case 51: abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
/* operand error */
|
||||
case 52: abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
/* overflow */
|
||||
case 53: abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
/* NAN */
|
||||
case 54: abfd->tdata.cisco_core_data->sig = SIGFPE; break;
|
||||
default:
|
||||
#ifndef SIGEMT
|
||||
#define SIGEMT SIGTRAP
|
||||
#endif
|
||||
/* "software generated"*/
|
||||
abfd->tdata.cisco_core_data->sig = SIGEMT;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* Unknown crash reason. */
|
||||
abfd->tdata.cisco_core_data->sig = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
abfd->sections = NULL;
|
||||
abfd->section_count = 0;
|
||||
|
||||
asect = (asection *) bfd_zmalloc (sizeof (asection));
|
||||
if (asect == NULL)
|
||||
goto error_return;
|
||||
asect->name = ".reg";
|
||||
asect->flags = SEC_HAS_CONTENTS;
|
||||
/* This can be bigger than the real size. Set it to the size of the whole
|
||||
core file. */
|
||||
asect->_raw_size = statbuf.st_size;
|
||||
asect->vma = 0;
|
||||
asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase;
|
||||
asect->next = abfd->sections;
|
||||
abfd->sections = asect;
|
||||
++abfd->section_count;
|
||||
|
||||
/* There is only one section containing data from the target system's RAM.
|
||||
We call it .data. */
|
||||
asect = (asection *) bfd_zmalloc (sizeof (asection));
|
||||
if (asect == NULL)
|
||||
goto error_return;
|
||||
asect->name = ".data";
|
||||
asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
|
||||
/* The size of memory is the size of the core file itself. */
|
||||
asect->_raw_size = statbuf.st_size;
|
||||
asect->vma = rambase;
|
||||
asect->filepos = 0;
|
||||
asect->next = abfd->sections;
|
||||
abfd->sections = asect;
|
||||
++abfd->section_count;
|
||||
|
||||
return abfd->xvec;
|
||||
|
||||
error_return:
|
||||
{
|
||||
sec_ptr nextsect;
|
||||
for (asect = abfd->sections; asect != NULL;)
|
||||
{
|
||||
nextsect = asect->next;
|
||||
free (asect);
|
||||
asect = nextsect;
|
||||
}
|
||||
free (abfd->tdata.cisco_core_data);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
cisco_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
cisco_core_file_failing_signal (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
return abfd->tdata.cisco_core_data->sig;
|
||||
}
|
||||
|
||||
boolean
|
||||
cisco_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd;
|
||||
bfd *exec_bfd;
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const bfd_target cisco_core_vec =
|
||||
{
|
||||
"trad-core",
|
||||
bfd_target_unknown_flavour,
|
||||
BFD_ENDIAN_BIG, /* target byte order */
|
||||
BFD_ENDIAN_BIG, /* 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 */
|
||||
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, /* unknown format */
|
||||
_bfd_dummy_target, /* object file */
|
||||
_bfd_dummy_target, /* archive */
|
||||
cisco_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 (cisco),
|
||||
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 */
|
||||
};
|
|
@ -0,0 +1,640 @@
|
|||
/* BFD back-end for AMD 29000 COFF binaries.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
Contributed by David Wood at New York University 7/8/91.
|
||||
|
||||
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 A29K 1
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/a29k.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
static long get_symbol_value PARAMS ((asymbol *));
|
||||
static bfd_reloc_status_type a29k_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static boolean coff_a29k_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
struct internal_reloc *, struct internal_syment *, asection **));
|
||||
static boolean coff_a29k_adjust_symndx
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
|
||||
struct internal_reloc *, boolean *));
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
||||
|
||||
#define INSERT_HWORD(WORD,HWORD) \
|
||||
(((WORD) & 0xff00ff00) | (((HWORD) & 0xff00) << 8) | ((HWORD)& 0xff))
|
||||
#define EXTRACT_HWORD(WORD) \
|
||||
((((WORD) & 0x00ff0000) >> 8) | ((WORD)& 0xff))
|
||||
#define SIGN_EXTEND_HWORD(HWORD) \
|
||||
((HWORD) & 0x8000 ? (HWORD)|(~0xffffL) : (HWORD))
|
||||
|
||||
/* Provided the symbol, returns the value reffed */
|
||||
static long
|
||||
get_symbol_value (symbol)
|
||||
asymbol *symbol;
|
||||
{
|
||||
long relocation = 0;
|
||||
|
||||
if (bfd_is_com_section (symbol->section))
|
||||
{
|
||||
relocation = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
relocation = symbol->value +
|
||||
symbol->section->output_section->vma +
|
||||
symbol->section->output_offset;
|
||||
}
|
||||
|
||||
return(relocation);
|
||||
}
|
||||
|
||||
/* this function is in charge of performing all the 29k relocations */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol_in;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
/* the consth relocation comes in two parts, we have to remember
|
||||
the state between calls, in these variables */
|
||||
static boolean part1_consth_active = false;
|
||||
static unsigned long part1_consth_value;
|
||||
|
||||
unsigned long insn;
|
||||
unsigned long sym_value;
|
||||
unsigned long unsigned_value;
|
||||
unsigned short r_type;
|
||||
long signed_value;
|
||||
|
||||
unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/
|
||||
bfd_byte *hit_data =addr + (bfd_byte *)(data);
|
||||
|
||||
r_type = reloc_entry->howto->type;
|
||||
|
||||
if (output_bfd) {
|
||||
/* Partial linking - do nothing */
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return bfd_reloc_ok;
|
||||
|
||||
}
|
||||
|
||||
if (symbol_in != NULL
|
||||
&& bfd_is_und_section (symbol_in->section))
|
||||
{
|
||||
/* Keep the state machine happy in case we're called again */
|
||||
if (r_type == R_IHIHALF)
|
||||
{
|
||||
part1_consth_active = true;
|
||||
part1_consth_value = 0;
|
||||
}
|
||||
return(bfd_reloc_undefined);
|
||||
}
|
||||
|
||||
if ((part1_consth_active) && (r_type != R_IHCONST))
|
||||
{
|
||||
part1_consth_active = false;
|
||||
*error_message = (char *) _("Missing IHCONST");
|
||||
return(bfd_reloc_dangerous);
|
||||
}
|
||||
|
||||
|
||||
sym_value = get_symbol_value(symbol_in);
|
||||
|
||||
switch (r_type)
|
||||
{
|
||||
case R_IREL:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
/* Take the value in the field and sign extend it */
|
||||
signed_value = EXTRACT_HWORD(insn);
|
||||
signed_value = SIGN_EXTEND_HWORD(signed_value);
|
||||
signed_value <<= 2;
|
||||
|
||||
/* See the note on the R_IREL reloc in coff_a29k_relocate_section. */
|
||||
if (signed_value == - (long) reloc_entry->address)
|
||||
signed_value = 0;
|
||||
|
||||
signed_value += sym_value + reloc_entry->addend;
|
||||
if ((signed_value & ~0x3ffff) == 0)
|
||||
{ /* Absolute jmp/call */
|
||||
insn |= (1<<24); /* Make it absolute */
|
||||
/* FIXME: Should we change r_type to R_IABS */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Relative jmp/call, so subtract from the value the
|
||||
address of the place we're coming from */
|
||||
signed_value -= (reloc_entry->address
|
||||
+ input_section->output_section->vma
|
||||
+ input_section->output_offset);
|
||||
if (signed_value>0x1ffff || signed_value<-0x20000)
|
||||
return(bfd_reloc_overflow);
|
||||
}
|
||||
signed_value >>= 2;
|
||||
insn = INSERT_HWORD(insn, signed_value);
|
||||
bfd_put_32(abfd, insn ,hit_data);
|
||||
break;
|
||||
case R_ILOHALF:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
unsigned_value = EXTRACT_HWORD(insn);
|
||||
unsigned_value += sym_value + reloc_entry->addend;
|
||||
insn = INSERT_HWORD(insn, unsigned_value);
|
||||
bfd_put_32(abfd, insn, hit_data);
|
||||
break;
|
||||
case R_IHIHALF:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
/* consth, part 1
|
||||
Just get the symbol value that is referenced */
|
||||
part1_consth_active = true;
|
||||
part1_consth_value = sym_value + reloc_entry->addend;
|
||||
/* Don't modify insn until R_IHCONST */
|
||||
break;
|
||||
case R_IHCONST:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
/* consth, part 2
|
||||
Now relocate the reference */
|
||||
if (part1_consth_active == false) {
|
||||
*error_message = (char *) _("Missing IHIHALF");
|
||||
return(bfd_reloc_dangerous);
|
||||
}
|
||||
/* sym_ptr_ptr = r_symndx, in coff_slurp_reloc_table() */
|
||||
unsigned_value = 0; /*EXTRACT_HWORD(insn) << 16;*/
|
||||
unsigned_value += reloc_entry->addend; /* r_symndx */
|
||||
unsigned_value += part1_consth_value;
|
||||
unsigned_value = unsigned_value >> 16;
|
||||
insn = INSERT_HWORD(insn, unsigned_value);
|
||||
part1_consth_active = false;
|
||||
bfd_put_32(abfd, insn, hit_data);
|
||||
break;
|
||||
case R_BYTE:
|
||||
insn = bfd_get_8(abfd, hit_data);
|
||||
unsigned_value = insn + sym_value + reloc_entry->addend;
|
||||
if (unsigned_value & 0xffffff00)
|
||||
return(bfd_reloc_overflow);
|
||||
bfd_put_8(abfd, unsigned_value, hit_data);
|
||||
break;
|
||||
case R_HWORD:
|
||||
insn = bfd_get_16(abfd, hit_data);
|
||||
unsigned_value = insn + sym_value + reloc_entry->addend;
|
||||
if (unsigned_value & 0xffff0000)
|
||||
return(bfd_reloc_overflow);
|
||||
bfd_put_16(abfd, insn, hit_data);
|
||||
break;
|
||||
case R_WORD:
|
||||
insn = bfd_get_32(abfd, hit_data);
|
||||
insn += sym_value + reloc_entry->addend;
|
||||
bfd_put_32(abfd, insn, hit_data);
|
||||
break;
|
||||
default:
|
||||
*error_message = _("Unrecognized reloc");
|
||||
return (bfd_reloc_dangerous);
|
||||
}
|
||||
|
||||
|
||||
return(bfd_reloc_ok);
|
||||
}
|
||||
|
||||
/* type rightshift
|
||||
size
|
||||
bitsize
|
||||
pc-relative
|
||||
bitpos
|
||||
absolute
|
||||
complain_on_overflow
|
||||
special_function
|
||||
relocation name
|
||||
partial_inplace
|
||||
src_mask
|
||||
*/
|
||||
|
||||
/*FIXME: I'm not real sure about this table */
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
{R_ABS, 0, 3, 32, false, 0, complain_overflow_bitfield,a29k_reloc,"ABS", true, 0xffffffff,0xffffffff, false},
|
||||
{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10},
|
||||
{11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20},
|
||||
{21}, {22}, {23},
|
||||
{R_IREL, 0, 3, 32, true, 0, complain_overflow_signed,a29k_reloc,"IREL", true, 0xffffffff,0xffffffff, false},
|
||||
{R_IABS, 0, 3, 32, false, 0, complain_overflow_bitfield, a29k_reloc,"IABS", true, 0xffffffff,0xffffffff, false},
|
||||
{R_ILOHALF, 0, 3, 16, true, 0, complain_overflow_signed, a29k_reloc,"ILOHALF", true, 0x0000ffff,0x0000ffff, false},
|
||||
{R_IHIHALF, 0, 3, 16, true, 16, complain_overflow_signed, a29k_reloc,"IHIHALF", true, 0xffff0000,0xffff0000, false},
|
||||
{R_IHCONST, 0, 3, 16, true, 0, complain_overflow_signed, a29k_reloc,"IHCONST", true, 0xffff0000,0xffff0000, false},
|
||||
{R_BYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, a29k_reloc,"BYTE", true, 0x000000ff,0x000000ff, false},
|
||||
{R_HWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, a29k_reloc,"HWORD", true, 0x0000ffff,0x0000ffff, false},
|
||||
{R_WORD, 0, 2, 32, false, 0, complain_overflow_bitfield, a29k_reloc,"WORD", true, 0xffffffff,0xffffffff, false},
|
||||
};
|
||||
|
||||
#define BADMAG(x) A29KBADMAG(x)
|
||||
|
||||
#define RELOC_PROCESSING(relent, reloc, symbols, abfd, section) \
|
||||
reloc_processing(relent, reloc, symbols, abfd, section)
|
||||
|
||||
static void
|
||||
reloc_processing (relent,reloc, symbols, abfd, section)
|
||||
arelent *relent;
|
||||
struct internal_reloc *reloc;
|
||||
asymbol **symbols;
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
{
|
||||
static bfd_vma ihihalf_vaddr = (bfd_vma) -1;
|
||||
|
||||
relent->address = reloc->r_vaddr;
|
||||
relent->howto = howto_table + reloc->r_type;
|
||||
if (reloc->r_type == R_IHCONST)
|
||||
{
|
||||
/* The address of an R_IHCONST should always be the address of
|
||||
the immediately preceding R_IHIHALF. relocs generated by gas
|
||||
are correct, but relocs generated by High C are different (I
|
||||
can't figure out what the address means for High C). We can
|
||||
handle both gas and High C by ignoring the address here, and
|
||||
simply reusing the address saved for R_IHIHALF. */
|
||||
if (ihihalf_vaddr == (bfd_vma) -1)
|
||||
abort ();
|
||||
relent->address = ihihalf_vaddr;
|
||||
ihihalf_vaddr = (bfd_vma) -1;
|
||||
relent->addend = reloc->r_symndx;
|
||||
relent->sym_ptr_ptr= bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
asymbol *ptr;
|
||||
relent->sym_ptr_ptr = symbols + obj_convert(abfd)[reloc->r_symndx];
|
||||
|
||||
ptr = *(relent->sym_ptr_ptr);
|
||||
|
||||
if (ptr
|
||||
&& bfd_asymbol_bfd(ptr) == abfd
|
||||
|
||||
&& ((ptr->flags & BSF_OLD_COMMON)== 0))
|
||||
{
|
||||
relent->addend = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
relent->addend = 0;
|
||||
}
|
||||
relent->address-= section->vma;
|
||||
if (reloc->r_type == R_IHIHALF)
|
||||
ihihalf_vaddr = relent->address;
|
||||
else if (ihihalf_vaddr != (bfd_vma) -1)
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/* The reloc processing routine for the optimized COFF linker. */
|
||||
|
||||
static boolean
|
||||
coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
contents, relocs, syms, sections)
|
||||
bfd *output_bfd;
|
||||
struct bfd_link_info *info;
|
||||
bfd *input_bfd;
|
||||
asection *input_section;
|
||||
bfd_byte *contents;
|
||||
struct internal_reloc *relocs;
|
||||
struct internal_syment *syms;
|
||||
asection **sections;
|
||||
{
|
||||
struct internal_reloc *rel;
|
||||
struct internal_reloc *relend;
|
||||
boolean hihalf;
|
||||
bfd_vma hihalf_val;
|
||||
|
||||
/* If we are performing a relocateable link, we don't need to do a
|
||||
thing. The caller will take care of adjusting the reloc
|
||||
addresses and symbol indices. */
|
||||
if (info->relocateable)
|
||||
return true;
|
||||
|
||||
hihalf = false;
|
||||
hihalf_val = 0;
|
||||
|
||||
rel = relocs;
|
||||
relend = rel + input_section->reloc_count;
|
||||
for (; rel < relend; rel++)
|
||||
{
|
||||
long symndx;
|
||||
bfd_byte *loc;
|
||||
struct coff_link_hash_entry *h;
|
||||
struct internal_syment *sym;
|
||||
asection *sec;
|
||||
bfd_vma val;
|
||||
boolean overflow;
|
||||
unsigned long insn;
|
||||
long signed_value;
|
||||
unsigned long unsigned_value;
|
||||
bfd_reloc_status_type rstat;
|
||||
|
||||
symndx = rel->r_symndx;
|
||||
loc = contents + rel->r_vaddr - input_section->vma;
|
||||
|
||||
if (symndx == -1 || rel->r_type == R_IHCONST)
|
||||
h = NULL;
|
||||
else
|
||||
h = obj_coff_sym_hashes (input_bfd)[symndx];
|
||||
|
||||
sym = NULL;
|
||||
sec = NULL;
|
||||
val = 0;
|
||||
|
||||
/* An R_IHCONST reloc does not have a symbol. Instead, the
|
||||
symbol index is an addend. R_IHCONST is always used in
|
||||
conjunction with R_IHHALF. */
|
||||
if (rel->r_type != R_IHCONST)
|
||||
{
|
||||
if (h == NULL)
|
||||
{
|
||||
if (symndx == -1)
|
||||
sec = bfd_abs_section_ptr;
|
||||
else
|
||||
{
|
||||
sym = syms + symndx;
|
||||
sec = sections[symndx];
|
||||
val = (sec->output_section->vma
|
||||
+ sec->output_offset
|
||||
+ sym->n_value
|
||||
- sec->vma);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
{
|
||||
sec = h->root.u.def.section;
|
||||
val = (h->root.u.def.value
|
||||
+ sec->output_section->vma
|
||||
+ sec->output_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (hihalf)
|
||||
{
|
||||
if (! ((*info->callbacks->reloc_dangerous)
|
||||
(info, _("missing IHCONST reloc"), input_bfd,
|
||||
input_section, rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
hihalf = false;
|
||||
}
|
||||
}
|
||||
|
||||
overflow = false;
|
||||
|
||||
switch (rel->r_type)
|
||||
{
|
||||
default:
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
|
||||
case R_IREL:
|
||||
insn = bfd_get_32 (input_bfd, loc);
|
||||
|
||||
/* Extract the addend. */
|
||||
signed_value = EXTRACT_HWORD (insn);
|
||||
signed_value = SIGN_EXTEND_HWORD (signed_value);
|
||||
signed_value <<= 2;
|
||||
|
||||
/* Unfortunately, there are two different versions of COFF
|
||||
a29k. In the original AMD version, the value stored in
|
||||
the field for the R_IREL reloc is a simple addend. In
|
||||
the GNU version, the value is the negative of the address
|
||||
of the reloc within section. We try to cope here by
|
||||
assuming the AMD version, unless the addend is exactly
|
||||
the negative of the address; in the latter case we assume
|
||||
the GNU version. This means that something like
|
||||
.text
|
||||
nop
|
||||
jmp i-4
|
||||
will fail, because the addend of -4 will happen to equal
|
||||
the negative of the address within the section. The
|
||||
compiler will never generate code like this.
|
||||
|
||||
At some point in the future we may want to take out this
|
||||
check. */
|
||||
|
||||
if (signed_value == - (long) (rel->r_vaddr - input_section->vma))
|
||||
signed_value = 0;
|
||||
|
||||
/* Determine the destination of the jump. */
|
||||
signed_value += val;
|
||||
|
||||
if ((signed_value & ~0x3ffff) == 0)
|
||||
{
|
||||
/* We can use an absolute jump. */
|
||||
insn |= (1 << 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make the destination PC relative. */
|
||||
signed_value -= (input_section->output_section->vma
|
||||
+ input_section->output_offset
|
||||
+ (rel->r_vaddr - input_section->vma));
|
||||
if (signed_value > 0x1ffff || signed_value < - 0x20000)
|
||||
{
|
||||
overflow = true;
|
||||
signed_value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Put the adjusted value back into the instruction. */
|
||||
signed_value >>= 2;
|
||||
insn = INSERT_HWORD (insn, signed_value);
|
||||
|
||||
bfd_put_32 (input_bfd, (bfd_vma) insn, loc);
|
||||
|
||||
break;
|
||||
|
||||
case R_ILOHALF:
|
||||
insn = bfd_get_32 (input_bfd, loc);
|
||||
unsigned_value = EXTRACT_HWORD (insn);
|
||||
unsigned_value += val;
|
||||
insn = INSERT_HWORD (insn, unsigned_value);
|
||||
bfd_put_32 (input_bfd, insn, loc);
|
||||
break;
|
||||
|
||||
case R_IHIHALF:
|
||||
/* Save the value for the R_IHCONST reloc. */
|
||||
hihalf = true;
|
||||
hihalf_val = val;
|
||||
break;
|
||||
|
||||
case R_IHCONST:
|
||||
if (! hihalf)
|
||||
{
|
||||
if (! ((*info->callbacks->reloc_dangerous)
|
||||
(info, _("missing IHIHALF reloc"), input_bfd,
|
||||
input_section, rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
hihalf_val = 0;
|
||||
}
|
||||
|
||||
insn = bfd_get_32 (input_bfd, loc);
|
||||
unsigned_value = rel->r_symndx + hihalf_val;
|
||||
unsigned_value >>= 16;
|
||||
insn = INSERT_HWORD (insn, unsigned_value);
|
||||
bfd_put_32 (input_bfd, (bfd_vma) insn, loc);
|
||||
|
||||
hihalf = false;
|
||||
|
||||
break;
|
||||
|
||||
case R_BYTE:
|
||||
case R_HWORD:
|
||||
case R_WORD:
|
||||
rstat = _bfd_relocate_contents (howto_table + rel->r_type,
|
||||
input_bfd, val, loc);
|
||||
if (rstat == bfd_reloc_overflow)
|
||||
overflow = true;
|
||||
else if (rstat != bfd_reloc_ok)
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (overflow)
|
||||
{
|
||||
const char *name;
|
||||
char buf[SYMNMLEN + 1];
|
||||
|
||||
if (symndx == -1)
|
||||
name = "*ABS*";
|
||||
else if (h != NULL)
|
||||
name = h->root.root.string;
|
||||
else if (sym == NULL)
|
||||
name = "*unknown*";
|
||||
else if (sym->_n._n_n._n_zeroes == 0
|
||||
&& sym->_n._n_n._n_offset != 0)
|
||||
name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
|
||||
else
|
||||
{
|
||||
strncpy (buf, sym->_n._n_name, SYMNMLEN);
|
||||
buf[SYMNMLEN] = '\0';
|
||||
name = buf;
|
||||
}
|
||||
|
||||
if (! ((*info->callbacks->reloc_overflow)
|
||||
(info, name, howto_table[rel->r_type].name, (bfd_vma) 0,
|
||||
input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define coff_relocate_section coff_a29k_relocate_section
|
||||
|
||||
/* We don't want to change the symndx of a R_IHCONST reloc, since it
|
||||
is actually an addend, not a symbol index at all. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static boolean
|
||||
coff_a29k_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
|
||||
bfd *obfd;
|
||||
struct bfd_link_info *info;
|
||||
bfd *ibfd;
|
||||
asection *sec;
|
||||
struct internal_reloc *irel;
|
||||
boolean *adjustedp;
|
||||
{
|
||||
if (irel->r_type == R_IHCONST)
|
||||
*adjustedp = true;
|
||||
else
|
||||
*adjustedp = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#define coff_adjust_symndx coff_a29k_adjust_symndx
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
const bfd_target a29kcoff_big_vec =
|
||||
{
|
||||
"coff-a29k-big", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC /* section flags */
|
||||
| SEC_LOAD | SEC_RELOC
|
||||
| SEC_READONLY ),
|
||||
'_', /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
/* 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_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16,
|
||||
|
||||
{
|
||||
|
||||
_bfd_dummy_target,
|
||||
coff_object_p,
|
||||
bfd_generic_archive_p,
|
||||
_bfd_dummy_target
|
||||
},
|
||||
{
|
||||
bfd_false,
|
||||
coff_mkobject,
|
||||
_bfd_generic_mkarchive,
|
||||
bfd_false
|
||||
},
|
||||
{
|
||||
bfd_false,
|
||||
coff_write_object_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
|
@ -0,0 +1,161 @@
|
|||
/* BFD back-end for Apollo 68000 COFF binaries.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
By Troy Rollo (troy@cbme.unsw.edu.au)
|
||||
Based on m68k standard COFF version 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 "coff/apollo.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
|
||||
#ifdef ONLY_DECLARE_RELOCS
|
||||
extern reloc_howto_type apollocoff_howto_table[];
|
||||
#else
|
||||
reloc_howto_type apollocoff_howto_table[] =
|
||||
{
|
||||
HOWTO(R_RELBYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO(R_RELWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO(R_RELLONG, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "32", true, 0xffffffff,0xffffffff, false),
|
||||
HOWTO(R_PCRBYTE, 0, 0, 8, true, 0, complain_overflow_signed, 0, "DISP8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO(R_PCRWORD, 0, 1, 16, true, 0, complain_overflow_signed, 0, "DISP16", true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO(R_PCRLONG, 0, 2, 32, true, 0, complain_overflow_signed, 0, "DISP32", true, 0xffffffff,0xffffffff, false),
|
||||
HOWTO(R_RELLONG_NEG, 0, -2, 32, false, 0, complain_overflow_bitfield, 0, "-32", true, 0xffffffff,0xffffffff, false),
|
||||
};
|
||||
#endif /* not ONLY_DECLARE_RELOCS */
|
||||
|
||||
#ifndef BADMAG
|
||||
#define BADMAG(x) M68KBADMAG(x)
|
||||
#endif
|
||||
#define APOLLO_M68 1 /* Customize coffcode.h */
|
||||
|
||||
/* Turn a howto into a reloc number */
|
||||
|
||||
#ifdef ONLY_DECLARE_RELOCS
|
||||
extern void apollo_rtype2howto PARAMS ((arelent *internal, int relocentry));
|
||||
extern int apollo_howto2rtype PARAMS ((reloc_howto_type *));
|
||||
#else
|
||||
void
|
||||
apollo_rtype2howto(internal, relocentry)
|
||||
arelent *internal;
|
||||
int relocentry;
|
||||
{
|
||||
switch (relocentry)
|
||||
{
|
||||
case R_RELBYTE: internal->howto = apollocoff_howto_table + 0; break;
|
||||
case R_RELWORD: internal->howto = apollocoff_howto_table + 1; break;
|
||||
case R_RELLONG: internal->howto = apollocoff_howto_table + 2; break;
|
||||
case R_PCRBYTE: internal->howto = apollocoff_howto_table + 3; break;
|
||||
case R_PCRWORD: internal->howto = apollocoff_howto_table + 4; break;
|
||||
case R_PCRLONG: internal->howto = apollocoff_howto_table + 5; break;
|
||||
case R_RELLONG_NEG: internal->howto = apollocoff_howto_table + 6; break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
apollo_howto2rtype (internal)
|
||||
reloc_howto_type *internal;
|
||||
{
|
||||
if (internal->pc_relative)
|
||||
{
|
||||
switch (internal->bitsize)
|
||||
{
|
||||
case 32: return R_PCRLONG;
|
||||
case 16: return R_PCRWORD;
|
||||
case 8: return R_PCRBYTE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (internal->bitsize)
|
||||
{
|
||||
case 32: return R_RELLONG;
|
||||
case 16: return R_RELWORD;
|
||||
case 8: return R_RELBYTE;
|
||||
}
|
||||
}
|
||||
return R_RELLONG;
|
||||
}
|
||||
#endif /* not ONLY_DECLARE_RELOCS */
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) \
|
||||
apollo_rtype2howto(internal, (relocentry)->r_type)
|
||||
|
||||
#define SELECT_RELOC(external, internal) \
|
||||
external.r_type = apollo_howto2rtype(internal);
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
const bfd_target
|
||||
#ifdef TARGET_SYM
|
||||
TARGET_SYM =
|
||||
#else
|
||||
apollocoff_vec =
|
||||
#endif
|
||||
{
|
||||
#ifdef TARGET_NAME
|
||||
TARGET_NAME,
|
||||
#else
|
||||
"apollo-m68k", /* name */
|
||||
#endif
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
#ifdef NAMES_HAVE_UNDERSCORE
|
||||
'_',
|
||||
#else
|
||||
0, /* leading underscore */
|
||||
#endif
|
||||
'/', /* ar_pad_char */
|
||||
15, /* 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_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{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
|
@ -0,0 +1,135 @@
|
|||
/* BFD back-end for Apple M68K COFF A/UX 3.x files.
|
||||
Copyright 1996, 1997 Free Software Foundation, Inc.
|
||||
Written by Richard Henderson <rth@tamu.edu>.
|
||||
|
||||
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 TARGET_SYM m68kaux_coff_vec
|
||||
#define TARGET_NAME "coff-m68k-aux"
|
||||
|
||||
#ifndef TARG_AUX
|
||||
#define TARG_AUX
|
||||
#endif
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
/* 4k pages */
|
||||
#define COFF_PAGE_SIZE 0x1000
|
||||
|
||||
/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */
|
||||
#define BSS_NOLOAD_IS_SHARED_LIBRARY
|
||||
|
||||
#define STATIC_RELOCS
|
||||
|
||||
#define COFF_COMMON_ADDEND
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
static boolean coff_m68k_aux_link_add_one_symbol
|
||||
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
|
||||
asection *, bfd_vma, const char *, boolean, boolean,
|
||||
struct bfd_link_hash_entry **));
|
||||
|
||||
#define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol
|
||||
|
||||
#include "coff/aux-coff.h" /* override coff/internal.h and coff/m68k.h */
|
||||
#include "coff-m68k.c"
|
||||
|
||||
/* We need non-absolute symbols to override absolute symbols. This
|
||||
mirrors Apple's "solution" to let a static library symbol override
|
||||
a shared library symbol. On the whole not a good thing, given how
|
||||
shared libraries work here, but can work if you are careful with
|
||||
what you include in the shared object. */
|
||||
|
||||
static boolean
|
||||
coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
|
||||
string, copy, collect, hashp)
|
||||
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;
|
||||
{
|
||||
struct bfd_link_hash_entry *h;
|
||||
|
||||
if ((flags & (BSF_WARNING | BSF_CONSTRUCTOR | BSF_WEAK)) == 0 &&
|
||||
!bfd_is_und_section (section) &&
|
||||
!bfd_is_com_section (section))
|
||||
{
|
||||
/* The new symbol is a definition or an indirect definition */
|
||||
|
||||
/* This bit copied from linker.c */
|
||||
if (hashp != NULL && *hashp != NULL)
|
||||
{
|
||||
h = *hashp;
|
||||
BFD_ASSERT (strcmp (h->root.string, name) == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
h = bfd_link_hash_lookup (info->hash, name, true, copy, false);
|
||||
if (h == NULL)
|
||||
{
|
||||
if (hashp != NULL)
|
||||
*hashp = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (info->notice_hash != (struct bfd_hash_table *) NULL
|
||||
&& (bfd_hash_lookup (info->notice_hash, name, false, false)
|
||||
!= (struct bfd_hash_entry *) NULL))
|
||||
{
|
||||
if (! (*info->callbacks->notice) (info, name, abfd, section, value))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hashp != (struct bfd_link_hash_entry **) NULL)
|
||||
*hashp = h;
|
||||
/* end duplication from linker.c */
|
||||
|
||||
if (h->type == bfd_link_hash_defined
|
||||
|| h->type == bfd_link_hash_indirect)
|
||||
{
|
||||
asection *msec;
|
||||
|
||||
if (h->type == bfd_link_hash_defined)
|
||||
msec = h->u.def.section;
|
||||
else
|
||||
msec = bfd_ind_section_ptr;
|
||||
|
||||
if (bfd_is_abs_section (msec) && !bfd_is_abs_section (section))
|
||||
{
|
||||
h->u.def.section = section;
|
||||
h->u.def.value = value;
|
||||
return true;
|
||||
}
|
||||
else if (bfd_is_abs_section (section) && !bfd_is_abs_section (msec))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we didn't exit early, finish processing in the generic routine */
|
||||
return _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
|
||||
value, string, copy, collect,
|
||||
hashp);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/* BFD back-end for Intel 386 COFF files (go32 variant).
|
||||
Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
Written by DJ Delorie.
|
||||
|
||||
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 TARGET_SYM go32coff_vec
|
||||
#define TARGET_NAME "coff-go32"
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
|
||||
#include "coff-i386.c"
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,354 @@
|
|||
/* BFD back-end for Hitachi H8/500 COFF binaries.
|
||||
Copyright 1993, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
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 "bfdlink.h"
|
||||
#include "coff/h8500.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
|
||||
|
||||
static reloc_howto_type r_imm8 =
|
||||
HOWTO (R_H8500_IMM8, 0, 1, 8, false, 0,
|
||||
complain_overflow_bitfield, 0, "r_imm8", true, 0x000000ff, 0x000000ff, false);
|
||||
|
||||
static reloc_howto_type r_imm16 =
|
||||
HOWTO (R_H8500_IMM16, 0, 1, 16, false, 0,
|
||||
complain_overflow_bitfield, 0, "r_imm16", true, 0x0000ffff, 0x0000ffff, false);
|
||||
|
||||
static reloc_howto_type r_imm24 =
|
||||
HOWTO (R_H8500_IMM24, 0, 1, 24, false, 0,
|
||||
complain_overflow_bitfield, 0, "r_imm24", true, 0x00ffffff, 0x00ffffff, false);
|
||||
|
||||
static reloc_howto_type r_imm32 =
|
||||
HOWTO (R_H8500_IMM32, 0, 1, 32, false, 0,
|
||||
complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff, 0xffffffff, false);
|
||||
|
||||
|
||||
static reloc_howto_type r_high8 =
|
||||
HOWTO (R_H8500_HIGH8, 0, 1, 8, false, 0,
|
||||
complain_overflow_dont, 0, "r_high8", true, 0x000000ff, 0x000000ff, false);
|
||||
|
||||
static reloc_howto_type r_low16 =
|
||||
HOWTO (R_H8500_LOW16, 0, 1, 16, false, 0,
|
||||
complain_overflow_dont, 0, "r_low16", true, 0x0000ffff, 0x0000ffff, false);
|
||||
|
||||
static reloc_howto_type r_pcrel8 =
|
||||
HOWTO (R_H8500_PCREL8, 0, 1, 8, true, 0, complain_overflow_signed, 0, "r_pcrel8", true, 0, 0, true);
|
||||
|
||||
|
||||
static reloc_howto_type r_pcrel16 =
|
||||
HOWTO (R_H8500_PCREL16, 0, 1, 16, true, 0, complain_overflow_signed, 0, "r_pcrel16", true, 0, 0, true);
|
||||
|
||||
static reloc_howto_type r_high16 =
|
||||
HOWTO (R_H8500_HIGH16, 0, 1, 8, false, 0,
|
||||
complain_overflow_dont, 0, "r_high16", true, 0x000ffff, 0x0000ffff, false);
|
||||
|
||||
|
||||
/* Turn a howto into a reloc number */
|
||||
|
||||
static int
|
||||
coff_h8500_select_reloc (howto)
|
||||
reloc_howto_type *howto;
|
||||
{
|
||||
return howto->type;
|
||||
}
|
||||
|
||||
#define SELECT_RELOC(x,howto) x.r_type = coff_h8500_select_reloc(howto)
|
||||
|
||||
|
||||
#define BADMAG(x) H8500BADMAG(x)
|
||||
#define H8500 1 /* Customize coffcode.h */
|
||||
|
||||
#define __A_MAGIC_SET__
|
||||
|
||||
/* Code to swap in the reloc */
|
||||
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
|
||||
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
|
||||
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \
|
||||
dst->r_stuff[0] = 'S'; \
|
||||
dst->r_stuff[1] = 'C';
|
||||
|
||||
/* Code to turn a r_type into a howto ptr, uses the above howto table
|
||||
*/
|
||||
|
||||
static void
|
||||
rtype2howto(internal, dst)
|
||||
arelent * internal;
|
||||
struct internal_reloc *dst;
|
||||
{
|
||||
switch (dst->r_type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
break;
|
||||
case R_H8500_IMM8:
|
||||
internal->howto = &r_imm8;
|
||||
break;
|
||||
case R_H8500_IMM16:
|
||||
internal->howto = &r_imm16;
|
||||
break;
|
||||
case R_H8500_IMM24:
|
||||
internal->howto = &r_imm24;
|
||||
break;
|
||||
case R_H8500_IMM32:
|
||||
internal->howto = &r_imm32;
|
||||
break;
|
||||
case R_H8500_PCREL8:
|
||||
internal->howto = &r_pcrel8;
|
||||
break;
|
||||
case R_H8500_PCREL16:
|
||||
internal->howto = &r_pcrel16;
|
||||
break;
|
||||
case R_H8500_HIGH8:
|
||||
internal->howto = &r_high8;
|
||||
break;
|
||||
case R_H8500_HIGH16:
|
||||
internal->howto = &r_high16;
|
||||
break;
|
||||
case R_H8500_LOW16:
|
||||
internal->howto = &r_low16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
|
||||
|
||||
|
||||
/* Perform any necessary magic to the addend in a reloc entry */
|
||||
|
||||
|
||||
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
|
||||
cache_ptr->addend = ext_reloc.r_offset;
|
||||
|
||||
|
||||
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
|
||||
reloc_processing(relent, reloc, symbols, abfd, section)
|
||||
|
||||
static void reloc_processing (relent, reloc, symbols, abfd, section)
|
||||
arelent * relent;
|
||||
struct internal_reloc *reloc;
|
||||
asymbol ** symbols;
|
||||
bfd * abfd;
|
||||
asection * section;
|
||||
{
|
||||
relent->address = reloc->r_vaddr;
|
||||
rtype2howto (relent, reloc);
|
||||
|
||||
if (reloc->r_symndx > 0)
|
||||
{
|
||||
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
|
||||
}
|
||||
else
|
||||
{
|
||||
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||
}
|
||||
|
||||
|
||||
relent->addend = reloc->r_offset;
|
||||
relent->address -= section->vma;
|
||||
}
|
||||
|
||||
static void
|
||||
extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
|
||||
bfd *in_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;
|
||||
{
|
||||
bfd_byte *d = data+*dst_ptr;
|
||||
asection *input_section = link_order->u.indirect.section;
|
||||
switch (reloc->howto->type)
|
||||
{
|
||||
case R_H8500_IMM8:
|
||||
bfd_put_8 (in_abfd,
|
||||
bfd_coff_reloc16_get_value (reloc, link_info, input_section),
|
||||
d);
|
||||
(*dst_ptr) += 1;
|
||||
(*src_ptr) += 1;
|
||||
break;
|
||||
|
||||
case R_H8500_HIGH8:
|
||||
bfd_put_8 (in_abfd,
|
||||
(bfd_coff_reloc16_get_value (reloc, link_info, input_section)
|
||||
>> 16),
|
||||
d );
|
||||
(*dst_ptr) += 1;
|
||||
(*src_ptr) += 1;
|
||||
break;
|
||||
|
||||
case R_H8500_IMM16:
|
||||
bfd_put_16 (in_abfd,
|
||||
bfd_coff_reloc16_get_value (reloc, link_info, input_section),
|
||||
d );
|
||||
(*dst_ptr) += 2;
|
||||
(*src_ptr) += 2;
|
||||
break;
|
||||
|
||||
case R_H8500_LOW16:
|
||||
bfd_put_16 (in_abfd,
|
||||
bfd_coff_reloc16_get_value (reloc, link_info, input_section),
|
||||
d);
|
||||
|
||||
(*dst_ptr) += 2;
|
||||
(*src_ptr) += 2;
|
||||
break;
|
||||
|
||||
case R_H8500_HIGH16:
|
||||
bfd_put_16 (in_abfd,
|
||||
(bfd_coff_reloc16_get_value (reloc, link_info, input_section)
|
||||
>>16),
|
||||
d);
|
||||
|
||||
(*dst_ptr) += 2;
|
||||
(*src_ptr) += 2;
|
||||
break;
|
||||
|
||||
case R_H8500_IMM24:
|
||||
{
|
||||
int v = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
|
||||
int o = bfd_get_32(in_abfd, data+ *dst_ptr -1);
|
||||
v = (v & 0x00ffffff) | (o & 0xff00000);
|
||||
bfd_put_32 (in_abfd, v, data + *dst_ptr -1);
|
||||
(*dst_ptr) +=3;
|
||||
(*src_ptr)+=3;;
|
||||
}
|
||||
break;
|
||||
case R_H8500_IMM32:
|
||||
{
|
||||
int v = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
|
||||
bfd_put_32 (in_abfd, v, data + *dst_ptr);
|
||||
(*dst_ptr) +=4;
|
||||
(*src_ptr)+=4;;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case R_H8500_PCREL8:
|
||||
{
|
||||
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
bfd_vma dot = link_order->offset
|
||||
+ *dst_ptr
|
||||
+ link_order->u.indirect.section->output_section->vma;
|
||||
int gap = dst - dot - 1; /* -1 since were in the odd byte of the
|
||||
word and the pc's been incremented */
|
||||
|
||||
if (gap > 128 || gap < -128)
|
||||
{
|
||||
if (! ((*link_info->callbacks->reloc_overflow)
|
||||
(link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
|
||||
reloc->howto->name, reloc->addend, input_section->owner,
|
||||
input_section, reloc->address)))
|
||||
abort ();
|
||||
}
|
||||
bfd_put_8 (in_abfd, gap, data + *dst_ptr);
|
||||
(*dst_ptr)++;
|
||||
(*src_ptr)++;
|
||||
break;
|
||||
}
|
||||
case R_H8500_PCREL16:
|
||||
{
|
||||
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
bfd_vma dot = link_order->offset
|
||||
+ *dst_ptr
|
||||
+ link_order->u.indirect.section->output_section->vma;
|
||||
int gap = dst - dot - 1; /* -1 since were in the odd byte of the
|
||||
word and the pc's been incremented */
|
||||
|
||||
if (gap > 32767 || gap < -32768)
|
||||
{
|
||||
if (! ((*link_info->callbacks->reloc_overflow)
|
||||
(link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
|
||||
reloc->howto->name, reloc->addend, input_section->owner,
|
||||
input_section, reloc->address)))
|
||||
abort ();
|
||||
}
|
||||
bfd_put_16 (in_abfd, gap, data + *dst_ptr);
|
||||
(*dst_ptr)+=2;
|
||||
(*src_ptr)+=2;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
#define coff_reloc16_extra_cases extra_case
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
|
||||
#undef coff_bfd_get_relocated_section_contents
|
||||
#undef coff_bfd_relax_section
|
||||
#define coff_bfd_get_relocated_section_contents \
|
||||
bfd_coff_reloc16_get_relocated_section_contents
|
||||
#define coff_bfd_relax_section bfd_coff_reloc16_relax_section
|
||||
|
||||
const bfd_target h8500coff_vec =
|
||||
{
|
||||
"coff-h8500", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading symbol underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* 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_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{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,
|
||||
};
|
|
@ -0,0 +1,637 @@
|
|||
/* BFD back-end for Intel 386 COFF files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
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 "coff/i386.h"
|
||||
|
||||
#include "coff/internal.h"
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
#include "coff/pe.h"
|
||||
#endif
|
||||
|
||||
#ifdef COFF_GO32_EXE
|
||||
#include "coff/go32exe.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))
|
||||
{
|
||||
#ifndef COFF_WITH_PE
|
||||
/* 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
|
||||
/* In PE mode, we do not offset the common symbol. */
|
||||
diff = reloc_entry->addend;
|
||||
#endif
|
||||
}
|
||||
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
|
||||
/* FIXME: How should this case be handled? */
|
||||
if (reloc_entry->howto->type == R_IMAGEBASE && diff != 0)
|
||||
abort ();
|
||||
#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. For normal i386 COFF, we
|
||||
can use the generic relocate_section routine. For PE, we need our
|
||||
own routine. */
|
||||
|
||||
#ifndef COFF_WITH_PE
|
||||
|
||||
#define coff_relocate_section _bfd_coff_generic_relocate_section
|
||||
|
||||
#else /* COFF_WITH_PE */
|
||||
|
||||
/* The PE relocate section routine. The only difference between this
|
||||
and the regular routine is that we don't want to do anything for a
|
||||
relocateable link. */
|
||||
|
||||
static boolean coff_pe_i386_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
struct internal_reloc *, struct internal_syment *, asection **));
|
||||
|
||||
static boolean
|
||||
coff_pe_i386_relocate_section (output_bfd, info, input_bfd,
|
||||
input_section, contents, relocs, syms,
|
||||
sections)
|
||||
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;
|
||||
{
|
||||
if (info->relocateable)
|
||||
return true;
|
||||
|
||||
return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
|
||||
input_section, contents,
|
||||
relocs, syms, sections);
|
||||
}
|
||||
|
||||
#define coff_relocate_section coff_pe_i386_relocate_section
|
||||
|
||||
#endif /* COFF_WITH_PE */
|
||||
|
||||
/* Convert an rtype to howto for the COFF backend linker. */
|
||||
|
||||
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 relocation 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
|
||||
}
|
||||
|
||||
#ifndef COFF_WITH_PE
|
||||
/* 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;
|
||||
#endif
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
if (howto->pc_relative)
|
||||
{
|
||||
*addendp -= 4;
|
||||
|
||||
/* If the symbol is defined, then the generic code is going to
|
||||
add back the symbol value in order to cancel out an
|
||||
adjustment it made to the addend. However, we set the addend
|
||||
to 0 at the start of this function. We need to adjust here,
|
||||
to avoid the adjustment the generic code will make. FIXME:
|
||||
This is getting a bit hackish. */
|
||||
if (sym != NULL && sym->n_scnum != 0)
|
||||
*addendp -= sym->n_value;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
#ifdef TARGET_UNDERSCORE
|
||||
|
||||
/* If i386 gcc uses underscores for symbol names, then it does not use
|
||||
a leading dot for local labels, so if TARGET_UNDERSCORE is defined
|
||||
we treat all symbols starting with L as local. */
|
||||
|
||||
static boolean coff_i386_is_local_label_name PARAMS ((bfd *, const char *));
|
||||
|
||||
static boolean
|
||||
coff_i386_is_local_label_name (abfd, name)
|
||||
bfd *abfd;
|
||||
const char *name;
|
||||
{
|
||||
if (name[0] == 'L')
|
||||
return true;
|
||||
|
||||
return _bfd_coff_is_local_label_name (abfd, name);
|
||||
}
|
||||
|
||||
#define coff_bfd_is_local_label_name coff_i386_is_local_label_name
|
||||
|
||||
#endif /* TARGET_UNDERSCORE */
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
static const bfd_target *
|
||||
i3coff_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
#ifdef COFF_IMAGE_WITH_PE
|
||||
/* We need to hack badly to handle a PE image correctly. In PE
|
||||
images created by the GNU linker, the offset to the COFF header
|
||||
is always the size. However, this is not the case in images
|
||||
generated by other PE linkers. The PE format stores a four byte
|
||||
offset to the PE signature just before the COFF header at
|
||||
location 0x3c of the file. We pick up that offset, verify that
|
||||
the PE signature is there, and then set ourselves up to read in
|
||||
the COFF header. */
|
||||
{
|
||||
bfd_byte ext_offset[4];
|
||||
file_ptr offset;
|
||||
bfd_byte ext_signature[4];
|
||||
unsigned long signature;
|
||||
|
||||
if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0
|
||||
|| bfd_read (ext_offset, 1, 4, abfd) != 4)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
offset = bfd_h_get_32 (abfd, ext_offset);
|
||||
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|
||||
|| bfd_read (ext_signature, 1, 4, abfd) != 4)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
signature = bfd_h_get_32 (abfd, ext_signature);
|
||||
|
||||
if (signature != 0x4550)
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Here is the hack. coff_object_p wants to read filhsz bytes to
|
||||
pick up the COFF header. We adjust so that that will work. 20
|
||||
is the size of the i386 COFF filehdr. */
|
||||
|
||||
if (bfd_seek (abfd,
|
||||
(bfd_tell (abfd)
|
||||
- bfd_coff_filhsz (abfd)
|
||||
+ 20),
|
||||
SEEK_SET)
|
||||
!= 0)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return coff_object_p (abfd);
|
||||
}
|
||||
|
||||
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),
|
||||
|
||||
#ifndef COFF_WITH_PE
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
|
||||
| SEC_CODE | SEC_DATA),
|
||||
#else
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
|
||||
| SEC_CODE | SEC_DATA
|
||||
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
|
||||
#endif
|
||||
|
||||
#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,
|
||||
};
|
|
@ -0,0 +1,422 @@
|
|||
/* BFD back-end for Intel 860 COFF files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
Created mostly by substituting "860" for "386" in coff-i386.c
|
||||
Harry Dolan <dolan@ssd.intel.com>, October 1995
|
||||
|
||||
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 "coff/i860.h"
|
||||
|
||||
#include "coff/internal.h"
|
||||
|
||||
#include "libcoff.h"
|
||||
|
||||
static bfd_reloc_status_type coff_i860_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static reloc_howto_type *coff_i860_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 i860 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_i860_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 860
|
||||
COFF, so we handle the addend here instead. */
|
||||
diff = reloc_entry->addend;
|
||||
}
|
||||
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
#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_i860_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_i860_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_i860_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_i860_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_i860_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_i860_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_i860_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_i860_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) I860BADMAG(x)
|
||||
#define I860 1 /* Customize coffcode.h */
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
(cache_ptr)->howto = howto_table + (dst)->r_type;
|
||||
|
||||
/* For 860 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_i860_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;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
return howto;
|
||||
}
|
||||
|
||||
#define coff_rtype_to_howto coff_i860_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
|
||||
i860coff_vec =
|
||||
#endif
|
||||
{
|
||||
#ifdef TARGET_NAME
|
||||
TARGET_NAME,
|
||||
#else
|
||||
"coff-i860", /* 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 */
|
||||
'_', /* leading underscore */
|
||||
'/', /* 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,
|
||||
};
|
|
@ -0,0 +1,703 @@
|
|||
/* BFD back-end for Intel 960 COFF files.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 1997 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 I960 1
|
||||
#define BADMAG(x) I960BADMAG(x)
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/i960.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h" /* to allow easier abstraction-breaking */
|
||||
|
||||
static boolean coff_i960_is_local_label_name PARAMS ((bfd *, const char *));
|
||||
static bfd_reloc_status_type optcall_callback
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static bfd_reloc_status_type coff_i960_relocate
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static reloc_howto_type *coff_i960_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
static boolean coff_i960_start_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
static boolean coff_i960_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
struct internal_reloc *, struct internal_syment *, asection **));
|
||||
static boolean coff_i960_adjust_symndx
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
|
||||
struct internal_reloc *, boolean *));
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
#define COFF_ALIGN_IN_SECTION_HEADER 1
|
||||
|
||||
#define GET_SCNHDR_ALIGN bfd_h_get_32
|
||||
#define PUT_SCNHDR_ALIGN bfd_h_put_32
|
||||
|
||||
/* The i960 does not support an MMU, so COFF_PAGE_SIZE can be
|
||||
arbitrarily small. */
|
||||
#define COFF_PAGE_SIZE 1
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
/* This set of local label names is taken from gas. */
|
||||
|
||||
static boolean
|
||||
coff_i960_is_local_label_name (abfd, name)
|
||||
bfd *abfd;
|
||||
const char *name;
|
||||
{
|
||||
return (name[0] == 'L'
|
||||
|| (name[0] == '.'
|
||||
&& (name[1] == 'C'
|
||||
|| name[1] == 'I'
|
||||
|| name[1] == '.')));
|
||||
}
|
||||
|
||||
/* This is just like the usual CALC_ADDEND, but it includes the
|
||||
section VMA for PC relative relocs. */
|
||||
#ifndef CALC_ADDEND
|
||||
#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 = 0; \
|
||||
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 && (reloc.r_type == 25 || reloc.r_type == 27)) \
|
||||
cache_ptr->addend += asect->vma; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define CALLS 0x66003800 /* Template for 'calls' instruction */
|
||||
#define BAL 0x0b000000 /* Template for 'bal' instruction */
|
||||
#define BAL_MASK 0x00ffffff
|
||||
|
||||
static bfd_reloc_status_type
|
||||
optcall_callback (abfd, reloc_entry, symbol_in, data,
|
||||
input_section, ignore_bfd, error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol_in;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *ignore_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
/* This item has already been relocated correctly, but we may be
|
||||
* able to patch in yet better code - done by digging out the
|
||||
* correct info on this symbol */
|
||||
bfd_reloc_status_type result;
|
||||
coff_symbol_type *cs = coffsymbol(symbol_in);
|
||||
|
||||
/* Don't do anything with symbols which aren't tied up yet,
|
||||
except move the reloc. */
|
||||
if (bfd_is_und_section (cs->symbol.section)) {
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
/* So the target symbol has to be of coff type, and the symbol
|
||||
has to have the correct native information within it */
|
||||
if ((bfd_asymbol_flavour(&cs->symbol) != bfd_target_coff_flavour)
|
||||
|| (cs->native == (combined_entry_type *)NULL))
|
||||
{
|
||||
/* This is interesting, consider the case where we're outputting coff
|
||||
from a mix n match input, linking from coff to a symbol defined in a
|
||||
bout file will cause this match to be true. Should I complain? This
|
||||
will only work if the bout symbol is non leaf. */
|
||||
*error_message =
|
||||
(char *) _("uncertain calling convention for non-COFF symbol");
|
||||
result = bfd_reloc_dangerous;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (cs->native->u.syment.n_sclass)
|
||||
{
|
||||
case C_LEAFSTAT:
|
||||
case C_LEAFEXT:
|
||||
/* This is a call to a leaf procedure, replace instruction with a bal
|
||||
to the correct location. */
|
||||
{
|
||||
union internal_auxent *aux = &((cs->native+2)->u.auxent);
|
||||
int word = bfd_get_32(abfd, (bfd_byte *)data + reloc_entry->address);
|
||||
int olf = (aux->x_bal.x_balntry - cs->native->u.syment.n_value);
|
||||
BFD_ASSERT(cs->native->u.syment.n_numaux==2);
|
||||
|
||||
/* We replace the original call instruction with a bal to
|
||||
the bal entry point - the offset of which is described in
|
||||
the 2nd auxent of the original symbol. We keep the native
|
||||
sym and auxents untouched, so the delta between the two
|
||||
is the offset of the bal entry point. */
|
||||
word = ((word + olf) & BAL_MASK) | BAL;
|
||||
bfd_put_32(abfd, word, (bfd_byte *) data + reloc_entry->address);
|
||||
}
|
||||
result = bfd_reloc_ok;
|
||||
break;
|
||||
case C_SCALL:
|
||||
/* This is a call to a system call, replace with a calls to # */
|
||||
BFD_ASSERT(0);
|
||||
result = bfd_reloc_ok;
|
||||
break;
|
||||
default:
|
||||
result = bfd_reloc_ok;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* i960 COFF is used by VxWorks 5.1. However, VxWorks 5.1 does not
|
||||
appear to correctly handle a reloc against a symbol defined in the
|
||||
same object file. It appears to simply discard such relocs, rather
|
||||
than adding their values into the object file. We handle this here
|
||||
by converting all relocs against defined symbols into relocs
|
||||
against the section symbol, when generating a relocateable output
|
||||
file.
|
||||
|
||||
Note that this function is only called if we are not using the COFF
|
||||
specific backend linker. It only does something when doing a
|
||||
relocateable link, which will almost certainly fail when not
|
||||
generating COFF i960 output, so this function is actually no longer
|
||||
useful. It was used before this target was converted to use the
|
||||
COFF specific backend linker. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
coff_i960_relocate (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;
|
||||
{
|
||||
asection *osec;
|
||||
|
||||
if (output_bfd == NULL)
|
||||
{
|
||||
/* Not generating relocateable output file. */
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
if (bfd_is_und_section (bfd_get_section (symbol)))
|
||||
{
|
||||
/* Symbol is not defined, so no need to worry about it. */
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
if (bfd_is_com_section (bfd_get_section (symbol)))
|
||||
{
|
||||
/* I don't really know what the right action is for a common
|
||||
symbol. */
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
/* Convert the reloc to use the section symbol. FIXME: This method
|
||||
is ridiculous. */
|
||||
osec = bfd_get_section (symbol)->output_section;
|
||||
if (coff_section_data (output_bfd, osec) != NULL
|
||||
&& coff_section_data (output_bfd, osec)->tdata != NULL)
|
||||
reloc_entry->sym_ptr_ptr =
|
||||
(asymbol **) coff_section_data (output_bfd, osec)->tdata;
|
||||
else
|
||||
{
|
||||
const char *sec_name;
|
||||
asymbol **syms, **sym_end;
|
||||
|
||||
sec_name = bfd_get_section_name (output_bfd, osec);
|
||||
syms = bfd_get_outsymbols (output_bfd);
|
||||
sym_end = syms + bfd_get_symcount (output_bfd);
|
||||
for (; syms < sym_end; syms++)
|
||||
{
|
||||
if (bfd_asymbol_name (*syms) != NULL
|
||||
&& (*syms)->value == 0
|
||||
&& strcmp ((*syms)->section->output_section->name,
|
||||
sec_name) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (syms >= sym_end)
|
||||
abort ();
|
||||
|
||||
reloc_entry->sym_ptr_ptr = syms;
|
||||
|
||||
if (coff_section_data (output_bfd, osec) == NULL)
|
||||
{
|
||||
osec->used_by_bfd =
|
||||
((PTR) bfd_zalloc (abfd,
|
||||
sizeof (struct coff_section_tdata)));
|
||||
if (osec->used_by_bfd == NULL)
|
||||
return bfd_reloc_overflow;
|
||||
}
|
||||
coff_section_data (output_bfd, osec)->tdata = (PTR) syms;
|
||||
}
|
||||
|
||||
/* Let bfd_perform_relocation do its thing, which will include
|
||||
stuffing the symbol addend into the object file. */
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
static reloc_howto_type howto_rellong =
|
||||
HOWTO ((unsigned int) R_RELLONG, 0, 2, 32,false, 0,
|
||||
complain_overflow_bitfield, coff_i960_relocate,"rellong", true,
|
||||
0xffffffff, 0xffffffff, 0);
|
||||
static reloc_howto_type howto_iprmed =
|
||||
HOWTO (R_IPRMED, 0, 2, 24,true,0, complain_overflow_signed,
|
||||
coff_i960_relocate, "iprmed ", true, 0x00ffffff, 0x00ffffff, 0);
|
||||
static reloc_howto_type howto_optcall =
|
||||
HOWTO (R_OPTCALL, 0,2,24,true,0, complain_overflow_signed,
|
||||
optcall_callback, "optcall", true, 0x00ffffff, 0x00ffffff, 0);
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_i960_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
default:
|
||||
return 0;
|
||||
case BFD_RELOC_I960_CALLJ:
|
||||
return &howto_optcall;
|
||||
case BFD_RELOC_32:
|
||||
case BFD_RELOC_CTOR:
|
||||
return &howto_rellong;
|
||||
case BFD_RELOC_24_PCREL:
|
||||
return &howto_iprmed;
|
||||
}
|
||||
}
|
||||
|
||||
/* The real code is in coffcode.h */
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
{ \
|
||||
reloc_howto_type *howto_ptr; \
|
||||
switch ((dst)->r_type) { \
|
||||
case 17: howto_ptr = &howto_rellong; break; \
|
||||
case 25: howto_ptr = &howto_iprmed; break; \
|
||||
case 27: howto_ptr = &howto_optcall; break; \
|
||||
default: howto_ptr = 0; break; \
|
||||
} \
|
||||
(cache_ptr)->howto = howto_ptr; \
|
||||
}
|
||||
|
||||
/* i960 COFF is used by VxWorks 5.1. However, VxWorks 5.1 does not
|
||||
appear to correctly handle a reloc against a symbol defined in the
|
||||
same object file. It appears to simply discard such relocs, rather
|
||||
than adding their values into the object file. We handle this by
|
||||
converting all relocs against global symbols into relocs against
|
||||
internal symbols at the start of the section. This routine is
|
||||
called at the start of the linking process, and it creates the
|
||||
necessary symbols. */
|
||||
|
||||
static boolean
|
||||
coff_i960_start_final_link (abfd, info)
|
||||
bfd *abfd;
|
||||
struct bfd_link_info *info;
|
||||
{
|
||||
bfd_size_type symesz = bfd_coff_symesz (abfd);
|
||||
asection *o;
|
||||
bfd_byte *esym;
|
||||
|
||||
if (! info->relocateable)
|
||||
return true;
|
||||
|
||||
esym = (bfd_byte *) bfd_malloc (symesz);
|
||||
if (esym == NULL)
|
||||
return false;
|
||||
|
||||
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
|
||||
return false;
|
||||
|
||||
for (o = abfd->sections; o != NULL; o = o->next)
|
||||
{
|
||||
struct internal_syment isym;
|
||||
|
||||
strncpy (isym._n._n_name, o->name, SYMNMLEN);
|
||||
isym.n_value = 0;
|
||||
isym.n_scnum = o->target_index;
|
||||
isym.n_type = T_NULL;
|
||||
isym.n_sclass = C_STAT;
|
||||
isym.n_numaux = 0;
|
||||
|
||||
bfd_coff_swap_sym_out (abfd, (PTR) &isym, (PTR) esym);
|
||||
|
||||
if (bfd_write (esym, symesz, 1, abfd) != symesz)
|
||||
{
|
||||
free (esym);
|
||||
return false;
|
||||
}
|
||||
|
||||
obj_raw_syment_count (abfd) += 1;
|
||||
}
|
||||
|
||||
free (esym);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The reloc processing routine for the optimized COFF linker. */
|
||||
|
||||
static boolean
|
||||
coff_i960_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
contents, relocs, syms, sections)
|
||||
bfd *output_bfd;
|
||||
struct bfd_link_info *info;
|
||||
bfd *input_bfd;
|
||||
asection *input_section;
|
||||
bfd_byte *contents;
|
||||
struct internal_reloc *relocs;
|
||||
struct internal_syment *syms;
|
||||
asection **sections;
|
||||
{
|
||||
struct internal_reloc *rel;
|
||||
struct internal_reloc *relend;
|
||||
|
||||
rel = relocs;
|
||||
relend = rel + input_section->reloc_count;
|
||||
for (; rel < relend; rel++)
|
||||
{
|
||||
long symndx;
|
||||
struct coff_link_hash_entry *h;
|
||||
struct internal_syment *sym;
|
||||
bfd_vma addend;
|
||||
bfd_vma val;
|
||||
reloc_howto_type *howto;
|
||||
bfd_reloc_status_type rstat = bfd_reloc_ok;
|
||||
boolean done;
|
||||
|
||||
symndx = rel->r_symndx;
|
||||
|
||||
if (symndx == -1)
|
||||
{
|
||||
h = NULL;
|
||||
sym = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = obj_coff_sym_hashes (input_bfd)[symndx];
|
||||
sym = syms + symndx;
|
||||
}
|
||||
|
||||
if (sym != NULL && sym->n_scnum != 0)
|
||||
addend = - sym->n_value;
|
||||
else
|
||||
addend = 0;
|
||||
|
||||
switch (rel->r_type)
|
||||
{
|
||||
case 17: howto = &howto_rellong; break;
|
||||
case 25: howto = &howto_iprmed; break;
|
||||
case 27: howto = &howto_optcall; break;
|
||||
default:
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
|
||||
val = 0;
|
||||
|
||||
if (h == NULL)
|
||||
{
|
||||
asection *sec;
|
||||
|
||||
if (symndx == -1)
|
||||
{
|
||||
sec = bfd_abs_section_ptr;
|
||||
val = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sec = sections[symndx];
|
||||
val = (sec->output_section->vma
|
||||
+ sec->output_offset
|
||||
+ sym->n_value
|
||||
- sec->vma);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
{
|
||||
asection *sec;
|
||||
|
||||
sec = h->root.u.def.section;
|
||||
val = (h->root.u.def.value
|
||||
+ sec->output_section->vma
|
||||
+ sec->output_offset);
|
||||
}
|
||||
else if (! info->relocateable)
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
done = false;
|
||||
|
||||
if (howto->type == R_OPTCALL && ! info->relocateable && symndx != -1)
|
||||
{
|
||||
int class;
|
||||
|
||||
if (h != NULL)
|
||||
class = h->class;
|
||||
else
|
||||
class = sym->n_sclass;
|
||||
|
||||
switch (class)
|
||||
{
|
||||
case C_NULL:
|
||||
/* This symbol is apparently not from a COFF input file.
|
||||
We warn, and then assume that it is not a leaf
|
||||
function. */
|
||||
if (! ((*info->callbacks->reloc_dangerous)
|
||||
(info,
|
||||
_("uncertain calling convention for non-COFF symbol"),
|
||||
input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
break;
|
||||
case C_LEAFSTAT:
|
||||
case C_LEAFEXT:
|
||||
/* This is a call to a leaf procedure; use the bal
|
||||
instruction. */
|
||||
{
|
||||
long olf;
|
||||
unsigned long word;
|
||||
|
||||
if (h != NULL)
|
||||
{
|
||||
BFD_ASSERT (h->numaux == 2);
|
||||
olf = h->aux[1].x_bal.x_balntry;
|
||||
}
|
||||
else
|
||||
{
|
||||
bfd_byte *esyms;
|
||||
union internal_auxent aux;
|
||||
|
||||
BFD_ASSERT (sym->n_numaux == 2);
|
||||
esyms = (bfd_byte *) obj_coff_external_syms (input_bfd);
|
||||
esyms += (symndx + 2) * bfd_coff_symesz (input_bfd);
|
||||
bfd_coff_swap_aux_in (input_bfd, (PTR) esyms, sym->n_type,
|
||||
sym->n_sclass, 1, sym->n_numaux,
|
||||
(PTR) &aux);
|
||||
olf = aux.x_bal.x_balntry;
|
||||
}
|
||||
|
||||
word = bfd_get_32 (input_bfd,
|
||||
(contents
|
||||
+ (rel->r_vaddr - input_section->vma)));
|
||||
word = ((word + olf - val) & BAL_MASK) | BAL;
|
||||
bfd_put_32 (input_bfd,
|
||||
word,
|
||||
(contents
|
||||
+ (rel->r_vaddr - input_section->vma)));
|
||||
done = true;
|
||||
}
|
||||
break;
|
||||
case C_SCALL:
|
||||
BFD_ASSERT (0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! done)
|
||||
{
|
||||
if (howto->pc_relative)
|
||||
addend += input_section->vma;
|
||||
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
|
||||
contents,
|
||||
rel->r_vaddr - input_section->vma,
|
||||
val, addend);
|
||||
}
|
||||
|
||||
switch (rstat)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
case bfd_reloc_ok:
|
||||
break;
|
||||
case bfd_reloc_overflow:
|
||||
{
|
||||
const char *name;
|
||||
char buf[SYMNMLEN + 1];
|
||||
|
||||
if (symndx == -1)
|
||||
name = "*ABS*";
|
||||
else if (h != NULL)
|
||||
name = h->root.root.string;
|
||||
else
|
||||
{
|
||||
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
|
||||
if (name == NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! ((*info->callbacks->reloc_overflow)
|
||||
(info, name, howto->name, (bfd_vma) 0, input_bfd,
|
||||
input_section, rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Adjust the symbol index of any reloc against a global symbol to
|
||||
instead be a reloc against the internal symbol we created specially
|
||||
for the section. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static boolean
|
||||
coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
|
||||
bfd *obfd;
|
||||
struct bfd_link_info *info;
|
||||
bfd *ibfd;
|
||||
asection *sec;
|
||||
struct internal_reloc *irel;
|
||||
boolean *adjustedp;
|
||||
{
|
||||
struct coff_link_hash_entry *h;
|
||||
|
||||
*adjustedp = false;
|
||||
|
||||
h = obj_coff_sym_hashes (ibfd)[irel->r_symndx];
|
||||
if (h == NULL
|
||||
|| (h->root.type != bfd_link_hash_defined
|
||||
&& h->root.type != bfd_link_hash_defweak))
|
||||
return true;
|
||||
|
||||
irel->r_symndx = h->root.u.def.section->output_section->target_index - 1;
|
||||
*adjustedp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define coff_bfd_is_local_label_name coff_i960_is_local_label_name
|
||||
|
||||
#define coff_start_final_link coff_i960_start_final_link
|
||||
|
||||
#define coff_relocate_section coff_i960_relocate_section
|
||||
|
||||
#define coff_adjust_symndx coff_i960_adjust_symndx
|
||||
|
||||
#define coff_bfd_reloc_type_lookup coff_i960_reloc_type_lookup
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
const bfd_target icoff_little_vec =
|
||||
{
|
||||
"coff-Intel-little", /* name */
|
||||
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),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading underscore */
|
||||
'/', /* 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 */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, 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,
|
||||
};
|
||||
|
||||
|
||||
const bfd_target icoff_big_vec =
|
||||
{
|
||||
"coff-Intel-big", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_LITTLE, /* data byte order is little */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading underscore */
|
||||
'/', /* 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_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_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{bfd_false, coff_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, 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,
|
||||
};
|
|
@ -0,0 +1,480 @@
|
|||
/* BFD back-end for Motorola 68000 COFF binaries.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 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 "coff/m68k.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
/* This source file is compiled multiple times for various m68k COFF
|
||||
variants. The following macros control its behaviour:
|
||||
|
||||
TARGET_SYM
|
||||
The C name of the BFD target vector. The default is m68kcoff_vec.
|
||||
TARGET_NAME
|
||||
The user visible target name. The default is "coff-m68k".
|
||||
NAMES_HAVE_UNDERSCORE
|
||||
Whether symbol names have an underscore.
|
||||
ONLY_DECLARE_RELOCS
|
||||
Only declare the relocation howto array. Don't actually compile
|
||||
it. The actual array will be picked up in another version of the
|
||||
file.
|
||||
STATIC_RELOCS
|
||||
Make the relocation howto array, and associated functions, static.
|
||||
COFF_COMMON_ADDEND
|
||||
If this is defined, then, for a relocation against a common
|
||||
symbol, the object file holds the value (the size) of the common
|
||||
symbol. If this is not defined, then, for a relocation against a
|
||||
common symbol, the object file holds zero. */
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
||||
|
||||
#ifndef COFF_PAGE_SIZE
|
||||
/* The page size is a guess based on ELF. */
|
||||
#define COFF_PAGE_SIZE 0x2000
|
||||
#endif
|
||||
|
||||
#ifndef COFF_COMMON_ADDEND
|
||||
#define RELOC_SPECIAL_FN 0
|
||||
#else
|
||||
static bfd_reloc_status_type m68kcoff_common_addend_special_fn
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static reloc_howto_type *m68kcoff_common_addend_rtype_to_howto
|
||||
PARAMS ((bfd *, asection *, struct internal_reloc *,
|
||||
struct coff_link_hash_entry *, struct internal_syment *,
|
||||
bfd_vma *));
|
||||
#define RELOC_SPECIAL_FN m68kcoff_common_addend_special_fn
|
||||
#endif
|
||||
|
||||
static boolean m68k_coff_is_local_label_name PARAMS ((bfd *, const char *));
|
||||
|
||||
/* On the delta, a symbol starting with L% is local. We won't see
|
||||
such a symbol on other platforms, so it should be safe to always
|
||||
consider it local here. */
|
||||
|
||||
static boolean
|
||||
m68k_coff_is_local_label_name (abfd, name)
|
||||
bfd *abfd;
|
||||
const char *name;
|
||||
{
|
||||
if (name[0] == 'L' && name[1] == '%')
|
||||
return true;
|
||||
|
||||
return _bfd_coff_is_local_label_name (abfd, name);
|
||||
}
|
||||
|
||||
#ifndef STATIC_RELOCS
|
||||
/* Clean up namespace. */
|
||||
#define m68kcoff_howto_table _bfd_m68kcoff_howto_table
|
||||
#define m68k_rtype2howto _bfd_m68kcoff_rtype2howto
|
||||
#define m68k_howto2rtype _bfd_m68kcoff_howto2rtype
|
||||
#define m68k_reloc_type_lookup _bfd_m68kcoff_reloc_type_lookup
|
||||
#endif
|
||||
|
||||
#ifdef ONLY_DECLARE_RELOCS
|
||||
extern reloc_howto_type m68kcoff_howto_table[];
|
||||
#else
|
||||
#ifdef STATIC_RELOCS
|
||||
static
|
||||
#endif
|
||||
reloc_howto_type m68kcoff_howto_table[] =
|
||||
{
|
||||
HOWTO(R_RELBYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO(R_RELWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "16", true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO(R_RELLONG, 0, 2, 32, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "32", true, 0xffffffff,0xffffffff, false),
|
||||
HOWTO(R_PCRBYTE, 0, 0, 8, true, 0, complain_overflow_signed, RELOC_SPECIAL_FN, "DISP8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO(R_PCRWORD, 0, 1, 16, true, 0, complain_overflow_signed, RELOC_SPECIAL_FN, "DISP16", true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO(R_PCRLONG, 0, 2, 32, true, 0, complain_overflow_signed, RELOC_SPECIAL_FN, "DISP32", true, 0xffffffff,0xffffffff, false),
|
||||
HOWTO(R_RELLONG_NEG, 0, -2, 32, false, 0, complain_overflow_bitfield, RELOC_SPECIAL_FN, "-32", true, 0xffffffff,0xffffffff, false),
|
||||
};
|
||||
#endif /* not ONLY_DECLARE_RELOCS */
|
||||
|
||||
#ifndef BADMAG
|
||||
#define BADMAG(x) M68KBADMAG(x)
|
||||
#endif
|
||||
#define M68 1 /* Customize coffcode.h */
|
||||
|
||||
/* Turn a howto into a reloc number */
|
||||
|
||||
#ifdef ONLY_DECLARE_RELOCS
|
||||
extern void m68k_rtype2howto PARAMS ((arelent *internal, int relocentry));
|
||||
extern int m68k_howto2rtype PARAMS ((reloc_howto_type *));
|
||||
extern reloc_howto_type *m68k_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
#else
|
||||
#ifdef STATIC_RELOCS
|
||||
static
|
||||
#endif
|
||||
void
|
||||
m68k_rtype2howto(internal, relocentry)
|
||||
arelent *internal;
|
||||
int relocentry;
|
||||
{
|
||||
switch (relocentry)
|
||||
{
|
||||
case R_RELBYTE: internal->howto = m68kcoff_howto_table + 0; break;
|
||||
case R_RELWORD: internal->howto = m68kcoff_howto_table + 1; break;
|
||||
case R_RELLONG: internal->howto = m68kcoff_howto_table + 2; break;
|
||||
case R_PCRBYTE: internal->howto = m68kcoff_howto_table + 3; break;
|
||||
case R_PCRWORD: internal->howto = m68kcoff_howto_table + 4; break;
|
||||
case R_PCRLONG: internal->howto = m68kcoff_howto_table + 5; break;
|
||||
case R_RELLONG_NEG: internal->howto = m68kcoff_howto_table + 6; break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef STATIC_RELOCS
|
||||
static
|
||||
#endif
|
||||
int
|
||||
m68k_howto2rtype (internal)
|
||||
reloc_howto_type *internal;
|
||||
{
|
||||
if (internal->pc_relative)
|
||||
{
|
||||
switch (internal->bitsize)
|
||||
{
|
||||
case 32: return R_PCRLONG;
|
||||
case 16: return R_PCRWORD;
|
||||
case 8: return R_PCRBYTE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (internal->bitsize)
|
||||
{
|
||||
case 32: return R_RELLONG;
|
||||
case 16: return R_RELWORD;
|
||||
case 8: return R_RELBYTE;
|
||||
}
|
||||
}
|
||||
return R_RELLONG;
|
||||
}
|
||||
|
||||
#ifdef STATIC_RELOCS
|
||||
static
|
||||
#endif
|
||||
reloc_howto_type *
|
||||
m68k_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
default: return NULL;
|
||||
case BFD_RELOC_8: return m68kcoff_howto_table + 0;
|
||||
case BFD_RELOC_16: return m68kcoff_howto_table + 1;
|
||||
case BFD_RELOC_CTOR:
|
||||
case BFD_RELOC_32: return m68kcoff_howto_table + 2;
|
||||
case BFD_RELOC_8_PCREL: return m68kcoff_howto_table + 3;
|
||||
case BFD_RELOC_16_PCREL: return m68kcoff_howto_table + 4;
|
||||
case BFD_RELOC_32_PCREL: return m68kcoff_howto_table + 5;
|
||||
/* FIXME: There doesn't seem to be a code for R_RELLONG_NEG. */
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
#endif /* not ONLY_DECLARE_RELOCS */
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) \
|
||||
m68k_rtype2howto(internal, (relocentry)->r_type)
|
||||
|
||||
#define SELECT_RELOC(external, internal) \
|
||||
external.r_type = m68k_howto2rtype (internal)
|
||||
|
||||
#define coff_bfd_reloc_type_lookup m68k_reloc_type_lookup
|
||||
|
||||
#ifndef COFF_COMMON_ADDEND
|
||||
#ifndef coff_rtype_to_howto
|
||||
|
||||
#define coff_rtype_to_howto m68kcoff_rtype_to_howto
|
||||
|
||||
static reloc_howto_type *m68kcoff_rtype_to_howto
|
||||
PARAMS ((bfd *, asection *, struct internal_reloc *,
|
||||
struct coff_link_hash_entry *, struct internal_syment *,
|
||||
bfd_vma *));
|
||||
|
||||
/*ARGSUSED*/
|
||||
static reloc_howto_type *
|
||||
m68kcoff_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;
|
||||
{
|
||||
arelent relent;
|
||||
reloc_howto_type *howto;
|
||||
|
||||
RTYPE2HOWTO (&relent, rel);
|
||||
|
||||
howto = relent.howto;
|
||||
|
||||
if (howto->pc_relative)
|
||||
*addendp += sec->vma;
|
||||
|
||||
return howto;
|
||||
}
|
||||
|
||||
#endif /* ! defined (coff_rtype_to_howto) */
|
||||
#endif /* ! defined (COFF_COMMON_ADDEND) */
|
||||
|
||||
#ifdef COFF_COMMON_ADDEND
|
||||
|
||||
/* If COFF_COMMON_ADDEND is defined, then when using m68k COFF the
|
||||
value stored in the .text section for a reference to a common
|
||||
symbol is the value itself plus any desired offset. (taken from
|
||||
work done by Ian Taylor, Cygnus Support, for I386 COFF). */
|
||||
|
||||
/* 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
|
||||
m68kcoff_common_addend_special_fn (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;
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
/* 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 && (reloc.r_type == R_PCRBYTE \
|
||||
|| reloc.r_type == R_PCRWORD \
|
||||
|| reloc.r_type == R_PCRLONG)) \
|
||||
cache_ptr->addend += asect->vma; \
|
||||
}
|
||||
|
||||
#ifndef coff_rtype_to_howto
|
||||
|
||||
/* coff-m68k.c uses the special COFF backend linker. We need to
|
||||
adjust common symbols. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static reloc_howto_type *
|
||||
m68kcoff_common_addend_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;
|
||||
{
|
||||
arelent relent;
|
||||
reloc_howto_type *howto;
|
||||
|
||||
RTYPE2HOWTO (&relent, rel);
|
||||
|
||||
howto = relent.howto;
|
||||
|
||||
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);
|
||||
*addendp -= sym->n_value;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
return howto;
|
||||
}
|
||||
|
||||
#define coff_rtype_to_howto m68kcoff_common_addend_rtype_to_howto
|
||||
|
||||
#endif /* ! defined (coff_rtype_to_howto) */
|
||||
|
||||
#endif /* COFF_COMMON_ADDEND */
|
||||
|
||||
#define coff_bfd_is_local_label_name m68k_coff_is_local_label_name
|
||||
|
||||
#define coff_relocate_section _bfd_coff_generic_relocate_section
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
#ifndef TARGET_SYM
|
||||
#define TARGET_SYM m68kcoff_vec
|
||||
#endif
|
||||
|
||||
#ifndef TARGET_NAME
|
||||
#define TARGET_NAME "coff-m68k"
|
||||
#endif
|
||||
|
||||
const bfd_target TARGET_SYM =
|
||||
{
|
||||
TARGET_NAME,
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(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 NAMES_HAVE_UNDERSCORE
|
||||
'_',
|
||||
#else
|
||||
0, /* leading underscore */
|
||||
#endif
|
||||
'/', /* ar_pad_char */
|
||||
15, /* 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_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{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
|
||||
};
|
|
@ -0,0 +1,330 @@
|
|||
/* BFD back-end for Motorola 88000 COFF "Binary Compatability Standard" files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 97, 1998 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 M88 1 /* Customize various include files */
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/m88k.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
static boolean m88k_is_local_label_name PARAMS ((bfd *, const char *));
|
||||
static bfd_reloc_status_type m88k_special_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static void rtype2howto PARAMS ((arelent *, struct internal_reloc *));
|
||||
static void reloc_processing
|
||||
PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
|
||||
#define GET_SCNHDR_NRELOC bfd_h_get_32
|
||||
#define GET_SCNHDR_NLNNO bfd_h_get_32
|
||||
|
||||
/* On coff-m88k, local labels start with '@'. */
|
||||
|
||||
#define coff_bfd_is_local_label_name m88k_is_local_label_name
|
||||
|
||||
static boolean
|
||||
m88k_is_local_label_name (abfd, name)
|
||||
bfd *abfd;
|
||||
const char *name;
|
||||
{
|
||||
return name[0] == '@';
|
||||
}
|
||||
|
||||
static bfd_reloc_status_type
|
||||
m88k_special_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;
|
||||
{
|
||||
reloc_howto_type *howto = reloc_entry->howto;
|
||||
|
||||
switch (howto->type)
|
||||
{
|
||||
case R_HVRT16:
|
||||
case R_LVRT16:
|
||||
if (output_bfd != (bfd *) NULL)
|
||||
{
|
||||
/* This is a partial relocation, and we want to apply the
|
||||
relocation to the reloc entry rather than the raw data.
|
||||
Modify the reloc inplace to reflect what we now know. */
|
||||
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
bfd_vma output_base = 0;
|
||||
bfd_vma addr = reloc_entry->address;
|
||||
bfd_vma x = bfd_get_16 (abfd, (bfd_byte *) data + addr);
|
||||
asection *reloc_target_output_section;
|
||||
long relocation = 0;
|
||||
|
||||
/* Work out which section the relocation is targetted at and the
|
||||
initial relocation command value. */
|
||||
|
||||
/* Get symbol value. (Common symbols are special.) */
|
||||
if (bfd_is_com_section (symbol->section))
|
||||
relocation = 0;
|
||||
else
|
||||
relocation = symbol->value;
|
||||
|
||||
reloc_target_output_section = symbol->section->output_section;
|
||||
|
||||
/* Convert input-section-relative symbol value to absolute. */
|
||||
if (output_bfd)
|
||||
output_base = 0;
|
||||
else
|
||||
output_base = reloc_target_output_section->vma;
|
||||
|
||||
relocation += output_base + symbol->section->output_offset;
|
||||
|
||||
/* Add in supplied addend. */
|
||||
relocation += ((reloc_entry->addend << howto->bitsize) + x);
|
||||
|
||||
reloc_entry->addend = 0;
|
||||
|
||||
relocation >>= (bfd_vma) howto->rightshift;
|
||||
|
||||
/* Shift everything up to where it's going to be used */
|
||||
|
||||
relocation <<= (bfd_vma) howto->bitpos;
|
||||
|
||||
if (relocation)
|
||||
bfd_put_16 (abfd, relocation, (unsigned char *) data + addr);
|
||||
}
|
||||
|
||||
/* If we are not producing relocateable output, return an error if
|
||||
the symbol is not defined. */
|
||||
if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL)
|
||||
return bfd_reloc_undefined;
|
||||
|
||||
return bfd_reloc_ok;
|
||||
|
||||
default:
|
||||
if (output_bfd != (bfd *) NULL)
|
||||
{
|
||||
/* This is a partial relocation, and we want to apply the
|
||||
relocation to the reloc entry rather than the raw data.
|
||||
Modify the reloc inplace to reflect what we now know. */
|
||||
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (output_bfd == (bfd *) NULL)
|
||||
return bfd_reloc_continue;
|
||||
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
HOWTO (R_PCR16L, /* type */
|
||||
02, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
m88k_special_reloc, /* special_function */
|
||||
"PCR16L", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PCR26L, /* type */
|
||||
02, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
26, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
m88k_special_reloc, /* special_function */
|
||||
"PCR26L", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x03ffffff, /* src_mask */
|
||||
0x03ffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_VRT16, /* type */
|
||||
00, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
m88k_special_reloc, /* special_function */
|
||||
"VRT16", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_HVRT16, /* type */
|
||||
16, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
m88k_special_reloc, /* special_function */
|
||||
"HVRT16", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_LVRT16, /* type */
|
||||
00, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
m88k_special_reloc, /* special_function */
|
||||
"LVRT16", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_VRT32, /* type */
|
||||
00, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
m88k_special_reloc, /* special_function */
|
||||
"VRT32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Code to turn an external r_type into a pointer to an entry in the
|
||||
above howto table. */
|
||||
static void
|
||||
rtype2howto (cache_ptr, dst)
|
||||
arelent *cache_ptr;
|
||||
struct internal_reloc *dst;
|
||||
{
|
||||
if (dst->r_type >= R_PCR16L && dst->r_type <= R_VRT32)
|
||||
{
|
||||
cache_ptr->howto = howto_table + dst->r_type - R_PCR16L;
|
||||
}
|
||||
else
|
||||
{
|
||||
BFD_ASSERT (0);
|
||||
}
|
||||
}
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst)
|
||||
|
||||
|
||||
/* Code to swap in the reloc offset */
|
||||
#define SWAP_IN_RELOC_OFFSET bfd_h_get_16
|
||||
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_16
|
||||
|
||||
|
||||
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
|
||||
reloc_processing(relent, reloc, symbols, abfd, section)
|
||||
|
||||
static void
|
||||
reloc_processing (relent, reloc, symbols, abfd, section)
|
||||
arelent *relent;
|
||||
struct internal_reloc *reloc;
|
||||
asymbol **symbols;
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
{
|
||||
relent->address = reloc->r_vaddr;
|
||||
rtype2howto (relent, reloc);
|
||||
|
||||
if (((int) reloc->r_symndx) > 0)
|
||||
{
|
||||
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
|
||||
}
|
||||
else
|
||||
{
|
||||
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||
}
|
||||
|
||||
relent->addend = reloc->r_offset;
|
||||
relent->address -= section->vma;
|
||||
}
|
||||
|
||||
#define BADMAG(x) MC88BADMAG(x)
|
||||
#include "coffcode.h"
|
||||
|
||||
#undef coff_write_armap
|
||||
|
||||
const bfd_target m88kbcs_vec =
|
||||
{
|
||||
"coff-m88kbcs", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* 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_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{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,
|
||||
};
|
|
@ -0,0 +1,703 @@
|
|||
/* BFD back-end for Motorolla MCore COFF/PE
|
||||
Copyright 1999
|
||||
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, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/mcore.h"
|
||||
#include "coff/internal.h"
|
||||
#include "coff/pe.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#ifdef BADMAG
|
||||
#undef BADMAG
|
||||
#endif
|
||||
#define BADMAG(x) MCOREBADMAG(x)
|
||||
|
||||
#ifndef NUM_ELEM
|
||||
#define NUM_ELEM(A) (sizeof (A) / sizeof (A)[0])
|
||||
#endif
|
||||
|
||||
/* This file is compiled more than once, but we only compile the
|
||||
final_link routine once. */
|
||||
extern boolean mcore_bfd_coff_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
static struct bfd_link_hash_table * coff_mcore_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
static bfd_reloc_status_type mcore_coff_unsupported_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static boolean in_reloc_p
|
||||
PARAMS ((bfd *, reloc_howto_type *));
|
||||
static boolean coff_mcore_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
struct internal_reloc *, struct internal_syment *, asection **));
|
||||
static reloc_howto_type * mcore_coff_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
static reloc_howto_type * coff_mcore_rtype_to_howto
|
||||
PARAMS ((bfd *, asection *, struct internal_reloc *,
|
||||
struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *));
|
||||
static const bfd_target * pe_object_p
|
||||
PARAMS ((bfd *));
|
||||
|
||||
|
||||
|
||||
/* The NT loader points the toc register to &toc + 32768, in order to
|
||||
use the complete range of a 16-bit displacement. We have to adjust
|
||||
for this when we fix up loads displaced off the toc reg. */
|
||||
#define TOC_LOAD_ADJUSTMENT (-32768)
|
||||
#define TOC_SECTION_NAME ".private.toc"
|
||||
|
||||
/* The main body of code is in coffcode.h. */
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
|
||||
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
|
||||
from smaller values. Start with zero, widen, *then* decrement. */
|
||||
#define MINUS_ONE (((bfd_vma)0) - 1)
|
||||
|
||||
|
||||
static reloc_howto_type mcore_coff_howto_table[] =
|
||||
{
|
||||
/* Unused: */
|
||||
HOWTO (IMAGE_REL_MCORE_ABSOLUTE,/* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* dont complain_on_overflow */
|
||||
0, /* special_function */
|
||||
"ABSOLUTE", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x00, /* src_mask */
|
||||
0x00, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (IMAGE_REL_MCORE_ADDR32,/* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
0, /* special_function */
|
||||
"ADDR32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* 8 bits + 2 zero bits; jmpi/jsri/lrw instructions.
|
||||
Should not appear in object files. */
|
||||
HOWTO (IMAGE_REL_MCORE_PCREL_IMM8BY4, /* type */
|
||||
2, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
mcore_coff_unsupported_reloc, /* special_function */
|
||||
"IMM8BY4", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* bsr/bt/bf/br instructions; 11 bits + 1 zero bit
|
||||
Span 2k instructions == 4k bytes.
|
||||
Only useful pieces at the relocated address are the opcode (5 bits) */
|
||||
HOWTO (IMAGE_REL_MCORE_PCREL_IMM11BY2,/* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
11, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"IMM11BY2", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x0, /* src_mask */
|
||||
0x7ff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported. */
|
||||
HOWTO (IMAGE_REL_MCORE_PCREL_IMM4BY2, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
4, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
mcore_coff_unsupported_reloc,/* special_function */
|
||||
"IMM4BY2", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* 32-bit pc-relative. Eventually this will help support PIC code. */
|
||||
HOWTO (IMAGE_REL_MCORE_PCREL_32,/* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"PCREL_32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x0, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* Like PCREL_IMM11BY2, this relocation indicates that there is a
|
||||
'jsri' at the specified address. There is a separate relocation
|
||||
entry for the literal pool entry that it references, but we
|
||||
might be able to change the jsri to a bsr if the target turns out
|
||||
to be close enough [even though we won't reclaim the literal pool
|
||||
entry, we'll get some runtime efficiency back]. Note that this
|
||||
is a relocation that we are allowed to safely ignore. */
|
||||
HOWTO (IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2,/* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
11, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"JSR_IMM11BY2", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x0, /* src_mask */
|
||||
0x7ff, /* dst_mask */
|
||||
true) /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Extend the coff_link_hash_table structure with a few M*Core specific fields.
|
||||
This allows us to store global data here without actually creating any
|
||||
global variables, which is a no-no in the BFD world. */
|
||||
typedef struct coff_mcore_link_hash_table
|
||||
{
|
||||
/* The original coff_link_hash_table structure. MUST be first field. */
|
||||
struct coff_link_hash_table root;
|
||||
|
||||
bfd * bfd_of_toc_owner;
|
||||
long int global_toc_size;
|
||||
long int import_table_size;
|
||||
long int first_thunk_address;
|
||||
long int thunk_size;
|
||||
}
|
||||
mcore_hash_table;
|
||||
|
||||
/* Get the MCore coff linker hash table from a link_info structure. */
|
||||
#define coff_mcore_hash_table(info) \
|
||||
((mcore_hash_table *) ((info)->hash))
|
||||
|
||||
/* Create an MCore coff linker hash table. */
|
||||
static struct bfd_link_hash_table *
|
||||
coff_mcore_link_hash_table_create (abfd)
|
||||
bfd * abfd;
|
||||
{
|
||||
mcore_hash_table * ret;
|
||||
|
||||
ret = ((mcore_hash_table *) bfd_alloc (abfd, sizeof (* ret)));
|
||||
if (ret == (mcore_hash_table *) NULL)
|
||||
return NULL;
|
||||
|
||||
if (! _bfd_coff_link_hash_table_init
|
||||
(& ret->root, abfd, _bfd_coff_link_hash_newfunc))
|
||||
{
|
||||
bfd_release (abfd, ret);
|
||||
return (struct bfd_link_hash_table *) NULL;
|
||||
}
|
||||
|
||||
ret->bfd_of_toc_owner = NULL;
|
||||
ret->global_toc_size = 0;
|
||||
ret->import_table_size = 0;
|
||||
ret->first_thunk_address = 0;
|
||||
ret->thunk_size = 0;
|
||||
|
||||
return & ret->root.root;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static bfd_reloc_status_type
|
||||
mcore_coff_unsupported_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;
|
||||
{
|
||||
BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
|
||||
|
||||
_bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
|
||||
bfd_get_filename (abfd),
|
||||
reloc_entry->howto->name,
|
||||
reloc_entry->howto->type);
|
||||
|
||||
return bfd_reloc_notsupported;
|
||||
}
|
||||
|
||||
|
||||
/* A cheesy little macro to make the code a little more readable. */
|
||||
#define HOW2MAP(bfd_rtype, mcore_rtype) \
|
||||
case bfd_rtype: return & mcore_coff_howto_table [mcore_rtype]
|
||||
|
||||
static reloc_howto_type *
|
||||
mcore_coff_reloc_type_lookup (abfd, code)
|
||||
bfd * abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
HOW2MAP (BFD_RELOC_32, IMAGE_REL_MCORE_ADDR32);
|
||||
HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM8BY4, IMAGE_REL_MCORE_PCREL_IMM8BY4);
|
||||
HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM11BY2, IMAGE_REL_MCORE_PCREL_IMM11BY2);
|
||||
HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM4BY2, IMAGE_REL_MCORE_PCREL_IMM4BY2);
|
||||
HOW2MAP (BFD_RELOC_32_PCREL, IMAGE_REL_MCORE_PCREL_32);
|
||||
HOW2MAP (BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2, IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
#undef HOW2MAP
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
(cache_ptr)->howto = mcore_coff_howto_table + (dst)->r_type;
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_mcore_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;
|
||||
|
||||
|
||||
if (rel->r_type >= NUM_ELEM (mcore_coff_howto_table))
|
||||
return NULL;
|
||||
|
||||
howto = mcore_coff_howto_table + rel->r_type;
|
||||
|
||||
if (howto->pc_relative)
|
||||
{
|
||||
* addendp = sec->vma - 2; /* XXX guess - is this right ? */
|
||||
|
||||
/* If the symbol is defined, then the generic code is going to
|
||||
add back the symbol value in order to cancel out an
|
||||
adjustment it made to the addend. However, we set the addend
|
||||
to 0 at the start of this function. We need to adjust here,
|
||||
to avoid the adjustment the generic code will make. FIXME:
|
||||
This is getting a bit hackish. */
|
||||
if (sym != NULL && sym->n_scnum != 0)
|
||||
* addendp -= sym->n_value;
|
||||
}
|
||||
else
|
||||
* addendp = 0;
|
||||
|
||||
return howto;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* The reloc processing routine for the optimized COFF linker. */
|
||||
static boolean
|
||||
coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
contents, relocs, syms, sections)
|
||||
bfd * output_bfd;
|
||||
struct bfd_link_info * info;
|
||||
bfd * input_bfd;
|
||||
asection * input_section;
|
||||
bfd_byte * contents;
|
||||
struct internal_reloc * relocs;
|
||||
struct internal_syment * syms;
|
||||
asection ** sections;
|
||||
{
|
||||
struct internal_reloc * rel;
|
||||
struct internal_reloc * relend;
|
||||
boolean hihalf;
|
||||
bfd_vma hihalf_val;
|
||||
|
||||
/* If we are performing a relocateable link, we don't need to do a
|
||||
thing. The caller will take care of adjusting the reloc
|
||||
addresses and symbol indices. */
|
||||
if (info->relocateable)
|
||||
return true;
|
||||
|
||||
BFD_ASSERT (input_bfd->xvec->byteorder
|
||||
== output_bfd->xvec->byteorder);
|
||||
|
||||
hihalf = false;
|
||||
hihalf_val = 0;
|
||||
|
||||
rel = relocs;
|
||||
relend = rel + input_section->reloc_count;
|
||||
|
||||
for (; rel < relend; rel++)
|
||||
{
|
||||
asection * toc_section = NULL;
|
||||
bfd_vma relocation;
|
||||
long symndx;
|
||||
struct internal_syment * sym;
|
||||
bfd_vma val;
|
||||
bfd_vma addend;
|
||||
bfd_reloc_status_type rstat;
|
||||
bfd_byte * loc;
|
||||
unsigned short r_type = rel->r_type;
|
||||
reloc_howto_type * howto = NULL;
|
||||
struct coff_link_hash_entry * h;
|
||||
const char * my_name;
|
||||
|
||||
symndx = rel->r_symndx;
|
||||
loc = contents + rel->r_vaddr - input_section->vma;
|
||||
|
||||
if (symndx == -1)
|
||||
{
|
||||
h = NULL;
|
||||
sym = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = obj_coff_sym_hashes (input_bfd)[symndx];
|
||||
sym = syms + symndx;
|
||||
}
|
||||
|
||||
/* Get the howto and initialise the addend. */
|
||||
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
|
||||
sym, & addend);
|
||||
if (howto == NULL)
|
||||
return false;
|
||||
|
||||
val = 0;
|
||||
|
||||
if (h == NULL)
|
||||
{
|
||||
if (symndx == -1)
|
||||
my_name = "*ABS*";
|
||||
else
|
||||
{
|
||||
asection * sec = sections[symndx];
|
||||
|
||||
val = (sym->n_value
|
||||
+ sec->output_section->vma
|
||||
+ sec->output_offset);
|
||||
|
||||
if (sym == NULL)
|
||||
my_name = "*unknown*";
|
||||
else if ( sym->_n._n_n._n_zeroes == 0
|
||||
&& sym->_n._n_n._n_offset != 0)
|
||||
my_name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
|
||||
else
|
||||
{
|
||||
static char buf [SYMNMLEN + 1];
|
||||
|
||||
strncpy (buf, sym->_n._n_name, SYMNMLEN);
|
||||
buf[SYMNMLEN] = '\0';
|
||||
my_name = buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
{
|
||||
asection * sec = h->root.u.def.section;
|
||||
|
||||
val = (h->root.u.def.value
|
||||
+ sec->output_section->vma
|
||||
+ sec->output_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
}
|
||||
|
||||
my_name = h->root.root.string;
|
||||
}
|
||||
|
||||
rstat = bfd_reloc_ok;
|
||||
|
||||
/* Each case must do its own relocation, setting rstat appropriately. */
|
||||
switch (r_type)
|
||||
{
|
||||
default:
|
||||
_bfd_error_handler (_("%s: unsupported relocation type 0x%02x"),
|
||||
bfd_get_filename (input_bfd), r_type);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
|
||||
case IMAGE_REL_MCORE_ABSOLUTE:
|
||||
fprintf (stderr,
|
||||
_("Warning: unsupported reloc %s <file %s, section %s>\n"),
|
||||
howto->name,
|
||||
bfd_get_filename (input_bfd),
|
||||
input_section->name);
|
||||
|
||||
fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
|
||||
rel->r_symndx, my_name, (long) rel->r_vaddr,
|
||||
(unsigned long) rel->r_vaddr);
|
||||
break;
|
||||
|
||||
case IMAGE_REL_MCORE_PCREL_IMM8BY4:
|
||||
case IMAGE_REL_MCORE_PCREL_IMM11BY2:
|
||||
case IMAGE_REL_MCORE_PCREL_IMM4BY2:
|
||||
case IMAGE_REL_MCORE_PCREL_32:
|
||||
case IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2:
|
||||
case IMAGE_REL_MCORE_ADDR32:
|
||||
rstat = _bfd_relocate_contents (howto, input_bfd, val, loc);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (rstat)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case bfd_reloc_ok:
|
||||
break;
|
||||
|
||||
case bfd_reloc_overflow:
|
||||
if (! ((*info->callbacks->reloc_overflow)
|
||||
(info, my_name, howto->name,
|
||||
(bfd_vma) 0, input_bfd,
|
||||
input_section, rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Tailor coffcode.h -- macro heaven. */
|
||||
|
||||
/* We use the special COFF backend linker, with our own special touch. */
|
||||
|
||||
#define coff_bfd_reloc_type_lookup mcore_coff_reloc_type_lookup
|
||||
#define coff_relocate_section coff_mcore_relocate_section
|
||||
#define coff_rtype_to_howto coff_mcore_rtype_to_howto
|
||||
|
||||
#define SELECT_RELOC(internal, howto) {internal.r_type = howto->type;}
|
||||
|
||||
#define COFF_PAGE_SIZE 0x1000
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
static const bfd_target *
|
||||
pe_object_p (abfd)
|
||||
bfd * abfd;
|
||||
{
|
||||
#ifdef COFF_IMAGE_WITH_PE
|
||||
/* We need to hack badly to handle a PE image correctly. In PE
|
||||
images created by the GNU linker, the offset to the COFF header
|
||||
is always the size. However, this is not the case in images
|
||||
generated by other PE linkers. The PE format stores a four byte
|
||||
offset to the PE signature just before the COFF header at
|
||||
location 0x3c of the file. We pick up that offset, verify that
|
||||
the PE signature is there, and then set ourselves up to read in
|
||||
the COFF header. */
|
||||
{
|
||||
bfd_byte ext_offset[4];
|
||||
file_ptr offset;
|
||||
bfd_byte ext_signature[4];
|
||||
unsigned long signature;
|
||||
|
||||
if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0
|
||||
|| bfd_read (ext_offset, 1, 4, abfd) != 4)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
offset = bfd_h_get_32 (abfd, ext_offset);
|
||||
|
||||
if (bfd_seek (abfd, offset, SEEK_SET) != 0
|
||||
|| bfd_read (ext_signature, 1, 4, abfd) != 4)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
signature = bfd_h_get_32 (abfd, ext_signature);
|
||||
|
||||
if (signature != 0x4550)
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Here is the hack. coff_object_p wants to read filhsz bytes to
|
||||
pick up the COFF header. We adjust so that that will work. 20
|
||||
is the size of the mips COFF filehdr. */
|
||||
if (bfd_seek (abfd, (bfd_tell (abfd) - bfd_coff_filhsz (abfd) + 20),
|
||||
SEEK_SET) != 0)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return coff_object_p (abfd);
|
||||
}
|
||||
|
||||
/* The transfer vectors that lead the outside world to all of the above. */
|
||||
|
||||
const bfd_target
|
||||
TARGET_BIG_SYM =
|
||||
{
|
||||
TARGET_BIG_NAME,
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(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 */
|
||||
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
|
||||
|
||||
0, /* leading char */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* 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_dummy_target,
|
||||
pe_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, /* _bfd_dummy_target */
|
||||
pe_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,
|
||||
};
|
||||
|
||||
const bfd_target
|
||||
TARGET_LITTLE_SYM =
|
||||
{
|
||||
TARGET_LITTLE_NAME,
|
||||
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 */
|
||||
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
|
||||
|
||||
0, /* leading underscore */
|
||||
'/', /* 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,
|
||||
pe_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p,
|
||||
pe_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
|
@ -0,0 +1,27 @@
|
|||
/* BFD back-end for Apple et al PowerPC Mac "XCOFF" files.
|
||||
Copyright 1995 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 TARGET_SYM pmac_xcoff_vec
|
||||
#define TARGET_NAME "xcoff-powermac"
|
||||
|
||||
/* Tweak coffcode.h based on this being a PowerMac instead of RS/6000. */
|
||||
|
||||
#define POWERMAC
|
||||
|
||||
#include "coff-rs6000.c"
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,256 @@
|
|||
/* BFD back-end for Sparc COFF files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 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 "coff/sparc.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
|
||||
#define BADMAG(x) ((x).f_magic != SPARCMAGIC && (x).f_magic != LYNXCOFFMAGIC)
|
||||
|
||||
/* The page size is a guess based on ELF. */
|
||||
#define COFF_PAGE_SIZE 0x10000
|
||||
|
||||
enum reloc_type
|
||||
{
|
||||
R_SPARC_NONE = 0,
|
||||
R_SPARC_8, R_SPARC_16, R_SPARC_32,
|
||||
R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
|
||||
R_SPARC_WDISP30, R_SPARC_WDISP22,
|
||||
R_SPARC_HI22, R_SPARC_22,
|
||||
R_SPARC_13, R_SPARC_LO10,
|
||||
R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22,
|
||||
R_SPARC_PC10, R_SPARC_PC22,
|
||||
R_SPARC_WPLT30,
|
||||
R_SPARC_COPY,
|
||||
R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT,
|
||||
R_SPARC_RELATIVE,
|
||||
R_SPARC_UA32,
|
||||
R_SPARC_max
|
||||
};
|
||||
|
||||
#if 0
|
||||
static CONST char *CONST reloc_type_names[] =
|
||||
{
|
||||
"R_SPARC_NONE",
|
||||
"R_SPARC_8", "R_SPARC_16", "R_SPARC_32",
|
||||
"R_SPARC_DISP8", "R_SPARC_DISP16", "R_SPARC_DISP32",
|
||||
"R_SPARC_WDISP30", "R_SPARC_WDISP22",
|
||||
"R_SPARC_HI22", "R_SPARC_22",
|
||||
"R_SPARC_13", "R_SPARC_LO10",
|
||||
"R_SPARC_GOT10", "R_SPARC_GOT13", "R_SPARC_GOT22",
|
||||
"R_SPARC_PC10", "R_SPARC_PC22",
|
||||
"R_SPARC_WPLT30",
|
||||
"R_SPARC_COPY",
|
||||
"R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT",
|
||||
"R_SPARC_RELATIVE",
|
||||
"R_SPARC_UA32",
|
||||
};
|
||||
#endif
|
||||
|
||||
/* This is stolen pretty directly from elf.c. */
|
||||
static bfd_reloc_status_type
|
||||
bfd_coff_generic_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
|
||||
static bfd_reloc_status_type
|
||||
bfd_coff_generic_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;
|
||||
{
|
||||
if (output_bfd != (bfd *) NULL
|
||||
&& (symbol->flags & BSF_SECTION_SYM) == 0)
|
||||
{
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
static reloc_howto_type coff_sparc_howto_table[] =
|
||||
{
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_8, 0,0, 8,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_8", false,0,0x000000ff,true),
|
||||
HOWTO(R_SPARC_16, 0,1,16,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_16", false,0,0x0000ffff,true),
|
||||
HOWTO(R_SPARC_32, 0,2,32,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_32", false,0,0xffffffff,true),
|
||||
HOWTO(R_SPARC_DISP8, 0,0, 8,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP8", false,0,0x000000ff,true),
|
||||
HOWTO(R_SPARC_DISP16, 0,1,16,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP16", false,0,0x0000ffff,true),
|
||||
HOWTO(R_SPARC_DISP32, 0,2,32,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP32", false,0,0x00ffffff,true),
|
||||
HOWTO(R_SPARC_WDISP30, 2,2,30,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP30", false,0,0x3fffffff,true),
|
||||
HOWTO(R_SPARC_WDISP22, 2,2,22,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_HI22, 10,2,22,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_HI22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_22, 0,2,22,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_13, 0,2,13,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_13", false,0,0x00001fff,true),
|
||||
HOWTO(R_SPARC_LO10, 0,2,10,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_LO10", false,0,0x000003ff,true),
|
||||
HOWTO(R_SPARC_GOT10, 0,2,10,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT10", false,0,0x000003ff,true),
|
||||
HOWTO(R_SPARC_GOT13, 0,2,13,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT13", false,0,0x00001fff,true),
|
||||
HOWTO(R_SPARC_GOT22, 10,2,22,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_PC10, 0,2,10,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC10", false,0,0x000003ff,true),
|
||||
HOWTO(R_SPARC_PC22, 0,2,22,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_WPLT30, 0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_WPLT30", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_COPY, 0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_COPY", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_GLOB_DAT,0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_GLOB_DAT",false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_JMP_SLOT,0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_JMP_SLOT",false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_RELATIVE,0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_RELATIVE",false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_UA32, 0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_UA32", false,0,0x00000000,true),
|
||||
};
|
||||
|
||||
struct coff_reloc_map {
|
||||
bfd_reloc_code_real_type bfd_reloc_val;
|
||||
unsigned char coff_reloc_val;
|
||||
};
|
||||
|
||||
static CONST struct coff_reloc_map sparc_reloc_map[] =
|
||||
{
|
||||
{ BFD_RELOC_NONE, R_SPARC_NONE, },
|
||||
{ BFD_RELOC_16, R_SPARC_16, },
|
||||
{ BFD_RELOC_8, R_SPARC_8 },
|
||||
{ BFD_RELOC_8_PCREL, R_SPARC_DISP8 },
|
||||
{ BFD_RELOC_CTOR, R_SPARC_32 }, /* @@ Assumes 32 bits. */
|
||||
{ BFD_RELOC_32, R_SPARC_32 },
|
||||
{ BFD_RELOC_32_PCREL, R_SPARC_DISP32 },
|
||||
{ BFD_RELOC_HI22, R_SPARC_HI22 },
|
||||
{ BFD_RELOC_LO10, R_SPARC_LO10, },
|
||||
{ BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 },
|
||||
{ BFD_RELOC_SPARC22, R_SPARC_22 },
|
||||
{ BFD_RELOC_SPARC13, R_SPARC_13 },
|
||||
{ BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 },
|
||||
{ BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 },
|
||||
{ BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 },
|
||||
{ BFD_RELOC_SPARC_PC10, R_SPARC_PC10 },
|
||||
{ BFD_RELOC_SPARC_PC22, R_SPARC_PC22 },
|
||||
{ BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 },
|
||||
{ BFD_RELOC_SPARC_COPY, R_SPARC_COPY },
|
||||
{ BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT },
|
||||
{ BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
|
||||
{ BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
|
||||
{ BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
|
||||
/* { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, not used?? */
|
||||
};
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_sparc_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct coff_reloc_map); i++)
|
||||
{
|
||||
if (sparc_reloc_map[i].bfd_reloc_val == code)
|
||||
return &coff_sparc_howto_table[(int) sparc_reloc_map[i].coff_reloc_val];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#define coff_bfd_reloc_type_lookup coff_sparc_reloc_type_lookup
|
||||
|
||||
static void
|
||||
rtype2howto (cache_ptr, dst)
|
||||
arelent *cache_ptr;
|
||||
struct internal_reloc *dst;
|
||||
{
|
||||
BFD_ASSERT (dst->r_type < (unsigned int) R_SPARC_max);
|
||||
cache_ptr->howto = &coff_sparc_howto_table[dst->r_type];
|
||||
}
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
|
||||
|
||||
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
|
||||
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
|
||||
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
|
||||
cache_ptr->addend = reloc.r_offset;
|
||||
|
||||
/* Clear the r_spare field in relocs. */
|
||||
#define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \
|
||||
do { \
|
||||
dst->r_spare[0] = 0; \
|
||||
dst->r_spare[1] = 0; \
|
||||
} while (0)
|
||||
|
||||
#define __A_MAGIC_SET__
|
||||
|
||||
/* Enable Sparc-specific hacks in coffcode.h. */
|
||||
|
||||
#define COFF_SPARC
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
const bfd_target
|
||||
#ifdef TARGET_SYM
|
||||
TARGET_SYM =
|
||||
#else
|
||||
sparccoff_vec =
|
||||
#endif
|
||||
{
|
||||
#ifdef TARGET_NAME
|
||||
TARGET_NAME,
|
||||
#else
|
||||
"coff-sparc", /* name */
|
||||
#endif
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(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 */
|
||||
'_', /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* 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 */
|
||||
|
||||
/* Note that we allow an object file to be treated as a core file as well. */
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, coff_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,
|
||||
};
|
|
@ -0,0 +1,464 @@
|
|||
/* BFD back-end for Intel 386 COFF files (go32 variant with a stub).
|
||||
Copyright 1997, 1998 Free Software Foundation, Inc.
|
||||
Written by Robert Hoehne.
|
||||
|
||||
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 handles now also stubbed coff images. The stub is a small
|
||||
DOS executable program before the coff image to load it in memory
|
||||
and execute it. This is needed, because DOS cannot run coff files.
|
||||
|
||||
All the functions below are called by the corresponding functions
|
||||
from coffswap.h.
|
||||
The only thing what they do is to adjust the information stored in
|
||||
the COFF file which are offset into the file.
|
||||
This is needed, because DJGPP uses a very special way to load and run
|
||||
the coff image. It loads the image in memory and assumes then, that the
|
||||
image had no stub by using the filepointers as pointers in the coff
|
||||
image and NOT in the file.
|
||||
|
||||
To be compatible with any existing executables I have fixed this
|
||||
here and NOT in the DJGPP startup code.
|
||||
*/
|
||||
|
||||
#define TARGET_SYM go32stubbedcoff_vec
|
||||
#define TARGET_NAME "coff-go32-exe"
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
#define COFF_GO32_EXE
|
||||
|
||||
#include "bfd.h"
|
||||
|
||||
/* At first the prototypes */
|
||||
|
||||
static void
|
||||
adjust_filehdr_in_post PARAMS ((bfd * abfd, PTR src, PTR dst));
|
||||
static void
|
||||
adjust_filehdr_out_pre PARAMS ((bfd * abfd, PTR in, PTR out));
|
||||
static void
|
||||
adjust_filehdr_out_post PARAMS ((bfd * abfd, PTR in, PTR out));
|
||||
|
||||
static void
|
||||
adjust_scnhdr_in_post PARAMS ((bfd * abfd, PTR ext, PTR in));
|
||||
static void
|
||||
adjust_scnhdr_out_pre PARAMS ((bfd * abfd, PTR in, PTR out));
|
||||
static void
|
||||
adjust_scnhdr_out_post PARAMS ((bfd * abfd, PTR in, PTR out));
|
||||
|
||||
static void
|
||||
adjust_aux_in_post PARAMS ((bfd * abfd, PTR ext1, int type, int class, int indx,
|
||||
int numaux, PTR in1));
|
||||
static void
|
||||
adjust_aux_out_pre PARAMS ((bfd * abfd, PTR inp, int type, int class, int indx,
|
||||
int numaux, PTR extp));
|
||||
static void
|
||||
adjust_aux_out_post PARAMS ((bfd * abfd, PTR inp, int type, int class, int indx,
|
||||
int numaux, PTR extp));
|
||||
|
||||
static void
|
||||
create_go32_stub PARAMS ((bfd * abfd));
|
||||
|
||||
/*
|
||||
All that ..._PRE and ...POST functions are called from the corresponding
|
||||
coff_swap... functions. The ...PRE functions are called at the beginning
|
||||
of the function and the ...POST functions at the end of the swap routines.
|
||||
*/
|
||||
|
||||
#define COFF_ADJUST_FILEHDR_IN_POST adjust_filehdr_in_post
|
||||
#define COFF_ADJUST_FILEHDR_OUT_PRE adjust_filehdr_out_pre
|
||||
#define COFF_ADJUST_FILEHDR_OUT_POST adjust_filehdr_out_post
|
||||
|
||||
#define COFF_ADJUST_SCNHDR_IN_POST adjust_scnhdr_in_post
|
||||
#define COFF_ADJUST_SCNHDR_OUT_PRE adjust_scnhdr_out_pre
|
||||
#define COFF_ADJUST_SCNHDR_OUT_POST adjust_scnhdr_out_post
|
||||
|
||||
#define COFF_ADJUST_AUX_IN_POST adjust_aux_in_post
|
||||
#define COFF_ADJUST_AUX_OUT_PRE adjust_aux_out_pre
|
||||
#define COFF_ADJUST_AUX_OUT_POST adjust_aux_out_post
|
||||
|
||||
static boolean
|
||||
go32_stubbed_coff_bfd_copy_private_bfd_data PARAMS ((bfd * ibfd, bfd * obfd));
|
||||
|
||||
#define coff_bfd_copy_private_bfd_data go32_stubbed_coff_bfd_copy_private_bfd_data
|
||||
|
||||
#include "coff-i386.c"
|
||||
|
||||
/* I hold in the usrdata the stub */
|
||||
#define bfd_coff_go32stub bfd_usrdata
|
||||
|
||||
/* This macro is used, because I cannot assume the endianess of the
|
||||
host system */
|
||||
#define _H(index) (bfd_h_get_16(abfd, (bfd_byte *)(header+index*2)))
|
||||
|
||||
/* This function checks if the bfd is a stubbed coff image */
|
||||
static const bfd_target *
|
||||
go32_stubbed_coff_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
unsigned char header[10];
|
||||
char magic[8];
|
||||
unsigned long coff_start, exe_start;
|
||||
|
||||
if (bfd_read (&header, 1, sizeof (header), abfd) != sizeof (header))
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
if (_H (0) != 0x5a4d) /* it is not an exe file. maybe a coff-image */
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
coff_start = (long) _H (2) * 512L;
|
||||
if (_H (1))
|
||||
coff_start += (long) _H (1) - 512L;
|
||||
|
||||
/* We can handle only a stub with a length of STUBSIZE */
|
||||
if (coff_start != STUBSIZE)
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
exe_start = _H (4) * 16;
|
||||
if (bfd_seek (abfd, exe_start, SEEK_SET) != 0)
|
||||
return 0;
|
||||
if (bfd_read (&magic, 1, 8, abfd) != 8)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
if (memcmp (magic, "go32stub", 8) != 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
|
||||
return 0;
|
||||
|
||||
/* Call the normal COFF detection routine */
|
||||
return coff_object_p (abfd);
|
||||
}
|
||||
|
||||
/* These bytes are a 2048-byte DOS executable, which loads the COFF
|
||||
image into memory and then runs it. It is called 'stub' */
|
||||
|
||||
static unsigned char stub_bytes[STUBSIZE] =
|
||||
{
|
||||
#include "go32stub.h"
|
||||
};
|
||||
|
||||
/*
|
||||
I have not commented each swap function below, because the
|
||||
technique is in any function the same. For the ...in function,
|
||||
all the pointers are adjusted by adding STUBSIZE and for the
|
||||
...out function, it is subtracted first and after calling the
|
||||
standard swap function it is reset to the old value */
|
||||
|
||||
/* This macro is used for adjusting the filepointers, which
|
||||
is done only, if the pointer is nonzero */
|
||||
|
||||
#define ADJUST_VAL(val,diff) \
|
||||
if (val != 0) val += diff
|
||||
|
||||
static void
|
||||
adjust_filehdr_in_post (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
PTR src;
|
||||
PTR dst;
|
||||
{
|
||||
FILHDR *filehdr_src = (FILHDR *) src;
|
||||
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
|
||||
|
||||
ADJUST_VAL (filehdr_dst->f_symptr, STUBSIZE);
|
||||
|
||||
/* Save now the stub to be used later */
|
||||
bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, STUBSIZE);
|
||||
|
||||
/* Since this function returns no status, I do not set here
|
||||
any bfd_error_...
|
||||
That means, before the use of bfd_coff_go32stub (), this value
|
||||
should be checked if it is != NULL */
|
||||
if (bfd_coff_go32stub (abfd) == NULL)
|
||||
return;
|
||||
memcpy (bfd_coff_go32stub (abfd), filehdr_src->stub, STUBSIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_filehdr_out_pre (abfd, in, out)
|
||||
bfd *abfd;
|
||||
PTR in;
|
||||
PTR out;
|
||||
{
|
||||
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
|
||||
FILHDR *filehdr_out = (FILHDR *) out;
|
||||
|
||||
/* Generate the stub */
|
||||
create_go32_stub (abfd);
|
||||
|
||||
/* Copy the stub to the file header */
|
||||
if (bfd_coff_go32stub (abfd) != NULL)
|
||||
memcpy (filehdr_out->stub, bfd_coff_go32stub (abfd), STUBSIZE);
|
||||
else
|
||||
/* use the default */
|
||||
memcpy (filehdr_out->stub, stub_bytes, STUBSIZE);
|
||||
|
||||
ADJUST_VAL (filehdr_in->f_symptr, -STUBSIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_filehdr_out_post (abfd, in, out)
|
||||
bfd *abfd;
|
||||
PTR in;
|
||||
PTR out;
|
||||
{
|
||||
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
|
||||
/* undo the above change */
|
||||
ADJUST_VAL (filehdr_in->f_symptr, STUBSIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_scnhdr_in_post (abfd, ext, in)
|
||||
bfd *abfd;
|
||||
PTR ext;
|
||||
PTR in;
|
||||
{
|
||||
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
|
||||
|
||||
ADJUST_VAL (scnhdr_int->s_scnptr, STUBSIZE);
|
||||
ADJUST_VAL (scnhdr_int->s_relptr, STUBSIZE);
|
||||
ADJUST_VAL (scnhdr_int->s_lnnoptr, STUBSIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_scnhdr_out_pre (abfd, in, out)
|
||||
bfd *abfd;
|
||||
PTR in;
|
||||
PTR out;
|
||||
{
|
||||
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
|
||||
|
||||
ADJUST_VAL (scnhdr_int->s_scnptr, -STUBSIZE);
|
||||
ADJUST_VAL (scnhdr_int->s_relptr, -STUBSIZE);
|
||||
ADJUST_VAL (scnhdr_int->s_lnnoptr, -STUBSIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_scnhdr_out_post (abfd, in, out)
|
||||
bfd *abfd;
|
||||
PTR in;
|
||||
PTR out;
|
||||
{
|
||||
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
|
||||
|
||||
ADJUST_VAL (scnhdr_int->s_scnptr, STUBSIZE);
|
||||
ADJUST_VAL (scnhdr_int->s_relptr, STUBSIZE);
|
||||
ADJUST_VAL (scnhdr_int->s_lnnoptr, STUBSIZE);
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_aux_in_post (abfd, ext1, type, class, indx, numaux, in1)
|
||||
bfd *abfd;
|
||||
PTR ext1;
|
||||
int type;
|
||||
int class;
|
||||
int indx;
|
||||
int numaux;
|
||||
PTR in1;
|
||||
{
|
||||
union internal_auxent *in = (union internal_auxent *) in1;
|
||||
|
||||
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
|
||||
{
|
||||
ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, STUBSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_aux_out_pre (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;
|
||||
|
||||
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
|
||||
{
|
||||
ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, -STUBSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
adjust_aux_out_post (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;
|
||||
|
||||
if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
|
||||
{
|
||||
ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, STUBSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
That's the function, which creates the stub. There are
|
||||
different cases from where the stub is taken.
|
||||
At first the environment variable $(GO32STUB) is checked and then
|
||||
$(STUB) if it was not set.
|
||||
If it exists and points to a valid stub the stub is taken from
|
||||
that file. This file can be also a whole executable file, because
|
||||
the stub is computed from the exe information at the start of that
|
||||
file.
|
||||
|
||||
If there was any error, the standard stub (compiled in this file)
|
||||
is taken.
|
||||
*/
|
||||
|
||||
static void
|
||||
create_go32_stub (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
/* Do it only once */
|
||||
if (bfd_coff_go32stub (abfd) == NULL)
|
||||
{
|
||||
char *stub;
|
||||
struct stat st;
|
||||
int f;
|
||||
unsigned char header[10];
|
||||
char magic[8];
|
||||
unsigned long coff_start, exe_start;
|
||||
|
||||
/* Check at first the environment variable $(GO32STUB) */
|
||||
stub = getenv ("GO32STUB");
|
||||
/* Now check the environment variable $(STUB) */
|
||||
if (stub == NULL)
|
||||
stub = getenv ("STUB");
|
||||
if (stub == NULL)
|
||||
goto stub_end;
|
||||
if (stat (stub, &st) != 0)
|
||||
goto stub_end;
|
||||
#ifdef O_BINARY
|
||||
f = open (stub, O_RDONLY | O_BINARY);
|
||||
#else
|
||||
f = open (stub, O_RDONLY);
|
||||
#endif
|
||||
if (f < 0)
|
||||
goto stub_end;
|
||||
if (read (f, &header, sizeof (header)) < 0)
|
||||
{
|
||||
close (f);
|
||||
goto stub_end;
|
||||
}
|
||||
if (_H (0) != 0x5a4d) /* it is not an exe file */
|
||||
{
|
||||
close (f);
|
||||
goto stub_end;
|
||||
}
|
||||
/* Compute the size of the stub (it is every thing up
|
||||
to the beginning of the coff image) */
|
||||
coff_start = (long) _H (2) * 512L;
|
||||
if (_H (1))
|
||||
coff_start += (long) _H (1) - 512L;
|
||||
|
||||
/* Currently there is only a fixed stub size of 2048 bytes
|
||||
supported */
|
||||
if (coff_start != 2048)
|
||||
{
|
||||
close (f);
|
||||
goto stub_end;
|
||||
}
|
||||
exe_start = _H (4) * 16;
|
||||
if ((unsigned long) lseek (f, exe_start, SEEK_SET) != exe_start)
|
||||
{
|
||||
close (f);
|
||||
goto stub_end;
|
||||
}
|
||||
if (read (f, &magic, 8) != 8)
|
||||
{
|
||||
close (f);
|
||||
goto stub_end;
|
||||
}
|
||||
if (memcmp (magic, "go32stub", 8) != 0)
|
||||
{
|
||||
close (f);
|
||||
goto stub_end;
|
||||
}
|
||||
/* Now we found a correct stub (hopefully) */
|
||||
bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, coff_start);
|
||||
if (bfd_coff_go32stub (abfd) == NULL)
|
||||
{
|
||||
close (f);
|
||||
return;
|
||||
}
|
||||
lseek (f, 0L, SEEK_SET);
|
||||
if ((unsigned long) read (f, bfd_coff_go32stub (abfd), coff_start)
|
||||
!= coff_start)
|
||||
{
|
||||
bfd_release (abfd, bfd_coff_go32stub (abfd));
|
||||
bfd_coff_go32stub (abfd) = NULL;
|
||||
}
|
||||
close (f);
|
||||
}
|
||||
stub_end:
|
||||
/* There was something wrong above, so use now the standard builtin
|
||||
stub */
|
||||
if (bfd_coff_go32stub (abfd) == NULL)
|
||||
{
|
||||
bfd_coff_go32stub (abfd) = (PTR) bfd_alloc (abfd, STUBSIZE);
|
||||
if (bfd_coff_go32stub (abfd) == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy (bfd_coff_go32stub (abfd), stub_bytes, STUBSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/* If ibfd was a stubbed coff image, copy the stub from that bfd
|
||||
to the new obfd.
|
||||
*/
|
||||
|
||||
static boolean
|
||||
go32_stubbed_coff_bfd_copy_private_bfd_data (ibfd, obfd)
|
||||
bfd *ibfd;
|
||||
bfd *obfd;
|
||||
{
|
||||
/* check if both are the same targets */
|
||||
if (ibfd->xvec != obfd->xvec)
|
||||
return true;
|
||||
|
||||
/* check if both have a valid stub */
|
||||
if (bfd_coff_go32stub (ibfd) == NULL
|
||||
|| bfd_coff_go32stub (obfd) == NULL)
|
||||
return true;
|
||||
|
||||
/* Now copy the stub */
|
||||
memcpy (bfd_coff_go32stub (obfd), bfd_coff_go32stub (ibfd), STUBSIZE);
|
||||
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/* BFD back-end for Motorola sysv68
|
||||
Copyright 1997 Free Software Foundation, Inc.
|
||||
Written by Philippe De Muyter <phdm@info.ucl.ac.be>.
|
||||
|
||||
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 TARGET_SYM m68ksysvcoff_vec
|
||||
#define TARGET_NAME "coff-m68k-sysv"
|
||||
#define STATIC_RELOCS
|
||||
#define COFF_COMMON_ADDEND
|
||||
|
||||
#include "coff-m68k.c"
|
|
@ -0,0 +1,206 @@
|
|||
/* BFD back-end for TMS320C30 coff binaries.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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 "bfdlink.h"
|
||||
#include "coff/tic30.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
|
||||
|
||||
reloc_howto_type tic30_coff_howto_table[] =
|
||||
{
|
||||
HOWTO (R_TIC30_ABS16, 2, 1, 16, false, 0, 0, NULL,
|
||||
"16", false, 0x0000FFFF, 0x0000FFFF, false),
|
||||
HOWTO (R_TIC30_ABS24, 2, 2, 24, false, 8, complain_overflow_bitfield, NULL,
|
||||
"24", false, 0xFFFFFF00, 0xFFFFFF00, false),
|
||||
HOWTO (R_TIC30_LDP, 18, 0, 24, false, 0, complain_overflow_bitfield, NULL,
|
||||
"LDP", false, 0x00FF0000, 0x000000FF, false),
|
||||
HOWTO (R_TIC30_ABS32, 2, 2, 32, false, 0, complain_overflow_bitfield, NULL,
|
||||
"32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
|
||||
HOWTO (R_TIC30_PC16, 2, 1, 16, true, 0, complain_overflow_signed, NULL,
|
||||
"PCREL", false, 0x0000FFFF, 0x0000FFFF, false),
|
||||
{-1}
|
||||
};
|
||||
|
||||
#ifndef coff_bfd_reloc_type_lookup
|
||||
#define coff_bfd_reloc_type_lookup tic30_coff_reloc_type_lookup
|
||||
|
||||
/* For the case statement use the code values used in tc_gen_reloc to
|
||||
map to the howto table entries that match those in both the aout
|
||||
and coff implementations. */
|
||||
reloc_howto_type *
|
||||
tic30_coff_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case BFD_RELOC_8:
|
||||
case BFD_RELOC_TIC30_LDP:
|
||||
return &tic30_coff_howto_table[2];
|
||||
case BFD_RELOC_16:
|
||||
return &tic30_coff_howto_table[0];
|
||||
case BFD_RELOC_24:
|
||||
return &tic30_coff_howto_table[1];
|
||||
case BFD_RELOC_16_PCREL:
|
||||
return &tic30_coff_howto_table[4];
|
||||
case BFD_RELOC_32:
|
||||
return &tic30_coff_howto_table[3];
|
||||
default:
|
||||
return (reloc_howto_type *) NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Turn a howto into a reloc number */
|
||||
|
||||
static int
|
||||
coff_tic30_select_reloc (howto)
|
||||
reloc_howto_type *howto;
|
||||
{
|
||||
return howto->type;
|
||||
}
|
||||
|
||||
#define SELECT_RELOC(x,howto) x.r_type = coff_tic30_select_reloc(howto)
|
||||
|
||||
|
||||
#define BADMAG(x) TIC30BADMAG(x)
|
||||
#define TIC30 1 /* Customize coffcode.h */
|
||||
#define __A_MAGIC_SET__
|
||||
|
||||
/* Code to swap in the reloc */
|
||||
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
|
||||
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
|
||||
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) dst->r_stuff[0] = 'S'; \
|
||||
dst->r_stuff[1] = 'C';
|
||||
|
||||
/* Code to turn a r_type into a howto ptr, uses the above howto table. */
|
||||
|
||||
static void
|
||||
rtype2howto (internal, dst)
|
||||
arelent *internal;
|
||||
struct internal_reloc *dst;
|
||||
{
|
||||
switch (dst->r_type)
|
||||
{
|
||||
case R_TIC30_ABS16:
|
||||
internal->howto = &tic30_coff_howto_table[0];
|
||||
break;
|
||||
case R_TIC30_ABS24:
|
||||
internal->howto = &tic30_coff_howto_table[1];
|
||||
break;
|
||||
case R_TIC30_ABS32:
|
||||
internal->howto = &tic30_coff_howto_table[3];
|
||||
break;
|
||||
case R_TIC30_LDP:
|
||||
internal->howto = &tic30_coff_howto_table[2];
|
||||
break;
|
||||
case R_TIC30_PC16:
|
||||
internal->howto = &tic30_coff_howto_table[4];
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
|
||||
|
||||
/* Perform any necessary magic to the addend in a reloc entry */
|
||||
|
||||
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
|
||||
cache_ptr->addend = ext_reloc.r_offset;
|
||||
|
||||
|
||||
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
|
||||
reloc_processing(relent, reloc, symbols, abfd, section)
|
||||
|
||||
static void
|
||||
reloc_processing (relent, reloc, symbols, abfd, section)
|
||||
arelent *relent;
|
||||
struct internal_reloc *reloc;
|
||||
asymbol **symbols;
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
{
|
||||
relent->address = reloc->r_vaddr;
|
||||
rtype2howto (relent, reloc);
|
||||
|
||||
if (reloc->r_symndx > 0)
|
||||
{
|
||||
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
|
||||
}
|
||||
else
|
||||
{
|
||||
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||
}
|
||||
relent->addend = reloc->r_offset;
|
||||
relent->address -= section->vma;
|
||||
}
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
const bfd_target tic30_coff_vec =
|
||||
{
|
||||
"coff-tic30", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_LITTLE, /* header byte order is little */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading symbol underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* 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_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{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
|
||||
};
|
|
@ -0,0 +1,759 @@
|
|||
/* BFD back-end for Texas Instruments TMS320C80 Multimedia Video Processor (MVP).
|
||||
Copyright 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by Fred Fish (fnf@cygnus.com)
|
||||
|
||||
There is nothing new under the sun. This file draws a lot on other
|
||||
coff files.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 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, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bfdlink.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/tic80.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
||||
#define COFF_ALIGN_IN_SECTION_HEADER 1
|
||||
#define COFF_ALIGN_IN_SFLAGS 1
|
||||
|
||||
#define GET_SCNHDR_FLAGS bfd_h_get_16
|
||||
#define PUT_SCNHDR_FLAGS bfd_h_put_16
|
||||
|
||||
static void rtype2howto
|
||||
PARAMS ((arelent *cache_ptr, struct internal_reloc *dst));
|
||||
static bfd_reloc_status_type ppbase_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static bfd_reloc_status_type glob15_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static bfd_reloc_status_type glob16_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static bfd_reloc_status_type local16_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static boolean coff_tic80_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
struct internal_reloc *, struct internal_syment *, asection **));
|
||||
|
||||
static reloc_howto_type tic80_howto_table[] =
|
||||
{
|
||||
|
||||
HOWTO (R_RELLONG, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"RELLONG", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_MPPCR, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"MPPCR", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ABS, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"ABS", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPBASE, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
ppbase_reloc, /* special_function */
|
||||
"PPBASE", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPLBASE, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
ppbase_reloc, /* special_function */
|
||||
"PPLBASE", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PP15, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
glob15_reloc, /* special_function */
|
||||
"PP15", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x1ffc0, /* src_mask */
|
||||
0x1ffc0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PP15W, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
glob15_reloc, /* special_function */
|
||||
"PP15W", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x1ffc0, /* src_mask */
|
||||
0x1ffc0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PP15H, /* type */
|
||||
1, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
glob15_reloc, /* special_function */
|
||||
"PP15H", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x1ffc0, /* src_mask */
|
||||
0x1ffc0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PP16B, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
glob16_reloc, /* special_function */
|
||||
"PP16B", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x3ffc0, /* src_mask */
|
||||
0x3ffc0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPL15, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"PPL15", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x7fff, /* src_mask */
|
||||
0x7fff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPL15W, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"PPL15W", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x7fff, /* src_mask */
|
||||
0x7fff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPL15H, /* type */
|
||||
1, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"PPL15H", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x7fff, /* src_mask */
|
||||
0x7fff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPL16B, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
local16_reloc, /* special_function */
|
||||
"PPL16B", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPN15, /* type */
|
||||
0, /* rightshift */
|
||||
-2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
glob15_reloc, /* special_function */
|
||||
"PPN15", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x1ffc0, /* src_mask */
|
||||
0x1ffc0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPN15W, /* type */
|
||||
2, /* rightshift */
|
||||
-2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
glob15_reloc, /* special_function */
|
||||
"PPN15W", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x1ffc0, /* src_mask */
|
||||
0x1ffc0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPN15H, /* type */
|
||||
1, /* rightshift */
|
||||
-2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
glob15_reloc, /* special_function */
|
||||
"PPN15H", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x1ffc0, /* src_mask */
|
||||
0x1ffc0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPN16B, /* type */
|
||||
0, /* rightshift */
|
||||
-2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
6, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
glob16_reloc, /* special_function */
|
||||
"PPN16B", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x3ffc0, /* src_mask */
|
||||
0x3ffc0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPLN15, /* type */
|
||||
0, /* rightshift */
|
||||
-2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"PPLN15", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x7fff, /* src_mask */
|
||||
0x7fff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPLN15W, /* type */
|
||||
2, /* rightshift */
|
||||
-2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"PPLN15W", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x7fff, /* src_mask */
|
||||
0x7fff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPLN15H, /* type */
|
||||
1, /* rightshift */
|
||||
-2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"PPLN15H", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x7fff, /* src_mask */
|
||||
0x7fff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_PPLN16B, /* type */
|
||||
0, /* rightshift */
|
||||
-2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
15, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
local16_reloc, /* special_function */
|
||||
"PPLN16B", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
false) /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Special relocation functions, used when the output file is not
|
||||
itself a COFF TIc80 file. */
|
||||
|
||||
/* This special function is used for the base address type
|
||||
relocations. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
ppbase_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol_in;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
/* FIXME. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* This special function is used for the global 15 bit relocations. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
glob15_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol_in;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
/* FIXME. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* This special function is used for the global 16 bit relocations. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
glob16_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol_in;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
/* FIXME. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* This special function is used for the local 16 bit relocations. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
local16_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol_in;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
/* FIXME. */
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Code to turn an external r_type into a pointer to an entry in the howto_table.
|
||||
If passed an r_type we don't recognize the abort rather than silently failing
|
||||
to generate an output file. */
|
||||
|
||||
static void
|
||||
rtype2howto (cache_ptr, dst)
|
||||
arelent *cache_ptr;
|
||||
struct internal_reloc *dst;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof tic80_howto_table / sizeof tic80_howto_table[0]; i++)
|
||||
{
|
||||
if (tic80_howto_table[i].type == dst->r_type)
|
||||
{
|
||||
cache_ptr->howto = tic80_howto_table + i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
(*_bfd_error_handler) (_("Unrecognized reloc type 0x%x"),
|
||||
(unsigned int) dst->r_type);
|
||||
cache_ptr->howto = tic80_howto_table + 0;
|
||||
}
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst)
|
||||
#define coff_rtype_to_howto coff_tic80_rtype_to_howto
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_tic80_rtype_to_howto (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;
|
||||
{
|
||||
arelent genrel;
|
||||
|
||||
if (rel -> r_symndx == -1 && addendp != NULL)
|
||||
{
|
||||
/* This is a TI "internal relocation", which means that the relocation
|
||||
amount is the amount by which the current section is being relocated
|
||||
in the output section. */
|
||||
*addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma;
|
||||
}
|
||||
RTYPE2HOWTO (&genrel, rel);
|
||||
return genrel.howto;
|
||||
}
|
||||
|
||||
#ifndef BADMAG
|
||||
#define BADMAG(x) TIC80BADMAG(x)
|
||||
#endif
|
||||
|
||||
#define coff_relocate_section coff_tic80_relocate_section
|
||||
|
||||
/* We need a special relocation routine to handle the PP relocs. Most
|
||||
of this is a copy of _bfd_coff_generic_relocate_section. */
|
||||
|
||||
static boolean
|
||||
coff_tic80_relocate_section (output_bfd, info, input_bfd,
|
||||
input_section, contents, relocs, syms,
|
||||
sections)
|
||||
bfd *output_bfd;
|
||||
struct bfd_link_info *info;
|
||||
bfd *input_bfd;
|
||||
asection *input_section;
|
||||
bfd_byte *contents;
|
||||
struct internal_reloc *relocs;
|
||||
struct internal_syment *syms;
|
||||
asection **sections;
|
||||
{
|
||||
struct internal_reloc *rel;
|
||||
struct internal_reloc *relend;
|
||||
|
||||
rel = relocs;
|
||||
relend = rel + input_section->reloc_count;
|
||||
for (; rel < relend; rel++)
|
||||
{
|
||||
long symndx;
|
||||
struct coff_link_hash_entry *h;
|
||||
struct internal_syment *sym;
|
||||
bfd_vma addend;
|
||||
bfd_vma val;
|
||||
reloc_howto_type *howto;
|
||||
bfd_reloc_status_type rstat;
|
||||
bfd_vma addr;
|
||||
|
||||
symndx = rel->r_symndx;
|
||||
|
||||
if (symndx == -1)
|
||||
{
|
||||
h = NULL;
|
||||
sym = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = obj_coff_sym_hashes (input_bfd)[symndx];
|
||||
sym = syms + symndx;
|
||||
}
|
||||
|
||||
/* COFF treats common symbols in one of two ways. Either the
|
||||
size of the symbol is included in the section contents, or it
|
||||
is not. We assume that the size is not included, and force
|
||||
the rtype_to_howto function to adjust the addend as needed. */
|
||||
|
||||
if (sym != NULL && sym->n_scnum != 0)
|
||||
addend = - sym->n_value;
|
||||
else
|
||||
addend = 0;
|
||||
|
||||
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
|
||||
sym, &addend);
|
||||
if (howto == NULL)
|
||||
return false;
|
||||
|
||||
val = 0;
|
||||
|
||||
if (h == NULL)
|
||||
{
|
||||
asection *sec;
|
||||
|
||||
if (symndx == -1)
|
||||
{
|
||||
sec = bfd_abs_section_ptr;
|
||||
val = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sec = sections[symndx];
|
||||
val = (sec->output_section->vma
|
||||
+ sec->output_offset
|
||||
+ sym->n_value);
|
||||
if (! obj_pe (output_bfd))
|
||||
val -= sec->vma;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
{
|
||||
asection *sec;
|
||||
|
||||
sec = h->root.u.def.section;
|
||||
val = (h->root.u.def.value
|
||||
+ sec->output_section->vma
|
||||
+ sec->output_offset);
|
||||
}
|
||||
|
||||
else if (! info->relocateable)
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
addr = rel->r_vaddr - input_section->vma;
|
||||
|
||||
/* FIXME: This code assumes little endian, but the PP can
|
||||
apparently be bi-endian. I don't know if the bi-endianness
|
||||
applies to the instruction set or just to the data. */
|
||||
switch (howto->type)
|
||||
{
|
||||
default:
|
||||
case R_ABS:
|
||||
case R_RELLONGX:
|
||||
case R_PPL15:
|
||||
case R_PPL15W:
|
||||
case R_PPL15H:
|
||||
case R_PPLN15:
|
||||
case R_PPLN15W:
|
||||
case R_PPLN15H:
|
||||
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
|
||||
contents, addr, val, addend);
|
||||
break;
|
||||
|
||||
case R_PP15:
|
||||
case R_PP15W:
|
||||
case R_PP15H:
|
||||
case R_PPN15:
|
||||
case R_PPN15W:
|
||||
case R_PPN15H:
|
||||
/* Offset the address so that we can use 4 byte relocations. */
|
||||
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
|
||||
contents + 2, addr, val, addend);
|
||||
break;
|
||||
|
||||
case R_PP16B:
|
||||
case R_PPN16B:
|
||||
{
|
||||
/* The most significant bit is stored in bit 6. */
|
||||
bfd_byte hold;
|
||||
|
||||
hold = contents[addr + 4];
|
||||
contents[addr + 4] &=~ 0x20;
|
||||
contents[addr + 4] |= (contents[addr] >> 1) & 0x20;
|
||||
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
|
||||
contents + 2, addr,
|
||||
val, addend);
|
||||
contents[addr] &=~ 0x40;
|
||||
contents[addr] |= (contents[addr + 4] << 1) & 0x40;
|
||||
contents[addr + 4] &=~ 0x20;
|
||||
contents[addr + 4] |= hold & 0x20;
|
||||
break;
|
||||
}
|
||||
|
||||
case R_PPL16B:
|
||||
case R_PPLN16B:
|
||||
{
|
||||
/* The most significant bit is stored in bit 28. */
|
||||
bfd_byte hold;
|
||||
|
||||
hold = contents[addr + 1];
|
||||
contents[addr + 1] &=~ 0x80;
|
||||
contents[addr + 1] |= (contents[addr + 3] << 3) & 0x80;
|
||||
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
|
||||
contents, addr,
|
||||
val, addend);
|
||||
contents[addr + 3] &= ~0x10;
|
||||
contents[addr + 3] |= (contents[addr + 1] >> 3) & 0x10;
|
||||
contents[addr + 1] &=~ 0x80;
|
||||
contents[addr + 1] |= hold & 0x80;
|
||||
break;
|
||||
}
|
||||
|
||||
case R_PPBASE:
|
||||
/* Parameter RAM is from 0x1000000 to 0x1000800. */
|
||||
contents[addr] &=~ 0x3;
|
||||
if (val >= 0x1000000 && val < 0x1000800)
|
||||
contents[addr] |= 0x3;
|
||||
else
|
||||
contents[addr] |= 0x2;
|
||||
rstat = bfd_reloc_ok;
|
||||
break;
|
||||
|
||||
case R_PPLBASE:
|
||||
/* Parameter RAM is from 0x1000000 to 0x1000800. */
|
||||
contents[addr + 2] &= ~0xc0;
|
||||
if (val >= 0x1000000 && val < 0x1000800)
|
||||
contents[addr + 2] |= 0xc0;
|
||||
else
|
||||
contents[addr + 2] |= 0x80;
|
||||
rstat = bfd_reloc_ok;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (rstat)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
case bfd_reloc_ok:
|
||||
break;
|
||||
case bfd_reloc_outofrange:
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: bad reloc address 0x%lx in section `%s'"),
|
||||
bfd_get_filename (input_bfd),
|
||||
(unsigned long) rel->r_vaddr,
|
||||
bfd_get_section_name (input_bfd, input_section));
|
||||
return false;
|
||||
case bfd_reloc_overflow:
|
||||
{
|
||||
const char *name;
|
||||
char buf[SYMNMLEN + 1];
|
||||
|
||||
if (symndx == -1)
|
||||
name = "*ABS*";
|
||||
else if (h != NULL)
|
||||
name = h->root.root.string;
|
||||
else
|
||||
{
|
||||
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
|
||||
if (name == NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! ((*info->callbacks->reloc_overflow)
|
||||
(info, name, howto->name, (bfd_vma) 0, input_bfd,
|
||||
input_section, rel->r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#define TIC80COFF 1 /* Customize coffcode.h */
|
||||
#undef C_AUTOARG /* Clashes with TIc80's C_UEXT */
|
||||
#undef C_LASTENT /* Clashes with TIc80's C_STATLAB */
|
||||
#include "coffcode.h"
|
||||
|
||||
const bfd_target
|
||||
tic80coff_vec =
|
||||
{
|
||||
"coff-tic80", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_LITTLE, /* data byte order is little (arch supports both) */
|
||||
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 */
|
||||
'_', /* leading underscore */
|
||||
'/', /* 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 */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{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
|
||||
};
|
|
@ -0,0 +1,35 @@
|
|||
/* BFD back-end for Motorola 68000 COFF binaries having underscore with name.
|
||||
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. */
|
||||
|
||||
#define TARGET_SYM m68kcoffun_vec
|
||||
#define TARGET_NAME "coff-m68k-un"
|
||||
|
||||
#define NAMES_HAVE_UNDERSCORE
|
||||
|
||||
/* define this to not have multiple copy of m68k_rtype2howto
|
||||
in the executable file */
|
||||
#define ONLY_DECLARE_RELOCS
|
||||
|
||||
/* This magic number indicates that the names have underscores.
|
||||
Other 68k magic numbers indicate that the names do not have
|
||||
underscores. */
|
||||
#define BADMAG(x) ((x).f_magic != MC68KBCSMAGIC)
|
||||
|
||||
#include "coff-m68k.c"
|
|
@ -0,0 +1,445 @@
|
|||
/* BFD back-end for WDC 65816 COFF binaries.
|
||||
Copyright 1995, 96, 1997 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 "bfdlink.h"
|
||||
#include "coff/w65.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
HOWTO (R_W65_ABS8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "abs8", true, 0x000000ff, 0x000000ff, false),
|
||||
HOWTO (R_W65_ABS16, 1, 0, 16, false, 0, complain_overflow_bitfield, 0, "abs16", true, 0x0000ffff, 0x0000ffff, false),
|
||||
HOWTO (R_W65_ABS24, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "abs24", true, 0x00ffffff, 0x00ffffff, false),
|
||||
HOWTO (R_W65_ABS8S8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, ">abs8", true, 0x000000ff, 0x000000ff, false),
|
||||
HOWTO (R_W65_ABS8S16, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "^abs8", true, 0x000000ff, 0x000000ff, false),
|
||||
HOWTO (R_W65_ABS16S8, 1, 0, 16, false, 0, complain_overflow_bitfield, 0, ">abs16", true, 0x0000ffff, 0x0000ffff, false),
|
||||
HOWTO (R_W65_ABS16S16,1, 0, 16, false, 0, complain_overflow_bitfield, 0, "^abs16", true, 0x0000ffff, 0x0000ffff, false),
|
||||
HOWTO (R_W65_PCR8, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "pcrel8", true, 0x000000ff, 0x000000ff, true),
|
||||
HOWTO (R_W65_PCR16, 1, 0, 16, false, 0, complain_overflow_bitfield, 0, "pcrel16", true, 0x0000ffff, 0x0000ffff, true),
|
||||
HOWTO (R_W65_DP, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "dp", true, 0x000000ff, 0x000000ff, false),
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* Turn a howto into a reloc number */
|
||||
|
||||
#define SELECT_RELOC(x,howto) \
|
||||
{ x.r_type = select_reloc(howto); }
|
||||
|
||||
#define BADMAG(x) (W65BADMAG(x))
|
||||
#define W65 1 /* Customize coffcode.h */
|
||||
#define __A_MAGIC_SET__
|
||||
|
||||
|
||||
/* Code to swap in the reloc */
|
||||
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
|
||||
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
|
||||
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \
|
||||
dst->r_stuff[0] = 'S'; \
|
||||
dst->r_stuff[1] = 'C';
|
||||
|
||||
|
||||
static int
|
||||
select_reloc (howto)
|
||||
reloc_howto_type *howto;
|
||||
{
|
||||
return howto->type ;
|
||||
}
|
||||
|
||||
/* Code to turn a r_type into a howto ptr, uses the above howto table
|
||||
*/
|
||||
|
||||
static void
|
||||
rtype2howto (internal, dst)
|
||||
arelent *internal;
|
||||
struct internal_reloc *dst;
|
||||
{
|
||||
internal->howto = howto_table + dst->r_type - 1;
|
||||
}
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
|
||||
|
||||
|
||||
/* Perform any necessary magic to the addend in a reloc entry */
|
||||
|
||||
|
||||
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
|
||||
cache_ptr->addend = ext_reloc.r_offset;
|
||||
|
||||
|
||||
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
|
||||
reloc_processing(relent, reloc, symbols, abfd, section)
|
||||
|
||||
static void
|
||||
reloc_processing (relent, reloc, symbols, abfd, section)
|
||||
arelent * relent;
|
||||
struct internal_reloc *reloc;
|
||||
asymbol ** symbols;
|
||||
bfd * abfd;
|
||||
asection * section;
|
||||
{
|
||||
relent->address = reloc->r_vaddr;
|
||||
rtype2howto (relent, reloc);
|
||||
|
||||
if (((int) reloc->r_symndx) > 0)
|
||||
{
|
||||
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
|
||||
}
|
||||
else
|
||||
{
|
||||
relent->sym_ptr_ptr = (asymbol **)&(bfd_abs_symbol);
|
||||
}
|
||||
|
||||
|
||||
|
||||
relent->addend = reloc->r_offset;
|
||||
|
||||
relent->address -= section->vma;
|
||||
/* relent->section = 0;*/
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
h8300_reloc16_estimate(abfd, input_section, reloc, shrink, link_info)
|
||||
bfd *abfd;
|
||||
asection *input_section;
|
||||
arelent *reloc;
|
||||
unsigned int shrink;
|
||||
struct bfd_link_info *link_info;
|
||||
{
|
||||
bfd_vma value;
|
||||
bfd_vma dot;
|
||||
bfd_vma gap;
|
||||
|
||||
/* The address of the thing to be relocated will have moved back by
|
||||
the size of the shrink - but we don't change reloc->address here,
|
||||
since we need it to know where the relocation lives in the source
|
||||
uncooked section */
|
||||
|
||||
/* reloc->address -= shrink; conceptual */
|
||||
|
||||
bfd_vma address = reloc->address - shrink;
|
||||
|
||||
|
||||
switch (reloc->howto->type)
|
||||
{
|
||||
case R_MOV16B2:
|
||||
case R_JMP2:
|
||||
shrink+=2;
|
||||
break;
|
||||
|
||||
/* Thing is a move one byte */
|
||||
case R_MOV16B1:
|
||||
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
|
||||
|
||||
if (value >= 0xff00)
|
||||
{
|
||||
|
||||
/* Change the reloc type from 16bit, possible 8 to 8bit
|
||||
possible 16 */
|
||||
reloc->howto = reloc->howto + 1;
|
||||
/* The place to relc moves back by one */
|
||||
/* This will be two bytes smaller in the long run */
|
||||
shrink +=2 ;
|
||||
bfd_perform_slip(abfd, 2, input_section, address);
|
||||
}
|
||||
|
||||
break;
|
||||
/* This is the 24 bit branch which could become an 8 bitter,
|
||||
the relocation points to the first byte of the insn, not the
|
||||
actual data */
|
||||
|
||||
case R_JMPL1:
|
||||
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
|
||||
|
||||
dot = input_section->output_section->vma +
|
||||
input_section->output_offset + address;
|
||||
|
||||
/* See if the address we're looking at within 127 bytes of where
|
||||
we are, if so then we can use a small branch rather than the
|
||||
jump we were going to */
|
||||
|
||||
gap = value - dot ;
|
||||
|
||||
if (-120 < (long)gap && (long)gap < 120 )
|
||||
{
|
||||
|
||||
/* Change the reloc type from 24bit, possible 8 to 8bit
|
||||
possible 32 */
|
||||
reloc->howto = reloc->howto + 1;
|
||||
/* This will be two bytes smaller in the long run */
|
||||
shrink +=2 ;
|
||||
bfd_perform_slip(abfd, 2, input_section, address);
|
||||
}
|
||||
break;
|
||||
|
||||
case R_JMP1:
|
||||
|
||||
value = bfd_coff_reloc16_get_value(reloc, link_info, input_section);
|
||||
|
||||
dot = input_section->output_section->vma +
|
||||
input_section->output_offset + address;
|
||||
|
||||
/* See if the address we're looking at within 127 bytes of where
|
||||
we are, if so then we can use a small branch rather than the
|
||||
jump we were going to */
|
||||
|
||||
gap = value - (dot - shrink);
|
||||
|
||||
|
||||
if (-120 < (long)gap && (long)gap < 120 )
|
||||
{
|
||||
|
||||
/* Change the reloc type from 16bit, possible 8 to 8bit
|
||||
possible 16 */
|
||||
reloc->howto = reloc->howto + 1;
|
||||
/* The place to relc moves back by one */
|
||||
|
||||
/* This will be two bytes smaller in the long run */
|
||||
shrink +=2 ;
|
||||
bfd_perform_slip(abfd, 2, input_section, address);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return shrink;
|
||||
}
|
||||
|
||||
|
||||
/* First phase of a relaxing link */
|
||||
|
||||
/* Reloc types
|
||||
large small
|
||||
R_MOV16B1 R_MOV16B2 mov.b with 16bit or 8 bit address
|
||||
R_JMP1 R_JMP2 jmp or pcrel branch
|
||||
R_JMPL1 R_JMPL_B8 24jmp or pcrel branch
|
||||
R_MOV24B1 R_MOV24B2 24 or 8 bit reloc for mov.b
|
||||
|
||||
*/
|
||||
|
||||
static void
|
||||
h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
|
||||
dst_ptr)
|
||||
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;
|
||||
{
|
||||
unsigned int src_address = *src_ptr;
|
||||
unsigned int dst_address = *dst_ptr;
|
||||
asection *input_section = link_order->u.indirect.section;
|
||||
|
||||
switch (reloc->howto->type)
|
||||
{
|
||||
case R_W65_ABS8:
|
||||
case R_W65_DP:
|
||||
{
|
||||
unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
bfd_put_8 (abfd, gap, data + dst_address);
|
||||
dst_address += 1;
|
||||
src_address += 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_W65_ABS8S8:
|
||||
{
|
||||
unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
gap >>= 8;
|
||||
bfd_put_8 (abfd, gap, data + dst_address);
|
||||
dst_address += 1;
|
||||
src_address += 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_W65_ABS8S16:
|
||||
{
|
||||
unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
gap >>=16;
|
||||
bfd_put_8 (abfd, gap, data + dst_address);
|
||||
dst_address += 1;
|
||||
src_address += 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_W65_ABS16:
|
||||
{
|
||||
unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
|
||||
bfd_put_16 (abfd, gap, data + dst_address);
|
||||
dst_address += 2;
|
||||
src_address += 2;
|
||||
}
|
||||
break;
|
||||
case R_W65_ABS16S8:
|
||||
{
|
||||
unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
gap >>= 8;
|
||||
bfd_put_16 (abfd, gap, data + dst_address);
|
||||
dst_address += 2;
|
||||
src_address += 2;
|
||||
}
|
||||
break;
|
||||
case R_W65_ABS16S16:
|
||||
{
|
||||
unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
gap >>= 16;
|
||||
bfd_put_16 (abfd, gap, data + dst_address);
|
||||
dst_address += 2;
|
||||
src_address += 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_W65_ABS24:
|
||||
{
|
||||
unsigned int gap = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
bfd_put_16 (abfd, gap, data + dst_address);
|
||||
bfd_put_8 (abfd, gap>>16, data+dst_address+2);
|
||||
dst_address += 3;
|
||||
src_address += 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_W65_PCR8:
|
||||
{
|
||||
int gap = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
bfd_vma dot = link_order->offset
|
||||
+ dst_address
|
||||
+ link_order->u.indirect.section->output_section->vma;
|
||||
|
||||
gap -= dot + 1;
|
||||
if (gap < -128 || gap > 127) {
|
||||
if (! ((*link_info->callbacks->reloc_overflow)
|
||||
(link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
|
||||
reloc->howto->name, reloc->addend, input_section->owner,
|
||||
input_section, reloc->address)))
|
||||
abort();
|
||||
}
|
||||
bfd_put_8 (abfd, gap, data + dst_address);
|
||||
dst_address += 1;
|
||||
src_address += 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_W65_PCR16:
|
||||
{
|
||||
bfd_vma gap = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
bfd_vma dot = link_order->offset
|
||||
+ dst_address
|
||||
+ link_order->u.indirect.section->output_section->vma;
|
||||
|
||||
|
||||
/* This wraps within the page, so ignore the relativeness, look at the
|
||||
high part */
|
||||
if ((gap & 0xf0000) != (dot & 0xf0000)) {
|
||||
if (! ((*link_info->callbacks->reloc_overflow)
|
||||
(link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
|
||||
reloc->howto->name, reloc->addend, input_section->owner,
|
||||
input_section, reloc->address)))
|
||||
abort();
|
||||
}
|
||||
|
||||
gap -= dot + 2;
|
||||
bfd_put_16 (abfd, gap, data + dst_address);
|
||||
dst_address += 2;
|
||||
src_address += 2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf(_("ignoring reloc %s\n"), reloc->howto->name);
|
||||
break;
|
||||
|
||||
}
|
||||
*src_ptr = src_address;
|
||||
*dst_ptr = dst_address;
|
||||
|
||||
}
|
||||
|
||||
#define coff_reloc16_extra_cases h8300_reloc16_extra_cases
|
||||
#define coff_reloc16_estimate h8300_reloc16_estimate
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
|
||||
#undef coff_bfd_get_relocated_section_contents
|
||||
#undef coff_bfd_relax_section
|
||||
#define coff_bfd_get_relocated_section_contents \
|
||||
bfd_coff_reloc16_get_relocated_section_contents
|
||||
#define coff_bfd_relax_section bfd_coff_reloc16_relax_section
|
||||
|
||||
|
||||
|
||||
bfd_target w65_vec =
|
||||
{
|
||||
"coff-w65", /* name */
|
||||
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 | BFD_IS_RELAXABLE ),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading char */
|
||||
'/', /* 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 */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{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,
|
||||
};
|
|
@ -0,0 +1,109 @@
|
|||
/* BFD back-end for we32k COFF files.
|
||||
Copyright (C) 1992, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
Contributed by Brendan Kehoe (brendan@cs.widener.edu).
|
||||
|
||||
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 "coff/we32k.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
{0},
|
||||
{1},
|
||||
{2},
|
||||
{3},
|
||||
{4},
|
||||
{5},
|
||||
HOWTO(R_DIR32, 0, 2, 32, false, 0,complain_overflow_bitfield, 0, "dir32", true, 0xffffffff,0xffffffff, false),
|
||||
{7},
|
||||
{010},
|
||||
{011},
|
||||
{012},
|
||||
{013},
|
||||
{014},
|
||||
{015},
|
||||
{016},
|
||||
HOWTO(R_RELBYTE, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO(R_RELWORD, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO(R_RELLONG, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "32", true, 0xffffffff,0xffffffff, false),
|
||||
HOWTO(R_PCRBYTE, 0, 0, 8, true, 0, complain_overflow_signed, 0, "DISP8", true, 0x000000ff,0x000000ff, false),
|
||||
HOWTO(R_PCRWORD, 0, 1, 16, true, 0, complain_overflow_signed, 0, "DISP16", true, 0x0000ffff,0x0000ffff, false),
|
||||
HOWTO(R_PCRLONG, 0, 2, 32, true, 0, complain_overflow_signed, 0, "DISP32", true, 0xffffffff,0xffffffff, false),
|
||||
};
|
||||
|
||||
/* Turn a howto into a reloc nunmber */
|
||||
|
||||
#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
|
||||
#define BADMAG(x) WE32KBADMAG(x)
|
||||
#define WE32K 1
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
(cache_ptr)->howto = howto_table + (dst)->r_type;
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
#define coff_write_armap bsd_write_armap
|
||||
|
||||
const bfd_target we32kcoff_vec =
|
||||
{
|
||||
"coff-we32k", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
0, /* leading underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* 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_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{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,
|
||||
};
|
|
@ -0,0 +1,280 @@
|
|||
/* BFD back-end for Zilog Z800n COFF binaries.
|
||||
Copyright 1992, 93, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
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 "bfdlink.h"
|
||||
#include "coff/z8k.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
|
||||
|
||||
static reloc_howto_type r_imm32 =
|
||||
HOWTO (R_IMM32, 0, 1, 32, false, 0,
|
||||
complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff,
|
||||
0xffffffff, false);
|
||||
|
||||
static reloc_howto_type r_imm4l =
|
||||
HOWTO (R_IMM4L, 0, 1, 4, false, 0,
|
||||
complain_overflow_bitfield, 0, "r_imm4l", true, 0xf, 0xf, false);
|
||||
|
||||
static reloc_howto_type r_da =
|
||||
HOWTO (R_IMM16, 0, 1, 16, false, 0,
|
||||
complain_overflow_bitfield, 0, "r_da", true, 0x0000ffff, 0x0000ffff,
|
||||
false);
|
||||
|
||||
static reloc_howto_type r_imm8 =
|
||||
HOWTO (R_IMM8, 0, 1, 8, false, 0,
|
||||
complain_overflow_bitfield, 0, "r_imm8", true, 0x000000ff, 0x000000ff,
|
||||
false);
|
||||
|
||||
static reloc_howto_type r_jr =
|
||||
HOWTO (R_JR, 0, 1, 8, true, 0, complain_overflow_signed, 0,
|
||||
"r_jr", true, 0, 0, true);
|
||||
|
||||
/* Turn a howto into a reloc number */
|
||||
|
||||
static int
|
||||
coff_z8k_select_reloc (howto)
|
||||
reloc_howto_type *howto;
|
||||
{
|
||||
return howto->type;
|
||||
}
|
||||
|
||||
#define SELECT_RELOC(x,howto) x.r_type = coff_z8k_select_reloc(howto)
|
||||
|
||||
|
||||
#define BADMAG(x) Z8KBADMAG(x)
|
||||
#define Z8K 1 /* Customize coffcode.h */
|
||||
#define __A_MAGIC_SET__
|
||||
|
||||
|
||||
|
||||
/* Code to swap in the reloc */
|
||||
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
|
||||
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
|
||||
#define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \
|
||||
dst->r_stuff[0] = 'S'; \
|
||||
dst->r_stuff[1] = 'C';
|
||||
|
||||
/* Code to turn a r_type into a howto ptr, uses the above howto table
|
||||
*/
|
||||
|
||||
static void
|
||||
rtype2howto (internal, dst)
|
||||
arelent * internal;
|
||||
struct internal_reloc *dst;
|
||||
{
|
||||
switch (dst->r_type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
break;
|
||||
case R_IMM8:
|
||||
internal->howto = &r_imm8;
|
||||
break;
|
||||
case R_IMM16:
|
||||
internal->howto = &r_da;
|
||||
break;
|
||||
case R_JR:
|
||||
internal->howto = &r_jr;
|
||||
break;
|
||||
case R_IMM32:
|
||||
internal->howto = &r_imm32;
|
||||
break;
|
||||
case R_IMM4L:
|
||||
internal->howto = &r_imm4l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
|
||||
|
||||
|
||||
/* Perform any necessary magic to the addend in a reloc entry */
|
||||
|
||||
|
||||
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
|
||||
cache_ptr->addend = ext_reloc.r_offset;
|
||||
|
||||
|
||||
#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
|
||||
reloc_processing(relent, reloc, symbols, abfd, section)
|
||||
|
||||
static void
|
||||
reloc_processing (relent, reloc, symbols, abfd, section)
|
||||
arelent * relent;
|
||||
struct internal_reloc *reloc;
|
||||
asymbol ** symbols;
|
||||
bfd * abfd;
|
||||
asection * section;
|
||||
{
|
||||
relent->address = reloc->r_vaddr;
|
||||
rtype2howto (relent, reloc);
|
||||
|
||||
if (reloc->r_symndx > 0)
|
||||
{
|
||||
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
|
||||
}
|
||||
else
|
||||
{
|
||||
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||
}
|
||||
|
||||
|
||||
relent->addend = reloc->r_offset;
|
||||
relent->address -= section->vma;
|
||||
}
|
||||
|
||||
static void
|
||||
extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
|
||||
bfd *in_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;
|
||||
{
|
||||
asection *input_section = link_order->u.indirect.section;
|
||||
|
||||
switch (reloc->howto->type)
|
||||
{
|
||||
case R_IMM8:
|
||||
bfd_put_8 (in_abfd,
|
||||
bfd_coff_reloc16_get_value (reloc, link_info, input_section),
|
||||
data + *dst_ptr);
|
||||
(*dst_ptr) += 1;
|
||||
(*src_ptr) += 1;
|
||||
break;
|
||||
|
||||
case R_IMM32:
|
||||
bfd_put_32 (in_abfd,
|
||||
bfd_coff_reloc16_get_value (reloc, link_info, input_section),
|
||||
data + *dst_ptr);
|
||||
(*dst_ptr) += 4;
|
||||
(*src_ptr) += 4;
|
||||
break;
|
||||
|
||||
case R_IMM4L:
|
||||
bfd_put_8 (in_abfd,
|
||||
((bfd_get_8 (in_abfd, data + *dst_ptr) & 0xf0)
|
||||
| (0x0f
|
||||
& bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section))),
|
||||
data + *dst_ptr);
|
||||
(*dst_ptr) += 1;
|
||||
(*src_ptr) += 1;
|
||||
break;
|
||||
|
||||
case R_IMM16:
|
||||
bfd_put_16 (in_abfd,
|
||||
bfd_coff_reloc16_get_value (reloc, link_info, input_section),
|
||||
data + *dst_ptr);
|
||||
(*dst_ptr) += 2;
|
||||
(*src_ptr) += 2;
|
||||
break;
|
||||
|
||||
case R_JR:
|
||||
{
|
||||
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
|
||||
input_section);
|
||||
bfd_vma dot = (link_order->offset
|
||||
+ *dst_ptr
|
||||
+ input_section->output_section->vma);
|
||||
int gap = dst - dot - 1;/* -1 since were in the odd byte of the
|
||||
word and the pc's been incremented */
|
||||
|
||||
if (gap & 1)
|
||||
abort ();
|
||||
gap /= 2;
|
||||
if (gap > 128 || gap < -128)
|
||||
{
|
||||
if (! ((*link_info->callbacks->reloc_overflow)
|
||||
(link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
|
||||
reloc->howto->name, reloc->addend, input_section->owner,
|
||||
input_section, reloc->address)))
|
||||
abort ();
|
||||
}
|
||||
bfd_put_8 (in_abfd, gap, data + *dst_ptr);
|
||||
(*dst_ptr)++;
|
||||
(*src_ptr)++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
#define coff_reloc16_extra_cases extra_case
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
|
||||
#undef coff_bfd_get_relocated_section_contents
|
||||
#undef coff_bfd_relax_section
|
||||
#define coff_bfd_get_relocated_section_contents \
|
||||
bfd_coff_reloc16_get_relocated_section_contents
|
||||
#define coff_bfd_relax_section bfd_coff_reloc16_relax_section
|
||||
|
||||
const bfd_target z8kcoff_vec =
|
||||
{
|
||||
"coff-z8k", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
'_', /* leading symbol underscore */
|
||||
'/', /* ar_pad_char */
|
||||
15, /* 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_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, _bfd_dummy_target},
|
||||
{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
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,908 @@
|
|||
/* Generic COFF swapping routines, for BFD.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 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 GET_SCNHDR_NRELOC
|
||||
#define GET_SCNHDR_NRELOC bfd_h_get_16
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_NRELOC
|
||||
#define PUT_SCNHDR_NRELOC bfd_h_put_16
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_NLNNO
|
||||
#define GET_SCNHDR_NLNNO bfd_h_get_16
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_NLNNO
|
||||
#define PUT_SCNHDR_NLNNO bfd_h_put_16
|
||||
#endif
|
||||
#ifndef GET_SCNHDR_FLAGS
|
||||
#define GET_SCNHDR_FLAGS bfd_h_get_32
|
||||
#endif
|
||||
#ifndef PUT_SCNHDR_FLAGS
|
||||
#define PUT_SCNHDR_FLAGS bfd_h_put_32
|
||||
#endif
|
||||
|
||||
|
||||
static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR));
|
||||
static unsigned int coff_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
|
||||
static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR));
|
||||
static unsigned int coff_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
|
||||
static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR));
|
||||
static unsigned int coff_swap_filehdr_out PARAMS ((bfd *, PTR, PTR));
|
||||
#ifndef NO_COFF_RELOCS
|
||||
static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR));
|
||||
static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR));
|
||||
#endif /* NO_COFF_RELOCS */
|
||||
#ifndef NO_COFF_SYMBOLS
|
||||
static void coff_swap_sym_in PARAMS ((bfd *, PTR, PTR));
|
||||
static unsigned int coff_swap_sym_out PARAMS ((bfd *, PTR, PTR));
|
||||
static void coff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
||||
static unsigned int coff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR));
|
||||
#endif /* NO_COFF_SYMBOLS */
|
||||
#ifndef NO_COFF_LINENOS
|
||||
static void coff_swap_lineno_in PARAMS ((bfd *, PTR, PTR));
|
||||
static unsigned int coff_swap_lineno_out PARAMS ((bfd *, PTR, PTR));
|
||||
#endif /* NO_COFF_LINENOS */
|
||||
|
||||
#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 RELSZ;
|
||||
}
|
||||
|
||||
#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;
|
||||
#ifdef COFF_ADJUST_FILEHDR_IN_PRE
|
||||
COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst);
|
||||
#endif
|
||||
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);
|
||||
#ifdef TIC80_TARGET_ID
|
||||
filehdr_dst->f_target_id = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_target_id);
|
||||
#endif
|
||||
|
||||
#ifdef COFF_ADJUST_FILEHDR_IN_POST
|
||||
COFF_ADJUST_FILEHDR_IN_POST (abfd, src, dst);
|
||||
#endif
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
#ifdef COFF_ADJUST_FILEHDR_OUT_PRE
|
||||
COFF_ADJUST_FILEHDR_OUT_PRE (abfd, in, out);
|
||||
#endif
|
||||
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);
|
||||
#ifdef TIC80_TARGET_ID
|
||||
bfd_h_put_16(abfd, filehdr_in->f_target_id, (bfd_byte *) filehdr_out->f_target_id);
|
||||
#endif
|
||||
|
||||
#ifdef COFF_ADJUST_FILEHDR_OUT_POST
|
||||
COFF_ADJUST_FILEHDR_OUT_POST (abfd, in, out);
|
||||
#endif
|
||||
return FILHSZ;
|
||||
}
|
||||
|
||||
|
||||
#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 SYMESZ;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
#ifdef COFF_ADJUST_AUX_IN_PRE
|
||||
COFF_ADJUST_AUX_IN_PRE (abfd, ext1, type, class, indx, numaux, in1);
|
||||
#endif
|
||||
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
|
||||
}
|
||||
goto end;
|
||||
|
||||
/* 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);
|
||||
goto end;
|
||||
}
|
||||
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);
|
||||
|
||||
/* PE defines some extra fields; we zero them out for
|
||||
safety. */
|
||||
in->x_scn.x_checksum = 0;
|
||||
in->x_scn.x_associated = 0;
|
||||
in->x_scn.x_comdat = 0;
|
||||
|
||||
goto end;
|
||||
}
|
||||
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 || class == C_FCN || 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);
|
||||
}
|
||||
|
||||
end: ;
|
||||
/* the semicolon is because MSVC doesn't like labels at
|
||||
end of block. */
|
||||
|
||||
#ifdef COFF_ADJUST_AUX_IN_POST
|
||||
COFF_ADJUST_AUX_IN_POST (abfd, ext1, type, class, indx, numaux, in1);
|
||||
#endif
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
#ifdef COFF_ADJUST_AUX_OUT_PRE
|
||||
COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, class, indx, numaux, extp);
|
||||
#endif
|
||||
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
|
||||
}
|
||||
goto end;
|
||||
|
||||
#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);
|
||||
goto end;
|
||||
}
|
||||
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);
|
||||
goto end;
|
||||
}
|
||||
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 || class == C_FCN || 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);
|
||||
}
|
||||
|
||||
end:
|
||||
#ifdef COFF_ADJUST_AUX_OUT_POST
|
||||
COFF_ADJUST_AUX_OUT_POST (abfd, inp, type, class, indx, numaux, extp);
|
||||
#endif
|
||||
return AUXESZ;
|
||||
}
|
||||
|
||||
#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 LINESZ;
|
||||
}
|
||||
|
||||
#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 AOUTSZ;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
#ifdef COFF_ADJUST_SCNHDR_IN_PRE
|
||||
COFF_ADJUST_SCNHDR_IN_PRE (abfd, ext, in);
|
||||
#endif
|
||||
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 =
|
||||
GET_SCNHDR_FLAGS (abfd, (bfd_byte *) scnhdr_ext->s_flags);
|
||||
scnhdr_int->s_nreloc =
|
||||
GET_SCNHDR_NRELOC (abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
|
||||
scnhdr_int->s_nlnno =
|
||||
GET_SCNHDR_NLNNO (abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
|
||||
#ifdef I960
|
||||
scnhdr_int->s_align =
|
||||
GET_SCNHDR_ALIGN (abfd, (bfd_byte *) scnhdr_ext->s_align);
|
||||
#endif
|
||||
#ifdef COFF_ADJUST_SCNHDR_IN_POST
|
||||
COFF_ADJUST_SCNHDR_IN_POST (abfd, ext, in);
|
||||
#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 = SCNHSZ;
|
||||
|
||||
#ifdef COFF_ADJUST_SCNHDR_OUT_PRE
|
||||
COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
|
||||
#endif
|
||||
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);
|
||||
PUT_SCNHDR_FLAGS (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
|
||||
{
|
||||
char buf[sizeof (scnhdr_int->s_name) + 1];
|
||||
|
||||
memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
|
||||
buf[sizeof (scnhdr_int->s_name)] = '\0';
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
|
||||
bfd_get_filename (abfd),
|
||||
buf, scnhdr_int->s_nlnno);
|
||||
PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
|
||||
}
|
||||
if (scnhdr_int->s_nreloc <= 0xffff)
|
||||
PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
|
||||
else
|
||||
{
|
||||
char buf[sizeof (scnhdr_int->s_name) + 1];
|
||||
|
||||
memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
|
||||
buf[sizeof (scnhdr_int->s_name)] = '\0';
|
||||
(*_bfd_error_handler) (_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
|
||||
bfd_get_filename (abfd),
|
||||
buf, scnhdr_int->s_nreloc);
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
|
||||
ret = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef I960
|
||||
PUT_SCNHDR_ALIGN (abfd, scnhdr_int->s_align, (bfd_byte *) scnhdr_ext->s_align);
|
||||
#endif
|
||||
#ifdef COFF_ADJUST_SCNHDR_OUT_POST
|
||||
COFF_ADJUST_SCNHDR_OUT_POST (abfd, in, out);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,719 @@
|
|||
# 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_underscore Whether underscores are used: yes or no
|
||||
|
||||
# Part of this file is processed by targmatch.sed to generate the
|
||||
# targmatch.h file. The #ifdef and #endif lines that appear below are
|
||||
# copied directly into targmatch.h.
|
||||
|
||||
# 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
|
||||
alpha*) targ_archs=bfd_alpha_arch ;;
|
||||
arm*) targ_archs=bfd_arm_arch ;;
|
||||
strongarm*) targ_archs=bfd_arm_arch ;;
|
||||
thumb*) targ_archs=bfd_arm_arch ;;
|
||||
c30*) targ_archs=bfd_tic30_arch ;;
|
||||
hppa*) targ_archs=bfd_hppa_arch ;;
|
||||
i[3456]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 ;;
|
||||
v850*) targ_archs=bfd_v850_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
|
||||
# START OF targmatch.h
|
||||
#ifdef BFD64
|
||||
alpha*-*-netbsd*)
|
||||
targ_defvec=bfd_elf64_alpha_vec
|
||||
targ_selvecs=ecoffalpha_little_vec
|
||||
;;
|
||||
alpha*-*-netware*)
|
||||
targ_defvec=ecoffalpha_little_vec
|
||||
targ_selvecs=nlm32_alpha_vec
|
||||
;;
|
||||
alpha*-*-linuxecoff*)
|
||||
targ_defvec=ecoffalpha_little_vec
|
||||
targ_selvecs=bfd_elf64_alpha_vec
|
||||
;;
|
||||
alpha*-*-linux-gnu* | alpha*-*-elf*)
|
||||
targ_defvec=bfd_elf64_alpha_vec
|
||||
targ_selvecs=ecoffalpha_little_vec
|
||||
;;
|
||||
alpha*-*-*vms*)
|
||||
targ_defvec=vms_alpha_vec
|
||||
;;
|
||||
alpha*-*-*)
|
||||
targ_defvec=ecoffalpha_little_vec
|
||||
;;
|
||||
#endif /* BFD64 */
|
||||
|
||||
arc-*-elf*)
|
||||
targ_defvec=bfd_elf32_littlearc_vec
|
||||
targ_selvecs=bfd_elf32_bigarc_vec
|
||||
;;
|
||||
|
||||
arm-*-riscix*)
|
||||
targ_defvec=riscix_vec
|
||||
;;
|
||||
arm-epoc-pe*)
|
||||
targ_defvec=arm_epoc_pe_little_vec
|
||||
targ_selvecs="arm_epoc_pe_little_vec arm_epoc_pe_big_vec arm_epoc_pei_little_vec arm_epoc_pei_big_vec"
|
||||
targ_underscore=no
|
||||
;;
|
||||
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
|
||||
;;
|
||||
arm-*-elf | arm*-*-linux-gnu)
|
||||
targ_defvec=bfd_elf32_littlearm_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_vec
|
||||
;;
|
||||
arm-*-oabi)
|
||||
targ_defvec=bfd_elf32_littlearm_oabi_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_oabi_vec
|
||||
;;
|
||||
|
||||
thumb-*-coff)
|
||||
targ_defvec=armcoff_little_vec
|
||||
targ_selvecs=armcoff_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
thumb-*-oabi)
|
||||
targ_defvec=bfd_elf32_littlearm_oabi_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_oabi_vec
|
||||
;;
|
||||
thumb-*-elf)
|
||||
targ_defvec=bfd_elf32_littlearm_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_vec
|
||||
;;
|
||||
thumb-epoc-pe*)
|
||||
targ_defvec=arm_epoc_pe_little_vec
|
||||
targ_selvecs="arm_epoc_pe_little_vec arm_epoc_pe_big_vec arm_epoc_pei_little_vec arm_epoc_pei_big_vec"
|
||||
targ_underscore=no
|
||||
;;
|
||||
thumb-*-pe*)
|
||||
targ_defvec=armpe_little_vec
|
||||
targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
strongarm-*-elf)
|
||||
targ_defvec=bfd_elf32_littlearm_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_vec
|
||||
;;
|
||||
strongarm-*-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
|
||||
;;
|
||||
|
||||
c30-*-*aout* | tic30-*-*aout*)
|
||||
targ_defvec=tic30_aout_vec
|
||||
;;
|
||||
c30-*-*coff* | tic30-*-*coff*)
|
||||
targ_defvec=tic30_coff_vec
|
||||
;;
|
||||
|
||||
d10v-*-*)
|
||||
targ_defvec=bfd_elf32_d10v_vec
|
||||
;;
|
||||
|
||||
d30v-*-*)
|
||||
targ_defvec=bfd_elf32_d30v_vec
|
||||
;;
|
||||
|
||||
fr30-*-elf)
|
||||
targ_defvec=bfd_elf32_fr30_vec
|
||||
;;
|
||||
|
||||
|
||||
h8300*-*-*)
|
||||
targ_defvec=h8300coff_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
h8500-*-*)
|
||||
targ_defvec=h8500coff_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
|
||||
targ_defvec=bfd_elf32_hppa_vec
|
||||
;;
|
||||
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined (HOST_HPPAMPEIX)
|
||||
hppa*-*-bsd*)
|
||||
targ_defvec=som_vec
|
||||
targ_selvecs=bfd_elf32_hppa_vec
|
||||
;;
|
||||
hppa*-*-hpux* | hppa*-*-hiux* | hppa*-*-mpeix*)
|
||||
targ_defvec=som_vec
|
||||
;;
|
||||
hppa*-*-osf*)
|
||||
targ_defvec=som_vec
|
||||
targ_selvecs=bfd_elf32_hppa_vec
|
||||
;;
|
||||
#endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */
|
||||
|
||||
i[3456]86-*-sco3.2v5*coff)
|
||||
targ_defvec=i386coff_vec
|
||||
targ_selvecs=bfd_elf32_i386_vec
|
||||
;;
|
||||
i[3456]86-*-sysv4* | i[3456]86-*-unixware | i[3456]86-*-solaris2* | \
|
||||
i[3456]86-*-elf | i[3456]86-*-sco3.2v5* | i[3456]86-*-freebsdelf* | \
|
||||
i[3456]86-*-dgux* | i[3456]86-*-sysv5*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs=i386coff_vec
|
||||
;;
|
||||
i[3456]86-*-msdosdjgpp* | i[3456]*-*-go32* | i[3456]86-go32-rtems* )
|
||||
targ_defvec=go32coff_vec
|
||||
targ_selvecs="go32stubbedcoff_vec i386aout_vec"
|
||||
;;
|
||||
i[3456]86-*-sysv* | i[3456]86-*-isc* | i[3456]86-*-sco* | i[3456]86-*-coff | \
|
||||
i[3456]86-*-aix* | i[3456]86*-*-rtems*)
|
||||
targ_defvec=i386coff_vec
|
||||
;;
|
||||
i[3456]86-sequent-bsd*)
|
||||
targ_defvec=i386dynix_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[3456]86-*-bsd*)
|
||||
targ_defvec=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[3456]86-*-freebsd*)
|
||||
targ_defvec=i386freebsd_vec
|
||||
targ_selvecs=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
|
||||
targ_defvec=i386netbsd_vec
|
||||
targ_selvecs=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[3456]86-*-netware*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs="nlm32_i386_vec i386coff_vec i386aout_vec"
|
||||
;;
|
||||
i[3456]86-*-linux*aout*)
|
||||
targ_defvec=i386linux_vec
|
||||
targ_selvecs=bfd_elf32_i386_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[3456]86-*-linux-gnu*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs=i386linux_vec
|
||||
;;
|
||||
i[3456]86-*-lynxos*)
|
||||
targ_defvec=i386lynx_coff_vec
|
||||
targ_selvecs=i386lynx_aout_vec
|
||||
;;
|
||||
i[3456]86-*-gnu*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
;;
|
||||
i[3456]86-*-mach* | i[3456]86-*-osf1mk*)
|
||||
targ_defvec=i386mach3_vec
|
||||
targ_cflags=-DSTAT_FOR_EXEC
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[3456]86-*-os9k)
|
||||
targ_defvec=i386os9k_vec
|
||||
;;
|
||||
i[3456]86-*-msdos*)
|
||||
targ_defvec=i386aout_vec
|
||||
targ_selvecs=i386msdos_vec
|
||||
;;
|
||||
i[3456]86-*-moss*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs="i386msdos_vec i386aout_vec"
|
||||
;;
|
||||
i[3456]86-*-beospe*)
|
||||
targ_defvec=i386pe_vec
|
||||
targ_selvecs="i386pe_vec i386pei_vec"
|
||||
;;
|
||||
i[3456]86-*-beoself* | i[3456]86-*-beos*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs="i386pe_vec i386pei_vec"
|
||||
;;
|
||||
i[3456]86-*-mingw32* | i[3456]86-*-cygwin* | i[3456]86-*-winnt | i[3456]86-*-pe)
|
||||
targ_defvec=i386pe_vec
|
||||
targ_selvecs="i386pe_vec i386pei_vec"
|
||||
;;
|
||||
i[3456]86-none-*)
|
||||
targ_defvec=i386coff_vec
|
||||
;;
|
||||
i[3456]86-*-aout* | i[3456]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 ieee_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i960-*-vxworks5.* | i960-*-coff* | i960-*-sysv* | i960-*-rtems*)
|
||||
targ_defvec=icoff_little_vec
|
||||
targ_selvecs="icoff_big_vec b_out_vec_little_host b_out_vec_big_host ieee_vec"
|
||||
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 ieee_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
m32r-*-*)
|
||||
targ_defvec=bfd_elf32_m32r_vec
|
||||
;;
|
||||
|
||||
m68*-apollo-*)
|
||||
targ_defvec=apollocoff_vec
|
||||
;;
|
||||
m68*-bull-sysv*)
|
||||
targ_defvec=m68kcoffun_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-motorola-sysv*)
|
||||
targ_defvec=m68ksysvcoff_vec
|
||||
;;
|
||||
m68*-hp-bsd*)
|
||||
targ_defvec=hp300bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-aout*)
|
||||
targ_defvec=aout0_big_vec
|
||||
# We include cisco_core_vec 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 ieee_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-elf* | m68*-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
targ_selvecs="m68kcoff_vec ieee_vec"
|
||||
;;
|
||||
m68*-*-coff* | m68*-*-sysv* | m68*-*-rtems*)
|
||||
targ_defvec=m68kcoff_vec
|
||||
targ_selvecs="m68kcoff_vec versados_vec ieee_vec"
|
||||
;;
|
||||
m68*-*-hpux*)
|
||||
targ_defvec=hp300hpux_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-linux*aout*)
|
||||
targ_defvec=m68klinux_vec
|
||||
targ_selvecs=bfd_elf32_m68k_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-linux-gnu*)
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
targ_selvecs=m68klinux_vec
|
||||
;;
|
||||
m68*-*-gnu*)
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
# targ_selvecs=m68kmach3_vec
|
||||
# targ_cflags=-DSTAT_FOR_EXEC
|
||||
;;
|
||||
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* | m68*-*-openbsd*)
|
||||
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 versados_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
|
||||
;;
|
||||
|
||||
mcore-*-elf)
|
||||
targ_defvec=bfd_elf32_mcore_big_vec
|
||||
targ_selvecs="bfd_elf32_mcore_big_vec bfd_elf32_mcore_little_vec"
|
||||
;;
|
||||
mcore-*-pe)
|
||||
targ_defvec=mcore_pe_big_vec
|
||||
targ_selvecs="mcore_pe_big_vec mcore_pe_little_vec mcore_pei_big_vec mcore_pei_little_vec"
|
||||
;;
|
||||
|
||||
mips*-big-*)
|
||||
targ_defvec=ecoff_big_vec
|
||||
targ_selvecs=ecoff_little_vec
|
||||
;;
|
||||
mips-dec-netbsd* | mips*el*-*-netbsd*)
|
||||
targ_defvec=bfd_elf32_littlemips_vec
|
||||
targ_selvecs="bfd_elf32_bigmips_vec ecoff_little_vec ecoff_big_vec"
|
||||
;;
|
||||
mips*-*-netbsd*)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_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*-*-irix6*)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_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*-*-lnews*)
|
||||
targ_defvec=ecoff_biglittle_vec
|
||||
targ_selvecs="ecoff_little_vec ecoff_big_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* | mips*el-*-vxworks*)
|
||||
targ_defvec=bfd_elf32_littlemips_vec
|
||||
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
|
||||
;;
|
||||
mips*-*-elf* | mips*-*-rtems* | mips*-*-vxworks*)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
|
||||
;;
|
||||
mips*-*-none)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
|
||||
;;
|
||||
mips*el*-*-linux-gnu* | mips*el*-*-openbsd*)
|
||||
targ_defvec=bfd_elf32_littlemips_vec
|
||||
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec"
|
||||
;;
|
||||
mips*-*-linux-gnu* | mips*-*-openbsd*)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec"
|
||||
;;
|
||||
|
||||
mn10200-*-*)
|
||||
targ_defvec=bfd_elf32_mn10200_vec
|
||||
;;
|
||||
|
||||
mn10300-*-*)
|
||||
targ_defvec=bfd_elf32_mn10300_vec
|
||||
;;
|
||||
|
||||
ns32k-pc532-mach* | ns32k-pc532-ux*)
|
||||
targ_defvec=pc532machaout_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
ns32k-*-netbsd* | ns32k-*-lites* | ns32k-*-openbsd*)
|
||||
targ_defvec=pc532netbsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
powerpc-*-aix* | powerpc-*-beos*)
|
||||
targ_defvec=rs6000coff_vec
|
||||
;;
|
||||
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
|
||||
powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
|
||||
powerpc-*-vxworks*)
|
||||
targ_defvec=bfd_elf32_powerpc_vec
|
||||
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_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* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks*)
|
||||
targ_defvec=bfd_elf32_powerpcle_vec
|
||||
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
|
||||
;;
|
||||
|
||||
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
|
||||
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
|
||||
;;
|
||||
|
||||
sh-*-elf*)
|
||||
targ_defvec=bfd_elf32_sh_vec
|
||||
targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sh-*-* | sh-*-rtems*)
|
||||
targ_defvec=shcoff_vec
|
||||
targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
sparclet-*-aout*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_selvecs=sparcle_aout_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparc86x-*-aout*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparclite-*-elf* | sparc86x-*-elf*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
;;
|
||||
sparc-*-linux*aout*)
|
||||
targ_defvec=sparclinux_vec
|
||||
targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparc-*-linux-gnu*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
targ_selvecs="sparclinux_vec sunos_big_vec"
|
||||
;;
|
||||
sparc-*-lynxos*)
|
||||
targ_defvec=sparclynx_coff_vec
|
||||
targ_selvecs=sparclynx_aout_vec
|
||||
;;
|
||||
sparc-*-netbsd* | sparc-*-openbsd*)
|
||||
targ_defvec=sparcnetbsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparc-*-elf* | sparc-*-solaris2*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
targ_selvecs=sunos_big_vec
|
||||
;;
|
||||
sparc-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
;;
|
||||
sparc-*-netware*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
targ_selvecs="nlm32_sparc_vec sunos_big_vec"
|
||||
;;
|
||||
#ifdef BFD64
|
||||
sparc64-*-aout*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparc64-*-linux-gnu*)
|
||||
targ_defvec=bfd_elf64_sparc_vec
|
||||
targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
|
||||
;;
|
||||
sparc64-*-elf*)
|
||||
targ_defvec=bfd_elf64_sparc_vec
|
||||
targ_selvecs=bfd_elf32_sparc_vec
|
||||
;;
|
||||
#endif /* BFD64 */
|
||||
sparc*-*-coff*)
|
||||
targ_defvec=sparccoff_vec
|
||||
;;
|
||||
sparc*-*-* | sparc*-*-rtems*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
#if HAVE_host_aout_vec
|
||||
tahoe-*-*)
|
||||
targ_defvec=host_aout_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
#endif
|
||||
|
||||
tic80*-*-*)
|
||||
targ_defvec=tic80coff_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
|
||||
v850-*-*)
|
||||
targ_defvec=bfd_elf32_v850_vec
|
||||
;;
|
||||
v850e-*-*)
|
||||
targ_defvec=bfd_elf32_v850_vec
|
||||
;;
|
||||
v850ea-*-*)
|
||||
targ_defvec=bfd_elf32_v850_vec
|
||||
;;
|
||||
#if HAVE_host_aout_vec
|
||||
vax-*-bsd* | vax-*-ultrix*)
|
||||
targ_defvec=host_aout_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
#endif
|
||||
|
||||
vax*-*-*vms*)
|
||||
targ_defvec=vms_vax_vec
|
||||
;;
|
||||
|
||||
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_out_adobe_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
*-sony-*)
|
||||
targ_defvec=newsos3_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
*-tandem-*)
|
||||
targ_defvec=m68kcoff_vec
|
||||
targ_selvecs=ieee_vec
|
||||
;;
|
||||
# END OF targmatch.h
|
||||
*)
|
||||
echo 1>&2 "*** BFD does not support target ${targ}."
|
||||
echo 1>&2 "*** Look in bfd/config.bfd for supported targets."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# If we support any ELF target, then automatically add support for the
|
||||
# generic ELF targets. This permits an objdump with some ELF support
|
||||
# to be used on an arbitrary ELF file for anything other than
|
||||
# relocation information.
|
||||
case "${targ_defvec} ${targ_selvecs}" in
|
||||
*bfd_elf64*)
|
||||
targ_selvecs="${targ_selvecs} bfd_elf64_little_generic_vec bfd_elf64_big_generic_vec bfd_elf32_little_generic_vec bfd_elf32_big_generic_vec"
|
||||
;;
|
||||
*bfd_elf32*)
|
||||
targ_selvecs="${targ_selvecs} bfd_elf32_little_generic_vec bfd_elf32_big_generic_vec"
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,234 @@
|
|||
/* config.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#undef inline
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define if you need to in order for stat and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||
#undef size_t
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define if you have the __argz_count function. */
|
||||
#undef HAVE___ARGZ_COUNT
|
||||
|
||||
/* Define if you have the __argz_next function. */
|
||||
#undef HAVE___ARGZ_NEXT
|
||||
|
||||
/* Define if you have the __argz_stringify function. */
|
||||
#undef HAVE___ARGZ_STRINGIFY
|
||||
|
||||
/* Define if you have the dcgettext function. */
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define if you have the fcntl function. */
|
||||
#undef HAVE_FCNTL
|
||||
|
||||
/* Define if you have the fdopen function. */
|
||||
#undef HAVE_FDOPEN
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* 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 munmap function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define if you have the setitimer function. */
|
||||
#undef HAVE_SETITIMER
|
||||
|
||||
/* Define if you have the setlocale function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define if you have the stpcpy function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define if you have the strchr function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define if you have the sysconf function. */
|
||||
#undef HAVE_SYSCONF
|
||||
|
||||
/* Define if you have the <argz.h> header file. */
|
||||
#undef HAVE_ARGZ_H
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <nl_types.h> header file. */
|
||||
#undef HAVE_NL_TYPES_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/dir.h> header file. */
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <sys/procfs.h> header file. */
|
||||
#undef HAVE_SYS_PROCFS_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
|
||||
|
||||
/* Define if you have the <values.h> header file. */
|
||||
#undef HAVE_VALUES_H
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if you have the stpcpy function */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if NLS is requested */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Use b modifier when opening binary files? */
|
||||
#undef USE_BINARY_FOPEN
|
||||
|
||||
/* Define if strstr is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_STRSTR
|
||||
|
||||
/* Define if malloc is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_MALLOC
|
||||
|
||||
/* Define if realloc is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_REALLOC
|
||||
|
||||
/* Define if free is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_FREE
|
||||
|
||||
/* Define if getenv is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_GETENV
|
||||
|
||||
/* Define if <sys/procfs.h> has prstatus_t. */
|
||||
#undef HAVE_PRSTATUS_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prstatus_t.pr_who. */
|
||||
#undef HAVE_PRSTATUS_T_PR_WHO
|
||||
|
||||
/* Define if <sys/procfs.h> has pstatus_t. */
|
||||
#undef HAVE_PSTATUS_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prpsinfo_t. */
|
||||
#undef HAVE_PRPSINFO_T
|
||||
|
||||
/* Define if <sys/procfs.h> has psinfo_t. */
|
||||
#undef HAVE_PSINFO_T
|
||||
|
||||
/* Define if <sys/procfs.h> has lwpstatus_t. */
|
||||
#undef HAVE_LWPSTATUS_T
|
||||
|
||||
/* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */
|
||||
#undef HAVE_LWPSTATUS_T_PR_CONTEXT
|
||||
|
||||
/* Define if <sys/procfs.h> has lwpstatus_t.pr_reg. */
|
||||
#undef HAVE_LWPSTATUS_T_PR_REG
|
||||
|
||||
/* Name of host specific header file to include in trad-core.c. */
|
||||
#undef TRAD_HEADER
|
||||
|
||||
/* Use mmap if it's available? */
|
||||
#undef USE_MMAP
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,18 @@
|
|||
@echo off
|
||||
if "%1" == "h8/300" goto h8300
|
||||
|
||||
echo Configuring bfd for go32
|
||||
update hosts\go32.h sysdep.h
|
||||
update Makefile.dos Makefile
|
||||
echo s/@WORDSIZE@/32/g>config.sed
|
||||
sed -e s/^/s\/@VERSION@\// -e s/$/\/g/g version >>config.sed
|
||||
sed -f config.sed < bfd-in2.h > bfd.h2
|
||||
update bfd.h2 bfd.h
|
||||
goto exit
|
||||
|
||||
:h8300
|
||||
echo Configuring bfd for H8/300
|
||||
update hosts\h-go32.h sysdep.h
|
||||
update Makefile.dos Makefile
|
||||
|
||||
:exit
|
|
@ -0,0 +1,215 @@
|
|||
$!
|
||||
$! This file configures the bfd library for use with openVMS (Alpha and Vax)
|
||||
$!
|
||||
$! We do not use the configure script, since we do not have /bin/sh
|
||||
$! to execute it.
|
||||
$!
|
||||
$! Written by Klaus K"ampf (kkaempf@rmi.de)
|
||||
$!
|
||||
$arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2
|
||||
$arch = f$element(arch_indx,"|","|VAX|Alpha|")
|
||||
$!
|
||||
$if arch .eqs. "Alpha"
|
||||
$then
|
||||
$ write sys$output "Configuring for Alpha target"
|
||||
$ target = "alpha"
|
||||
$!
|
||||
$! copy bfd-in2.h to bfd.h, replacing @ macros
|
||||
$!
|
||||
$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
|
||||
[]bfd-in2.h /output=[]bfd.h
|
||||
$DECK
|
||||
!
|
||||
! Copy file, changing lines with macros (@@)
|
||||
!
|
||||
!
|
||||
vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
|
||||
rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
|
||||
match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
vers := CURRENT_LINE-")";
|
||||
ELSE;
|
||||
vers := "unknown";
|
||||
ENDIF;
|
||||
|
||||
file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
|
||||
rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
|
||||
|
||||
match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT(vers);
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('64');
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('0');
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('__DECC');
|
||||
SPLIT_LINE;
|
||||
COPY_TEXT('#include <ints.h>');
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('int64');
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('uint64');
|
||||
ENDIF;
|
||||
WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
|
||||
QUIT
|
||||
$ EOD
|
||||
$
|
||||
$else
|
||||
$
|
||||
$ write sys$output "Configuring for Vax target"
|
||||
$ target = "vax"
|
||||
$!
|
||||
$! copy bfd-in2.h to bfd.h, replacing @ macros
|
||||
$!
|
||||
$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
|
||||
[]bfd-in2.h /output=[]bfd.h
|
||||
$DECK
|
||||
!
|
||||
! Copy file, changing lines with macros (@@)
|
||||
!
|
||||
!
|
||||
vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
|
||||
rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
|
||||
match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
vers := CURRENT_LINE-")";
|
||||
ELSE;
|
||||
vers := "unknown";
|
||||
ENDIF;
|
||||
|
||||
file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
|
||||
rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
|
||||
|
||||
match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT(vers);
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('32');
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('0');
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('__DECC');
|
||||
SPLIT_LINE;
|
||||
COPY_TEXT('#include <ints.h>');
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('int64');
|
||||
ENDIF;
|
||||
match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
|
||||
IF match_pos <> 0 THEN;
|
||||
POSITION(BEGINNING_OF(match_pos));
|
||||
ERASE(match_pos);
|
||||
COPY_TEXT('uint64');
|
||||
ENDIF;
|
||||
WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
|
||||
QUIT
|
||||
$ EOD
|
||||
$endif
|
||||
$
|
||||
$ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
|
||||
$!
|
||||
$!
|
||||
$! create targmatch.h
|
||||
$!
|
||||
$ open/write tfile []targmatch.h
|
||||
$ write tfile "{ """ + target + "-*-*vms*""" + ","
|
||||
$ write tfile "#if defined (SELECT_VECS)"
|
||||
$ write tfile "SELECT_VECS"
|
||||
$ write tfile "#else"
|
||||
$ write tfile "UNSUPPORTED_TARGET"
|
||||
$ write tfile "#endif"
|
||||
$ write tfile "},"
|
||||
$ close tfile
|
||||
$ write sys$output "Generated `targmatch.h'"
|
||||
$!
|
||||
$!
|
||||
$! create config.h
|
||||
$!
|
||||
$ create []config.h
|
||||
/* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */
|
||||
/* 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. */
|
||||
/* #define HAVE_MMAP 1 */
|
||||
/* 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. */
|
||||
#define HAVE_FCNTL 1
|
||||
/* Define if you have the getpagesize function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
/* Define if you have the madvise function. */
|
||||
#define HAVE_MADVISE 1
|
||||
/* Define if you have the mprotect function. */
|
||||
#define HAVE_MPROTECT 1
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
/* Define if you have the <stddef.h> header file. */
|
||||
#define HAVE_STDDEF_H 1
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#define HAVE_SYS_FILE_H 1
|
||||
/* Define if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
$!
|
||||
$ write sys$output "Generated `config.h'"
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
# 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 64 bit types are as fast as 32 bit
|
||||
# HOST_64BIT_TYPE host 64 bit type
|
||||
# HOST_U_64BIT_TYPE unsigned 64 bit type (not needed if 64BIT_TYPE is long)
|
||||
|
||||
HDEFINES=
|
||||
host64=false
|
||||
HOST_64BIT_TYPE=
|
||||
HOST_U_64BIT_TYPE=
|
||||
|
||||
case "${host}" in
|
||||
|
||||
alpha*-*-*) host64=true; HOST_64BIT_TYPE=long ;;
|
||||
|
||||
hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;;
|
||||
hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;;
|
||||
hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;;
|
||||
hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
|
||||
hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
|
||||
|
||||
i[3456]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
|
||||
i[3456]86-sequent-sysv4*) ;;
|
||||
i[3456]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
|
||||
|
||||
mips*-dec-netbsd*) ;;
|
||||
mips*-*-openbsd*) ;;
|
||||
mips*-dec-*) HDEFINES="-G 4" ;;
|
||||
mips*-sgi-irix3*) HDEFINES="-G 4" ;;
|
||||
mips*-sgi-irix4*) HDEFINES="-G 4" ;;
|
||||
mips*-sgi-irix6*) host64=true
|
||||
HOST_64BIT_TYPE="long long";
|
||||
HOST_U_64BIT_TYPE="unsigned long long";
|
||||
;;
|
||||
mips*-*-sysv4*) ;;
|
||||
mips*-*-sysv*) HDEFINES="-G 4" ;;
|
||||
mips*-*-riscos*) HDEFINES="-G 4" ;;
|
||||
|
||||
m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;;
|
||||
|
||||
*-*-solaris*) HOST_64BIT_TYPE="long long"
|
||||
HOST_U_64BIT_TYPE="unsigned long long"
|
||||
;;
|
||||
|
||||
*-*-windows*)
|
||||
HOST_64BIT_TYPE=__int64
|
||||
HOST_U_64BIT_TYPE="unsigned __int64"
|
||||
# The following krock is necessary because we can't run the build compiler
|
||||
# (MSVC) on the configure host, so we have to explicitly set the values here.
|
||||
# Note that this file is never run through autoconf, so we can't use any
|
||||
# autoconf macros here. Because of this, we have to muck with autoconf
|
||||
# variables explicitly.
|
||||
ac_cv_func_mmap_fixed_mapped=no
|
||||
ac_cv_header_time=no
|
||||
ac_cv_func_getpagesize=no
|
||||
ac_cv_func_madvise=no
|
||||
ac_cv_func_mprotect=no
|
||||
ac_cv_header_sys_file_h=no
|
||||
ac_cv_header_sys_time_h=no
|
||||
ac_cv_header_unistd_h=no
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,648 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(libbfd.c)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ISC_POSIX
|
||||
|
||||
AM_INIT_AUTOMAKE(bfd, 2.9.4)
|
||||
|
||||
dnl These must be called before AM_PROG_LIBTOOL, because it may want
|
||||
dnl to call AC_CHECK_PROG.
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
||||
|
||||
dnl Default to a non shared library. This may be overridden by the
|
||||
dnl configure option --enable-shared.
|
||||
AM_DISABLE_SHARED
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
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(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
|
||||
|
||||
AM_CONFIG_HEADER(config.h:config.in)
|
||||
|
||||
if test -z "$target" ; then
|
||||
AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
|
||||
fi
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
AM_MAINTAINER_MODE
|
||||
AC_EXEEXT
|
||||
|
||||
host64=false
|
||||
target64=false
|
||||
|
||||
# host stuff:
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
ALL_LINGUAS=
|
||||
CY_GNU_GETTEXT
|
||||
|
||||
# Permit host specific settings.
|
||||
. ${srcdir}/configure.host
|
||||
|
||||
AC_SUBST(HDEFINES)
|
||||
AC_PROG_INSTALL
|
||||
|
||||
BFD_HOST_64BIT_LONG=0
|
||||
BFD_HOST_64_BIT_DEFINED=0
|
||||
BFD_HOST_64_BIT=
|
||||
BFD_HOST_U_64_BIT=
|
||||
if test "x${HOST_64BIT_TYPE}" = "xlong"; then
|
||||
BFD_HOST_64BIT_LONG=1
|
||||
elif test "x${HOST_64BIT_TYPE}" != "x"; then
|
||||
BFD_HOST_64_BIT_DEFINED=1
|
||||
BFD_HOST_64_BIT=${HOST_64BIT_TYPE}
|
||||
BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE}
|
||||
fi
|
||||
AC_SUBST(BFD_HOST_64BIT_LONG)
|
||||
AC_SUBST(BFD_HOST_64_BIT_DEFINED)
|
||||
AC_SUBST(BFD_HOST_64_BIT)
|
||||
AC_SUBST(BFD_HOST_U_64_BIT)
|
||||
|
||||
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_HEADER_DIRENT
|
||||
AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen)
|
||||
|
||||
BFD_BINARY_FOPEN
|
||||
|
||||
BFD_NEED_DECLARATION(strstr)
|
||||
BFD_NEED_DECLARATION(malloc)
|
||||
BFD_NEED_DECLARATION(realloc)
|
||||
BFD_NEED_DECLARATION(free)
|
||||
BFD_NEED_DECLARATION(getenv)
|
||||
|
||||
# If we are configured native, pick a core file support file.
|
||||
COREFILE=
|
||||
COREFLAG=
|
||||
TRAD_HEADER=
|
||||
if test "${target}" = "${host}"; then
|
||||
case "${host}" in
|
||||
alpha*-*-linux-gnu*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/alphalinux.h"'
|
||||
;;
|
||||
alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;;
|
||||
alpha*-*-*) COREFILE=osf-core.lo ;;
|
||||
arm-*-riscix) COREFILE=trad-core.lo ;;
|
||||
hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
|
||||
hppa*-*-hiux*) COREFILE=hpux-core.lo ;;
|
||||
hppa*-*-mpeix*) COREFILE=hpux-core.lo ;;
|
||||
hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo"
|
||||
COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-sequent-bsd*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo;
|
||||
TRAD_HEADER='"hosts/symmetry.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-sequent-sysv4*) ;;
|
||||
i[3456]86-sequent-sysv*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/symmetry.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-bsd* | i[3456]86-*-freebsd*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/i386bsd.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
|
||||
changequote([,])dnl
|
||||
COREFILE=netbsd-core.lo
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-esix-sysv3*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/esix.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-sco3.2v5*)
|
||||
changequote([,])dnl
|
||||
COREFILE=sco5-core.lo
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-sco* | i[3456]86-*-isc*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/i386sco.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-mach3*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/i386mach3.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-linux-gnu*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/i386linux.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-isc*) COREFILE=trad-core.lo ;;
|
||||
i[3456]86-*-aix*) COREFILE=aix386-core.lo ;;
|
||||
changequote([,])dnl
|
||||
i860-*-mach3* | i860-*-osf1*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/i860mach3.h"'
|
||||
;;
|
||||
mips-dec-bsd*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/mipsbsd.h"'
|
||||
;;
|
||||
mips-dec-mach3*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/mipsmach3.h"'
|
||||
;;
|
||||
mips-*-netbsd* | mips*-*-openbsd*)
|
||||
COREFILE=netbsd-core.lo
|
||||
;;
|
||||
mips-dec-*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/decstation.h"'
|
||||
;;
|
||||
mips-sgi-irix4*) COREFILE=irix-core.lo ;;
|
||||
mips-sgi-irix5*) COREFILE=irix-core.lo ;;
|
||||
mips-sgi-irix6*) COREFILE=irix-core.lo ;;
|
||||
mips-*-mach3*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/mipsmach3.h"'
|
||||
;;
|
||||
mips-*-sysv4*) ;;
|
||||
mips-*-sysv* | mips-*-riscos*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/riscos.h"'
|
||||
;;
|
||||
mips-sony-bsd*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/news-mips.h"'
|
||||
;;
|
||||
m68*-bull*-sysv*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/dpx2.h"'
|
||||
;;
|
||||
m68*-hp-hpux*) COREFILE=hpux-core.lo ;;
|
||||
m68*-hp-bsd*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/hp300bsd.h"'
|
||||
;;
|
||||
m68*-*-linux-gnu*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/m68klinux.h"'
|
||||
;;
|
||||
m68*-motorola-sysv*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/delta68.h"'
|
||||
;;
|
||||
m68*-sony-*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/news.h"'
|
||||
;;
|
||||
m68*-*-netbsd* | m68*-*-openbsd*)
|
||||
COREFILE=netbsd-core.lo
|
||||
;;
|
||||
m68*-apple-aux*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/m68kaux.h"'
|
||||
;;
|
||||
m88*-*-sysv4*) ;;
|
||||
m88*-motorola-sysv*) COREFILE=ptrace-core.lo ;;
|
||||
m88*-*-mach3*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/m88kmach3.h"'
|
||||
;;
|
||||
ns32k-pc532-mach)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/pc532mach.h"'
|
||||
;;
|
||||
ns32k-*-netbsd* | ns32k-*-openbsd*)
|
||||
COREFILE=netbsd-core.lo
|
||||
;;
|
||||
rs6000-*-lynx*) COREFILE=lynx-core.lo ;;
|
||||
rs6000-*-aix4*) COREFILE=rs6000-core.lo ;;
|
||||
rs6000-*-*) COREFILE=rs6000-core.lo ;;
|
||||
powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;;
|
||||
powerpc-*-aix4*) COREFILE=rs6000-core.lo ;;
|
||||
powerpc-*-aix*) COREFILE=rs6000-core.lo ;;
|
||||
powerpc-*-beos*) ;;
|
||||
powerpc-*-netbsd*) COREFILE=netbsd-core.lo ;;
|
||||
sparc-*-netbsd* | sparc-*-openbsd*)
|
||||
COREFILE=netbsd-core.lo
|
||||
;;
|
||||
tahoe-*-*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/tahoe.h"'
|
||||
;;
|
||||
vax-*-ultrix2*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/vaxult2.h"'
|
||||
;;
|
||||
vax-*-ultrix*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/vaxult2.h"'
|
||||
;;
|
||||
vax-*-*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/vaxbsd.h"'
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$COREFILE" in
|
||||
aix386-core.lo) COREFLAG=-DAIX386_CORE ;;
|
||||
hppabsd-core.lo) COREFLAG=-DHPPABSD_CORE ;;
|
||||
hpux-core.lo) COREFLAG=-DHPUX_CORE ;;
|
||||
irix-core.lo) COREFLAG=-DIRIX_CORE ;;
|
||||
lynx-core.lo) COREFLAG=-DLYNX_CORE ;;
|
||||
netbsd-core.lo) COREFLAG=-DNETBSD_CORE ;;
|
||||
osf-core.lo) COREFLAG=-DOSF_CORE ;;
|
||||
ptrace-core.lo) COREFLAG=-DPTRACE_CORE ;;
|
||||
rs6000-core.lo) COREFLAG="$COREFLAG -DAIX_CORE" ;;
|
||||
sco5-core.lo) COREFLAG="$COREFLAG -DSCO5_CORE" ;;
|
||||
trad-core.lo) COREFLAG="$COREFLAG -DTRAD_CORE" ;;
|
||||
esac
|
||||
|
||||
# ELF corefile support has several flavors, but all of
|
||||
# them use something called <sys/procfs.h>
|
||||
AC_CHECK_HEADERS(sys/procfs.h)
|
||||
if test "$ac_cv_header_sys_procfs_h" = yes; then
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(prstatus_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus_t, pr_who)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(psinfo_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(lwpstatus_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_context)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_reg)
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(COREFILE)
|
||||
AC_SUBST(COREFLAG)
|
||||
AC_DEFINE_UNQUOTED(TRAD_HEADER, $TRAD_HEADER,
|
||||
[Name of host specific header file to include in trad-core.c.])
|
||||
|
||||
# Horrible hacks to build DLLs on Windows.
|
||||
WIN32LDFLAGS=
|
||||
WIN32LIBADD=
|
||||
case "${host}" in
|
||||
*-*-cygwin*)
|
||||
if test "$enable_shared" = "yes"; then
|
||||
WIN32LDFLAGS="-no-undefined"
|
||||
WIN32LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(WIN32LDFLAGS)
|
||||
AC_SUBST(WIN32LIBADD)
|
||||
|
||||
# target stuff:
|
||||
|
||||
# Canonicalize the secondary target names.
|
||||
if test -n "$enable_targets" ; then
|
||||
for targ in `echo $enable_targets | sed 's/,/ /g'`
|
||||
do
|
||||
result=`${CONFIG_SHELL-/bin/sh} $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.lo elflink.lo dwarf2.lo dwarf1.lo"
|
||||
|
||||
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.lo cofflink.lo" ;;
|
||||
a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;;
|
||||
armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
|
||||
armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
|
||||
armpe_little_vec) tb="$tb pe-arm.lo coff-arm.lo cofflink.lo " ;;
|
||||
armpe_big_vec) tb="$tb pe-arm.lo coff-arm.lo cofflink.lo " ;;
|
||||
armpei_little_vec) tb="$tb pei-arm.lo cofflink.lo " ;;
|
||||
armpei_big_vec) tb="$tb pei-arm.lo cofflink.lo " ;;
|
||||
arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo cofflink.lo " ;;
|
||||
arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo cofflink.lo " ;;
|
||||
arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo cofflink.lo " ;;
|
||||
arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo cofflink.lo " ;;
|
||||
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
|
||||
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
|
||||
aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;;
|
||||
aout_mips_big_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
|
||||
aout_mips_little_vec) tb="$tb mipsbsd.lo aout32.lo" ;;
|
||||
apollocoff_vec) tb="$tb coff-apollo.lo" ;;
|
||||
b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;;
|
||||
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
|
||||
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"
|
||||
target64=true ;;
|
||||
bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
|
||||
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
|
||||
target64=true ;;
|
||||
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
|
||||
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
|
||||
target64=true ;;
|
||||
bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
|
||||
bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
|
||||
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
|
||||
bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
|
||||
target64=true ;;
|
||||
bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
|
||||
target64=true ;;
|
||||
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"
|
||||
target64=true ;;
|
||||
cisco_core_vec) tb="$tb cisco-core.lo" ;;
|
||||
demo_64_vec) tb="$tb demo64.lo aout64.lo"
|
||||
target64=true ;;
|
||||
ecoff_big_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
|
||||
ecoff_little_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
|
||||
ecoff_biglittle_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
|
||||
ecoffalpha_little_vec) tb="$tb coff-alpha.lo ecoff.lo ecofflink.lo"
|
||||
target64=true ;;
|
||||
go32coff_vec) tb="$tb coff-go32.lo cofflink.lo" ;;
|
||||
go32stubbedcoff_vec) tb="$tb coff-stgo32.lo cofflink.lo" ;;
|
||||
h8300coff_vec) tb="$tb coff-h8300.lo reloc16.lo" ;;
|
||||
h8500coff_vec) tb="$tb coff-h8500.lo reloc16.lo" ;;
|
||||
host_aout_vec) tb="$tb host-aout.lo aout32.lo" ;;
|
||||
hp300bsd_vec) tb="$tb hp300bsd.lo aout32.lo" ;;
|
||||
hp300hpux_vec) tb="$tb hp300hpux.lo aout32.lo" ;;
|
||||
i386aout_vec) tb="$tb i386aout.lo aout32.lo" ;;
|
||||
i386bsd_vec) tb="$tb i386bsd.lo aout32.lo" ;;
|
||||
i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;;
|
||||
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
|
||||
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
|
||||
i386msdos_vec) tb="$tb i386msdos.lo" ;;
|
||||
i386pe_vec) tb="$tb pe-i386.lo cofflink.lo " ;;
|
||||
i386pei_vec) tb="$tb pei-i386.lo cofflink.lo" ;;
|
||||
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
|
||||
i386lynx_aout_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;;
|
||||
i386lynx_coff_vec) tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;;
|
||||
i386mach3_vec) tb="$tb i386mach3.lo aout32.lo" ;;
|
||||
i386netbsd_vec) tb="$tb i386netbsd.lo aout32.lo" ;;
|
||||
i386os9k_vec) tb="$tb i386os9k.lo aout32.lo" ;;
|
||||
i860coff_vec) tb="$tb coff-i860.lo cofflink.lo" ;;
|
||||
icoff_big_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
|
||||
icoff_little_vec) tb="$tb coff-i960.lo cofflink.lo" ;;
|
||||
ieee_vec) tb="$tb ieee.lo" ;;
|
||||
m68kcoff_vec) tb="$tb coff-m68k.lo cofflink.lo" ;;
|
||||
m68kcoffun_vec) tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
|
||||
m68klinux_vec) tb="$tb m68klinux.lo aout32.lo" ;;
|
||||
m68klynx_aout_vec) tb="$tb m68klynx.lo lynx-core.lo aout32.lo" ;;
|
||||
m68klynx_coff_vec) tb="$tb cf-m68klynx.lo coff-m68k.lo cofflink.lo lynx-core.lo" ;;
|
||||
m68knetbsd_vec) tb="$tb m68knetbsd.lo aout32.lo" ;;
|
||||
m68k4knetbsd_vec) tb="$tb m68k4knetbsd.lo aout32.lo" ;;
|
||||
m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;;
|
||||
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
|
||||
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
|
||||
mcore_pe_big_vec) tb="$tb pe-mcore.lo cofflink.lo" ;;
|
||||
mcore_pe_little_vec) tb="$tb pe-mcore.lo cofflink.lo" ;;
|
||||
mcore_pei_big_vec) tb="$tb pei-mcore.lo cofflink.lo" ;;
|
||||
mcore_pei_little_vec) tb="$tb pei-mcore.lo cofflink.lo" ;;
|
||||
newsos3_vec) tb="$tb newsos3.lo aout32.lo" ;;
|
||||
nlm32_i386_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
|
||||
nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
|
||||
nlm32_alpha_vec) tb="$tb nlm32-alpha.lo nlm32.lo nlm.lo"
|
||||
target64=true ;;
|
||||
riscix_vec) tb="$tb aout32.lo riscix.lo" ;;
|
||||
nlm32_powerpc_vec) tb="$tb nlm32-ppc.lo nlm32.lo nlm.lo" ;;
|
||||
pc532netbsd_vec) tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
|
||||
pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
|
||||
pmac_xcoff_vec) tb="$tb coff-pmac.lo xcofflink.lo" ;;
|
||||
rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
|
||||
bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo cofflink.lo" ;;
|
||||
bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo cofflink.lo" ;;
|
||||
bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo cofflink.lo" ;;
|
||||
bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo cofflink.lo" ;;
|
||||
ppcboot_vec) tb="$tb ppcboot.lo" ;;
|
||||
shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
|
||||
shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
|
||||
shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
|
||||
shlcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
|
||||
som_vec) tb="$tb som.lo" ;;
|
||||
sparcle_aout_vec) tb="$tb aout-sparcle.lo aout32.lo" ;;
|
||||
sparclinux_vec) tb="$tb sparclinux.lo aout32.lo" ;;
|
||||
sparclynx_aout_vec) tb="$tb sparclynx.lo lynx-core.lo aout32.lo" ;;
|
||||
sparclynx_coff_vec) tb="$tb cf-sparclynx.lo lynx-core.lo" ;;
|
||||
sparcnetbsd_vec) tb="$tb sparcnetbsd.lo aout32.lo" ;;
|
||||
sparccoff_vec) tb="$tb coff-sparc.lo" ;;
|
||||
srec_vec) tb="$tb srec.lo" ;;
|
||||
sunos_big_vec) tb="$tb sunos.lo aout32.lo" ;;
|
||||
symbolsrec_vec) tb="$tb srec.lo" ;;
|
||||
tekhex_vec) tb="$tb tekhex.lo" ;;
|
||||
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
|
||||
tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
|
||||
tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;;
|
||||
versados_vec) tb="$tb versados.lo" ;;
|
||||
vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"
|
||||
target64=true ;;
|
||||
vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;;
|
||||
w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;;
|
||||
we32kcoff_vec) tb="$tb coff-we32k.lo" ;;
|
||||
z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo" ;;
|
||||
|
||||
"") ;;
|
||||
*) AC_MSG_ERROR(*** unknown target vector $vec) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Target architecture .o files.
|
||||
# A couple of CPUs use shorter file names to avoid problems on DOS
|
||||
# filesystems.
|
||||
ta=`echo $selarchs | sed -e s/bfd_/cpu-/g -e s/_arch/.lo/g -e s/mn10200/m10200/ -e s/mn10300/m10300/`
|
||||
|
||||
# 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=
|
||||
havevecs=
|
||||
selarchs=
|
||||
else # all_targets is true
|
||||
# Only set these if they will be nonempty, for the clever echo.
|
||||
havevecs=
|
||||
test -n "$selvecs" &&
|
||||
havevecs=`echo $selvecs | sed -e 's/^/-DHAVE_/' -e 's/ \(.\)/ -DHAVE_\1/g'`
|
||||
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)'
|
||||
if test -z "$GCC" && test "$BFD_HOST_64BIT_LONG" = "0" && test "$BFD_HOST_64_BIT_DEFINED" = "0"; then
|
||||
AC_MSG_WARN([You have requested a 64 bit BFD configuration, but])
|
||||
AC_MSG_WARN([your compiler may not have a 64 bit integral type])
|
||||
fi
|
||||
;;
|
||||
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}'"
|
||||
test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}"
|
||||
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_fixed_mapped} in
|
||||
true+yes ) AC_DEFINE(USE_MMAP, 1, [Use mmap if it's available?]) ;;
|
||||
esac
|
||||
|
||||
rm -f doc/config.status
|
||||
AC_OUTPUT(Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in,
|
||||
[sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile])
|
|
@ -0,0 +1,106 @@
|
|||
/* 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));
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/* BFD support for the AMD 29000 architecture.
|
||||
Copyright 1992 Free Software Foundation, Inc.
|
||||
Hacked 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"
|
||||
|
||||
const bfd_arch_info_type bfd_a29k_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_a29k,
|
||||
0, /* only 1 machine */
|
||||
"a29k",
|
||||
"a29k",
|
||||
4,
|
||||
true, /* the one and only */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
};
|
|
@ -0,0 +1,51 @@
|
|||
/* BFD support for the Alpha 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"
|
||||
|
||||
#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
|
||||
{ \
|
||||
BITS_WORD, /* bits in a word */ \
|
||||
BITS_ADDR, /* bits in an address */ \
|
||||
8, /* 8 bits in a byte */ \
|
||||
bfd_arch_alpha, \
|
||||
NUMBER, \
|
||||
"alpha", \
|
||||
PRINT, \
|
||||
3, \
|
||||
DEFAULT, \
|
||||
bfd_default_compatible, \
|
||||
bfd_default_scan, \
|
||||
NEXT, \
|
||||
}
|
||||
|
||||
#define NN(index) (&arch_info_struct[index])
|
||||
|
||||
/* These exist only so that we can resonably disassemble PALcode. */
|
||||
static const bfd_arch_info_type arch_info_struct[] =
|
||||
{
|
||||
N (64, 64, bfd_mach_alpha_ev4, "alpha:ev4", false, NN(1)),
|
||||
N (64, 64, bfd_mach_alpha_ev5, "alpha:ev5", false, NN(2)),
|
||||
N (64, 64, bfd_mach_alpha_ev6, "alpha:ev6", false, 0),
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_alpha_arch =
|
||||
N (64, 64, 0, "alpha", true, NN(0));
|
|
@ -0,0 +1,70 @@
|
|||
/* BFD support for the ARC processor
|
||||
Copyright 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||
Contributed by Doug Evans (dje@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"
|
||||
|
||||
#define ARC(mach, print_name, default_p, next) \
|
||||
{ \
|
||||
32, /* 32 bits in a word */ \
|
||||
32, /* 32 bits in an address */ \
|
||||
8, /* 8 bits in a byte */ \
|
||||
bfd_arch_arc, \
|
||||
mach, \
|
||||
"arc", \
|
||||
print_name, \
|
||||
4, /* section alignment power */ \
|
||||
default_p, \
|
||||
bfd_default_compatible, \
|
||||
bfd_default_scan, \
|
||||
next, \
|
||||
}
|
||||
|
||||
#if 0 /* ??? Not currently needed, but keep in for future reference. */
|
||||
static const bfd_arch_info_type arch_info_struct[] =
|
||||
{
|
||||
ARC (bfd_mach_arc_foo, "arc-foo", false, &arch_info_struct[1]),
|
||||
ARC (bfd_mach_arc_bar, "arc-bar", false, 0),
|
||||
};
|
||||
#endif
|
||||
|
||||
const bfd_arch_info_type bfd_arc_arch =
|
||||
ARC (bfd_mach_arc_base, "arc-base", true, 0 /*&arch_info_struct[0]*/);
|
||||
|
||||
/* Utility routines. */
|
||||
|
||||
/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
|
||||
Returns -1 if not found. */
|
||||
|
||||
int
|
||||
arc_get_mach (name)
|
||||
char *name;
|
||||
{
|
||||
const bfd_arch_info_type *p;
|
||||
|
||||
for (p = &bfd_arc_arch; p != NULL; p = p->next)
|
||||
{
|
||||
/* +4: skip over "arc-" */
|
||||
if (strcmp (name, p->printable_name + 4) == 0)
|
||||
return p->mach;
|
||||
}
|
||||
return -1;
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
/* BFD support for the ARM processor
|
||||
Copyright 1994, 95, 1997 Free Software Foundation, Inc.
|
||||
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
|
||||
|
||||
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"
|
||||
|
||||
static const bfd_arch_info_type *compatible
|
||||
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
|
||||
static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
|
||||
|
||||
/* This routine is provided two arch_infos and works out which ARM
|
||||
machine which would be compatible with both and returns a pointer
|
||||
to its info structure */
|
||||
|
||||
static const bfd_arch_info_type *
|
||||
compatible (a,b)
|
||||
const bfd_arch_info_type * a;
|
||||
const bfd_arch_info_type * b;
|
||||
{
|
||||
/* If a & b are for different architecture we can do nothing */
|
||||
if (a->arch != b->arch)
|
||||
return NULL;
|
||||
|
||||
/* If a & b are for the same machine then all is well */
|
||||
if (a->mach == b->mach)
|
||||
return a;
|
||||
|
||||
/* Otherwise if either a or b is the 'default' machine then
|
||||
it can be polymorphed into the other */
|
||||
if (a->the_default)
|
||||
return b;
|
||||
|
||||
if (b->the_default)
|
||||
return a;
|
||||
|
||||
/* So far all newer ARM architecture cores are supersets of previous cores */
|
||||
if (a->mach < b->mach)
|
||||
return b;
|
||||
else if (a->mach > b->mach)
|
||||
return a;
|
||||
|
||||
/* Never reached! */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
enum bfd_architecture arch;
|
||||
char * name;
|
||||
}
|
||||
processors[] =
|
||||
{
|
||||
{ bfd_mach_arm_2, "arm2" },
|
||||
{ bfd_mach_arm_2a, "arm250" },
|
||||
{ bfd_mach_arm_2a, "arm3" },
|
||||
{ bfd_mach_arm_3, "arm6" },
|
||||
{ bfd_mach_arm_3, "arm60" },
|
||||
{ bfd_mach_arm_3, "arm600" },
|
||||
{ bfd_mach_arm_3, "arm610" },
|
||||
{ bfd_mach_arm_3, "arm7" },
|
||||
{ bfd_mach_arm_3, "arm710" },
|
||||
{ bfd_mach_arm_3, "arm7500" },
|
||||
{ bfd_mach_arm_3, "arm7d" },
|
||||
{ bfd_mach_arm_3, "arm7di" },
|
||||
{ bfd_mach_arm_3M, "arm7dm" },
|
||||
{ bfd_mach_arm_3M, "arm7dmi" },
|
||||
{ bfd_mach_arm_4, "arm8" },
|
||||
{ bfd_mach_arm_4, "arm810" },
|
||||
{ bfd_mach_arm_4, "sa1" },
|
||||
{ bfd_mach_arm_4T, "arm7tdmi" }
|
||||
};
|
||||
|
||||
static boolean
|
||||
scan (info, string)
|
||||
const struct bfd_arch_info * info;
|
||||
const char * string;
|
||||
{
|
||||
int i;
|
||||
|
||||
/* First test for an exact match */
|
||||
if (strcasecmp (string, info->printable_name) == 0)
|
||||
return true;
|
||||
|
||||
/* Next check for a processor name instead of an Architecture name */
|
||||
for (i = sizeof (processors) / sizeof (processors[0]); i--;)
|
||||
{
|
||||
if (strcasecmp (string, processors[ i ].name) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i != -1 && info->arch == processors[ i ].arch)
|
||||
return true;
|
||||
|
||||
/* Finally check for the default architecture */
|
||||
if (strcasecmp (string, "arm") == 0)
|
||||
return info->the_default;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#define N(number, print, default, next) \
|
||||
{ 32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, scan, next }
|
||||
|
||||
static const bfd_arch_info_type arch_info_struct[] =
|
||||
{
|
||||
N( bfd_mach_arm_2, "armv2", false, & arch_info_struct[1] ),
|
||||
N( bfd_mach_arm_2a, "armv2a", false, & arch_info_struct[2] ),
|
||||
N( bfd_mach_arm_3, "armv3", false, & arch_info_struct[3] ),
|
||||
N( bfd_mach_arm_3M, "armv3m", false, & arch_info_struct[4] ),
|
||||
N( bfd_mach_arm_4, "armv4", false, & arch_info_struct[5] ),
|
||||
N( bfd_mach_arm_4T, "armv4t", false, NULL )
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_arm_arch =
|
||||
N( 0, "arm", true, & arch_info_struct[0] );
|
|
@ -0,0 +1,40 @@
|
|||
/* BFD support for the D10V processor
|
||||
Copyright 1996 Free Software Foundation, Inc.
|
||||
Contributed by Martin Hunt (hunt@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"
|
||||
|
||||
const bfd_arch_info_type bfd_d10v_arch =
|
||||
{
|
||||
16, /* 16 bits in a word */
|
||||
16, /* 16 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_d10v,
|
||||
0,
|
||||
"d10v",
|
||||
"d10v",
|
||||
4, /* section alignment power */
|
||||
true,
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan,
|
||||
0,
|
||||
};
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/* BFD support for the Mitsubishi D30V processor
|
||||
Copyright 1997 Free Software Foundation, Inc.
|
||||
Contributed by Martin Hunt (hunt@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"
|
||||
|
||||
const bfd_arch_info_type bfd_d30v_arch =
|
||||
{
|
||||
32, /* bits in a word */
|
||||
32, /* bits in an address */
|
||||
8, /* bits in a byte */
|
||||
bfd_arch_d30v,
|
||||
0,
|
||||
"d30v",
|
||||
"d30v",
|
||||
4, /* section alignment power */
|
||||
true,
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan,
|
||||
0,
|
||||
};
|
|
@ -0,0 +1,38 @@
|
|||
/* BFD support for the FR30 processor.
|
||||
Copyright (C) 1998 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_fr30_arch =
|
||||
{
|
||||
32, /* bits per word */
|
||||
32, /* bits per address */
|
||||
8, /* bits per byte */
|
||||
bfd_arch_fr30, /* architecture */
|
||||
bfd_mach_fr30, /* machine */
|
||||
"fr30", /* architecture name */
|
||||
"fr30", /* printable name */
|
||||
4, /* section align power */
|
||||
true, /* the default ? */
|
||||
bfd_default_compatible, /* architecture comparison fn */
|
||||
bfd_default_scan, /* string to architecture convert fn */
|
||||
NULL /* next in list */
|
||||
};
|
|
@ -0,0 +1,134 @@
|
|||
/* BFD library support routines for the Hitachi H8/300 architecture.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||
Hacked 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"
|
||||
|
||||
int bfd_default_scan_num_mach ();
|
||||
|
||||
static boolean
|
||||
h8300_scan (info, string)
|
||||
const struct bfd_arch_info *info;
|
||||
const char *string;
|
||||
{
|
||||
if (*string != 'h' && *string != 'H')
|
||||
return false;
|
||||
|
||||
string++;
|
||||
if (*string != '8')
|
||||
return false;
|
||||
|
||||
string++;
|
||||
if (*string == '/')
|
||||
string++;
|
||||
|
||||
if (*string != '3')
|
||||
return false;
|
||||
string++;
|
||||
if (*string != '0')
|
||||
return false;
|
||||
string++;
|
||||
if (*string != '0')
|
||||
return false;
|
||||
string++;
|
||||
if (*string == '-')
|
||||
string++;
|
||||
if (*string == 'h' || *string == 'H')
|
||||
{
|
||||
return (info->mach == bfd_mach_h8300h);
|
||||
}
|
||||
else if (*string == 's' || *string == 'S')
|
||||
{
|
||||
return (info->mach == bfd_mach_h8300s);
|
||||
}
|
||||
else
|
||||
{
|
||||
return info->mach == bfd_mach_h8300;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This routine is provided two arch_infos and works out the
|
||||
machine which would be compatible with both and returns a pointer
|
||||
to its info structure */
|
||||
|
||||
static const bfd_arch_info_type *
|
||||
compatible (in, out)
|
||||
const bfd_arch_info_type * in;
|
||||
const bfd_arch_info_type * out;
|
||||
{
|
||||
/* It's really not a good idea to mix and match modes. */
|
||||
if (in->mach != out->mach)
|
||||
return 0;
|
||||
else
|
||||
return in;
|
||||
}
|
||||
|
||||
static const bfd_arch_info_type h8300_info_struct =
|
||||
{
|
||||
16, /* 16 bits in a word */
|
||||
16, /* 16 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_h8300,
|
||||
bfd_mach_h8300,
|
||||
"h8300", /* arch_name */
|
||||
"h8300", /* printable name */
|
||||
1,
|
||||
true, /* the default machine */
|
||||
compatible,
|
||||
h8300_scan,
|
||||
/* local_bfd_reloc_type_lookup, */
|
||||
0,
|
||||
};
|
||||
|
||||
static const bfd_arch_info_type h8300h_info_struct =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_h8300,
|
||||
bfd_mach_h8300h,
|
||||
"h8300h", /* arch_name */
|
||||
"h8300h", /* printable name */
|
||||
1,
|
||||
false, /* the default machine */
|
||||
compatible,
|
||||
h8300_scan,
|
||||
/* local_bfd_reloc_type_lookup, */
|
||||
&h8300_info_struct,
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_h8300_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_h8300,
|
||||
bfd_mach_h8300s,
|
||||
"h8300s", /* arch_name */
|
||||
"h8300s", /* printable name */
|
||||
1,
|
||||
false, /* the default machine */
|
||||
compatible,
|
||||
h8300_scan,
|
||||
/* local_bfd_reloc_type_lookup, */
|
||||
&h8300h_info_struct,
|
||||
};
|
|
@ -0,0 +1,199 @@
|
|||
/* BFD library support routines for the H8/500 architecture.
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
Hacked 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"
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
Relocations for the Z8K
|
||||
|
||||
*/
|
||||
static bfd_reloc_status_type
|
||||
howto16_callback (abfd, reloc_entry, symbol_in, data,
|
||||
ignore_input_section, ignore_bfd)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
struct symbol_cache_entry *symbol_in;
|
||||
PTR data;
|
||||
asection *ignore_input_section;
|
||||
bfd *ignore_bfd;
|
||||
{
|
||||
long relocation = 0;
|
||||
bfd_vma addr = reloc_entry->address;
|
||||
long x = bfd_get_16(abfd, (bfd_byte *)data + addr);
|
||||
|
||||
HOWTO_PREPARE(relocation, symbol_in);
|
||||
|
||||
x = (x + relocation + reloc_entry->addend);
|
||||
|
||||
bfd_put_16(abfd, x, (bfd_byte *)data + addr);
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
|
||||
static bfd_reloc_status_type
|
||||
howto8_callback (abfd, reloc_entry, symbol_in, data,
|
||||
ignore_input_section, ignore_bfd)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
struct symbol_cache_entry *symbol_in;
|
||||
PTR data;
|
||||
asection *ignore_input_section;
|
||||
bfd *ignore_bfd;
|
||||
{
|
||||
long relocation = 0;
|
||||
bfd_vma addr = reloc_entry->address;
|
||||
long x = bfd_get_8(abfd, (bfd_byte *)data + addr);
|
||||
|
||||
HOWTO_PREPARE(relocation, symbol_in);
|
||||
|
||||
x = (x + relocation + reloc_entry->addend);
|
||||
|
||||
bfd_put_8(abfd, x, (bfd_byte *)data + addr);
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
|
||||
static bfd_reloc_status_type
|
||||
howto8_FFnn_callback (abfd, reloc_entry, symbol_in, data,
|
||||
ignore_input_section, ignore_bfd)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
struct symbol_cache_entry *symbol_in;
|
||||
PTR data;
|
||||
asection *ignore_input_section;
|
||||
bfd *ignore_bfd;
|
||||
{
|
||||
long relocation = 0;
|
||||
bfd_vma addr = reloc_entry->address;
|
||||
|
||||
long x = bfd_get_8(abfd, (bfd_byte *)data + addr);
|
||||
abort();
|
||||
HOWTO_PREPARE(relocation, symbol_in);
|
||||
|
||||
x = (x + relocation + reloc_entry->addend);
|
||||
|
||||
bfd_put_8(abfd, x, (bfd_byte *)data + addr);
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
static bfd_reloc_status_type
|
||||
howto8_pcrel_callback (abfd, reloc_entry, symbol_in, data,
|
||||
ignore_input_section, ignore_bfd)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
struct symbol_cache_entry *symbol_in;
|
||||
PTR data;
|
||||
asection *ignore_input_section;
|
||||
bfd *ignore_bfd;
|
||||
{
|
||||
long relocation = 0;
|
||||
bfd_vma addr = reloc_entry->address;
|
||||
long x = bfd_get_8(abfd, (bfd_byte *)data + addr);
|
||||
abort();
|
||||
HOWTO_PREPARE(relocation, symbol_in);
|
||||
|
||||
x = (x + relocation + reloc_entry->addend);
|
||||
|
||||
bfd_put_8(abfd, x, (bfd_byte *)data + addr);
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static reloc_howto_type howto_16
|
||||
= NEWHOWTO(howto16_callback,"abs16",1,false,false);
|
||||
static reloc_howto_type howto_8
|
||||
= NEWHOWTO(howto8_callback,"abs8",0,false,false);
|
||||
|
||||
static reloc_howto_type howto_8_FFnn
|
||||
= NEWHOWTO(howto8_FFnn_callback,"ff00+abs8",0,false,false);
|
||||
|
||||
static reloc_howto_type howto_8_pcrel
|
||||
= NEWHOWTO(howto8_pcrel_callback,"pcrel8",0,false,true);
|
||||
|
||||
|
||||
static reloc_howto_type *
|
||||
local_bfd_reloc_type_lookup (arch, code)
|
||||
const struct bfd_arch_info *arch;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code) {
|
||||
case BFD_RELOC_16:
|
||||
return &howto_16;
|
||||
case BFD_RELOC_8_FFnn:
|
||||
return &howto_8_FFnn;
|
||||
case BFD_RELOC_8:
|
||||
return &howto_8;
|
||||
case BFD_RELOC_8_PCREL:
|
||||
return &howto_8_pcrel;
|
||||
}
|
||||
return (reloc_howto_type *)NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
int bfd_default_scan_num_mach();
|
||||
|
||||
static boolean
|
||||
scan_mach (info, string)
|
||||
const struct bfd_arch_info *info;
|
||||
const char *string;
|
||||
{
|
||||
if (strcmp(string,"h8/500") == 0) return true;
|
||||
if (strcmp(string,"H8/500") == 0) return true;
|
||||
if (strcmp(string,"h8500") == 0) return true;
|
||||
if (strcmp(string,"H8500") == 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#if 0 /* not used currently */
|
||||
/* This routine is provided two arch_infos and returns whether
|
||||
they'd be compatible */
|
||||
|
||||
static const bfd_arch_info_type *
|
||||
compatible (a,b)
|
||||
const bfd_arch_info_type *a;
|
||||
const bfd_arch_info_type *b;
|
||||
{
|
||||
if (a->arch != b->arch || a->mach != b->mach)
|
||||
return NULL;
|
||||
return a;
|
||||
}
|
||||
#endif
|
||||
|
||||
const bfd_arch_info_type bfd_h8500_arch =
|
||||
{
|
||||
16, /* 16 bits in a word */
|
||||
24, /* 24 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_h8500,
|
||||
0, /* only 1 machine */
|
||||
"h8500", /* arch_name */
|
||||
"h8500", /* printable name */
|
||||
1,
|
||||
true, /* the default machine */
|
||||
bfd_default_compatible,
|
||||
scan_mach,
|
||||
0,
|
||||
};
|
|
@ -0,0 +1,71 @@
|
|||
/* BFD support for the HP Precision Architecture 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"
|
||||
|
||||
static const bfd_arch_info_type bfd_hppa10_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_hppa,
|
||||
10, /* By convention PA1.0 = 10 */
|
||||
"hppa",
|
||||
"hppa1.0",
|
||||
3,
|
||||
true, /* Unless we use 1.1 specific features */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
};
|
||||
|
||||
/* PA2.0 in narrow mode */
|
||||
static const bfd_arch_info_type bfd_hppa20_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_hppa,
|
||||
20, /* By convention PA1.0 = 10 */
|
||||
"hppa",
|
||||
"hppa2.0",
|
||||
3,
|
||||
false, /* Unless we use 1.1 specific features */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
&bfd_hppa10_arch,
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_hppa_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_hppa,
|
||||
11, /* By convention PA1.1 = 11 */
|
||||
"hppa",
|
||||
"hppa1.1",
|
||||
3,
|
||||
false, /* 1.1 specific features used */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
&bfd_hppa20_arch,
|
||||
};
|
|
@ -0,0 +1,70 @@
|
|||
/* BFD support for the Intel 386 architecture.
|
||||
Copyright 1992, 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 "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
const bfd_arch_info_type bfd_i386_arch_intel_syntax =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_i386,
|
||||
bfd_mach_i386_i386_intel_syntax,
|
||||
"i386:intel",
|
||||
"i386:intel",
|
||||
3,
|
||||
true,
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
};
|
||||
static const bfd_arch_info_type i8086_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address (well, not really) */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_i386,
|
||||
bfd_mach_i386_i8086,
|
||||
"i8086",
|
||||
"i8086",
|
||||
3,
|
||||
false,
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
&bfd_i386_arch_intel_syntax,
|
||||
};
|
||||
|
||||
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,
|
||||
bfd_mach_i386_i386,
|
||||
"i386",
|
||||
"i386",
|
||||
3,
|
||||
true,
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
&i8086_arch,
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/* BFD support for the Intel 860 architecture.
|
||||
Copyright 1992, 1995 Free Software Foundation, Inc.
|
||||
Created mostly by substituting "860" for "386" in cpu-i386.c
|
||||
Harry Dolan <dolan@ssd.intel.com>, October 1995
|
||||
|
||||
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_i860_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_i860,
|
||||
0, /* only 1 machine */
|
||||
"i860",
|
||||
"i860",
|
||||
3,
|
||||
true, /* the one and only */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
};
|
|
@ -0,0 +1,166 @@
|
|||
/* BFD library support routines for the i960 architecture.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
Hacked 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"
|
||||
|
||||
|
||||
/* This routine is provided a string, and tries to work out if it
|
||||
could possibly refer to the i960 machine pointed at in the
|
||||
info_struct pointer */
|
||||
|
||||
static boolean
|
||||
scan_960_mach (ap, string)
|
||||
const bfd_arch_info_type *ap;
|
||||
const char *string;
|
||||
{
|
||||
unsigned long machine;
|
||||
|
||||
/* Look for the string i960, or somesuch at the front of the string */
|
||||
|
||||
if (strncmp("i960",string,4) == 0) {
|
||||
string+=4;
|
||||
}
|
||||
else {
|
||||
/* no match, can be us */
|
||||
return false;
|
||||
}
|
||||
if (string[0] == 0) {
|
||||
/* i960 on it's own means core to us*/
|
||||
if (ap->mach == bfd_mach_i960_core) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string[0] != ':') {
|
||||
return false;
|
||||
}
|
||||
string++;
|
||||
if (string[0] == '\0')
|
||||
return false;
|
||||
if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' &&
|
||||
string[3] == 'e' && string[4] == '\0')
|
||||
machine = bfd_mach_i960_core;
|
||||
else if (strcmp (string, "ka_sa") == 0)
|
||||
machine = bfd_mach_i960_ka_sa;
|
||||
else if (strcmp (string, "kb_sb") == 0)
|
||||
machine = bfd_mach_i960_kb_sb;
|
||||
else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char */
|
||||
return false;
|
||||
else if (string[0] == 'k' && string[1] == 'b')
|
||||
machine = bfd_mach_i960_kb_sb;
|
||||
else if (string[0] == 's' && string[1] == 'b')
|
||||
machine = bfd_mach_i960_kb_sb;
|
||||
else if (string[0] == 'm' && string[1] == 'c')
|
||||
machine = bfd_mach_i960_mc;
|
||||
else if (string[0] == 'x' && string[1] == 'a')
|
||||
machine = bfd_mach_i960_xa;
|
||||
else if (string[0] == 'c' && string[1] == 'a')
|
||||
machine = bfd_mach_i960_ca;
|
||||
else if (string[0] == 'k' && string[1] == 'a')
|
||||
machine = bfd_mach_i960_ka_sa;
|
||||
else if (string[0] == 's' && string[1] == 'a')
|
||||
machine = bfd_mach_i960_ka_sa;
|
||||
else if (string[0] == 'j' && string[1] == 'x')
|
||||
machine = bfd_mach_i960_jx;
|
||||
else if (string[0] == 'h' && string[1] == 'x')
|
||||
machine = bfd_mach_i960_hx;
|
||||
else
|
||||
return false;
|
||||
if (machine == ap->mach) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This routine is provided two arch_infos and works out the i960
|
||||
machine which would be compatible with both and returns a pointer
|
||||
to its info structure */
|
||||
|
||||
static const bfd_arch_info_type *
|
||||
compatible (a,b)
|
||||
const bfd_arch_info_type *a;
|
||||
const bfd_arch_info_type *b;
|
||||
{
|
||||
|
||||
/* The i960 has distinct subspecies which may not interbreed:
|
||||
CORE CA
|
||||
CORE KA KB MC XA
|
||||
CORE HX JX
|
||||
Any architecture on the same line is compatible, the one on
|
||||
the right is the least restrictive.
|
||||
|
||||
We represent this information in an array, each machine to a side */
|
||||
|
||||
#define ERROR 0
|
||||
#define CORE bfd_mach_i960_core /*1*/
|
||||
#define KA bfd_mach_i960_ka_sa /*2*/
|
||||
#define KB bfd_mach_i960_kb_sb /*3*/
|
||||
#define MC bfd_mach_i960_mc /*4*/
|
||||
#define XA bfd_mach_i960_xa /*5*/
|
||||
#define CA bfd_mach_i960_ca /*6*/
|
||||
#define JX bfd_mach_i960_jx /*7*/
|
||||
#define HX bfd_mach_i960_hx /*8*/
|
||||
#define MAX_ARCH ((int)HX)
|
||||
|
||||
static CONST unsigned long matrix[MAX_ARCH+1][MAX_ARCH+1] =
|
||||
{
|
||||
{ ERROR, CORE, KA, KB, MC, XA, CA, JX, HX },
|
||||
{ CORE, CORE, KA, KB, MC, XA, CA, JX, HX },
|
||||
{ KA, KA, KA, KB, MC, XA, ERROR, ERROR, ERROR},
|
||||
{ KB, KB, KB, KB, MC, XA, ERROR, ERROR, ERROR},
|
||||
{ MC, MC, MC, MC, MC, XA, ERROR, ERROR, ERROR},
|
||||
{ XA, XA, XA, XA, XA, XA, ERROR, ERROR, ERROR},
|
||||
{ CA, CA, ERROR, ERROR, ERROR, ERROR, CA, ERROR, ERROR},
|
||||
{ JX, JX, ERROR, ERROR, ERROR, ERROR, ERROR, JX, HX },
|
||||
{ HX, HX, ERROR, ERROR, ERROR, ERROR, ERROR, HX, HX },
|
||||
};
|
||||
|
||||
|
||||
if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (a->mach == matrix[a->mach][b->mach]) ? a : b;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int bfd_default_scan_num_mach();
|
||||
#define N(a,b,d,n) \
|
||||
{ 32, 32, 8,bfd_arch_i960,a,"i960",b,3,d,compatible,scan_960_mach,n,}
|
||||
|
||||
static const bfd_arch_info_type arch_info_struct[] =
|
||||
{
|
||||
N(bfd_mach_i960_ka_sa,"i960:ka_sa",false, &arch_info_struct[1]),
|
||||
N(bfd_mach_i960_kb_sb,"i960:kb_sb",false, &arch_info_struct[2]),
|
||||
N(bfd_mach_i960_mc, "i960:mc", false, &arch_info_struct[3]),
|
||||
N(bfd_mach_i960_xa, "i960:xa", false, &arch_info_struct[4]),
|
||||
N(bfd_mach_i960_ca, "i960:ca", false, &arch_info_struct[5]),
|
||||
N(bfd_mach_i960_jx, "i960:jx", false, &arch_info_struct[6]),
|
||||
N(bfd_mach_i960_hx, "i960:hx", false, 0),
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_i960_arch =
|
||||
N(bfd_mach_i960_core, "i960:core", true, &arch_info_struct[0]);
|
|
@ -0,0 +1,38 @@
|
|||
/* BFD support for the Matsushita 10200 processor
|
||||
Copyright 1996, 1997 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_mn10200_arch =
|
||||
{
|
||||
16, /* 16 bits in a word */
|
||||
24, /* 16 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_mn10200,
|
||||
200,
|
||||
"mn10200",
|
||||
"mn10200",
|
||||
2,
|
||||
true, /* the one and only */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
};
|
|
@ -0,0 +1,41 @@
|
|||
/* BFD support for the Matsushita 10300 processor
|
||||
Copyright 1996, 1997 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"
|
||||
|
||||
#define NEXT NULL
|
||||
|
||||
const bfd_arch_info_type bfd_mn10300_arch =
|
||||
{
|
||||
32, /* 16 bits in a word */
|
||||
32, /* 16 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_mn10300,
|
||||
300,
|
||||
"mn10300",
|
||||
"mn10300",
|
||||
2,
|
||||
true, /* the one and only */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
NEXT,
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/* BFD support for the M32R processor.
|
||||
Copyright (C) 1996, 1997, 1998, 1999 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"
|
||||
|
||||
#define N(number, print, default, next) \
|
||||
{ 32, 32, 8, bfd_arch_m32r, number, "m32r", print, 4, default, \
|
||||
bfd_default_compatible, bfd_default_scan, next }
|
||||
|
||||
#define NEXT NULL
|
||||
|
||||
|
||||
const bfd_arch_info_type bfd_m32r_arch =
|
||||
N (bfd_mach_m32r, "m32r", true, NEXT);
|
|
@ -0,0 +1,42 @@
|
|||
/* BFD library support routines for architectures.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 97, 1998
|
||||
Free Software Foundation, Inc.
|
||||
Hacked 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"
|
||||
|
||||
#define N(name, print,d,next) \
|
||||
{ 32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_default_compatible,bfd_default_scan, next, }
|
||||
|
||||
static const bfd_arch_info_type arch_info_struct[] =
|
||||
{
|
||||
N(bfd_mach_m68000, "m68k:68000", false, &arch_info_struct[1]),
|
||||
N(bfd_mach_m68008, "m68k:68008", false, &arch_info_struct[2]),
|
||||
N(bfd_mach_m68010, "m68k:68010", false, &arch_info_struct[3]),
|
||||
N(bfd_mach_m68020, "m68k:68020", false, &arch_info_struct[4]),
|
||||
N(bfd_mach_m68030, "m68k:68030", false, &arch_info_struct[5]),
|
||||
N(bfd_mach_m68040, "m68k:68040", false, &arch_info_struct[6]),
|
||||
N(bfd_mach_cpu32, "m68k:cpu32", false, &arch_info_struct[7]),
|
||||
N(bfd_mach_m68060, "m68k:68060", false, 0),
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_m68k_arch =
|
||||
N(0, "m68k", true, &arch_info_struct[0]);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue