libelf: vendor as full-fork recipe (path=source, patches baked)
This commit is contained in:
@@ -8,7 +8,12 @@ version = "0.190"
|
||||
description = "libelf — ELF object file access library (from elfutils). Required by Mesa's radeonsi gallium driver."
|
||||
|
||||
[source]
|
||||
tar = "https://sourceware.org/elfutils/ftp/0.190/elfutils-0.190.tar.bz2"
|
||||
# Vendored local fork (full-fork model): builds from the committed source/
|
||||
# tree (offline, reproducible). source/ = pristine upstream + the patches below
|
||||
# BAKED IN. .patch files kept tracked so a version bump can re-apply them via
|
||||
# sync-recipe-source.sh.
|
||||
# upstream: https://sourceware.org/elfutils/ftp/0.190/elfutils-0.190.tar.bz2
|
||||
path = "source"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
elfutils-0.190.tar.bz2
|
||||
@@ -0,0 +1 @@
|
||||
<https://www.gnu.org/software/gettext/manual/html_node/Users.html>
|
||||
@@ -0,0 +1,104 @@
|
||||
Aaron Merey
|
||||
Adam Markey
|
||||
Adrian Ratiu
|
||||
Ahelenia Ziemiańska
|
||||
Akihiko Odaki
|
||||
Alexander Cherepanov
|
||||
Alexander Kanavin
|
||||
Alexander Miller
|
||||
Alice Zhang
|
||||
Andreas Krebbel
|
||||
Andreas Schwab
|
||||
Andrei Homescu
|
||||
Anthony G. Basile
|
||||
Ben Woodard
|
||||
Chih-Hung Hsieh
|
||||
Claudio Rodrigo Pereyra Diaz
|
||||
Colin Cross
|
||||
Cornelius Neckenig
|
||||
Daniel Cabrera
|
||||
David Abdurachmanov
|
||||
Di Chen
|
||||
Dima Kogan
|
||||
Dimitris Glezos
|
||||
Dmitry V. Levin
|
||||
Dodji Seketeli
|
||||
Domingo Becker
|
||||
Eduardo Santiago
|
||||
Eli Schwartz
|
||||
Érico Nogueira
|
||||
Érico Rolim
|
||||
Filipe Brandenburger
|
||||
Florian Weimer
|
||||
Francesco Tombolini
|
||||
Frank Ch. Eigler
|
||||
Geert Warrink
|
||||
Gladys Guerrero
|
||||
Gustavo Romero
|
||||
Hayatsu Shunsuke
|
||||
H.J. Lu
|
||||
Hyu_gabaru Ryu_ichi
|
||||
Jakub Jelinek
|
||||
Jan Kratochvil
|
||||
Jan Pokorný
|
||||
Jason P. Leasure
|
||||
Jean Pihet
|
||||
Jeff Kenton
|
||||
Jim Wilson
|
||||
John M Mellor-Crummey
|
||||
John Ogness
|
||||
Jonathan Lebon
|
||||
Jonathon Anderson
|
||||
Jose E. Marchesi
|
||||
Josh Stone
|
||||
Joshua Watt
|
||||
Kevin Cernekee
|
||||
kiyoto hashida
|
||||
Konrad Kleine
|
||||
Kurt Roeckx
|
||||
Kyle McMartin
|
||||
Lei Zhang
|
||||
Lubomir Rintel
|
||||
Luca Boccassi
|
||||
Luiz Angelo Daros de Luca
|
||||
Mao Han
|
||||
Marek Polacek
|
||||
Mark Wielaard
|
||||
Martin Liska
|
||||
Masatake YAMATO
|
||||
Matt Fleming
|
||||
Matthias Klose
|
||||
Matthias Maennich
|
||||
Max Filippov
|
||||
Michael Forney
|
||||
Michael Münch
|
||||
Mike Frysinger
|
||||
Milian Wolff
|
||||
Namhyung Kim
|
||||
Noah Sanci
|
||||
Noriko Mizumoto
|
||||
Omar Sandoval
|
||||
Petr Machata
|
||||
Pino Toscano
|
||||
Piotr Drąg
|
||||
Ravi Bangoria
|
||||
Richard Henderson
|
||||
Roland McGrath
|
||||
Rosen Penev
|
||||
Ross Burton
|
||||
Saleem Abdulrasool
|
||||
Sergei Trofimovich
|
||||
Srđan Milaković
|
||||
Steven Chamberlain
|
||||
Thomas Canniot
|
||||
Thomas Spura
|
||||
Timm Bäder
|
||||
Tom Tromey
|
||||
Ulf Hermann
|
||||
Ulrich Drepper
|
||||
Wei Liu
|
||||
William Cohen
|
||||
Yonghong Song
|
||||
Yulia Poyarkova
|
||||
Yunlian Jiang
|
||||
Yuri Chornoivan
|
||||
@@ -0,0 +1,142 @@
|
||||
The project home is http://elfutils.org/
|
||||
|
||||
The current elfutils source code can be checked out with
|
||||
git clone git://sourceware.org/git/elfutils.git
|
||||
|
||||
The developer mailinglist to send patches to is
|
||||
elfutils-devel@sourceware.org.
|
||||
https://sourceware.org/ml/elfutils-devel/
|
||||
|
||||
To subscribe send an email to elfutils-devel-subscribe@sourceware.org
|
||||
Or use the form at https://sourceware.org/mailman/listinfo/elfutils-devel
|
||||
|
||||
Please supply patches using git format-patch or using git send-email.
|
||||
|
||||
Sign your work
|
||||
|
||||
To facilitate tracking of who did what, we've adopted a "sign-off"
|
||||
procedure for patches based on the procedure used by the Linux kernel
|
||||
project.
|
||||
|
||||
The sign-off is a simple line at the end of the explanation for the
|
||||
patch, which certifies that you wrote it or otherwise have the right
|
||||
to pass it on as a patch under an appropriate license. The rules are
|
||||
pretty simple: if you can certify the below:
|
||||
|
||||
Developer's Certificate of Origin
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me,
|
||||
and I have the right to submit the contribution under each
|
||||
license indicated in, or otherwise designated as being
|
||||
applicable to, the file.
|
||||
|
||||
(b) The contribution was provided directly to me by some other
|
||||
person who certified (a), and I have not modified it.
|
||||
|
||||
(c) I understand and agree that the project and the
|
||||
contribution are public and that a record of the
|
||||
contribution (including all personal information I submit
|
||||
with it, including my sign-off) is maintained indefinitely
|
||||
and may be redistributed.
|
||||
|
||||
then you just add a line saying
|
||||
|
||||
Signed-off-by: Random J Developer <random@developer.example.org>
|
||||
|
||||
using a known identity (sorry, no anonymous contributions.)
|
||||
The name you use as your identity should not be an anonymous id
|
||||
or false name that misrepresents who you are.
|
||||
|
||||
git commit --signoff will add such a Signed-off-by line at the end of
|
||||
the commit log message for you.
|
||||
|
||||
The ideal patch contains a ChangeLog entry for the commit message and
|
||||
a test case for the bug fixed or feature added.
|
||||
|
||||
The commit message is expected to start with a one line summary of
|
||||
what the patch does, prefixed with the main subdir the patch applies
|
||||
to. e.g libelf: Rewind the elf_frob function bar definitions.
|
||||
|
||||
Finally please include an ChangeLog entry explicitly listing the files
|
||||
and what changed in each of them in the commit message. This will help
|
||||
a reviewer understand which changes are expected (and which might be
|
||||
accidential). Try to follow the GNU Change Log style:
|
||||
https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html
|
||||
Note that elfutils previously maintained separate ChangeLog
|
||||
files. These are no longer used. All changes should be documented in
|
||||
the git commit message.
|
||||
|
||||
The testsuite (make check) is expected to have zero failing tests.
|
||||
Do not knowingly add tests that FAIL. If there are architectures or
|
||||
configurations where a tests is not supported make sure they are
|
||||
skipped instead of failing. Adding "exit 77" in the test shell wrapper
|
||||
indicates that a test was SKIPPED.
|
||||
|
||||
We do allow binaries in the testsuite for tests that only need to
|
||||
read ELF or DWARF data and if generating the data in the testcase
|
||||
itself is difficult or would be architecture specific.
|
||||
The binaries should be bzip2 compressed. Add a note in the test
|
||||
wrapper run-<testcase>.sh script how to regenerate the binary.
|
||||
|
||||
After sending your patch to the mailinglist one of the committers
|
||||
to the project will review it, give feedback, and if perfect they
|
||||
will commit it for you.
|
||||
|
||||
All patches sent to the mailing list are tracked at
|
||||
https://patchwork.sourceware.org/project/elfutils/list/
|
||||
|
||||
To use this from the command line you can use git-pw
|
||||
https://patchwork.readthedocs.io/projects/git-pw/en/latest/
|
||||
|
||||
For using it with git-pw use these .git/config settings:
|
||||
[pw]
|
||||
server = https://patchwork.sourceware.org/api/1.2/
|
||||
project = elfutils
|
||||
token = <hex-token>
|
||||
states = committed,accepted,superseded,deferred,rejected,under-review
|
||||
|
||||
If you would like to help maintain the pending patch list your
|
||||
patchwork account can be added as maintainer for the elfutils project.
|
||||
|
||||
You can become a maintainer/committer yourself after you have provided
|
||||
at least a handful of accepted patches and agree to the guidelines in
|
||||
this document for creating, reviewing, accepting and committing patches.
|
||||
|
||||
To become a committer you need a sourceware account:
|
||||
https://sourceware.org/cgi-bin/pdw/ps_form.cgi
|
||||
Upload a SSH public key and have an existing maintainer sponsor you
|
||||
for the elfutils group.
|
||||
|
||||
committers can push patches through:
|
||||
ssh://<user>@sourceware.org/git/elfutils.git
|
||||
|
||||
The current webpages published at https://sourceware.org/elfutils/
|
||||
can be checked out with:
|
||||
git clone ssh://<user>@sourceware.org/git/elfutils-htdocs.git
|
||||
Patches should also be posted to the mailinglist.
|
||||
|
||||
As a maintainer/committer you should still post patches as described
|
||||
above. And ideally they are reviewed and approved as above. If no
|
||||
other committer has reviewed or objected to your patch for a week
|
||||
you may use your own judgement whether you ping your patch or push
|
||||
it after "self-review". If you do, you should post a message to the
|
||||
mailinglist that the patch has been pushed.
|
||||
|
||||
committers may also create git branches starting with <nickname>/...
|
||||
patches on these branches are works in progress, so might not be perfect
|
||||
yet, but should follow the above guidelines as much as possible and should
|
||||
be aimed at integration into main. For merging a branch into main
|
||||
the same process as above should be followed by posting the patches
|
||||
to the list first.
|
||||
|
||||
Note that a branch starting with <nickname>/try... will be picked up
|
||||
by the Sourceware buildbot and can be used to test your patches before
|
||||
merging into the main branch:
|
||||
https://builder.sourceware.org/buildbot/#/builders?tags=elfutils-try
|
||||
|
||||
committers/maintainers who repeatedly ignore the above guidelines,
|
||||
are hostile or offensive towards other committers or contributors,
|
||||
and don't correct their behavior after being asked by other committers
|
||||
will be removed as maintainer/committer.
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. 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
|
||||
them 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 prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. 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.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey 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;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
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
|
||||
state 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) <year> <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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program 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, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU 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 Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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) <year> <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.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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) year 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 Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
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 that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser 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 as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,114 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBFxDPtIBEAC8xePaWvq5cDMBYtrpdmR20YX5xrDXUeHgueSVE9Mw8yCan2Cq
|
||||
1Ac1jHYnXxp4Jj3q4tIS9Jq2oAbqxyvBMdJYqEz4z709eDnYBacZQcGqojLh3HI2
|
||||
P7lmmKxkL8rS3Q3Ug05mYT+MwgmRvIO1+kwQTcq1AeB9z9/zikgY1Jv1R86gH8G8
|
||||
4OPbJUowdE/mT3pQ+2UQnarCVPJ3WJtZNDXPRzskk0t5h+Mg5RtX+COoHfsvWHiE
|
||||
UTmHMfynw49GG/YF6jLSVzMlKMz3jdOePIArpm2BNUu8DvEn9at6daKR4Ah+ujDd
|
||||
08l9j8wFhJnenn/9+ENjm9kOGQWOmH/fEIOlMAATVdZEfHVfAWbgICPSrPyi+v3A
|
||||
CE4uEoaw85LgbAAbhzdswlLezLxS7LLTpfDZUFZfkho1MSGXaCQ475/iVAeuxi61
|
||||
B2VcmH4lOSH7HYNkMY8ggGk2/WG35eq8PZme8PvXUmLu+f2jzy9XFekIr+/Ks2Tc
|
||||
hCTYCw6bhSLPa19HapCxvWXgNcYzZ8jULqBXsAfj4NnzBTn6u5nsJ1reA8GoO9vL
|
||||
aQf3LDgr+UY/z+6N474lAVfr0eIdWzkWPvX8fcBCfiB944rPr+Q50RUfc9ngIKP4
|
||||
JsflhXTn601aL4r6qkCcBVqO/eRhb4vCAUo7csemTKzI/05ooGfQtZ3O5QARAQAB
|
||||
tB5NYXJrIFdpZWxhYXJkIDxtYXJrQGtsb21wLm9yZz6JAlEEEwEKADsCGwEFCwkI
|
||||
BwIGFQoJCAsCBBYCAwECHgECF4AWIQTsPP6I9soHiHdPXB0apEvmSd52CgUCXE37
|
||||
mQIZAQAKCRAapEvmSd52CuO9D/9Fi6LOrU+iYHjfIk+wT8jyhF1YNATnooa5W7y/
|
||||
4QlXOIyKmkXM/0faH1hZNGf4qVK4dBUewuhALMEzudkXEhzudg9KpB9SaHZNR5DZ
|
||||
+YHo204zJ84P+aJa7F8FOScbNAiG4pFGC7sQxvtAz0skM0yLsdhNg2tM8lM3n9e/
|
||||
rO4EK7aR55ojzE9pCWhRSx/AKYT7545KzXuCRTky8fRcI8YeNNLPIseoV3QPkf7q
|
||||
Ni6YXl0yUHV5gQMCWqgbfdHAljd2+N1RZvdzfEOLVPLX4/dgxb36i9OKkuCAHLoL
|
||||
2UXfzcAElltHQundNi/xYzSizzEYBeIbVrbuqiJP1zmiPUKxHibkU3ThZZUbonKR
|
||||
NVPQe1hO47Cxyj1RxXl6Nt9uda3W9ow6Kr96Bjs3WVBSqsuohqaAlAxC6RccslrE
|
||||
w/7N7l8S423LJI6ZV+FvyJzmSAqkLNz/tuFSMj76uH4s1dLbRv8K4fcw1vZgqy/4
|
||||
jIhBFycn29hMNvImKbMnLDwC7K92lBGQ6hp75/0Hf1qHOpDaiyV9Qqzr3sTOMXJi
|
||||
Ym3ac5bDqJb9Mi5YPNB2OD3w3bDMGT5+eWjmw9RiYT5gNjY6nZhDiQS/PtIc6l3i
|
||||
2GaBjSdurwj47TlCWALj3ZiiEKiybanK5/YXdVXGchLnoNkxeI1YcANZhX60FWEy
|
||||
aHZsa7QbTWFyayBXaWVsYWFyZCA8bWp3QGdudS5vcmc+iQJOBBMBCgA4FiEE7Dz+
|
||||
iPbKB4h3T1wdGqRL5knedgoFAlxN+lMCGwEFCwkIBwIGFQoJCAsCBBYCAwECHgEC
|
||||
F4AACgkQGqRL5knedgo1bhAArI7kReYq4YtaxS8Pxb5MdPxiQVtvfkbycWCZ4owz
|
||||
PeEIkJqcbadNUiGSqCRR2xeT4kuzFZWILiZfBTwHwFM/bXRDK/FOn7F8aqUAV1tq
|
||||
2W70Z7BUpTwpAv7Xm5YvsfbTBZmllJltEiIrKIzULCtRKKVXgtOKg0sd/W2aXwyl
|
||||
+OX+PVzu4mXXNEkO10J7VpnCvjyaJNeKgeJYQLizSWdEf7i6RX31yC29+GsSqika
|
||||
OHdfxJMM+bo/x/aCuYlgDB+OQ6LZzpXZO0C8B5SMgMfZaK1rxDtUtViajSyOFJ4I
|
||||
g6bcgc5qDCLnk407oEN1yBWps867uN/Bi4Dk+xh691feGsyq95DvPis2Ut+0X0/W
|
||||
i/uLg3uu/X5EcNHynwht7KaGCLeuOZKxvzfeudNeyKFX34HtFyE/2k9LR0mFX8Xn
|
||||
XQGBD9psOxcd2K8Rku9BjjKDZ/vf53sMh5vxUNo+zkd+5dLZWPnLrhkfQrepDBP+
|
||||
Tc/6W0VSZCP5/nKX6GjPwmELtZj4jGf33tgfNMJrmxGUjpDxtiJc7OroNC4he3F5
|
||||
AF4RNRa5VvHs6ah57swVvKyJmLH5mxxKIn39PspOhzVxSbkWNPLS+km2InPum+fm
|
||||
YKQL6IrHcqt/ecrR7o9GRgI0cJjLJ+wv93ti+gxsUWPbAUBaJPk24omIpQafFT/Y
|
||||
AEW0Hk1hcmsgV2llbGFhcmQgPG1qd0ByZWRoYXQuY29tPokCTgQTAQoAOBYhBOw8
|
||||
/oj2ygeId09cHRqkS+ZJ3nYKBQJcTfqnAhsBBQsJCAcCBhUKCQgLAgQWAgMBAh4B
|
||||
AheAAAoJEBqkS+ZJ3nYK6JIP/jGq2adAkk1IPsVx7X5argCXaI5o3aTG+N6BPMvi
|
||||
zGY4CyqTBmYAg3qRPWN4U+wxNFgzQ3nPfptJK6EDBAY4Lw+kKR4o8o5zPyjAjbc9
|
||||
/be5bvTwMFmMbzWxGWoJ4ch9W+wD4W+W8ssnJDbVi5Btp7kKyUgg3KP7oUQpxZ9M
|
||||
TgmKEmPuce9zOQ78q+LIPbkhI9zCS/1VCHkeVyn+TrnACoHx7sKgJoOwjVlcbW3S
|
||||
0sdCuaGg3+VLI3v3IpQ56UXIX6RVeLX9zVDZnAq72Age4HHcxjX97j16iL5ZhZRc
|
||||
24J5tpSkJgHt+RASOKHJGPIivCqKbQKhYc1G4MbFbGzclaLTXya3Q4ekFzo4ohd2
|
||||
ga7mgjG0SJ+aIU5wCYxEUDsqJLm+uH/nbQzXTxIoQhH5yub4OhW88z6LpwPGhLvz
|
||||
S2SuPJIXAlbGyrH70/uRZWkwKF/8mQjMCsLEYkZ9DRB815rUTc9CJkkeOlPXQUbx
|
||||
r2fDAgi0j3yAUxlrC7jESO/zUJrICbxChYAx9KMWG/2PsKbrGAAMKiC7+q6mY09Q
|
||||
63F/g1DEF2sb+bguMdWc7SEj64jFUf9wJ+vjU1F321Bkh/QWMABv6n+7EFkwnNky
|
||||
lCR5H1boOHO03TNT0jyLbBECR7/Mtpwt46c4+n9EPCmQyvdU3MVPORvZge1hzvuv
|
||||
fo22uQENBFxDuhkBCAC19Q021v7kTuwYKwEmbqQC5wvmbEMT4ldvQ8gWCUIFL9kT
|
||||
xM67IF0annsys+rrAyqqFUTq2onVmgjciu9upl6uDdV3wivCBEDN9ZLZAVHTSvii
|
||||
XDhnHUSg6EhCdZKhal9DKAi+vGSLSe14e2Kfoe4c6R0yDVI+Dn0OfUhlMXu2NoDS
|
||||
FLAdHsDHSCrE6xKO+BNgL2MPuMeXLhNitNIVrykoZMkFrUMcMsHrvrk05ah87RQO
|
||||
1e2ljenn8qxPRLdOVWc0TJiosjiy04vwDAYNUCPDL5W2Mp2bv2AeTPCzF1qkDnGK
|
||||
ZEqV2peWKCPB608lS1icw5oKtOl50PSgzTdaLVRXABEBAAGJAjYEGAEKACAWIQTs
|
||||
PP6I9soHiHdPXB0apEvmSd52CgUCXEO6GQIbDAAKCRAapEvmSd52Cpy8D/9tq4BQ
|
||||
3VwrDNCxycALqWvZSPv/AgsT6hRvQsLc6Yp0FEtz+frFPLWt7bylMrzKItpsr0G2
|
||||
FofWw0yNyHNYPmGlCi+SrWLJnUTEm5TZgwT+9kLt/mJ4B0J1gHkknXSo91S84DPa
|
||||
ik9CH0GmXIQyPANkDDlmp9W/Hk8oKxxvCx+SSsZ6ANXakcNVg/w4MhDW2HowW4sB
|
||||
vtltOFSgPRs9zISiNw//GYjeYrdOOnieMhszwpjQuK5XYnDhwiSap2D8nQlD/VpA
|
||||
a2CvE/fOFV2CJyKZfE0J8v5DZOU+SUwnty1f52ZA1s/OCysaK1LLdCXz3bQiybQZ
|
||||
hobcAneBVZFlNzf6xpR+pGtw3OVSyLQo4LSQf4lFszNy8FfE+BJ1/yUWFBjljLwI
|
||||
Hd4IW7Y17PugAc19fQ23krOIc3O4qsuYzqdhzYzqGbPvf7fY3Tz0BNcW5885KEQJ
|
||||
H7VJJLqpf3EELhmkLBONYiF10iggFSmn8WSQWbXm0kGRETvAzf+FYcJsKDu9QASD
|
||||
RNck8J20ZJGVLbZNdP+VuLOXCDAkSGIxi91TLi6bY0Mb2yNRgAq6cnIJUTAbcnw0
|
||||
5BLxRW+e8AS3HodjZHWzAMDPpZn5TFfJOXdDhdeePVGgkypxwnbeyTT3OjUEh37v
|
||||
r+XIgrTMpz+ZNpHxLr4bJatQEVK3H6Q3ZbQkMbkBDQRcQ7q3AQgAqSM4Wx4QvvCI
|
||||
f8is+57mLJhceB2kLt3VR67UFZC0ywcr5V0pvTuu2U1oUB+BVYC/A9UdnvWTyDef
|
||||
3xTCx0hAiiFhlMe6CkODOalmxI+KwPxD276+70tcxd8vR2FJviDQKw96f2hlLAnx
|
||||
R47GUp3cPfIgVfkvIXnXLMUJQvBhXeXqgYhOcAplI677n/zTeFjBtd/JqtyDoJ0D
|
||||
e1odEyC+ZZD/Jo5q80Sydhvb99BHQMgLTJTJPW1iRV2AK4xfBjxOMwqml9Lx4HRI
|
||||
pV/IHs3MTyhEpEA+I/eKpO6UxApHWHZ76Zm8BL8RwnfFaXjMueRhIGMFtJnLuNFc
|
||||
5mOLXa3uhwARAQABiQNsBBgBCgAgFiEE7Dz+iPbKB4h3T1wdGqRL5knedgoFAlxD
|
||||
urcCGwIBQAkQGqRL5knedgrAdCAEGQEKAB0WIQQSdoqWeVmQEHoNL9/8V+PMrNma
|
||||
eAUCXEO6twAKCRD8V+PMrNmaeEvuB/92qMj2mQN3CXRQUTlmzVNUJLJAwzjRDoSt
|
||||
3kqDrACJ2N8JLSxWFeHmEmrrmFPUmXfBUkT+F2W+OrsJlUtwepuTYROgLNZebFQd
|
||||
jB38oqsj8RMKb5ikWntRUka2xhSDRBa0IlpxHBWLHS8nEx1x4HB4uYRK3IpWShAV
|
||||
mWk7jiATGJLFYJGVo4TBfM27zCty8/GQN/3A2DAJ2OJbiJ12ByTgzztGdhJ69H/Q
|
||||
UltkK7eJUGMjPwhpmp07lrolyUurbzaLMQow4SLo/ZIxa0nPC+AoMSk06teichCZ
|
||||
wIyiU/70S0c/uL3RFhnTbgWcdQkAVpWdkwFqIES4xG5QLUu85/WT7lMQALJKKuOO
|
||||
pbOeKvyLV16Oo70OTms/LbmXU9+bjCjz7QISuzhI4rua0onjQzBaRXFYkfCjBudW
|
||||
aEpy/wP5wk6QlqxLkeZNCk0TswksLxQjyO2XgBcOnrSsQIEJ7VICG9PDvtVzbrSB
|
||||
YMjoDo58AyniEMVANyUnFYl1YBlFt506PDh86ZEqlpbbReAsYfEuBQdBfJhWph9W
|
||||
ZgJDVtEHUAxaiqisvNEbz4xRIAsxX/OxnQMdD09Xs50yvl38ERIadacejtQnAIYe
|
||||
EaUBsgQk3rt0+g9lm6trD7P4FXYhUD9vml6/n8TGB3UJi3lKpX41GSUC1y+oPna8
|
||||
p+EEmrm3BbB4fgnIkfYiEDNogvm2pe7nzUP7sNnE8RcyYcjUoEQ0Uo+HB6fk6NeB
|
||||
GKqaIKVexCcExnWKHvl0DZzGydvKx41nyzFI1sueg34LcWwpGHXzJyhmpjhNe1GO
|
||||
KtVGHCGKhKhppK4ntUZISciGh38wvKuFDohHO3JVZ9AhyRWKTuynzLarBpmvu11T
|
||||
Dbv0lfnZcghlWWHNlx8x8DdaEuFWXZTDuVXqGclmeV2hS0LomX33LCB4n0XkZtC9
|
||||
LsmTIsr+ZdVCAXUeX/pJONNxNF8G47lZLLgLWF9beuHWp3u1Io31fzh44TZxm1Z3
|
||||
1wCZjOrsL9bvy3xHyDFaDL+/7i6TXsSxtqTXuQENBFxDu6IBCACgVJJnY8zh8uHn
|
||||
8d/E7p4j+9ueTvTHMRYOS0kkGhHBC7JmxCw6/EvbnbTsI0CQeyIJHlmPIqDVgRVj
|
||||
ijcTWacd3vIdazzH9sqs65nl49yMnA23tIya4VWlbHC3J4x/LL84A4GaJO/FVF2v
|
||||
v6hVg3IGbopp5KX+pr6s56TiWddSDqMgjb7rSzjWuNyRK75ToctL7Y/Zn6st3Zio
|
||||
O7LXq3ghkWf8JR7ZaUFIY6P1qS5heiCHP0PxQJSrtpYzH3rKJoHpIkjxnsB/sD0C
|
||||
05cAdlzXBTUVTNLY+DPlQ7FeRkG+VK91briG4tvQ8ohhEiC9HuJu1AKMNWBZ9qeU
|
||||
wsXaJvNzABEBAAGJAjYEGAEKACAWIQTsPP6I9soHiHdPXB0apEvmSd52CgUCXEO7
|
||||
ogIbIAAKCRAapEvmSd52Ch8ZD/9wKuIlaRMSB1AMCwhGPaqXZahrJ649Y0jI4Jqp
|
||||
FKv2/U5hKHOG7bihRAeEj7pZzhlgBrkZg1SBdZ3vHs1ufElnfe5RQApdDm93daU5
|
||||
SP29iEivJQxKjF91EfEffl0trxxztBipI5/2D+kaS8cnNVfzo5ZEWy/cd6AShvRV
|
||||
HM7Y2QHc+mlaZhYhBvTtwC6avXNnG55WYgobGENeAwkyD072JF3XrxFb+XkcKxla
|
||||
9yRdWdHxJd5PYJqsKM+nVeJM226OwOyU235gfIhIP6pfGqF9UVH0uFoCYkVkUSjV
|
||||
d96Q+Cj0kdhTOrtLW1OY11d9TBxje42GOtc7X9Zzx1nhwU8rCCErF9/uJIJKlq7I
|
||||
08rMX3rFDTtizwN7g7ZBkDDiZO+BIKQPt/awA9NM+tda02hyfQokBBi+v8b/iKif
|
||||
KIfUaqPDo1PA5uxljdluyX8AXIotKjJXF6Elsiz7bVpcIc0ZXOOFr9ylmtZm51YN
|
||||
mOzDNznEBmol2oBZfsk2G55/QgShHmKUnvzKANBGfnfS/a/K7Hv4sfZAb58Prl6O
|
||||
mQSrkmhzFry/4BNLKq+nd4s8VXkJPpx3Ogf3DoIynqpNF0bwf52U5IgJSNcJN/Hr
|
||||
AwhaG1W+Y3LDe7S19M0cUzftEUeq3Jd89hoijC72tdba+BRfW0ncfvEcsk9QifSU
|
||||
1tvZxQ==
|
||||
=l2J7
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
@@ -0,0 +1,368 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command './configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache' and
|
||||
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||
default to prevent problems with accidental use of stale cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version of
|
||||
'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide 'make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here is
|
||||
an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the 'configure' script. 'configure' automatically checks for the source
|
||||
code in the directory that 'configure' is in and in '..'. This is known
|
||||
as a "VPATH" build.
|
||||
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the default
|
||||
for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, 'make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install time
|
||||
for the entire installation to be relocated. The approach of makefile
|
||||
variable overrides for each directory variable is required by the GNU
|
||||
Coding Standards, and ideally causes no recompilation. However, some
|
||||
platforms have known limitations with the semantics of shared libraries
|
||||
that end up requiring recompilation when using this method, particularly
|
||||
noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running './configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running './configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||
is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same timestamps as their
|
||||
prerequisites, which makes it generally unusable when shipped generated
|
||||
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||
try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||
workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used only
|
||||
in the top level, while the 'recursive' variant lists options also
|
||||
present in any nested packages.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names:: for
|
||||
more details, including other options available for fine-tuning the
|
||||
installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
||||
@@ -0,0 +1,102 @@
|
||||
## Process this file with automake to create Makefile.in
|
||||
## Configure input file for elfutils.
|
||||
##
|
||||
## Copyright (C) 1996-2006, 2008, 2009, 2015 Red Hat, Inc.
|
||||
##
|
||||
## This file is part of elfutils.
|
||||
##
|
||||
## This file is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## elfutils 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, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
# automake already tells which subdir is being entered.
|
||||
# Don't make make repeat.
|
||||
AM_MAKEFLAGS = --no-print-directory
|
||||
|
||||
pkginclude_HEADERS = version.h
|
||||
|
||||
SUBDIRS = config lib libelf libcpu backends libebl libdwelf libdwfl libdw \
|
||||
libasm debuginfod src po doc tests
|
||||
|
||||
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING SECURITY \
|
||||
COPYING COPYING-GPLV2 COPYING-LGPLV3
|
||||
|
||||
# Make sure the test install uses lib64 when $LIB will yield lib64.
|
||||
# Make sure the test build uses the same compiler, which on e.g. ppc64
|
||||
# determines which platform we are actually testing.
|
||||
# Run all tests under valgrind.
|
||||
AM_DISTCHECK_CONFIGURE_FLAGS = \
|
||||
--libdir=`echo $(libdir) | sed "s,^$(exec_prefix),$$dc_install_base,"`\
|
||||
CC="$(CC)"
|
||||
|
||||
distcheck-hook:
|
||||
chmod -R u+w $(distdir)
|
||||
|
||||
rpm: dist
|
||||
rpmbuild -ts elfutils-@PACKAGE_VERSION@.tar.bz2
|
||||
|
||||
if GCOV
|
||||
|
||||
COVERAGE_OUTPUT_FILE = $(PACKAGE_NAME).lcov
|
||||
COVERAGE_OUTPUT_DIRECTORY = coverage
|
||||
COVERAGE_OUTPUT_INDEX_HTML = $(COVERAGE_OUTPUT_DIRECTORY)/index.html
|
||||
COVERAGE_TITLE = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
|
||||
|
||||
COVERAGE_DIRS = $(filter-out tests,$(SUBDIRS))
|
||||
src_COVERAGE_DIRS = $(patsubst %,$(srcdir)/%,$(COVERAGE_DIRS))
|
||||
build_COVERAGE_DIRS = $(patsubst %,$(builddir)/%,$(COVERAGE_DIRS))
|
||||
all_COVERAGE_DIRS = $(sort $(src_COVERAGE_DIRS) $(build_COVERAGE_DIRS))
|
||||
LCOV_DIRS_ARGS = $(patsubst %,--directory=%,$(all_COVERAGE_DIRS))
|
||||
|
||||
CLEANFILES = $(COVERAGE_OUTPUT_FILE)
|
||||
|
||||
.PHONY: coverage coverage-clean
|
||||
|
||||
clean-local: coverage-clean
|
||||
distclean-local: coverage-clean
|
||||
|
||||
coverage-clean:
|
||||
-rm -rf $(COVERAGE_OUTPUT_DIRECTORY)
|
||||
|
||||
coverage: $(COVERAGE_OUTPUT_INDEX_HTML)
|
||||
@echo 'file://$(abs_builddir)/$(COVERAGE_OUTPUT_INDEX_HTML)'
|
||||
|
||||
$(COVERAGE_OUTPUT_INDEX_HTML): $(COVERAGE_OUTPUT_FILE)
|
||||
LC_ALL=C $(GENHTML) \
|
||||
--legend \
|
||||
--show-details \
|
||||
--rc=genhtml_branch_coverage=1 \
|
||||
--title='$(COVERAGE_TITLE)' \
|
||||
--prefix='$(abspath $(abs_srcdir))' \
|
||||
--prefix='$(realpath $(abs_srcdir))' \
|
||||
--prefix='$(abspath $(abs_builddir)/..)' \
|
||||
--prefix='$(realpath $(abs_builddir)/..)' \
|
||||
--output-directory='$(COVERAGE_OUTPUT_DIRECTORY)' \
|
||||
$<
|
||||
|
||||
$(COVERAGE_OUTPUT_FILE):
|
||||
$(LCOV) \
|
||||
--capture \
|
||||
--no-external \
|
||||
--no-checksum \
|
||||
--rc=lcov_branch_coverage=1 \
|
||||
--gcov-tool='$(GCOV)' \
|
||||
--output-file='$@' \
|
||||
$(LCOV_DIRS_ARGS)
|
||||
|
||||
endif
|
||||
|
||||
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||
# directory in parallel.
|
||||
.NOTPARALLEL:
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
||||
Fundamental design decision:
|
||||
|
||||
- the sizes of external and internal types are assumed to be the same.
|
||||
This leaves byte ordering aside. While assuming this the code can be
|
||||
greatly simplified and speed increases. Since no change violating this
|
||||
assumption is in sight this is believed to be a worthwhile optimization.
|
||||
|
||||
- the ABI of the backend modules is not guaranteed. Really, no guarantee
|
||||
whatsoever. We are enforcing this in the code. The modules and their
|
||||
users must match. No third-party EBL module are supported or allowed.
|
||||
The only reason there are separate modules is to not have the code for
|
||||
all architectures in all the binaries.
|
||||
|
||||
- although the public libraries (libasm, libdw) have a stable API and are
|
||||
backwards ABI compatible they, and the elfutils tools, do depend on each
|
||||
others internals, and on internals of libelf to provide their interfaces.
|
||||
So they should always be upgraded in lockstep when packaging the tools
|
||||
and libraries separately. For one example of how to do that, see the
|
||||
config/elfutils.spec.
|
||||
|
||||
Some notes:
|
||||
|
||||
- old GNU ld's behavior wrt DSOs seems to be severely broken.
|
||||
|
||||
y.o reference foo()
|
||||
y1.o defines foo(), references bar()
|
||||
y2.o defines bar()
|
||||
libbar.so defines bar()
|
||||
|
||||
Running
|
||||
|
||||
gcc -o y y.o -lbar y1.o y2.o
|
||||
|
||||
uses the bar() definition from libbar.so and does not mention the definition
|
||||
in y2.o at all (no duplicate symbol message). Correct is to use the
|
||||
definition in y2.o.
|
||||
|
||||
|
||||
y.o reference foo()
|
||||
y1.o defines foo(), references bar()
|
||||
y2.o in liby2.a defines bar()
|
||||
libbar.so defines bar()
|
||||
|
||||
Running
|
||||
|
||||
gcc -o y y.o -lbar y1.o -ly3
|
||||
|
||||
has to use the definition in -lbar and not pull the definition from liby3.a.
|
||||
|
||||
|
||||
- the old linker follows DT_NEEDED entries and adds the objects referenced
|
||||
this way which define a symbol which is needed as a DT_NEEDED to the
|
||||
generated binary. This is wrong since the DT_NEEDED changes the search
|
||||
path in the object (which is breadth first).
|
||||
|
||||
|
||||
- the old linker supported extern "C++", extern "java" in version scripts.
|
||||
I believe this implementation is severely broken and needs a redesign
|
||||
(how do wildcards work with these languages*?). Therefore it is left
|
||||
out for now.
|
||||
|
||||
|
||||
- what should happen if two sections in different files with the same
|
||||
name have different types and/or the flags are different
|
||||
|
||||
|
||||
- section names in input files are mostly irrelevant. Exceptions:
|
||||
|
||||
.comment/SHT_PROGBITS in strip, ld
|
||||
|
||||
.debug \
|
||||
.line |
|
||||
.debug_srcinfo |
|
||||
.debug_sfnames |
|
||||
.debug_aranges |
|
||||
.debug_pubnames |
|
||||
.debug_info |
|
||||
.debug_abbrev |
|
||||
.debug_line |
|
||||
.debug_abbrev > DWARF sections in ld
|
||||
.debug_line |
|
||||
.debug_frame |
|
||||
.debug_str |
|
||||
.debug_loc |
|
||||
.debug_macinfo |
|
||||
.debug_weaknames |
|
||||
.debug_funcnames |
|
||||
.debug_typenames |
|
||||
.debug_varnames /
|
||||
|
||||
Sections created in output files follow the naming of special section
|
||||
from the gABI.
|
||||
|
||||
In no place is a section solely identified by its name. Internal
|
||||
references always use the section index.
|
||||
@@ -0,0 +1,33 @@
|
||||
The elfutils project provides libraries and tools for ELF files and DWARF data.
|
||||
|
||||
The project home is http://elfutils.org/
|
||||
|
||||
Releases are published at ftp://sourceware.org/pub/elfutils/
|
||||
Which can also be found at https://sourceware.org/elfutils/ftp/
|
||||
|
||||
To build a release do: ./configure && make && make check
|
||||
Please check the configure summary to make sure all recommended
|
||||
features are enabled. There should be no failures after make check.
|
||||
|
||||
Please reports bugs at https://sourceware.org/bugzilla/
|
||||
|
||||
The current elfutils source code can be checked out with
|
||||
git clone git://sourceware.org/git/elfutils.git
|
||||
|
||||
To build a git checkout do:
|
||||
autoreconf -i -f && \
|
||||
./configure --enable-maintainer-mode && \
|
||||
make && make check
|
||||
|
||||
The developer mailinglist to send patches to is
|
||||
elfutils-devel@sourceware.org.
|
||||
https://sourceware.org/ml/elfutils-devel/
|
||||
|
||||
To subscribe send an email to elfutils-devel-subscribe@sourceware.org
|
||||
Or use the form at https://sourceware.org/mailman/listinfo/elfutils-devel
|
||||
|
||||
See the CONTRIBUTING file for how to propose patches to the code.
|
||||
|
||||
See the NOTES files for some design decisions and notes.
|
||||
|
||||
See the SECURITY file for defining and handling security-sensitive bugs.
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
The elfutils library and utilities aim to be generally robust and
|
||||
reliable. However, elfutils routinely processes complex binary
|
||||
structured data. This makes the code intricate and sometimes brittle.
|
||||
While elfutils developers use a variety of static and dynamic checker
|
||||
software (valgrind, sanitizers) in testing, bugs may remain. Some of
|
||||
these bugs may have security-related implications.
|
||||
|
||||
|
||||
While many errors are cleanly detected at runtime, it is possible that
|
||||
vulnerabilities exist that could be exploitable. These may arise from
|
||||
crafted / fuzzed / erroneous inputs, or perhaps even from valid inputs
|
||||
with unforseen characteristics. Therefore, to minimize risks, users
|
||||
of elfutils tools and libraries should consider measures such as:
|
||||
|
||||
- avoiding running complex elfutils analysis on untrustworthy inputs
|
||||
- avoiding running elfutils tools as privileged processes
|
||||
- applying common platform level protection mechanisms such as
|
||||
selinux, syscall filtering, hardened compilation, etc.
|
||||
|
||||
Since most elfutils tools are run in short-lived, local, interactive,
|
||||
development context rather than remotely "in production", we generally
|
||||
treat malfunctions as ordinary bugs rather than security vulnerabilities.
|
||||
|
||||
|
||||
Elfutils includes one network client/server: debuginfod. The
|
||||
debuginfod man page contains a SECURITY section outlining the general
|
||||
risks. tl;dr: many classes of server problems are delegated to
|
||||
front-end proxies and curated elf/dwarf archives of the operator;
|
||||
others to careful configuration of the debuginfod client. These are
|
||||
not generally reportable as security vulnerabilities. However, we are
|
||||
likely to accept security vulnerability reports related to:
|
||||
|
||||
- availability: e.g., remotely exploitable server crash, but not
|
||||
routine resource exhaustion or overload; client crash due to
|
||||
unexpected valid traffic from trusted server
|
||||
|
||||
- confidentiality: e.g., allowing the server to expose one client's
|
||||
traffic to another client
|
||||
|
||||
- integrity: e.g., causing the server to send erroneous
|
||||
elf/dwarf/source data across the webapi; causing the client to
|
||||
corrupt its cache to lose file integrity
|
||||
|
||||
We welcome reports that are tangential to any of these subjects.
|
||||
|
||||
Please report bugs via any of:
|
||||
- email to <elfutils-devel@sourceware.org>
|
||||
- https://sourceware.org/bugzilla/enter_bug.cgi?product=elfutils
|
||||
|
||||
After considering the above exclusions, please report suspected
|
||||
security vulnerabilities confidentially via any of:
|
||||
|
||||
- email to <mark@klomp.org>
|
||||
- email to <fche@elastic.org>
|
||||
- email to <secalert@redhat.com>
|
||||
@@ -0,0 +1,6 @@
|
||||
At least the following have submitted valuable patches:
|
||||
|
||||
Jeff Johnson building. rpm wrestling
|
||||
Alexander Larsson separate debug info
|
||||
Jakub Jelinek bug fixes, testing
|
||||
Denys Vlasenko bug fuxes
|
||||
@@ -0,0 +1,195 @@
|
||||
ToDo list for elfutils -*-outline-*-
|
||||
----------------------
|
||||
|
||||
Time-stamp: <2009-02-05 22:08:01 drepper>
|
||||
|
||||
* mkinstalldirs
|
||||
|
||||
Remove everywhere. Use mkdir -p.
|
||||
|
||||
* libelf:
|
||||
|
||||
** verify section
|
||||
|
||||
Currently the elf_update function trusts the user blindly if the
|
||||
ELF_F_LAYOUT flag is set. This is OK if the data is prepared by a
|
||||
ELF_C_NULL call but not if the user prepared the data herself
|
||||
|
||||
** break out archive handling from elf_begin
|
||||
|
||||
The handling of archives (especially of the symbol tables) must be
|
||||
broken out of elf_begin. There are several different forms of
|
||||
archives and only when having the archive handling separately this
|
||||
remains maintainable.
|
||||
|
||||
** shdrs in read-only files
|
||||
|
||||
When reading (ELF_C_READ*) then there is no need to malloc Shdr
|
||||
structure in elfXX_getshdr if file is mmaped and unaligned access
|
||||
is allowed or the structure is aligned. Use ELF_F_MALLOCED flag
|
||||
to differentiate.
|
||||
|
||||
** shdrs after elf_cntl (ELF_C_FDREAD)
|
||||
|
||||
Similar to the above. After ELF_C_FDREAD the file is completely
|
||||
in memory. See also this mailing list thread:
|
||||
https://fedorahosted.org/pipermail/elfutils-devel/2012-July/002368.html
|
||||
|
||||
* libdw
|
||||
|
||||
** More memory access checks needed
|
||||
|
||||
All accesses to the debug sections should make sure the offsets are
|
||||
valid. This is currently especially a problem with leb128 accesses.
|
||||
|
||||
** Low level macro information operations
|
||||
|
||||
in 5.11.3 are not implemented. gcc currently does not emit this
|
||||
information so I cannot test it.
|
||||
|
||||
** Rename dwarf_getabbrev
|
||||
|
||||
|
||||
* libcpu
|
||||
|
||||
** x86
|
||||
|
||||
*** Opcodes
|
||||
|
||||
crc32
|
||||
extractps
|
||||
pextrb
|
||||
pextrd/pextrq
|
||||
pextrw
|
||||
pinsrq
|
||||
popcnt 64-bit reg
|
||||
|
||||
* nm:
|
||||
|
||||
** add demangler support
|
||||
|
||||
Use demangler from libiberty.
|
||||
|
||||
** add support to read debugging symbols
|
||||
|
||||
Implement -l option for BSD and POSIX format
|
||||
|
||||
|
||||
* strip:
|
||||
|
||||
** support SHT_SYMTAB_SHNDX
|
||||
|
||||
should be removed if not needed anymore
|
||||
|
||||
* ld:
|
||||
|
||||
** sanity check .rel sh_info content
|
||||
|
||||
the sh_info of all .rel sections with the same name must point to
|
||||
sections which also have the same name
|
||||
|
||||
** use ld.so.conf
|
||||
|
||||
to locate shared libraries also use /etc/ld.so.conf
|
||||
|
||||
** handle object files for different architectures
|
||||
|
||||
ld.so is expected to ignore object files for different architectures and
|
||||
continue looking for a matching file (e.g., ignore 32-bit binaries on
|
||||
64-bit platforms and vice versa). We probably need the same in ld.
|
||||
|
||||
** reuse after elf_end
|
||||
|
||||
Some files are closed using elf_end. They are removed from memory only
|
||||
if no reference is left (especially for archives this is a problem).
|
||||
The old mapping should be reused in that case. The problem is worse
|
||||
for files which are not mapped read-only (archives again).
|
||||
|
||||
** size for STT_SECTION entries
|
||||
|
||||
The STT_SECTION entries have zero for the size but can easily get
|
||||
the size of the section.
|
||||
|
||||
** .eh_frame_hdr
|
||||
|
||||
Not implemented at all in the moment except for recognition of the option
|
||||
itself.
|
||||
|
||||
** variables with aliases in executables
|
||||
|
||||
When linking an executable with a references against a variable in a
|
||||
DSO, create symbol table entries for all the aliases of the variable
|
||||
in the DSO and create a relocation for one of them (a non-weak
|
||||
definition)
|
||||
|
||||
* elflint
|
||||
|
||||
** additional checks
|
||||
|
||||
1st GOT entry == _DYNAMIC
|
||||
|
||||
check versioning info:
|
||||
|
||||
always BASE in verdef
|
||||
sh_size/sh_entsize matches last offset != 0
|
||||
|
||||
check whether any relocation is for a merge-able section
|
||||
|
||||
check TLS relocation dependencies
|
||||
|
||||
Check content of .eh_frame_hdr, .eh_frame, .gcc_except_table
|
||||
|
||||
*** for x86
|
||||
|
||||
check that R_386_TLS_GD is followed by R_386_PLT32 for __tls_get_addr
|
||||
|
||||
** relax
|
||||
|
||||
prelink generated files
|
||||
|
||||
* elfcmp
|
||||
|
||||
** treat relocation sections special
|
||||
|
||||
Differences in the relocation sections can be ignored if all
|
||||
the same symbols with the same targets are present and the order
|
||||
of overlapping relocations doesn't change. There really never
|
||||
should be overlapping relocations but who knows.
|
||||
|
||||
* mcs
|
||||
|
||||
Sun has it. Can modify sections which are not in segments.
|
||||
|
||||
-a string
|
||||
Append string to the comment section of the ELF object
|
||||
files. If string contains embedded blanks, it must be
|
||||
enclosed in quotation marks.
|
||||
|
||||
-c Compress the contents of the comment section of the
|
||||
ELF object files. All duplicate entries are removed.
|
||||
The ordering of the remaining entries is not dis-
|
||||
turbed.
|
||||
|
||||
-d Delete the contents of the comment section from the
|
||||
ELF object files. The section header for the comment
|
||||
section is also removed.
|
||||
|
||||
-n name
|
||||
Specify the name of the comment section to access if
|
||||
other than .comment. By default, mcs deals with the
|
||||
section named .comment. This option can be used to
|
||||
specify another section. mcs can take multiple -n
|
||||
options to allow for specification of multiple sec-
|
||||
tion comments.
|
||||
|
||||
-p Print the contents of the comment section on the stan-
|
||||
dard output. Each section printed is tagged by the
|
||||
name of the file from which it was extracted, using
|
||||
the format file[member_name]: for archive files and
|
||||
file: for other files.
|
||||
|
||||
-V Print on standard error the version number of mcs.
|
||||
|
||||
Local Variables:
|
||||
eval:(hide-sublevels 3)
|
||||
End:
|
||||
+1603
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,118 @@
|
||||
## Process this file with automake to create Makefile.in
|
||||
##
|
||||
## Copyright (C) 2000-2010, 2013, 2014 Red Hat, Inc.
|
||||
## Copyright (C) 2012 Tilera Corporation
|
||||
## This file is part of elfutils.
|
||||
##
|
||||
## This file is free software; you can redistribute it and/or modify
|
||||
## it under the terms of either
|
||||
##
|
||||
## * the GNU Lesser General Public License as published by the Free
|
||||
## Software Foundation; either version 3 of the License, or (at
|
||||
## your option) any later version
|
||||
##
|
||||
## or
|
||||
##
|
||||
## * 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
|
||||
##
|
||||
## or both in parallel, as here.
|
||||
##
|
||||
## elfutils 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 copies of the GNU General Public License and
|
||||
## the GNU Lesser General Public License along with this program. If
|
||||
## not, see <http://www.gnu.org/licenses/>.
|
||||
include $(top_srcdir)/config/eu.am
|
||||
if BUILD_STATIC
|
||||
AM_CFLAGS += $(fpic_CFLAGS)
|
||||
endif
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
|
||||
-I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
|
||||
|
||||
noinst_LIBRARIES = libebl_backends.a libebl_backends_pic.a
|
||||
|
||||
modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
|
||||
m68k bpf riscv csky loongarch arc
|
||||
|
||||
i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \
|
||||
i386_retval.c i386_regs.c i386_auxv.c \
|
||||
i386_initreg.c i386_unwind.c
|
||||
|
||||
sh_SRCS = sh_init.c sh_symbol.c sh_corenote.c sh_regs.c sh_retval.c
|
||||
|
||||
x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c x86_64_cfi.c \
|
||||
x86_64_retval.c x86_64_regs.c x86_64_initreg.c \
|
||||
x86_64_unwind.c x32_corenote.c
|
||||
|
||||
|
||||
ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c
|
||||
|
||||
alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \
|
||||
alpha_corenote.c alpha_auxv.c
|
||||
|
||||
arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \
|
||||
arm_auxv.c arm_attrs.c arm_retval.c arm_cfi.c arm_initreg.c \
|
||||
arm_machineflagname.c
|
||||
|
||||
aarch64_SRCS = aarch64_init.c aarch64_regs.c aarch64_symbol.c \
|
||||
aarch64_corenote.c aarch64_retval.c aarch64_cfi.c \
|
||||
aarch64_initreg.c aarch64_unwind.c
|
||||
|
||||
sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \
|
||||
sparc_corenote.c sparc64_corenote.c sparc_auxv.c sparc_attrs.c \
|
||||
sparc_cfi.c sparc_initreg.c
|
||||
|
||||
ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \
|
||||
ppc_corenote.c ppc_auxv.c ppc_attrs.c \
|
||||
ppc_cfi.c ppc_initreg.c
|
||||
|
||||
ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c ppc64_corenote.c \
|
||||
ppc64_unwind.c ppc64_resolve_sym.c
|
||||
|
||||
s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c \
|
||||
s390_corenote.c s390x_corenote.c s390_cfi.c s390_initreg.c \
|
||||
s390_unwind.c
|
||||
|
||||
m68k_SRCS = m68k_init.c m68k_symbol.c m68k_regs.c \
|
||||
m68k_retval.c m68k_corenote.c m68k_cfi.c m68k_initreg.c
|
||||
|
||||
# m68k prstatus core notes are described by a packed structure
|
||||
# which has not naturally aligned fields. Since we don't access
|
||||
# these fields directly, but take their offset to be used later
|
||||
# to extract the data through elfxx_xlatetom/memmove, this isn't
|
||||
# an issue.
|
||||
m68k_corenote_no_Wpacked_not_aligned = yes
|
||||
|
||||
bpf_SRCS = bpf_init.c bpf_regs.c bpf_symbol.c
|
||||
|
||||
riscv_SRCS = riscv_init.c riscv_symbol.c riscv_cfi.c riscv_regs.c \
|
||||
riscv_initreg.c riscv_corenote.c riscv64_corenote.c riscv_retval.c
|
||||
|
||||
csky_SRCS = csky_attrs.c csky_init.c csky_symbol.c csky_cfi.c \
|
||||
csky_regs.c csky_initreg.c csky_corenote.c
|
||||
|
||||
loongarch_SRCS = loongarch_init.c loongarch_symbol.c loongarch_cfi.c \
|
||||
loongarch_regs.c loongarch_retval.c loongarch_initreg.c \
|
||||
loongarch_unwind.c loongarch_corenote.c
|
||||
|
||||
arc_SRCS = arc_init.c arc_symbol.c
|
||||
|
||||
libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
|
||||
$(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
|
||||
$(aarch64_SRCS) $(sparc_SRCS) $(ppc_SRCS) \
|
||||
$(ppc64_SRCS) $(s390_SRCS) \
|
||||
$(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) \
|
||||
$(loongarch_SRCS) $(arc_SRCS)
|
||||
|
||||
libebl_backends_pic_a_SOURCES =
|
||||
am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os)
|
||||
|
||||
noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
|
||||
EXTRA_DIST = $(modules:=_reloc.def)
|
||||
|
||||
MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,85 @@
|
||||
/* arm64 ABI-specified defaults for DWARF CFI.
|
||||
Copyright (C) 2013, 2018 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND aarch64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* ABI-specified state of DWARF CFI based on:
|
||||
|
||||
"DWARF for the ARM 64 bit architecture (AArch64) 1.0"
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadwarf64.pdf
|
||||
|
||||
"Procedure Call Standard for the ARM 64 bit Architecture 1.0"
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf
|
||||
*/
|
||||
|
||||
int
|
||||
aarch64_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
|
||||
{
|
||||
static const uint8_t abi_cfi[] =
|
||||
{
|
||||
/* The initial Canonical Frame Address is the value of the
|
||||
Stack Pointer (r31) as setup in the previous frame. */
|
||||
DW_CFA_def_cfa, ULEB128_7 (30), ULEB128_7 (0),
|
||||
|
||||
#define SV(n) DW_CFA_same_value, ULEB128_7 (n)
|
||||
/* Callee-saved regs r19-r28. */
|
||||
SV (19), SV (20), SV (21), SV (22), SV (23),
|
||||
SV (24), SV (25), SV (26), SV (27), SV (28),
|
||||
|
||||
/* The Frame Pointer (FP, r29) and Link Register (LR, r30). */
|
||||
SV (29), SV (30),
|
||||
|
||||
/* The Stack Pointer (r31) is restored from CFA address by default. */
|
||||
DW_CFA_val_offset, ULEB128_7 (31), ULEB128_7 (0),
|
||||
|
||||
/* Callee-saved fpregs v8-v15. v0 == 64. */
|
||||
SV (72), SV (73), SV (74), SV (75),
|
||||
SV (76), SV (77), SV (78), SV (79),
|
||||
#undef SV
|
||||
|
||||
/* XXX Note: registers intentionally unused by the program,
|
||||
for example as a consequence of the procedure call standard
|
||||
should be initialized as if by DW_CFA_same_value. */
|
||||
};
|
||||
|
||||
abi_info->initial_instructions = abi_cfi;
|
||||
abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
|
||||
abi_info->data_alignment_factor = -4;
|
||||
|
||||
abi_info->return_address_register = 30; /* lr. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
/* AArch64 specific core note handling.
|
||||
Copyright (C) 2013 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define BACKEND aarch64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
#define ULONG uint64_t
|
||||
#define PID_T int32_t
|
||||
#define UID_T uint32_t
|
||||
#define GID_T uint32_t
|
||||
#define ALIGN_ULONG 8
|
||||
#define ALIGN_PID_T 4
|
||||
#define ALIGN_UID_T 4
|
||||
#define ALIGN_GID_T 4
|
||||
#define TYPE_ULONG ELF_T_XWORD
|
||||
#define TYPE_PID_T ELF_T_SWORD
|
||||
#define TYPE_UID_T ELF_T_WORD
|
||||
#define TYPE_GID_T ELF_T_WORD
|
||||
|
||||
#define PRSTATUS_REGS_SIZE (34 * 8)
|
||||
|
||||
static const Ebl_Register_Location prstatus_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 0, .count = 32, .bits = 64 }, /* x0..x30, sp */
|
||||
};
|
||||
|
||||
#define PRSTATUS_REGSET_ITEMS \
|
||||
{ \
|
||||
.name = "pc", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ PRSTATUS_REGS_SIZE - 16), \
|
||||
.group = "register", \
|
||||
.pc_register = true \
|
||||
}, \
|
||||
{ \
|
||||
.name = "pstate", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ PRSTATUS_REGS_SIZE - 8), \
|
||||
.group = "register" \
|
||||
}
|
||||
|
||||
static const Ebl_Register_Location aarch64_fpregset_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 64, .count = 32, .bits = 128 }, /* v0..v31 */
|
||||
};
|
||||
|
||||
static const Ebl_Core_Item aarch64_fpregset_items[] =
|
||||
{
|
||||
{
|
||||
.name = "fpsr", .type = ELF_T_WORD, .format = 'x',
|
||||
.offset = 512, .group = "register"
|
||||
},
|
||||
{
|
||||
.name = "fpcr", .type = ELF_T_WORD, .format = 'x',
|
||||
.offset = 516, .group = "register"
|
||||
}
|
||||
};
|
||||
|
||||
static const Ebl_Core_Item aarch64_tls_items[] =
|
||||
{
|
||||
{
|
||||
.name = "tls", .type = ELF_T_XWORD, .format = 'x',
|
||||
.offset = 0, .group = "register"
|
||||
}
|
||||
};
|
||||
|
||||
static const Ebl_Core_Item aarch64_syscall_items [] =
|
||||
{
|
||||
{
|
||||
.name = "syscall", .type = ELF_T_WORD, .format = 'x',
|
||||
.offset = 0, .group = "register"
|
||||
}
|
||||
};
|
||||
|
||||
#define AARCH64_HWBP_REG(KIND, N) \
|
||||
{ \
|
||||
.name = "DBG" KIND "VR" #N "_EL1", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = 8 + N * 16, .group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "DBG" KIND "CR" #N "_EL1", .type = ELF_T_WORD, .format = 'x', \
|
||||
.offset = 16 + N * 16, .group = "register" \
|
||||
}
|
||||
|
||||
#define AARCH64_BP_WP_GROUP(KIND, NAME) \
|
||||
static const Ebl_Core_Item NAME[] = \
|
||||
{ \
|
||||
{ \
|
||||
.name = "dbg_info", .type = ELF_T_WORD, .format = 'x', \
|
||||
.offset = 0, .group = "control" \
|
||||
}, \
|
||||
/* N.B.: 4 bytes of padding here. */ \
|
||||
\
|
||||
AARCH64_HWBP_REG(KIND, 0), \
|
||||
AARCH64_HWBP_REG(KIND, 1), \
|
||||
AARCH64_HWBP_REG(KIND, 2), \
|
||||
AARCH64_HWBP_REG(KIND, 3), \
|
||||
AARCH64_HWBP_REG(KIND, 4), \
|
||||
AARCH64_HWBP_REG(KIND, 5), \
|
||||
AARCH64_HWBP_REG(KIND, 6), \
|
||||
AARCH64_HWBP_REG(KIND, 7), \
|
||||
AARCH64_HWBP_REG(KIND, 8), \
|
||||
AARCH64_HWBP_REG(KIND, 9), \
|
||||
AARCH64_HWBP_REG(KIND, 10), \
|
||||
AARCH64_HWBP_REG(KIND, 11), \
|
||||
AARCH64_HWBP_REG(KIND, 12), \
|
||||
AARCH64_HWBP_REG(KIND, 13), \
|
||||
AARCH64_HWBP_REG(KIND, 14), \
|
||||
AARCH64_HWBP_REG(KIND, 15), \
|
||||
\
|
||||
/* The DBGBVR+DBGBCR pair only takes 12 bytes. There are 4 bytes \
|
||||
of padding at the end of each pair. The item formatter in \
|
||||
readelf can skip those, but the missing 4 bytes at the end of \
|
||||
the whole block cause it to assume the whole item bunch \
|
||||
repeats, so it loops around to read more. Insert an explicit \
|
||||
(but invisible) padding word. */ \
|
||||
{ \
|
||||
.name = "", .type = ELF_T_WORD, .format = 'h', \
|
||||
.offset = 260, .group = "register" \
|
||||
} \
|
||||
}
|
||||
|
||||
AARCH64_BP_WP_GROUP ("B", aarch64_hw_bp_items);
|
||||
AARCH64_BP_WP_GROUP ("W", aarch64_hw_wp_items);
|
||||
|
||||
#undef AARCH64_BP_WP_GROUP
|
||||
#undef AARCH64_HWBP_REG
|
||||
|
||||
#define EXTRA_NOTES \
|
||||
EXTRA_REGSET_ITEMS (NT_FPREGSET, 528, \
|
||||
aarch64_fpregset_regs, aarch64_fpregset_items) \
|
||||
EXTRA_ITEMS (NT_ARM_TLS, 8, aarch64_tls_items) \
|
||||
EXTRA_ITEMS (NT_ARM_HW_BREAK, 264, aarch64_hw_bp_items) \
|
||||
EXTRA_ITEMS (NT_ARM_HW_WATCH, 264, aarch64_hw_wp_items) \
|
||||
EXTRA_ITEMS (NT_ARM_SYSTEM_CALL, 4, aarch64_syscall_items)
|
||||
|
||||
#include "linux-core-note.c"
|
||||
@@ -0,0 +1,66 @@
|
||||
/* Initialization of AArch64 specific backend library.
|
||||
Copyright (C) 2013, 2017 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND aarch64_
|
||||
#define RELOC_PREFIX R_AARCH64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on aarch64_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
|
||||
Ebl *
|
||||
aarch64_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
/* We handle it. */
|
||||
aarch64_init_reloc (eh);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, core_note);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, return_value_location);
|
||||
HOOK (eh, check_special_symbol);
|
||||
HOOK (eh, dynamic_tag_name);
|
||||
HOOK (eh, dynamic_tag_check);
|
||||
HOOK (eh, data_marker_symbol);
|
||||
HOOK (eh, abi_cfi);
|
||||
|
||||
/* X0-X30 (31 regs) + SP + 1 Reserved + ELR, 30 Reserved regs (34-43)
|
||||
+ V0-V31 (32 regs, least significant 64 bits only)
|
||||
+ ALT_FRAME_RETURN_COLUMN (used when LR isn't used) = 97 DWARF regs. */
|
||||
eh->frame_nregs = 97;
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
HOOK (eh, unwind);
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/* Fetch live process registers from TID.
|
||||
Copyright (C) 2013, 2014 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include <assert.h>
|
||||
#if defined(__aarch64__) && defined(__linux__)
|
||||
# include <linux/uio.h>
|
||||
# include <sys/user.h>
|
||||
# include <sys/ptrace.h>
|
||||
/* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
|
||||
# ifndef HAVE_SYS_USER_REGS
|
||||
# define user_regs_struct user_pt_regs
|
||||
# define user_fpsimd_struct user_fpsimd_state
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define BACKEND aarch64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
bool
|
||||
aarch64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc __attribute__ ((unused)),
|
||||
void *arg __attribute__ ((unused)))
|
||||
{
|
||||
#if !defined(__aarch64__) || !defined(__linux__)
|
||||
return false;
|
||||
#else /* __aarch64__ */
|
||||
|
||||
/* General registers. */
|
||||
struct user_regs_struct gregs;
|
||||
struct iovec iovec;
|
||||
iovec.iov_base = &gregs;
|
||||
iovec.iov_len = sizeof (gregs);
|
||||
if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec) != 0)
|
||||
return false;
|
||||
|
||||
/* X0..X30 plus SP. */
|
||||
if (! setfunc (0, 32, (Dwarf_Word *) &gregs.regs[0], arg))
|
||||
return false;
|
||||
|
||||
/* PC. */
|
||||
if (! setfunc (-1, 1, (Dwarf_Word *) &gregs.pc, arg))
|
||||
return false;
|
||||
|
||||
/* ELR cannot be found. */
|
||||
|
||||
/* FP registers (only 64bits are used). */
|
||||
struct user_fpsimd_struct fregs;
|
||||
iovec.iov_base = &fregs;
|
||||
iovec.iov_len = sizeof (fregs);
|
||||
if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec) != 0)
|
||||
return false;
|
||||
|
||||
Dwarf_Word dwarf_fregs[32];
|
||||
for (int r = 0; r < 32; r++)
|
||||
dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF;
|
||||
|
||||
if (! setfunc (64, 32, dwarf_fregs, arg))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
#endif /* __aarch64__ */
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/* Register names and numbers for AArch64 DWARF.
|
||||
Copyright (C) 2013, 2014 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define BACKEND aarch64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
__attribute__ ((format (printf, 7, 8)))
|
||||
static ssize_t
|
||||
do_regtype (const char *setname, int type,
|
||||
const char **setnamep, int *typep,
|
||||
char *name, size_t namelen, const char *fmt, ...)
|
||||
{
|
||||
*setnamep = setname;
|
||||
*typep = type;
|
||||
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
int s = vsnprintf (name, namelen, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (s < 0 || (unsigned) s >= namelen)
|
||||
return -1;
|
||||
return s + 1;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
aarch64_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setnamep,
|
||||
int *bits, int *typep)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 128;
|
||||
|
||||
|
||||
*prefix = "";
|
||||
*bits = 64;
|
||||
|
||||
#define regtype(setname, type, ...) \
|
||||
do_regtype(setname, type, setnamep, typep, name, namelen, __VA_ARGS__)
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case 0 ... 30:
|
||||
return regtype ("integer", DW_ATE_signed, "x%d", regno);
|
||||
|
||||
case 31:
|
||||
return regtype ("integer", DW_ATE_address, "sp");
|
||||
|
||||
case 32:
|
||||
return 0;
|
||||
|
||||
case 33:
|
||||
return regtype ("integer", DW_ATE_address, "elr");
|
||||
|
||||
case 34 ... 63:
|
||||
return 0;
|
||||
|
||||
case 64 ... 95:
|
||||
/* FP/SIMD register file supports a variety of data types--it
|
||||
can be thought of as a register holding a single integer or
|
||||
floating-point value, or a vector of 8-, 16-, 32- or 64-bit
|
||||
integers. 128-bit quad-word is the only singular value that
|
||||
covers the whole register, so mark the register thus. */
|
||||
*bits = 128;
|
||||
return regtype ("FP/SIMD", DW_ATE_unsigned, "v%d", regno - 64);
|
||||
|
||||
case 96 ... 127:
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/* List the relocation types for AArch64. -*- C -*-
|
||||
Copyright (C) 2013, 2014, 2015 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (ABS64, REL|EXEC|DYN)
|
||||
RELOC_TYPE (ABS32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
|
||||
RELOC_TYPE (JUMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPMOD, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPREL, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_TPREL, EXEC|DYN)
|
||||
RELOC_TYPE (TLSDESC, EXEC|DYN)
|
||||
|
||||
/* R_AARCH64_NONE records that the section containing the place to be
|
||||
relocated depends on the section defining the symbol mentioned in
|
||||
the relocation directive[.] (ARM IHI 0056B). */
|
||||
RELOC_TYPE (NONE, REL)
|
||||
|
||||
RELOC_TYPE (ABS16, REL)
|
||||
RELOC_TYPE (PREL64, REL)
|
||||
RELOC_TYPE (PREL32, REL)
|
||||
RELOC_TYPE (PREL16, REL)
|
||||
RELOC_TYPE (MOVW_UABS_G0, REL)
|
||||
RELOC_TYPE (MOVW_UABS_G0_NC, REL)
|
||||
RELOC_TYPE (MOVW_UABS_G1, REL)
|
||||
RELOC_TYPE (MOVW_UABS_G1_NC, REL)
|
||||
RELOC_TYPE (MOVW_UABS_G2, REL)
|
||||
RELOC_TYPE (MOVW_UABS_G2_NC, REL)
|
||||
RELOC_TYPE (MOVW_UABS_G3, REL)
|
||||
RELOC_TYPE (MOVW_SABS_G0, REL)
|
||||
RELOC_TYPE (MOVW_SABS_G1, REL)
|
||||
RELOC_TYPE (MOVW_SABS_G2, REL)
|
||||
RELOC_TYPE (LD_PREL_LO19, REL)
|
||||
RELOC_TYPE (ADR_PREL_LO21, REL)
|
||||
RELOC_TYPE (ADR_PREL_PG_HI21, REL)
|
||||
RELOC_TYPE (ADR_PREL_PG_HI21_NC, REL)
|
||||
RELOC_TYPE (ADD_ABS_LO12_NC, REL)
|
||||
RELOC_TYPE (LDST8_ABS_LO12_NC, REL)
|
||||
RELOC_TYPE (LDST16_ABS_LO12_NC, REL)
|
||||
RELOC_TYPE (LDST32_ABS_LO12_NC, REL)
|
||||
RELOC_TYPE (LDST64_ABS_LO12_NC, REL)
|
||||
RELOC_TYPE (LDST128_ABS_LO12_NC, REL)
|
||||
RELOC_TYPE (TSTBR14, REL)
|
||||
RELOC_TYPE (CONDBR19, REL)
|
||||
RELOC_TYPE (JUMP26, REL)
|
||||
RELOC_TYPE (CALL26, REL)
|
||||
RELOC_TYPE (MOVW_PREL_G0, REL)
|
||||
RELOC_TYPE (MOVW_PREL_G0_NC, REL)
|
||||
RELOC_TYPE (MOVW_PREL_G1, REL)
|
||||
RELOC_TYPE (MOVW_PREL_G1_NC, REL)
|
||||
RELOC_TYPE (MOVW_PREL_G2, REL)
|
||||
RELOC_TYPE (MOVW_PREL_G2_NC, REL)
|
||||
RELOC_TYPE (MOVW_PREL_G3, REL)
|
||||
RELOC_TYPE (MOVW_GOTOFF_G0, REL)
|
||||
RELOC_TYPE (MOVW_GOTOFF_G0_NC, REL)
|
||||
RELOC_TYPE (MOVW_GOTOFF_G1, REL)
|
||||
RELOC_TYPE (MOVW_GOTOFF_G1_NC, REL)
|
||||
RELOC_TYPE (MOVW_GOTOFF_G2, REL)
|
||||
RELOC_TYPE (MOVW_GOTOFF_G2_NC, REL)
|
||||
RELOC_TYPE (MOVW_GOTOFF_G3, REL)
|
||||
RELOC_TYPE (GOTREL64, REL)
|
||||
RELOC_TYPE (GOTREL32, REL)
|
||||
RELOC_TYPE (GOT_LD_PREL19, REL)
|
||||
RELOC_TYPE (LD64_GOTOFF_LO15, REL)
|
||||
RELOC_TYPE (ADR_GOT_PAGE, REL)
|
||||
RELOC_TYPE (LD64_GOT_LO12_NC, REL)
|
||||
RELOC_TYPE (LD64_GOTPAGE_LO15, REL)
|
||||
RELOC_TYPE (TLSGD_ADR_PREL21, REL)
|
||||
RELOC_TYPE (TLSGD_ADR_PAGE21, REL)
|
||||
RELOC_TYPE (TLSGD_ADD_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSGD_MOVW_G1, REL)
|
||||
RELOC_TYPE (TLSGD_MOVW_G0_NC, REL)
|
||||
RELOC_TYPE (TLSLD_ADR_PREL21, REL)
|
||||
RELOC_TYPE (TLSLD_ADR_PAGE21, REL)
|
||||
RELOC_TYPE (TLSLD_ADD_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLD_MOVW_G1, REL)
|
||||
RELOC_TYPE (TLSLD_MOVW_G0_NC, REL)
|
||||
RELOC_TYPE (TLSLD_LD_PREL19, REL)
|
||||
RELOC_TYPE (TLSLD_MOVW_DTPREL_G2, REL)
|
||||
RELOC_TYPE (TLSLD_MOVW_DTPREL_G1, REL)
|
||||
RELOC_TYPE (TLSLD_MOVW_DTPREL_G1_NC, REL)
|
||||
RELOC_TYPE (TLSLD_MOVW_DTPREL_G0, REL)
|
||||
RELOC_TYPE (TLSLD_MOVW_DTPREL_G0_NC, REL)
|
||||
RELOC_TYPE (TLSLD_ADD_DTPREL_HI12, REL)
|
||||
RELOC_TYPE (TLSLD_ADD_DTPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLD_ADD_DTPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLD_LDST8_DTPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLD_LDST8_DTPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLD_LDST16_DTPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLD_LDST16_DTPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLD_LDST32_DTPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLD_LDST32_DTPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLD_LDST64_DTPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLD_LDST64_DTPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLD_LDST128_DTPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLD_LDST128_DTPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSIE_MOVW_GOTTPREL_G1, REL)
|
||||
RELOC_TYPE (TLSIE_MOVW_GOTTPREL_G0_NC, REL)
|
||||
RELOC_TYPE (TLSIE_ADR_GOTTPREL_PAGE21, REL)
|
||||
RELOC_TYPE (TLSIE_LD64_GOTTPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSIE_LD_GOTTPREL_PREL19, REL)
|
||||
RELOC_TYPE (TLSLE_MOVW_TPREL_G2, REL)
|
||||
RELOC_TYPE (TLSLE_MOVW_TPREL_G1, REL)
|
||||
RELOC_TYPE (TLSLE_MOVW_TPREL_G1_NC, REL)
|
||||
RELOC_TYPE (TLSLE_MOVW_TPREL_G0, REL)
|
||||
RELOC_TYPE (TLSLE_MOVW_TPREL_G0_NC, REL)
|
||||
RELOC_TYPE (TLSLE_ADD_TPREL_HI12, REL)
|
||||
RELOC_TYPE (TLSLE_ADD_TPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLE_ADD_TPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLE_LDST8_TPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLE_LDST8_TPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLE_LDST16_TPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLE_LDST16_TPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLE_LDST32_TPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLE_LDST32_TPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLE_LDST64_TPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLE_LDST64_TPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSLE_LDST128_TPREL_LO12, REL)
|
||||
RELOC_TYPE (TLSLE_LDST128_TPREL_LO12_NC, REL)
|
||||
RELOC_TYPE (TLSDESC_LD_PREL19, REL)
|
||||
RELOC_TYPE (TLSDESC_ADR_PREL21, REL)
|
||||
RELOC_TYPE (TLSDESC_ADR_PAGE21, REL)
|
||||
RELOC_TYPE (TLSDESC_LD64_LO12, REL)
|
||||
RELOC_TYPE (TLSDESC_ADD_LO12, REL)
|
||||
RELOC_TYPE (TLSDESC_OFF_G1, REL)
|
||||
RELOC_TYPE (TLSDESC_OFF_G0_NC, REL)
|
||||
RELOC_TYPE (TLSDESC_LDR, REL)
|
||||
RELOC_TYPE (TLSDESC_ADD, REL)
|
||||
RELOC_TYPE (TLSDESC_CALL, REL)
|
||||
@@ -0,0 +1,375 @@
|
||||
/* Function return value location for Linux/AArch64 ABI.
|
||||
Copyright (C) 2013 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND aarch64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
static int
|
||||
skip_until (Dwarf_Die *child, int tag)
|
||||
{
|
||||
int i;
|
||||
while (DWARF_TAG_OR_RETURN (child) != tag)
|
||||
if ((i = dwarf_siblingof (child, child)) != 0)
|
||||
/* If there are no members, then this is not a HFA. Errors
|
||||
are propagated. */
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
dwarf_bytesize_aux (Dwarf_Die *die, Dwarf_Word *sizep)
|
||||
{
|
||||
int bits;
|
||||
if (((bits = 8 * dwarf_bytesize (die)) < 0
|
||||
&& (bits = dwarf_bitsize (die)) < 0)
|
||||
|| bits % 8 != 0)
|
||||
return -1;
|
||||
|
||||
*sizep = bits / 8;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* HFA (Homogeneous Floating-point Aggregate) is an aggregate type
|
||||
whose members are all of the same floating-point type, which is
|
||||
then base type of this HFA. Instead of being floating-point types
|
||||
directly, members can instead themselves be HFA. Such HFA fields
|
||||
are handled as if their type were HFA base type.
|
||||
|
||||
This function returns 0 if TYPEDIE is HFA, 1 if it is not, or -1 if
|
||||
there were errors. In the former case, *SIZEP contains byte size
|
||||
of the base type (e.g. 8 for IEEE double). *COUNT is set to the
|
||||
number of leaf members of the HFA. */
|
||||
static int hfa_type (Dwarf_Die *ftypedie, int tag,
|
||||
Dwarf_Word *sizep, Dwarf_Word *countp);
|
||||
|
||||
/* Return 0 if MEMBDIE refers to a member with a floating-point or HFA
|
||||
type, or 1 if it's not. Return -1 for errors. The meaning of the
|
||||
remaining arguments is as documented at hfa_type. */
|
||||
static int
|
||||
member_is_fp (Dwarf_Die *membdie, Dwarf_Word *sizep, Dwarf_Word *countp)
|
||||
{
|
||||
Dwarf_Die typedie;
|
||||
int tag = dwarf_peeled_die_type (membdie, &typedie);
|
||||
switch (tag)
|
||||
{
|
||||
case DW_TAG_base_type:;
|
||||
Dwarf_Word encoding;
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_attr_integrate (&typedie, DW_AT_encoding, &attr_mem) == NULL
|
||||
|| dwarf_formudata (&attr_mem, &encoding) != 0)
|
||||
return -1;
|
||||
|
||||
switch (encoding)
|
||||
{
|
||||
case DW_ATE_complex_float:
|
||||
*countp = 2;
|
||||
break;
|
||||
|
||||
case DW_ATE_float:
|
||||
*countp = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (dwarf_bytesize_aux (&typedie, sizep) < 0)
|
||||
return -1;
|
||||
|
||||
*sizep /= *countp;
|
||||
return 0;
|
||||
|
||||
case DW_TAG_structure_type:
|
||||
case DW_TAG_union_type:
|
||||
case DW_TAG_array_type:
|
||||
return hfa_type (&typedie, tag, sizep, countp);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
hfa_type (Dwarf_Die *ftypedie, int tag, Dwarf_Word *sizep, Dwarf_Word *countp)
|
||||
{
|
||||
assert (tag == DW_TAG_structure_type || tag == DW_TAG_class_type
|
||||
|| tag == DW_TAG_union_type || tag == DW_TAG_array_type);
|
||||
|
||||
int i;
|
||||
if (tag == DW_TAG_array_type)
|
||||
{
|
||||
Dwarf_Word tot_size;
|
||||
if (dwarf_aggregate_size (ftypedie, &tot_size) < 0)
|
||||
return -1;
|
||||
|
||||
/* For vector types, we don't care about the underlying
|
||||
type, but only about the vector type itself. */
|
||||
bool vec;
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formflag (dwarf_attr_integrate (ftypedie, DW_AT_GNU_vector,
|
||||
&attr_mem), &vec) == 0
|
||||
&& vec)
|
||||
{
|
||||
*sizep = tot_size;
|
||||
*countp = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((i = member_is_fp (ftypedie, sizep, countp)) == 0)
|
||||
{
|
||||
*countp = tot_size / *sizep;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Find first DW_TAG_member and determine its type. */
|
||||
Dwarf_Die member;
|
||||
if ((i = dwarf_child (ftypedie, &member) != 0))
|
||||
return i;
|
||||
|
||||
if ((i = skip_until (&member, DW_TAG_member)) != 0)
|
||||
return i;
|
||||
|
||||
*countp = 0;
|
||||
if ((i = member_is_fp (&member, sizep, countp)) != 0)
|
||||
return i;
|
||||
|
||||
while ((i = dwarf_siblingof (&member, &member)) == 0
|
||||
&& (i = skip_until (&member, DW_TAG_member)) == 0)
|
||||
{
|
||||
Dwarf_Word size, count;
|
||||
if ((i = member_is_fp (&member, &size, &count)) != 0)
|
||||
return i;
|
||||
|
||||
if (*sizep != size)
|
||||
return 1;
|
||||
|
||||
*countp += count;
|
||||
}
|
||||
|
||||
/* At this point we already have at least one FP member, which means
|
||||
FTYPEDIE is an HFA. So either return 0, or propagate error. */
|
||||
return i < 0 ? i : 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_in_gpr (const Dwarf_Op **locp, Dwarf_Word size)
|
||||
{
|
||||
static const Dwarf_Op loc[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
{ .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 8 }
|
||||
};
|
||||
|
||||
*locp = loc;
|
||||
return size <= 8 ? 1 : 4;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_by_ref (const Dwarf_Op **locp)
|
||||
{
|
||||
static const Dwarf_Op loc[] = { { .atom = DW_OP_breg0 } };
|
||||
|
||||
*locp = loc;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_hfa (const Dwarf_Op **locp, Dwarf_Word size, Dwarf_Word count)
|
||||
{
|
||||
assert (count >= 1 && count <= 4);
|
||||
assert (size == 2 || size == 4 || size == 8 || size == 16);
|
||||
|
||||
#define DEFINE_FPREG(NAME, SIZE) \
|
||||
static const Dwarf_Op NAME[] = { \
|
||||
{ .atom = DW_OP_regx, .number = 64 }, \
|
||||
{ .atom = DW_OP_piece, .number = SIZE }, \
|
||||
{ .atom = DW_OP_regx, .number = 65 }, \
|
||||
{ .atom = DW_OP_piece, .number = SIZE }, \
|
||||
{ .atom = DW_OP_regx, .number = 66 }, \
|
||||
{ .atom = DW_OP_piece, .number = SIZE }, \
|
||||
{ .atom = DW_OP_regx, .number = 67 }, \
|
||||
{ .atom = DW_OP_piece, .number = SIZE } \
|
||||
}
|
||||
|
||||
switch (size)
|
||||
{
|
||||
case 2:;
|
||||
DEFINE_FPREG (loc_hfa_2, 2);
|
||||
*locp = loc_hfa_2;
|
||||
break;
|
||||
|
||||
case 4:;
|
||||
DEFINE_FPREG (loc_hfa_4, 4);
|
||||
*locp = loc_hfa_4;
|
||||
break;
|
||||
|
||||
case 8:;
|
||||
DEFINE_FPREG (loc_hfa_8, 8);
|
||||
*locp = loc_hfa_8;
|
||||
break;
|
||||
|
||||
case 16:;
|
||||
DEFINE_FPREG (loc_hfa_16, 16);
|
||||
*locp = loc_hfa_16;
|
||||
break;
|
||||
}
|
||||
#undef DEFINE_FPREG
|
||||
|
||||
return count == 1 ? 1 : 2 * count;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_in_simd (const Dwarf_Op **locp)
|
||||
{
|
||||
/* This is like passing single-element HFA. Size doesn't matter, so
|
||||
pretend it's for example double. */
|
||||
return pass_hfa (locp, 8, 1);
|
||||
}
|
||||
|
||||
int
|
||||
aarch64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
{
|
||||
/* Start with the function's type, and get the DW_AT_type attribute,
|
||||
which is the type of the return value. */
|
||||
Dwarf_Die typedie;
|
||||
int tag = dwarf_peeled_die_type (functypedie, &typedie);
|
||||
if (tag <= 0)
|
||||
return tag;
|
||||
|
||||
Dwarf_Word size = (Dwarf_Word)-1;
|
||||
|
||||
/* If the argument type is a Composite Type that is larger than 16
|
||||
bytes, then the argument is copied to memory allocated by the
|
||||
caller and the argument is replaced by a pointer to the copy. */
|
||||
if (tag == DW_TAG_structure_type || tag == DW_TAG_union_type
|
||||
|| tag == DW_TAG_class_type || tag == DW_TAG_array_type)
|
||||
{
|
||||
Dwarf_Word base_size, count;
|
||||
switch (hfa_type (&typedie, tag, &base_size, &count))
|
||||
{
|
||||
default:
|
||||
return -1;
|
||||
|
||||
case 0:
|
||||
assert (count > 0);
|
||||
if (count <= 4)
|
||||
return pass_hfa (locp, base_size, count);
|
||||
FALLTHROUGH;
|
||||
|
||||
case 1:
|
||||
/* Not a HFA. */
|
||||
if (dwarf_aggregate_size (&typedie, &size) < 0)
|
||||
return -1;
|
||||
if (size > 16)
|
||||
return pass_by_ref (locp);
|
||||
}
|
||||
}
|
||||
|
||||
if (tag == DW_TAG_base_type || dwarf_is_pointer (tag))
|
||||
{
|
||||
if (dwarf_bytesize_aux (&typedie, &size) < 0)
|
||||
{
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (tag == DW_TAG_base_type)
|
||||
{
|
||||
Dwarf_Word encoding;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (&typedie, DW_AT_encoding,
|
||||
&attr_mem),
|
||||
&encoding) != 0)
|
||||
return -1;
|
||||
|
||||
switch (encoding)
|
||||
{
|
||||
/* If the argument is a Half-, Single-, Double- or Quad-
|
||||
precision Floating-point [...] the argument is allocated
|
||||
to the least significant bits of register v[NSRN]. */
|
||||
case DW_ATE_float:
|
||||
switch (size)
|
||||
{
|
||||
case 2: /* half */
|
||||
case 4: /* single */
|
||||
case 8: /* double */
|
||||
case 16: /* quad */
|
||||
return pass_in_simd (locp);
|
||||
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
|
||||
case DW_ATE_complex_float:
|
||||
switch (size)
|
||||
{
|
||||
case 8: /* float _Complex */
|
||||
case 16: /* double _Complex */
|
||||
case 32: /* long double _Complex */
|
||||
return pass_hfa (locp, size / 2, 2);
|
||||
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* If the argument is an Integral or Pointer Type, the
|
||||
size of the argument is less than or equal to 8 bytes
|
||||
[...] the argument is copied to the least significant
|
||||
bits in x[NGRN]. */
|
||||
case DW_ATE_boolean:
|
||||
case DW_ATE_signed:
|
||||
case DW_ATE_unsigned:
|
||||
case DW_ATE_unsigned_char:
|
||||
case DW_ATE_signed_char:
|
||||
return pass_in_gpr (locp, size);
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
return pass_in_gpr (locp, size);
|
||||
}
|
||||
|
||||
*locp = NULL;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/* AArch64 specific symbolic name handling.
|
||||
Copyright (C) 2013, 2015, 2017 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <system.h>
|
||||
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND aarch64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
aarch64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_AARCH64_ABS64:
|
||||
return ELF_T_XWORD;
|
||||
case R_AARCH64_ABS32:
|
||||
return ELF_T_WORD;
|
||||
case R_AARCH64_ABS16:
|
||||
return ELF_T_HALF;
|
||||
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is the _GLOBAL_OFFSET_TABLE_ symbol, then it should point in
|
||||
the .got even if there is a .got.plt section.
|
||||
https://sourceware.org/ml/libc-ports/2013-06/msg00057.html
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1201778
|
||||
*/
|
||||
bool
|
||||
aarch64_check_special_symbol (Elf *elf, const GElf_Sym *sym,
|
||||
const char *name, const GElf_Shdr *destshdr)
|
||||
{
|
||||
if (name != NULL
|
||||
&& strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
|
||||
{
|
||||
size_t shstrndx;
|
||||
if (elf_getshdrstrndx (elf, &shstrndx) != 0)
|
||||
return false;
|
||||
const char *sname = elf_strptr (elf, shstrndx, destshdr->sh_name);
|
||||
if (sname != NULL
|
||||
&& (strcmp (sname, ".got") == 0 || strcmp (sname, ".got.plt") == 0))
|
||||
{
|
||||
Elf_Scn *scn = NULL;
|
||||
while ((scn = elf_nextscn (elf, scn)) != NULL)
|
||||
{
|
||||
GElf_Shdr shdr_mem;
|
||||
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
|
||||
if (shdr != NULL)
|
||||
{
|
||||
sname = elf_strptr (elf, shstrndx, shdr->sh_name);
|
||||
if (sname != NULL && strcmp (sname, ".got") == 0)
|
||||
return (sym->st_value >= shdr->sh_addr
|
||||
&& sym->st_value < shdr->sh_addr + shdr->sh_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* A data mapping symbol is a symbol with "$d" name or "$d.<any...>" name,
|
||||
STT_NOTYPE, STB_LOCAL and st_size of zero. The indicate the stat of a
|
||||
sequence of data items. */
|
||||
bool
|
||||
aarch64_data_marker_symbol (const GElf_Sym *sym, const char *sname)
|
||||
{
|
||||
return (sym != NULL && sname != NULL
|
||||
&& sym->st_size == 0 && GELF_ST_BIND (sym->st_info) == STB_LOCAL
|
||||
&& GELF_ST_TYPE (sym->st_info) == STT_NOTYPE
|
||||
&& (strcmp (sname, "$d") == 0 || startswith (sname, "$d.")));
|
||||
}
|
||||
|
||||
const char *
|
||||
aarch64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (tag)
|
||||
{
|
||||
case DT_AARCH64_BTI_PLT:
|
||||
return "AARCH64_BTI_PLT";
|
||||
case DT_AARCH64_PAC_PLT:
|
||||
return "AARCH64_PAC_PLT";
|
||||
case DT_AARCH64_VARIANT_PCS:
|
||||
return "AARCH64_VARIANT_PCS";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
aarch64_dynamic_tag_check (int64_t tag)
|
||||
{
|
||||
return (tag == DT_AARCH64_BTI_PLT
|
||||
|| tag == DT_AARCH64_PAC_PLT
|
||||
|| tag == DT_AARCH64_VARIANT_PCS);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/* Get previous frame state for an existing frame state.
|
||||
Copyright (C) 2016 The Qt Company Ltd.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND aarch64_
|
||||
#define FP_REG 29
|
||||
#define LR_REG 30
|
||||
#define SP_REG 31
|
||||
#define FP_OFFSET 0
|
||||
#define LR_OFFSET 8
|
||||
#define SP_OFFSET 16
|
||||
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* There was no CFI. Maybe we happen to have a frame pointer and can unwind from that? */
|
||||
|
||||
bool
|
||||
EBLHOOK(unwind) (Ebl *ebl __attribute__ ((unused)), Dwarf_Addr pc __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc, ebl_tid_registers_get_t *getfunc,
|
||||
ebl_pid_memory_read_t *readfunc, void *arg,
|
||||
bool *signal_framep __attribute__ ((unused)))
|
||||
{
|
||||
Dwarf_Word fp, lr, sp;
|
||||
|
||||
if (!getfunc(LR_REG, 1, &lr, arg))
|
||||
return false;
|
||||
|
||||
if (lr == 0 || !setfunc(-1, 1, &lr, arg))
|
||||
return false;
|
||||
|
||||
if (!getfunc(FP_REG, 1, &fp, arg))
|
||||
fp = 0;
|
||||
|
||||
if (!getfunc(SP_REG, 1, &sp, arg))
|
||||
sp = 0;
|
||||
|
||||
Dwarf_Word newLr, newFp, newSp;
|
||||
|
||||
if (!readfunc(fp + LR_OFFSET, &newLr, arg))
|
||||
newLr = 0;
|
||||
|
||||
if (!readfunc(fp + FP_OFFSET, &newFp, arg))
|
||||
newFp = 0;
|
||||
|
||||
newSp = fp + SP_OFFSET;
|
||||
|
||||
// These are not fatal if they don't work. They will just prevent unwinding at the next frame.
|
||||
setfunc(LR_REG, 1, &newLr, arg);
|
||||
setfunc(FP_REG, 1, &newFp, arg);
|
||||
setfunc(SP_REG, 1, &newSp, arg);
|
||||
|
||||
// If the fp is invalid, we might still have a valid lr.
|
||||
// But if the fp is valid, then the stack should be moving in the right direction.
|
||||
return fp == 0 || newSp > sp;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* Alpha-specific auxv handling.
|
||||
Copyright (C) 2008 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND alpha_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
int
|
||||
EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format)
|
||||
{
|
||||
if (a_type != AT_HWCAP)
|
||||
return 0;
|
||||
|
||||
*name = "HWCAP";
|
||||
*format = "b"
|
||||
"bwx\0" "fix\0" "cix\0" "0x08\0"
|
||||
"0x10\0" "0x20\0" "0x40\0" "0x80\0"
|
||||
"max\0" "precise_trap\0"
|
||||
"\0";
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/* PowerPC specific core note handling.
|
||||
Copyright (C) 2007 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define BACKEND alpha_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
static const Ebl_Register_Location prstatus_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 0, .count = 31, .bits = 64 }, /* r0-r30 */
|
||||
{ .offset = 32 * 8, .regno = 64, .count = 1, .bits = 64 }, /* pc */
|
||||
{ .offset = 33 * 8, .regno = 66, .count = 1, .bits = 64 }, /* unique */
|
||||
};
|
||||
#define PRSTATUS_REGS_SIZE (33 * 8)
|
||||
|
||||
static const Ebl_Register_Location fpregset_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 32, .count = 32, .bits = 64 }, /* f0-f30, fpcr */
|
||||
};
|
||||
#define FPREGSET_SIZE (32 * 8)
|
||||
|
||||
#define ULONG uint64_t
|
||||
#define ALIGN_ULONG 8
|
||||
#define TYPE_ULONG ELF_T_XWORD
|
||||
#define TYPE_LONG ELF_T_SXWORD
|
||||
#define PID_T int32_t
|
||||
#define UID_T uint32_t
|
||||
#define GID_T uint32_t
|
||||
#define ALIGN_PID_T 4
|
||||
#define ALIGN_UID_T 4
|
||||
#define ALIGN_GID_T 4
|
||||
#define TYPE_PID_T ELF_T_SWORD
|
||||
#define TYPE_UID_T ELF_T_WORD
|
||||
#define TYPE_GID_T ELF_T_WORD
|
||||
|
||||
#include "linux-core-note.c"
|
||||
@@ -0,0 +1,63 @@
|
||||
/* Initialization of Alpha specific backend library.
|
||||
Copyright (C) 2002-2011 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND alpha_
|
||||
#define RELOC_PREFIX R_ALPHA_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on alpha_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
|
||||
Ebl *
|
||||
alpha_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
/* We handle it. */
|
||||
alpha_init_reloc (eh);
|
||||
HOOK (eh, dynamic_tag_name);
|
||||
HOOK (eh, dynamic_tag_check);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, return_value_location);
|
||||
HOOK (eh, machine_section_flag_check);
|
||||
HOOK (eh, check_special_section);
|
||||
HOOK (eh, check_special_symbol);
|
||||
HOOK (eh, check_st_other_bits);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, core_note);
|
||||
HOOK (eh, auxv_info);
|
||||
eh->sysvhash_entrysize = sizeof (Elf64_Xword);
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
/* Register names and numbers for Alpha DWARF.
|
||||
Copyright (C) 2007 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND alpha_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
ssize_t
|
||||
alpha_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setname,
|
||||
int *bits, int *type)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 67;
|
||||
|
||||
if (regno < 0 || regno > 66 || namelen < 7)
|
||||
return -1;
|
||||
|
||||
*prefix = "$";
|
||||
|
||||
*bits = 64;
|
||||
*type = DW_ATE_signed;
|
||||
*setname = "integer";
|
||||
if (regno >= 32 && regno < 64)
|
||||
{
|
||||
*setname = "FPU";
|
||||
*type = DW_ATE_float;
|
||||
}
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case 0:
|
||||
name[0] = 'v';
|
||||
name[1] = '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 1 ... 8:
|
||||
name[0] = 't';
|
||||
name[1] = regno - 1 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 9 ... 15:
|
||||
name[0] = 's';
|
||||
name[1] = regno - 9 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 16 ... 21:
|
||||
name[0] = 'a';
|
||||
name[1] = regno - 16 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 22 ... 23:
|
||||
name[0] = 't';
|
||||
name[1] = regno - 22 + '8';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 24 ... 25:
|
||||
name[0] = 't';
|
||||
name[1] = '1';
|
||||
name[2] = regno - 24 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 26:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "ra") + 1 - name;
|
||||
|
||||
case 27:
|
||||
return stpcpy (name, "t12") + 1 - name;
|
||||
|
||||
case 28:
|
||||
return stpcpy (name, "at") + 1 - name;
|
||||
|
||||
case 29:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "gp") + 1 - name;
|
||||
|
||||
case 30:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "sp") + 1 - name;
|
||||
|
||||
case 31:
|
||||
return stpcpy (name, "zero") + 1 - name;
|
||||
|
||||
case 32 ... 32 + 9:
|
||||
name[0] = 'f';
|
||||
name[1] = regno - 32 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 32 + 10 ... 32 + 19:
|
||||
name[0] = 'f';
|
||||
name[1] = '1';
|
||||
name[2] = regno - 32 - 10 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 32 + 20 ... 32 + 29:
|
||||
name[0] = 'f';
|
||||
name[1] = '2';
|
||||
name[2] = regno - 32 - 20 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 32 + 30:
|
||||
return stpcpy (name, "f30") + 1 - name;
|
||||
|
||||
case 32 + 31:
|
||||
*type = DW_ATE_unsigned;
|
||||
return stpcpy (name, "fpcr") + 1 - name;
|
||||
|
||||
case 64:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "pc") + 1 - name;
|
||||
|
||||
case 66:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "unique") + 1 - name;
|
||||
|
||||
default:
|
||||
*setname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
name[namelen++] = '\0';
|
||||
return namelen;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/* List the relocation types for alpha. -*- C -*-
|
||||
Copyright (C) 2005 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, 0)
|
||||
RELOC_TYPE (REFLONG, REL|EXEC|DYN)
|
||||
RELOC_TYPE (REFQUAD, REL|EXEC|DYN)
|
||||
RELOC_TYPE (GPREL32, REL)
|
||||
RELOC_TYPE (LITERAL, REL)
|
||||
RELOC_TYPE (LITUSE, REL)
|
||||
RELOC_TYPE (GPDISP, REL)
|
||||
RELOC_TYPE (BRADDR, REL)
|
||||
RELOC_TYPE (HINT, REL)
|
||||
RELOC_TYPE (SREL16, REL)
|
||||
RELOC_TYPE (SREL32, REL)
|
||||
RELOC_TYPE (SREL64, REL)
|
||||
RELOC_TYPE (GPRELHIGH, REL)
|
||||
RELOC_TYPE (GPRELLOW, REL)
|
||||
RELOC_TYPE (GPREL16, REL)
|
||||
RELOC_TYPE (COPY, 0)
|
||||
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
|
||||
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_GD_HI, REL)
|
||||
RELOC_TYPE (TLSGD, REL)
|
||||
RELOC_TYPE (TLS_LDM, REL)
|
||||
RELOC_TYPE (DTPMOD64, REL|EXEC|DYN)
|
||||
RELOC_TYPE (GOTDTPREL, REL)
|
||||
RELOC_TYPE (DTPREL64, REL|EXEC|DYN)
|
||||
RELOC_TYPE (DTPRELHI, REL)
|
||||
RELOC_TYPE (DTPRELLO, REL)
|
||||
RELOC_TYPE (DTPREL16, REL)
|
||||
RELOC_TYPE (GOTTPREL, REL)
|
||||
RELOC_TYPE (TPREL64, REL|EXEC|DYN)
|
||||
RELOC_TYPE (TPRELHI, REL)
|
||||
RELOC_TYPE (TPRELLO, REL)
|
||||
RELOC_TYPE (TPREL16, REL)
|
||||
@@ -0,0 +1,149 @@
|
||||
/* Function return value location for Alpha ELF ABI.
|
||||
Copyright (C) 2005, 2007, 2014 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND alpha_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* $0. */
|
||||
static const Dwarf_Op loc_intreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg0 }
|
||||
};
|
||||
#define nloc_intreg 1
|
||||
|
||||
/* $f0, or pair $f0, $f1. */
|
||||
static const Dwarf_Op loc_fpreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
{ .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
};
|
||||
#define nloc_fpreg 1
|
||||
#define nloc_fpregpair 4
|
||||
|
||||
/* The return value is a structure and is actually stored in stack space
|
||||
passed in a hidden argument by the caller. But, the compiler
|
||||
helpfully returns the address of that space in $0. */
|
||||
static const Dwarf_Op loc_aggregate[] =
|
||||
{
|
||||
{ .atom = DW_OP_breg0, .number = 0 }
|
||||
};
|
||||
#define nloc_aggregate 1
|
||||
|
||||
int
|
||||
alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
{
|
||||
/* Start with the function's type, and get the DW_AT_type attribute,
|
||||
which is the type of the return value. */
|
||||
Dwarf_Die die_mem, *typedie = &die_mem;
|
||||
int tag = dwarf_peeled_die_type (functypedie, typedie);
|
||||
if (tag <= 0)
|
||||
return tag;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case -1:
|
||||
return -1;
|
||||
|
||||
case DW_TAG_subrange_type:
|
||||
if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
|
||||
{
|
||||
Dwarf_Attribute attr_mem, *attr;
|
||||
attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
typedie = dwarf_formref_die (attr, &die_mem);
|
||||
tag = DWARF_TAG_OR_RETURN (typedie);
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
Dwarf_Word size;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
if (tag == DW_TAG_base_type)
|
||||
{
|
||||
Dwarf_Word encoding;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
|
||||
&attr_mem),
|
||||
&encoding) != 0)
|
||||
return -1;
|
||||
|
||||
*locp = loc_fpreg;
|
||||
if (encoding == DW_ATE_float)
|
||||
{
|
||||
if (size <= 8)
|
||||
return nloc_fpreg;
|
||||
goto aggregate;
|
||||
}
|
||||
if (encoding == DW_ATE_complex_float)
|
||||
{
|
||||
if (size <= 8 * 2)
|
||||
return nloc_fpregpair;
|
||||
goto aggregate;
|
||||
}
|
||||
}
|
||||
if (size <= 8)
|
||||
{
|
||||
*locp = loc_intreg;
|
||||
return nloc_intreg;
|
||||
}
|
||||
}
|
||||
|
||||
FALLTHROUGH;
|
||||
|
||||
case DW_TAG_structure_type:
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_union_type:
|
||||
case DW_TAG_string_type:
|
||||
case DW_TAG_array_type:
|
||||
aggregate:
|
||||
*locp = loc_aggregate;
|
||||
return nloc_aggregate;
|
||||
}
|
||||
|
||||
/* XXX We don't have a good way to return specific errors from ebl calls.
|
||||
This value means we do not understand the type, but it is well-formed
|
||||
DWARF and might be valid. */
|
||||
return -2;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
/* Alpha specific symbolic name handling.
|
||||
Copyright (C) 2002-2011 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND alpha_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
const char *
|
||||
alpha_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (tag)
|
||||
{
|
||||
case DT_ALPHA_PLTRO:
|
||||
return "ALPHA_PLTRO";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
alpha_dynamic_tag_check (int64_t tag)
|
||||
{
|
||||
return tag == DT_ALPHA_PLTRO;
|
||||
}
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
alpha_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_ALPHA_REFLONG:
|
||||
return ELF_T_WORD;
|
||||
case R_ALPHA_REFQUAD:
|
||||
return ELF_T_XWORD;
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check whether SHF_MASKPROC flags are valid. */
|
||||
bool
|
||||
alpha_machine_section_flag_check (GElf_Xword sh_flags)
|
||||
{
|
||||
return (sh_flags &~ (SHF_ALPHA_GPREL)) == 0;
|
||||
}
|
||||
|
||||
bool
|
||||
alpha_check_special_section (Ebl *ebl,
|
||||
int ndx __attribute__ ((unused)),
|
||||
const GElf_Shdr *shdr,
|
||||
const char *sname __attribute__ ((unused)))
|
||||
{
|
||||
if ((shdr->sh_flags
|
||||
& (SHF_WRITE | SHF_EXECINSTR)) == (SHF_WRITE | SHF_EXECINSTR)
|
||||
&& shdr->sh_addr != 0)
|
||||
{
|
||||
/* This is ordinarily flagged, but is valid for an old-style PLT.
|
||||
|
||||
Look for the SHT_DYNAMIC section and the DT_PLTGOT tag in it.
|
||||
Its d_ptr should match the .plt section's sh_addr. */
|
||||
|
||||
Elf_Scn *scn = NULL;
|
||||
while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
|
||||
{
|
||||
GElf_Shdr scn_shdr;
|
||||
if (likely (gelf_getshdr (scn, &scn_shdr) != NULL)
|
||||
&& scn_shdr.sh_type == SHT_DYNAMIC
|
||||
&& scn_shdr.sh_entsize != 0)
|
||||
{
|
||||
GElf_Addr pltgot = 0;
|
||||
Elf_Data *data = elf_getdata (scn, NULL);
|
||||
if (data != NULL)
|
||||
for (size_t i = 0; i < data->d_size / scn_shdr.sh_entsize; ++i)
|
||||
{
|
||||
GElf_Dyn dyn;
|
||||
if (unlikely (gelf_getdyn (data, i, &dyn) == NULL))
|
||||
break;
|
||||
if (dyn.d_tag == DT_PLTGOT)
|
||||
pltgot = dyn.d_un.d_ptr;
|
||||
else if (dyn.d_tag == DT_ALPHA_PLTRO && dyn.d_un.d_val != 0)
|
||||
return false; /* This PLT should not be writable. */
|
||||
}
|
||||
return pltgot == shdr->sh_addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check whether given symbol's st_value and st_size are OK despite failing
|
||||
normal checks. */
|
||||
bool
|
||||
alpha_check_special_symbol (Elf *elf __attribute__ ((unused)),
|
||||
const GElf_Sym *sym __attribute__ ((unused)),
|
||||
const char *name,
|
||||
const GElf_Shdr *destshdr __attribute__ ((unused)))
|
||||
{
|
||||
if (name == NULL)
|
||||
return false;
|
||||
|
||||
if (strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
|
||||
/* On Alpha any place in the section is valid. */
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check whether only valid bits are set on the st_other symbol flag.
|
||||
Standard ST_VISIBILITY have already been masked off. */
|
||||
bool
|
||||
alpha_check_st_other_bits (unsigned char st_other)
|
||||
{
|
||||
return ((((st_other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_NOPV)
|
||||
|| ((st_other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_STD_GPLOAD))
|
||||
&& (st_other &~ STO_ALPHA_STD_GPLOAD) == 0);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/* Initialization of ARC specific backend library.
|
||||
Copyright (C) 2022 Synopsys Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* More details on an ARC elf can be found at:
|
||||
https://github.com/foss-for-synopsys-dwc-arc-processors/ \
|
||||
arc-ABI-manual/blob/master/arcv3-elf.md */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND arc_
|
||||
#define RELOC_PREFIX R_ARC_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on arc_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
Ebl *
|
||||
arc_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
arc_init_reloc (eh);
|
||||
HOOK (eh, machine_flag_check);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, section_type_name);
|
||||
|
||||
/* /bld/gcc-stage2/arc-snps-linux-gnu/libgcc/libgcc.map.in
|
||||
#define __LIBGCC_DWARF_FRAME_REGISTERS__. */
|
||||
eh->frame_nregs = 146;
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/* List the relocation types for ARC. -*- C -*-
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, EXEC|DYN)
|
||||
RELOC_TYPE (8, REL|EXEC|DYN)
|
||||
RELOC_TYPE (16, REL|EXEC|DYN)
|
||||
RELOC_TYPE (24, REL|EXEC|DYN)
|
||||
RELOC_TYPE (32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (N8, REL|EXEC|DYN)
|
||||
RELOC_TYPE (N16, REL|EXEC|DYN)
|
||||
RELOC_TYPE (N24, REL|EXEC|DYN)
|
||||
RELOC_TYPE (N32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (SDA, REL)
|
||||
RELOC_TYPE (SECTOFF, REL)
|
||||
RELOC_TYPE (S21H_PCREL, REL)
|
||||
RELOC_TYPE (S21W_PCREL, REL)
|
||||
RELOC_TYPE (S25H_PCREL, REL)
|
||||
RELOC_TYPE (S25W_PCREL, REL)
|
||||
RELOC_TYPE (SDA32, REL)
|
||||
RELOC_TYPE (SDA_LDST, REL)
|
||||
RELOC_TYPE (SDA_LDST1, REL)
|
||||
RELOC_TYPE (SDA_LDST2, REL)
|
||||
RELOC_TYPE (SDA16_LD, REL)
|
||||
RELOC_TYPE (SDA16_LD1, REL)
|
||||
RELOC_TYPE (SDA16_LD2, REL)
|
||||
RELOC_TYPE (S13_PCREL, REL)
|
||||
RELOC_TYPE (W, REL)
|
||||
RELOC_TYPE (32_ME, REL)
|
||||
RELOC_TYPE (N32_ME, REL)
|
||||
RELOC_TYPE (SECTOFF_ME, REL)
|
||||
RELOC_TYPE (SDA32_ME, REL)
|
||||
RELOC_TYPE (W_ME, REL)
|
||||
RELOC_TYPE (SDA_12, REL)
|
||||
RELOC_TYPE (SDA16_ST2, REL)
|
||||
RELOC_TYPE (32_PCREL, REL)
|
||||
RELOC_TYPE (PC32, REL)
|
||||
RELOC_TYPE (GOTPC32, REL)
|
||||
RELOC_TYPE (PLT32, REL)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
|
||||
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (GOTOFF, REL)
|
||||
RELOC_TYPE (GOTPC, REL)
|
||||
RELOC_TYPE (GOT32, REL)
|
||||
RELOC_TYPE (S21W_PCREL_PLT, REL)
|
||||
RELOC_TYPE (S25H_PCREL_PLT, REL)
|
||||
RELOC_TYPE (JLI_SECTOFF, REL)
|
||||
RELOC_TYPE (TLS_DTPMOD, REL)
|
||||
RELOC_TYPE (TLS_DTPOFF, REL)
|
||||
RELOC_TYPE (TLS_TPOFF, REL)
|
||||
RELOC_TYPE (TLS_GD_GOT, REL)
|
||||
RELOC_TYPE (TLS_GD_LD, REL)
|
||||
RELOC_TYPE (TLS_GD_CALL, REL)
|
||||
RELOC_TYPE (TLS_IE_GOT, REL)
|
||||
RELOC_TYPE (TLS_DTPOFF_S9, REL)
|
||||
RELOC_TYPE (TLS_LE_S9, REL)
|
||||
RELOC_TYPE (TLS_LE_32, REL)
|
||||
RELOC_TYPE (S25W_PCREL_PLT, REL)
|
||||
RELOC_TYPE (S21H_PCREL_PLT, REL)
|
||||
RELOC_TYPE (NPS_CMEM16, REL)
|
||||
@@ -0,0 +1,81 @@
|
||||
/* ARC specific symbolic name handling.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND arc_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* Check whether machine flags are valid. */
|
||||
bool
|
||||
arc_machine_flag_check (GElf_Word flags)
|
||||
{
|
||||
return ((flags & ~EF_ARC_ALL_MSK) == 0);
|
||||
}
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
arc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub __attribute ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_ARC_32:
|
||||
return ELF_T_WORD;
|
||||
case R_ARC_16:
|
||||
return ELF_T_HALF;
|
||||
case R_ARC_8:
|
||||
return ELF_T_BYTE;
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return symbolic representation of section type. */
|
||||
const char *
|
||||
arc_section_type_name (int type,
|
||||
char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SHT_ARC_ATTRIBUTES:
|
||||
return "ARC_ATTRIBUTES";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
/* Object attribute tags for ARM.
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
#define KNOWN_VALUES(...) do \
|
||||
{ \
|
||||
static const char *table[] = { __VA_ARGS__ }; \
|
||||
if (value < sizeof table / sizeof table[0]) \
|
||||
*value_name = table[value]; \
|
||||
} while (0)
|
||||
|
||||
bool
|
||||
arm_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
|
||||
const char *vendor, int tag, uint64_t value,
|
||||
const char **tag_name, const char **value_name)
|
||||
{
|
||||
if (!strcmp (vendor, "aeabi"))
|
||||
switch (tag)
|
||||
{
|
||||
case 4:
|
||||
*tag_name = "CPU_raw_name";
|
||||
return true;
|
||||
case 5:
|
||||
*tag_name = "CPU_name";
|
||||
return true;
|
||||
case 6:
|
||||
*tag_name = "CPU_arch";
|
||||
KNOWN_VALUES ("Pre-v4",
|
||||
"v4",
|
||||
"v4T",
|
||||
"v5T",
|
||||
"v5TE",
|
||||
"v5TEJ",
|
||||
"v6",
|
||||
"v6KZ",
|
||||
"v6T2",
|
||||
"v6K",
|
||||
"v7",
|
||||
"v6-M",
|
||||
"v6S-M");
|
||||
return true;
|
||||
case 7:
|
||||
*tag_name = "CPU_arch_profile";
|
||||
switch (value)
|
||||
{
|
||||
case 'A':
|
||||
*value_name = "Application";
|
||||
break;
|
||||
case 'R':
|
||||
*value_name = "Realtime";
|
||||
break;
|
||||
case 'M':
|
||||
*value_name = "Microcontroller";
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
case 8:
|
||||
*tag_name = "ARM_ISA_use";
|
||||
KNOWN_VALUES ("No", "Yes");
|
||||
return true;
|
||||
case 9:
|
||||
*tag_name = "THUMB_ISA_use";
|
||||
KNOWN_VALUES ("No", "Thumb-1", "Thumb-2");
|
||||
return true;
|
||||
case 10:
|
||||
*tag_name = "VFP_arch";
|
||||
KNOWN_VALUES ("No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16");
|
||||
return true;
|
||||
case 11:
|
||||
*tag_name = "WMMX_arch";
|
||||
KNOWN_VALUES ("No", "WMMXv1", "WMMXv2");
|
||||
return true;
|
||||
case 12:
|
||||
*tag_name = "Advanced_SIMD_arch";
|
||||
KNOWN_VALUES ("No", "NEONv1");
|
||||
return true;
|
||||
case 13:
|
||||
*tag_name = "PCS_config";
|
||||
KNOWN_VALUES ("None",
|
||||
"Bare platform",
|
||||
"Linux application",
|
||||
"Linux DSO",
|
||||
"PalmOS 2004",
|
||||
"PalmOS (reserved)",
|
||||
"SymbianOS 2004",
|
||||
"SymbianOS (reserved)");
|
||||
return true;
|
||||
case 14:
|
||||
*tag_name = "ABI_PCS_R9_use";
|
||||
KNOWN_VALUES ("V6", "SB", "TLS", "Unused");
|
||||
return true;
|
||||
case 15:
|
||||
*tag_name = "ABI_PCS_RW_data";
|
||||
KNOWN_VALUES ("Absolute", "PC-relative", "SB-relative", "None");
|
||||
return true;
|
||||
case 16:
|
||||
*tag_name = "ABI_PCS_RO_data";
|
||||
KNOWN_VALUES ("Absolute", "PC-relative", "None");
|
||||
return true;
|
||||
case 17:
|
||||
*tag_name = "ABI_PCS_GOT_use";
|
||||
KNOWN_VALUES ("None", "direct", "GOT-indirect");
|
||||
return true;
|
||||
case 18:
|
||||
*tag_name = "ABI_PCS_wchar_t";
|
||||
return true;
|
||||
case 19:
|
||||
*tag_name = "ABI_FP_rounding";
|
||||
KNOWN_VALUES ("Unused", "Needed");
|
||||
return true;
|
||||
case 20:
|
||||
*tag_name = "ABI_FP_denormal";
|
||||
KNOWN_VALUES ("Unused", "Needed", "Sign only");
|
||||
return true;
|
||||
case 21:
|
||||
*tag_name = "ABI_FP_exceptions";
|
||||
KNOWN_VALUES ("Unused", "Needed");
|
||||
return true;
|
||||
case 22:
|
||||
*tag_name = "ABI_FP_user_exceptions";
|
||||
KNOWN_VALUES ("Unused", "Needed");
|
||||
return true;
|
||||
case 23:
|
||||
*tag_name = "ABI_FP_number_model";
|
||||
KNOWN_VALUES ("Unused", "Finite", "RTABI", "IEEE 754");
|
||||
return true;
|
||||
case 24:
|
||||
*tag_name = "ABI_align8_needed";
|
||||
KNOWN_VALUES ("No", "Yes", "4-byte");
|
||||
return true;
|
||||
case 25:
|
||||
*tag_name = "ABI_align8_preserved";
|
||||
KNOWN_VALUES ("No", "Yes, except leaf SP", "Yes");
|
||||
return true;
|
||||
case 26:
|
||||
*tag_name = "ABI_enum_size";
|
||||
KNOWN_VALUES ("Unused", "small", "int", "forced to int");
|
||||
return true;
|
||||
case 27:
|
||||
*tag_name = "ABI_HardFP_use";
|
||||
KNOWN_VALUES ("as VFP_arch", "SP only", "DP only", "SP and DP");
|
||||
return true;
|
||||
case 28:
|
||||
*tag_name = "ABI_VFP_args";
|
||||
KNOWN_VALUES ("AAPCS", "VFP registers", "custom");
|
||||
return true;
|
||||
case 29:
|
||||
*tag_name = "ABI_WMMX_args";
|
||||
KNOWN_VALUES ("AAPCS", "WMMX registers", "custom");
|
||||
return true;
|
||||
case 30:
|
||||
*tag_name = "ABI_optimization_goals";
|
||||
KNOWN_VALUES ("None",
|
||||
"Prefer Speed",
|
||||
"Aggressive Speed",
|
||||
"Prefer Size",
|
||||
"Aggressive Size",
|
||||
"Prefer Debug",
|
||||
"Aggressive Debug");
|
||||
return true;
|
||||
case 31:
|
||||
*tag_name = "ABI_FP_optimization_goals";
|
||||
KNOWN_VALUES ("None",
|
||||
"Prefer Speed",
|
||||
"Aggressive Speed",
|
||||
"Prefer Size",
|
||||
"Aggressive Size",
|
||||
"Prefer Accuracy",
|
||||
"Aggressive Accuracy");
|
||||
return true;
|
||||
case 34:
|
||||
*tag_name = "CPU_unaligned_access";
|
||||
KNOWN_VALUES ("None", "v6");
|
||||
return true;
|
||||
case 36:
|
||||
*tag_name = "VFP_HP_extension";
|
||||
KNOWN_VALUES ("Not Allowed", "Allowed");
|
||||
return true;
|
||||
case 38:
|
||||
*tag_name = "ABI_FP_16bit_format";
|
||||
KNOWN_VALUES ("None", "IEEE 754", "Alternative Format");
|
||||
return true;
|
||||
case 64:
|
||||
*tag_name = "nodefaults";
|
||||
return true;
|
||||
case 65:
|
||||
*tag_name = "also_compatible_with";
|
||||
return true;
|
||||
case 66:
|
||||
*tag_name = "T2EE_use";
|
||||
KNOWN_VALUES ("Not Allowed", "Allowed");
|
||||
return true;
|
||||
case 67:
|
||||
*tag_name = "conformance";
|
||||
return true;
|
||||
case 68:
|
||||
*tag_name = "Virtualization_use";
|
||||
KNOWN_VALUES ("Not Allowed", "Allowed");
|
||||
return true;
|
||||
case 70:
|
||||
*tag_name = "MPextension_use";
|
||||
KNOWN_VALUES ("Not Allowed", "Allowed");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* ARM-specific auxv handling.
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
int
|
||||
EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format)
|
||||
{
|
||||
if (a_type != AT_HWCAP)
|
||||
return 0;
|
||||
|
||||
*name = "HWCAP";
|
||||
*format = "b"
|
||||
"swp\0" "half\0" "thumb\0" "26bit\0"
|
||||
"fast-mult\0" "fpa\0" "vfp\0" "edsp\0"
|
||||
"java\0" "iwmmxt\0"
|
||||
"\0";
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/* arm ABI-specified defaults for DWARF CFI.
|
||||
Copyright (C) 2013 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* ABI-specified state of DWARF CFI based on:
|
||||
|
||||
"DWARF for the ARM Architecture ABI r2.09"
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040b/IHI0040B_aadwarf.pdf
|
||||
|
||||
"Procedure Call Standard for the ARM Architecture ABI r2.09"
|
||||
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf
|
||||
*/
|
||||
|
||||
int
|
||||
arm_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
|
||||
{
|
||||
static const uint8_t abi_cfi[] =
|
||||
{
|
||||
/* The initial Canonical Frame Address is the value of the
|
||||
Stack Pointer (r13) as setup in the previous frame. */
|
||||
DW_CFA_def_cfa, ULEB128_7 (13), ULEB128_7 (0),
|
||||
|
||||
/* The Stack Pointer (r13) is restored from CFA address by default. */
|
||||
DW_CFA_val_offset, ULEB128_7 (13), ULEB128_7 (0),
|
||||
|
||||
#define SV(n) DW_CFA_same_value, ULEB128_7 (n)
|
||||
/* Callee-saved regs r4-r8, r10, r11. */
|
||||
SV (4), SV (5), SV (6), SV (7), SV (8), SV (10), SV (11),
|
||||
|
||||
/* The link register contains the return address setup by caller. */
|
||||
SV (14),
|
||||
DW_CFA_register, ULEB128_7 (15), ULEB128_7 (14), /* pc = lr */
|
||||
#undef SV
|
||||
|
||||
/* VFP S16-S31/D8-D15/Q4-Q7 are callee saved.
|
||||
And uleb128 encoded with two bytes. */
|
||||
#define ULEB128_8_2(x) ((x & 0x7f) | 0x80), 0x02
|
||||
#define SV(n) DW_CFA_same_value, ULEB128_8_2 (n)
|
||||
SV (264), SV (265), SV (266), SV (267),
|
||||
SV (268), SV (269), SV (270), SV (271),
|
||||
|
||||
/* XXX Note: registers intentionally unused by the program,
|
||||
for example as a consequence of the procedure call standard
|
||||
should be initialized as if by DW_CFA_same_value. */
|
||||
};
|
||||
#undef ULEB128_8_2
|
||||
#undef SV
|
||||
|
||||
abi_info->initial_instructions = abi_cfi;
|
||||
abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
|
||||
abi_info->data_alignment_factor = 4;
|
||||
|
||||
abi_info->return_address_register = 15; /* pc. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* ARM specific core note handling.
|
||||
Copyright (C) 2009, 2012 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
static const Ebl_Register_Location prstatus_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 0, .count = 16, .bits = 32 }, /* r0..r15 */
|
||||
{ .offset = 16 * 4, .regno = 128, .count = 1, .bits = 32 }, /* cpsr */
|
||||
};
|
||||
#define PRSTATUS_REGS_SIZE (18 * 4)
|
||||
|
||||
#define PRSTATUS_REGSET_ITEMS \
|
||||
{ \
|
||||
.name = "orig_r0", .type = ELF_T_SWORD, .format = 'd', \
|
||||
.offset = offsetof (struct EBLHOOK(prstatus), pr_reg) + (4 * 17), \
|
||||
.group = "register" \
|
||||
}
|
||||
|
||||
static const Ebl_Register_Location fpregset_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 96, .count = 8, .bits = 96 }, /* f0..f7 */
|
||||
};
|
||||
#define FPREGSET_SIZE 116
|
||||
|
||||
#define ULONG uint32_t
|
||||
#define PID_T int32_t
|
||||
#define UID_T uint16_t
|
||||
#define GID_T uint16_t
|
||||
#define ALIGN_ULONG 4
|
||||
#define ALIGN_PID_T 4
|
||||
#define ALIGN_UID_T 2
|
||||
#define ALIGN_GID_T 2
|
||||
#define TYPE_ULONG ELF_T_WORD
|
||||
#define TYPE_PID_T ELF_T_SWORD
|
||||
#define TYPE_UID_T ELF_T_HALF
|
||||
#define TYPE_GID_T ELF_T_HALF
|
||||
|
||||
#define ARM_VFPREGS_SIZE ( 32 * 8 /*fpregs*/ + 4 /*fpscr*/ )
|
||||
static const Ebl_Register_Location vfp_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 256, .count = 32, .bits = 64 }, /* fpregs */
|
||||
};
|
||||
|
||||
static const Ebl_Core_Item vfp_items[] =
|
||||
{
|
||||
{
|
||||
.name = "fpscr", .group = "register",
|
||||
.offset = 0,
|
||||
.type = ELF_T_WORD, .format = 'x',
|
||||
},
|
||||
};
|
||||
|
||||
#define EXTRA_NOTES \
|
||||
EXTRA_REGSET_ITEMS (NT_ARM_VFP, ARM_VFPREGS_SIZE, vfp_regs, vfp_items)
|
||||
|
||||
#include "linux-core-note.c"
|
||||
@@ -0,0 +1,72 @@
|
||||
/* Initialization of Arm specific backend library.
|
||||
Copyright (C) 2002, 2005, 2009, 2013, 2014, 2015, 2017 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND arm_
|
||||
#define RELOC_PREFIX R_ARM_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on arm_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
|
||||
Ebl *
|
||||
arm_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
/* We handle it. */
|
||||
arm_init_reloc (eh);
|
||||
HOOK (eh, segment_type_name);
|
||||
HOOK (eh, section_type_name);
|
||||
HOOK (eh, machine_flag_check);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, core_note);
|
||||
HOOK (eh, auxv_info);
|
||||
HOOK (eh, check_object_attribute);
|
||||
HOOK (eh, return_value_location);
|
||||
HOOK (eh, abi_cfi);
|
||||
HOOK (eh, check_reloc_target_type);
|
||||
HOOK (eh, symbol_type_name);
|
||||
HOOK (eh, data_marker_symbol);
|
||||
HOOK (eh, machine_flag_name);
|
||||
|
||||
/* We only unwind the core integer registers. */
|
||||
eh->frame_nregs = 16;
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
|
||||
/* Bit zero encodes whether an function address is THUMB or ARM. */
|
||||
eh->func_addr_mask = ~(GElf_Addr)1;
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* Fetch live process registers from TID.
|
||||
Copyright (C) 2014 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined __arm__
|
||||
# include <sys/types.h>
|
||||
# include <sys/user.h>
|
||||
# include <sys/ptrace.h>
|
||||
#endif
|
||||
|
||||
#ifdef __aarch64__
|
||||
# include <linux/uio.h>
|
||||
# include <sys/user.h>
|
||||
# include <sys/ptrace.h>
|
||||
/* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
|
||||
# ifndef HAVE_SYS_USER_REGS
|
||||
# define user_regs_struct user_pt_regs
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
bool
|
||||
arm_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc __attribute__ ((unused)),
|
||||
void *arg __attribute__ ((unused)))
|
||||
{
|
||||
#if !defined(__linux__) || (!defined __arm__ && !defined __aarch64__)
|
||||
return false;
|
||||
#else /* __arm__ || __aarch64__ */
|
||||
#if defined __arm__
|
||||
struct user_regs user_regs;
|
||||
if (ptrace (PTRACE_GETREGS, tid, NULL, &user_regs) != 0)
|
||||
return false;
|
||||
|
||||
Dwarf_Word dwarf_regs[16];
|
||||
/* R0..R12 SP LR PC */
|
||||
for (int i = 0; i < 16; i++)
|
||||
dwarf_regs[i] = user_regs.uregs[i];
|
||||
|
||||
return setfunc (0, 16, dwarf_regs, arg);
|
||||
#elif defined __aarch64__
|
||||
/* Compat mode: arm compatible code running on aarch64 */
|
||||
int i;
|
||||
struct user_regs_struct gregs;
|
||||
struct iovec iovec;
|
||||
iovec.iov_base = &gregs;
|
||||
iovec.iov_len = sizeof (gregs);
|
||||
if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec) != 0)
|
||||
return false;
|
||||
|
||||
Dwarf_Word dwarf_regs[16];
|
||||
/* R0..R12 SP LR PC, encoded as 32 bit quantities */
|
||||
uint32_t *u32_ptr = (uint32_t *) &gregs.regs[0];
|
||||
for (i = 0; i < 16; i++)
|
||||
dwarf_regs[i] = u32_ptr[i];
|
||||
|
||||
return setfunc (0, 16, dwarf_regs, arg);
|
||||
#else
|
||||
# error "source file error, it cannot happen"
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
/* Arm-specific ELF flag names.
|
||||
Copyright (C) 2022 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
const char *
|
||||
arm_machine_flag_name (Elf64_Word orig, Elf64_Word *flagref)
|
||||
{
|
||||
unsigned version = EF_ARM_EABI_VERSION (*flagref) >> 24;
|
||||
if (version != 0)
|
||||
{
|
||||
static const char vername[5][14] =
|
||||
{
|
||||
"Version1 EABI",
|
||||
"Version2 EABI",
|
||||
"Version3 EABI",
|
||||
"Version4 EABI",
|
||||
"Version5 EABI",
|
||||
};
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_EABIMASK);
|
||||
return vername[version - 1];
|
||||
}
|
||||
switch (EF_ARM_EABI_VERSION (orig))
|
||||
{
|
||||
case EF_ARM_EABI_VER2:
|
||||
if ((*flagref & EF_ARM_DYNSYMSUSESEGIDX) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_DYNSYMSUSESEGIDX);
|
||||
return "dynamic symbols use segment index";
|
||||
}
|
||||
if ((*flagref & EF_ARM_MAPSYMSFIRST) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_MAPSYMSFIRST);
|
||||
return "mapping symbols precede others";
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case EF_ARM_EABI_VER1:
|
||||
if ((*flagref & EF_ARM_SYMSARESORTED) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_SYMSARESORTED);
|
||||
return "sorted symbol tables";
|
||||
}
|
||||
break;
|
||||
case EF_ARM_EABI_VER3:
|
||||
break;
|
||||
case EF_ARM_EABI_VER5:
|
||||
if ((*flagref & EF_ARM_SOFT_FLOAT) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_SOFT_FLOAT);
|
||||
return "soft-float ABI";
|
||||
}
|
||||
if ((*flagref & EF_ARM_VFP_FLOAT) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_VFP_FLOAT);
|
||||
return "hard-float ABI";
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case EF_ARM_EABI_VER4:
|
||||
if ((*flagref & EF_ARM_BE8) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_BE8);
|
||||
return "BE8";
|
||||
}
|
||||
if ((*flagref & EF_ARM_LE8) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_LE8);
|
||||
return "LE8";
|
||||
}
|
||||
break;
|
||||
case EF_ARM_EABI_UNKNOWN:
|
||||
if ((*flagref & EF_ARM_INTERWORK) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_INTERWORK);
|
||||
return "interworking enabled";
|
||||
}
|
||||
if ((*flagref & EF_ARM_APCS_26) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_APCS_26);
|
||||
return "uses APCS/26";
|
||||
}
|
||||
if ((*flagref & EF_ARM_APCS_FLOAT) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_APCS_FLOAT);
|
||||
return "uses APCS/float";
|
||||
}
|
||||
if ((*flagref & EF_ARM_PIC) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_PIC);
|
||||
return "position independent";
|
||||
}
|
||||
if ((*flagref & EF_ARM_ALIGN8) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_ALIGN8);
|
||||
return "8 bit structure alignment";
|
||||
}
|
||||
if ((*flagref & EF_ARM_NEW_ABI) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_NEW_ABI);
|
||||
return "uses new ABI";
|
||||
}
|
||||
if ((*flagref & EF_ARM_OLD_ABI) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_OLD_ABI);
|
||||
return "uses old ABI";
|
||||
}
|
||||
if ((*flagref & EF_ARM_SOFT_FLOAT) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_SOFT_FLOAT);
|
||||
return "software FP";
|
||||
}
|
||||
if ((*flagref & EF_ARM_VFP_FLOAT) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_VFP_FLOAT);
|
||||
return "VFP";
|
||||
}
|
||||
if ((*flagref & EF_ARM_MAVERICK_FLOAT) != 0)
|
||||
{
|
||||
*flagref &= ~((Elf64_Word) EF_ARM_MAVERICK_FLOAT);
|
||||
return "Maverick FP";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/* Register names and numbers for ARM DWARF.
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
ssize_t
|
||||
arm_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setname,
|
||||
int *bits, int *type)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 320;
|
||||
|
||||
if (regno < 0 || regno > 320 || namelen < 5)
|
||||
return -1;
|
||||
|
||||
*prefix = "";
|
||||
*bits = 32;
|
||||
*type = DW_ATE_signed;
|
||||
*setname = "integer";
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case 0 ... 9:
|
||||
name[0] = 'r';
|
||||
name[1] = regno + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 10 ... 12:
|
||||
name[0] = 'r';
|
||||
name[1] = '1';
|
||||
name[2] = regno % 10 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 13 ... 15:
|
||||
*type = DW_ATE_address;
|
||||
name[0] = "slp"[regno - 13];
|
||||
name[1] = "prc"[regno - 13];
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 16 + 0 ... 16 + 7:
|
||||
regno += 96 - 16;
|
||||
FALLTHROUGH;
|
||||
case 96 + 0 ... 96 + 7:
|
||||
*setname = "FPA";
|
||||
*type = DW_ATE_float;
|
||||
*bits = 96;
|
||||
name[0] = 'f';
|
||||
name[1] = regno - 96 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 128:
|
||||
*type = DW_ATE_unsigned;
|
||||
return stpcpy (name, "spsr") + 1 - name;
|
||||
|
||||
case 256 + 0 ... 256 + 9:
|
||||
*setname = "VFP";
|
||||
*type = DW_ATE_float;
|
||||
*bits = 64;
|
||||
name[0] = 'd';
|
||||
name[1] = regno - 256 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 256 + 10 ... 256 + 31:
|
||||
*setname = "VFP";
|
||||
*type = DW_ATE_float;
|
||||
*bits = 64;
|
||||
name[0] = 'd';
|
||||
name[1] = (regno - 256) / 10 + '0';
|
||||
name[2] = (regno - 256) % 10 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
*setname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
name[namelen++] = '\0';
|
||||
return namelen;
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/* List the relocation types for arm. -*- C -*-
|
||||
Copyright (C) 2005-2010, 2014, 2015 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, REL) /* It really is used in ET_REL on ARM. */
|
||||
RELOC_TYPE (PC24, REL|EXEC|DYN)
|
||||
RELOC_TYPE (ABS32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (REL32, REL)
|
||||
RELOC_TYPE (PC13, REL)
|
||||
RELOC_TYPE (ABS16, REL)
|
||||
RELOC_TYPE (ABS12, REL)
|
||||
RELOC_TYPE (THM_ABS5, REL)
|
||||
RELOC_TYPE (ABS8, REL)
|
||||
RELOC_TYPE (SBREL32, REL)
|
||||
RELOC_TYPE (THM_PC22, REL)
|
||||
RELOC_TYPE (THM_PC8, REL)
|
||||
RELOC_TYPE (AMP_VCALL9, REL)
|
||||
RELOC_TYPE (TLS_DESC, EXEC|DYN)
|
||||
RELOC_TYPE (THM_SWI8, REL)
|
||||
RELOC_TYPE (XPC25, REL)
|
||||
RELOC_TYPE (THM_XPC22, REL)
|
||||
RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_TPOFF32, EXEC|DYN)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
|
||||
RELOC_TYPE (JUMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (GOTOFF, REL)
|
||||
RELOC_TYPE (GOTPC, REL)
|
||||
RELOC_TYPE (GOT32, REL)
|
||||
RELOC_TYPE (PLT32, REL)
|
||||
RELOC_TYPE (CALL, REL)
|
||||
RELOC_TYPE (JUMP24, REL)
|
||||
RELOC_TYPE (THM_JUMP24, REL)
|
||||
RELOC_TYPE (BASE_ABS, REL)
|
||||
RELOC_TYPE (ALU_PCREL_7_0, REL)
|
||||
RELOC_TYPE (ALU_PCREL_15_8, REL)
|
||||
RELOC_TYPE (ALU_PCREL_23_15, REL)
|
||||
RELOC_TYPE (LDR_SBREL_11_0, REL)
|
||||
RELOC_TYPE (ALU_SBREL_19_12, REL)
|
||||
RELOC_TYPE (ALU_SBREL_27_20, REL)
|
||||
RELOC_TYPE (TARGET1, REL)
|
||||
RELOC_TYPE (SBREL31, REL)
|
||||
RELOC_TYPE (V4BX, REL)
|
||||
RELOC_TYPE (TARGET2, REL)
|
||||
RELOC_TYPE (PREL31, REL)
|
||||
RELOC_TYPE (MOVW_ABS_NC, REL)
|
||||
RELOC_TYPE (MOVT_ABS, REL)
|
||||
RELOC_TYPE (MOVW_PREL_NC, REL)
|
||||
RELOC_TYPE (MOVT_PREL, REL)
|
||||
RELOC_TYPE (THM_MOVW_ABS_NC, REL)
|
||||
RELOC_TYPE (THM_MOVT_ABS, REL)
|
||||
RELOC_TYPE (THM_MOVW_PREL_NC, REL)
|
||||
RELOC_TYPE (THM_MOVT_PREL, REL)
|
||||
RELOC_TYPE (THM_JUMP19, REL)
|
||||
RELOC_TYPE (THM_JUMP6, REL)
|
||||
RELOC_TYPE (THM_ALU_PREL_11_0, REL)
|
||||
RELOC_TYPE (THM_PC12, REL)
|
||||
RELOC_TYPE (ABS32_NOI, REL)
|
||||
RELOC_TYPE (REL32_NOI, REL)
|
||||
RELOC_TYPE (ALU_PC_G0_NC, REL)
|
||||
RELOC_TYPE (ALU_PC_G0, REL)
|
||||
RELOC_TYPE (ALU_PC_G1_NC, REL)
|
||||
RELOC_TYPE (ALU_PC_G1, REL)
|
||||
RELOC_TYPE (ALU_PC_G2, REL)
|
||||
RELOC_TYPE (LDR_PC_G1, REL)
|
||||
RELOC_TYPE (LDR_PC_G2, REL)
|
||||
RELOC_TYPE (LDRS_PC_G0, REL)
|
||||
RELOC_TYPE (LDRS_PC_G1, REL)
|
||||
RELOC_TYPE (LDRS_PC_G2, REL)
|
||||
RELOC_TYPE (LDC_PC_G0, REL)
|
||||
RELOC_TYPE (LDC_PC_G1, REL)
|
||||
RELOC_TYPE (LDC_PC_G2, REL)
|
||||
RELOC_TYPE (ALU_SB_G0_NC, REL)
|
||||
RELOC_TYPE (ALU_SB_G0, REL)
|
||||
RELOC_TYPE (ALU_SB_G1_NC, REL)
|
||||
RELOC_TYPE (ALU_SB_G1, REL)
|
||||
RELOC_TYPE (ALU_SB_G2, REL)
|
||||
RELOC_TYPE (LDR_SB_G0, REL)
|
||||
RELOC_TYPE (LDR_SB_G1, REL)
|
||||
RELOC_TYPE (LDR_SB_G2, REL)
|
||||
RELOC_TYPE (LDRS_SB_G0, REL)
|
||||
RELOC_TYPE (LDRS_SB_G1, REL)
|
||||
RELOC_TYPE (LDRS_SB_G2, REL)
|
||||
RELOC_TYPE (LDC_SB_G0, REL)
|
||||
RELOC_TYPE (LDC_SB_G1, REL)
|
||||
RELOC_TYPE (LDC_SB_G2, REL)
|
||||
RELOC_TYPE (MOVW_BREL_NC, REL)
|
||||
RELOC_TYPE (MOVT_BREL, REL)
|
||||
RELOC_TYPE (MOVW_BREL, REL)
|
||||
RELOC_TYPE (THM_MOVW_BREL_NC, REL)
|
||||
RELOC_TYPE (THM_MOVT_BREL, REL)
|
||||
RELOC_TYPE (THM_MOVW_BREL, REL)
|
||||
RELOC_TYPE (TLS_GOTDESC, REL)
|
||||
RELOC_TYPE (TLS_CALL, REL)
|
||||
RELOC_TYPE (TLS_DESCSEQ, REL)
|
||||
RELOC_TYPE (THM_TLS_CALL, REL)
|
||||
RELOC_TYPE (PLT32_ABS, REL)
|
||||
RELOC_TYPE (GOT_ABS, REL)
|
||||
RELOC_TYPE (GOT_PREL, REL)
|
||||
RELOC_TYPE (GOT_BREL12, REL)
|
||||
RELOC_TYPE (GOTOFF12, REL)
|
||||
RELOC_TYPE (GOTRELAX, REL)
|
||||
RELOC_TYPE (GNU_VTENTRY, REL)
|
||||
RELOC_TYPE (GNU_VTINHERIT, REL)
|
||||
RELOC_TYPE (THM_PC11, REL)
|
||||
RELOC_TYPE (THM_PC9, REL)
|
||||
RELOC_TYPE (TLS_GD32, REL)
|
||||
RELOC_TYPE (TLS_LDM32, REL)
|
||||
RELOC_TYPE (TLS_LDO32, REL)
|
||||
RELOC_TYPE (TLS_IE32, REL)
|
||||
RELOC_TYPE (TLS_LE32, REL)
|
||||
RELOC_TYPE (TLS_LDO12, REL)
|
||||
RELOC_TYPE (TLS_LE12, REL)
|
||||
RELOC_TYPE (TLS_IE12GP, REL)
|
||||
|
||||
RELOC_TYPE (ME_TOO, REL)
|
||||
RELOC_TYPE (THM_TLS_DESCSEQ16, REL)
|
||||
RELOC_TYPE (THM_TLS_DESCSEQ32, REL)
|
||||
RELOC_TYPE (THM_GOT_BREL12, REL)
|
||||
|
||||
RELOC_TYPE (IRELATIVE, EXEC|DYN)
|
||||
|
||||
RELOC_TYPE (RXPC25, REL)
|
||||
RELOC_TYPE (RSBREL32, REL)
|
||||
RELOC_TYPE (THM_RPC22, REL)
|
||||
RELOC_TYPE (RREL32, REL)
|
||||
RELOC_TYPE (RABS22, REL)
|
||||
RELOC_TYPE (RPC24, REL)
|
||||
RELOC_TYPE (RBASE, REL)
|
||||
@@ -0,0 +1,126 @@
|
||||
/* Function return value location for ARM EABI.
|
||||
Copyright (C) 2009-2010, 2014 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* r0, or pair r0, r1, or aggregate up to r0-r3. */
|
||||
static const Dwarf_Op loc_intreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
{ .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
{ .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
{ .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
};
|
||||
#define nloc_intreg 1
|
||||
#define nloc_intregs(n) (2 * (n))
|
||||
|
||||
/* The return value is a structure and is actually stored in stack space
|
||||
passed in a hidden argument by the caller. But, the compiler
|
||||
helpfully returns the address of that space in r0. */
|
||||
static const Dwarf_Op loc_aggregate[] =
|
||||
{
|
||||
{ .atom = DW_OP_breg0, .number = 0 }
|
||||
};
|
||||
#define nloc_aggregate 1
|
||||
|
||||
|
||||
int
|
||||
arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
{
|
||||
/* Start with the function's type, and get the DW_AT_type attribute,
|
||||
which is the type of the return value. */
|
||||
Dwarf_Die die_mem, *typedie = &die_mem;
|
||||
int tag = dwarf_peeled_die_type (functypedie, typedie);
|
||||
if (tag <= 0)
|
||||
return tag;
|
||||
|
||||
Dwarf_Word size;
|
||||
switch (tag)
|
||||
{
|
||||
case -1:
|
||||
return -1;
|
||||
|
||||
case DW_TAG_subrange_type:
|
||||
if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
|
||||
{
|
||||
Dwarf_Attribute attr_mem, *attr;
|
||||
attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
typedie = dwarf_formref_die (attr, &die_mem);
|
||||
tag = DWARF_TAG_OR_RETURN (typedie);
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 4;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
if (size <= 16)
|
||||
{
|
||||
intreg:
|
||||
*locp = loc_intreg;
|
||||
return size <= 4 ? nloc_intreg : nloc_intregs ((size + 3) / 4);
|
||||
}
|
||||
|
||||
aggregate:
|
||||
*locp = loc_aggregate;
|
||||
return nloc_aggregate;
|
||||
}
|
||||
|
||||
case DW_TAG_structure_type:
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_union_type:
|
||||
case DW_TAG_array_type:
|
||||
if (dwarf_aggregate_size (typedie, &size) == 0
|
||||
&& size > 0 && size <= 4)
|
||||
goto intreg;
|
||||
goto aggregate;
|
||||
}
|
||||
|
||||
/* XXX We don't have a good way to return specific errors from ebl calls.
|
||||
This value means we do not understand the type, but it is well-formed
|
||||
DWARF and might be valid. */
|
||||
return -2;
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
/* Arm specific symbolic name handling.
|
||||
Copyright (C) 2002-2009, 2014, 2015, 2017 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <system.h>
|
||||
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
const char *
|
||||
arm_segment_type_name (int segment, char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (segment)
|
||||
{
|
||||
case PT_ARM_EXIDX:
|
||||
return "ARM_EXIDX";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return symbolic representation of section type. */
|
||||
const char *
|
||||
arm_section_type_name (int type,
|
||||
char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SHT_ARM_EXIDX:
|
||||
return "ARM_EXIDX";
|
||||
case SHT_ARM_PREEMPTMAP:
|
||||
return "ARM_PREEMPTMAP";
|
||||
case SHT_ARM_ATTRIBUTES:
|
||||
return "ARM_ATTRIBUTES";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check whether machine flags are valid. */
|
||||
bool
|
||||
arm_machine_flag_check (GElf_Word flags)
|
||||
{
|
||||
switch (flags & EF_ARM_EABIMASK)
|
||||
{
|
||||
case EF_ARM_EABI_UNKNOWN:
|
||||
case EF_ARM_EABI_VER1:
|
||||
case EF_ARM_EABI_VER2:
|
||||
case EF_ARM_EABI_VER3:
|
||||
case EF_ARM_EABI_VER4:
|
||||
case EF_ARM_EABI_VER5:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((flags &~ (EF_ARM_EABIMASK
|
||||
| EF_ARM_RELEXEC
|
||||
| EF_ARM_HASENTRY
|
||||
| EF_ARM_INTERWORK
|
||||
| EF_ARM_APCS_26
|
||||
| EF_ARM_APCS_FLOAT
|
||||
| EF_ARM_PIC
|
||||
| EF_ARM_ALIGN8
|
||||
| EF_ARM_NEW_ABI
|
||||
| EF_ARM_OLD_ABI
|
||||
| EF_ARM_SOFT_FLOAT
|
||||
| EF_ARM_VFP_FLOAT
|
||||
| EF_ARM_MAVERICK_FLOAT
|
||||
| EF_ARM_SYMSARESORTED
|
||||
| EF_ARM_DYNSYMSUSESEGIDX
|
||||
| EF_ARM_MAPSYMSFIRST
|
||||
| EF_ARM_EABIMASK
|
||||
| EF_ARM_BE8
|
||||
| EF_ARM_LE8)) == 0);
|
||||
}
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_ARM_ABS32:
|
||||
return ELF_T_WORD;
|
||||
case R_ARM_ABS16:
|
||||
return ELF_T_HALF;
|
||||
case R_ARM_ABS8:
|
||||
return ELF_T_BYTE;
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
/* The SHT_ARM_EXIDX section type is a valid target for relocation. */
|
||||
bool
|
||||
arm_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_type)
|
||||
{
|
||||
return sh_type == SHT_ARM_EXIDX;
|
||||
}
|
||||
|
||||
const char *
|
||||
arm_symbol_type_name (int type,
|
||||
char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case STT_ARM_TFUNC:
|
||||
return "ARM_TFUNC";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* A data mapping symbol is a symbol with "$d" name or "$d.<any...>" name,
|
||||
* STT_NOTYPE, STB_LOCAL and st_size of zero. The indicate the stat of a
|
||||
* sequence of data items. */
|
||||
bool
|
||||
arm_data_marker_symbol (const GElf_Sym *sym, const char *sname)
|
||||
{
|
||||
return (sym != NULL && sname != NULL
|
||||
&& sym->st_size == 0 && GELF_ST_BIND (sym->st_info) == STB_LOCAL
|
||||
&& GELF_ST_TYPE (sym->st_info) == STT_NOTYPE
|
||||
&& (strcmp (sname, "$d") == 0 || startswith (sname, "$d.")));
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/* Initialization of BPF specific backend library.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND bpf_
|
||||
#define RELOC_PREFIX R_BPF_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on bpf_reloc.def. */
|
||||
#define NO_RELATIVE_RELOC
|
||||
#define NO_COPY_RELOC
|
||||
#include "common-reloc.c"
|
||||
|
||||
|
||||
Ebl *
|
||||
bpf_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
/* We handle it. */
|
||||
bpf_init_reloc (eh);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, disasm);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/* Register names and numbers for BPF DWARF.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bpf.h"
|
||||
|
||||
#define BACKEND bpf_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
ssize_t
|
||||
bpf_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setname,
|
||||
int *bits, int *type)
|
||||
{
|
||||
ssize_t len;
|
||||
|
||||
if (name == NULL)
|
||||
return MAX_BPF_REG;
|
||||
if (regno < 0 || regno >= MAX_BPF_REG)
|
||||
return -1;
|
||||
|
||||
*prefix = "";
|
||||
*setname = "integer";
|
||||
*bits = 64;
|
||||
*type = DW_ATE_signed;
|
||||
|
||||
len = snprintf(name, namelen, "r%d", regno);
|
||||
return ((size_t)len < namelen ? len : -1);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/* List the relocation types for BPF. -*- C -*-
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, EXEC|DYN)
|
||||
RELOC_TYPE (64_64, REL)
|
||||
RELOC_TYPE (64_32, REL)
|
||||
@@ -0,0 +1,55 @@
|
||||
/* BPF specific symbolic name handling.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND bpf_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
bpf_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_BPF_64_64:
|
||||
return ELF_T_XWORD;
|
||||
case R_BPF_64_32:
|
||||
return ELF_T_WORD;
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/* Common code for ebl reloc functions.
|
||||
Copyright (C) 2005, 2006 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "libebl_CPU.h"
|
||||
#include <assert.h>
|
||||
|
||||
#define R_TYPE(name) PASTE (RELOC_PREFIX, name)
|
||||
#define PASTE(a, b) PASTE_1 (a, b)
|
||||
#define PASTE_1(a, b) a##b
|
||||
#define R_NAME(name) R_NAME_1 (RELOC_PREFIX, name)
|
||||
#define R_NAME_1(prefix, type) R_NAME_2 (prefix, type)
|
||||
#define R_NAME_2(prefix, type) #prefix #type
|
||||
|
||||
#define RELOC_TYPES STRINGIFIED_PASTE (BACKEND, reloc.def)
|
||||
#define STRINGIFIED_PASTE(a, b) STRINGIFY (PASTE (a, b))
|
||||
#define STRINGIFY(x) STRINGIFY_1 (x)
|
||||
#define STRINGIFY_1(x) #x
|
||||
|
||||
/* Provide a table of reloc type names, in a PIC-friendly fashion. */
|
||||
|
||||
static const struct EBLHOOK(reloc_nametable)
|
||||
{
|
||||
char zero[1];
|
||||
#define RELOC_TYPE(type, uses) \
|
||||
char name_##type[sizeof R_NAME (type)];
|
||||
#include RELOC_TYPES
|
||||
#undef RELOC_TYPE
|
||||
} EBLHOOK(reloc_nametable) =
|
||||
{
|
||||
{ '\0' },
|
||||
#define RELOC_TYPE(type, uses) R_NAME (type),
|
||||
#include RELOC_TYPES
|
||||
#undef RELOC_TYPE
|
||||
};
|
||||
#define reloc_namestr (&EBLHOOK(reloc_nametable).zero)
|
||||
|
||||
static const uint_fast16_t EBLHOOK(reloc_nameidx)[] =
|
||||
{
|
||||
#define RELOC_TYPE(type, uses) \
|
||||
[R_TYPE (type)] = offsetof (struct EBLHOOK(reloc_nametable), name_##type),
|
||||
#include RELOC_TYPES
|
||||
#undef RELOC_TYPE
|
||||
};
|
||||
#define nreloc \
|
||||
((int) (sizeof EBLHOOK(reloc_nameidx) / sizeof EBLHOOK(reloc_nameidx)[0]))
|
||||
|
||||
#define REL (1 << (ET_REL - 1))
|
||||
#define EXEC (1 << (ET_EXEC - 1))
|
||||
#define DYN (1 << (ET_DYN - 1))
|
||||
static const uint8_t EBLHOOK(reloc_valid)[] =
|
||||
{
|
||||
#define RELOC_TYPE(type, uses) [R_TYPE (type)] = uses,
|
||||
#include RELOC_TYPES
|
||||
#undef RELOC_TYPE
|
||||
};
|
||||
#undef REL
|
||||
#undef EXEC
|
||||
#undef DYN
|
||||
|
||||
const char *
|
||||
EBLHOOK(reloc_type_name) (int reloc,
|
||||
char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
#ifdef RELOC_TYPE_ID
|
||||
reloc = RELOC_TYPE_ID (reloc);
|
||||
#endif
|
||||
|
||||
if (reloc >= 0 && reloc < nreloc && EBLHOOK(reloc_nameidx)[reloc] != 0)
|
||||
return reloc_namestr[EBLHOOK(reloc_nameidx)[reloc]];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
EBLHOOK(reloc_type_check) (int reloc)
|
||||
{
|
||||
#ifdef RELOC_TYPE_ID
|
||||
reloc = RELOC_TYPE_ID (reloc);
|
||||
#endif
|
||||
|
||||
return reloc >= 0 && reloc < nreloc && EBLHOOK(reloc_nameidx)[reloc] != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
EBLHOOK(reloc_valid_use) (Elf *elf, int reloc)
|
||||
{
|
||||
uint8_t uses;
|
||||
|
||||
GElf_Ehdr ehdr_mem;
|
||||
GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
|
||||
assert (ehdr != NULL);
|
||||
uint8_t type = ehdr->e_type;
|
||||
|
||||
#ifdef RELOC_TYPE_ID
|
||||
reloc = RELOC_TYPE_ID (reloc);
|
||||
#endif
|
||||
|
||||
uses = EBLHOOK(reloc_valid)[reloc];
|
||||
return type > ET_NONE && type < ET_CORE && (uses & (1 << (type - 1)));
|
||||
}
|
||||
|
||||
#ifndef NO_COPY_RELOC
|
||||
bool
|
||||
EBLHOOK(copy_reloc_p) (int reloc)
|
||||
{
|
||||
return reloc == R_TYPE (COPY);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
EBLHOOK(none_reloc_p) (int reloc)
|
||||
{
|
||||
return reloc == R_TYPE (NONE);
|
||||
}
|
||||
|
||||
#ifndef NO_RELATIVE_RELOC
|
||||
bool
|
||||
EBLHOOK(relative_reloc_p) (int reloc)
|
||||
{
|
||||
return reloc == R_TYPE (RELATIVE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
EBLHOOK(init_reloc) (Ebl *ebl)
|
||||
{
|
||||
ebl->reloc_type_name = EBLHOOK(reloc_type_name);
|
||||
ebl->reloc_type_check = EBLHOOK(reloc_type_check);
|
||||
ebl->reloc_valid_use = EBLHOOK(reloc_valid_use);
|
||||
ebl->none_reloc_p = EBLHOOK(none_reloc_p);
|
||||
#ifndef NO_COPY_RELOC
|
||||
ebl->copy_reloc_p = EBLHOOK(copy_reloc_p);
|
||||
#endif
|
||||
#ifndef NO_RELATIVE_RELOC
|
||||
ebl->relative_reloc_p = EBLHOOK(relative_reloc_p);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/* C-SKY ABI-specified defaults for DWARF CFI.
|
||||
Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND csky_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
bool
|
||||
csky_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
|
||||
const char *vendor, int tag,
|
||||
uint64_t value __attribute__ ((unused)),
|
||||
const char **tag_name,
|
||||
const char **value_name __attribute__ ((unused)))
|
||||
{
|
||||
if (!strcmp (vendor, "csky"))
|
||||
switch (tag)
|
||||
{
|
||||
case 4:
|
||||
*tag_name = "CSKY_ARCH_NAME";
|
||||
return true;
|
||||
|
||||
case 5:
|
||||
*tag_name = "CSKY_CPU_NAME";
|
||||
return true;
|
||||
|
||||
case 6:
|
||||
*tag_name = "CSKY_ISA_FLAGS";
|
||||
return true;
|
||||
|
||||
case 7:
|
||||
*tag_name = "CSKY_ISA_EXT_FLAGS";
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/* C-SKY ABI-specified defaults for DWARF CFI.
|
||||
Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND csky_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
int
|
||||
csky_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
|
||||
{
|
||||
static const uint8_t abi_cfi[] =
|
||||
{
|
||||
DW_CFA_def_cfa, ULEB128_7 (14), ULEB128_7 (0),
|
||||
DW_CFA_val_offset, ULEB128_7 (14), ULEB128_7 (0),
|
||||
|
||||
#define SV(n) DW_CFA_same_value, ULEB128_7 (n)
|
||||
SV(4), SV (5), SV (6), SV (7), SV (8), SV (9),
|
||||
SV(10), SV (11), SV (15), SV (16), SV (17)
|
||||
#undef SV
|
||||
};
|
||||
|
||||
abi_info->initial_instructions = abi_cfi;
|
||||
abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
|
||||
abi_info->data_alignment_factor = -4;
|
||||
|
||||
abi_info->return_address_register = 15; /* lr. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/* C-SKY specific core note handling.
|
||||
Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define BACKEND csky_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
#define ULONG uint32_t
|
||||
#define PID_T int32_t
|
||||
#define UID_T uint32_t
|
||||
#define GID_T uint32_t
|
||||
#define ALIGN_ULONG 4
|
||||
#define ALIGN_PID_T 4
|
||||
#define ALIGN_UID_T 4
|
||||
#define ALIGN_GID_T 4
|
||||
#define TYPE_ULONG ELF_T_WORD
|
||||
#define TYPE_PID_T ELF_T_SWORD
|
||||
#define TYPE_UID_T ELF_T_WORD
|
||||
#define TYPE_GID_T ELF_T_WORD
|
||||
|
||||
static const Ebl_Register_Location prstatus_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 0, .count = 36, .bits = 32 } /* r0..r31 */
|
||||
};
|
||||
#define PRSTATUS_REGS_SIZE (36 * 4)
|
||||
|
||||
#include "linux-core-note.c"
|
||||
@@ -0,0 +1,60 @@
|
||||
/* Initialization of C-SKY specific backend library.
|
||||
Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND csky_
|
||||
#define RELOC_PREFIX R_CKCORE_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on csky_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
Ebl *
|
||||
csky_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
/* We handle it. */
|
||||
csky_init_reloc (eh);
|
||||
HOOK (eh, abi_cfi);
|
||||
HOOK (eh, core_note);
|
||||
HOOK (eh, check_object_attribute);
|
||||
HOOK (eh, machine_flag_check);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, section_type_name);
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
|
||||
/* gcc/config/ #define DWARF_FRAME_REGISTERS. */
|
||||
eh->frame_nregs = 38;
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/* Fetch live process registers from TID. C-SKY version.
|
||||
Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include <assert.h>
|
||||
#if defined __CSKY__ && defined __linux__
|
||||
# include <sys/uio.h>
|
||||
# include <sys/procfs.h>
|
||||
# include <sys/ptrace.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND csky_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
bool
|
||||
csky_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc __attribute__ ((unused)),
|
||||
void *arg __attribute__ ((unused)))
|
||||
{
|
||||
#if !defined __CSKY__ || !defined __linux__
|
||||
return false;
|
||||
#else /* __CSKY__ */
|
||||
struct pt_regs user_regs;
|
||||
struct iovec iovec;
|
||||
iovec.iov_base = &user_regs;
|
||||
iovec.iov_len = sizeof (user_regs);
|
||||
if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec) != 0)
|
||||
return false;
|
||||
|
||||
Dwarf_Word dwarf_regs[38];
|
||||
|
||||
/* lr. */
|
||||
dwarf_regs[15] = user_regs.lr;
|
||||
/* sp. */
|
||||
dwarf_regs[14] = user_regs.usp;
|
||||
/* r0 ~ r13. */
|
||||
dwarf_regs[0] = user_regs.a0;
|
||||
dwarf_regs[1] = user_regs.a1;
|
||||
dwarf_regs[2] = user_regs.a2;
|
||||
dwarf_regs[3] = user_regs.a3;
|
||||
for (int i = 4; i < 14; i++)
|
||||
dwarf_regs[i] = user_regs.regs[i - 4];
|
||||
/* r ~ r13. */
|
||||
for (int i = 16; i < 31; i++)
|
||||
dwarf_regs[i] = user_regs.exregs[i - 16];
|
||||
/* tls. */
|
||||
dwarf_regs[31] = user_regs.tls;
|
||||
/* hi. */
|
||||
dwarf_regs[36] = user_regs.rhi;
|
||||
/* lo. */
|
||||
dwarf_regs[37] = user_regs.rlo;
|
||||
/* pc. */
|
||||
dwarf_regs[32] = user_regs.pc;
|
||||
setfunc (-1, 1, &dwarf_regs[32], arg);
|
||||
|
||||
return setfunc (0, 38, dwarf_regs, arg);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/* Register names and numbers for C-SKY DWARF.
|
||||
Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND csky_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
ssize_t
|
||||
csky_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setname,
|
||||
int *bits, int *type)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 38;
|
||||
|
||||
*prefix = "";
|
||||
*bits = 32;
|
||||
*type = DW_ATE_signed;
|
||||
*setname = "integer";
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case 0 ... 9:
|
||||
name[0] = 'r';
|
||||
name[1] = regno + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 10 ... 13:
|
||||
case 16 ... 30:
|
||||
name[0] = 'r';
|
||||
name[1] = regno / 10 + '0';
|
||||
name[2] = regno % 10 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 14:
|
||||
stpcpy (name, "sp");
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
stpcpy (name, "lr");
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 31:
|
||||
stpcpy (name, "tls");
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 36:
|
||||
stpcpy (name, "hi");
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 37:
|
||||
stpcpy (name, "lo");
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
*setname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
name[namelen++] = '\0';
|
||||
return namelen;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/* List the relocation types for csky. -*- C -*-
|
||||
Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
|
||||
RELOC_TYPE (NONE, REL|EXEC|DYN)
|
||||
RELOC_TYPE (ADDR32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (PCRELIMM8BY4, REL)
|
||||
RELOC_TYPE (PCRELIMM11BY2, REL)
|
||||
RELOC_TYPE (PCREL32, REL|DYN)
|
||||
RELOC_TYPE (PCRELJSR_IMM11BY2, REL)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
|
||||
RELOC_TYPE (JUMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (GOTOFF, REL)
|
||||
RELOC_TYPE (GOTPC, REL)
|
||||
RELOC_TYPE (GOT32, REL)
|
||||
RELOC_TYPE (PLT32, REL)
|
||||
RELOC_TYPE (ADDRGOT, REL)
|
||||
RELOC_TYPE (ADDRPLT, REL)
|
||||
RELOC_TYPE (PCREL_IMM26BY2, REL)
|
||||
RELOC_TYPE (PCREL_IMM16BY2, REL)
|
||||
RELOC_TYPE (PCREL_IMM16BY4, REL)
|
||||
RELOC_TYPE (PCREL_IMM10BY2, REL)
|
||||
RELOC_TYPE (PCREL_IMM10BY4, REL)
|
||||
RELOC_TYPE (ADDR_HI16, REL|DYN)
|
||||
RELOC_TYPE (ADDR_LO16, REL|DYN)
|
||||
RELOC_TYPE (GOTPC_HI16, REL)
|
||||
RELOC_TYPE (GOTPC_LO16, REL)
|
||||
RELOC_TYPE (GOTOFF_HI16, REL)
|
||||
RELOC_TYPE (GOTOFF_LO16, REL)
|
||||
RELOC_TYPE (GOT12, REL)
|
||||
RELOC_TYPE (GOT_HI16, REL)
|
||||
RELOC_TYPE (GOT_LO16, REL)
|
||||
RELOC_TYPE (PLT12, REL)
|
||||
RELOC_TYPE (PLT_HI16, REL)
|
||||
RELOC_TYPE (PLT_LO16, REL)
|
||||
RELOC_TYPE (ADDRGOT_HI16, REL)
|
||||
RELOC_TYPE (ADDRGOT_LO16, REL)
|
||||
RELOC_TYPE (ADDRPLT_HI16, REL)
|
||||
RELOC_TYPE (ADDRPLT_LO16, REL)
|
||||
RELOC_TYPE (PCREL_JSR_IMM26BY2, REL|DYN)
|
||||
RELOC_TYPE (TOFFSET_LO16, REL)
|
||||
RELOC_TYPE (DOFFSET_LO16, REL)
|
||||
RELOC_TYPE (PCREL_IMM18BY2, REL)
|
||||
RELOC_TYPE (DOFFSET_IMM18, REL)
|
||||
RELOC_TYPE (DOFFSET_IMM18BY2, REL)
|
||||
RELOC_TYPE (DOFFSET_IMM18BY4, REL)
|
||||
RELOC_TYPE (GOT_IMM18BY4, REL)
|
||||
RELOC_TYPE (PLT_IMM18BY4, REL)
|
||||
RELOC_TYPE (PCREL_IMM7BY4, REL)
|
||||
RELOC_TYPE (TLS_LE32, REL)
|
||||
RELOC_TYPE (TLS_IE32, REL)
|
||||
RELOC_TYPE (TLS_GD32, REL)
|
||||
RELOC_TYPE (TLS_LDM32, REL)
|
||||
RELOC_TYPE (TLS_LDO32, REL)
|
||||
RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_TPOFF32, EXEC|DYN)
|
||||
@@ -0,0 +1,77 @@
|
||||
/* C-SKY specific symbolic name handling.
|
||||
Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND csky_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
csky_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_CKCORE_ADDR32:
|
||||
return ELF_T_WORD;
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
csky_machine_flag_check (GElf_Word flags)
|
||||
{
|
||||
switch (flags & EF_CSKY_ABIMASK)
|
||||
{
|
||||
case EF_CSKY_ABIV2:
|
||||
return true;
|
||||
case EF_CSKY_ABIV1:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
csky_section_type_name (int type,
|
||||
char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
if (type == SHT_CSKY_ATTRIBUTES)
|
||||
return "CSKY_ATTRIBUTES";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/* i386 specific auxv handling.
|
||||
Copyright (C) 2007 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND i386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
int
|
||||
EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format)
|
||||
{
|
||||
if (a_type != AT_HWCAP)
|
||||
return 0;
|
||||
|
||||
*name = "HWCAP";
|
||||
*format = "b"
|
||||
"fpu\0" "vme\0" "de\0" "pse\0" "tsc\0" "msr\0" "pae\0" "mce\0"
|
||||
"cx8\0" "apic\0" "10\0" "sep\0" "mtrr\0" "pge\0" "mca\0" "cmov\0"
|
||||
"pat\0" "pse36\0" "pn\0" "clflush\0" "20\0" "dts\0" "acpi\0" "mmx\0"
|
||||
"fxsr\0" "sse\0" "sse2\0" "ss\0" "ht\0" "tm\0" "ia64\0" "pbe\0" "\0";
|
||||
return 1;
|
||||
}
|
||||
|
||||
__typeof (i386_auxv_info) x86_64_auxv_info
|
||||
__attribute__ ((alias ("i386_auxv_info")));
|
||||
@@ -0,0 +1,68 @@
|
||||
/* i386 ABI-specified defaults for DWARF CFI.
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND i386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
int
|
||||
i386_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
|
||||
{
|
||||
static const uint8_t abi_cfi[] =
|
||||
{
|
||||
/* Call-saved regs. */
|
||||
DW_CFA_same_value, ULEB128_7 (3), /* %ebx */
|
||||
DW_CFA_same_value, ULEB128_7 (5), /* %ebp */
|
||||
DW_CFA_same_value, ULEB128_7 (6), /* %esi */
|
||||
DW_CFA_same_value, ULEB128_7 (7), /* %edi */
|
||||
|
||||
/* The CFA is the SP. */
|
||||
DW_CFA_val_offset, ULEB128_7 (4), ULEB128_7 (0),
|
||||
|
||||
/* Segment registers are call-saved if ever used at all. */
|
||||
DW_CFA_same_value, ULEB128_7 (40), /* %es */
|
||||
DW_CFA_same_value, ULEB128_7 (41), /* %cs */
|
||||
DW_CFA_same_value, ULEB128_7 (42), /* %ss */
|
||||
DW_CFA_same_value, ULEB128_7 (43), /* %ds */
|
||||
DW_CFA_same_value, ULEB128_7 (44), /* %fs */
|
||||
DW_CFA_same_value, ULEB128_7 (45), /* %gs */
|
||||
};
|
||||
|
||||
abi_info->initial_instructions = abi_cfi;
|
||||
abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
|
||||
abi_info->data_alignment_factor = 4;
|
||||
|
||||
abi_info->return_address_register = 8; /* %eip */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/* i386 specific core note handling.
|
||||
Copyright (C) 2007-2010 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define BACKEND i386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
static const Ebl_Register_Location prstatus_regs[] =
|
||||
{
|
||||
#define GR(at, n, dwreg) \
|
||||
{ .offset = at * 4, .regno = dwreg, .count = n, .bits = 32 }
|
||||
#define SR(at, n, dwreg) \
|
||||
{ .offset = at * 4, .regno = dwreg, .count = n, .bits = 16, .pad = 2 }
|
||||
|
||||
GR (0, 1, 3), /* %ebx */
|
||||
GR (1, 2, 1), /* %ecx-%edx */
|
||||
GR (3, 2, 6), /* %esi-%edi */
|
||||
GR (5, 1, 5), /* %ebp */
|
||||
GR (6, 1, 0), /* %eax */
|
||||
SR (7, 1, 43), /* %ds */
|
||||
SR (8, 1, 40), /* %es */
|
||||
SR (9, 1, 44), /* %fs */
|
||||
SR (10, 1, 45), /* %gs */
|
||||
/* 11, 1, orig_eax */
|
||||
GR (12, 1, 8), /* %eip */
|
||||
SR (13, 1, 41), /* %cs */
|
||||
GR (14, 1, 9), /* eflags */
|
||||
GR (15, 1, 4), /* %esp */
|
||||
SR (16, 1, 42), /* %ss */
|
||||
|
||||
#undef GR
|
||||
#undef SR
|
||||
};
|
||||
#define PRSTATUS_REGS_SIZE (17 * 4)
|
||||
|
||||
#define ULONG uint32_t
|
||||
#define PID_T int32_t
|
||||
#define UID_T uint16_t
|
||||
#define GID_T uint16_t
|
||||
#define ALIGN_ULONG 4
|
||||
#define ALIGN_PID_T 4
|
||||
#define ALIGN_UID_T 2
|
||||
#define ALIGN_GID_T 2
|
||||
#define TYPE_ULONG ELF_T_WORD
|
||||
#define TYPE_PID_T ELF_T_SWORD
|
||||
#define TYPE_UID_T ELF_T_HALF
|
||||
#define TYPE_GID_T ELF_T_HALF
|
||||
|
||||
#define PRSTATUS_REGSET_ITEMS \
|
||||
{ \
|
||||
.name = "orig_eax", .type = ELF_T_SWORD, .format = 'd', \
|
||||
.offset = offsetof (struct EBLHOOK(prstatus), pr_reg) + (4 * 11), \
|
||||
.group = "register" \
|
||||
}
|
||||
|
||||
static const Ebl_Register_Location fpregset_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 37, .count = 2, .bits = 32 }, /* fctrl-fstat */
|
||||
{ .offset = 7 * 4, .regno = 11, .count = 8, .bits = 80 }, /* stN */
|
||||
};
|
||||
#define FPREGSET_SIZE 108
|
||||
|
||||
static const Ebl_Register_Location prxfpreg_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 37, .count = 2, .bits = 16 }, /* fctrl-fstat */
|
||||
{ .offset = 24, .regno = 39, .count = 1, .bits = 32 }, /* mxcsr */
|
||||
{ .offset = 32, .regno = 11, .count = 8, .bits = 80, .pad = 6 }, /* stN */
|
||||
{ .offset = 32 + 128, .regno = 21, .count = 8, .bits = 128 }, /* xmm */
|
||||
};
|
||||
|
||||
#define EXTRA_NOTES \
|
||||
EXTRA_REGSET (NT_PRXFPREG, 512, prxfpreg_regs) \
|
||||
case NT_386_TLS: \
|
||||
return tls_info (nhdr->n_descsz, regs_offset, nregloc, reglocs, \
|
||||
nitems, items); \
|
||||
EXTRA_NOTES_IOPERM
|
||||
|
||||
static const Ebl_Core_Item tls_items[] =
|
||||
{
|
||||
{ .type = ELF_T_WORD, .offset = 0x0, .format = 'd', .name = "index" },
|
||||
{ .type = ELF_T_WORD, .offset = 0x4, .format = 'x', .name = "base" },
|
||||
{ .type = ELF_T_WORD, .offset = 0x8, .format = 'x', .name = "limit" },
|
||||
{ .type = ELF_T_WORD, .offset = 0xc, .format = 'x', .name = "flags" },
|
||||
};
|
||||
|
||||
static int
|
||||
tls_info (GElf_Word descsz, GElf_Word *regs_offset,
|
||||
size_t *nregloc, const Ebl_Register_Location **reglocs,
|
||||
size_t *nitems, const Ebl_Core_Item **items)
|
||||
{
|
||||
if (descsz % 16 != 0)
|
||||
return 0;
|
||||
|
||||
*regs_offset = 0;
|
||||
*nregloc = 0;
|
||||
*reglocs = NULL;
|
||||
*nitems = sizeof tls_items / sizeof tls_items[0];
|
||||
*items = tls_items;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include "x86_corenote.c"
|
||||
#include "linux-core-note.c"
|
||||
@@ -0,0 +1,64 @@
|
||||
/* Initialization of i386 specific backend library.
|
||||
Copyright (C) 2000-2009, 2013, 2017 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND i386_
|
||||
#define RELOC_PREFIX R_386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on i386_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
Ebl *
|
||||
i386_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
/* We handle it. */
|
||||
i386_init_reloc (eh);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, gotpc_reloc_check);
|
||||
HOOK (eh, core_note);
|
||||
generic_debugscn_p = eh->debugscn_p;
|
||||
HOOK (eh, debugscn_p);
|
||||
HOOK (eh, return_value_location);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, auxv_info);
|
||||
HOOK (eh, disasm);
|
||||
HOOK (eh, abi_cfi);
|
||||
/* gcc/config/ #define DWARF_FRAME_REGISTERS. For i386 it is 17, why? */
|
||||
eh->frame_nregs = 9;
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
HOOK (eh, unwind);
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/* Fetch live process registers from TID.
|
||||
Copyright (C) 2013 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if (defined __i386__ || defined __x86_64__) && defined(__linux__)
|
||||
# include <sys/types.h>
|
||||
# include <sys/user.h>
|
||||
# include <sys/ptrace.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND i386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
bool
|
||||
i386_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc __attribute__ ((unused)),
|
||||
void *arg __attribute__ ((unused)))
|
||||
{
|
||||
#if (!defined __i386__ && !defined __x86_64__) || !defined(__linux__)
|
||||
return false;
|
||||
#else /* __i386__ || __x86_64__ */
|
||||
struct user_regs_struct user_regs;
|
||||
if (ptrace (PTRACE_GETREGS, tid, NULL, &user_regs) != 0)
|
||||
return false;
|
||||
Dwarf_Word dwarf_regs[9];
|
||||
# if defined __i386__
|
||||
dwarf_regs[0] = user_regs.eax;
|
||||
dwarf_regs[1] = user_regs.ecx;
|
||||
dwarf_regs[2] = user_regs.edx;
|
||||
dwarf_regs[3] = user_regs.ebx;
|
||||
dwarf_regs[4] = user_regs.esp;
|
||||
dwarf_regs[5] = user_regs.ebp;
|
||||
dwarf_regs[6] = user_regs.esi;
|
||||
dwarf_regs[7] = user_regs.edi;
|
||||
dwarf_regs[8] = user_regs.eip;
|
||||
# elif defined __x86_64__
|
||||
dwarf_regs[0] = user_regs.rax;
|
||||
dwarf_regs[1] = user_regs.rcx;
|
||||
dwarf_regs[2] = user_regs.rdx;
|
||||
dwarf_regs[3] = user_regs.rbx;
|
||||
dwarf_regs[4] = user_regs.rsp;
|
||||
dwarf_regs[5] = user_regs.rbp;
|
||||
dwarf_regs[6] = user_regs.rsi;
|
||||
dwarf_regs[7] = user_regs.rdi;
|
||||
dwarf_regs[8] = user_regs.rip;
|
||||
# else /* (__i386__ || __x86_64__) && (!__i386__ && !__x86_64__) */
|
||||
# error "source file error, it cannot happen"
|
||||
# endif /* (__i386__ || __x86_64__) && (!__i386__ && !__x86_64__) */
|
||||
return setfunc (0, 9, dwarf_regs, arg);
|
||||
#endif /* __i386__ || __x86_64__ */
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/* Register names and numbers for i386 DWARF.
|
||||
Copyright (C) 2005, 2006, 2007 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND i386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
ssize_t
|
||||
i386_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setname,
|
||||
int *bits, int *type)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 46;
|
||||
|
||||
if (regno < 0 || regno > 45 || namelen < 6)
|
||||
return -1;
|
||||
|
||||
*prefix = "%";
|
||||
*bits = 32;
|
||||
*type = DW_ATE_unsigned;
|
||||
if (regno < 11)
|
||||
{
|
||||
*setname = "integer";
|
||||
if (regno < 9)
|
||||
*type = DW_ATE_signed;
|
||||
}
|
||||
else if (regno < 19)
|
||||
{
|
||||
*setname = "x87";
|
||||
*type = DW_ATE_float;
|
||||
*bits = 80;
|
||||
}
|
||||
else if (regno < 29)
|
||||
{
|
||||
*setname = "SSE";
|
||||
*bits = 128;
|
||||
}
|
||||
else if (regno < 37)
|
||||
{
|
||||
*setname = "MMX";
|
||||
*bits = 64;
|
||||
}
|
||||
else if (regno < 40)
|
||||
*setname = "FPU-control";
|
||||
else
|
||||
{
|
||||
*setname = "segment";
|
||||
*bits = 16;
|
||||
}
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
static const char baseregs[][2] =
|
||||
{
|
||||
"ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ip"
|
||||
};
|
||||
|
||||
case 4:
|
||||
case 5:
|
||||
case 8:
|
||||
*type = DW_ATE_address;
|
||||
FALLTHROUGH;
|
||||
case 0 ... 3:
|
||||
case 6 ... 7:
|
||||
name[0] = 'e';
|
||||
name[1] = baseregs[regno][0];
|
||||
name[2] = baseregs[regno][1];
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
return stpcpy (name, "eflags") + 1 - name;
|
||||
case 10:
|
||||
return stpcpy (name, "trapno") + 1 - name;
|
||||
|
||||
case 11 ... 18:
|
||||
name[0] = 's';
|
||||
name[1] = 't';
|
||||
name[2] = regno - 11 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 21 ... 28:
|
||||
name[0] = 'x';
|
||||
name[1] = 'm';
|
||||
name[2] = 'm';
|
||||
name[3] = regno - 21 + '0';
|
||||
namelen = 4;
|
||||
break;
|
||||
|
||||
case 29 ... 36:
|
||||
name[0] = 'm';
|
||||
name[1] = 'm';
|
||||
name[2] = regno - 29 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 37:
|
||||
*bits = 16;
|
||||
return stpcpy (name, "fctrl") + 1 - name;
|
||||
case 38:
|
||||
*bits = 16;
|
||||
return stpcpy (name, "fstat") + 1 - name;
|
||||
case 39:
|
||||
return stpcpy (name, "mxcsr") + 1 - name;
|
||||
|
||||
case 40 ... 45:
|
||||
name[0] = "ecsdfg"[regno - 40];
|
||||
name[1] = 's';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
*setname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
name[namelen++] = '\0';
|
||||
return namelen;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/* List the relocation types for i386. -*- C -*-
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2005, 2009, 2015 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, 0)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (PC32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (GOT32, REL)
|
||||
RELOC_TYPE (PLT32, REL)
|
||||
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
|
||||
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (GOTOFF, REL)
|
||||
RELOC_TYPE (GOTPC, REL)
|
||||
RELOC_TYPE (32PLT, REL)
|
||||
RELOC_TYPE (TLS_TPOFF, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_IE, REL)
|
||||
RELOC_TYPE (TLS_GOTIE, REL)
|
||||
RELOC_TYPE (TLS_LE, REL)
|
||||
RELOC_TYPE (TLS_GD, REL)
|
||||
RELOC_TYPE (TLS_LDM, REL)
|
||||
RELOC_TYPE (16, REL)
|
||||
RELOC_TYPE (PC16, REL)
|
||||
RELOC_TYPE (8, REL)
|
||||
RELOC_TYPE (PC8, REL)
|
||||
RELOC_TYPE (TLS_GD_32, REL)
|
||||
RELOC_TYPE (TLS_GD_PUSH, REL)
|
||||
RELOC_TYPE (TLS_GD_CALL, REL)
|
||||
RELOC_TYPE (TLS_GD_POP, REL)
|
||||
RELOC_TYPE (TLS_LDM_32, REL)
|
||||
RELOC_TYPE (TLS_LDM_PUSH, REL)
|
||||
RELOC_TYPE (TLS_LDM_CALL, REL)
|
||||
RELOC_TYPE (TLS_LDM_POP, REL)
|
||||
RELOC_TYPE (TLS_LDO_32, REL)
|
||||
RELOC_TYPE (TLS_IE_32, REL)
|
||||
RELOC_TYPE (TLS_LE_32, REL)
|
||||
RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_TPOFF32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_GOTDESC, REL)
|
||||
RELOC_TYPE (TLS_DESC_CALL, REL)
|
||||
RELOC_TYPE (TLS_DESC, EXEC)
|
||||
RELOC_TYPE (IRELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (GOT32X, REL)
|
||||
@@ -0,0 +1,139 @@
|
||||
/* Function return value location for Linux/i386 ABI.
|
||||
Copyright (C) 2005-2010, 2014 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND i386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* %eax, or pair %eax, %edx. */
|
||||
static const Dwarf_Op loc_intreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
{ .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
};
|
||||
#define nloc_intreg 1
|
||||
#define nloc_intregpair 4
|
||||
|
||||
/* %st(0). */
|
||||
static const Dwarf_Op loc_fpreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg11 }
|
||||
};
|
||||
#define nloc_fpreg 1
|
||||
|
||||
/* The return value is a structure and is actually stored in stack space
|
||||
passed in a hidden argument by the caller. But, the compiler
|
||||
helpfully returns the address of that space in %eax. */
|
||||
static const Dwarf_Op loc_aggregate[] =
|
||||
{
|
||||
{ .atom = DW_OP_breg0, .number = 0 }
|
||||
};
|
||||
#define nloc_aggregate 1
|
||||
|
||||
int
|
||||
i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
{
|
||||
/* Start with the function's type, and get the DW_AT_type attribute,
|
||||
which is the type of the return value. */
|
||||
Dwarf_Die die_mem, *typedie = &die_mem;
|
||||
int tag = dwarf_peeled_die_type (functypedie, typedie);
|
||||
if (tag <= 0)
|
||||
return tag;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case -1:
|
||||
return -1;
|
||||
|
||||
case DW_TAG_subrange_type:
|
||||
if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
|
||||
{
|
||||
Dwarf_Attribute attr_mem, *attr;
|
||||
attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
typedie = dwarf_formref_die (attr, &die_mem);
|
||||
tag = DWARF_TAG_OR_RETURN (typedie);
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Word size;
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 4;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
if (tag == DW_TAG_base_type)
|
||||
{
|
||||
Dwarf_Word encoding;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
|
||||
&attr_mem),
|
||||
&encoding) != 0)
|
||||
return -1;
|
||||
if (encoding == DW_ATE_float)
|
||||
{
|
||||
if (size > 16)
|
||||
return -2;
|
||||
*locp = loc_fpreg;
|
||||
return nloc_fpreg;
|
||||
}
|
||||
}
|
||||
*locp = loc_intreg;
|
||||
if (size <= 4)
|
||||
return nloc_intreg;
|
||||
if (size <= 8)
|
||||
return nloc_intregpair;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
case DW_TAG_structure_type:
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_union_type:
|
||||
case DW_TAG_array_type:
|
||||
*locp = loc_aggregate;
|
||||
return nloc_aggregate;
|
||||
}
|
||||
|
||||
/* XXX We don't have a good way to return specific errors from ebl calls.
|
||||
This value means we do not understand the type, but it is well-formed
|
||||
DWARF and might be valid. */
|
||||
return -2;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/* i386 specific symbolic name handling.
|
||||
Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND i386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* Return true if the symbol type is that referencing the GOT. */
|
||||
bool
|
||||
i386_gotpc_reloc_check (Elf *elf __attribute__ ((unused)), int type)
|
||||
{
|
||||
return type == R_386_GOTPC;
|
||||
}
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
i386_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_386_32:
|
||||
return ELF_T_SWORD;
|
||||
case R_386_16:
|
||||
return ELF_T_HALF;
|
||||
case R_386_8:
|
||||
return ELF_T_BYTE;
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check section name for being that of a debug information section. */
|
||||
bool (*generic_debugscn_p) (const char *);
|
||||
bool
|
||||
i386_debugscn_p (const char *name)
|
||||
{
|
||||
return (generic_debugscn_p (name)
|
||||
|| strcmp (name, ".stab") == 0
|
||||
|| strcmp (name, ".stabstr") == 0);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* Get previous frame state for an existing frame state using frame pointers.
|
||||
Copyright (C) 2017 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define BACKEND i386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* Register numbers for frame and stack pointers. We take advantage of
|
||||
them being next to each other when calling getfunc and setfunc. */
|
||||
#define ESP 4
|
||||
#define EBP (ESP + 1)
|
||||
|
||||
/* Most basic frame pointer chasing with EBP as frame pointer.
|
||||
PC = *(FP + 4), SP = FP + 8, FP = *FP. */
|
||||
bool
|
||||
i386_unwind (Ebl *ebl __attribute__ ((unused)),
|
||||
Dwarf_Addr pc __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc, ebl_tid_registers_get_t *getfunc,
|
||||
ebl_pid_memory_read_t *readfunc, void *arg,
|
||||
bool *signal_framep __attribute__ ((unused)))
|
||||
{
|
||||
/* sp = 0, fp = 1 */
|
||||
Dwarf_Word regs[2];
|
||||
|
||||
/* Get current stack and frame pointers. */
|
||||
if (! getfunc (ESP, 2, regs, arg))
|
||||
return false;
|
||||
|
||||
Dwarf_Word sp = regs[0];
|
||||
Dwarf_Word fp = regs[1];
|
||||
|
||||
/* Sanity check. We only support traditional stack frames. */
|
||||
if (fp == 0 || sp == 0 || fp < sp)
|
||||
return false;
|
||||
|
||||
/* Get the return address from the stack, it is our new pc. */
|
||||
Dwarf_Word ret_addr;
|
||||
if (! readfunc (fp + 4, &ret_addr, arg) || ret_addr == 0)
|
||||
return false;
|
||||
|
||||
/* Get new sp and fp. Sanity check again. */
|
||||
sp = fp + 8;
|
||||
if (! readfunc (fp, &fp, arg) || fp == 0 || sp >= fp)
|
||||
return false;
|
||||
|
||||
/* Set new sp, fp and pc. */
|
||||
regs[0] = sp;
|
||||
regs[1] = fp;
|
||||
if (! setfunc (ESP, 2, regs, arg) || ! setfunc (-1, 1, &ret_addr, arg))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/* Initialization of IA-64 specific backend library.
|
||||
Copyright (C) 2002, 2003, 2005, 2006, 2007, 2014 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND ia64_
|
||||
#define RELOC_PREFIX R_IA64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on ia64_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
Ebl *
|
||||
ia64_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
/* We handle it. */
|
||||
ia64_init_reloc (eh);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, segment_type_name);
|
||||
HOOK (eh, section_type_name);
|
||||
HOOK (eh, dynamic_tag_name);
|
||||
HOOK (eh, dynamic_tag_check);
|
||||
HOOK (eh, machine_flag_check);
|
||||
HOOK (eh, machine_section_flag_check);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, return_value_location);
|
||||
HOOK (eh, check_reloc_target_type);
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
/* Register names and numbers for IA64 DWARF.
|
||||
Copyright (C) 2006 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND i386_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
ssize_t
|
||||
ia64_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setname,
|
||||
int *bits, int *type)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 687 + 64;
|
||||
|
||||
if (regno < 0 || regno > 687 + 63 || namelen < 12)
|
||||
return -1;
|
||||
|
||||
*prefix = "ar.";
|
||||
*setname = "application";
|
||||
*bits = 64;
|
||||
*type = DW_ATE_signed;
|
||||
switch (regno)
|
||||
{
|
||||
case 0 ... 9:
|
||||
name[0] = 'r';
|
||||
name[1] = (regno - 0) + '0';
|
||||
namelen = 2;
|
||||
*setname = "integer";
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 10 ... 99:
|
||||
name[0] = 'r';
|
||||
name[1] = (regno - 0) / 10 + '0';
|
||||
name[2] = (regno - 0) % 10 + '0';
|
||||
namelen = 3;
|
||||
*setname = "integer";
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 100 ... 127:
|
||||
name[0] = 'r';
|
||||
name[1] = '1';
|
||||
name[2] = (regno - 100) / 10 + '0';
|
||||
name[3] = (regno - 0) % 10 + '0';
|
||||
namelen = 4;
|
||||
*setname = "integer";
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 128 + 0 ... 128 + 9:
|
||||
name[0] = 'f';
|
||||
name[1] = (regno - 128) + '0';
|
||||
namelen = 2;
|
||||
*type = DW_ATE_float;
|
||||
*bits = 128;
|
||||
*setname = "FPU";
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 128 + 10 ... 128 + 99:
|
||||
name[0] = 'f';
|
||||
name[1] = (regno - 128) / 10 + '0';
|
||||
name[2] = (regno - 128) % 10 + '0';
|
||||
namelen = 3;
|
||||
*setname = "FPU";
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 128 + 100 ... 128 + 127:
|
||||
name[0] = 'f';
|
||||
name[1] = '1';
|
||||
name[2] = (regno - 128 - 100) / 10 + '0';
|
||||
name[3] = (regno - 128) % 10 + '0';
|
||||
namelen = 4;
|
||||
*type = DW_ATE_float;
|
||||
*bits = 128;
|
||||
*setname = "FPU";
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 320 + 0 ... 320 + 7:
|
||||
name[0] = 'b';
|
||||
name[1] = (regno - 320) + '0';
|
||||
namelen = 2;
|
||||
*type = DW_ATE_address;
|
||||
*setname = "branch";
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 328 ... 333:
|
||||
{
|
||||
static const char named_special[][5] =
|
||||
{
|
||||
"vfp", "vrap", "pr", "ip", "psr", "cfm"
|
||||
};
|
||||
*setname = "special";
|
||||
*prefix = "";
|
||||
*type = regno == 331 ? DW_ATE_address : DW_ATE_unsigned;
|
||||
return stpcpy (name, named_special[regno - 328]) + 1 - name;
|
||||
}
|
||||
|
||||
case 590:
|
||||
*setname = "special";
|
||||
*prefix = "";
|
||||
*type = DW_ATE_unsigned;
|
||||
return stpcpy (name, "bof") + 1 - name;
|
||||
|
||||
case 334 + 0 ... 334 + 7:
|
||||
name[0] = 'k';
|
||||
name[1] = 'r';
|
||||
name[2] = (regno - 334) + '0';
|
||||
namelen = 3;
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 334 + 8 ... 334 + 127:
|
||||
{
|
||||
static const char named_ar[][9] =
|
||||
{
|
||||
[16 - 8] = "rsc",
|
||||
[17 - 8] = "bsp",
|
||||
[18 - 8] = "bspstore",
|
||||
[19 - 8] = "rnat",
|
||||
[21 - 8] = "fcr",
|
||||
[24 - 8] = "eflag",
|
||||
[25 - 8] = "csd",
|
||||
[26 - 8] = "ssd",
|
||||
[27 - 8] = "cflg",
|
||||
[28 - 8] = "fsr",
|
||||
[29 - 8] = "fir",
|
||||
[30 - 8] = "fdr",
|
||||
[32 - 8] = "ccv",
|
||||
[36 - 8] = "unat",
|
||||
[40 - 8] = "fpsr",
|
||||
[44 - 8] = "itc",
|
||||
[64 - 8] = "pfs",
|
||||
[65 - 8] = "lc",
|
||||
[66 - 8] = "ec",
|
||||
};
|
||||
const size_t idx = regno - (334 + 8);
|
||||
*type = DW_ATE_unsigned;
|
||||
if (idx == 1 || idx == 2)
|
||||
*type = DW_ATE_address;
|
||||
if (idx < sizeof named_ar / sizeof named_ar[0]
|
||||
&& named_ar[idx][0] != '\0')
|
||||
return stpcpy (name, named_ar[idx]) + 1 - name;
|
||||
|
||||
name[0] = 'a';
|
||||
name[1] = 'r';
|
||||
switch (regno - 334)
|
||||
{
|
||||
case 0 ... 9:
|
||||
name[2] = (regno - 334) + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
case 10 ... 99:
|
||||
name[2] = (regno - 334) / 10 + '0';
|
||||
name[3] = (regno - 334) % 10 + '0';
|
||||
namelen = 4;
|
||||
break;
|
||||
case 100 ... 127:
|
||||
name[2] = '1';
|
||||
name[3] = (regno - 334 - 100) / 10 + '0';
|
||||
name[4] = (regno - 334) % 10 + '0';
|
||||
namelen = 5;
|
||||
break;
|
||||
}
|
||||
*prefix = "";
|
||||
break;
|
||||
}
|
||||
|
||||
case 462 + 0 ... 462 + 9:
|
||||
name[0] = 'n';
|
||||
name[1] = 'a';
|
||||
name[2] = 't';
|
||||
name[3] = (regno - 462) + '0';
|
||||
namelen = 4;
|
||||
*setname = "NAT";
|
||||
*type = DW_ATE_boolean;
|
||||
*bits = 1;
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 462 + 10 ... 462 + 99:
|
||||
name[0] = 'n';
|
||||
name[1] = 'a';
|
||||
name[2] = 't';
|
||||
name[3] = (regno - 462) / 10 + '0';
|
||||
name[4] = (regno - 462) % 10 + '0';
|
||||
namelen = 5;
|
||||
*setname = "NAT";
|
||||
*type = DW_ATE_boolean;
|
||||
*bits = 1;
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 462 + 100 ... 462 + 127:
|
||||
name[0] = 'n';
|
||||
name[1] = 'a';
|
||||
name[2] = 't';
|
||||
name[3] = '1';
|
||||
name[4] = (regno - 462 - 100) / 10 + '0';
|
||||
name[5] = (regno - 462) % 10 + '0';
|
||||
namelen = 6;
|
||||
*setname = "NAT";
|
||||
*type = DW_ATE_boolean;
|
||||
*bits = 1;
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 687 + 0 ... 687 + 9:
|
||||
name[0] = 'p';
|
||||
name[1] = (regno - 687) + '0';
|
||||
namelen = 2;
|
||||
*setname = "predicate";
|
||||
*type = DW_ATE_boolean;
|
||||
*bits = 1;
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
case 687 + 10 ... 687 + 63:
|
||||
name[0] = 'p';
|
||||
name[1] = (regno - 687) / 10 + '0';
|
||||
name[2] = (regno - 687) % 10 + '0';
|
||||
namelen = 3;
|
||||
*setname = "predicate";
|
||||
*type = DW_ATE_boolean;
|
||||
*bits = 1;
|
||||
*prefix = "";
|
||||
break;
|
||||
|
||||
default:
|
||||
*setname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
name[namelen++] = '\0';
|
||||
return namelen;
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
/* List the relocation types for ia64. -*- C -*-
|
||||
Copyright (C) 2005, 2006, 2015 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, 0)
|
||||
RELOC_TYPE (IMM14, REL)
|
||||
RELOC_TYPE (IMM22, REL)
|
||||
RELOC_TYPE (IMM64, REL)
|
||||
RELOC_TYPE (DIR32MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (DIR32LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (DIR64MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (DIR64LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (GPREL22, REL)
|
||||
RELOC_TYPE (GPREL64I, REL)
|
||||
RELOC_TYPE (GPREL32MSB, REL)
|
||||
RELOC_TYPE (GPREL32LSB, REL)
|
||||
RELOC_TYPE (GPREL64MSB, REL)
|
||||
RELOC_TYPE (GPREL64LSB, REL)
|
||||
RELOC_TYPE (LTOFF22, REL)
|
||||
RELOC_TYPE (LTOFF64I, REL)
|
||||
RELOC_TYPE (PLTOFF22, REL)
|
||||
RELOC_TYPE (PLTOFF64I, REL)
|
||||
RELOC_TYPE (PLTOFF64MSB, REL)
|
||||
RELOC_TYPE (PLTOFF64LSB, REL)
|
||||
RELOC_TYPE (FPTR64I, REL)
|
||||
RELOC_TYPE (FPTR32MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (FPTR32LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (FPTR64MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (FPTR64LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (PCREL60B, REL)
|
||||
RELOC_TYPE (PCREL21B, REL)
|
||||
RELOC_TYPE (PCREL21M, REL)
|
||||
RELOC_TYPE (PCREL21F, REL)
|
||||
RELOC_TYPE (PCREL32MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (PCREL32LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (PCREL64MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (PCREL64LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (LTOFF_FPTR22, REL)
|
||||
RELOC_TYPE (LTOFF_FPTR64I, REL)
|
||||
RELOC_TYPE (LTOFF_FPTR32MSB, REL)
|
||||
RELOC_TYPE (LTOFF_FPTR32LSB, REL)
|
||||
RELOC_TYPE (LTOFF_FPTR64MSB, REL)
|
||||
RELOC_TYPE (LTOFF_FPTR64LSB, REL)
|
||||
RELOC_TYPE (SEGREL32MSB, REL)
|
||||
RELOC_TYPE (SEGREL32LSB, REL)
|
||||
RELOC_TYPE (SEGREL64MSB, REL)
|
||||
RELOC_TYPE (SEGREL64LSB, REL)
|
||||
RELOC_TYPE (SECREL32MSB, REL)
|
||||
RELOC_TYPE (SECREL32LSB, REL)
|
||||
RELOC_TYPE (SECREL64MSB, REL)
|
||||
RELOC_TYPE (SECREL64LSB, REL)
|
||||
RELOC_TYPE (REL32MSB, EXEC|DYN)
|
||||
RELOC_TYPE (REL32LSB, EXEC|DYN)
|
||||
RELOC_TYPE (REL64MSB, EXEC|DYN)
|
||||
RELOC_TYPE (REL64LSB, EXEC|DYN)
|
||||
RELOC_TYPE (LTV32MSB, REL)
|
||||
RELOC_TYPE (LTV32LSB, REL)
|
||||
RELOC_TYPE (LTV64MSB, REL)
|
||||
RELOC_TYPE (LTV64LSB, REL)
|
||||
RELOC_TYPE (PCREL21BI, REL)
|
||||
RELOC_TYPE (PCREL22, REL)
|
||||
RELOC_TYPE (PCREL64I, REL)
|
||||
RELOC_TYPE (IPLTMSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (IPLTLSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (SUB, 0)
|
||||
RELOC_TYPE (LTOFF22X, REL)
|
||||
RELOC_TYPE (LDXMOV, REL)
|
||||
RELOC_TYPE (TPREL14, REL)
|
||||
RELOC_TYPE (TPREL22, REL)
|
||||
RELOC_TYPE (TPREL64I, REL)
|
||||
RELOC_TYPE (TPREL64MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (TPREL64LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (LTOFF_TPREL22, REL)
|
||||
RELOC_TYPE (DTPMOD64MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (DTPMOD64LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (LTOFF_DTPMOD22, REL)
|
||||
RELOC_TYPE (DTPREL14, REL)
|
||||
RELOC_TYPE (DTPREL22, REL)
|
||||
RELOC_TYPE (DTPREL64I, REL)
|
||||
RELOC_TYPE (DTPREL32MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (DTPREL32LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (DTPREL64MSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (DTPREL64LSB, REL|EXEC|DYN)
|
||||
RELOC_TYPE (LTOFF_DTPREL22, REL)
|
||||
|
||||
#define NO_RELATIVE_RELOC 1
|
||||
@@ -0,0 +1,365 @@
|
||||
/* Function return value location for IA64 ABI.
|
||||
Copyright (C) 2006-2010, 2014 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND ia64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* r8, or pair r8, r9, or aggregate up to r8-r11. */
|
||||
static const Dwarf_Op loc_intreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg8 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
{ .atom = DW_OP_reg9 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
{ .atom = DW_OP_reg10 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
{ .atom = DW_OP_reg11 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
};
|
||||
#define nloc_intreg 1
|
||||
#define nloc_intregs(n) (2 * (n))
|
||||
|
||||
/* f8, or aggregate up to f8-f15. */
|
||||
#define DEFINE_FPREG(size) \
|
||||
static const Dwarf_Op loc_fpreg_##size[] = \
|
||||
{ \
|
||||
{ .atom = DW_OP_regx, .number = 128 + 8 }, \
|
||||
{ .atom = DW_OP_piece, .number = size }, \
|
||||
{ .atom = DW_OP_regx, .number = 128 + 9 }, \
|
||||
{ .atom = DW_OP_piece, .number = size }, \
|
||||
{ .atom = DW_OP_regx, .number = 128 + 10 }, \
|
||||
{ .atom = DW_OP_piece, .number = size }, \
|
||||
{ .atom = DW_OP_regx, .number = 128 + 11 }, \
|
||||
{ .atom = DW_OP_piece, .number = size }, \
|
||||
{ .atom = DW_OP_regx, .number = 128 + 12 }, \
|
||||
{ .atom = DW_OP_piece, .number = size }, \
|
||||
{ .atom = DW_OP_regx, .number = 128 + 13 }, \
|
||||
{ .atom = DW_OP_piece, .number = size }, \
|
||||
{ .atom = DW_OP_regx, .number = 128 + 14 }, \
|
||||
{ .atom = DW_OP_piece, .number = size }, \
|
||||
{ .atom = DW_OP_regx, .number = 128 + 15 }, \
|
||||
{ .atom = DW_OP_piece, .number = size }, \
|
||||
}
|
||||
#define nloc_fpreg 1
|
||||
#define nloc_fpregs(n) (2 * (n))
|
||||
|
||||
DEFINE_FPREG (4);
|
||||
DEFINE_FPREG (8);
|
||||
DEFINE_FPREG (10);
|
||||
|
||||
#undef DEFINE_FPREG
|
||||
|
||||
|
||||
/* The return value is a structure and is actually stored in stack space
|
||||
passed in a hidden argument by the caller. But, the compiler
|
||||
helpfully returns the address of that space in r8. */
|
||||
static const Dwarf_Op loc_aggregate[] =
|
||||
{
|
||||
{ .atom = DW_OP_breg8, .number = 0 }
|
||||
};
|
||||
#define nloc_aggregate 1
|
||||
|
||||
|
||||
static inline int
|
||||
compute_hfa (const Dwarf_Op *loc, int nregs,
|
||||
const Dwarf_Op **locp, int fpregs_used)
|
||||
{
|
||||
if (fpregs_used == 0)
|
||||
*locp = loc;
|
||||
else if (*locp != loc)
|
||||
return 9;
|
||||
return fpregs_used + nregs;
|
||||
}
|
||||
|
||||
/* If this type is an HFA small enough to be returned in FP registers,
|
||||
return the number of registers to use. Otherwise 9, or -1 for errors. */
|
||||
static int
|
||||
hfa_type (Dwarf_Die *typedie, Dwarf_Word size,
|
||||
const Dwarf_Op **locp, int fpregs_used)
|
||||
{
|
||||
/* Descend the type structure, counting elements and finding their types.
|
||||
If we find a datum that's not an FP type (and not quad FP), punt.
|
||||
If we find a datum that's not the same FP type as the first datum, punt.
|
||||
If we count more than eight total homogeneous FP data, punt. */
|
||||
|
||||
int tag = DWARF_TAG_OR_RETURN (typedie);
|
||||
switch (tag)
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
|
||||
case -1:
|
||||
return -1;
|
||||
|
||||
case DW_TAG_base_type:;
|
||||
Dwarf_Word encoding;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
|
||||
&attr_mem), &encoding) != 0)
|
||||
return -1;
|
||||
|
||||
#define hfa(loc, nregs) compute_hfa(loc, nregs, locp, fpregs_used)
|
||||
switch (encoding)
|
||||
{
|
||||
case DW_ATE_float:
|
||||
switch (size)
|
||||
{
|
||||
case 4: /* float */
|
||||
return hfa (loc_fpreg_4, 1);
|
||||
case 8: /* double */
|
||||
return hfa (loc_fpreg_8, 1);
|
||||
case 10: /* x86-style long double, not really used */
|
||||
return hfa (loc_fpreg_10, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case DW_ATE_complex_float:
|
||||
switch (size)
|
||||
{
|
||||
case 4 * 2: /* complex float */
|
||||
return hfa (loc_fpreg_4, 2);
|
||||
case 8 * 2: /* complex double */
|
||||
return hfa (loc_fpreg_8, 2);
|
||||
case 10 * 2: /* complex long double (x86-style) */
|
||||
return hfa (loc_fpreg_10, 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DW_TAG_structure_type:
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_union_type:;
|
||||
Dwarf_Die child_mem;
|
||||
switch (dwarf_child (typedie, &child_mem))
|
||||
{
|
||||
default:
|
||||
return -1;
|
||||
|
||||
case 1: /* No children: empty struct. */
|
||||
break;
|
||||
|
||||
case 0:; /* Look at each element. */
|
||||
int max_used = fpregs_used;
|
||||
do
|
||||
switch (dwarf_tag (&child_mem))
|
||||
{
|
||||
case -1:
|
||||
return -1;
|
||||
|
||||
case DW_TAG_member:;
|
||||
Dwarf_Die child_type_mem;
|
||||
Dwarf_Die *child_typedie
|
||||
= dwarf_formref_die (dwarf_attr_integrate (&child_mem,
|
||||
DW_AT_type,
|
||||
&attr_mem),
|
||||
&child_type_mem);
|
||||
Dwarf_Word child_size;
|
||||
if (dwarf_aggregate_size (child_typedie, &child_size) != 0)
|
||||
return -1;
|
||||
if (tag == DW_TAG_union_type)
|
||||
{
|
||||
int used = hfa_type (child_typedie, child_size,
|
||||
locp, fpregs_used);
|
||||
if (used < 0 || used > 8)
|
||||
return used;
|
||||
if (used > max_used)
|
||||
max_used = used;
|
||||
}
|
||||
else
|
||||
{
|
||||
fpregs_used = hfa_type (child_typedie, child_size,
|
||||
locp, fpregs_used);
|
||||
if (fpregs_used < 0 || fpregs_used > 8)
|
||||
return fpregs_used;
|
||||
}
|
||||
}
|
||||
while (dwarf_siblingof (&child_mem, &child_mem) == 0);
|
||||
if (tag == DW_TAG_union_type)
|
||||
fpregs_used = max_used;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DW_TAG_array_type:
|
||||
if (size == 0)
|
||||
break;
|
||||
|
||||
Dwarf_Die base_type_mem;
|
||||
Dwarf_Die *base_typedie
|
||||
= dwarf_formref_die (dwarf_attr_integrate (typedie, DW_AT_type,
|
||||
&attr_mem),
|
||||
&base_type_mem);
|
||||
Dwarf_Word base_size;
|
||||
if (dwarf_aggregate_size (base_typedie, &base_size) != 0)
|
||||
return -1;
|
||||
|
||||
int used = hfa_type (base_typedie, base_size, locp, 0);
|
||||
if (used < 0 || used > 8)
|
||||
return used;
|
||||
if (size % (*locp)[1].number != 0)
|
||||
return 0;
|
||||
fpregs_used += used * (size / (*locp)[1].number);
|
||||
break;
|
||||
|
||||
default:
|
||||
return 9;
|
||||
}
|
||||
|
||||
return fpregs_used;
|
||||
}
|
||||
|
||||
int
|
||||
ia64_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
{
|
||||
/* Start with the function's type, and get the DW_AT_type attribute,
|
||||
which is the type of the return value. */
|
||||
Dwarf_Die die_mem, *typedie = &die_mem;
|
||||
int tag = dwarf_peeled_die_type (functypedie, typedie);
|
||||
if (tag <= 0)
|
||||
return tag;
|
||||
|
||||
Dwarf_Word size;
|
||||
switch (tag)
|
||||
{
|
||||
case -1:
|
||||
return -1;
|
||||
|
||||
case DW_TAG_subrange_type:
|
||||
if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
|
||||
{
|
||||
Dwarf_Attribute attr_mem, *attr;
|
||||
attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
typedie = dwarf_formref_die (attr, &die_mem);
|
||||
tag = DWARF_TAG_OR_RETURN (typedie);
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (tag == DW_TAG_base_type)
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
Dwarf_Word encoding;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
|
||||
&attr_mem),
|
||||
&encoding) != 0)
|
||||
return -1;
|
||||
|
||||
switch (encoding)
|
||||
{
|
||||
case DW_ATE_float:
|
||||
switch (size)
|
||||
{
|
||||
case 4: /* float */
|
||||
*locp = loc_fpreg_4;
|
||||
return nloc_fpreg;
|
||||
case 8: /* double */
|
||||
*locp = loc_fpreg_8;
|
||||
return nloc_fpreg;
|
||||
case 10: /* x86-style long double, not really used */
|
||||
*locp = loc_fpreg_10;
|
||||
return nloc_fpreg;
|
||||
case 16: /* long double, IEEE quad format */
|
||||
*locp = loc_intreg;
|
||||
return nloc_intregs (2);
|
||||
}
|
||||
return -2;
|
||||
|
||||
case DW_ATE_complex_float:
|
||||
switch (size)
|
||||
{
|
||||
case 4 * 2: /* complex float */
|
||||
*locp = loc_fpreg_4;
|
||||
return nloc_fpregs (2);
|
||||
case 8 * 2: /* complex double */
|
||||
*locp = loc_fpreg_8;
|
||||
return nloc_fpregs (2);
|
||||
case 10 * 2: /* complex long double (x86-style) */
|
||||
*locp = loc_fpreg_10;
|
||||
return nloc_fpregs (2);
|
||||
case 16 * 2: /* complex long double (IEEE quad) */
|
||||
*locp = loc_intreg;
|
||||
return nloc_intregs (4);
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
intreg:
|
||||
*locp = loc_intreg;
|
||||
if (size <= 8)
|
||||
return nloc_intreg;
|
||||
if (size <= 32)
|
||||
return nloc_intregs ((size + 7) / 8);
|
||||
|
||||
large:
|
||||
*locp = loc_aggregate;
|
||||
return nloc_aggregate;
|
||||
|
||||
case DW_TAG_structure_type:
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_union_type:
|
||||
case DW_TAG_array_type:
|
||||
if (dwarf_aggregate_size (typedie, &size) != 0)
|
||||
return -1;
|
||||
|
||||
/* If this qualifies as an homogeneous floating-point aggregate
|
||||
(HFA), then it should be returned in FP regs. */
|
||||
int nfpreg = hfa_type (typedie, size, locp, 0);
|
||||
if (nfpreg < 0)
|
||||
return nfpreg;
|
||||
else if (nfpreg > 0 && nfpreg <= 8)
|
||||
return nfpreg == 1 ? nloc_fpreg : nloc_fpregs (nfpreg);
|
||||
|
||||
if (size > 32)
|
||||
goto large;
|
||||
|
||||
goto intreg;
|
||||
}
|
||||
|
||||
/* XXX We don't have a good way to return specific errors from ebl calls.
|
||||
This value means we do not understand the type, but it is well-formed
|
||||
DWARF and might be valid. */
|
||||
return -2;
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
/* IA-64 specific symbolic name handling.
|
||||
Copyright (C) 2002-2009, 2014 Red Hat, Inc.
|
||||
This file is part of elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define BACKEND ia64_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
const char *
|
||||
ia64_segment_type_name (int segment, char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (segment)
|
||||
{
|
||||
case PT_IA_64_ARCHEXT:
|
||||
return "IA_64_ARCHEXT";
|
||||
case PT_IA_64_UNWIND:
|
||||
return "IA_64_UNWIND";
|
||||
case PT_IA_64_HP_OPT_ANOT:
|
||||
return "IA_64_HP_OPT_ANOT";
|
||||
case PT_IA_64_HP_HSL_ANOT:
|
||||
return "IA_64_HP_HSL_ANOT";
|
||||
case PT_IA_64_HP_STACK:
|
||||
return "IA_64_HP_STACK";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
ia64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (tag)
|
||||
{
|
||||
case DT_IA_64_PLT_RESERVE:
|
||||
return "IA_64_PLT_RESERVE";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check dynamic tag. */
|
||||
bool
|
||||
ia64_dynamic_tag_check (int64_t tag)
|
||||
{
|
||||
return tag == DT_IA_64_PLT_RESERVE;
|
||||
}
|
||||
|
||||
/* Check whether machine flags are valid. */
|
||||
bool
|
||||
ia64_machine_flag_check (GElf_Word flags)
|
||||
{
|
||||
return ((flags &~ EF_IA_64_ABI64) == 0);
|
||||
}
|
||||
|
||||
/* Check whether SHF_MASKPROC flags are valid. */
|
||||
bool
|
||||
ia64_machine_section_flag_check (GElf_Xword sh_flags)
|
||||
{
|
||||
return (sh_flags &~ (SHF_IA_64_SHORT | SHF_IA_64_NORECOV)) == 0;
|
||||
}
|
||||
|
||||
/* Return symbolic representation of section type. */
|
||||
const char *
|
||||
ia64_section_type_name (int type,
|
||||
char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SHT_IA_64_EXT:
|
||||
return "IA_64_EXT";
|
||||
case SHT_IA_64_UNWIND:
|
||||
return "IA_64_UNWIND";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
ia64_reloc_simple_type (Ebl *ebl, int type,
|
||||
int *addsub __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
/* The SECREL types when used with non-allocated sections
|
||||
like .debug_* are the same as direct absolute relocs
|
||||
applied to those sections, since a 0 section address is assumed.
|
||||
So we treat them the same here. */
|
||||
|
||||
case R_IA64_SECREL32MSB:
|
||||
case R_IA64_DIR32MSB:
|
||||
if (ebl->data == ELFDATA2MSB)
|
||||
return ELF_T_WORD;
|
||||
break;
|
||||
case R_IA64_SECREL32LSB:
|
||||
case R_IA64_DIR32LSB:
|
||||
if (ebl->data == ELFDATA2LSB)
|
||||
return ELF_T_WORD;
|
||||
break;
|
||||
case R_IA64_DIR64MSB:
|
||||
case R_IA64_SECREL64MSB:
|
||||
if (ebl->data == ELFDATA2MSB)
|
||||
return ELF_T_XWORD;
|
||||
break;
|
||||
case R_IA64_SECREL64LSB:
|
||||
case R_IA64_DIR64LSB:
|
||||
if (ebl->data == ELFDATA2LSB)
|
||||
return ELF_T_XWORD;
|
||||
break;
|
||||
}
|
||||
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
|
||||
/* The SHT_IA_64_UNWIND section type is a valid target for relocation. */
|
||||
bool
|
||||
ia64_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_type)
|
||||
{
|
||||
return sh_type == SHT_IA_64_UNWIND;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/* Common interface for libebl modules.
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2005, 2013, 2014 Red Hat, Inc.
|
||||
Copyright (C) 2023 Mark J. Wielaard <mark@klomp.org>
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBEBL_CPU_H
|
||||
#define _LIBEBL_CPU_H 1
|
||||
|
||||
#include <dwarf.h>
|
||||
#include <libeblP.h>
|
||||
|
||||
#define EBLHOOK(name) EBLHOOK_1(BACKEND, name)
|
||||
#define EBLHOOK_1(a, b) EBLHOOK_2(a, b)
|
||||
#define EBLHOOK_2(a, b) a##b
|
||||
|
||||
/* Constructor. */
|
||||
extern Ebl *EBLHOOK(init) (Elf *elf, GElf_Half machine, Ebl *eh);
|
||||
|
||||
#include "ebl-hooks.h"
|
||||
|
||||
#define HOOK(eh, name) eh->name = EBLHOOK(name)
|
||||
|
||||
extern bool (*generic_debugscn_p) (const char *) attribute_hidden;
|
||||
|
||||
/* Helper for retval. Return dwarf_tag (die), but calls return -1
|
||||
if there where previous errors that leave die NULL. */
|
||||
#define DWARF_TAG_OR_RETURN(die) \
|
||||
({ Dwarf_Die *_die = (die); \
|
||||
if (_die == NULL) return -1; \
|
||||
dwarf_tag (_die); })
|
||||
|
||||
/* Get a type die corresponding to DIE. Peel CV qualifiers off
|
||||
it. Returns zero if the DIE doesn't have a type, or the type
|
||||
is DW_TAG_unspecified_type. Returns -1 on error. Otherwise
|
||||
returns the result tag DW_AT value. */
|
||||
static inline int
|
||||
dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result)
|
||||
{
|
||||
Dwarf_Attribute attr_mem;
|
||||
Dwarf_Attribute *attr = dwarf_attr_integrate (die, DW_AT_type, &attr_mem);
|
||||
if (attr == NULL)
|
||||
/* The function has no return value, like a `void' function in C. */
|
||||
return 0;
|
||||
|
||||
if (result == NULL)
|
||||
return -1;
|
||||
|
||||
if (dwarf_formref_die (attr, result) == NULL)
|
||||
return -1;
|
||||
|
||||
if (dwarf_peel_type (result, result) != 0)
|
||||
return -1;
|
||||
|
||||
int tag = dwarf_tag (result);
|
||||
if (tag == DW_TAG_unspecified_type)
|
||||
return 0; /* Treat an unspecified type as if there was no type. */
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
dwarf_is_pointer (int tag)
|
||||
{
|
||||
return tag == DW_TAG_pointer_type
|
||||
|| tag == DW_TAG_ptr_to_member_type
|
||||
|| tag == DW_TAG_reference_type
|
||||
|| tag == DW_TAG_rvalue_reference_type;
|
||||
}
|
||||
|
||||
#define CASE_POINTER \
|
||||
case DW_TAG_pointer_type: \
|
||||
case DW_TAG_ptr_to_member_type: \
|
||||
case DW_TAG_reference_type: \
|
||||
case DW_TAG_rvalue_reference_type
|
||||
|
||||
#endif /* libebl_CPU.h */
|
||||
@@ -0,0 +1,316 @@
|
||||
/* Common core note type descriptions for Linux.
|
||||
Copyright (C) 2007-2010 Red Hat, Inc.
|
||||
Copyright (C) H.J. Lu <hjl.tools@gmail.com>, 2015.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* The including CPU_corenote.c file provides prstatus_regs and
|
||||
defines macros ULONG, [PUG]ID_T, and ALIGN_*, TYPE_*.
|
||||
|
||||
Here we describe the common layout used in <linux/elfcore.h>. */
|
||||
|
||||
#define CHAR int8_t
|
||||
#define ALIGN_CHAR 1
|
||||
#define TYPE_CHAR ELF_T_BYTE
|
||||
#define SHORT uint16_t
|
||||
#define ALIGN_SHORT 2
|
||||
#define TYPE_SHORT ELF_T_HALF
|
||||
#define INT int32_t
|
||||
#ifndef ALIGN_INT
|
||||
# define ALIGN_INT 4
|
||||
#endif
|
||||
#define TYPE_INT ELF_T_SWORD
|
||||
#ifndef PR_REG
|
||||
# define PR_REG ULONG
|
||||
#endif
|
||||
#ifndef ALIGN_PR_REG
|
||||
# define ALIGN_PR_REG ALIGN_ULONG
|
||||
#endif
|
||||
#ifndef PRPSINFO_UID_T
|
||||
# define PRPSINFO_UID_T UID_T
|
||||
# define ALIGN_PRPSINFO_UID_T ALIGN_UID_T
|
||||
# define TYPE_PRPSINFO_UID_T TYPE_UID_T
|
||||
#endif
|
||||
#ifndef PRPSINFO_GID_T
|
||||
# define PRPSINFO_GID_T GID_T
|
||||
# define ALIGN_PRPSINFO_GID_T ALIGN_GID_T
|
||||
# define TYPE_PRPSINFO_GID_T TYPE_GID_T
|
||||
#endif
|
||||
|
||||
#define FIELD(type, name) type name __attribute__ ((aligned (ALIGN_##type)))
|
||||
|
||||
struct EBLHOOK(siginfo)
|
||||
{
|
||||
FIELD (INT, si_signo);
|
||||
FIELD (INT, si_code);
|
||||
FIELD (INT, si_errno);
|
||||
};
|
||||
|
||||
struct EBLHOOK(timeval)
|
||||
{
|
||||
FIELD (ULONG, tv_sec);
|
||||
FIELD (ULONG, tv_usec);
|
||||
};
|
||||
|
||||
/* On sparc64, tv_usec (suseconds_t) is actually 32 bits with 32 bits padding.
|
||||
The 'T'|0x80 value for .format indicates this as a special kludge. */
|
||||
#if SUSECONDS_HALF
|
||||
# define TIMEVAL_FIELD(name) FIELD (time, ULONG, name, 'T'|0x80, .count = 2)
|
||||
#else
|
||||
# define TIMEVAL_FIELD(name) FIELD (time, ULONG, name, 'T', .count = 2)
|
||||
#endif
|
||||
|
||||
|
||||
struct EBLHOOK(prstatus)
|
||||
{
|
||||
struct EBLHOOK(siginfo) pr_info;
|
||||
FIELD (SHORT, pr_cursig);
|
||||
FIELD (ULONG, pr_sigpend);
|
||||
FIELD (ULONG, pr_sighold);
|
||||
FIELD (PID_T, pr_pid);
|
||||
FIELD (PID_T, pr_ppid);
|
||||
FIELD (PID_T, pr_pgrp);
|
||||
FIELD (PID_T, pr_sid);
|
||||
struct EBLHOOK(timeval) pr_utime;
|
||||
struct EBLHOOK(timeval) pr_stime;
|
||||
struct EBLHOOK(timeval) pr_cutime;
|
||||
struct EBLHOOK(timeval) pr_cstime;
|
||||
struct
|
||||
{
|
||||
FIELD (PR_REG, pr_reg[PRSTATUS_REGS_SIZE / sizeof (PR_REG)]);
|
||||
}
|
||||
#ifdef ALIGN_PR_REG
|
||||
__attribute__ ((aligned (ALIGN_PR_REG)))
|
||||
#endif
|
||||
;
|
||||
FIELD (INT, pr_fpvalid);
|
||||
}
|
||||
#ifdef ALIGN_PRSTATUS
|
||||
attribute_packed __attribute__ ((aligned (ALIGN_PRSTATUS)))
|
||||
#endif
|
||||
;
|
||||
|
||||
#define FNAMESZ 16
|
||||
#define PRARGSZ 80
|
||||
|
||||
struct EBLHOOK(prpsinfo)
|
||||
{
|
||||
FIELD (CHAR, pr_state);
|
||||
FIELD (CHAR, pr_sname);
|
||||
FIELD (CHAR, pr_zomb);
|
||||
FIELD (CHAR, pr_nice);
|
||||
FIELD (ULONG, pr_flag);
|
||||
FIELD (PRPSINFO_UID_T, pr_uid);
|
||||
FIELD (PRPSINFO_GID_T, pr_gid);
|
||||
FIELD (PID_T, pr_pid);
|
||||
FIELD (PID_T, pr_ppid);
|
||||
FIELD (PID_T, pr_pgrp);
|
||||
FIELD (PID_T, pr_sid);
|
||||
FIELD (CHAR, pr_fname[FNAMESZ]);
|
||||
FIELD (CHAR, pr_psargs[PRARGSZ]);
|
||||
};
|
||||
|
||||
#undef FIELD
|
||||
|
||||
#define FIELD(igroup, itype, item, fmt, ...) \
|
||||
{ \
|
||||
.name = #item, \
|
||||
.group = #igroup, \
|
||||
.offset = offsetof (struct EBLHOOK(prstatus), pr_##item), \
|
||||
.type = TYPE_##itype, \
|
||||
.format = fmt, \
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
static const Ebl_Core_Item prstatus_items[] =
|
||||
{
|
||||
FIELD (signal, INT, info.si_signo, 'd'),
|
||||
FIELD (signal, INT, info.si_code, 'd'),
|
||||
FIELD (signal, INT, info.si_errno, 'd'),
|
||||
FIELD (signal, SHORT, cursig, 'd'),
|
||||
|
||||
/* Use different group name for a newline delimiter. */
|
||||
FIELD (signal2, ULONG, sigpend, 'B'),
|
||||
FIELD (signal3, ULONG, sighold, 'B'),
|
||||
FIELD (identity, PID_T, pid, 'd', .thread_identifier = true),
|
||||
FIELD (identity, PID_T, ppid, 'd'),
|
||||
FIELD (identity, PID_T, pgrp, 'd'),
|
||||
FIELD (identity, PID_T, sid, 'd'),
|
||||
TIMEVAL_FIELD (utime),
|
||||
TIMEVAL_FIELD (stime),
|
||||
TIMEVAL_FIELD (cutime),
|
||||
TIMEVAL_FIELD (cstime),
|
||||
#ifdef PRSTATUS_REGSET_ITEMS
|
||||
PRSTATUS_REGSET_ITEMS,
|
||||
#endif
|
||||
FIELD (register, INT, fpvalid, 'd'),
|
||||
};
|
||||
|
||||
#undef FIELD
|
||||
|
||||
#define FIELD(igroup, itype, item, fmt, ...) \
|
||||
{ \
|
||||
.name = #item, \
|
||||
.group = #igroup, \
|
||||
.offset = offsetof (struct EBLHOOK(prpsinfo), pr_##item), \
|
||||
.type = TYPE_##itype, \
|
||||
.format = fmt, \
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
static const Ebl_Core_Item prpsinfo_items[] =
|
||||
{
|
||||
FIELD (state, CHAR, state, 'd'),
|
||||
FIELD (state, CHAR, sname, 'c'),
|
||||
FIELD (state, CHAR, zomb, 'd'),
|
||||
FIELD (state, CHAR, nice, 'd'),
|
||||
FIELD (state, ULONG, flag, 'x'),
|
||||
FIELD (identity, PRPSINFO_UID_T, uid, 'd'),
|
||||
FIELD (identity, PRPSINFO_GID_T, gid, 'd'),
|
||||
FIELD (identity, PID_T, pid, 'd'),
|
||||
FIELD (identity, PID_T, ppid, 'd'),
|
||||
FIELD (identity, PID_T, pgrp, 'd'),
|
||||
FIELD (identity, PID_T, sid, 'd'),
|
||||
FIELD (command, CHAR, fname, 's', .count = FNAMESZ),
|
||||
FIELD (command, CHAR, psargs, 's', .count = PRARGSZ),
|
||||
};
|
||||
|
||||
static const Ebl_Core_Item vmcoreinfo_items[] =
|
||||
{
|
||||
{
|
||||
.type = ELF_T_BYTE, .format = '\n'
|
||||
}
|
||||
};
|
||||
|
||||
#undef FIELD
|
||||
|
||||
int
|
||||
EBLHOOK(core_note) (const GElf_Nhdr *nhdr, const char *name,
|
||||
GElf_Word *regs_offset, size_t *nregloc,
|
||||
const Ebl_Register_Location **reglocs,
|
||||
size_t *nitems, const Ebl_Core_Item **items)
|
||||
{
|
||||
switch (nhdr->n_namesz)
|
||||
{
|
||||
case sizeof "CORE" - 1: /* Buggy old Linux kernels. */
|
||||
if (memcmp (name, "CORE", nhdr->n_namesz) == 0)
|
||||
break;
|
||||
return 0;
|
||||
|
||||
case sizeof "CORE":
|
||||
if (memcmp (name, "CORE", nhdr->n_namesz) == 0)
|
||||
break;
|
||||
/* Buggy old Linux kernels didn't terminate "LINUX". */
|
||||
FALLTHROUGH;
|
||||
|
||||
case sizeof "LINUX":
|
||||
if (memcmp (name, "LINUX", nhdr->n_namesz) == 0)
|
||||
break;
|
||||
return 0;
|
||||
|
||||
case sizeof "VMCOREINFO":
|
||||
if (nhdr->n_type != 0
|
||||
|| memcmp (name, "VMCOREINFO", sizeof "VMCOREINFO") != 0)
|
||||
return 0;
|
||||
*regs_offset = 0;
|
||||
*nregloc = 0;
|
||||
*reglocs = NULL;
|
||||
*nitems = 1;
|
||||
*items = vmcoreinfo_items;
|
||||
return 1;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (nhdr->n_type)
|
||||
{
|
||||
case NT_PRSTATUS:
|
||||
if (nhdr->n_descsz != sizeof (struct EBLHOOK(prstatus)))
|
||||
return 0;
|
||||
*regs_offset = offsetof (struct EBLHOOK(prstatus), pr_reg);
|
||||
*nregloc = sizeof prstatus_regs / sizeof prstatus_regs[0];
|
||||
*reglocs = prstatus_regs;
|
||||
*nitems = sizeof prstatus_items / sizeof prstatus_items[0];
|
||||
*items = prstatus_items;
|
||||
return 1;
|
||||
|
||||
case NT_PRPSINFO:
|
||||
if (nhdr->n_descsz != sizeof (struct EBLHOOK(prpsinfo)))
|
||||
return 0;
|
||||
*regs_offset = 0;
|
||||
*nregloc = 0;
|
||||
*reglocs = NULL;
|
||||
*nitems = sizeof prpsinfo_items / sizeof prpsinfo_items[0];
|
||||
*items = prpsinfo_items;
|
||||
return 1;
|
||||
|
||||
#define EXTRA_REGSET(type, size, table) \
|
||||
case type: \
|
||||
if (nhdr->n_descsz != size) \
|
||||
return 0; \
|
||||
*regs_offset = 0; \
|
||||
*nregloc = sizeof table / sizeof table[0]; \
|
||||
*reglocs = table; \
|
||||
*nitems = 0; \
|
||||
*items = NULL; \
|
||||
return 1;
|
||||
|
||||
#define EXTRA_REGSET_ITEMS(type, size, table, extra_items) \
|
||||
case type: \
|
||||
if (nhdr->n_descsz != size) \
|
||||
return 0; \
|
||||
*regs_offset = 0; \
|
||||
*nregloc = sizeof table / sizeof table[0]; \
|
||||
*reglocs = table; \
|
||||
*nitems = sizeof extra_items / sizeof extra_items[0]; \
|
||||
*items = extra_items; \
|
||||
return 1;
|
||||
|
||||
#define EXTRA_ITEMS(type, size, extra_items) \
|
||||
case type: \
|
||||
if (nhdr->n_descsz != size) \
|
||||
return 0; \
|
||||
*regs_offset = 0; \
|
||||
*nregloc = 0; \
|
||||
*reglocs = NULL; \
|
||||
*nitems = sizeof extra_items / sizeof extra_items[0]; \
|
||||
*items = extra_items; \
|
||||
return 1;
|
||||
|
||||
#ifdef FPREGSET_SIZE
|
||||
EXTRA_REGSET (NT_FPREGSET, FPREGSET_SIZE, fpregset_regs)
|
||||
#endif
|
||||
|
||||
#ifdef EXTRA_NOTES
|
||||
EXTRA_NOTES
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/* LoongArch ABI-specified defaults for DWARF CFI.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limted.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* LoongArch ELF ABI specification:
|
||||
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_register_convention
|
||||
*/
|
||||
int
|
||||
loongarch_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
|
||||
{
|
||||
static const uint8_t abi_cfi[] =
|
||||
{
|
||||
/* The initial Canonical Frame Address is the value of the
|
||||
Stack Pointer ($r3) as setup in the previous frame. */
|
||||
DW_CFA_def_cfa, ULEB128_7 (3), ULEB128_7 (0),
|
||||
|
||||
/* The Stack Pointer ($r3) is restored from CFA address by default. */
|
||||
DW_CFA_val_offset, ULEB128_7 (3), ULEB128_7 (0),
|
||||
|
||||
#define SV(n) DW_CFA_same_value, ULEB128_7 (n)
|
||||
/* The return address register contains the return address setup by
|
||||
caller. */
|
||||
SV (1),
|
||||
|
||||
/* Callee-saved registers $s0-$s7. */
|
||||
SV (23), SV (24), SV (25), SV (26), SV (27), SV (28),
|
||||
SV (29), SV (30), SV (31),
|
||||
|
||||
/* The Frame Pointer ($fp, $r22) */
|
||||
SV(22),
|
||||
|
||||
/* Callee-saved registers $fs0-$fs7. */
|
||||
SV (56), SV (57), SV (58), SV (59), SV (60), SV (61),
|
||||
SV (62), SV (63),
|
||||
#undef SV
|
||||
|
||||
/* XXX Note: registers intentionally unused by the program,
|
||||
for example as a consequence of the procedure call standard
|
||||
should be initialized as if by DW_CFA_same_value. */
|
||||
};
|
||||
|
||||
abi_info->initial_instructions = abi_cfi;
|
||||
abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
|
||||
abi_info->data_alignment_factor = -4;
|
||||
|
||||
abi_info->return_address_register = 1; /* ra. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/* LoongArch specific core note handling.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limited.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
#define ULONG uint64_t
|
||||
#define PID_T int32_t
|
||||
#define UID_T uint32_t
|
||||
#define GID_T uint32_t
|
||||
#define ALIGN_ULONG 8
|
||||
#define ALIGN_PID_T 4
|
||||
#define ALIGN_UID_T 4
|
||||
#define ALIGN_GID_T 4
|
||||
#define TYPE_ULONG ELF_T_XWORD
|
||||
#define TYPE_PID_T ELF_T_SWORD
|
||||
#define TYPE_UID_T ELF_T_WORD
|
||||
#define TYPE_GID_T ELF_T_WORD
|
||||
|
||||
#define PRSTATUS_REGS_SIZE (45 * 8)
|
||||
|
||||
static const Ebl_Register_Location prstatus_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 0, .count = 32, .bits = 64 }, /* r0..r31 */
|
||||
};
|
||||
|
||||
#define PRSTATUS_REGSET_ITEMS \
|
||||
{ \
|
||||
.name = "orig_a0", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 32 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_era", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 33 * 8), \
|
||||
.group = "register", \
|
||||
.pc_register = true \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_badvaddr", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 34 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_crmd", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 35 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_prmd", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 36 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_euen", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 37 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_ecfg", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 38 * 8), \
|
||||
.group = "register" \
|
||||
}, \
|
||||
{ \
|
||||
.name = "csr_estat", .type = ELF_T_XWORD, .format = 'x', \
|
||||
.offset = (offsetof (struct EBLHOOK(prstatus), pr_reg) \
|
||||
+ 39 * 8), \
|
||||
.group = "register" \
|
||||
}
|
||||
/* 40 ~ 44 reserved */
|
||||
|
||||
#include "linux-core-note.c"
|
||||
@@ -0,0 +1,62 @@
|
||||
/* Initialization of LoongArch specific backend library.
|
||||
Copyright (C) 2022 Hengqi Chen
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limted.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#define RELOC_PREFIX R_LARCH_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on loongarch_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
|
||||
Ebl *
|
||||
loongarch_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
loongarch_init_reloc (eh);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, machine_flag_check);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, core_note);
|
||||
HOOK (eh, abi_cfi);
|
||||
/* gcc/config/ #define DWARF_FRAME_REGISTERS. */
|
||||
eh->frame_nregs = 74;
|
||||
HOOK (eh, check_special_symbol);
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
HOOK (eh, return_value_location);
|
||||
HOOK (eh, unwind);
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/* Fetch live process registers from TID.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limted.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
#include <assert.h>
|
||||
#if defined __loongarch__ && defined __linux__
|
||||
# include <sys/uio.h>
|
||||
# include <sys/procfs.h>
|
||||
# include <sys/ptrace.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
bool
|
||||
loongarch_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc __attribute__ ((unused)),
|
||||
void *arg __attribute__ ((unused)))
|
||||
{
|
||||
#if !defined __loongarch__ || !defined __linux__
|
||||
return false;
|
||||
#else /* __loongarch__ */
|
||||
|
||||
/* General registers. */
|
||||
struct user_regs_struct gregs;
|
||||
struct iovec iovec;
|
||||
iovec.iov_base = &gregs;
|
||||
iovec.iov_len = sizeof (gregs);
|
||||
if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec) != 0)
|
||||
return false;
|
||||
|
||||
/* $r0 is constant 0. */
|
||||
Dwarf_Word zero = 0;
|
||||
if (! setfunc (0, 1, &zero, arg))
|
||||
return false;
|
||||
|
||||
/* $r1-$r31. */
|
||||
if (! setfunc (1, 32, (Dwarf_Word *) &gregs.regs[1], arg))
|
||||
return false;
|
||||
|
||||
/* PC. */
|
||||
if (! setfunc (-1, 1, (Dwarf_Word *) &gregs.csr_era, arg))
|
||||
return false;
|
||||
|
||||
/* Floating-point registers (only 64bits are used). */
|
||||
struct user_fp_struct fregs;
|
||||
iovec.iov_base = &fregs;
|
||||
iovec.iov_len = sizeof (fregs);
|
||||
if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec) != 0)
|
||||
return false;
|
||||
|
||||
/* $f0-$f31 */
|
||||
if (! setfunc (32, 32, (Dwarf_Word *) &fregs.fpr[0], arg))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
#endif /* __loongarch__ */
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/* Register names and numbers for LoongArch DWARF.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limted.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
ssize_t
|
||||
loongarch_register_info (Ebl *ebl, int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setname,
|
||||
int *bits, int *type)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 64;
|
||||
|
||||
*prefix = "";
|
||||
|
||||
if (regno < 32)
|
||||
{
|
||||
*setname = "integer";
|
||||
*type = DW_ATE_signed;
|
||||
*bits = ebl->class == ELFCLASS64 ? 64 : 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
*setname = "FPU";
|
||||
*type = DW_ATE_float;
|
||||
*bits = 64;
|
||||
}
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case 0:
|
||||
return stpcpy (name, "zero") + 1 - name;
|
||||
|
||||
case 1:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "ra") + 1 - name;
|
||||
|
||||
case 2:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "tp") + 1 - name;
|
||||
|
||||
case 3:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "sp") + 1 - name;
|
||||
|
||||
case 4 ... 11:
|
||||
name[0] = 'a';
|
||||
name[1] = regno - 4 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 12 ... 20:
|
||||
name[0] = 't';
|
||||
name[1] = regno - 12 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 21:
|
||||
return stpcpy (name, "u0") + 1 - name;
|
||||
|
||||
case 22:
|
||||
*type = DW_ATE_address;
|
||||
return stpcpy (name, "fp") + 1 - name;
|
||||
|
||||
case 23 ... 31:
|
||||
name[0] = 's';
|
||||
name[1] = regno - 23 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 32 ... 39:
|
||||
name[0] = 'f';
|
||||
name[1] = 'a';
|
||||
name[2] = regno - 32 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 40 ... 49:
|
||||
name[0] = 'f';
|
||||
name[1] = 't';
|
||||
name[2] = regno - 40 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 50 ... 55:
|
||||
name[0] = 'f';
|
||||
name[1] = 't';
|
||||
name[2] = '1';
|
||||
name[3] = regno - 50 + '0';
|
||||
namelen = 4;
|
||||
break;
|
||||
|
||||
case 56 ... 63:
|
||||
name[0] = 'f';
|
||||
name[1] = 's';
|
||||
name[2] = regno - 56 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
*setname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
name[namelen++] = '\0';
|
||||
return namelen;
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/* List the relocation types for LoongArch. -*- C -*-
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, EXEC|DYN)
|
||||
RELOC_TYPE (32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (64, REL|EXEC|DYN)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (JUMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPMOD64, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPREL32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPREL64, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_TPREL32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_TPREL64, EXEC|DYN)
|
||||
RELOC_TYPE (IRELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (MARK_LA, REL)
|
||||
RELOC_TYPE (MARK_PCREL, REL)
|
||||
RELOC_TYPE (SOP_PUSH_PCREL, REL)
|
||||
RELOC_TYPE (SOP_PUSH_ABSOLUTE, REL)
|
||||
RELOC_TYPE (SOP_PUSH_DUP, REL)
|
||||
RELOC_TYPE (SOP_PUSH_GPREL, REL)
|
||||
RELOC_TYPE (SOP_PUSH_TLS_TPREL, REL)
|
||||
RELOC_TYPE (SOP_PUSH_TLS_GOT, REL)
|
||||
RELOC_TYPE (SOP_PUSH_TLS_GD, REL)
|
||||
RELOC_TYPE (SOP_PUSH_PLT_PCREL, REL)
|
||||
RELOC_TYPE (SOP_ASSERT, REL)
|
||||
RELOC_TYPE (SOP_NOT, REL)
|
||||
RELOC_TYPE (SOP_SUB, REL)
|
||||
RELOC_TYPE (SOP_SL, REL)
|
||||
RELOC_TYPE (SOP_SR, REL)
|
||||
RELOC_TYPE (SOP_ADD, REL)
|
||||
RELOC_TYPE (SOP_AND, REL)
|
||||
RELOC_TYPE (SOP_IF_ELSE, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_10_5, REL)
|
||||
RELOC_TYPE (SOP_POP_32_U_10_12, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_10_12, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_10_16, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_10_16_S2, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_5_20, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_0_5_10_16_S2, REL)
|
||||
RELOC_TYPE (SOP_POP_32_S_0_10_10_16_S2, REL)
|
||||
RELOC_TYPE (SOP_POP_32_U, REL)
|
||||
RELOC_TYPE (ADD8, REL)
|
||||
RELOC_TYPE (ADD16, REL)
|
||||
RELOC_TYPE (ADD24, REL)
|
||||
RELOC_TYPE (ADD32, REL)
|
||||
RELOC_TYPE (ADD64, REL)
|
||||
RELOC_TYPE (SUB8, REL)
|
||||
RELOC_TYPE (SUB16, REL)
|
||||
RELOC_TYPE (SUB24, REL)
|
||||
RELOC_TYPE (SUB32, REL)
|
||||
RELOC_TYPE (SUB64, REL)
|
||||
RELOC_TYPE (GNU_VTINHERIT, REL)
|
||||
RELOC_TYPE (GNU_VTENTRY, REL)
|
||||
|
||||
/* reserved 59-63 */
|
||||
|
||||
RELOC_TYPE (B16, REL)
|
||||
RELOC_TYPE (B21, REL)
|
||||
RELOC_TYPE (B26, REL)
|
||||
RELOC_TYPE (ABS_HI20, REL)
|
||||
RELOC_TYPE (ABS_LO12, REL)
|
||||
RELOC_TYPE (ABS64_LO20, REL)
|
||||
RELOC_TYPE (ABS64_HI12, REL)
|
||||
RELOC_TYPE (PCALA_HI20, REL)
|
||||
RELOC_TYPE (PCALA_LO12, REL)
|
||||
RELOC_TYPE (PCALA64_LO20, REL)
|
||||
RELOC_TYPE (PCALA64_HI12, REL)
|
||||
RELOC_TYPE (GOT_PC_HI20, REL)
|
||||
RELOC_TYPE (GOT_PC_LO12, REL)
|
||||
RELOC_TYPE (GOT64_PC_LO20, REL)
|
||||
RELOC_TYPE (GOT64_PC_HI12, REL)
|
||||
RELOC_TYPE (GOT_HI20, REL)
|
||||
RELOC_TYPE (GOT_LO12, REL)
|
||||
RELOC_TYPE (GOT64_LO20, REL)
|
||||
RELOC_TYPE (GOT64_HI12, REL)
|
||||
RELOC_TYPE (TLS_LE_HI20, REL)
|
||||
RELOC_TYPE (TLS_LE_LO12, REL)
|
||||
RELOC_TYPE (TLS_LE64_LO20, REL)
|
||||
RELOC_TYPE (TLS_LE64_HI12, REL)
|
||||
RELOC_TYPE (TLS_IE_PC_HI20, REL)
|
||||
RELOC_TYPE (TLS_IE_PC_LO12, REL)
|
||||
RELOC_TYPE (TLS_IE64_PC_LO20, REL)
|
||||
RELOC_TYPE (TLS_IE64_PC_HI12, REL)
|
||||
RELOC_TYPE (TLS_IE_HI20, REL)
|
||||
RELOC_TYPE (TLS_IE_LO12, REL)
|
||||
RELOC_TYPE (TLS_IE64_LO20, REL)
|
||||
RELOC_TYPE (TLS_IE64_HI12, REL)
|
||||
RELOC_TYPE (TLS_LD_PC_HI20, REL)
|
||||
RELOC_TYPE (TLS_LD_HI20, REL)
|
||||
RELOC_TYPE (TLS_GD_PC_HI20, REL)
|
||||
RELOC_TYPE (TLS_GD_HI20, REL)
|
||||
RELOC_TYPE (32_PCREL, REL)
|
||||
RELOC_TYPE (RELAX, REL)
|
||||
RELOC_TYPE (DELETE, REL)
|
||||
RELOC_TYPE (ALIGN, REL)
|
||||
RELOC_TYPE (PCREL20_S2, REL)
|
||||
RELOC_TYPE (CFA, REL)
|
||||
RELOC_TYPE (ADD6, REL)
|
||||
RELOC_TYPE (SUB6, REL)
|
||||
RELOC_TYPE (ADD_ULEB128, REL)
|
||||
RELOC_TYPE (SUB_ULEB128, REL)
|
||||
RELOC_TYPE (64_PCREL, REL)
|
||||
@@ -0,0 +1,202 @@
|
||||
/* Function return value location for Linux/LoongArch ABI.
|
||||
Copyright (C) 2013 Red Hat, Inc.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limited.
|
||||
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
static int
|
||||
dwarf_bytesize_aux (Dwarf_Die *die, Dwarf_Word *sizep)
|
||||
{
|
||||
int bits;
|
||||
if (((bits = 8 * dwarf_bytesize (die)) < 0
|
||||
&& (bits = dwarf_bitsize (die)) < 0)
|
||||
|| bits % 8 != 0)
|
||||
return -1;
|
||||
|
||||
*sizep = bits / 8;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_in_gpr (const Dwarf_Op **locp, Dwarf_Word size)
|
||||
{
|
||||
static const Dwarf_Op loc[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg4 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
{ .atom = DW_OP_reg5 }, { .atom = DW_OP_piece, .number = 8 }
|
||||
};
|
||||
|
||||
*locp = loc;
|
||||
return size <= 8 ? 1 : 4;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_by_ref (const Dwarf_Op **locp)
|
||||
{
|
||||
static const Dwarf_Op loc[] = { { .atom = DW_OP_breg4 } };
|
||||
|
||||
*locp = loc;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
pass_in_fpr (const Dwarf_Op **locp, Dwarf_Word size)
|
||||
{
|
||||
static const Dwarf_Op loc[] =
|
||||
{
|
||||
{ .atom = DW_OP_regx, .number = 32 },
|
||||
{ .atom = DW_OP_piece, .number = 8 },
|
||||
{ .atom = DW_OP_regx, .number = 33 },
|
||||
{ .atom = DW_OP_piece, .number = 8 }
|
||||
};
|
||||
|
||||
*locp = loc;
|
||||
return size <= 8 ? 1 : 4;
|
||||
}
|
||||
|
||||
int
|
||||
loongarch_return_value_location(Dwarf_Die *functypedie,
|
||||
const Dwarf_Op **locp)
|
||||
{
|
||||
/* Start with the function's type, and get the DW_AT_type attribute,
|
||||
which is the type of the return value. */
|
||||
Dwarf_Die typedie;
|
||||
int tag = dwarf_peeled_die_type (functypedie, &typedie);
|
||||
if (tag <= 0)
|
||||
return tag;
|
||||
|
||||
Dwarf_Word size = (Dwarf_Word)-1;
|
||||
|
||||
/* If the argument type is a Composite Type that is larger than 16
|
||||
bytes, then the argument is copied to memory allocated by the
|
||||
caller and the argument is replaced by a pointer to the copy. */
|
||||
if (tag == DW_TAG_structure_type || tag == DW_TAG_union_type
|
||||
|| tag == DW_TAG_class_type || tag == DW_TAG_array_type)
|
||||
{
|
||||
if (dwarf_aggregate_size (&typedie, &size) < 0)
|
||||
return -1;
|
||||
|
||||
/* Aggregates larger than 2*GRLEN bits are passed by reference. */
|
||||
if (size > 16)
|
||||
return pass_by_ref (locp);
|
||||
/* Aggregates whose total size is no more than GRLEN bits are passed in
|
||||
a register. Aggregates whose total size is no more than 2*GRLEN bits
|
||||
are passed in a pair of registers. */
|
||||
else
|
||||
return pass_in_gpr (locp, size);
|
||||
}
|
||||
|
||||
if (tag == DW_TAG_base_type || dwarf_is_pointer (tag))
|
||||
{
|
||||
if (dwarf_bytesize_aux (&typedie, &size) < 0)
|
||||
{
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 8;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (tag == DW_TAG_base_type)
|
||||
{
|
||||
Dwarf_Word encoding;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (&typedie, DW_AT_encoding,
|
||||
&attr_mem),
|
||||
&encoding) != 0)
|
||||
return -1;
|
||||
|
||||
switch (encoding)
|
||||
{
|
||||
case DW_ATE_boolean:
|
||||
case DW_ATE_signed:
|
||||
case DW_ATE_unsigned:
|
||||
case DW_ATE_unsigned_char:
|
||||
case DW_ATE_signed_char:
|
||||
/* Scalars that are at most GRLEN bits wide are passed in a single
|
||||
argument register. Scalars that are 2*GRLEN bits wide are
|
||||
passed in a pair of argument registers. Scalars wider than
|
||||
2*GRLEN are passed by reference. */
|
||||
return pass_in_gpr (locp, size);
|
||||
|
||||
case DW_ATE_float:
|
||||
/* A real floating-point argument is passed in a floating-point
|
||||
argument register if it is no more than FLEN bits wide,
|
||||
otherwise it is passed according to the integer calling
|
||||
convention. */
|
||||
switch (size)
|
||||
{
|
||||
case 4: /* single */
|
||||
case 8: /* double */
|
||||
return pass_in_fpr (locp, size);
|
||||
|
||||
case 16: /* quad */
|
||||
return pass_in_gpr (locp, size);
|
||||
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
|
||||
case DW_ATE_complex_float:
|
||||
/* A complex floating-point number is passed as though it were a
|
||||
struct containing two floating-point reals. */
|
||||
switch (size)
|
||||
{
|
||||
case 8: /* float _Complex */
|
||||
case 16: /* double _Complex */
|
||||
return pass_in_fpr (locp, size);
|
||||
|
||||
case 32: /* long double _Complex */
|
||||
return pass_by_ref (locp);
|
||||
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
return pass_in_gpr (locp, size);
|
||||
}
|
||||
|
||||
*locp = NULL;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/* LoongArch specific symbolic name handling.
|
||||
Copyright (C) 2022 Hengqi Chen
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
loongarch_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type,
|
||||
int *addsub)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case R_LARCH_32:
|
||||
return ELF_T_WORD;
|
||||
case R_LARCH_64:
|
||||
return ELF_T_XWORD;
|
||||
case R_LARCH_ADD16:
|
||||
*addsub = 1;
|
||||
return ELF_T_HALF;
|
||||
case R_LARCH_ADD32:
|
||||
*addsub = 1;
|
||||
return ELF_T_WORD;
|
||||
case R_LARCH_ADD64:
|
||||
*addsub = 1;
|
||||
return ELF_T_XWORD;
|
||||
case R_LARCH_SUB16:
|
||||
*addsub = -1;
|
||||
return ELF_T_HALF;
|
||||
case R_LARCH_SUB32:
|
||||
*addsub = -1;
|
||||
return ELF_T_WORD;
|
||||
case R_LARCH_SUB64:
|
||||
*addsub = -1;
|
||||
return ELF_T_XWORD;
|
||||
default:
|
||||
return ELF_T_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
loongarch_machine_flag_check (GElf_Word flags)
|
||||
{
|
||||
return ((flags &~ (EF_LARCH_ABI_MODIFIER_MASK
|
||||
| EF_LARCH_OBJABI_V1)) == 0);
|
||||
}
|
||||
|
||||
/* Check whether given symbol's st_value and st_size are OK despite failing
|
||||
normal checks. */
|
||||
bool
|
||||
loongarch_check_special_symbol (Elf *elf, const GElf_Sym *sym,
|
||||
const char *name, const GElf_Shdr *destshdr)
|
||||
{
|
||||
if (name != NULL
|
||||
&& strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
|
||||
{
|
||||
size_t shstrndx;
|
||||
if (elf_getshdrstrndx (elf, &shstrndx) != 0)
|
||||
return false;
|
||||
const char *sname = elf_strptr (elf, shstrndx, destshdr->sh_name);
|
||||
if (sname != NULL
|
||||
&& (strcmp (sname, ".got") == 0 || strcmp (sname, ".got.plt") == 0))
|
||||
{
|
||||
Elf_Scn *scn = NULL;
|
||||
while ((scn = elf_nextscn (elf, scn)) != NULL)
|
||||
{
|
||||
GElf_Shdr shdr_mem;
|
||||
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
|
||||
if (shdr != NULL)
|
||||
{
|
||||
sname = elf_strptr (elf, shstrndx, shdr->sh_name);
|
||||
if (sname != NULL && strcmp (sname, ".got") == 0)
|
||||
return (sym->st_value >= shdr->sh_addr
|
||||
&& sym->st_value < shdr->sh_addr + shdr->sh_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* Get previous frame state for an existing frame state.
|
||||
Copyright (C) 2023 OpenAnolis community LoongArch SIG.
|
||||
Copyright (C) 2023 Loongson Technology Corporation Limited.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND loongarch_
|
||||
#define RA_REG 1
|
||||
#define SP_REG 3
|
||||
#define FP_REG 22
|
||||
|
||||
#define RA_OFFSET 8
|
||||
#define FP_OFFSET 16
|
||||
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* There was no CFI. Maybe we happen to have a frame pointer and can unwind from that? */
|
||||
|
||||
bool
|
||||
EBLHOOK(unwind) (Ebl *ebl __attribute__ ((unused)), Dwarf_Addr pc __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc, ebl_tid_registers_get_t *getfunc,
|
||||
ebl_pid_memory_read_t *readfunc, void *arg,
|
||||
bool *signal_framep __attribute__ ((unused)))
|
||||
{
|
||||
Dwarf_Word fp, ra, sp;
|
||||
|
||||
if (!getfunc(RA_REG, 1, &ra, arg))
|
||||
return false;
|
||||
|
||||
if (ra == 0 || !setfunc(-1, 1, &ra, arg))
|
||||
return false;
|
||||
|
||||
if (!getfunc(FP_REG, 1, &fp, arg))
|
||||
fp = 0;
|
||||
|
||||
if (!getfunc(SP_REG, 1, &sp, arg))
|
||||
sp = 0;
|
||||
|
||||
Dwarf_Word newRa, newFp, newSp;
|
||||
|
||||
if (!readfunc(fp - RA_OFFSET, &newRa, arg))
|
||||
newRa = 0;
|
||||
|
||||
if (!readfunc(fp - FP_OFFSET, &newFp, arg))
|
||||
newFp = 0;
|
||||
|
||||
newSp = fp;
|
||||
|
||||
// These are not fatal if they don't work. They will just prevent unwinding at the next frame.
|
||||
setfunc(RA_REG, 1, &newRa, arg);
|
||||
setfunc(FP_REG, 1, &newFp, arg);
|
||||
setfunc(SP_REG, 1, &newSp, arg);
|
||||
|
||||
// If the fp is invalid, we might still have a valid ra.
|
||||
// But if the fp is valid, then the stack should be moving in the right direction.
|
||||
return fp == 0 || newSp > sp;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/* m68k ABI-specified defaults for DWARF CFI.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND m68k_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
int
|
||||
m68k_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
|
||||
{
|
||||
static const uint8_t abi_cfi[] =
|
||||
{
|
||||
#define SV(n) DW_CFA_same_value, ULEB128_7 (n)
|
||||
/* Call-saved registers %d2-%d7, %a2-%a6. */
|
||||
SV (2), SV (3), SV (4), SV (5), SV (6), SV (7),
|
||||
SV (10), SV (11), SV (12), SV (13), SV (14),
|
||||
|
||||
/* The CFA is the SP. */
|
||||
DW_CFA_val_offset, ULEB128_7 (15), ULEB128_7 (0),
|
||||
};
|
||||
|
||||
abi_info->initial_instructions = abi_cfi;
|
||||
abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
|
||||
abi_info->data_alignment_factor = -4;
|
||||
|
||||
abi_info->return_address_register = 24; /* %pc */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/* M68K specific core note handling.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <elf.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define BACKEND m68k_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
static const Ebl_Register_Location prstatus_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 1, .count = 14, .bits = 32 }, /* d1-d7, a0-a6 */
|
||||
{ .offset = 14 * 4, .regno = 0, .count = 1, .bits = 32 }, /* d0 */
|
||||
{ .offset = 15 * 4, .regno = 15, .count = 1, .bits = 32 }, /* a7 */
|
||||
{ .offset = 18 * 4, .regno = 24, .count = 1, .bits = 32 } /* pc */
|
||||
};
|
||||
#define PRSTATUS_REGS_SIZE (20 * 4)
|
||||
|
||||
#define ULONG uint32_t
|
||||
#define PID_T int32_t
|
||||
#define UID_T uint16_t
|
||||
#define GID_T uint16_t
|
||||
#define ALIGN_INT 2
|
||||
#define ALIGN_ULONG 2
|
||||
#define ALIGN_PID_T 2
|
||||
#define ALIGN_UID_T 2
|
||||
#define ALIGN_GID_T 2
|
||||
#define ALIGN_PRSTATUS 2
|
||||
#define TYPE_ULONG ELF_T_WORD
|
||||
#define TYPE_PID_T ELF_T_SWORD
|
||||
#define TYPE_UID_T ELF_T_HALF
|
||||
#define TYPE_GID_T ELF_T_HALF
|
||||
|
||||
static const Ebl_Register_Location fpregset_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 16, .count = 8, .bits = 96 }, /* fp0-fp7 */
|
||||
};
|
||||
#define FPREGSET_SIZE (27 * 4)
|
||||
|
||||
#include "linux-core-note.c"
|
||||
@@ -0,0 +1,58 @@
|
||||
/* Initialization of M68K specific backend library.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND m68k_
|
||||
#define RELOC_PREFIX R_68K_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
/* This defines the common reloc hooks based on m68k_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
|
||||
Ebl *
|
||||
m68k_init (Elf *elf __attribute__ ((unused)),
|
||||
GElf_Half machine __attribute__ ((unused)),
|
||||
Ebl *eh)
|
||||
{
|
||||
/* We handle it. */
|
||||
m68k_init_reloc (eh);
|
||||
HOOK (eh, gotpc_reloc_check);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, return_value_location);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, core_note);
|
||||
HOOK (eh, abi_cfi);
|
||||
/* gcc/config/ #define DWARF_FRAME_REGISTERS. */
|
||||
eh->frame_nregs = 25;
|
||||
HOOK (eh, set_initial_registers_tid);
|
||||
|
||||
return eh;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/* Fetch live process registers from TID.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined __m68k__ && defined __linux__
|
||||
# include <sys/types.h>
|
||||
# include <sys/user.h>
|
||||
# include <sys/ptrace.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND m68k_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
bool
|
||||
m68k_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
ebl_tid_registers_t *setfunc __attribute__ ((unused)),
|
||||
void *arg __attribute__ ((unused)))
|
||||
{
|
||||
#if !defined __m68k__ || !defined __linux__
|
||||
return false;
|
||||
#else /* __m68k__ */
|
||||
struct user_regs_struct user_regs;
|
||||
if (ptrace (PTRACE_GETREGS, tid, NULL, &user_regs) != 0)
|
||||
return false;
|
||||
|
||||
Dwarf_Word dwarf_regs[16];
|
||||
dwarf_regs[0] = user_regs.d0;
|
||||
dwarf_regs[1] = user_regs.d1;
|
||||
dwarf_regs[2] = user_regs.d2;
|
||||
dwarf_regs[3] = user_regs.d3;
|
||||
dwarf_regs[4] = user_regs.d4;
|
||||
dwarf_regs[5] = user_regs.d5;
|
||||
dwarf_regs[6] = user_regs.d6;
|
||||
dwarf_regs[7] = user_regs.d7;
|
||||
dwarf_regs[8] = user_regs.a0;
|
||||
dwarf_regs[9] = user_regs.a1;
|
||||
dwarf_regs[10] = user_regs.a2;
|
||||
dwarf_regs[11] = user_regs.a3;
|
||||
dwarf_regs[12] = user_regs.a4;
|
||||
dwarf_regs[13] = user_regs.a5;
|
||||
dwarf_regs[14] = user_regs.a6;
|
||||
dwarf_regs[15] = user_regs.usp;
|
||||
|
||||
/* D0..D7, A0..A7. */
|
||||
if (! setfunc (0, 16, dwarf_regs, arg))
|
||||
return false;
|
||||
|
||||
/* PC. */
|
||||
dwarf_regs[0] = user_regs.pc;
|
||||
if (! setfunc (24, 1, dwarf_regs, arg))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
#endif /* __m68k__ */
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/* Register names and numbers for M68K DWARF.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND m68k_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
ssize_t
|
||||
m68k_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
int regno, char *name, size_t namelen,
|
||||
const char **prefix, const char **setname,
|
||||
int *bits, int *type)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 25;
|
||||
|
||||
if (regno < 0 || regno > 24 || namelen < 5)
|
||||
return -1;
|
||||
|
||||
*prefix = "%";
|
||||
*setname = "integer";
|
||||
*bits = 32;
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case 0 ... 7:
|
||||
*type = DW_ATE_signed;
|
||||
name[0] = 'd';
|
||||
name[1] = regno + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 8 ... 15:
|
||||
*type = DW_ATE_address;
|
||||
name[0] = 'a';
|
||||
name[1] = regno - 8 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 16 ... 23:
|
||||
*type = DW_ATE_float;
|
||||
*setname = "FPU";
|
||||
*bits = 96;
|
||||
name[0] = 'f';
|
||||
name[1] = 'p';
|
||||
name[2] = regno - 16 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
*type = DW_ATE_address;
|
||||
name[0] = 'p';
|
||||
name[1] = 'c';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
/* Can't happen. */
|
||||
default:
|
||||
*setname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
name[namelen++] = '\0';
|
||||
return namelen;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/* List the relocation types for m68k. -*- C -*-
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* NAME, REL|EXEC|DYN */
|
||||
|
||||
RELOC_TYPE (NONE, EXEC|DYN)
|
||||
RELOC_TYPE (32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (16, REL|EXEC|DYN)
|
||||
RELOC_TYPE (8, REL|EXEC|DYN)
|
||||
RELOC_TYPE (PC32, REL|EXEC|DYN)
|
||||
RELOC_TYPE (PC16, REL|EXEC|DYN)
|
||||
RELOC_TYPE (PC8, REL|EXEC|DYN)
|
||||
RELOC_TYPE (GOT32, REL)
|
||||
RELOC_TYPE (GOT16, REL)
|
||||
RELOC_TYPE (GOT8, REL)
|
||||
RELOC_TYPE (GOT32O, REL)
|
||||
RELOC_TYPE (GOT16O, REL)
|
||||
RELOC_TYPE (GOT8O, REL)
|
||||
RELOC_TYPE (PLT32, REL)
|
||||
RELOC_TYPE (PLT16, REL)
|
||||
RELOC_TYPE (PLT8, REL)
|
||||
RELOC_TYPE (PLT32O, REL)
|
||||
RELOC_TYPE (PLT16O, REL)
|
||||
RELOC_TYPE (PLT8O, REL)
|
||||
RELOC_TYPE (COPY, EXEC|DYN)
|
||||
RELOC_TYPE (GLOB_DAT, EXEC|DYN)
|
||||
RELOC_TYPE (JMP_SLOT, EXEC|DYN)
|
||||
RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_GD32, REL)
|
||||
RELOC_TYPE (TLS_GD16, REL)
|
||||
RELOC_TYPE (TLS_GD8, REL)
|
||||
RELOC_TYPE (TLS_LDM32, REL)
|
||||
RELOC_TYPE (TLS_LDM16, REL)
|
||||
RELOC_TYPE (TLS_LDM8, REL)
|
||||
RELOC_TYPE (TLS_LDO32, REL)
|
||||
RELOC_TYPE (TLS_LDO16, REL)
|
||||
RELOC_TYPE (TLS_LDO8, REL)
|
||||
RELOC_TYPE (TLS_IE32, REL)
|
||||
RELOC_TYPE (TLS_IE16, REL)
|
||||
RELOC_TYPE (TLS_IE8, REL)
|
||||
RELOC_TYPE (TLS_LE32, REL)
|
||||
RELOC_TYPE (TLS_LE16, REL)
|
||||
RELOC_TYPE (TLS_LE8, REL)
|
||||
RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_DTPREL32, EXEC|DYN)
|
||||
RELOC_TYPE (TLS_TPREL32, EXEC|DYN)
|
||||
@@ -0,0 +1,150 @@
|
||||
/* Function return value location for Linux/m68k ABI.
|
||||
This file is part of elfutils.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify
|
||||
it under the terms of either
|
||||
|
||||
* the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or (at
|
||||
your option) any later version
|
||||
|
||||
or
|
||||
|
||||
* 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
|
||||
|
||||
or both in parallel, as here.
|
||||
|
||||
elfutils 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 copies of the GNU General Public License and
|
||||
the GNU Lesser General Public License along with this program. If
|
||||
not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND m68k_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* %d0, or pair %d0, %d1. */
|
||||
static const Dwarf_Op loc_intreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
{ .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
};
|
||||
#define nloc_intreg 1
|
||||
#define nloc_intregpair 4
|
||||
|
||||
/* %a0. */
|
||||
static const Dwarf_Op loc_ptrreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg8 }
|
||||
};
|
||||
#define nloc_ptrreg 1
|
||||
|
||||
/* %fp0. */
|
||||
static const Dwarf_Op loc_fpreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg16 }
|
||||
};
|
||||
#define nloc_fpreg 1
|
||||
|
||||
/* The return value is a structure and is actually stored in stack space
|
||||
passed in a hidden argument by the caller. But, the compiler
|
||||
helpfully returns the address of that space in %a0. */
|
||||
static const Dwarf_Op loc_aggregate[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg8 }
|
||||
};
|
||||
#define nloc_aggregate 1
|
||||
|
||||
int
|
||||
m68k_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
{
|
||||
/* Start with the function's type, and get the DW_AT_type attribute,
|
||||
which is the type of the return value. */
|
||||
Dwarf_Die die_mem, *typedie = &die_mem;
|
||||
int tag = dwarf_peeled_die_type (functypedie, typedie);
|
||||
if (tag <= 0)
|
||||
return tag;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case -1:
|
||||
return -1;
|
||||
|
||||
case DW_TAG_subrange_type:
|
||||
if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
|
||||
{
|
||||
Dwarf_Attribute attr_mem, *attr;
|
||||
attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
typedie = dwarf_formref_die (attr, &die_mem);
|
||||
tag = DWARF_TAG_OR_RETURN (typedie);
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
case DW_TAG_base_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
CASE_POINTER:
|
||||
{
|
||||
Dwarf_Word size;
|
||||
Dwarf_Attribute attr_mem;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) != 0)
|
||||
{
|
||||
if (dwarf_is_pointer (tag))
|
||||
size = 4;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
if (tag == DW_TAG_base_type)
|
||||
{
|
||||
Dwarf_Word encoding;
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
|
||||
&attr_mem),
|
||||
&encoding) != 0)
|
||||
return -1;
|
||||
if (encoding == DW_ATE_float)
|
||||
{
|
||||
if (size > 12)
|
||||
return -2;
|
||||
*locp = loc_fpreg;
|
||||
return nloc_fpreg;
|
||||
}
|
||||
}
|
||||
if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
{
|
||||
*locp = loc_ptrreg;
|
||||
return nloc_ptrreg;
|
||||
}
|
||||
*locp = loc_intreg;
|
||||
if (size <= 4)
|
||||
return nloc_intreg;
|
||||
if (size <= 8)
|
||||
return nloc_intregpair;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case DW_TAG_structure_type:
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_union_type:
|
||||
case DW_TAG_array_type:
|
||||
*locp = loc_aggregate;
|
||||
return nloc_aggregate;
|
||||
}
|
||||
|
||||
/* XXX We don't have a good way to return specific errors from ebl calls.
|
||||
This value means we do not understand the type, but it is well-formed
|
||||
DWARF and might be valid. */
|
||||
return -2;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user