Compare commits

..

No commits in common. "openkylin/yangtze" and "pristine-tar" have entirely different histories.

148 changed files with 2 additions and 28256 deletions

8
.gitignore vendored
View File

@ -1,8 +0,0 @@
*.o
*.dwo
*~
dwz
dwz.sum
dwz.log
native.c
testsuite/dwz.tests/execs

340
COPYING
View File

@ -1,340 +0,0 @@
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 Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <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 Library General
Public License instead of this License.

View File

@ -1,73 +0,0 @@
GCC RUNTIME LIBRARY EXCEPTION
Version 3.1, 31 March 2009
Copyright (C) 2009 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 GCC Runtime Library Exception ("Exception") is an additional
permission under section 7 of the GNU General Public License, version
3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
bears a notice placed by the copyright holder of the file stating that
the file is governed by GPLv3 along with this Exception.
When you use GCC to compile a program, GCC may combine portions of
certain GCC header files and runtime libraries with the compiled
program. The purpose of this Exception is to allow compilation of
non-GPL (including proprietary) programs to use, in this way, the
header files and runtime libraries covered by this Exception.
0. Definitions.
A file is an "Independent Module" if it either requires the Runtime
Library for execution after a Compilation Process, or makes use of an
interface provided by the Runtime Library, but is not otherwise based
on the Runtime Library.
"GCC" means a version of the GNU Compiler Collection, with or without
modifications, governed by version 3 (or a specified later version) of
the GNU General Public License (GPL) with the option of using any
subsequent versions published by the FSF.
"GPL-compatible Software" is software whose conditions of propagation,
modification and use would permit combination with GCC in accord with
the license of GCC.
"Target Code" refers to output from any compiler for a real or virtual
target processor architecture, in executable form or suitable for
input to an assembler, loader, linker and/or execution
phase. Notwithstanding that, Target Code does not include data in any
format that is used as a compiler intermediate representation, or used
for producing a compiler intermediate representation.
The "Compilation Process" transforms code entirely represented in
non-intermediate languages designed for human-written code, and/or in
Java Virtual Machine byte code, into Target Code. Thus, for example,
use of source code generators and preprocessors need not be considered
part of the Compilation Process, since the Compilation Process can be
understood as starting with the output of the generators or
preprocessors.
A Compilation Process is "Eligible" if it is done using GCC, alone or
with other GPL-compatible software, or if it is done without using any
work based on GCC. For example, using non-GPL-compatible Software to
optimize any GCC intermediate representations would not qualify as an
Eligible Compilation Process.
1. Grant of Additional Permission.
You have permission to propagate a work of Target Code formed by
combining the Runtime Library with Independent Modules, even if such
propagation would otherwise violate the terms of GPLv3, provided that
all Target Code was generated by Eligible Compilation Processes. You
may then convey such a combination under terms of your choice,
consistent with the licensing of the Independent Modules.
2. No Weakening of GCC Copyleft.
The availability of this Exception does not imply any general
presumption that third-party software is unaffected by the copyleft
requirements of the license of GCC.

674
COPYING3
View File

@ -1,674 +0,0 @@
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>.

View File

@ -1,3 +0,0 @@
-DFSF_YEARS='"1992-2021"'
-DRH_YEARS='"2001-2021"'
-DSUSE_YEARS='"2019-2021"'

View File

@ -1 +0,0 @@
One definition rule optimization

201
Makefile
View File

@ -1,201 +0,0 @@
ifneq ($(srcdir),)
VPATH = $(srcdir)
else
srcdir=$(shell pwd)
endif
CFLAGS = -O2 -g
DWZ_VERSION := $(shell cat $(srcdir)/VERSION)
CFLAGS_VERSION = -DDWZ_VERSION='"$(DWZ_VERSION)"'
CFLAGS_COPYRIGHT = $(shell cat $(srcdir)/COPYRIGHT_YEARS)
CFLAGS_COMMON = -Wall -W -D_FILE_OFFSET_BITS=64
XXH_PROG = "\#define XXH_INLINE_ALL 1\n\#include <xxhash.h>\n"
XXH_INLINE_ALL_WORKS = $(shell printf $(XXH_PROG) \
| $(CC) -xc -c - -o /dev/null 2>/dev/null \
&& echo -n 1)
ifeq "$(XXH_INLINE_ALL_WORKS)" "1"
CFLAGS_COMMON += -DXXH_INLINE_ALL=1
endif
override CFLAGS += $(CFLAGS_COMMON) $(CFLAGS_VERSION) $(CFLAGS_COPYRIGHT)
prefix = /usr
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
datarootdir = $(prefix)/share
mandir = $(datarootdir)/man
OBJECTS = args.o dwz.o hashtab.o pool.o sha1.o dwarfnames.o
LIBS=-lelf
ifneq "$(XXH_INLINE_ALL_WORKS)" "1"
LIBS += -lxxhash
endif
dwz: $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
args.o: native.o
args.o: CFLAGS_FOR_SOURCE = \
-DNATIVE_ENDIAN_VAL=$(NATIVE_ENDIAN_VAL) \
-DNATIVE_POINTER_SIZE=$(NATIVE_POINTER_SIZE)
NATIVE_ENDIAN=$(shell readelf -h native.o \
| grep Data \
| sed 's/.*, //;s/ endian//')
NATIVE_ENDIAN_LITTLE=$(findstring $(NATIVE_ENDIAN),$(findstring little,$(NATIVE_ENDIAN)))
NATIVE_ENDIAN_BIG=$(findstring $(NATIVE_ENDIAN),$(findstring big,$(NATIVE_ENDIAN)))
NATIVE_ENDIAN_VAL=$(if $(NATIVE_ENDIAN_LITTLE),ELFDATA2LSB,$(if $(NATIVE_ENDIAN_BIG),ELFDATA2MSB,ELFDATANONE))
NATIVE_POINTER_SIZE=$(shell readelf -wi native.o \
| grep "Pointer Size:" \
| sed 's/.*: *//')
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< $(CFLAGS_FOR_SOURCE)
install: dwz
install -D dwz $(DESTDIR)$(bindir)/dwz
install -D -m 644 $(srcdir)/dwz.1 $(DESTDIR)$(mandir)/man1/dwz.1
clean:
rm -f $(OBJECTS) *~ core* dwz $(TEST_EXECS) $(DWZ_TEST_OBJECTS) \
dwz.log dwz.sum native.c native.o
rm -Rf testsuite-bin tmp.*
native.c:
echo "int main (void) { return 0; }" > $@
native.o: native.c
$(CC) -o $@ $< -c -g
PWD:=$(shell pwd -P)
TEST_SRC = $(srcdir)/testsuite/dwz.tests
TEST_EXECS_DWARF_ASM = no-multifile-prop invalid-dw-at-stmt-list-encoding \
unavailable-dwarf-piece
TEST_EXECS_x86_64 = py-section-script dw2-skip-prologue \
implptr-64bit-d2o4a8r8t0 varval
TEST_EXECS = hello dwz-for-test min two-typedef start hello-gold-gdb-index \
start-gold hello-gnu-pubnames $(TEST_EXECS_DWARF_ASM) \
$(TEST_EXECS_$(UNAME)) odr-struct odr-class odr-union odr-struct-ns \
odr-class-ns odr-union-ns odr-loc def-decl cycle
UNAME:=$(shell uname -p)
hello:
$(CC) $(TEST_SRC)/hello.c -o $@ -g
hello-gnu-pubnames:
$(CC) $(TEST_SRC)/hello.c -o $@ -g -ggnu-pubnames || touch $@
dw2-skip-prologue:
$(CC) $(TEST_SRC)/dw2-skip-prologue.S $(TEST_SRC)/dw2-skip-prologue.c \
-DINLINED -DPTRBITS=64 -o $@ || touch $@
py-section-script:
$(CC) $(TEST_SRC)/py-section-script.s -o $@ -g || touch $@
DWZ_TEST_OBJECTS := $(patsubst %.o,%-for-test.o,$(OBJECTS))
dwz-for-test: $(DWZ_TEST_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
rm -f $(DWZ_TEST_OBJECTS)
args-for-test.o: CFLAGS_FOR_SOURCE = \
-DNATIVE_ENDIAN_VAL=$(NATIVE_ENDIAN_VAL) \
-DNATIVE_POINTER_SIZE=$(NATIVE_POINTER_SIZE)
$(DWZ_TEST_OBJECTS): %-for-test.o : %.c
$(CC) $< -o $@ -c \
-DUSE_GNUC=0 -DDEVEL \
-O2 -g \
$(CFLAGS_COMMON) \
-DDWZ_VERSION='"for-test"' \
$(CFLAGS_COPYRIGHT) \
$(CFLAGS_FOR_SOURCE)
min:
$(CC) $(TEST_SRC)/min.c $(TEST_SRC)/min-2.c -o $@ -g
two-typedef:
$(CC) $(TEST_SRC)/two-typedef.c $(TEST_SRC)/two-typedef-2.c \
-I $(TEST_SRC) -o $@ -g
start:
$(CC) $(TEST_SRC)/start.c -o $@ -g -nostdlib
start-gold:
$(CC) $(TEST_SRC)/start.c -fuse-ld=gold -o $@ -g -nostdlib || touch $@
implptr-64bit-d2o4a8r8t0:
$(CC) $(TEST_SRC)/implptr-64bit-d2o4a8r8t0.S $(TEST_SRC)/main.c \
-o $@ -g || touch $@
hello-gold-gdb-index:
$(CC) $(TEST_SRC)/hello.c -g -fuse-ld=gold -Wl,--gdb-index -o $@ \
|| touch $@
varval:
$(CC) $(TEST_SRC)/varval.c $(TEST_SRC)/varval.S -g -o $@ || touch $@
POINTER_SIZE:=$(shell $(CC) $(TEST_SRC)/pointer-size.c -o pointer-size; \
./pointer-size; \
rm -f ./pointer-size)
TEMP_ASM_FILES=$(addsuffix -dw.S, $(TEST_EXECS_DWARF_ASM))
.INTERMEDIATE: $(TEMP_ASM_FILES)
$(TEMP_ASM_FILES): %-dw.S: $(TEST_SRC)/../lib/%.exp
export POINTER_SIZE=$(POINTER_SIZE); \
export DEJAGNU=$(DEJAGNU); \
runtest --tool=dwz -srcdir $(srcdir)/testsuite/ lib/$*.exp
$(filter-out no-multifile-prop unavailable-dwarf-piece, $(TEST_EXECS_DWARF_ASM)): %: %-dw.S
$(CC) $(TEST_SRC)/main.c $< -o $@
# Fails to compile on riscv64: Error: non-constant .uleb128 is not supported.
no-multifile-prop unavailable-dwarf-piece: %: %-dw.S
$(CC) $(TEST_SRC)/main.c $< -o $@ || true
odr-struct:
$(CXX) $(TEST_SRC)/odr.cc $(TEST_SRC)/odr-2.cc -I$(TEST_SRC) -o $@ -g \
-DKIND=struct
odr-class:
$(CXX) $(TEST_SRC)/odr.cc $(TEST_SRC)/odr-2.cc -I$(TEST_SRC) -o $@ -g \
-DKIND=class
odr-union:
$(CXX) $(TEST_SRC)/odr.cc $(TEST_SRC)/odr-2.cc -I$(TEST_SRC) -o $@ -g \
-DKIND=union
odr-struct-ns:
$(CXX) $(TEST_SRC)/odr.cc $(TEST_SRC)/odr-2.cc -I$(TEST_SRC) -o $@ -g \
-DKIND=struct -DNAMESPACE=1
odr-class-ns:
$(CXX) $(TEST_SRC)/odr.cc $(TEST_SRC)/odr-2.cc -I$(TEST_SRC) -o $@ -g \
-DKIND=class -DNAMESPACE=1
odr-union-ns:
$(CXX) $(TEST_SRC)/odr.cc $(TEST_SRC)/odr-2.cc -I$(TEST_SRC) -o $@ -g \
-DKIND=union -DNAMESPACE=1
odr-loc:
$(CXX) $(TEST_SRC)/odr-loc.cc $(TEST_SRC)/odr-loc-2.cc -I$(TEST_SRC) \
-o $@ -g
def-decl:
$(CXX) $(TEST_SRC)/decl.cc $(TEST_SRC)/def.cc $(TEST_SRC)/def2.cc \
-I$(TEST_SRC) -o $@ -g
cycle:
$(CC) $(TEST_SRC)/cycle.c -o $@ -g
# On some systems we need to set and export DEJAGNU to suppress
# WARNING: Couldn't find the global config file.
DEJAGNU ?= /dev/null
VALGRIND_OPTIONS = -q --error-exitcode=99
check check-valgrind: dwz $(TEST_EXECS)
mkdir -p testsuite-bin
cd testsuite-bin; \
if [ "$@" = "check" ]; then \
ln -sf $(PWD)/dwz .; \
else \
echo "valgrind $(VALGRIND_OPTIONS) $(PWD)/dwz \"\$$@\"" > dwz; \
chmod +x dwz; \
fi
export DEJAGNU=$(DEJAGNU); \
export PATH=$(PWD)/testsuite-bin:$$PATH; export LC_ALL=C; \
runtest --tool=dwz -srcdir $(srcdir)/testsuite $(RUNTESTFLAGS)
rm -Rf testsuite-bin $(TEST_EXECS) $(DWZ_TEST_OBJECTS)

View File

@ -1,28 +0,0 @@
- Verify that copyright notices in source files are up-to-date.
- Update COPYRIGHT_YEARS using contrib/release/gen-copyright-years.sh.
Commit modifications if there are any.
- Run contrib/release/do-release.sh.
Use:
- --minor to do a minor update: $maj.$min -> $maj.$(($min + 1))
- --major to do a major update: $maj.$min -> $(($maj + 1)).0
This:
- adds a commit that updates the VERSION file,
- creates a signed annotated release tag for that commit, and
- pushes both the commit and the tag to the remote repository.
- Run contrib/release/upload-release.sh.
This creates and uploads two release tarballs.
- Write draft release announcement.
F.i. using template of
https://sourceware.org/ml/gdb-announce/2019/msg00001.html.
- Sent out draft release announcement to maintainers for review and
further contributions.
- Sent out release announcement. Sent to:
- Maintainers
- dwz@sourceware.org
- dwarf-discuss@lists.dwarfstd.org
- gcc@gcc.gnu.org
- gdb@sourceware.org
- lldb-dev@lists.llvm.org
- Update web page ( https://sourceware.org/dwz/ ):
- Add news item with hlink to release annoucement.
- Add entry in release list.

View File

@ -1 +0,0 @@
0.15

743
args.c
View File

@ -1,743 +0,0 @@
/* Copyright (C) 2001-2021 Red Hat, Inc.
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2019-2021 SUSE LLC.
Written by Jakub Jelinek <jakub@redhat.com>, 2012.
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, 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; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#include <assert.h>
#include <getopt.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <error.h>
#include <gelf.h>
#include <sys/sysinfo.h>
#include "args.h"
#include "util.h"
#if DEVEL
int tracing;
int ignore_size;
int ignore_locus;
int dump_checksum_p;
int dump_dies_p;
int dump_dups_p;
int dump_pus_p;
int verify_dups_p;
int verify_edge_freelist;
int stats_p;
int checksum_cycle_opt = 1;
int skip_producers_p;
#endif
int unoptimized_multifile;
int save_temps;
int verify_edges_p;
int dump_edges_p;
int partition_dups_opt;
int progress_p;
int progress_mem_p;
int import_opt_p = 1;
int force_p;
int max_forks = -1;
enum deduplication_mode deduplication_mode = dm_inter_cu;
int uni_lang_p = 0;
int gen_cu_p = 0;
enum die_count_methods die_count_method = estimate;
int odr = 0;
enum odr_mode odr_mode = ODR_LINK;
/* Filename if inter-file size optimization should be performed. */
const char *multifile;
/* Argument of -M option, i.e. preferred name that should be stored
into the .gnu_debugaltlink or .debug_sup section. */
const char *multifile_name;
/* True if -r option is present, i.e. .gnu_debugaltlink or .debug_sup section
should contain a filename relative to the directory in which
the particular file is present. */
bool multifile_relative;
/* Pointer size of multifile. */
int multifile_force_ptr_size;
/* Endianity of multifile. */
int multifile_force_endian;
/* True if DWARF 5 .debug_sup and DW_FORM_ref_sup4 / DW_FORM_strp_sup
should be used instead of the GNU extensions .gnu_debugaltlink
and DW_FORM_GNU_ref_alt / DW_FORM_GNU_strp_alt etc. */
bool dwarf_5;
/* True if -q option has been passed. */
bool quiet;
/* Number of DIEs, above which dwz retries processing
in low_mem mode (and give up on multifile optimizing
the file in question). */
unsigned int low_mem_die_limit = 10000000;
/* Number of DIEs, above which dwz gives up processing
input altogether. */
unsigned int max_die_limit = 50000000;
/* Phase of multifile handling. */
unsigned char multifile_mode;
static int die_count_method_parsed;
static int deduplication_mode_parsed;
static int odr_mode_parsed;
static int skip_producer_parsed;
/* Options for getopt_long. */
static struct option dwz_options[] =
{
{ "help", no_argument, 0, '?' },
{ "output", required_argument, 0, 'o' },
{ "multifile", required_argument, 0, 'm' },
{ "quiet", no_argument, 0, 'q' },
{ "hardlink", no_argument, 0, 'h' },
{ "low-mem-die-limit", required_argument, 0, 'l' },
{ "max-die-limit", required_argument, 0, 'L' },
{ "multifile-name", required_argument, 0, 'M' },
{ "relative", no_argument, 0, 'r' },
{ "version", no_argument, 0, 'v' },
{ "import-optimize",
no_argument, &import_opt_p, 1 },
{ "no-import-optimize",
no_argument, &import_opt_p, 0 },
{ "dwarf-5", no_argument, 0, '5' },
#if DEVEL
{ "devel-trace", no_argument, &tracing, 1 },
{ "devel-progress", no_argument, &progress_p, 1 },
{ "devel-progress-mem",no_argument, &progress_mem_p, 1 },
{ "devel-ignore-size", no_argument, &ignore_size, 1 },
{ "devel-ignore-locus",no_argument, &ignore_locus, 1 },
{ "devel-force", no_argument, &force_p, 1 },
{ "devel-save-temps", no_argument, &save_temps, 1 },
{ "devel-dump-checksum",
no_argument, &dump_checksum_p, 1 },
{ "devel-dump-dies", no_argument, &dump_dies_p, 1 },
{ "devel-dump-dups", no_argument, &dump_dups_p, 1 },
{ "devel-dump-pus", no_argument, &dump_pus_p, 1 },
{ "devel-unoptimized-multifile",
no_argument, &unoptimized_multifile, 1 },
{ "devel-verify-edges",no_argument, &verify_edges_p, 1 },
{ "devel-verify-dups", no_argument, &verify_dups_p, 1 },
{ "devel-dump-edges", no_argument, &dump_edges_p, 1 },
{ "devel-partition-dups-opt",
no_argument, &partition_dups_opt, 1 },
{ "devel-die-count-method",
required_argument, &die_count_method_parsed, 1 },
{ "devel-stats", no_argument, &stats_p, 1 },
{ "devel-deduplication-mode",
required_argument, &deduplication_mode_parsed, 1 },
{ "devel-uni-lang",
no_argument, &uni_lang_p, 1 },
{ "devel-no-uni-lang",
no_argument, &uni_lang_p, 0 },
{ "devel-gen-cu",
no_argument, &gen_cu_p, 1 },
{ "devel-no-gen-cu",
no_argument, &gen_cu_p, 0 },
{ "devel-checksum-cycle-opt",
no_argument, &checksum_cycle_opt, 1 },
{ "devel-no-checksum-cycle-opt",
no_argument, &checksum_cycle_opt, 0 },
{ "devel-skip-producer",
required_argument, &skip_producer_parsed, 1},
#endif
{ "odr", no_argument, &odr, 1 },
{ "no-odr", no_argument, &odr, 0 },
{ "odr-mode", required_argument, &odr_mode_parsed, 1 },
{ "multifile-pointer-size",
required_argument, 0, 'p' },
{ "multifile-endian",
required_argument, 0, 'e' },
{ "jobs", required_argument, 0, 'j' },
{ NULL, no_argument, 0, 0 }
};
/* Struct describing various usage aspects of a command line option. */
struct option_help
{
const char *short_name;
const char *long_name;
const char *argument;
const char *default_value;
const char *msg;
};
/* Describe common command line options. */
static struct option_help dwz_common_options_help[] =
{
{ "q", "quiet", NULL, NULL,
"Silence up the most common messages." },
{ "l", "low-mem-die-limit", "<COUNT|none>", "10 million DIEs",
"Handle files larger than this limit using a slower and more memory"
" usage friendly mode and don't optimize those files in multifile mode." },
{ "L", "max-die-limit", "<COUNT|none>", "50 million DIEs",
"Don't optimize files larger than this limit." },
{ NULL, "odr", NULL, NULL,
NULL },
{ NULL, "no-odr", NULL, "Disabled",
"Enable/disable one definition rule optimization." },
{ NULL, "odr-mode", "<basic|link>", "link",
"Set aggressiveness level of one definition rule optimization." },
{ NULL, "import-optimize", NULL, NULL,
NULL },
{ NULL, "no-import-optimize", NULL, "Enabled",
"Enable/disable optimization that reduces the number of"
" DW_TAG_imported_unit DIEs." }
};
/* Describe single-file command line options. */
static struct option_help dwz_single_file_options_help[] =
{
{ "o", "output", "OUTFILE", NULL,
"Place the output in OUTFILE." }
};
#if NATIVE_ENDIAN_VAL == ELFDATA2MSB
#define NATIVE_ENDIAN "big"
#elif NATIVE_ENDIAN_VAL == ELFDATA2LSB
#define NATIVE_ENDIAN "little"
#else
#define NATIVE_ENDIAN "not available"
#endif
/* Describe mult-file command line options. */
static struct option_help dwz_multi_file_options_help[] =
{
{ "h", "hardlink", NULL, NULL,
"Handle hardlinked files as one file." },
{ "m", "multifile", "COMMONFILE", NULL,
"Enable multifile optimization, placing common DIEs in multifile"
" COMMONFILE." },
{ "M", "multifile-name", "NAME", NULL,
"Set .gnu_debugaltlink or .debug_sup in files to NAME." },
{ "r", "relative", NULL, NULL,
"Set .gnu_debugaltlink in files to relative path from file directory"
" to multifile." },
{ "5", "dwarf-5", NULL, NULL,
"Emit DWARF 5 standardized supplementary object files instead of"
" GNU extension .debug_altlink." },
{ "p", "multifile-pointer-size", "<SIZE|auto|native>", "auto",
"Set pointer size of multifile, in number of bytes."
" Native pointer size is " XSTR (NATIVE_POINTER_SIZE) "." },
{ "e", "multifile-endian", "<l|b|auto|native>", "auto",
"Set endianity of multifile."
" Native endianity is " NATIVE_ENDIAN "." },
{ "j", "jobs", "<n>", "number of processors / 2",
"Process <n> files in parallel." }
};
/* Describe misc command line options. */
static struct option_help dwz_misc_options_help[] =
{
{ "v", "version", NULL, NULL,
"Display dwz version information." },
{ "?", "help", NULL, NULL,
"Display this information." }
};
/* Print LEN spaces to STREAM. */
static void
do_indent (FILE *stream, unsigned int len)
{
unsigned int i;
for (i = 0; i < len; i++)
fprintf (stream, " ");
}
/* Print MSG to STREAM, indenting to INDENT and wrapping at LIMIT.
Assume starting position is at INDENT. */
static void
wrap (FILE *stream, unsigned int indent, unsigned int limit, const char *msg)
{
unsigned int len = indent;
const char *s = msg;
while (true)
{
const char *e = strchr (s, ' ');
unsigned int word_len;
if (e == NULL)
word_len = strlen (s);
else
word_len = e - s;
if (word_len == 0)
return;
if (len + 1 /* space */ + word_len > limit)
{
fprintf (stream, "\n");
do_indent (stream ,indent);
len = indent;
}
else if (len > indent)
{
fprintf (stream, " ");
len += 1;
}
if (e != NULL)
{
const char *i;
for (i = s; i < e; ++i)
fprintf (stream, "%c", *i);
}
else
fprintf (stream, "%s", s);
len += word_len;
if (e == NULL)
break;
s = e + 1;
}
}
/* Print OPTIONS_HELP of length H to STREAM, indenting to help message to
INDENT an wrapping at LIMIT. */
static void
print_options_help (FILE *stream, struct option_help *options_help, unsigned int n,
unsigned int indent, unsigned int limit)
{
unsigned len;
const char *s;
unsigned int i;
for (i = 0; i < n; ++i)
{
len = 0;
fprintf (stream, " ");
len += 2;
s = options_help[i].short_name;
if (s)
{
fprintf (stream, "-%s", s);
len += 2;
}
s = options_help[i].long_name;
if (len == 4)
{
fprintf (stream, ", ");
len += 2;
}
fprintf (stream, "--%s", s);
len += 2 + strlen (s);
s = options_help[i].argument;
if (s)
{
fprintf (stream, " %s", s);
len += 1 + strlen (s);
}
s = options_help[i].msg;
if (s)
{
assert (IMPLIES (strlen (s) > 0, s[strlen (s) - 1] == '.'));
if (len > indent)
{
fprintf (stream, "\n");
do_indent (stream, indent);
}
else
do_indent (stream, indent - len);
len = indent;
wrap (stream, indent, limit, s);
}
fprintf (stream, "\n");
s = options_help[i].default_value;
if (s)
{
do_indent (stream, indent);
fprintf (stream, "Default value: %s.\n", s);
}
}
}
/* Print usage and exit. */
static void
usage (int failing)
{
unsigned int n, i;
unsigned int indent, limit;
FILE *stream = failing ? stderr : stdout;
const char *header_lines[] = {
"dwz [common options] [-h] [-m COMMONFILE] [-M NAME | -r] [-5]",
" [-p <SIZE|auto|native>] [-e <l|b|auto|native>] [-j N] [FILES]",
"dwz [common options] -o OUTFILE FILE",
"dwz [ -v | -? ]"
};
unsigned int nr_header_lines
= sizeof (header_lines) / sizeof (*header_lines);
fprintf (stream, "Usage:\n");
for (i = 0; i < nr_header_lines; ++i)
fprintf (stream, " %s\n", header_lines[i]);
indent = 30;
limit = 80;
fprintf (stream, "Common options:\n");
n = (sizeof (dwz_common_options_help)
/ sizeof (dwz_common_options_help[0]));
print_options_help (stream, dwz_common_options_help, n, indent, limit);
fprintf (stream, "Single-file options:\n");
n = (sizeof (dwz_single_file_options_help)
/ sizeof (dwz_single_file_options_help[0]));
print_options_help (stream, dwz_single_file_options_help, n, indent, limit);
fprintf (stream, "Multi-file options:\n");
n = (sizeof (dwz_multi_file_options_help)
/ sizeof (dwz_multi_file_options_help[0]));
print_options_help (stream, dwz_multi_file_options_help, n, indent, limit);
fprintf (stream, "Miscellaneous options:\n");
n = (sizeof (dwz_misc_options_help)
/ sizeof (dwz_misc_options_help[0]));
print_options_help (stream, dwz_misc_options_help, n, indent, limit);
#if DEVEL
fprintf (stream, "Development options:\n");
fprintf (stream, "%s",
(" --devel-trace\n"
" --devel-progress\n"
" --devel-progress-mem\n"
" --devel-stats\n"
" --devel-ignore-size\n"
" --devel-ignore-locus\n"
" --devel-force\n"
" --devel-save-temps\n"
" --devel-dump-checksum\n"
" --devel-dump-dies\n"
" --devel-dump-dups\n"
" --devel-dump-pus\n"
" --devel-unoptimized-multifile\n"
" --devel-verify-dups\n"
" --devel-verify-edges\n"
" --devel-dump-edges\n"
" --devel-partition-dups-opt\n"
" --devel-die-count-method\n"
" --devel-deduplication-mode={none,intra-cu,inter-cu}\n"
" --devel-uni-lang / --devel-no-uni-lang\n"
" --devel-gen-cu / --devel-no-gen-cu\n"
" --devel-skip-producer <producer>\n"));
#endif
exit (failing);
}
/* Print version and exit. */
static void
version (void)
{
printf ("dwz version " DWZ_VERSION "\n"
"Copyright (C) " RH_YEARS " Red Hat, Inc.\n"
"Copyright (C) " FSF_YEARS " Free Software Foundation, Inc.\n"
"Copyright (C) " SUSE_YEARS " SUSE LLC.\n"
"This program is free software; you may redistribute it under the terms of\n"
"the GNU General Public License version 3 or (at your option) any later version.\n"
"This program has absolutely no warranty.\n");
exit (0);
}
static const char **skip_producers;
static size_t skip_producers_size;
static size_t nr_skip_producers;
static void
add_skip_producer (const char *producer)
{
size_t alloc_size;
if (skip_producers == NULL)
{
skip_producers_size = 10;
alloc_size = skip_producers_size * sizeof (const char *);
skip_producers = malloc (alloc_size);
}
else if (nr_skip_producers == skip_producers_size)
{
skip_producers_size += 10;
alloc_size = skip_producers_size * sizeof (const char *);
skip_producers = realloc (skip_producers, alloc_size);
}
skip_producers[nr_skip_producers] = producer;
nr_skip_producers++;
}
bool
skip_producer (const char *producer)
{
size_t i;
if (producer == NULL)
return false;
for (i = 0; i < nr_skip_producers; ++i)
{
const char *skip = skip_producers[i];
if (strncmp (skip, producer, strlen (skip)) == 0)
return true;
}
return false;
}
/* Parse command line arguments in ARGV. */
void
parse_args (int argc, char *argv[], bool *hardlink, const char **outfile)
{
unsigned long l;
char *end;
while (1)
{
int option_index = -1;
int c = getopt_long (argc, argv, "m:o:qhl:L:M:r?v5p:e:j:", dwz_options,
&option_index);
if (c == -1)
break;
switch (c)
{
default:
case '?':
usage (option_index == -1);
break;
case 0:
/* Option handled by getopt_long. */
if (die_count_method_parsed)
{
die_count_method_parsed = 0;
if (strcmp (optarg, "none") == 0)
{
die_count_method = none;
break;
}
if (strcmp (optarg, "estimate") == 0)
{
die_count_method = estimate;
break;
}
error (1, 0, "invalid argument --devel-die-count-method %s",
optarg);
}
if (deduplication_mode_parsed)
{
deduplication_mode_parsed = 0;
if (strcmp (optarg, "none") == 0)
{
deduplication_mode = dm_none;
break;
}
if (strcmp (optarg, "intra-cu") == 0)
{
deduplication_mode = dm_intra_cu;
break;
}
if (strcmp (optarg, "inter-cu") == 0)
{
deduplication_mode = dm_inter_cu;
break;
}
error (1, 0, "invalid argument --devel-deduplication-mode %s",
optarg);
}
if (odr_mode_parsed)
{
odr_mode_parsed = 0;
if (strcmp (optarg, "basic") == 0)
{
odr_mode = ODR_BASIC;
break;
}
if (strcmp (optarg, "link") == 0)
{
odr_mode = ODR_LINK;
break;
}
error (1, 0, "invalid argument --odr-mode %s",
optarg);
}
if (skip_producer_parsed)
{
skip_producer_parsed = 0;
add_skip_producer (optarg);
#if DEVEL
skip_producers_p = 1;
#endif
}
break;
case 'o':
*outfile = optarg;
break;
case 'm':
multifile = optarg;
break;
case 'q':
quiet = true;
break;
case 'h':
*hardlink = true;
break;
case 'M':
multifile_name = optarg;
break;
case 'r':
multifile_relative = true;
break;
case 'l':
if (strcmp (optarg, "none") == 0)
{
low_mem_die_limit = -1U;
break;
}
l = strtoul (optarg, &end, 0);
if (*end != '\0' || optarg == end || (unsigned int) l != l)
error (1, 0, "invalid argument -l %s", optarg);
low_mem_die_limit = l;
break;
case 'L':
if (strcmp (optarg, "none") == 0)
{
max_die_limit = -1U;
break;
}
l = strtoul (optarg, &end, 0);
if (*end != '\0' || optarg == end || (unsigned int) l != l)
error (1, 0, "invalid argument -L %s", optarg);
max_die_limit = l;
break;
case '5':
dwarf_5 = true;
break;
case 'p':
if (strcmp (optarg, "auto") == 0)
{
multifile_force_ptr_size = 0;
break;
}
if (strcmp (optarg, "native") == 0)
{
multifile_force_ptr_size = NATIVE_POINTER_SIZE;
break;
}
l = strtoul (optarg, &end, 0);
if (*end != '\0' || optarg == end || (unsigned int) l != l)
error (1, 0, "invalid argument -l %s", optarg);
multifile_force_ptr_size = l;
break;
case 'e':
if (strcmp (optarg, "auto") == 0)
{
multifile_force_endian = 0;
break;
}
if (strcmp (optarg, "native") == 0)
{
switch (NATIVE_ENDIAN_VAL)
{
case ELFDATA2MSB:
case ELFDATA2LSB:
multifile_force_endian = NATIVE_ENDIAN_VAL;
break;
default:
error (1, 0, "Cannot determine native endian");
}
break;
}
if (strlen (optarg) != 1)
error (1, 0, "invalid argument -l %s", optarg);
switch (optarg[0])
{
case 'l':
case 'L':
multifile_force_endian = ELFDATA2LSB;
break;
case 'b':
case 'B':
multifile_force_endian = ELFDATA2MSB;
break;
default:
error (1, 0, "invalid argument -l %s", optarg);
}
break;
case 'v':
version ();
break;
case 'j':
l = strtoul (optarg, &end, 0);
if (*end != '\0' || optarg == end || (unsigned int) l != l)
error (1, 0, "invalid argument -j %s", optarg);
max_forks = l;
break;
}
}
if (progress_mem_p)
progress_p = 1;
/* Specifying a low-mem die-limit that is larger than or equal to the
max die-limit has the effect of disabling low-mem mode. Make this
explicit by setting it to the 'none' value. */
if (low_mem_die_limit != -1U
&& low_mem_die_limit >= max_die_limit)
low_mem_die_limit = -1U;
if (multifile_relative && multifile_name)
error (1, 0, "-M and -r options can't be specified together");
if (max_forks == -1)
{
long nprocs = get_nprocs ();
/* Be conservative on max forks: 4 procs may be actually be 4 SMT
threads with only 2 cores. */
max_forks = nprocs / 2;
}
}

97
args.h
View File

@ -1,97 +0,0 @@
/* Copyright (C) 2001-2021 Red Hat, Inc.
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2019-2021 SUSE LLC.
Written by Jakub Jelinek <jakub@redhat.com>, 2012.
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, 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; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#if DEVEL
extern int tracing;
extern int ignore_size;
extern int ignore_locus;
extern int dump_checksum_p;
extern int dump_dies_p;
extern int dump_dups_p;
extern int dump_pus_p;
extern int verify_dups_p;
extern int verify_edge_freelist;
extern int stats_p;
extern int checksum_cycle_opt;
extern int skip_producers_p;
#else
#define tracing 0
#define ignore_size 0
#define ignore_locus 0
#define dump_checksum_p 0
#define dump_dies_p 0
#define dump_dups_p 0
#define dump_pus_p 0
#define verify_dups_p 0
#define stats_p 0
#define checksum_cycle_opt 1
#define skip_producers_p 0
#endif
extern int unoptimized_multifile;
extern int save_temps;
extern int verify_edges_p;
extern int dump_edges_p;
extern int partition_dups_opt;
extern int progress_p;
extern int progress_mem_p;
extern int import_opt_p;
extern int force_p;
extern int max_forks;
enum deduplication_mode
{
dm_none,
dm_intra_cu,
dm_inter_cu
};
extern enum deduplication_mode deduplication_mode;
extern int uni_lang_p;
extern int gen_cu_p;
enum die_count_methods
{
none,
estimate
};
extern enum die_count_methods die_count_method;
extern int odr;
enum odr_mode { ODR_BASIC, ODR_LINK };
extern enum odr_mode odr_mode;
extern const char *multifile;
extern const char *multifile_name;
extern bool multifile_relative;
extern int multifile_force_ptr_size;
extern int multifile_force_endian;
extern unsigned char multifile_mode;
extern bool dwarf_5;
extern bool quiet;
extern unsigned int low_mem_die_limit;
extern unsigned int max_die_limit;
extern void parse_args (int, char *[], bool *, const char **);
extern bool skip_producer (const char *producer);

18
configure vendored
View File

@ -1,18 +0,0 @@
#!/bin/sh
srcdir=$(cd $(dirname $0); pwd -P)
if [ "$srcdir" = "$(pwd -P)" ]; then
# We're not in a separate build dir, but in the source dir, we already
# have a Makefile.
exit 0
fi
cat > Makefile <<EOF
srcdir:=$srcdir
default:
\$(MAKE) -f \$(srcdir)/Makefile srcdir=\$(srcdir)
%:
\$(MAKE) -f \$(srcdir)/Makefile srcdir=\$(srcdir) \$*
EOF

View File

@ -1,16 +0,0 @@
#!/bin/bash
f="$1"
size=$(readelf -WS "$f" \
| grep -E "[ \t]\.debug_info" \
| sed 's/.*\.debug_info//' \
| awk '{print $4}')
size=$((16#$size))
nr_dies=$(readelf -wi "$f" \
| grep -c ': Abbrev Number.*(DW_TAG')
res=$(echo "scale=2; $size / $nr_dies" \
| bc)
echo -e "$res\tsize: $size\tnr_dies: $nr_dies"

View File

@ -1,28 +0,0 @@
#!/bin/sh
outputfile=dwz.debug_all
echo "
int
main (void)
{
return 0;
}
" \
| gcc -x c - -c -o $outputfile
sections="
debug_abbrev
debug_info
debug_line
debug_macro
debug_str
"
for section in $sections; do
file=dwz.$section
objcopy \
--add-section .$section=$file \
$outputfile
done

View File

@ -1,27 +0,0 @@
BEGIN {
start=0
}
/Copyright \(C\).*[.]/ {
print
next
}
/Copyright \(C\)/ {
start=1
printf $0
next
}
/[.]/ {
if (start == 0)
next
print
start=0
}
// {
if (start == 0)
next
printf $0
}

View File

@ -1,67 +0,0 @@
#!/bin/sh
set -e
do_minor=false
do_major=false
while [ $# -gt 0 ]; do
case "$1" in
--minor)
do_minor=true
;;
--major)
do_major=true
;;
*)
echo "Unknown option: $1"
exit 1
esac
shift
done
if $do_minor && $do_major; then
echo "Can only bump minor or major, not both"
exit 1
fi
if ! $do_minor && ! $do_major; then
echo "Need to bump minor or major"
exit 1
fi
git checkout master
version=$(cat VERSION)
minor=$(echo $version \
| sed 's/.*\.//')
major=$(echo $version \
| sed 's/\..*//')
echo Current version: major: $major, minor: $minor
if $do_minor; then
echo "Bumping minor version"
minor=$(($minor + 1))
elif $do_major; then
echo "Bumping major version"
major=$(($major + 1))
minor=0
fi
echo Bumped version: major: $major, minor: $minor
version=$major.$minor
set +x
echo $version > VERSION
git add VERSION
git commit -m "Bump version to $version"
git push origin master:master
git tag -s -m "dwz $version release" dwz-$version
git push origin dwz-$version

View File

@ -1,164 +0,0 @@
#!/bin/bash
this=$(basename $0)
max ()
{
local a
a=$1
local b
b=$2
if [ "$a" = "" ]; then
echo "$b"
return
elif [ "$b" = "" ]; then
echo "$a"
return
fi
if [ $a -gt $b ]; then
echo "$a"
else
echo "$b"
fi
}
min ()
{
local a
a="$1"
local b
b="$2"
if [ "$a" = "" ]; then
echo "$b"
return
elif [ "$b" = "" ]; then
echo "$a"
return
fi
if [ $a -lt $b ]; then
echo "$a"
else
echo "$b"
fi
}
print_range () {
local a
a="$1"
local b
b="$2"
if [ "$a" = "$b" ]; then
echo "$a"
return
fi
echo "$a-$b"
}
process_line ()
{
local line
line="$1"
fsf=false
rh=false
suse=false;
if echo "$line" \
| grep -q "Free Software Foundation, Inc\."; then
fsf=true
who=fsf
line=$(echo "$line" \
| sed 's/Free Software Foundation, Inc\.//')
elif echo "$line" \
| grep -q "Red Hat, Inc\."; then
rh=true
who=rh
line=$(echo "$line" \
| sed 's/Red Hat, Inc\.//')
elif echo "$line" \
| grep -q "SUSE LLC\."; then
suse=true
who=suse
line=$(echo "$line" \
| sed 's/SUSE LLC\.//')
else
echo "error: unknown copyright: $line"
exit 1
fi
line=$(echo "$line" \
| sed 's/[,-]/ /g')
max_year=$(echo "$line" \
| sed 's/ /\n/g' \
| grep -v '^$' \
| sort -n -r \
| head -n 1)
min_year=$(echo "$line" \
| sed 's/ /\n/g' \
| grep -v '^$' \
| sort -n \
| head -n 1)
if $fsf; then
fsf_max=$(max "$fsf_max" "$max_year")
fsf_min=$(min "$fsf_min" "$min_year")
elif $rh; then
rh_max=$(max "$rh_max" "$max_year")
rh_min=$(min "$rh_min" "$min_year")
elif $suse; then
suse_max=$(max "$suse_max" "$max_year")
suse_min=$(min "$suse_min" "$min_year")
fi
}
main ()
{
if ! git status --ignored 2>&1 \
| grep -q "nothing to commit, working tree clean"; then
echo "Git tree not clean"
exit 1
fi
local tmp
tmp=$(mktemp)
for f in *.c *.h *.def; do
if test "$f" = "native.c"; then continue; fi
if ! grep -q "Copyright (C)" $f; then
echo "error: found file without copyright marker: $f"
exit 1
fi
echo processing file: $f
grep -v '"' $f \
| awk -f contrib/release/copyright-lines.awk \
> $tmp
while read line; do
line=$(echo "$line" \
| sed 's/ */ /g')
line=$(echo "$line" \
| sed 's/.*Copyright (C) *//')
echo "Processing line: $line"
process_line "$line"
done < $tmp
done
rm -f $tmp
echo "-DFSF_YEARS='\"$(print_range $fsf_min $fsf_max)\"'" \
> COPYRIGHT_YEARS
echo "-DRH_YEARS='\"$(print_range $rh_min $rh_max)\"'" \
>> COPYRIGHT_YEARS
echo "-DSUSE_YEARS='\"$(print_range $suse_min $suse_max)\"'" \
>> COPYRIGHT_YEARS
}
main "$@"

View File

@ -1,67 +0,0 @@
#!/bin/sh -x
set -e
pwd=$(pwd -P)
version=$(cat VERSION)
tag=dwz-$version
rootdir=dwz
tarfile=dwz-$version.tar
server=sourceware.org
ftpdir=/sourceware/ftp/pub/dwz/releases
# The server itself seems to add a sha512.sum file, so lets not duplicate that
# effort.
#checksums="md5sum sha512sum"
checksums="md5sum"
repo="$pwd"
dir=$(mktemp -d)
cd $dir
git clone \
$repo \
$rootdir
cd $dir/$rootdir
git ch $tag
rm -Rf .git
cd $dir
tar cvf \
$tarfile \
$rootdir
xz \
--best \
-k \
$tarfile
gzip \
--best \
-k \
$tarfile
files=$(echo $tarfile.*)
[ "$files" != "" ]
ssh $server \
"mkdir -p $ftpdir"
scp \
$files \
"$server:$ftpdir"
ssh $server \
"cd $ftpdir && chmod 644 $files"
for checksum in $checksums; do
ssh $server \
"cd $ftpdir && touch $checksum && chmod 644 $checksum && ( $checksum $files >> $checksum )"
done
rm -Rf $dir

View File

@ -1,8 +0,0 @@
dwz for Debian
Please edit this to provide information specific to
this dwz Debian package.
(Automatically generated by debmake Version 4.3.1)
-- Lu zhiping <luzhiping@kylinos.cn> Thu, 25 Aug 2022 17:22:52 +0800

7
debian/changelog vendored
View File

@ -1,7 +0,0 @@
dwz (0.15-1ok1) yangtze; urgency=medium
* Rebuild for openkylin
-- zhangyuan <zhangyuan@kylinos.cn> Mon, 26 Dec 2022 11:45:14 +0100

1
debian/compat vendored
View File

@ -1 +0,0 @@
13

20
debian/control vendored
View File

@ -1,20 +0,0 @@
Source: dwz
Section: devel
Priority: optional
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Uploaders: Matthias Klose <doko@debian.org>
Build-Depends: debhelper (>= 13),
libelf-dev,
libxxhash-dev,
dejagnu <!nocheck>,
elfutils <!nocheck>,
gdb <!nocheck>,
Standards-Version: 4.6.1
Homepage: https://www.sourceware.org/dwz/
Package: dwz
Architecture: any
Multi-Arch: foreign
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: DWARF compression tool
DWARF optimizer and duplication removal utility.

126
debian/copyright vendored
View File

@ -1,126 +0,0 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: dwz
Source: http://sourceware.org/git/?p=dwz.git;a=summary
Files: *
Copyright: Copyright (C) 2001-2012 Red Hat, Inc.
Copyright (C) 2003 Free Software Foundation, Inc.
License: GPL-2+
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, 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.
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Files: dwarf2.*
Copyright: Gary Funck <gary@intrepid.com>
Copyright (C) 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
License: GPL-3+
This file is part of GCC.
.
GCC 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, or (at your option) any later
version.
.
GCC 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.
.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
Files: dwarfnames.c
Copyright: Copyright (C) 2012 Free Software Foundation, Inc.
License: GPL-2+
This file is part of GNU CC.
.
GNU CC 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, or (at your option)
any later version.
.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combined
executable.)
.
GNU CC 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.
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Files: hashtab.*
Copyright: Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
Free Software Foundation, Inc.
License: LGPL-2+
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
.
Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
.
On Debian systems, the complete text of the GNU Library General
Public License version 2 can be found in "/usr/share/common-licenses/LGPL-2".
Files: sha1.*
Copyright: Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2008
Free Software Foundation, Inc.
License: GPL-2+
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, 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.
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Files: debian/*
Copyright: 2012 Matthias Klose <doko@debian.org>
License: GPL-2+
This package 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 package 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/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

1
debian/files vendored
View File

@ -1 +0,0 @@
dwz_0.15-1ok1_source.buildinfo devel optional

View File

@ -1,2 +0,0 @@
git diff bc8f69b695fea7456a43c81e7fcb656eac4d60bb c6e0e3874442401ba5fa1bfa6a563e44f7306ffe

View File

@ -1,2 +0,0 @@
# empty
#git-updates.diff

25
debian/rules vendored
View File

@ -1,25 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
#DEB_BUILD_OPTIONS := $(DEB_BUILD_OPTIONS) nostrip noopt
#export DEB_BUILD_OPTIONS
CFLAGS := $(shell dpkg-buildflags --get CPPFLAGS; dpkg-buildflags --get CFLAGS)
LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
%:
dh $@ --parallel --buildsystem=makefile --builddirectory=build
override_dh_auto_configure:
rm -rf build
mkdir build
cd build && ../configure
override_dh_auto_build:
dh_auto_build -- CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
override_dh_auto_test:
-dh_auto_test

View File

@ -1 +0,0 @@
3.0 (native)

2
debian/watch vendored
View File

@ -1,2 +0,0 @@
version=3
http://sourceware.org/git/?p=dwz.git;a=summary .*h=refs/tags/dwz-(\d.*)

View File

@ -1,818 +0,0 @@
/* -*- c -*-
Declarations and definitions of codes relating to the DWARF2 and
DWARF3 symbolic debugging information formats.
Copyright (C) 1992-2021 Free Software Foundation, Inc.
Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
Office (AJPO), Florida State University and Silicon Graphics Inc.
provided support for this effort -- June 21, 1995.
Derived from the DWARF 1 implementation written by Ron Guilmette
(rfg@netcom.com), November 1990.
This file is part of GCC.
GCC 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, or (at your option) any later
version.
GCC 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This file is derived from the DWARF specification (a public document)
Revision 2.0.0 (July 27, 1993) developed by the UNIX International
Programming Languages Special Interest Group (UI/PLSIG) and distributed
by UNIX International. Copies of this specification are available from
UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
This file also now contains definitions from the DWARF 3 specification
published Dec 20, 2005, available from: http://dwarf.freestandards.org.
This file also now contains definitions from the DWARF 4
specification, available from: http://dwarfstd.org/ */
/* This file declares various DWARF-related constants using a set of
macros which can be redefined by the including file.
The macros are in sections. Each section corresponds to a single
set of DWARF constants and has a corresponding key. The key is
used in all the macro names.
The sections are TAG (for DW_TAG_ constants), FORM (DW_FORM_), AT
(DW_AT_), OP (DW_OP_), ATE (DW_ATE_), and CFA (DW_CFA_).
Using TAG as an example, the following macros may be used for each
key:
DW_FIRST_TAG(name, value) - Introduce the first DW_TAG constant.
DW_TAG(name, value) - Define a subsequent constant.
DW_TAG_DUP(name, value) - Define a subsequent constant whose value
is a duplicate of some other constant. Not all keys use the _DUP
macro form. If more than one name shares a value, then the base
(DW_TAG) form will be the preferred name and DW_TAG_DUP will hold
any alternate names.
DW_END_TAG - Invoked at the end of the DW_TAG constants. */
DW_FIRST_TAG (DW_TAG_padding, 0x00)
DW_TAG (DW_TAG_array_type, 0x01)
DW_TAG (DW_TAG_class_type, 0x02)
DW_TAG (DW_TAG_entry_point, 0x03)
DW_TAG (DW_TAG_enumeration_type, 0x04)
DW_TAG (DW_TAG_formal_parameter, 0x05)
DW_TAG (DW_TAG_imported_declaration, 0x08)
DW_TAG (DW_TAG_label, 0x0a)
DW_TAG (DW_TAG_lexical_block, 0x0b)
DW_TAG (DW_TAG_member, 0x0d)
DW_TAG (DW_TAG_pointer_type, 0x0f)
DW_TAG (DW_TAG_reference_type, 0x10)
DW_TAG (DW_TAG_compile_unit, 0x11)
DW_TAG (DW_TAG_string_type, 0x12)
DW_TAG (DW_TAG_structure_type, 0x13)
DW_TAG (DW_TAG_subroutine_type, 0x15)
DW_TAG (DW_TAG_typedef, 0x16)
DW_TAG (DW_TAG_union_type, 0x17)
DW_TAG (DW_TAG_unspecified_parameters, 0x18)
DW_TAG (DW_TAG_variant, 0x19)
DW_TAG (DW_TAG_common_block, 0x1a)
DW_TAG (DW_TAG_common_inclusion, 0x1b)
DW_TAG (DW_TAG_inheritance, 0x1c)
DW_TAG (DW_TAG_inlined_subroutine, 0x1d)
DW_TAG (DW_TAG_module, 0x1e)
DW_TAG (DW_TAG_ptr_to_member_type, 0x1f)
DW_TAG (DW_TAG_set_type, 0x20)
DW_TAG (DW_TAG_subrange_type, 0x21)
DW_TAG (DW_TAG_with_stmt, 0x22)
DW_TAG (DW_TAG_access_declaration, 0x23)
DW_TAG (DW_TAG_base_type, 0x24)
DW_TAG (DW_TAG_catch_block, 0x25)
DW_TAG (DW_TAG_const_type, 0x26)
DW_TAG (DW_TAG_constant, 0x27)
DW_TAG (DW_TAG_enumerator, 0x28)
DW_TAG (DW_TAG_file_type, 0x29)
DW_TAG (DW_TAG_friend, 0x2a)
DW_TAG (DW_TAG_namelist, 0x2b)
DW_TAG (DW_TAG_namelist_item, 0x2c)
DW_TAG (DW_TAG_packed_type, 0x2d)
DW_TAG (DW_TAG_subprogram, 0x2e)
DW_TAG (DW_TAG_template_type_param, 0x2f)
DW_TAG (DW_TAG_template_value_param, 0x30)
DW_TAG (DW_TAG_thrown_type, 0x31)
DW_TAG (DW_TAG_try_block, 0x32)
DW_TAG (DW_TAG_variant_part, 0x33)
DW_TAG (DW_TAG_variable, 0x34)
DW_TAG (DW_TAG_volatile_type, 0x35)
/* DWARF 3. */
DW_TAG (DW_TAG_dwarf_procedure, 0x36)
DW_TAG (DW_TAG_restrict_type, 0x37)
DW_TAG (DW_TAG_interface_type, 0x38)
DW_TAG (DW_TAG_namespace, 0x39)
DW_TAG (DW_TAG_imported_module, 0x3a)
DW_TAG (DW_TAG_unspecified_type, 0x3b)
DW_TAG (DW_TAG_partial_unit, 0x3c)
DW_TAG (DW_TAG_imported_unit, 0x3d)
DW_TAG (DW_TAG_condition, 0x3f)
DW_TAG (DW_TAG_shared_type, 0x40)
/* DWARF 4. */
DW_TAG (DW_TAG_type_unit, 0x41)
DW_TAG (DW_TAG_rvalue_reference_type, 0x42)
DW_TAG (DW_TAG_template_alias, 0x43)
/* DWARF 5. */
DW_TAG (DW_TAG_coarray_type, 0x44)
DW_TAG (DW_TAG_generic_subrange, 0x45)
DW_TAG (DW_TAG_dynamic_type, 0x46)
DW_TAG (DW_TAG_atomic_type, 0x47)
DW_TAG (DW_TAG_call_site, 0x48)
DW_TAG (DW_TAG_call_site_parameter, 0x49)
DW_TAG (DW_TAG_skeleton_unit, 0x4a)
DW_TAG (DW_TAG_immutable_type, 0x4b)
DW_TAG_DUP (DW_TAG_lo_user, 0x4080)
DW_TAG_DUP (DW_TAG_hi_user, 0xffff)
/* SGI/MIPS Extensions. */
DW_TAG (DW_TAG_MIPS_loop, 0x4081)
/* HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . */
DW_TAG (DW_TAG_HP_array_descriptor, 0x4090)
DW_TAG (DW_TAG_HP_Bliss_field, 0x4091)
DW_TAG (DW_TAG_HP_Bliss_field_set, 0x4092)
/* GNU extensions. */
DW_TAG (DW_TAG_format_label, 0x4101) /* For FORTRAN 77 and Fortran 90. */
DW_TAG (DW_TAG_function_template, 0x4102) /* For C++. */
DW_TAG (DW_TAG_class_template, 0x4103) /* For C++. */
DW_TAG (DW_TAG_GNU_BINCL, 0x4104)
DW_TAG (DW_TAG_GNU_EINCL, 0x4105)
/* Template template parameter.
See http://gcc.gnu.org/wiki/TemplateParmsDwarf . */
DW_TAG (DW_TAG_GNU_template_template_param, 0x4106)
/* Template parameter pack extension, specified at
http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates
The values of these two TAGS are in the DW_TAG_GNU_* space until the tags
are properly part of DWARF 5. */
DW_TAG (DW_TAG_GNU_template_parameter_pack, 0x4107)
DW_TAG (DW_TAG_GNU_formal_parameter_pack, 0x4108)
/* The GNU call site extension, specified at
http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open .
The values of these two TAGS are in the DW_TAG_GNU_* space until the tags
are properly part of DWARF 5. */
DW_TAG (DW_TAG_GNU_call_site, 0x4109)
DW_TAG (DW_TAG_GNU_call_site_parameter, 0x410a)
/* Extensions for UPC. See: http://dwarfstd.org/doc/DWARF4.pdf. */
DW_TAG (DW_TAG_upc_shared_type, 0x8765)
DW_TAG (DW_TAG_upc_strict_type, 0x8766)
DW_TAG (DW_TAG_upc_relaxed_type, 0x8767)
/* PGI (STMicroelectronics) extensions. No documentation available. */
DW_TAG (DW_TAG_PGI_kanji_type, 0xA000)
DW_TAG (DW_TAG_PGI_interface_block, 0xA020)
DW_END_TAG
DW_FIRST_FORM (DW_FORM_addr, 0x01)
DW_FORM (DW_FORM_block2, 0x03)
DW_FORM (DW_FORM_block4, 0x04)
DW_FORM (DW_FORM_data2, 0x05)
DW_FORM (DW_FORM_data4, 0x06)
DW_FORM (DW_FORM_data8, 0x07)
DW_FORM (DW_FORM_string, 0x08)
DW_FORM (DW_FORM_block, 0x09)
DW_FORM (DW_FORM_block1, 0x0a)
DW_FORM (DW_FORM_data1, 0x0b)
DW_FORM (DW_FORM_flag, 0x0c)
DW_FORM (DW_FORM_sdata, 0x0d)
DW_FORM (DW_FORM_strp, 0x0e)
DW_FORM (DW_FORM_udata, 0x0f)
DW_FORM (DW_FORM_ref_addr, 0x10)
DW_FORM (DW_FORM_ref1, 0x11)
DW_FORM (DW_FORM_ref2, 0x12)
DW_FORM (DW_FORM_ref4, 0x13)
DW_FORM (DW_FORM_ref8, 0x14)
DW_FORM (DW_FORM_ref_udata, 0x15)
DW_FORM (DW_FORM_indirect, 0x16)
/* DWARF 4. */
DW_FORM (DW_FORM_sec_offset, 0x17)
DW_FORM (DW_FORM_exprloc, 0x18)
DW_FORM (DW_FORM_flag_present, 0x19)
DW_FORM (DW_FORM_ref_sig8, 0x20)
/* DWARF 5. */
DW_FORM (DW_FORM_strx, 0x1a)
DW_FORM (DW_FORM_addrx, 0x1b)
DW_FORM (DW_FORM_ref_sup4, 0x1c)
DW_FORM (DW_FORM_strp_sup, 0x1d)
DW_FORM (DW_FORM_data16, 0x1e)
DW_FORM (DW_FORM_line_strp, 0x1f)
DW_FORM (DW_FORM_implicit_const, 0x21)
DW_FORM (DW_FORM_loclistx, 0x22)
DW_FORM (DW_FORM_rnglistx, 0x23)
DW_FORM (DW_FORM_ref_sup8, 0x24)
DW_FORM (DW_FORM_strx1, 0x25)
DW_FORM (DW_FORM_strx2, 0x26)
DW_FORM (DW_FORM_strx3, 0x27)
DW_FORM (DW_FORM_strx4, 0x28)
DW_FORM (DW_FORM_addrx1, 0x29)
DW_FORM (DW_FORM_addrx2, 0x2a)
DW_FORM (DW_FORM_addrx3, 0x2b)
DW_FORM (DW_FORM_addrx4, 0x2c)
/* Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. */
DW_FORM (DW_FORM_GNU_addr_index, 0x1f01)
DW_FORM (DW_FORM_GNU_str_index, 0x1f02)
/* Extensions for DWZ multifile.
See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open . */
DW_FORM (DW_FORM_GNU_ref_alt, 0x1f20)
DW_FORM (DW_FORM_GNU_strp_alt, 0x1f21)
DW_END_FORM
DW_FIRST_AT (DW_AT_sibling, 0x01)
DW_AT (DW_AT_location, 0x02)
DW_AT (DW_AT_name, 0x03)
DW_AT (DW_AT_ordering, 0x09)
DW_AT (DW_AT_subscr_data, 0x0a)
DW_AT (DW_AT_byte_size, 0x0b)
DW_AT (DW_AT_bit_offset, 0x0c)
DW_AT (DW_AT_bit_size, 0x0d)
DW_AT (DW_AT_element_list, 0x0f)
DW_AT (DW_AT_stmt_list, 0x10)
DW_AT (DW_AT_low_pc, 0x11)
DW_AT (DW_AT_high_pc, 0x12)
DW_AT (DW_AT_language, 0x13)
DW_AT (DW_AT_member, 0x14)
DW_AT (DW_AT_discr, 0x15)
DW_AT (DW_AT_discr_value, 0x16)
DW_AT (DW_AT_visibility, 0x17)
DW_AT (DW_AT_import, 0x18)
DW_AT (DW_AT_string_length, 0x19)
DW_AT (DW_AT_common_reference, 0x1a)
DW_AT (DW_AT_comp_dir, 0x1b)
DW_AT (DW_AT_const_value, 0x1c)
DW_AT (DW_AT_containing_type, 0x1d)
DW_AT (DW_AT_default_value, 0x1e)
DW_AT (DW_AT_inline, 0x20)
DW_AT (DW_AT_is_optional, 0x21)
DW_AT (DW_AT_lower_bound, 0x22)
DW_AT (DW_AT_producer, 0x25)
DW_AT (DW_AT_prototyped, 0x27)
DW_AT (DW_AT_return_addr, 0x2a)
DW_AT (DW_AT_start_scope, 0x2c)
DW_AT (DW_AT_bit_stride, 0x2e)
DW_AT (DW_AT_upper_bound, 0x2f)
DW_AT (DW_AT_abstract_origin, 0x31)
DW_AT (DW_AT_accessibility, 0x32)
DW_AT (DW_AT_address_class, 0x33)
DW_AT (DW_AT_artificial, 0x34)
DW_AT (DW_AT_base_types, 0x35)
DW_AT (DW_AT_calling_convention, 0x36)
DW_AT (DW_AT_count, 0x37)
DW_AT (DW_AT_data_member_location, 0x38)
DW_AT (DW_AT_decl_column, 0x39)
DW_AT (DW_AT_decl_file, 0x3a)
DW_AT (DW_AT_decl_line, 0x3b)
DW_AT (DW_AT_declaration, 0x3c)
DW_AT (DW_AT_discr_list, 0x3d)
DW_AT (DW_AT_encoding, 0x3e)
DW_AT (DW_AT_external, 0x3f)
DW_AT (DW_AT_frame_base, 0x40)
DW_AT (DW_AT_friend, 0x41)
DW_AT (DW_AT_identifier_case, 0x42)
DW_AT (DW_AT_macro_info, 0x43)
DW_AT (DW_AT_namelist_items, 0x44)
DW_AT (DW_AT_priority, 0x45)
DW_AT (DW_AT_segment, 0x46)
DW_AT (DW_AT_specification, 0x47)
DW_AT (DW_AT_static_link, 0x48)
DW_AT (DW_AT_type, 0x49)
DW_AT (DW_AT_use_location, 0x4a)
DW_AT (DW_AT_variable_parameter, 0x4b)
DW_AT (DW_AT_virtuality, 0x4c)
DW_AT (DW_AT_vtable_elem_location, 0x4d)
/* DWARF 3 values. */
DW_AT (DW_AT_allocated, 0x4e)
DW_AT (DW_AT_associated, 0x4f)
DW_AT (DW_AT_data_location, 0x50)
DW_AT (DW_AT_byte_stride, 0x51)
DW_AT (DW_AT_entry_pc, 0x52)
DW_AT (DW_AT_use_UTF8, 0x53)
DW_AT (DW_AT_extension, 0x54)
DW_AT (DW_AT_ranges, 0x55)
DW_AT (DW_AT_trampoline, 0x56)
DW_AT (DW_AT_call_column, 0x57)
DW_AT (DW_AT_call_file, 0x58)
DW_AT (DW_AT_call_line, 0x59)
DW_AT (DW_AT_description, 0x5a)
DW_AT (DW_AT_binary_scale, 0x5b)
DW_AT (DW_AT_decimal_scale, 0x5c)
DW_AT (DW_AT_small, 0x5d)
DW_AT (DW_AT_decimal_sign, 0x5e)
DW_AT (DW_AT_digit_count, 0x5f)
DW_AT (DW_AT_picture_string, 0x60)
DW_AT (DW_AT_mutable, 0x61)
DW_AT (DW_AT_threads_scaled, 0x62)
DW_AT (DW_AT_explicit, 0x63)
DW_AT (DW_AT_object_pointer, 0x64)
DW_AT (DW_AT_endianity, 0x65)
DW_AT (DW_AT_elemental, 0x66)
DW_AT (DW_AT_pure, 0x67)
DW_AT (DW_AT_recursive, 0x68)
/* DWARF 4. */
DW_AT (DW_AT_signature, 0x69)
DW_AT (DW_AT_main_subprogram, 0x6a)
DW_AT (DW_AT_data_bit_offset, 0x6b)
DW_AT (DW_AT_const_expr, 0x6c)
DW_AT (DW_AT_enum_class, 0x6d)
DW_AT (DW_AT_linkage_name, 0x6e)
/* DWARF 5. */
DW_AT (DW_AT_string_length_bit_size, 0x6f)
DW_AT (DW_AT_string_length_byte_size, 0x70)
DW_AT (DW_AT_rank, 0x71)
DW_AT (DW_AT_str_offsets_base, 0x72)
DW_AT (DW_AT_addr_base, 0x73)
DW_AT (DW_AT_rnglists_base, 0x74)
DW_AT (DW_AT_dwo_name, 0x76)
DW_AT (DW_AT_reference, 0x77)
DW_AT (DW_AT_rvalue_reference, 0x78)
DW_AT (DW_AT_macros, 0x79)
DW_AT (DW_AT_call_all_calls, 0x7a)
DW_AT (DW_AT_call_all_source_calls, 0x7b)
DW_AT (DW_AT_call_all_tail_calls, 0x7c)
DW_AT (DW_AT_call_return_pc, 0x7d)
DW_AT (DW_AT_call_value, 0x7e)
DW_AT (DW_AT_call_origin, 0x7f)
DW_AT (DW_AT_call_parameter, 0x80)
DW_AT (DW_AT_call_pc, 0x81)
DW_AT (DW_AT_call_tail_call, 0x82)
DW_AT (DW_AT_call_target, 0x83)
DW_AT (DW_AT_call_target_clobbered, 0x84)
DW_AT (DW_AT_call_data_location, 0x85)
DW_AT (DW_AT_call_data_value, 0x86)
DW_AT (DW_AT_noreturn, 0x87)
DW_AT (DW_AT_alignment, 0x88)
DW_AT (DW_AT_export_symbols, 0x89)
DW_AT (DW_AT_deleted, 0x8a)
DW_AT (DW_AT_defaulted, 0x8b)
DW_AT (DW_AT_loclists_base, 0x8c)
DW_AT_DUP (DW_AT_lo_user, 0x2000) /* Implementation-defined range start. */
DW_AT_DUP (DW_AT_hi_user, 0x3fff) /* Implementation-defined range end. */
/* SGI/MIPS extensions. */
DW_AT (DW_AT_MIPS_fde, 0x2001)
DW_AT (DW_AT_MIPS_loop_begin, 0x2002)
DW_AT (DW_AT_MIPS_tail_loop_begin, 0x2003)
DW_AT (DW_AT_MIPS_epilog_begin, 0x2004)
DW_AT (DW_AT_MIPS_loop_unroll_factor, 0x2005)
DW_AT (DW_AT_MIPS_software_pipeline_depth, 0x2006)
DW_AT (DW_AT_MIPS_linkage_name, 0x2007)
DW_AT (DW_AT_MIPS_stride, 0x2008)
DW_AT (DW_AT_MIPS_abstract_name, 0x2009)
DW_AT (DW_AT_MIPS_clone_origin, 0x200a)
DW_AT (DW_AT_MIPS_has_inlines, 0x200b)
/* HP extensions. */
DW_AT (DW_AT_HP_block_index, 0x2000)
DW_AT_DUP (DW_AT_HP_unmodifiable, 0x2001) /* Same as DW_AT_MIPS_fde. */
DW_AT_DUP (DW_AT_HP_prologue, 0x2005) /* Same as DW_AT_MIPS_loop_unroll. */
DW_AT_DUP (DW_AT_HP_epilogue, 0x2008) /* Same as DW_AT_MIPS_stride. */
DW_AT (DW_AT_HP_actuals_stmt_list, 0x2010)
DW_AT (DW_AT_HP_proc_per_section, 0x2011)
DW_AT (DW_AT_HP_raw_data_ptr, 0x2012)
DW_AT (DW_AT_HP_pass_by_reference, 0x2013)
DW_AT (DW_AT_HP_opt_level, 0x2014)
DW_AT (DW_AT_HP_prof_version_id, 0x2015)
DW_AT (DW_AT_HP_opt_flags, 0x2016)
DW_AT (DW_AT_HP_cold_region_low_pc, 0x2017)
DW_AT (DW_AT_HP_cold_region_high_pc, 0x2018)
DW_AT (DW_AT_HP_all_variables_modifiable, 0x2019)
DW_AT (DW_AT_HP_linkage_name, 0x201a)
DW_AT (DW_AT_HP_prof_flags, 0x201b) /* In comp unit of procs_info for -g. */
DW_AT (DW_AT_HP_unit_name, 0x201f)
DW_AT (DW_AT_HP_unit_size, 0x2020)
DW_AT (DW_AT_HP_widened_byte_size, 0x2021)
DW_AT (DW_AT_HP_definition_points, 0x2022)
DW_AT (DW_AT_HP_default_location, 0x2023)
DW_AT (DW_AT_HP_is_result_param, 0x2029)
/* GNU extensions. */
DW_AT (DW_AT_sf_names, 0x2101)
DW_AT (DW_AT_src_info, 0x2102)
DW_AT (DW_AT_mac_info, 0x2103)
DW_AT (DW_AT_src_coords, 0x2104)
DW_AT (DW_AT_body_begin, 0x2105)
DW_AT (DW_AT_body_end, 0x2106)
DW_AT (DW_AT_GNU_vector, 0x2107)
/* Thread-safety annotations.
See http://gcc.gnu.org/wiki/ThreadSafetyAnnotation . */
DW_AT (DW_AT_GNU_guarded_by, 0x2108)
DW_AT (DW_AT_GNU_pt_guarded_by, 0x2109)
DW_AT (DW_AT_GNU_guarded, 0x210a)
DW_AT (DW_AT_GNU_pt_guarded, 0x210b)
DW_AT (DW_AT_GNU_locks_excluded, 0x210c)
DW_AT (DW_AT_GNU_exclusive_locks_required, 0x210d)
DW_AT (DW_AT_GNU_shared_locks_required, 0x210e)
/* One-definition rule violation detection.
See http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo . */
DW_AT (DW_AT_GNU_odr_signature, 0x210f)
/* Template template argument name.
See http://gcc.gnu.org/wiki/TemplateParmsDwarf . */
DW_AT (DW_AT_GNU_template_name, 0x2110)
/* The GNU call site extension.
See http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open . */
DW_AT (DW_AT_GNU_call_site_value, 0x2111)
DW_AT (DW_AT_GNU_call_site_data_value, 0x2112)
DW_AT (DW_AT_GNU_call_site_target, 0x2113)
DW_AT (DW_AT_GNU_call_site_target_clobbered, 0x2114)
DW_AT (DW_AT_GNU_tail_call, 0x2115)
DW_AT (DW_AT_GNU_all_tail_call_sites, 0x2116)
DW_AT (DW_AT_GNU_all_call_sites, 0x2117)
DW_AT (DW_AT_GNU_all_source_call_sites, 0x2118)
/* Section offset into .debug_macro section. */
DW_AT (DW_AT_GNU_macros, 0x2119)
/* Attribute for C++ deleted special member functions (= delete;). */
DW_AT (DW_AT_GNU_deleted, 0x211a)
/* Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. */
DW_AT (DW_AT_GNU_dwo_name, 0x2130)
DW_AT (DW_AT_GNU_dwo_id, 0x2131)
DW_AT (DW_AT_GNU_ranges_base, 0x2132)
DW_AT (DW_AT_GNU_addr_base, 0x2133)
DW_AT (DW_AT_GNU_pubnames, 0x2134)
DW_AT (DW_AT_GNU_pubtypes, 0x2135)
/* Attribute for discriminator.
See http://gcc.gnu.org/wiki/Discriminator */
DW_AT (DW_AT_GNU_discriminator, 0x2136)
DW_AT (DW_AT_GNU_locviews, 0x2137)
DW_AT (DW_AT_GNU_entry_view, 0x2138)
/* VMS extensions. */
DW_AT (DW_AT_VMS_rtnbeg_pd_address, 0x2201)
/* GNAT extensions. */
/* GNAT descriptive type.
See http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type . */
DW_AT (DW_AT_use_GNAT_descriptive_type, 0x2301)
DW_AT (DW_AT_GNAT_descriptive_type, 0x2302)
/* Rational constant extension.
See https://gcc.gnu.org/wiki/DW_AT_GNU_numerator_denominator . */
DW_TAG (DW_AT_GNU_numerator, 0x2303)
DW_TAG (DW_AT_GNU_denominator, 0x2304)
/* Biased integer extension.
See https://gcc.gnu.org/wiki/DW_AT_GNU_bias . */
DW_TAG (DW_AT_GNU_bias, 0x2305)
/* UPC extension. */
DW_AT (DW_AT_upc_threads_scaled, 0x3210)
/* PGI (STMicroelectronics) extensions. */
DW_AT (DW_AT_PGI_lbase, 0x3a00)
DW_AT (DW_AT_PGI_soffset, 0x3a01)
DW_AT (DW_AT_PGI_lstride, 0x3a02)
/* Apple extensions. */
DW_AT (DW_AT_APPLE_optimized, 0x3fe1)
DW_AT (DW_AT_APPLE_flags, 0x3fe2)
DW_AT (DW_AT_APPLE_isa, 0x3fe3)
DW_AT (DW_AT_APPLE_block, 0x3fe4)
DW_AT (DW_AT_APPLE_major_runtime_vers, 0x3fe5)
DW_AT (DW_AT_APPLE_runtime_class, 0x3fe6)
DW_AT (DW_AT_APPLE_omit_frame_ptr, 0x3fe7)
DW_AT (DW_AT_APPLE_property_name, 0x3fe8)
DW_AT (DW_AT_APPLE_property_getter, 0x3fe9)
DW_AT (DW_AT_APPLE_property_setter, 0x3fea)
DW_AT (DW_AT_APPLE_property_attribute, 0x3feb)
DW_AT (DW_AT_APPLE_objc_complete_type, 0x3fec)
DW_AT (DW_AT_APPLE_property, 0x3fed)
DW_END_AT
DW_FIRST_OP (DW_OP_addr, 0x03)
DW_OP (DW_OP_deref, 0x06)
DW_OP (DW_OP_const1u, 0x08)
DW_OP (DW_OP_const1s, 0x09)
DW_OP (DW_OP_const2u, 0x0a)
DW_OP (DW_OP_const2s, 0x0b)
DW_OP (DW_OP_const4u, 0x0c)
DW_OP (DW_OP_const4s, 0x0d)
DW_OP (DW_OP_const8u, 0x0e)
DW_OP (DW_OP_const8s, 0x0f)
DW_OP (DW_OP_constu, 0x10)
DW_OP (DW_OP_consts, 0x11)
DW_OP (DW_OP_dup, 0x12)
DW_OP (DW_OP_drop, 0x13)
DW_OP (DW_OP_over, 0x14)
DW_OP (DW_OP_pick, 0x15)
DW_OP (DW_OP_swap, 0x16)
DW_OP (DW_OP_rot, 0x17)
DW_OP (DW_OP_xderef, 0x18)
DW_OP (DW_OP_abs, 0x19)
DW_OP (DW_OP_and, 0x1a)
DW_OP (DW_OP_div, 0x1b)
DW_OP (DW_OP_minus, 0x1c)
DW_OP (DW_OP_mod, 0x1d)
DW_OP (DW_OP_mul, 0x1e)
DW_OP (DW_OP_neg, 0x1f)
DW_OP (DW_OP_not, 0x20)
DW_OP (DW_OP_or, 0x21)
DW_OP (DW_OP_plus, 0x22)
DW_OP (DW_OP_plus_uconst, 0x23)
DW_OP (DW_OP_shl, 0x24)
DW_OP (DW_OP_shr, 0x25)
DW_OP (DW_OP_shra, 0x26)
DW_OP (DW_OP_xor, 0x27)
DW_OP (DW_OP_bra, 0x28)
DW_OP (DW_OP_eq, 0x29)
DW_OP (DW_OP_ge, 0x2a)
DW_OP (DW_OP_gt, 0x2b)
DW_OP (DW_OP_le, 0x2c)
DW_OP (DW_OP_lt, 0x2d)
DW_OP (DW_OP_ne, 0x2e)
DW_OP (DW_OP_skip, 0x2f)
DW_OP (DW_OP_lit0, 0x30)
DW_OP (DW_OP_lit1, 0x31)
DW_OP (DW_OP_lit2, 0x32)
DW_OP (DW_OP_lit3, 0x33)
DW_OP (DW_OP_lit4, 0x34)
DW_OP (DW_OP_lit5, 0x35)
DW_OP (DW_OP_lit6, 0x36)
DW_OP (DW_OP_lit7, 0x37)
DW_OP (DW_OP_lit8, 0x38)
DW_OP (DW_OP_lit9, 0x39)
DW_OP (DW_OP_lit10, 0x3a)
DW_OP (DW_OP_lit11, 0x3b)
DW_OP (DW_OP_lit12, 0x3c)
DW_OP (DW_OP_lit13, 0x3d)
DW_OP (DW_OP_lit14, 0x3e)
DW_OP (DW_OP_lit15, 0x3f)
DW_OP (DW_OP_lit16, 0x40)
DW_OP (DW_OP_lit17, 0x41)
DW_OP (DW_OP_lit18, 0x42)
DW_OP (DW_OP_lit19, 0x43)
DW_OP (DW_OP_lit20, 0x44)
DW_OP (DW_OP_lit21, 0x45)
DW_OP (DW_OP_lit22, 0x46)
DW_OP (DW_OP_lit23, 0x47)
DW_OP (DW_OP_lit24, 0x48)
DW_OP (DW_OP_lit25, 0x49)
DW_OP (DW_OP_lit26, 0x4a)
DW_OP (DW_OP_lit27, 0x4b)
DW_OP (DW_OP_lit28, 0x4c)
DW_OP (DW_OP_lit29, 0x4d)
DW_OP (DW_OP_lit30, 0x4e)
DW_OP (DW_OP_lit31, 0x4f)
DW_OP (DW_OP_reg0, 0x50)
DW_OP (DW_OP_reg1, 0x51)
DW_OP (DW_OP_reg2, 0x52)
DW_OP (DW_OP_reg3, 0x53)
DW_OP (DW_OP_reg4, 0x54)
DW_OP (DW_OP_reg5, 0x55)
DW_OP (DW_OP_reg6, 0x56)
DW_OP (DW_OP_reg7, 0x57)
DW_OP (DW_OP_reg8, 0x58)
DW_OP (DW_OP_reg9, 0x59)
DW_OP (DW_OP_reg10, 0x5a)
DW_OP (DW_OP_reg11, 0x5b)
DW_OP (DW_OP_reg12, 0x5c)
DW_OP (DW_OP_reg13, 0x5d)
DW_OP (DW_OP_reg14, 0x5e)
DW_OP (DW_OP_reg15, 0x5f)
DW_OP (DW_OP_reg16, 0x60)
DW_OP (DW_OP_reg17, 0x61)
DW_OP (DW_OP_reg18, 0x62)
DW_OP (DW_OP_reg19, 0x63)
DW_OP (DW_OP_reg20, 0x64)
DW_OP (DW_OP_reg21, 0x65)
DW_OP (DW_OP_reg22, 0x66)
DW_OP (DW_OP_reg23, 0x67)
DW_OP (DW_OP_reg24, 0x68)
DW_OP (DW_OP_reg25, 0x69)
DW_OP (DW_OP_reg26, 0x6a)
DW_OP (DW_OP_reg27, 0x6b)
DW_OP (DW_OP_reg28, 0x6c)
DW_OP (DW_OP_reg29, 0x6d)
DW_OP (DW_OP_reg30, 0x6e)
DW_OP (DW_OP_reg31, 0x6f)
DW_OP (DW_OP_breg0, 0x70)
DW_OP (DW_OP_breg1, 0x71)
DW_OP (DW_OP_breg2, 0x72)
DW_OP (DW_OP_breg3, 0x73)
DW_OP (DW_OP_breg4, 0x74)
DW_OP (DW_OP_breg5, 0x75)
DW_OP (DW_OP_breg6, 0x76)
DW_OP (DW_OP_breg7, 0x77)
DW_OP (DW_OP_breg8, 0x78)
DW_OP (DW_OP_breg9, 0x79)
DW_OP (DW_OP_breg10, 0x7a)
DW_OP (DW_OP_breg11, 0x7b)
DW_OP (DW_OP_breg12, 0x7c)
DW_OP (DW_OP_breg13, 0x7d)
DW_OP (DW_OP_breg14, 0x7e)
DW_OP (DW_OP_breg15, 0x7f)
DW_OP (DW_OP_breg16, 0x80)
DW_OP (DW_OP_breg17, 0x81)
DW_OP (DW_OP_breg18, 0x82)
DW_OP (DW_OP_breg19, 0x83)
DW_OP (DW_OP_breg20, 0x84)
DW_OP (DW_OP_breg21, 0x85)
DW_OP (DW_OP_breg22, 0x86)
DW_OP (DW_OP_breg23, 0x87)
DW_OP (DW_OP_breg24, 0x88)
DW_OP (DW_OP_breg25, 0x89)
DW_OP (DW_OP_breg26, 0x8a)
DW_OP (DW_OP_breg27, 0x8b)
DW_OP (DW_OP_breg28, 0x8c)
DW_OP (DW_OP_breg29, 0x8d)
DW_OP (DW_OP_breg30, 0x8e)
DW_OP (DW_OP_breg31, 0x8f)
DW_OP (DW_OP_regx, 0x90)
DW_OP (DW_OP_fbreg, 0x91)
DW_OP (DW_OP_bregx, 0x92)
DW_OP (DW_OP_piece, 0x93)
DW_OP (DW_OP_deref_size, 0x94)
DW_OP (DW_OP_xderef_size, 0x95)
DW_OP (DW_OP_nop, 0x96)
/* DWARF 3 extensions. */
DW_OP (DW_OP_push_object_address, 0x97)
DW_OP (DW_OP_call2, 0x98)
DW_OP (DW_OP_call4, 0x99)
DW_OP (DW_OP_call_ref, 0x9a)
DW_OP (DW_OP_form_tls_address, 0x9b)
DW_OP (DW_OP_call_frame_cfa, 0x9c)
DW_OP (DW_OP_bit_piece, 0x9d)
/* DWARF 4 extensions. */
DW_OP (DW_OP_implicit_value, 0x9e)
DW_OP (DW_OP_stack_value, 0x9f)
/* DWARF 5 extensions. */
DW_OP (DW_OP_implicit_pointer, 0xa0)
DW_OP (DW_OP_addrx, 0xa1)
DW_OP (DW_OP_constx, 0xa2)
DW_OP (DW_OP_entry_value, 0xa3)
DW_OP (DW_OP_const_type, 0xa4)
DW_OP (DW_OP_regval_type, 0xa5)
DW_OP (DW_OP_deref_type, 0xa6)
DW_OP (DW_OP_xderef_type, 0xa7)
DW_OP (DW_OP_convert, 0xa8)
DW_OP (DW_OP_reinterpret, 0xa9)
DW_OP_DUP (DW_OP_lo_user, 0xe0) /* Implementation-defined range start. */
DW_OP_DUP (DW_OP_hi_user, 0xff) /* Implementation-defined range end. */
/* GNU extensions. */
DW_OP (DW_OP_GNU_push_tls_address, 0xe0)
/* The following is for marking variables that are uninitialized. */
DW_OP (DW_OP_GNU_uninit, 0xf0)
DW_OP (DW_OP_GNU_encoded_addr, 0xf1)
/* The GNU implicit pointer extension.
See http://www.dwarfstd.org/ShowIssue.php?issue=100831.1&type=open . */
DW_OP (DW_OP_GNU_implicit_pointer, 0xf2)
/* The GNU entry value extension.
See http://www.dwarfstd.org/ShowIssue.php?issue=100909.1&type=open . */
DW_OP (DW_OP_GNU_entry_value, 0xf3)
/* The GNU typed stack extension.
See http://www.dwarfstd.org/doc/040408.1.html . */
DW_OP (DW_OP_GNU_const_type, 0xf4)
DW_OP (DW_OP_GNU_regval_type, 0xf5)
DW_OP (DW_OP_GNU_deref_type, 0xf6)
DW_OP (DW_OP_GNU_convert, 0xf7)
DW_OP (DW_OP_GNU_reinterpret, 0xf9)
/* The GNU parameter ref extension. */
DW_OP (DW_OP_GNU_parameter_ref, 0xfa)
/* Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. */
DW_OP (DW_OP_GNU_addr_index, 0xfb)
DW_OP (DW_OP_GNU_const_index, 0xfc)
/* The GNU variable value extension.
See http://dwarfstd.org/ShowIssue.php?issue=161109.2 . */
DW_OP (DW_OP_GNU_variable_value, 0xfd)
/* HP extensions. */
DW_OP_DUP (DW_OP_HP_unknown, 0xe0) /* Ouch, the same as GNU_push_tls_address. */
DW_OP (DW_OP_HP_is_value, 0xe1)
DW_OP (DW_OP_HP_fltconst4, 0xe2)
DW_OP (DW_OP_HP_fltconst8, 0xe3)
DW_OP (DW_OP_HP_mod_range, 0xe4)
DW_OP (DW_OP_HP_unmod_range, 0xe5)
DW_OP (DW_OP_HP_tls, 0xe6)
/* PGI (STMicroelectronics) extensions. */
DW_OP (DW_OP_PGI_omp_thread_num, 0xf8)
/* AARCH64 extensions.
DW_OP_AARCH64_operation takes one mandatory unsigned LEB128 operand.
Bits[6:0] of this operand is the action code, all others bits are initialized
to 0 except explicitly documented for one action. Please refer AArch64 DWARF
ABI documentation for details. */
DW_OP (DW_OP_AARCH64_operation, 0xea)
DW_END_OP
DW_FIRST_ATE (DW_ATE_void, 0x0)
DW_ATE (DW_ATE_address, 0x1)
DW_ATE (DW_ATE_boolean, 0x2)
DW_ATE (DW_ATE_complex_float, 0x3)
DW_ATE (DW_ATE_float, 0x4)
DW_ATE (DW_ATE_signed, 0x5)
DW_ATE (DW_ATE_signed_char, 0x6)
DW_ATE (DW_ATE_unsigned, 0x7)
DW_ATE (DW_ATE_unsigned_char, 0x8)
/* DWARF 3. */
DW_ATE (DW_ATE_imaginary_float, 0x9)
DW_ATE (DW_ATE_packed_decimal, 0xa)
DW_ATE (DW_ATE_numeric_string, 0xb)
DW_ATE (DW_ATE_edited, 0xc)
DW_ATE (DW_ATE_signed_fixed, 0xd)
DW_ATE (DW_ATE_unsigned_fixed, 0xe)
DW_ATE (DW_ATE_decimal_float, 0xf)
/* DWARF 4. */
DW_ATE (DW_ATE_UTF, 0x10)
/* DWARF 5. */
DW_ATE (DW_ATE_UCS, 0x11)
DW_ATE (DW_ATE_ASCII, 0x12)
DW_ATE_DUP (DW_ATE_lo_user, 0x80)
DW_ATE_DUP (DW_ATE_hi_user, 0xff)
/* HP extensions. */
DW_ATE (DW_ATE_HP_float80, 0x80) /* Floating-point (80 bit). */
DW_ATE (DW_ATE_HP_complex_float80, 0x81) /* Complex floating-point (80 bit). */
DW_ATE (DW_ATE_HP_float128, 0x82) /* Floating-point (128 bit). */
DW_ATE (DW_ATE_HP_complex_float128, 0x83) /* Complex fp (128 bit). */
DW_ATE (DW_ATE_HP_floathpintel, 0x84) /* Floating-point (82 bit IA64). */
DW_ATE (DW_ATE_HP_imaginary_float80, 0x85)
DW_ATE (DW_ATE_HP_imaginary_float128, 0x86)
DW_ATE (DW_ATE_HP_VAX_float, 0x88) /* F or G floating. */
DW_ATE (DW_ATE_HP_VAX_float_d, 0x89) /* D floating. */
DW_ATE (DW_ATE_HP_packed_decimal, 0x8a) /* Cobol. */
DW_ATE (DW_ATE_HP_zoned_decimal, 0x8b) /* Cobol. */
DW_ATE (DW_ATE_HP_edited, 0x8c) /* Cobol. */
DW_ATE (DW_ATE_HP_signed_fixed, 0x8d) /* Cobol. */
DW_ATE (DW_ATE_HP_unsigned_fixed, 0x8e) /* Cobol. */
DW_ATE (DW_ATE_HP_VAX_complex_float, 0x8f) /* F or G floating complex. */
DW_ATE (DW_ATE_HP_VAX_complex_float_d, 0x90) /* D floating complex. */
DW_END_ATE
DW_FIRST_CFA (DW_CFA_advance_loc, 0x40)
DW_CFA (DW_CFA_offset, 0x80)
DW_CFA (DW_CFA_restore, 0xc0)
DW_CFA (DW_CFA_nop, 0x00)
DW_CFA (DW_CFA_set_loc, 0x01)
DW_CFA (DW_CFA_advance_loc1, 0x02)
DW_CFA (DW_CFA_advance_loc2, 0x03)
DW_CFA (DW_CFA_advance_loc4, 0x04)
DW_CFA (DW_CFA_offset_extended, 0x05)
DW_CFA (DW_CFA_restore_extended, 0x06)
DW_CFA (DW_CFA_undefined, 0x07)
DW_CFA (DW_CFA_same_value, 0x08)
DW_CFA (DW_CFA_register, 0x09)
DW_CFA (DW_CFA_remember_state, 0x0a)
DW_CFA (DW_CFA_restore_state, 0x0b)
DW_CFA (DW_CFA_def_cfa, 0x0c)
DW_CFA (DW_CFA_def_cfa_register, 0x0d)
DW_CFA (DW_CFA_def_cfa_offset, 0x0e)
/* DWARF 3. */
DW_CFA (DW_CFA_def_cfa_expression, 0x0f)
DW_CFA (DW_CFA_expression, 0x10)
DW_CFA (DW_CFA_offset_extended_sf, 0x11)
DW_CFA (DW_CFA_def_cfa_sf, 0x12)
DW_CFA (DW_CFA_def_cfa_offset_sf, 0x13)
DW_CFA (DW_CFA_val_offset, 0x14)
DW_CFA (DW_CFA_val_offset_sf, 0x15)
DW_CFA (DW_CFA_val_expression, 0x16)
DW_CFA (DW_CFA_lo_user, 0x1c)
DW_CFA (DW_CFA_hi_user, 0x3f)
/* SGI/MIPS specific. */
DW_CFA (DW_CFA_MIPS_advance_loc8, 0x1d)
/* GNU extensions.
NOTE: DW_CFA_GNU_window_save is multiplexed on Sparc and AArch64. */
DW_CFA (DW_CFA_GNU_window_save, 0x2d)
DW_CFA_DUP (DW_CFA_AARCH64_negate_ra_state, 0x2d)
DW_CFA (DW_CFA_GNU_args_size, 0x2e)
DW_CFA (DW_CFA_GNU_negative_offset_extended, 0x2f)
DW_END_CFA
/* Index attributes in the Abbreviations Table. */
DW_FIRST_IDX (DW_IDX_compile_unit, 1)
DW_IDX (DW_IDX_type_unit, 2)
DW_IDX (DW_IDX_die_offset, 3)
DW_IDX (DW_IDX_parent, 4)
DW_IDX (DW_IDX_type_hash, 5)
DW_IDX_DUP (DW_IDX_lo_user, 0x2000)
DW_IDX (DW_IDX_hi_user, 0x3fff)
DW_IDX (DW_IDX_GNU_internal, 0x2000)
DW_IDX (DW_IDX_GNU_external, 0x2001)
DW_END_IDX
/* DWARF5 Unit type header encodings */
DW_FIRST_UT (DW_UT_compile, 0x01)
DW_UT (DW_UT_type, 0x02)
DW_UT (DW_UT_partial, 0x03)
DW_UT (DW_UT_skeleton, 0x04)
DW_UT (DW_UT_split_compile, 0x05)
DW_UT (DW_UT_split_type, 0x06)
DW_UT (DW_UT_lo_user, 0x80)
DW_UT (DW_UT_hi_user, 0xff)
DW_END_UT

556
dwarf2.h
View File

@ -1,556 +0,0 @@
/* Declarations and definitions of codes relating to the DWARF2 and
DWARF3 symbolic debugging information formats.
Copyright (C) 1992-2021 Free Software Foundation, Inc.
Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
Office (AJPO), Florida State University and Silicon Graphics Inc.
provided support for this effort -- June 21, 1995.
Derived from the DWARF 1 implementation written by Ron Guilmette
(rfg@netcom.com), November 1990.
This file is part of GCC.
GCC 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, or (at your option) any later
version.
GCC 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This file is derived from the DWARF specification (a public document)
Revision 2.0.0 (July 27, 1993) developed by the UNIX International
Programming Languages Special Interest Group (UI/PLSIG) and distributed
by UNIX International. Copies of this specification are available from
UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
This file also now contains definitions from the DWARF 3 specification
published Dec 20, 2005, available from: http://dwarf.freestandards.org. */
#ifndef _DWARF2_H
#define _DWARF2_H
#define DW_TAG(name, value) , name = value
#define DW_TAG_DUP(name, value) , name = value
#define DW_FORM(name, value) , name = value
#define DW_AT(name, value) , name = value
#define DW_AT_DUP(name, value) , name = value
#define DW_OP(name, value) , name = value
#define DW_OP_DUP(name, value) , name = value
#define DW_ATE(name, value) , name = value
#define DW_ATE_DUP(name, value) , name = value
#define DW_CFA(name, value) , name = value
#define DW_CFA_DUP(name, value) , name = value
#define DW_IDX(name, value) , name = value
#define DW_IDX_DUP(name, value) , name = value
#define DW_UT(name, value) , name = value
#define DW_FIRST_TAG(name, value) enum dwarf_tag { \
name = value
#define DW_END_TAG };
#define DW_FIRST_FORM(name, value) enum dwarf_form { \
name = value
#define DW_END_FORM };
#define DW_FIRST_AT(name, value) enum dwarf_attribute { \
name = value
#define DW_END_AT };
#define DW_FIRST_OP(name, value) enum dwarf_location_atom { \
name = value
#define DW_END_OP };
#define DW_FIRST_ATE(name, value) enum dwarf_type { \
name = value
#define DW_END_ATE };
#define DW_FIRST_CFA(name, value) enum dwarf_call_frame_info { \
name = value
#define DW_END_CFA };
#define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \
name = value
#define DW_END_IDX };
#define DW_FIRST_UT(name, value) enum dwarf_unit_type { \
name = value
#define DW_END_UT };
#include "dwarf2.def"
#undef DW_FIRST_TAG
#undef DW_END_TAG
#undef DW_FIRST_FORM
#undef DW_END_FORM
#undef DW_FIRST_AT
#undef DW_END_AT
#undef DW_FIRST_OP
#undef DW_END_OP
#undef DW_FIRST_ATE
#undef DW_END_ATE
#undef DW_FIRST_CFA
#undef DW_END_CFA
#undef DW_FIRST_IDX
#undef DW_END_IDX
#undef DW_FIRST_UT
#undef DW_END_UT
#undef DW_TAG
#undef DW_TAG_DUP
#undef DW_FORM
#undef DW_AT
#undef DW_AT_DUP
#undef DW_OP
#undef DW_OP_DUP
#undef DW_ATE
#undef DW_ATE_DUP
#undef DW_CFA
#undef DW_CFA_DUP
#undef DW_IDX
#undef DW_IDX_DUP
#undef DW_UT
/* Flag that tells whether entry has a child or not. */
#define DW_children_no 0
#define DW_children_yes 1
#define DW_AT_stride_size DW_AT_bit_stride /* Note: The use of DW_AT_stride_size is deprecated. */
#define DW_AT_stride DW_AT_byte_stride /* Note: The use of DW_AT_stride is deprecated. */
/* Decimal sign encodings. */
enum dwarf_decimal_sign_encoding
{
/* DWARF 3. */
DW_DS_unsigned = 0x01,
DW_DS_leading_overpunch = 0x02,
DW_DS_trailing_overpunch = 0x03,
DW_DS_leading_separate = 0x04,
DW_DS_trailing_separate = 0x05
};
/* Endianity encodings. */
enum dwarf_endianity_encoding
{
/* DWARF 3. */
DW_END_default = 0x00,
DW_END_big = 0x01,
DW_END_little = 0x02,
DW_END_lo_user = 0x40,
DW_END_hi_user = 0xff
};
/* Array ordering names and codes. */
enum dwarf_array_dim_ordering
{
DW_ORD_row_major = 0,
DW_ORD_col_major = 1
};
/* Access attribute. */
enum dwarf_access_attribute
{
DW_ACCESS_public = 1,
DW_ACCESS_protected = 2,
DW_ACCESS_private = 3
};
/* Visibility. */
enum dwarf_visibility_attribute
{
DW_VIS_local = 1,
DW_VIS_exported = 2,
DW_VIS_qualified = 3
};
/* Virtuality. */
enum dwarf_virtuality_attribute
{
DW_VIRTUALITY_none = 0,
DW_VIRTUALITY_virtual = 1,
DW_VIRTUALITY_pure_virtual = 2
};
/* Case sensitivity. */
enum dwarf_id_case
{
DW_ID_case_sensitive = 0,
DW_ID_up_case = 1,
DW_ID_down_case = 2,
DW_ID_case_insensitive = 3
};
/* Calling convention. */
enum dwarf_calling_convention
{
DW_CC_normal = 0x1,
DW_CC_program = 0x2,
DW_CC_nocall = 0x3,
/* DWARF 5. */
DW_CC_pass_by_reference = 0x4,
DW_CC_pass_by_value = 0x5,
DW_CC_lo_user = 0x40,
DW_CC_hi_user = 0xff,
DW_CC_GNU_renesas_sh = 0x40,
DW_CC_GNU_borland_fastcall_i386 = 0x41,
/* This DW_CC_ value is not currently generated by any toolchain. It is
used internally to GDB to indicate OpenCL C functions that have been
compiled with the IBM XL C for OpenCL compiler and use a non-platform
calling convention for passing OpenCL C vector types. This value may
be changed freely as long as it does not conflict with any other DW_CC_
value defined here. */
DW_CC_GDB_IBM_OpenCL = 0xff
};
/* Inline attribute. */
enum dwarf_inline_attribute
{
DW_INL_not_inlined = 0,
DW_INL_inlined = 1,
DW_INL_declared_not_inlined = 2,
DW_INL_declared_inlined = 3
};
/* Discriminant lists. */
enum dwarf_discrim_list
{
DW_DSC_label = 0,
DW_DSC_range = 1
};
/* Line number opcodes. */
enum dwarf_line_number_ops
{
DW_LNS_extended_op = 0,
DW_LNS_copy = 1,
DW_LNS_advance_pc = 2,
DW_LNS_advance_line = 3,
DW_LNS_set_file = 4,
DW_LNS_set_column = 5,
DW_LNS_negate_stmt = 6,
DW_LNS_set_basic_block = 7,
DW_LNS_const_add_pc = 8,
DW_LNS_fixed_advance_pc = 9,
/* DWARF 3. */
DW_LNS_set_prologue_end = 10,
DW_LNS_set_epilogue_begin = 11,
DW_LNS_set_isa = 12
};
/* Line number extended opcodes. */
enum dwarf_line_number_x_ops
{
DW_LNE_end_sequence = 1,
DW_LNE_set_address = 2,
DW_LNE_define_file = 3,
DW_LNE_set_discriminator = 4,
/* HP extensions. */
DW_LNE_HP_negate_is_UV_update = 0x11,
DW_LNE_HP_push_context = 0x12,
DW_LNE_HP_pop_context = 0x13,
DW_LNE_HP_set_file_line_column = 0x14,
DW_LNE_HP_set_routine_name = 0x15,
DW_LNE_HP_set_sequence = 0x16,
DW_LNE_HP_negate_post_semantics = 0x17,
DW_LNE_HP_negate_function_exit = 0x18,
DW_LNE_HP_negate_front_end_logical = 0x19,
DW_LNE_HP_define_proc = 0x20,
DW_LNE_HP_source_file_correlation = 0x80,
DW_LNE_lo_user = 0x80,
DW_LNE_hi_user = 0xff
};
/* Sub-opcodes for DW_LNE_HP_source_file_correlation. */
enum dwarf_line_number_hp_sfc_ops
{
DW_LNE_HP_SFC_formfeed = 1,
DW_LNE_HP_SFC_set_listing_line = 2,
DW_LNE_HP_SFC_associate = 3
};
/* Content type codes in line table directory_entry_format
and file_name_entry_format sequences. */
enum dwarf_line_number_content_type
{
DW_LNCT_path = 0x1,
DW_LNCT_directory_index = 0x2,
DW_LNCT_timestamp = 0x3,
DW_LNCT_size = 0x4,
DW_LNCT_MD5 = 0x5,
DW_LNCT_lo_user = 0x2000,
DW_LNCT_hi_user = 0x3fff
};
/* Type codes for location list entries. */
enum dwarf_location_list_entry_type
{
DW_LLE_end_of_list = 0x00,
DW_LLE_base_addressx = 0x01,
DW_LLE_startx_endx = 0x02,
DW_LLE_startx_length = 0x03,
DW_LLE_offset_pair = 0x04,
DW_LLE_default_location = 0x05,
DW_LLE_base_address = 0x06,
DW_LLE_start_end = 0x07,
DW_LLE_start_length = 0x08,
/* <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/2017-April/004347.html>
has the proposal for now; only available to list members.
A (possibly updated) copy of the proposal is available at
<http://people.redhat.com/aoliva/papers/sfn/dwarf6-sfn-lvu.txt>. */
DW_LLE_GNU_view_pair = 0x09,
#define DW_LLE_view_pair DW_LLE_GNU_view_pair
/* Former extension for Fission.
See http://gcc.gnu.org/wiki/DebugFission. */
DW_LLE_GNU_end_of_list_entry = 0x00,
DW_LLE_GNU_base_address_selection_entry = 0x01,
DW_LLE_GNU_start_end_entry = 0x02,
DW_LLE_GNU_start_length_entry = 0x03
};
#define DW_CIE_ID 0xffffffff
#define DW64_CIE_ID 0xffffffffffffffffULL
#define DW_CFA_extended 0
#define DW_CHILDREN_no 0x00
#define DW_CHILDREN_yes 0x01
#define DW_ADDR_none 0
/* Source language names and codes. */
enum dwarf_source_language
{
DW_LANG_C89 = 0x0001,
DW_LANG_C = 0x0002,
DW_LANG_Ada83 = 0x0003,
DW_LANG_C_plus_plus = 0x0004,
DW_LANG_Cobol74 = 0x0005,
DW_LANG_Cobol85 = 0x0006,
DW_LANG_Fortran77 = 0x0007,
DW_LANG_Fortran90 = 0x0008,
DW_LANG_Pascal83 = 0x0009,
DW_LANG_Modula2 = 0x000a,
/* DWARF 3. */
DW_LANG_Java = 0x000b,
DW_LANG_C99 = 0x000c,
DW_LANG_Ada95 = 0x000d,
DW_LANG_Fortran95 = 0x000e,
DW_LANG_PLI = 0x000f,
DW_LANG_ObjC = 0x0010,
DW_LANG_ObjC_plus_plus = 0x0011,
DW_LANG_UPC = 0x0012,
DW_LANG_D = 0x0013,
/* DWARF 4. */
DW_LANG_Python = 0x0014,
/* DWARF 5. */
DW_LANG_OpenCL = 0x0015,
DW_LANG_Go = 0x0016,
DW_LANG_Modula3 = 0x0017,
DW_LANG_Haskell = 0x0018,
DW_LANG_C_plus_plus_03 = 0x0019,
DW_LANG_C_plus_plus_11 = 0x001a,
DW_LANG_OCaml = 0x001b,
DW_LANG_Rust = 0x001c,
DW_LANG_C11 = 0x001d,
DW_LANG_Swift = 0x001e,
DW_LANG_Julia = 0x001f,
DW_LANG_Dylan = 0x0020,
DW_LANG_C_plus_plus_14 = 0x0021,
DW_LANG_Fortran03 = 0x0022,
DW_LANG_Fortran08 = 0x0023,
DW_LANG_RenderScript = 0x0024,
DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */
DW_LANG_hi_user = 0xffff, /* Implementation-defined range start. */
/* MIPS. */
DW_LANG_Mips_Assembler = 0x8001,
/* UPC. */
DW_LANG_Upc = 0x8765,
/* HP extensions. */
DW_LANG_HP_Bliss = 0x8003,
DW_LANG_HP_Basic91 = 0x8004,
DW_LANG_HP_Pascal91 = 0x8005,
DW_LANG_HP_IMacro = 0x8006,
DW_LANG_HP_Assembler = 0x8007,
/* Rust extension, but replaced in DWARF 5. */
DW_LANG_Rust_old = 0x9000
};
/* Names and codes for macro information. */
enum dwarf_macinfo_record_type
{
DW_MACINFO_define = 1,
DW_MACINFO_undef = 2,
DW_MACINFO_start_file = 3,
DW_MACINFO_end_file = 4,
DW_MACINFO_vendor_ext = 255
};
/* DW_TAG_defaulted/DW_TAG_GNU_defaulted attributes. */
enum dwarf_defaulted_attribute
{
DW_DEFAULTED_no = 0x00,
DW_DEFAULTED_in_class = 0x01,
DW_DEFAULTED_out_of_class = 0x02
};
/* Names and codes for new style macro information. */
enum dwarf_macro_record_type
{
DW_MACRO_define = 0x01,
DW_MACRO_undef = 0x02,
DW_MACRO_start_file = 0x03,
DW_MACRO_end_file = 0x04,
DW_MACRO_define_strp = 0x05,
DW_MACRO_undef_strp = 0x06,
DW_MACRO_import = 0x07,
DW_MACRO_define_sup = 0x08,
DW_MACRO_undef_sup = 0x09,
DW_MACRO_import_sup = 0x0a,
DW_MACRO_define_strx = 0x0b,
DW_MACRO_undef_strx = 0x0c,
DW_MACRO_lo_user = 0xe0,
DW_MACRO_hi_user = 0xff,
/* Compatibility macros for the GNU .debug_macro extension. */
DW_MACRO_GNU_define = 0x01,
DW_MACRO_GNU_undef = 0x02,
DW_MACRO_GNU_start_file = 0x03,
DW_MACRO_GNU_end_file = 0x04,
DW_MACRO_GNU_define_indirect = 0x05,
DW_MACRO_GNU_undef_indirect = 0x06,
DW_MACRO_GNU_transparent_include = 0x07,
/* Extensions for DWZ multifile.
See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open . */
DW_MACRO_GNU_define_indirect_alt = 0x08,
DW_MACRO_GNU_undef_indirect_alt = 0x09,
DW_MACRO_GNU_transparent_include_alt = 0x0a,
DW_MACRO_GNU_lo_user = 0xe0,
DW_MACRO_GNU_hi_user = 0xff
};
/* Range list entry kinds in .debug_rnglists* section. */
enum dwarf_range_list_entry
{
DW_RLE_end_of_list = 0x00,
DW_RLE_base_addressx = 0x01,
DW_RLE_startx_endx = 0x02,
DW_RLE_startx_length = 0x03,
DW_RLE_offset_pair = 0x04,
DW_RLE_base_address = 0x05,
DW_RLE_start_end = 0x06,
DW_RLE_start_length = 0x07
};
/* @@@ For use with GNU frame unwind information. */
#define DW_EH_PE_absptr 0x00
#define DW_EH_PE_omit 0xff
#define DW_EH_PE_uleb128 0x01
#define DW_EH_PE_udata2 0x02
#define DW_EH_PE_udata4 0x03
#define DW_EH_PE_udata8 0x04
#define DW_EH_PE_sleb128 0x09
#define DW_EH_PE_sdata2 0x0A
#define DW_EH_PE_sdata4 0x0B
#define DW_EH_PE_sdata8 0x0C
#define DW_EH_PE_signed 0x08
#define DW_EH_PE_pcrel 0x10
#define DW_EH_PE_textrel 0x20
#define DW_EH_PE_datarel 0x30
#define DW_EH_PE_funcrel 0x40
#define DW_EH_PE_aligned 0x50
#define DW_EH_PE_indirect 0x80
/* Codes for the debug sections in a dwarf package (.dwp) file.
(From the pre-standard formats Extensions for Fission.
See http://gcc.gnu.org/wiki/DebugFissionDWP). */
enum dwarf_sect
{
DW_SECT_INFO = 1,
DW_SECT_TYPES = 2,
DW_SECT_ABBREV = 3,
DW_SECT_LINE = 4,
DW_SECT_LOC = 5,
DW_SECT_STR_OFFSETS = 6,
DW_SECT_MACINFO = 7,
DW_SECT_MACRO = 8,
DW_SECT_MAX = 8
};
/* Codes for the debug sections in a dwarf package (.dwp) file.
(From the official DWARF v5 spec.
See http://dwarfstd.org/doc/DWARF5.pdf, section 7.3.5). */
enum dwarf_sect_v5
{
DW_SECT_INFO_V5 = 1,
DW_SECT_RESERVED_V5 = 2,
DW_SECT_ABBREV_V5 = 3,
DW_SECT_LINE_V5 = 4,
DW_SECT_LOCLISTS_V5 = 5,
DW_SECT_STR_OFFSETS_V5 = 6,
DW_SECT_MACRO_V5 = 7,
DW_SECT_RNGLISTS_V5 = 8,
DW_SECT_MAX_V5 = 8
};
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Return the name of a DW_TAG_ constant, or NULL if the value is not
recognized. */
extern const char *get_DW_TAG_name (unsigned int tag);
/* Return the name of a DW_AT_ constant, or NULL if the value is not
recognized. */
extern const char *get_DW_AT_name (unsigned int attr);
/* Return the name of a DW_FORM_ constant, or NULL if the value is not
recognized. */
extern const char *get_DW_FORM_name (unsigned int form);
/* Return the name of a DW_OP_ constant, or NULL if the value is not
recognized. */
extern const char *get_DW_OP_name (unsigned int op);
/* Return the name of a DW_ATE_ constant, or NULL if the value is not
recognized. */
extern const char *get_DW_ATE_name (unsigned int enc);
/* Return the name of a DW_CFA_ constant, or NULL if the value is not
recognized. */
extern const char *get_DW_CFA_name (unsigned int opc);
/* Return the name of a DW_IDX_ constant, or NULL if the value is not
recognized. */
extern const char *get_DW_IDX_name (unsigned int idx);
/* Return the name of a DW_UT_ constant, or NULL if the value is not
recognized. */
extern const char *get_DW_UT_name (unsigned int ut);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _DWARF2_H */

View File

@ -1,118 +0,0 @@
/* Names of various DWARF tags.
Copyright (C) 2012-2021 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC 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, or (at your option)
any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combined
executable.)
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "dwarf2.h"
#define DW_FIRST_TAG(name, value) \
const char *get_DW_TAG_name (unsigned int tag) \
{ switch (tag) { \
DW_TAG (name, value)
#define DW_END_TAG } return 0; }
#define DW_FIRST_FORM(name, value) \
const char *get_DW_FORM_name (unsigned int form) \
{ switch (form) { \
DW_FORM (name, value)
#define DW_END_FORM } return 0; }
#define DW_FIRST_AT(name, value) \
const char *get_DW_AT_name (unsigned int attr) { \
switch (attr) { \
DW_AT (name, value)
#define DW_END_AT } return 0; }
#define DW_FIRST_OP(name, value) \
const char *get_DW_OP_name (unsigned int op) { \
switch (op) { \
DW_OP (name, value)
#define DW_END_OP } return 0; }
#define DW_FIRST_ATE(name, value) \
const char *get_DW_ATE_name (unsigned int enc) { \
switch (enc) { \
DW_ATE (name, value)
#define DW_END_ATE } return 0; }
#define DW_FIRST_CFA(name, value) \
const char *get_DW_CFA_name (unsigned int opc) { \
switch (opc) { \
DW_CFA (name, value)
#define DW_END_CFA } return 0; }
#define DW_FIRST_IDX(name, value) \
const char *get_DW_IDX_name (unsigned int idx) { \
switch (idx) { \
DW_IDX (name, value)
#define DW_END_IDX } return 0; }
#define DW_FIRST_UT(name, value) \
const char *get_DW_UT_name (unsigned int ut) { \
switch (ut) { \
DW_UT (name, value)
#define DW_END_UT } return 0; }
#define DW_TAG(name, value) case name: return # name ;
#define DW_TAG_DUP(name, value)
#define DW_FORM(name, value) case name: return # name ;
#define DW_AT(name, value) case name: return # name ;
#define DW_AT_DUP(name, value)
#define DW_OP(name, value) case name: return # name ;
#define DW_OP_DUP(name, value)
#define DW_ATE(name, value) case name: return # name ;
#define DW_ATE_DUP(name, value)
#define DW_CFA(name, value) case name: return # name ;
#define DW_CFA_DUP(name, value)
#define DW_IDX(name, value) case name: return # name ;
#define DW_IDX_DUP(name, value)
#define DW_UT(name, value) case name: return # name ;
#include "dwarf2.def"
#undef DW_FIRST_TAG
#undef DW_END_TAG
#undef DW_FIRST_FORM
#undef DW_END_FORM
#undef DW_FIRST_AT
#undef DW_END_AT
#undef DW_FIRST_OP
#undef DW_END_OP
#undef DW_FIRST_ATE
#undef DW_END_ATE
#undef DW_FIRST_CFA
#undef DW_END_CFA
#undef DW_FIRST_IDX
#undef DW_END_IDX
#undef DW_END_UT
#undef DW_TAG
#undef DW_TAG_DUP
#undef DW_FORM
#undef DW_AT
#undef DW_AT_DUP
#undef DW_OP
#undef DW_OP_DUP
#undef DW_ATE
#undef DW_ATE_DUP
#undef DW_CFA
#undef DW_CFA_DUP
#undef DW_IDX
#undef DW_IDX_DUP

207
dwz.1
View File

@ -1,207 +0,0 @@
.TH dwz 1 "15 Feb 2021"
.SH NAME
dwz \- DWARF optimization and duplicate removal tool
.SH SYNOPSIS
dwz
.RB [OPTION...]\ [FILES]
.SH DESCRIPTION
\fBdwz\fR is a program that attempts to optimize DWARF debugging information
contained in ELF shared libraries and ELF executables for size, by
replacing DWARF information representation with equivalent smaller
representation where possible and by reducing the amount of duplication
using techniques from DWARF standard appendix E - creating
\fIDW_TAG_partial_unit\fR
compilation units (CUs) for duplicated information and using
\fIDW_TAG_imported_unit\fR
to import it into each CU that needs it.
The tool handles DWARF 32-bit format debugging sections of versions 2,
3, 4, most of version 5 and GNU extensions on top of those. It is
strongly recommended to use at least DWARF 3, but using DWARF 4 or
higher will work much better.
While most of DWARF 5 is supported dwz doesn't yet generate spec
compliant DWARF Supplementary Object Files (DWARF 5, section
7.3.6) unless the \fI--dwarf-5\fR option is used. Instead of a
\fI.debug_sup\fR section it will generate by default a \fI.gnu_debugaltlink\fR
section. And it will use the \fIDW_FORM_GNU_strp_alt\fR and
\fIDW_FORM_GNU_reg_alt\fR, instead of \fIDW_FORM_strp_sup\fR
and \fIDW_FORM_ref_sup\fR to keep compatibility with existing DWARF
consumers.
DWARF 4 \fI.debug_types\fR are supported, but DWARF 5 \fIDW_UT_type\fR
units are not. Likewise \fI.gdb_index\fR is supported, but the DWARF 5
\fI.debug_names\fR is not. Also some forms and sections that are only
emitted by GCC when generating Split DWARF, \fIDW_FORM_strx\fR and
\fI.debug_str_offsets\fR, \fIDW_FORM_addrx\fR and \fI.debug_addr\fR,
\fIDW_FORM_rnglistx\fR and \fIDW_FORM_loclistsx\fR, are not supported
yet.
The tool has two main modes of operation, without the
\fI-m\fR option it attempts to optimize DWARF debugging information in each
given object (executable or shared library) individually, with the
\fI-m\fR option it afterwards attempts to optimize even more by moving
DWARF debugging information entries (DIEs), strings and macro descriptions
duplicated in more than one object into a newly created ELF ET_REL
object whose filename is given as
\fI-m\fR
option argument. The debug sections in the executables and shared libraries
specified on the command line are then modified again, referring to
the entities in the newly created object.
.SH OPTIONS
.TP
.B \-m\ FILE \-\-multifile FILE
Multifile mode.
After processing all named executables and shared libraries, attempt to
create ELF object
\fIFILE\fR
and put debugging information duplicated in more than one object there,
afterwards optimize each named executable or shared library even further
if possible.
.TP
.B \-h\ \-\-hardlink
Look for executables or shared libraries hardlinked together, instead
of rewriting them individually rewrite just one of them and hardlink the
rest to the first one again.
.TP
.B \-M NAME \-\-multifile-name NAME
Specify the name of the common file that should be put into the
\fI.gnu_debugaltlink\fR section alongside with its build ID. By default
\fBdwz\fR puts there the argument of the \fB-m\fR option.
.TP
.B \-r \-\-relative
Specify that the name of the common file to be put into the
\fI.gnu_debugaltlink\fR
section is supposed to be relative path from the directory containing
the executable or shared library to the file named in the argument
of the \fB-m\fR option. Either \fB-M\fR or \fB-r\fR
option can be specified, but not both.
.TP
.B \-p N \-\-multifile-pointer-size <N|auto|native>
Specify the pointer size of the multifile, in bytes. If auto, use the
pointer size of the files, provided they match. If native, use native pointer
size, as specified in the help message.
.TP
.B \-p <l|b|auto> \-\-multifile-endian <l|b|auto|native>
Specify the endianity of the multifile. If auto, use the endianity of
the files, provided they match. If native, use native endianity, as specified
in the help message.
.TP
.B \-q \-\-quiet
Silence up some of the most common messages.
.TP
.B \-o FILE \-\-output FILE
This option instructs
\fBdwz\fR not to overwrite the specified file, but instead store the new content
into \fBFILE\fR. Nothing is written if \fBdwz\fR
exits with non-zero exit code. Can be used only with a single executable
or shared library (if there are no arguments at all,
\fIa.out\fR
is assumed).
.TP
.B \-l <COUNT|none> \-\-low\-mem\-die\-limit <COUNT|none>
Handle executables or shared libraries containing more than
\fICOUNT\fR debugging information entries in their \fI.debug_info\fR
section using a slower and more memory usage friendly mode and don't
attempt to optimize that object in multifile mode.
The default is 10 million DIEs. There is a risk that for very large
amounts of debugging information in a single shared library or executable
there might not be enough memory (especially when \fBdwz\fR
tool is 32-bit binary, it might run out of available virtual address
space even sooner). Specifying none as argument disables the limit.
.TP
.B \-L <COUNT|none> \-\-max\-die\-limit <COUNT|none>
Don't attempt to optimize executables or shared libraries
containing more than
\fICOUNT\fR DIEs at all. The default is 50 million DIEs. Specifying none as
argument disables the limit.
.TP
.B \-5 \-\-dwarf\-5
Emit standard DWARF 5 Supplementary Object Files with \fI.debug_sup\fR and
corresponding forms, instead of the GNU extension \fI.gnu_debugaltlink\fR
and corresponding forms.
.TP
.B \-j <N> \-\-jobs <N>
Process \fIN\fR files in parallel. The default is processors / 2. Disabled
when multifile is used.
.TP
.B \-\-odr / \-\-no-odr
.B Experimental.
Enable/disable One-Definition-Rule optimization for C++ compilation units.
This optimization causes struct/union/class DIEs with the same name to be
considered equal. This has the effect that DIEs referring to distinct DIEs
representing the same type (like f.i. pointer type DIEs) are considered equal,
and may be deduplicated. The status of this optimization is experimental.
It's disabled in low-mem mode.
Disabled by default.
.TP
.B \-\-odr-mode=<basic|link>
Set the One-Definition-Rule optimization aggressiveness: basic or link.
When using the link setting, the optimization will attempt to replace
declarations of a struct/union/class with a corresponding definition. When
using the basic setting, that part of the optimization is disabled.
In normal operation, the link setting should be used. The basic setting is
provided only as fallback in case of problems with the link setting. Set to
link by default.
.TP
.B \-\-import-optimize / \-\-no-import-optimize
Enable/disable optimization that reduces the number of
\fIDW_TAG_imported_unit\fR DIEs generated to import the partial units created
by \fBdwz\fR. Disabling the optimization can be used to work around problems
in the optimization, or to make it easier to observe which CU imports which
PU.
Enabled by default.
.TP
.B \-? \-\-help
Print short help and exit.
.TP
.B \-v \-\-version
Print version number and short licensing notice and exit.
.SH ARGUMENTS
Command-line arguments should be the executables, shared libraries
or their stripped to file separate debug information objects.
.SH EXAMPLES
.RS
$ dwz -m .dwz/foobar-1.2.debug -rh \\
bin/foo.debug bin/foo2.debug foo/lib/libbar.so.debug
.RE
will attempt to optimize debugging information in
\fIbin/foo.debug\fR, \fIbin/foo2.debug\fR and
\fIlib/libbar.so.debug\fR (by modifying the files in place) and
when beneficial also will create \fI.dwz/foobar-1.2.debug\fR file.
\fI.gnu_debugaltlink\fR section in the first two files will refer to
\fI../.dwz/foobar-1.2.debug\fR and in the last file to
\fI../../.dwz/foobar-1.2.debug\fR. If e.g.
\fIbin/foo.debug\fR and \fIbin/foo2.debug\fR were hardlinked
together initially, they will be hardlinked again and for multifile
optimizations considered just as a single file rather than two.
.RS
$ dwz -o foo.dwz foo
.RE
will not modify \fIfoo\fR
but instead store the ELF object with optimized debugging information
if successful into \fIfoo.dwz\fR
file it creates.
.RS
$ dwz *.debug foo/*.debug
.RE
will attempt to optimize debugging information in *.debug and foo/*.debug
files, optimizing each file individually in place.
.RS
$ dwz
.RE
is equivalent to \fIdwz a.out\fR command.
.SH SEE ALSO
.BR http://dwarfstd.org/doc/DWARF4.pdf
,
.BR http://dwarfstd.org/doc/DWARF5.pdf
,
.BR gdb (1).
.SH AUTHORS
Jakub Jelinek <jakub@redhat.com>,
Tom de Vries <tdevries@suse.de>,
Mark Wielaard <mark@klomp.org>
.SH BUGS
Use the Bugzilla link of the project web page or our mailing list.
.nh
.BR https://sourceware.org/dwz/ ", " <dwz@sourceware.org> .

16872
dwz.c

File diff suppressed because it is too large Load Diff

BIN
dwz_0.14.orig.tar.xz.delta Normal file

Binary file not shown.

1
dwz_0.14.orig.tar.xz.id Normal file
View File

@ -0,0 +1 @@
c6cf2da93dce51d928bd6061753257b589d07050

BIN
dwz_0.15.orig.tar.xz.delta Normal file

Binary file not shown.

1
dwz_0.15.orig.tar.xz.id Normal file
View File

@ -0,0 +1 @@
cc0c7147f472fecbc93add134f5c0e5c1bb72529

628
hashtab.c
View File

@ -1,628 +0,0 @@
/* An expandable hash tables datatype.
Copyright (C) 1999-2016 Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* This package implements basic hash table functionality. It is possible
to search for an entry, create an entry and destroy an entry.
Elements in the table are generic pointers.
The size of the table is not fixed; if the occupancy of the table
grows too high the hash table will be expanded.
The abstract data implementation is based on generalized Algorithm D
from Knuth's book "The art of computer programming". Hash table is
expanded by creation of new hash table and transferring elements from
the old table to the new table. */
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "hashtab.h"
#include <endian.h>
#if __BYTE_ORDER == __BIG_ENDIAN
# define WORDS_BIGENDIAN 1
#endif
/* This macro defines reserved value for empty table entry. */
#define EMPTY_ENTRY ((void *) 0)
/* This macro defines reserved value for table entry which contained
a deleted element. */
#define DELETED_ENTRY ((void *) 1)
static hashval_t hash_pointer (const void *);
static int eq_pointer (const void *, const void *);
static int htab_expand (htab_t);
static void **find_empty_slot_for_expand (htab_t, hashval_t);
/* At some point, we could make these be NULL, and modify the
hash-table routines to handle NULL specially; that would avoid
function-call overhead for the common case of hashing pointers. */
htab_hash htab_hash_pointer = hash_pointer;
htab_eq htab_eq_pointer = eq_pointer;
/* The following function returns a nearest prime number which is
greater than N, and near a power of two. */
unsigned long
higher_prime_number (n)
unsigned long n;
{
/* These are primes that are near, but slightly smaller than, a
power of two. */
static unsigned long primes[] = {
(unsigned long) 7,
(unsigned long) 13,
(unsigned long) 31,
(unsigned long) 61,
(unsigned long) 127,
(unsigned long) 251,
(unsigned long) 509,
(unsigned long) 1021,
(unsigned long) 2039,
(unsigned long) 4093,
(unsigned long) 8191,
(unsigned long) 16381,
(unsigned long) 32749,
(unsigned long) 65521,
(unsigned long) 131071,
(unsigned long) 262139,
(unsigned long) 524287,
(unsigned long) 1048573,
(unsigned long) 2097143,
(unsigned long) 4194301,
(unsigned long) 8388593,
(unsigned long) 16777213,
(unsigned long) 33554393,
(unsigned long) 67108859,
(unsigned long) 134217689,
(unsigned long) 268435399,
(unsigned long) 536870909,
(unsigned long) 1073741789,
(unsigned long) 2147483647,
/* 4294967291L */
((unsigned long) 2147483647) + ((unsigned long) 2147483644),
};
unsigned long* low = &primes[0];
unsigned long* high = &primes[sizeof(primes) / sizeof(primes[0])];
while (low != high)
{
unsigned long* mid = low + (high - low) / 2;
if (n > *mid)
low = mid + 1;
else
high = mid;
}
/* If we've run out of primes, abort. */
if (n > *low)
{
fprintf (stderr, "Cannot find prime bigger than %lu\n", n);
abort ();
}
return *low;
}
/* Returns a hash code for P. */
static hashval_t
hash_pointer (p)
const void * p;
{
return (hashval_t) ((long)p >> 3);
}
/* Returns non-zero if P1 and P2 are equal. */
static int
eq_pointer (p1, p2)
const void * p1;
const void * p2;
{
return p1 == p2;
}
/* This function creates table with length slightly longer than given
source length. The created hash table is initiated as empty (all the
hash table entries are EMPTY_ENTRY). The function returns the created
hash table. Memory allocation may fail; it may return NULL. */
htab_t
htab_try_create (size, hash_f, eq_f, del_f)
size_t size;
htab_hash hash_f;
htab_eq eq_f;
htab_del del_f;
{
htab_t result;
size = higher_prime_number (size);
result = (htab_t) calloc (1, sizeof (struct htab));
if (result == NULL)
return NULL;
result->entries = (void **) calloc (size, sizeof (void *));
if (result->entries == NULL)
{
free (result);
return NULL;
}
result->size = size;
result->hash_f = hash_f;
result->eq_f = eq_f;
result->del_f = del_f;
result->return_allocation_failure = 1;
return result;
}
/* This function frees all memory allocated for given hash table.
Naturally the hash table must already exist. */
void
htab_delete (htab)
htab_t htab;
{
int i;
if (htab->del_f)
for (i = htab->size - 1; i >= 0; i--)
if (htab->entries[i] != EMPTY_ENTRY
&& htab->entries[i] != DELETED_ENTRY)
(*htab->del_f) (htab->entries[i]);
free (htab->entries);
free (htab);
}
/* This function clears all entries in the given hash table. */
void
htab_empty (htab)
htab_t htab;
{
int i;
if (htab->del_f)
for (i = htab->size - 1; i >= 0; i--)
if (htab->entries[i] != EMPTY_ENTRY
&& htab->entries[i] != DELETED_ENTRY)
(*htab->del_f) (htab->entries[i]);
memset (htab->entries, 0, htab->size * sizeof (void *));
htab->n_deleted = 0;
htab->n_elements = 0;
}
/* Similar to htab_find_slot, but without several unwanted side effects:
- Does not call htab->eq_f when it finds an existing entry.
- Does not change the count of elements/searches/collisions in the
hash table.
This function also assumes there are no deleted entries in the table.
HASH is the hash value for the element to be inserted. */
static void **
find_empty_slot_for_expand (htab, hash)
htab_t htab;
hashval_t hash;
{
size_t size = htab->size;
unsigned int index = hash % size;
void **slot = htab->entries + index;
hashval_t hash2;
if (*slot == EMPTY_ENTRY)
return slot;
else if (*slot == DELETED_ENTRY)
abort ();
hash2 = 1 + hash % (size - 2);
for (;;)
{
index += hash2;
if (index >= size)
index -= size;
slot = htab->entries + index;
if (*slot == EMPTY_ENTRY)
return slot;
else if (*slot == DELETED_ENTRY)
abort ();
}
}
/* The following function changes size of memory allocated for the
entries and repeatedly inserts the table elements. The occupancy
of the table after the call will be about 50%. Naturally the hash
table must already exist. Remember also that the place of the
table entries is changed. If memory allocation failures are allowed,
this function will return zero, indicating that the table could not be
expanded. If all goes well, it will return a non-zero value. */
static int
htab_expand (htab)
htab_t htab;
{
void **oentries;
void **olimit;
void **p;
oentries = htab->entries;
olimit = oentries + htab->size;
htab->size = higher_prime_number (htab->size * 2);
if (htab->return_allocation_failure)
{
void **nentries = (void **) calloc (htab->size, sizeof (void **));
if (nentries == NULL)
return 0;
htab->entries = nentries;
}
htab->n_elements -= htab->n_deleted;
htab->n_deleted = 0;
p = oentries;
do
{
void * x = *p;
if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
{
void **q = find_empty_slot_for_expand (htab, (*htab->hash_f) (x));
*q = x;
}
p++;
}
while (p < olimit);
free (oentries);
return 1;
}
/* This function searches for a hash table entry equal to the given
element. It cannot be used to insert or delete an element. */
void *
htab_find_with_hash (htab, element, hash)
htab_t htab;
const void * element;
hashval_t hash;
{
unsigned int index;
hashval_t hash2;
size_t size;
void * entry;
htab->searches++;
size = htab->size;
index = hash % size;
entry = htab->entries[index];
if (entry == EMPTY_ENTRY
|| (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element)))
return entry;
hash2 = 1 + hash % (size - 2);
for (;;)
{
htab->collisions++;
index += hash2;
if (index >= size)
index -= size;
entry = htab->entries[index];
if (entry == EMPTY_ENTRY
|| (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element)))
return entry;
}
}
/* Like htab_find_slot_with_hash, but compute the hash value from the
element. */
void *
htab_find (htab, element)
htab_t htab;
const void * element;
{
return htab_find_with_hash (htab, element, (*htab->hash_f) (element));
}
/* This function searches for a hash table slot containing an entry
equal to the given element. To delete an entry, call this with
INSERT = 0, then call htab_clear_slot on the slot returned (possibly
after doing some checks). To insert an entry, call this with
INSERT = 1, then write the value you want into the returned slot.
When inserting an entry, NULL may be returned if memory allocation
fails. */
void **
htab_find_slot_with_hash (htab, element, hash, insert)
htab_t htab;
const void * element;
hashval_t hash;
enum insert_option insert;
{
void **first_deleted_slot;
unsigned int index;
hashval_t hash2;
size_t size;
void * entry;
if (insert == INSERT && htab->size * 3 <= htab->n_elements * 4
&& htab_expand (htab) == 0)
return NULL;
size = htab->size;
index = hash % size;
htab->searches++;
first_deleted_slot = NULL;
entry = htab->entries[index];
if (entry == EMPTY_ENTRY)
goto empty_entry;
else if (entry == DELETED_ENTRY)
first_deleted_slot = &htab->entries[index];
else if ((*htab->eq_f) (entry, element))
return &htab->entries[index];
hash2 = 1 + hash % (size - 2);
for (;;)
{
htab->collisions++;
index += hash2;
if (index >= size)
index -= size;
entry = htab->entries[index];
if (entry == EMPTY_ENTRY)
goto empty_entry;
else if (entry == DELETED_ENTRY)
{
if (!first_deleted_slot)
first_deleted_slot = &htab->entries[index];
}
else if ((*htab->eq_f) (entry, element))
return &htab->entries[index];
}
empty_entry:
if (insert == NO_INSERT)
return NULL;
htab->n_elements++;
if (first_deleted_slot)
{
*first_deleted_slot = EMPTY_ENTRY;
return first_deleted_slot;
}
return &htab->entries[index];
}
/* Like htab_find_slot_with_hash, but compute the hash value from the
element. */
void **
htab_find_slot (htab, element, insert)
htab_t htab;
const void * element;
enum insert_option insert;
{
return htab_find_slot_with_hash (htab, element, (*htab->hash_f) (element),
insert);
}
/* This function deletes an element with the given value from hash
table. If there is no matching element in the hash table, this
function does nothing. */
void
htab_remove_elt (htab, element)
htab_t htab;
void * element;
{
void **slot;
slot = htab_find_slot (htab, element, NO_INSERT);
if (*slot == EMPTY_ENTRY)
return;
if (htab->del_f)
(*htab->del_f) (*slot);
*slot = DELETED_ENTRY;
htab->n_deleted++;
}
/* This function clears a specified slot in a hash table. It is
useful when you've already done the lookup and don't want to do it
again. */
void
htab_clear_slot (htab, slot)
htab_t htab;
void **slot;
{
if (slot < htab->entries || slot >= htab->entries + htab->size
|| *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY)
abort ();
if (htab->del_f)
(*htab->del_f) (*slot);
*slot = DELETED_ENTRY;
htab->n_deleted++;
}
/* This function scans over the entire hash table calling
CALLBACK for each live entry. If CALLBACK returns false,
the iteration stops. INFO is passed as CALLBACK's second
argument. */
void
htab_traverse (htab, callback, info)
htab_t htab;
htab_trav callback;
void * info;
{
void **slot = htab->entries;
void **limit = slot + htab->size;
do
{
void * x = *slot;
if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
if (!(*callback) (slot, info))
break;
}
while (++slot < limit);
}
/* Return the current size of given hash table. */
size_t
htab_size (htab)
htab_t htab;
{
return htab->size;
}
/* Return the current number of elements in given hash table. */
size_t
htab_elements (htab)
htab_t htab;
{
return htab->n_elements - htab->n_deleted;
}
/* Return the fraction of fixed collisions during all work with given
hash table. */
double
htab_collisions (htab)
htab_t htab;
{
if (htab->searches == 0)
return 0.0;
return (double) htab->collisions / (double) htab->searches;
}
#ifndef NDEBUG
void
htab_dump (htab, name, dumpfn)
htab_t htab;
const char *name;
htab_dumpfn dumpfn;
{
FILE *f = fopen (name, "w");
size_t i, j;
if (f == NULL)
abort ();
fprintf (f, "size %zd n_elements %zd n_deleted %zd\n",
htab->size, htab->n_elements, htab->n_deleted);
for (i = 0; i < htab->size; ++i)
{
if (htab->entries [i] == EMPTY_ENTRY
|| htab->entries [i] == DELETED_ENTRY)
{
for (j = i + 1; j < htab->size; ++j)
if (htab->entries [j] != htab->entries [i])
break;
fprintf (f, "%c%zd\n",
htab->entries [i] == EMPTY_ENTRY ? 'E' : 'D',
j - i);
i = j - 1;
}
else
{
fputc ('V', f);
(*dumpfn) (f, htab->entries [i]);
}
}
fclose (f);
}
void
htab_restore (htab, name, restorefn)
htab_t htab;
const char *name;
htab_restorefn restorefn;
{
FILE *f = fopen (name, "r");
size_t size, n_elements, n_deleted, i, j, k;
int c;
if (f == NULL)
abort ();
if (fscanf (f, "size %zd n_elements %zd n_deleted %zd\n",
&size, &n_elements, &n_deleted) != 3)
abort ();
htab_empty (htab);
free (htab->entries);
htab->entries = (void **) calloc (size, sizeof (void *));
if (htab->entries == NULL)
abort ();
htab->size = size;
htab->n_elements = n_elements;
htab->n_deleted = n_deleted;
for (i = 0; i < htab->size; ++i)
{
switch ((c = fgetc (f)))
{
case 'E':
case 'D':
if (fscanf (f, "%zd\n", &j) != 1)
abort ();
if (i + j > htab->size)
abort ();
if (c == 'D')
for (k = i; k < i + j; ++k)
htab->entries [k] = DELETED_ENTRY;
i += j - 1;
break;
case 'V':
htab->entries [i] = (*restorefn) (f);
break;
default:
abort ();
}
}
fclose (f);
}
#endif

160
hashtab.h
View File

@ -1,160 +0,0 @@
/* An expandable hash tables datatype.
Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2009, 2010
Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* This package implements basic hash table functionality. It is possible
to search for an entry, create an entry and destroy an entry.
Elements in the table are generic pointers.
The size of the table is not fixed; if the occupancy of the table
grows too high the hash table will be expanded.
The abstract data implementation is based on generalized Algorithm D
from Knuth's book "The art of computer programming". Hash table is
expanded by creation of new hash table and transferring elements from
the old table to the new table. */
#ifndef __HASHTAB_H__
#define __HASHTAB_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* The type for a hash code. */
typedef unsigned int hashval_t;
/* Callback function pointer types. */
/* Calculate hash of a table entry. */
typedef hashval_t (*htab_hash) (const void *);
/* Compare a table entry with a possible entry. The entry already in
the table always comes first, so the second element can be of a
different type (but in this case htab_find and htab_find_slot
cannot be used; instead the variants that accept a hash value
must be used). */
typedef int (*htab_eq) (const void *, const void *);
/* Cleanup function called whenever a live element is removed from
the hash table. */
typedef void (*htab_del) (void *);
/* Function called by htab_traverse for each live element. The first
arg is the slot of the element (which can be passed to htab_clear_slot
if desired), the second arg is the auxiliary pointer handed to
htab_traverse. Return 1 to continue scan, 0 to stop. */
typedef int (*htab_trav) (void **, void *);
/* Hash tables are of the following type. The structure
(implementation) of this type is not needed for using the hash
tables. All work with hash table should be executed only through
functions mentioned below. */
struct htab
{
/* Pointer to hash function. */
htab_hash hash_f;
/* Pointer to comparison function. */
htab_eq eq_f;
/* Pointer to cleanup function. */
htab_del del_f;
/* Table itself. */
void **entries;
/* Current size (in entries) of the hash table */
size_t size;
/* Current number of elements including also deleted elements */
size_t n_elements;
/* Current number of deleted elements in the table */
size_t n_deleted;
/* The following member is used for debugging. Its value is number
of all calls of `htab_find_slot' for the hash table. */
unsigned int searches;
/* The following member is used for debugging. Its value is number
of collisions fixed for time of work with the hash table. */
unsigned int collisions;
/* This is non-zero if we are allowed to return NULL for function calls
that allocate memory. */
int return_allocation_failure;
};
typedef struct htab *htab_t;
/* An enum saying whether we insert into the hash table or not. */
enum insert_option {NO_INSERT, INSERT};
/* The prototypes of the package functions. */
/* This function is like htab_create, but may return NULL if memory
allocation fails, and also signals that htab_find_slot_with_hash and
htab_find_slot are allowed to return NULL when inserting. */
extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del);
extern void htab_delete (htab_t);
extern void htab_empty (htab_t);
extern void *htab_find (htab_t, const void *);
extern void **htab_find_slot (htab_t, const void *, enum insert_option);
extern void *htab_find_with_hash (htab_t, const void *, hashval_t);
extern void **htab_find_slot_with_hash (htab_t, const void *, hashval_t,
enum insert_option);
extern void htab_clear_slot (htab_t, void **);
extern void htab_remove_elt (htab_t, void *);
extern void htab_traverse (htab_t, htab_trav, void *);
extern size_t htab_size (htab_t);
extern size_t htab_elements (htab_t);
extern double htab_collisions (htab_t);
/* Utility function. */
unsigned long higher_prime_number (unsigned long);
/* A hash function for pointers. */
extern htab_hash htab_hash_pointer;
/* An equality function for pointers. */
extern htab_eq htab_eq_pointer;
#ifndef NDEBUG
#include <stdio.h>
typedef void (*htab_dumpfn) (FILE *, const void *);
typedef void *(*htab_restorefn) (FILE *);
extern void htab_dump (htab_t, const char *, htab_dumpfn);
extern void htab_restore (htab_t, const char *, htab_restorefn);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __HASHTAB_H */

View File

@ -1,126 +0,0 @@
/* Various iterators.
Copyright (C) 2019 SUSE LLC.
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, 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; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* CU iterators. */
#define FOREACH_CU(CU) \
for (CU = first_cu; CU; CU = CU->cu_next)
#define FOREACH_CU_PU(CU) \
for (CU = first_cu; CU && CU->cu_kind == CU_PU; CU = CU->cu_next)
#define FOREACH_CU_NORMAL(CU) \
for (CU = first_cu; CU && CU->cu_kind != CU_TYPES; CU = CU->cu_next) \
if (CU->cu_kind == CU_NORMAL)
#define FOREACH_CU_TYPES(CU) \
for (CU = first_cu; CU; CU = CU->cu_next) \
if (CU->cu_kind == CU_TYPES) \
/* Function that describes a depth-first traversal path visiting all dies. */
static inline dw_die_ref FORCE_INLINE
next_die (dw_die_ref die)
{
if (die->die_child != NULL)
return die->die_child;
while (1)
{
if (die->die_sib != NULL)
return die->die_sib;
if (die->die_root)
return NULL;
die = die->die_parent;
}
}
/* Function that describes a depth-first traversal path visiting all toplevel
dies. */
static inline dw_die_ref FORCE_INLINE
next_toplevel_die (dw_die_ref die)
{
if (die->die_child != NULL && die->die_child->die_toplevel)
return die->die_child;
while (1)
{
if (die->die_sib != NULL && die->die_sib->die_toplevel)
return die->die_sib;
if (die->die_root)
return NULL;
die = die->die_parent;
}
}
/* DIE_IN_CU iterators. */
#define FOREACH_DIE_IN_CU(DIE, CU) \
for (DIE = CU->cu_die; DIE; DIE = next_die (DIE))
#define FOREACH_TOPLEVEL_DIE_IN_CU(DIE, CU) \
for (DIE = CU->cu_die; DIE; DIE = next_toplevel_die (DIE))
#define FOREACH_LOW_TOPLEVEL_DIE_IN_CU(DIE, CU) \
FOREACH_TOPLEVEL_DIE_IN_CU (DIE, CU) \
if (!(die->die_root || die->die_named_namespace))
/* DIE iterators. */
#define FOREACH_DIE(CU, DIE) \
FOREACH_CU (CU) \
FOREACH_DIE_IN_CU (DIE, CU)
#define FOREACH_TOPLEVEL_DIE(CU, DIE) \
FOREACH_CU (CU) \
FOREACH_TOPLEVEL_DIE_IN_CU (DIE, CU)
#define FOREACH_LOW_TOPLEVEL_DIE(CU, DIE) \
FOREACH_CU (CU) \
FOREACH_LOW_TOPLEVEL_DIE_IN_CU (DIE, CU)
#define FOREACH_CU_PU_TOPLEVEL_DIE(CU, DIE) \
FOREACH_CU_PU (CU) \
FOREACH_TOPLEVEL_DIE_IN_CU (DIE, CU)
#define FOREACH_CU_NORMAL_TOPLEVEL_DIE(CU, DIE) \
FOREACH_CU_NORMAL (CU) \
FOREACH_TOPLEVEL_DIE_IN_CU (DIE, CU)
#define FOREACH_CU_TYPES_TOPLEVEL_DIE(CU, DIE) \
FOREACH_CU_TYPES (CU) \
FOREACH_TOPLEVEL_DIE_IN_CU (DIE, CU)
#define FOREACH_CU_PU_LOW_TOPLEVEL_DIE(CU, DIE) \
FOREACH_CU_PU (CU) \
FOREACH_LOW_TOPLEVEL_DIE_IN_CU (DIE, CU)
#define FOREACH_CU_NORMAL_LOW_TOPLEVEL_DIE(CU, DIE) \
FOREACH_CU_NORMAL (CU) \
FOREACH_LOW_TOPLEVEL_DIE_IN_CU (DIE, CU)
#define FOREACH_CU_TYPES_LOW_TOPLEVEL_DIE(CU, DIE) \
FOREACH_CU_TYPES (CU) \
FOREACH_LOW_TOPLEVEL_DIE_IN_CU (DIE, CU)

103
pool.c
View File

@ -1,103 +0,0 @@
/* Copyright (C) 2001-2021 Red Hat, Inc.
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2019-2021 SUSE LLC.
Written by Jakub Jelinek <jakub@redhat.com>, 2012.
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, 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; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* Big pool allocator. obstack isn't efficient, because it aligns everything
too much, and allocates too small chunks. All these objects are only freed
together. */
#include <stddef.h>
#include <stdlib.h>
#include <inttypes.h>
#include "pool.h"
/* Pointer to the start of the current pool chunk, current first free byte
in the chunk and byte after the end of the current pool chunk. */
static unsigned char *pool, *pool_next, *pool_limit;
extern void dwz_oom (void);
/* Allocate SIZE bytes with ALIGN bytes alignment from the pool. */
void *
pool_alloc_1 (unsigned int align, unsigned int size)
{
void *ret;
if (pool == NULL
|| (size_t) (pool_limit - pool_next) < (size_t) align + size)
{
size_t new_size = (size_t) align + size;
unsigned char *new_pool;
new_size += sizeof (void *);
if (new_size < 16384 * 1024 - 64)
new_size = 16384 * 1024 - 64;
new_pool = (unsigned char *) malloc (new_size);
if (new_pool == NULL)
dwz_oom ();
*(unsigned char **) new_pool = pool;
pool_next = new_pool + sizeof (unsigned char *);
pool_limit = new_pool + new_size;
pool = new_pool;
}
pool_next = (unsigned char *) (((uintptr_t) pool_next + align - 1)
& ~(uintptr_t) (align - 1));
ret = pool_next;
pool_next += size;
return ret;
}
/* Finalize a pool and return it. */
unsigned char *
finalize_pool (void)
{
unsigned char *ret = pool;
pool = NULL;
pool_next = NULL;
pool_limit = NULL;
return ret;
}
/* Free pool P. */
static void
pool_destroy_1 (unsigned char *p)
{
while (p)
{
void *elem = (void *) p;
p = *(unsigned char **) p;
free (elem);
}
}
/* Free pool P, or the current pool if NULL. */
void
pool_destroy (unsigned char *p)
{
if (p != NULL)
{
pool_destroy_1 (p);
return;
}
pool_destroy_1 (pool);
pool = NULL;
pool_next = NULL;
pool_limit = NULL;
}

26
pool.h
View File

@ -1,26 +0,0 @@
/* Copyright (C) 2001-2021 Red Hat, Inc.
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2019-2021 SUSE LLC.
Written by Jakub Jelinek <jakub@redhat.com>, 2012.
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, 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; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
extern void *pool_alloc_1 (unsigned int, unsigned int);
extern unsigned char *finalize_pool (void);
extern void pool_destroy (unsigned char *);
#define pool_alloc(name, size) \
(struct name *) pool_alloc_1 (ALIGNOF_STRUCT (name), size)

340
sha1.c
View File

@ -1,340 +0,0 @@
/* sha1.c - Functions to compute SHA1 message digest of files or
memory blocks according to the NIST specification FIPS-180-1.
Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2008 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, 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. */
/* Written by Scott G. Miller
Credits:
Robert Klep <robert@ilse.nl> -- Expansion function fix
*/
#include "sha1.h"
#include <stddef.h>
#include <string.h>
#include <endian.h>
#if __BYTE_ORDER == __BIG_ENDIAN
# define SWAP(n) (n)
#else
# define SWAP(n) \
(((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
#endif
/* This array contains the bytes used to pad the buffer to the next
64-byte boundary. (RFC 1321, 3.1: Step 1) */
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Take a pointer to a 160 bit block of data (five 32 bit ints) and
initialize it to the start constants of the SHA1 algorithm. This
must be called before using hash in the call to sha1_hash. */
void
sha1_init_ctx (struct sha1_ctx *ctx)
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
ctx->C = 0x98badcfe;
ctx->D = 0x10325476;
ctx->E = 0xc3d2e1f0;
ctx->total[0] = ctx->total[1] = 0;
ctx->buflen = 0;
}
/* Put result from CTX in first 20 bytes following RESBUF. The result
must be in little endian byte order.
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32-bit value. */
void *
sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf)
{
((sha1_uint32 *) resbuf)[0] = SWAP (ctx->A);
((sha1_uint32 *) resbuf)[1] = SWAP (ctx->B);
((sha1_uint32 *) resbuf)[2] = SWAP (ctx->C);
((sha1_uint32 *) resbuf)[3] = SWAP (ctx->D);
((sha1_uint32 *) resbuf)[4] = SWAP (ctx->E);
return resbuf;
}
/* Process the remaining bytes in the internal buffer and the usual
prolog according to the standard and write the result to RESBUF.
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32-bit value. */
void *
sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
{
/* Take yet unprocessed bytes into account. */
sha1_uint32 bytes = ctx->buflen;
size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
/* Now count remaining bytes. */
ctx->total[0] += bytes;
if (ctx->total[0] < bytes)
++ctx->total[1];
/* Put the 64-bit file length in *bits* at the end of the buffer. */
ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);
memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);
/* Process last bytes. */
sha1_process_block (ctx->buffer, size * 4, ctx);
return sha1_read_ctx (ctx, resbuf);
}
/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
void *
sha1_buffer (const char *buffer, size_t len, void *resblock)
{
struct sha1_ctx ctx;
/* Initialize the computation context. */
sha1_init_ctx (&ctx);
/* Process whole buffer but last len % 64 bytes. */
sha1_process_bytes (buffer, len, &ctx);
/* Put result in desired memory area. */
return sha1_finish_ctx (&ctx, resblock);
}
void
sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
{
/* When we already have some bits in our internal buffer concatenate
both inputs first. */
if (ctx->buflen != 0)
{
size_t left_over = ctx->buflen;
size_t add = 128 - left_over > len ? len : 128 - left_over;
memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
ctx->buflen += add;
if (ctx->buflen > 64)
{
sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
ctx->buflen &= 63;
/* The regions in the following copy operation cannot overlap. */
memcpy (ctx->buffer,
&((char *) ctx->buffer)[(left_over + add) & ~63],
ctx->buflen);
}
buffer = (const char *) buffer + add;
len -= add;
}
/* Process available complete blocks. */
if (len >= 64)
{
#if !_STRING_ARCH_unaligned
# define alignof(type) offsetof (struct { char c; type x; }, x)
# define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0)
if (UNALIGNED_P (buffer))
while (len > 64)
{
sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
buffer = (const char *) buffer + 64;
len -= 64;
}
else
#endif
{
sha1_process_block (buffer, len & ~63, ctx);
buffer = (const char *) buffer + (len & ~63);
len &= 63;
}
}
/* Move remaining bytes in internal buffer. */
if (len > 0)
{
size_t left_over = ctx->buflen;
memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
left_over += len;
if (left_over >= 64)
{
sha1_process_block (ctx->buffer, 64, ctx);
left_over -= 64;
memcpy (ctx->buffer, &ctx->buffer[16], left_over);
}
ctx->buflen = left_over;
}
}
/* --- Code below is the primary difference between md5.c and sha1.c --- */
/* SHA1 round constants */
#define K1 0x5a827999
#define K2 0x6ed9eba1
#define K3 0x8f1bbcdc
#define K4 0xca62c1d6
/* Round functions. Note that F2 is the same as F4. */
#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) )
#define F2(B,C,D) (B ^ C ^ D)
#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) )
#define F4(B,C,D) (B ^ C ^ D)
/* Process LEN bytes of BUFFER, accumulating context into CTX.
It is assumed that LEN % 64 == 0.
Most of this code comes from GnuPG's cipher/sha1.c. */
void
sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
{
const sha1_uint32 *words = (const sha1_uint32*) buffer;
size_t nwords = len / sizeof (sha1_uint32);
const sha1_uint32 *endp = words + nwords;
sha1_uint32 x[16];
sha1_uint32 a = ctx->A;
sha1_uint32 b = ctx->B;
sha1_uint32 c = ctx->C;
sha1_uint32 d = ctx->D;
sha1_uint32 e = ctx->E;
/* First increment the byte count. RFC 1321 specifies the possible
length of the file up to 2^64 bits. Here we only compute the
number of bytes. Do a double word increment. */
ctx->total[0] += len;
if (ctx->total[0] < len)
++ctx->total[1];
#define rol(x, n) (((x) << (n)) | ((sha1_uint32) (x) >> (32 - (n))))
#define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \
^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
, (x[I&0x0f] = rol(tm, 1)) )
#define R(A,B,C,D,E,F,K,M) do { E += rol( A, 5 ) \
+ F( B, C, D ) \
+ K \
+ M; \
B = rol( B, 30 ); \
} while(0)
while (words < endp)
{
sha1_uint32 tm;
int t;
for (t = 0; t < 16; t++)
{
x[t] = SWAP (*words);
words++;
}
R( a, b, c, d, e, F1, K1, x[ 0] );
R( e, a, b, c, d, F1, K1, x[ 1] );
R( d, e, a, b, c, F1, K1, x[ 2] );
R( c, d, e, a, b, F1, K1, x[ 3] );
R( b, c, d, e, a, F1, K1, x[ 4] );
R( a, b, c, d, e, F1, K1, x[ 5] );
R( e, a, b, c, d, F1, K1, x[ 6] );
R( d, e, a, b, c, F1, K1, x[ 7] );
R( c, d, e, a, b, F1, K1, x[ 8] );
R( b, c, d, e, a, F1, K1, x[ 9] );
R( a, b, c, d, e, F1, K1, x[10] );
R( e, a, b, c, d, F1, K1, x[11] );
R( d, e, a, b, c, F1, K1, x[12] );
R( c, d, e, a, b, F1, K1, x[13] );
R( b, c, d, e, a, F1, K1, x[14] );
R( a, b, c, d, e, F1, K1, x[15] );
R( e, a, b, c, d, F1, K1, M(16) );
R( d, e, a, b, c, F1, K1, M(17) );
R( c, d, e, a, b, F1, K1, M(18) );
R( b, c, d, e, a, F1, K1, M(19) );
R( a, b, c, d, e, F2, K2, M(20) );
R( e, a, b, c, d, F2, K2, M(21) );
R( d, e, a, b, c, F2, K2, M(22) );
R( c, d, e, a, b, F2, K2, M(23) );
R( b, c, d, e, a, F2, K2, M(24) );
R( a, b, c, d, e, F2, K2, M(25) );
R( e, a, b, c, d, F2, K2, M(26) );
R( d, e, a, b, c, F2, K2, M(27) );
R( c, d, e, a, b, F2, K2, M(28) );
R( b, c, d, e, a, F2, K2, M(29) );
R( a, b, c, d, e, F2, K2, M(30) );
R( e, a, b, c, d, F2, K2, M(31) );
R( d, e, a, b, c, F2, K2, M(32) );
R( c, d, e, a, b, F2, K2, M(33) );
R( b, c, d, e, a, F2, K2, M(34) );
R( a, b, c, d, e, F2, K2, M(35) );
R( e, a, b, c, d, F2, K2, M(36) );
R( d, e, a, b, c, F2, K2, M(37) );
R( c, d, e, a, b, F2, K2, M(38) );
R( b, c, d, e, a, F2, K2, M(39) );
R( a, b, c, d, e, F3, K3, M(40) );
R( e, a, b, c, d, F3, K3, M(41) );
R( d, e, a, b, c, F3, K3, M(42) );
R( c, d, e, a, b, F3, K3, M(43) );
R( b, c, d, e, a, F3, K3, M(44) );
R( a, b, c, d, e, F3, K3, M(45) );
R( e, a, b, c, d, F3, K3, M(46) );
R( d, e, a, b, c, F3, K3, M(47) );
R( c, d, e, a, b, F3, K3, M(48) );
R( b, c, d, e, a, F3, K3, M(49) );
R( a, b, c, d, e, F3, K3, M(50) );
R( e, a, b, c, d, F3, K3, M(51) );
R( d, e, a, b, c, F3, K3, M(52) );
R( c, d, e, a, b, F3, K3, M(53) );
R( b, c, d, e, a, F3, K3, M(54) );
R( a, b, c, d, e, F3, K3, M(55) );
R( e, a, b, c, d, F3, K3, M(56) );
R( d, e, a, b, c, F3, K3, M(57) );
R( c, d, e, a, b, F3, K3, M(58) );
R( b, c, d, e, a, F3, K3, M(59) );
R( a, b, c, d, e, F4, K4, M(60) );
R( e, a, b, c, d, F4, K4, M(61) );
R( d, e, a, b, c, F4, K4, M(62) );
R( c, d, e, a, b, F4, K4, M(63) );
R( b, c, d, e, a, F4, K4, M(64) );
R( a, b, c, d, e, F4, K4, M(65) );
R( e, a, b, c, d, F4, K4, M(66) );
R( d, e, a, b, c, F4, K4, M(67) );
R( c, d, e, a, b, F4, K4, M(68) );
R( b, c, d, e, a, F4, K4, M(69) );
R( a, b, c, d, e, F4, K4, M(70) );
R( e, a, b, c, d, F4, K4, M(71) );
R( d, e, a, b, c, F4, K4, M(72) );
R( c, d, e, a, b, F4, K4, M(73) );
R( b, c, d, e, a, F4, K4, M(74) );
R( a, b, c, d, e, F4, K4, M(75) );
R( e, a, b, c, d, F4, K4, M(76) );
R( d, e, a, b, c, F4, K4, M(77) );
R( c, d, e, a, b, F4, K4, M(78) );
R( b, c, d, e, a, F4, K4, M(79) );
a = ctx->A += a;
b = ctx->B += b;
c = ctx->C += c;
d = ctx->D += d;
e = ctx->E += e;
}
}

95
sha1.h
View File

@ -1,95 +0,0 @@
/* Declarations of functions and data types used for SHA1 sum
library functions.
Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2010
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, 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. */
#ifndef SHA1_H
# define SHA1_H 1
#include <stdio.h>
#include <limits.h>
#include <stdint.h>
/* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
doing that would require that the configure script compile and *run*
the resulting executable. Locally running cross-compiled executables
is usually not possible. */
#include <sys/types.h>
typedef u_int32_t sha1_uint32;
typedef uintptr_t sha1_uintptr;
/* Structure to save state of computation between the single steps. */
struct sha1_ctx
{
sha1_uint32 A;
sha1_uint32 B;
sha1_uint32 C;
sha1_uint32 D;
sha1_uint32 E;
sha1_uint32 total[2];
sha1_uint32 buflen;
sha1_uint32 buffer[32];
};
/* Initialize structure containing state of computation. */
extern void sha1_init_ctx (struct sha1_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is necessary that LEN is a multiple of 64!!! */
extern void sha1_process_block (const void *buffer, size_t len,
struct sha1_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialization function update the context for the next LEN bytes
starting at BUFFER.
It is NOT required that LEN is a multiple of 64. */
extern void sha1_process_bytes (const void *buffer, size_t len,
struct sha1_ctx *ctx);
/* Process the remaining bytes in the buffer and put result from CTX
in first 20 bytes following RESBUF. The result is always in little
endian byte order, so that a byte-wise output yields to the wanted
ASCII representation of the message digest.
IMPORTANT: On some systems it is required that RESBUF be correctly
aligned for a 32 bits value. */
extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
/* Put result from CTX in first 20 bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest.
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
#endif

View File

@ -1,13 +0,0 @@
struct s;
struct s {
struct s *p;
};
struct s var;
int
main (void)
{
return 0;
}

View File

@ -1,36 +0,0 @@
readelf_flags=""
if readelf -h 2>&1 | grep -q "\-wN"; then
readelf_flags=-wN
fi
cp $execs/cycle 1
# Using mode 3 in checksum_die_ref.
$execs/dwz-for-test 1 -o 1.z --devel-dump-dies 2> DUMP.1
rm -f 1.z
# Skipping mode 3 in checksum_die_ref.
$execs/dwz-for-test 1 -o 1.z --devel-dump-dies --devel-no-checksum-cycle-opt 2> DUMP.2
rm -f 1.z
# Verify that mode 3 and mode 4 have different checksums.
grep " s structure_type" DUMP.1 > LINE.1
grep " s structure_type" DUMP.2 > LINE.2
! diff -q LINE.1 LINE.2
rm -f DUMP.1 DUMP.2 LINE.1 LINE.2
# Verify that dwz actually works with --devel-no-checksum-cycle-opt.
cp 1 2
$execs/dwz-for-test -m 3 1 2 --devel-no-checksum-cycle-opt --devel-ignore-size
cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*: s$")
[ $cnt -eq 1 ]
# Even with -wN readelf 2.38-15.fc37 follows and prints the contents
# of the alt file. So make sure it cannot do that by removing it.
rm 3
cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*: s$" || true)
[ $cnt -eq 0 ]
rm -f 1 2 3

View File

@ -1,3 +0,0 @@
class ao_ref;
ao_ref *p3;

View File

@ -1,11 +0,0 @@
#include "def.h"
ao_ref *p1;
int
main (void)
{
ao_ref *p1 = new ao_ref;
return 0;
}

View File

@ -1,10 +0,0 @@
class bla {
int a;
public:
bla() { a = 1; }
};
class ao_ref
{
bla a;
};

View File

@ -1,9 +0,0 @@
#include "def.h"
ao_ref *p2;
void
foo (void)
{
p2 = new ao_ref;
}

View File

@ -1,27 +0,0 @@
cp $execs/two-typedef 1
cnt=$(readelf -wi 1 \
| grep 'DW_AT_name.*: aaa' \
| wc -l)
[ $cnt -eq 2 ]
$execs/dwz-for-test 1 2>/dev/null
cnt=$(readelf -wi 1 \
| grep 'DW_AT_name.*: aaa' \
| wc -l)
[ $cnt -eq 2 ]
cp $execs/two-typedef 1
$execs/dwz-for-test --devel-ignore-locus --devel-ignore-size 1
cnt=$(readelf -wi 1 \
| grep 'DW_AT_name.*: aaa' \
| wc -l)
[ $cnt -eq 1 ]
rm -f 1

View File

@ -1,29 +0,0 @@
cp $execs/min 1
cnt=$(readelf -wi 1 \
| grep '(DW_TAG_partial_unit' \
| wc -l)
[ $cnt -eq 0 ]
$execs/dwz-for-test 1 2>/dev/null
cnt=$(readelf -wi 1 \
| grep '(DW_TAG_partial_unit' \
| wc -l)
if [ $cnt -ne 0 ]; then
exit 77
fi
cp $execs/min 1
$execs/dwz-for-test --devel-ignore-size 1
cnt=$(readelf -wi 1 \
| grep '(DW_TAG_partial_unit' \
| wc -l)
[ $cnt -gt 0 ]
rm -f 1

View File

@ -1,5 +0,0 @@
cp $execs/hello 1
$execs/dwz-for-test --devel-trace 1 2>/dev/null
rm -f 1

View File

@ -1,403 +0,0 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2011-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 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/>.
This was copied from the git://sourceware.org/git/binutils-gdb.git
repository, file gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S. */
#if PTRBITS == 64
# define PTRBYTE .8byte
#elif PTRBITS == 32
# define PTRBYTE .4byte
#else
# error "Unsupported pointer size"
#endif
.section .debug_info
.Lcu1_begin:
/* CU header */
.4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
.Lcu1_start:
.2byte 2 /* DWARF Version */
.4byte .Labbrev1_begin /* Offset into abbrev section */
.byte PTRBITS / 8 /* Pointer size */
/* CU die */
.uleb128 1 /* Abbrev: DW_TAG_compile_unit */
.4byte .Lline1_begin /* DW_AT_stmt_list */
PTRBYTE func_start /* DW_AT_low_pc */
PTRBYTE func_end /* DW_AT_high_pc */
.ascii "main.c\0" /* DW_AT_name */
.ascii "GNU C 4.5.0\0" /* DW_AT_producer must be >= 4.5 */
.byte 2 /* DW_AT_language (DW_LANG_C) */
.uleb128 2 /* Abbrev: DW_TAG_subprogram */
.byte 1 /* DW_AT_external */
.ascii "func\0" /* DW_AT_name */
.4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
PTRBYTE func_start /* DW_AT_low_pc */
PTRBYTE func_end /* DW_AT_high_pc */
/* GDB `has_loclist' detection of -O2 -g code needs to see a DW_AT_location
location list. There may exist -O2 -g CUs still not needing/using any such
location list - exactly like this CU. Make one up. */
.uleb128 0x7 /* (DIE (0x42) DW_TAG_formal_parameter) */
.ascii "param\0" /* DW_AT_name */
.4byte .Ltype_int - .Lcu1_begin /* DW_AT_type */
.4byte loclist /* DW_AT_location */
.uleb128 4 /* Abbrev: DW_TAG_inlined_subroutine */
.ascii "inlined\0" /* DW_AT_name */
PTRBYTE func0 /* DW_AT_low_pc */
PTRBYTE func1 /* DW_AT_high_pc */
.byte 3 /* DW_AT_inline (DW_INL_declared_inlined) */
.byte 1 /* DW_AT_call_file */
.byte 8 /* DW_AT_call_line */
.uleb128 4 /* Abbrev: DW_TAG_inlined_subroutine */
.ascii "inlined2\0" /* DW_AT_name */
PTRBYTE func2 /* DW_AT_low_pc */
PTRBYTE func3 /* DW_AT_high_pc */
.byte 3 /* DW_AT_inline (DW_INL_declared_inlined) */
.byte 1 /* DW_AT_call_file */
.byte 11 /* DW_AT_call_line */
#ifdef INLINED
.uleb128 4 /* Abbrev: DW_TAG_inlined_subroutine */
.ascii "otherinline\0" /* DW_AT_name */
PTRBYTE func3 /* DW_AT_low_pc */
PTRBYTE func_end /* DW_AT_high_pc */
.byte 3 /* DW_AT_inline (DW_INL_declared_inlined) */
.byte 1 /* DW_AT_call_file */
.byte 9 /* DW_AT_call_line */
#endif
#ifdef LEXICAL
.uleb128 5 /* Abbrev: DW_TAG_lexical_block */
PTRBYTE func3 /* DW_AT_low_pc */
PTRBYTE func_end /* DW_AT_high_pc */
/* GDB would otherwise ignore the DW_TAG_lexical_block. */
.uleb128 6 /* Abbrev: DW_TAG_variable */
.ascii "lexicalvar\0" /* DW_AT_name */
.4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
.byte 0 /* End of children of DW_TAG_lexical_block */
#endif
.byte 0 /* End of children of DW_TAG_subprogram */
/* Simulate `fund' is also named `func' so that the function name matches and
fund's SAL is not discarded in expand_line_sal_maybe. */
.uleb128 2 /* Abbrev: DW_TAG_subprogram */
.byte 1 /* DW_AT_external */
.ascii "func\0" /* DW_AT_name */
.4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
PTRBYTE fund_start /* DW_AT_low_pc */
PTRBYTE fund_end /* DW_AT_high_pc */
.byte 0 /* End of children of DW_TAG_subprogram */
.Ltype_int:
.uleb128 3 /* Abbrev: DW_TAG_base_type */
.ascii "int\0" /* DW_AT_name */
.byte 4 /* DW_AT_byte_size */
.byte 5 /* DW_AT_encoding */
.byte 0 /* End of children of CU */
.Lcu1_end:
.section .debug_loc
loclist:
/* Reset the location list base address first. */
.4byte -1, 0
PTRBYTE func_start, func_end
.2byte 2f-1f
1: .byte 0x50 /* DW_OP_reg0 */
2:
/* Location list end. */
.4byte 0, 0
/* Abbrev table */
.section .debug_abbrev
.Labbrev1_begin:
.uleb128 1 /* Abbrev code */
.uleb128 0x11 /* DW_TAG_compile_unit */
.byte 1 /* has_children */
.uleb128 0x10 /* DW_AT_stmt_list */
.uleb128 0x6 /* DW_FORM_data4 */
.uleb128 0x11 /* DW_AT_low_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x25 /* DW_AT_producer */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x13 /* DW_AT_language */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 2 /* Abbrev code */
.uleb128 0x2e /* DW_TAG_subprogram */
.byte 1 /* has_children */
.uleb128 0x3f /* DW_AT_external */
.uleb128 0xc /* DW_FORM_flag */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
.uleb128 0x11 /* DW_AT_low_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x1 /* DW_FORM_addr */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 3 /* Abbrev code */
.uleb128 0x24 /* DW_TAG_base_type */
.byte 0 /* has_children */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0xb /* DW_AT_byte_size */
.uleb128 0xb /* DW_FORM_data1 */
.uleb128 0x3e /* DW_AT_encoding */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 4 /* Abbrev code */
.uleb128 0x1d /* DW_TAG_inlined_subroutine */
.byte 0 /* has_children */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x11 /* DW_AT_low_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x20 /* DW_AT_inline */
.uleb128 0xb /* DW_FORM_data1 */
.uleb128 0x58 /* DW_AT_call_file */
.uleb128 0xb /* DW_FORM_data1 */
.uleb128 0x59 /* DW_AT_call_line */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 5 /* Abbrev code */
.uleb128 0x0b /* DW_TAG_lexical_block */
.byte 1 /* has_children */
.uleb128 0x11 /* DW_AT_low_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x1 /* DW_FORM_addr */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 6 /* Abbrev code */
.uleb128 0x34 /* DW_TAG_variable */
.byte 0 /* has_children */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 0x7 /* (abbrev code) */
.uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */
.byte 0x0 /* DW_children_no */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x49 /* (DW_AT_type) */
.uleb128 0x13 /* (DW_FORM_ref4) */
.uleb128 0x02 /* (DW_AT_location) */
.uleb128 0x06 /* (DW_FORM_data4) */
.byte 0x0
.byte 0x0
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
/* Line table */
.section .debug_line
.Lline1_begin:
.4byte .Lline1_end - .Lline1_start /* Initial length */
.Lline1_start:
.2byte 2 /* Version */
.4byte .Lline1_lines - .Lline1_hdr /* header_length */
.Lline1_hdr:
.byte 1 /* Minimum insn length */
.byte 1 /* default_is_stmt */
.byte 1 /* line_base */
.byte 1 /* line_range */
.byte 0x10 /* opcode_base */
/* Standard lengths */
.byte 0
.byte 1
.byte 1
.byte 1
.byte 1
.byte 0
.byte 0
.byte 0
.byte 1
.byte 0
.byte 0
.byte 1
.byte 0
.byte 0
.byte 0
/* Include directories */
.byte 0
/* File names */
.ascii "main.c\0"
.uleb128 0
.uleb128 0
.uleb128 0
.ascii "other.c\0"
.uleb128 0
.uleb128 0
.uleb128 0
.byte 0
.Lline1_lines:
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE func_start
.byte 3 /* DW_LNS_advance_line */
.sleb128 4 /* ... to 5 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE func0
.byte 4 /* DW_LNS_set_file */
.uleb128 2
.byte 3 /* DW_LNS_advance_line */
.sleb128 -4 /* ... to 1 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE func1
.byte 4 /* DW_LNS_set_file */
.uleb128 1
.byte 3 /* DW_LNS_advance_line */
.sleb128 8 /* ... to 9 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE func2
.byte 4 /* DW_LNS_set_file */
.uleb128 2
.byte 3 /* DW_LNS_advance_line */
.sleb128 -8 /* ... to 1 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE func3
.byte 4 /* DW_LNS_set_file */
.uleb128 1
.byte 3 /* DW_LNS_advance_line */
.sleb128 8 /* ... to 9 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE func_end
/* Equivalent copy but renamed s/func/fund/. */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE fund_start
.byte 3 /* DW_LNS_advance_line */
.sleb128 -4 /* ... to 5 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE fund0
.byte 4 /* DW_LNS_set_file */
.uleb128 2
.byte 3 /* DW_LNS_advance_line */
.sleb128 -4 /* ... to 1 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE fund1
.byte 4 /* DW_LNS_set_file */
.uleb128 1
.byte 3 /* DW_LNS_advance_line */
.sleb128 8 /* ... to 9 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE fund2
.byte 4 /* DW_LNS_set_file */
.uleb128 2
.byte 3 /* DW_LNS_advance_line */
.sleb128 -8 /* ... to 1 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE fund3
.byte 4 /* DW_LNS_set_file */
.uleb128 1
.byte 3 /* DW_LNS_advance_line */
.sleb128 8 /* ... to 9 */
.byte 1 /* DW_LNS_copy */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
PTRBYTE fund_end
/* Line numbering end. */
.byte 0 /* DW_LNE_end_of_sequence */
.uleb128 1
.byte 1
.Lline1_end:
.section .note.GNU-stack,"",@progbits

View File

@ -1,61 +0,0 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2011-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 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/>.
This was copied from the git://sourceware.org/git/binutils-gdb.git
repository, file gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.c. */
static volatile int v;
asm ("func_start: .globl func_start\n");
static int
func (void)
{
v++;
asm ("func0: .globl func0\n");
v++;
asm ("func1: .globl func1\n");
v++;
asm ("func2: .globl func2\n");
v++;
asm ("func3: .globl func3\n");
return v;
}
asm ("func_end: .globl func_end\n");
/* Equivalent copy but renamed s/func/fund/. */
asm ("fund_start: .globl fund_start\n");
static int
fund (void)
{
v++;
asm ("fund0: .globl fund0\n");
v++;
asm ("fund1: .globl fund1\n");
v++;
asm ("fund2: .globl fund2\n");
v++;
asm ("fund3: .globl fund3\n");
return v;
}
asm ("fund_end: .globl fund_end\n");
int
main (void)
{
return func () + fund ();
}

View File

@ -1,145 +0,0 @@
set tests [find $srcdir/$subdir *.sh]
set pwd [pwd]
set env(PATH) $srcdir/scripts:$::env(PATH)
set env(execs) $pwd
exec mkdir -p $pwd/testsuite/dwz.tests/execs
exec $srcdir/scripts/xunzip-dir.sh \
$srcdir/dwz.tests/execs.xz \
$pwd/testsuite/dwz.tests/execs
foreach test $tests {
global runtests
set basename [exec basename $test]
if ![runtest_file_p $runtests $basename] {
continue
}
set required_execs []
if { $basename == "pr24173.sh" } {
lappend required_execs "py-section-script"
}
if { $basename == "pr24341.sh" } {
if { [catch {exec readelf -wi min | grep DW_AT_name | grep -c / } matches] } {
# Some error occurred in the supported test, f.i. DWARF in min
# unsupported by readelf.
unsupported "$test"
continue
}
if { $matches != 2 } {
# The exec min is used for the regression test for pr24341, but it
# only functions as such if the DWARF only contains the CUs of the
# test-case itself.
unsupported "$test"
continue
}
}
if { $basename == "pr24172.sh" } {
if { ![istarget x86_64-*-*] } {
unsupported "$test"
continue
}
lappend required_execs "dw2-skip-prologue"
}
if { $basename == "pr24170.sh" } {
lappend required_execs "implptr-64bit-d2o4a8r8t0"
}
if { $basename == "gold-gdb-index.sh" } {
lappend required_execs "hello-gold-gdb-index"
}
if { $basename == "pr24747.sh" } {
lappend required_execs "start-gold"
}
if { $basename == "pr24771.sh" } {
lappend required_execs "hello-gnu-pubnames"
}
if { $basename == "pr24823.sh" } {
lappend required_execs "varval"
}
if { ![istarget x86_64-*-*] } {
if { $basename == "pr24468.sh" } {
unsupported "$test"
continue
}
if { $basename == "ld-2.26.1-multifile.sh" } {
unsupported "$test"
continue
}
}
if { $basename == "gdb-add-index.sh" } {
if { [catch { exec which gdb-add-index } ] } {
unsupported "$test"
continue
}
}
if { [istarget mips*-*-*] } {
# elfutils don't have a MIPS backend (PR elfutils/24795), so eu-strip
# doesn't work as expected.
if { $basename == "eu-strip-unstrip.sh" || \
$basename == "eu-strip-unstrip-multifile.sh" || \
$basename == "pr24173.sh" } {
unsupported "$test"
continue
}
}
if { $basename == "pr25109.sh" } {
lappend required_execs no-multifile-prop
}
if { $basename == "pr27463.sh" } {
lappend required_execs unavailable-dwarf-piece
}
set unsupported 0
foreach required_exec $required_execs {
set exists [file exists $required_exec]
if { $exists == 0 } {
set unsupported 1
break
}
set size [file size $required_exec]
if { $size == 0 } {
set unsupported 1
break
}
}
if { $unsupported == 1 } {
unsupported "$test"
continue
}
set dir $pwd/tmp.$basename
exec rm -Rf $dir
exec mkdir $dir
cd $dir
if { [catch { exec sh -e $test } msg] } {
if { [lindex $::errorCode 0] == "CHILDSTATUS" && \
[lindex $::errorCode 2] == 77 } {
unsupported "$test"
exec rm -Rf $dir
} else {
puts "$msg"
fail "$test"
}
} else {
if { [file exists dwz.info ] } {
set info [exec cat dwz.info]
verbose -log "$test:" 1
verbose -log "$info" 1
exec rm -f dwz.info
}
set file_list [glob -nocomplain "$dir/*"]
if {[llength $file_list] != 0} {
puts "$dir is not empty"
fail "$test"
} else {
pass "$test"
exec rm -Rf $dir
}
}
cd $pwd
}

View File

@ -1,7 +0,0 @@
cp $execs/dwz-for-test 1
dwz 1
smaller-than.sh 1 $execs/dwz-for-test
rm -f 1

View File

@ -1,18 +0,0 @@
cp $execs/hello 1
cp $execs/hello 2
eu-strip 1 -o 1.stripped -f 1.debug
eu-strip 2 -o 2.stripped -f 2.debug
dwz -m 3 1.debug 2.debug
eu-unstrip 1.stripped 1.debug -o 1.unstripped
eu-unstrip 2.stripped 2.debug -o 2.unstripped
smaller-than.sh 1.unstripped 1
smaller-than.sh 2.unstripped 2
[ "$(gnu-debugaltlink-name.sh 1.unstripped)" = "3" ]
[ "$(gnu-debugaltlink-name.sh 2.unstripped)" = "3" ]
rm -f 1 1.debug 1.stripped 1.unstripped 2 2.debug 2.stripped 2.unstripped 3

View File

@ -1,11 +0,0 @@
cp $execs/hello 1
eu-strip 1 -o 1.stripped -f 1.debug
dwz 1.debug
eu-unstrip 1.stripped 1.debug -o 1.unstripped
smaller-than.sh 1.unstripped 1
rm -f 1 1.debug 1.stripped 1.unstripped

View File

@ -1,15 +0,0 @@
cp $execs/hello 1
# Redirect gdb-add-index stderr to stdout.
# https://sourceware.org/bugzilla/show_bug.cgi?id=29316
gdb-add-index 1 2>&1
readelf -S 1 | grep -q '\.gdb_index'
dwz 1 -o 2
readelf -S 2 | grep -q '\.gdb_index'
smaller-than.sh 2 1
rm -f 1 2

View File

@ -1,7 +0,0 @@
cp ../hello-gold-gdb-index 1
dwz 1
smaller-than.sh 1 ../hello-gold-gdb-index
rm -f 1

View File

@ -1,15 +0,0 @@
cp $execs/hello 1
ln 1 2
cp $execs/hello 3
dwz -h -m 4 1 2 3
hardlinks-p.sh 1 2
smaller-than.sh 1 $execs/hello
smaller-than.sh 3 $execs/hello
[ "$(gnu-debugaltlink-name.sh 1)" = "4" ]
[ "$(gnu-debugaltlink-name.sh 3)" = "4" ]
rm -f 1 2 3 4

View File

@ -1,11 +0,0 @@
cp $execs/hello 1
ln 1 2
dwz -h 1 2
smaller-than.sh 1 $execs/hello
smaller-than.sh 2 $execs/hello
hardlinks-p.sh 1 2
rm -f 1 2

View File

@ -1,8 +0,0 @@
#include <stdio.h>
int
main (void)
{
printf ("hello\n");
return 0;
}

View File

@ -1,13 +0,0 @@
cp $execs/hello 1
if dwz -? 1 2> dwz.err; status=$?; then
true
fi
[ $status -eq 1 ]
grep -q "Usage:" dwz.err
cmp 1 $execs/hello
rm -f 1 dwz.err

View File

@ -1,25 +0,0 @@
cp $execs/hello 1
if dwz -x 1 2> dwz.err; status=$?; then
true
fi
[ $status -eq 1 ]
grep -q ": invalid option -- 'x'" dwz.err
grep -q "Usage:" dwz.err
cmp 1 $execs/hello
if dwz --x 1 2> dwz.err; status=$?; then
true
fi
[ $status -eq 1 ]
grep -q ": unrecognized option '--x'" dwz.err
grep -q "Usage:" dwz.err
cmp 1 $execs/hello
rm -f 1 dwz.err

View File

@ -1,157 +0,0 @@
/* This was generated using git://sourceware.org/git/binutils-gdb.git
repository, file gdb/testsuite/gdb.dwarf2/implptr-64bit.exp. */
.section .debug_info
.Lcu1_begin:
.4byte .Lcu1_end - .Lcu1_start
.Lcu1_start:
.2byte 2 /* Version */
.4byte .Labbrev1_begin /* Abbrevs */
.byte 8 /* Pointer size */
.uleb128 2 /* Abbrev (DW_TAG_compile_unit) */
.ascii "GNU C 4.4.3\0"
.sleb128 0x0001
.ascii "1.c\0"
.Llabel3:
.uleb128 3 /* Abbrev (DW_TAG_base_type) */
.sleb128 4
.sleb128 0x5
.ascii "int\0"
.Llabel1:
.uleb128 4 /* Abbrev (DW_TAG_structure_type) */
.ascii "s\0"
.sleb128 4
.uleb128 5 /* Abbrev (DW_TAG_member) */
.ascii "f\0"
.4byte .Llabel3 - .Lcu1_begin
.byte 0
.byte 0x0 /* Terminate children */
.Llabel4:
.uleb128 6 /* Abbrev (DW_TAG_pointer_type) */
.sleb128 8
.4byte .Llabel1 - .Lcu1_begin
.Llabel2:
.uleb128 7 /* Abbrev (DW_TAG_variable) */
.ascii "v\0"
.uleb128 .Lexpr_end6 - .Lexpr_start5/* expression */
.Lexpr_start5:
.byte 0x9e /* DW_OP_implicit_value */
.uleb128 .Lvalue_end8 - .Lvalue_start7
.Lvalue_start7:
.byte 0x1
.byte 0x1
.byte 0x1
.byte 0x1
.Lvalue_end8:
.Lexpr_end6:
.8byte .Llabel1 - .Lcu1_begin
.uleb128 8 /* Abbrev (DW_TAG_subprogram) */
.ascii "main\0"
.8byte main
.8byte main+0x100
.8byte .Llabel3
.byte 1
.uleb128 9 /* Abbrev (DW_TAG_variable) */
.ascii "p\0"
.uleb128 .Lexpr_end10 - .Lexpr_start9/* expression */
.Lexpr_start9:
.byte 0xf2 /* DW_OP_GNU_implicit_pointer */
.8byte .Llabel2
.sleb128 0
.Lexpr_end10:
.8byte .Llabel4 - .Lcu1_begin
.byte 0x0 /* Terminate children */
.byte 0x0 /* Terminate children */
.Lcu1_end:
.section .debug_abbrev
.Labbrev1_begin:
.uleb128 2 /* Abbrev start */
.uleb128 0x11 /* DW_TAG_compile_unit */
.byte 1 /* has_children */
.uleb128 0x25 /* DW_AT_producer */
.uleb128 0x08 /* DW_FORM_string */
.uleb128 0x13 /* DW_AT_language */
.uleb128 0x0d /* DW_FORM_sdata */
.uleb128 0x03 /* DW_AT_name */
.uleb128 0x08 /* DW_FORM_string */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 3 /* Abbrev start */
.uleb128 0x24 /* DW_TAG_base_type */
.byte 0 /* has_children */
.uleb128 0x0b /* DW_AT_byte_size */
.uleb128 0x0d /* DW_FORM_sdata */
.uleb128 0x3e /* DW_AT_encoding */
.uleb128 0x0d /* DW_FORM_sdata */
.uleb128 0x03 /* DW_AT_name */
.uleb128 0x08 /* DW_FORM_string */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 4 /* Abbrev start */
.uleb128 0x13 /* DW_TAG_structure_type */
.byte 1 /* has_children */
.uleb128 0x03 /* DW_AT_name */
.uleb128 0x08 /* DW_FORM_string */
.uleb128 0x0b /* DW_AT_byte_size */
.uleb128 0x0d /* DW_FORM_sdata */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 5 /* Abbrev start */
.uleb128 0x0d /* DW_TAG_member */
.byte 0 /* has_children */
.uleb128 0x03 /* DW_AT_name */
.uleb128 0x08 /* DW_FORM_string */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
.uleb128 0x38 /* DW_AT_data_member_location */
.uleb128 0x0b /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 6 /* Abbrev start */
.uleb128 0x0f /* DW_TAG_pointer_type */
.byte 0 /* has_children */
.uleb128 0x0b /* DW_AT_byte_size */
.uleb128 0x0d /* DW_FORM_sdata */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 7 /* Abbrev start */
.uleb128 0x34 /* DW_TAG_variable */
.byte 0 /* has_children */
.uleb128 0x03 /* DW_AT_name */
.uleb128 0x08 /* DW_FORM_string */
.uleb128 0x02 /* DW_AT_location */
.uleb128 0x09 /* SPECIAL_expr */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x14 /* DW_FORM_ref8 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 8 /* Abbrev start */
.uleb128 0x2e /* DW_TAG_subprogram */
.byte 1 /* has_children */
.uleb128 0x03 /* DW_AT_name */
.uleb128 0x08 /* DW_FORM_string */
.uleb128 0x11 /* DW_AT_low_pc */
.uleb128 0x01 /* DW_FORM_addr */
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x01 /* DW_FORM_addr */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x10 /* DW_FORM_ref_addr */
.uleb128 0x3f /* DW_AT_external */
.uleb128 0x0c /* DW_FORM_flag */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 9 /* Abbrev start */
.uleb128 0x34 /* DW_TAG_variable */
.byte 0 /* has_children */
.uleb128 0x03 /* DW_AT_name */
.uleb128 0x08 /* DW_FORM_string */
.uleb128 0x02 /* DW_AT_location */
.uleb128 0x09 /* SPECIAL_expr */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x14 /* DW_FORM_ref8 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.section .note.GNU-stack,"",@progbits

View File

@ -1,14 +0,0 @@
exec=../testsuite/dwz.tests/execs/hello-ld-2.26.1
cp $exec 1
cp 1 2
dwz -m 3 1 2
smaller-than.sh 1 $exec
smaller-than.sh 2 $exec
[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
rm -f 1 2 3

View File

@ -1,13 +0,0 @@
cp $execs/hello 1
$execs/dwz-for-test \
-l0 \
--devel-trace \
1 \
2> dwz.err
if grep -q "Compressing 1$" dwz.err; then
exit 1
fi
rm -f 1 dwz.err

View File

@ -1,23 +0,0 @@
cp $execs/hello 1
cp 1 2
count=$(readelf -wi 1 \
| grep '(DW_TAG' \
| wc -l)
limit=$count
if $execs/dwz-for-test \
-l$limit \
--devel-trace \
-m 3 1 2 \
2> dwz.err; status=$?; then
true
fi
if grep -q "Hit low-mem die-limit" dwz.err; then
exit 1
fi
[ $status -eq 0 ]
rm -f 1 2 3 dwz.err

View File

@ -1,18 +0,0 @@
cp $execs/hello 1
count=$(readelf -wi 1 \
| grep '(DW_TAG' \
| wc -l)
limit=$count
$execs/dwz-for-test \
-l$limit \
--devel-trace \
1 \
2> dwz.err
if grep -q "Compressing 1 in low-mem mode" dwz.err; then
exit 1
fi
rm -f 1 dwz.err

View File

@ -1,13 +0,0 @@
cp $execs/hello 1
$execs/dwz-for-test \
-lnone \
--devel-trace \
1 \
2> dwz.err
if grep -q "Compressing 1 in low-mem mode" dwz.err; then
exit 1
fi
rm -f 1 dwz.err

View File

@ -1,18 +0,0 @@
cp $execs/hello 1
count=$(readelf -wi 1 \
| grep '(DW_TAG' \
| wc -l)
limit=$((count + 1))
$execs/dwz-for-test \
-l$limit \
--devel-trace \
1 \
2> dwz.err
if grep -q "Compressing 1 in low-mem mode" dwz.err; then
exit 1
fi
rm -f 1 dwz.err

View File

@ -1,18 +0,0 @@
cp $execs/hello 1
count=$(readelf -wi 1 \
| grep '(DW_TAG' \
| wc -l)
limit=$((count - 1))
$execs/dwz-for-test \
-l$limit \
--devel-trace \
1 \
2> dwz.err
if ! grep -q "Compressing 1 in low-mem mode" dwz.err; then
exit 1
fi
rm -f 1 dwz.err

View File

@ -1,7 +0,0 @@
cp $execs/hello 1
dwz -l0 1
smaller-than.sh 1 $execs/hello
rm -f 1

View File

@ -1,25 +0,0 @@
int
main (void)
{
return 0;
}
int
foo (int i)
{
int j;
asm (".global foo_start_lbl\nfoo_start_lbl:");
j = i *2;
asm (".global foo_end_lbl\nfoo_end_lbl:");
return j;
}
int
bar (int i)
{
int j;
asm (".global bar_start_lbl\nbar_start_lbl:");
j = i *2;
asm (".global bar_end_lbl\nbar_end_lbl:");
return j;
}

View File

@ -1,7 +0,0 @@
cp $execs/hello 1
$execs/dwz-for-test \
-Lnone \
1
rm -f 1

View File

@ -1,5 +0,0 @@
int
foo (void)
{
return 0;
}

View File

@ -1,7 +0,0 @@
extern int foo (void);
int
main (void)
{
return 0;
}

View File

@ -1,12 +0,0 @@
cp $execs/hello 1
cp $execs/hello 2
dwz -m 3 -M /xxx/yyy/3 1 2
smaller-than.sh 1 $execs/hello
smaller-than.sh 2 $execs/hello
[ "$(gnu-debugaltlink-name.sh 1)" = "/xxx/yyy/3" ]
[ "$(gnu-debugaltlink-name.sh 2)" = "/xxx/yyy/3" ]
rm -f 1 2 3

View File

@ -1,12 +0,0 @@
cp $execs/hello 1
cp $execs/hello 2
dwz -m $(pwd -P)/3 -r 1 2
smaller-than.sh 1 $execs/hello
smaller-than.sh 2 $execs/hello
[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
rm -f 1 2 3

View File

@ -1,12 +0,0 @@
cp $execs/hello 1
cp $execs/hello 2
dwz -m 3 1 2
smaller-than.sh 1 $execs/hello
smaller-than.sh 2 $execs/hello
[ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
[ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
rm -f 1 2 3

View File

@ -1,39 +0,0 @@
cp ../hello 1
objcopy --only-keep-debug 1 1.debug
objcopy --strip-debug 1 1.stripped
if ! eu-unstrip 1.stripped 1.debug -o 1.unstripped; then
exit 77
fi
rm 1.unstripped
cp 1.debug 2.debug
if dwz -m 3 1.debug 2.debug 2> dwz.err; status=$?; then
true
fi
rm 2.debug
if grep -q "dwz: Section overlap detected" dwz.err; then
exit 77
fi
[ $status -eq 0 ]
version=$(eu-unstrip --version | head -n 1 | cut -d ' ' -f3)
major=$(echo $version | sed 's%\..*%%')
minor=$(echo $version | sed 's%.*\.%%')
if [ $major -gt 0 ] || [ $minor -ge 168 ]; then
true
else
exit 77
fi
eu-unstrip 1.stripped 1.debug -o 1.unstripped
# An unstripped exec can end up larger than the original (PR elfutils/24809).
#smaller-than.sh 1.unstripped 1
rm -f 1 1.debug 1.stripped 1.unstripped 3 dwz.err

View File

@ -1,35 +0,0 @@
cp ../hello 1
objcopy --only-keep-debug 1 1.debug
objcopy --strip-debug 1 1.stripped
if ! eu-unstrip 1.stripped 1.debug -o 1.unstripped; then
exit 77
fi
rm 1.unstripped
if dwz 1.debug 2> dwz.err; status=$?; then
true
fi
if grep -q "dwz: Section overlap detected" dwz.err; then
exit 77
fi
[ $status -eq 0 ]
version=$(eu-unstrip --version | head -n 1 | cut -d ' ' -f3)
major=$(echo $version | sed 's%\..*%%')
minor=$(echo $version | sed 's%.*\.%%')
if [ $major -gt 0 ] || [ $minor -ge 168 ]; then
true
else
exit 77
fi
eu-unstrip 1.stripped 1.debug -o 1.unstripped
# An unstripped exec can end up larger than the original (PR elfutils/24809).
#smaller-than.sh 1.unstripped 1
rm -f 1 1.debug 1.stripped 1.unstripped dwz.err

View File

@ -1,18 +0,0 @@
objcopy --remove-section=.debug_abbrev $execs/hello 1
cp 1 1.saved
if dwz 1 2>dwz.err; status=$?; then
true
fi
if ! grep -q "\.debug_abbrev not present" dwz.err; then
cat dwz.err
exit 1
fi
[ $status -eq 1 ]
cmp 1 1.saved
rm -f 1 1.saved dwz.err

View File

@ -1,30 +0,0 @@
objcopy --strip-debug $execs/hello 1
cp 1 1.saved
if dwz 1 2>dwz.err; status=$?; then
true
fi
if ! grep -q "\.debug_info section not present" dwz.err; then
cat dwz.err
exit 1
fi
[ $status -eq 0 ]
cmp 1 1.saved
if dwz 1 -o 2 2>dwz.err; status=$?; then
true
fi
if ! grep -q "\.debug_info section not present" dwz.err; then
cat dwz.err
exit 1
fi
[ $status -eq 1 ]
[ ! -f 2 ]
rm -f 1 1.saved dwz.err

View File

@ -1,20 +0,0 @@
#if NAMESPACE
namespace ns {
#endif
KIND bbb
{
int member_four;
};
KIND ccc;
#if NAMESPACE
}
#endif
#include "odr.h"
#if NAMESPACE
KIND ns::aaa var2;
KIND ns::bbb var4;
#else
KIND aaa var2;
KIND bbb var4;
#endif

View File

@ -1,29 +0,0 @@
if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
exit 77
fi
cp $execs/odr-class-ns 1
verify-dwarf.sh 1
aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
[ $aaa -eq 2 ]
bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
[ $bbb -eq 2 ]
ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
[ $ccc -eq 2 ]
$execs/dwz-for-test --odr 1
aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
[ $aaa -eq 1 ]
bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
[ $bbb -eq 1 ]
ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
[ $ccc -eq 1 ]
rm -f 1

View File

@ -1,29 +0,0 @@
if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
exit 77
fi
cp $execs/odr-class 1
verify-dwarf.sh 1
aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
[ $aaa -eq 2 ]
bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
[ $bbb -eq 2 ]
ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
[ $ccc -eq 2 ]
$execs/dwz-for-test --odr 1
aaa=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*aaa')
[ $aaa -eq 1 ]
bbb=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*bbb')
[ $bbb -eq 1 ]
ccc=$(readelf -wi 1 | grep -c 'DW_AT_name.*:.*ccc')
[ $ccc -eq 1 ]
rm -f 1

View File

@ -1,19 +0,0 @@
if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
exit 77
fi
cp $execs/def-decl 1
verify-dwarf.sh 1
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true)
[ $cnt -eq 5 ]
$execs/dwz-for-test --odr 1 --devel-ignore-size
verify-dwarf.sh 1
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*ao_ref" || true)
[ $cnt -eq 2 ]
rm -f 1

View File

@ -1,14 +0,0 @@
struct bbb
{
int member_four;
};
struct ccc;
struct aaa
{
struct bbb *member_one;
struct ccc *member_two;
};
struct aaa var2;
struct bbb var4;

View File

@ -1,19 +0,0 @@
struct bbb;
struct ccc {
int member_three;
};
struct aaa
{
struct bbb *member_one;
struct ccc *member_two;
};
struct aaa var1;
struct ccc var3;
int
main (void)
{
return 0;
}

View File

@ -1,39 +0,0 @@
if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
exit 77
fi
cp $execs/odr-loc 1
for name in aaa bbb ccc; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 2 ]
done
$execs/dwz-for-test --odr 1 --devel-ignore-size
verify-dwarf.sh 1
for name in aaa bbb ccc; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
case $name in
aaa)
[ $cnt -eq 2 ]
;;
*)
[ $cnt -eq 1 ]
;;
esac
done
cp $execs/odr-loc 1
$execs/dwz-for-test --odr --devel-ignore-locus 1
verify-dwarf.sh 1
for name in aaa bbb ccc; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 1 ]
done
rm -f 1

View File

@ -1,61 +0,0 @@
if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
exit 77
fi
readelf_flags=""
if readelf -h 2>&1 | grep -q "\-wN"; then
readelf_flags=-wN
fi
cp $execs/odr-struct 1
cp 1 2
for name in aaa bbb ccc; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 2 ]
done
for name in member_one member_two member_three member_four; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
case $name in
member_one|member_two)
[ $cnt -eq 2 ]
;;
member_three|member_four)
[ $cnt -eq 1 ]
;;
esac
done
decl_cnt=$(readelf -wi 1 | grep -c "DW_AT_declaration" || true)
$execs/dwz-for-test --odr 1 2 -m 3
verify-dwarf.sh 1
verify-dwarf.sh 3
for name in aaa bbb ccc; do
cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 1 ]
done
for name in member_one member_two member_three member_four; do
cnt=$(readelf -wi 3 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 1 ]
done
# Even with -wN readelf 2.38-15.fc37 follows and prints the contents
# of the alt file. So make sure it cannot do that by removing it.
rm 3
for name in aaa bbb ccc; do
cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 0 ]
done
for name in member_one member_two member_three member_four; do
cnt=$(readelf -wi $readelf_flags 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 0 ]
done
rm -f 1 2 3

View File

@ -1,49 +0,0 @@
if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
exit 77
fi
cp $execs/odr-struct-ns 1
for name in aaa bbb ccc; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 2 ]
done
for name in member_one member_two member_three member_four; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
case $name in
member_one|member_two)
[ $cnt -eq 2 ]
;;
member_three|member_four)
[ $cnt -eq 1 ]
;;
esac
done
# Check that bbb and ccc are present as DW_AT_declaration
readelf -wi 1 | grep -3 DW_AT_declaration > decls
grep bbb decls >/dev/null
grep ccc decls >/dev/null
$execs/dwz-for-test --odr 1
verify-dwarf.sh 1
for name in aaa bbb ccc; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 1 ]
done
for name in member_one member_two member_three member_four; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 1 ]
done
# We expect two decls to be removed, for bbb and ccc.
readelf -wi 1 | grep -3 DW_AT_declaration > decls || true
if grep bbb decls >/dev/null ; then exit 1; fi
if grep ccc decls >/dev/null ; then exit 2; fi
rm -f 1 decls

View File

@ -1,49 +0,0 @@
if ! $execs/dwz-for-test --odr -v 2>/dev/null; then
exit 77
fi
cp $execs/odr-struct 1
for name in aaa bbb ccc; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 2 ]
done
for name in member_one member_two member_three member_four; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
case $name in
member_one|member_two)
[ $cnt -eq 2 ]
;;
member_three|member_four)
[ $cnt -eq 1 ]
;;
esac
done
# Check that bbb and ccc are present as DW_AT_declaration
readelf -wi 1 | grep -3 DW_AT_declaration > decls
grep bbb decls >/dev/null
grep ccc decls >/dev/null
$execs/dwz-for-test --odr 1
verify-dwarf.sh 1
for name in aaa bbb ccc; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 1 ]
done
for name in member_one member_two member_three member_four; do
cnt=$(readelf -wi 1 | grep -c "DW_AT_name.*:.*$name" || true)
[ $cnt -eq 1 ]
done
# We expect two decls to be removed, for bbb and ccc.
readelf -wi 1 | grep -3 DW_AT_declaration > decls || true
if grep bbb decls >/dev/null ; then exit 1; fi
if grep ccc decls >/dev/null ; then exit 2; fi
rm -f 1 decls

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