1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-11 09:50:12 +00:00

Import ELF Tool Chain revision 3197

From http://svn.code.sf.net/p/elftoolchain/code
This commit is contained in:
Ed Maste 2015-05-14 17:48:57 +00:00
parent 84d41a2986
commit d400e40862
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/elftoolchain/dist/; revision=282911
svn path=/vendor/elftoolchain/elftoolchain-r3197/; revision=282913; tag=vendor/elftoolchain/elftoolchain-r3197
55 changed files with 225 additions and 144 deletions

19
INSTALL
View File

@ -15,6 +15,7 @@ operating systems.
----------------- -------- -----------------------
`DragonFly BSD`_ 2.10.1 i386
FreeBSD_ v8.2 amd64 & i386
FreeBSD_ v10.1 i386
Minix_ 3.0.2 i386
NetBSD_ v5.0.2 i386
OpenBSD_ v5.0 i386
@ -75,6 +76,22 @@ Prerequisites
% sudo pkg_add -r latex-pgf
:FreeBSD 10.1:
- The core libraries and utilities should build out of the box on
a stock install of FreeBSD.
- To build and run the test suite:
#. The current release of the `Test Execution Toolkit`_ needs to
be downloaded and unpacked into the ``test/tet/`` directory.
#. The ``python`` and ``py27-yaml`` packages need to be installed::
% sudo pkg install python py27-yaml
- Building additional documentation is not currently supported under
FreeBSD 10.1.
:Minix 3.2.0:
- The following packages are pre-requisites for building the
sources on Minix 3.2.0:
@ -299,7 +316,7 @@ website`_.
.. _project website: http://elftoolchain.sourceforge.net/
.. $Id: INSTALL 3165 2015-02-20 20:52:18Z emaste $
.. $Id: INSTALL 3193 2015-05-04 17:47:14Z jkoshy $
.. Local Variables:
.. mode: rst

View File

@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: addr2line.1 2066 2011-10-26 15:40:28Z jkoshy $
.\" $Id: addr2line.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd July 25, 2010
.Os
@ -99,7 +99,7 @@ Print a help message.
Print a version identifier and exit.
.El
.Sh OUTPUT FORMAT
If the
If the
.Fl f
option was not specified,
.Nm
@ -156,4 +156,4 @@ its source file and line number use:
The
.Nm
utility was written by
.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

View File

@ -39,7 +39,7 @@
#include "_elftc.h"
ELFTC_VCSID("$Id: addr2line.c 3174 2015-03-27 17:13:41Z emaste $");
ELFTC_VCSID("$Id: addr2line.c 3197 2015-05-12 21:01:31Z emaste $");
static struct option longopts[] = {
{"target" , required_argument, NULL, 'b'},
@ -84,6 +84,44 @@ version(void)
exit(0);
}
/*
* Handle DWARF 4 'offset from' DW_AT_high_pc. Although we don't
* fully support DWARF 4, some compilers (like FreeBSD Clang 3.5.1)
* generate DW_AT_high_pc as an offset from DW_AT_low_pc.
*
* "If the value of the DW_AT_high_pc is of class address, it is the
* relocated address of the first location past the last instruction
* associated with the entity; if it is of class constant, the value
* is an unsigned integer offset which when added to the low PC gives
* the address of the first location past the last instruction
* associated with the entity."
*
* DWARF4 spec, section 2.17.2.
*/
static int
handle_high_pc(Dwarf_Die die, Dwarf_Unsigned lopc, Dwarf_Unsigned *hipc)
{
Dwarf_Error de;
Dwarf_Half form;
Dwarf_Attribute at;
int ret;
ret = dwarf_attr(die, DW_AT_high_pc, &at, &de);
if (ret == DW_DLV_ERROR) {
warnx("dwarf_attr failed: %s", dwarf_errmsg(de));
return (ret);
}
ret = dwarf_whatform(at, &form, &de);
if (ret == DW_DLV_ERROR) {
warnx("dwarf_whatform failed: %s", dwarf_errmsg(de));
return (ret);
}
if (dwarf_get_form_class(2, 0, 0, form) == DW_FORM_CLASS_CONSTANT)
*hipc += lopc;
return (DW_DLV_OK);
}
static void
search_func(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Addr addr,
const char **rlt_func)
@ -108,6 +146,8 @@ search_func(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Addr addr,
if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc, &de) ||
dwarf_attrval_unsigned(die, DW_AT_high_pc, &hipc, &de))
goto cont_search;
if (handle_high_pc(die, lopc, &hipc) != DW_DLV_OK)
goto cont_search;
if (addr < lopc || addr >= hipc)
goto cont_search;
@ -202,6 +242,8 @@ translate(Dwarf_Debug dbg, const char* addrstr)
* Check if the address falls into the PC range of
* this CU.
*/
if (handle_high_pc(die, lopc, &hipc) != DW_DLV_OK)
continue;
if (addr < lopc || addr >= hipc)
continue;
}

12
ar/ar.1
View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: ar.1 2742 2012-12-10 18:47:36Z jkoshy $
.\" $Id: ar.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd December 10, 2012
.Os
@ -194,11 +194,11 @@ from the archive specified by argument
The archive's symbol table, if present, is updated to reflect
the new contents of the archive.
.It Fl D
When used in combination with the
When used in combination with the
.Fl r
or
.Fl q
option, insert 0's instead of the real mtime, uid and gid values
option, insert 0's instead of the real mtime, uid and gid values
and 0644 instead of file mode from the members named by arguments
.Ar .
This ensures that checksums on the resulting archives are reproducible
@ -346,7 +346,7 @@ or
options,
.Nm
gives a file-by-file description of the archive modification being
performed, which consists of three white-space seperated fields:
performed, which consists of three white-space separated fields:
the option letter, a dash
.Dq "-" ,
and the file name.
@ -554,7 +554,7 @@ using MRI librarian commands, use the following script:
.Bd -literal -offset indent
create ex.a * specify the output archive
addmod ex1.o ex2.o * add modules
save * save pending changes
save * save pending changes
end * exit the utility
.Ed
.Sh DIAGNOSTICS
@ -594,7 +594,7 @@ An
command first appeared in AT&T UNIX Version 1.
In
.Fx 8.0 ,
.An "Kai Wang" Aq kaiw@FreeBSD.org
.An Kai Wang Aq Mt kaiw@FreeBSD.org
reimplemented
.Nm
using the

View File

@ -21,7 +21,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: ar.5 2066 2011-10-26 15:40:28Z jkoshy $
.\" $Id: ar.5 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd November 28, 2010
.Os
@ -126,7 +126,7 @@ The BSD and SVR4/GNU variants use different schemes for encoding file
names for members.
.Bl -tag -width "SVR4/GNU"
.It "BSD"
File names that are upto 16 bytes long and which do not contain
File names that are up to 16 bytes long and which do not contain
embedded spaces are stored directly in the
.Ar ar_name
field of the archive header.
@ -164,7 +164,7 @@ ASCII
.Dq "A BC D"
.Pc .
.It "SVR4/GNU"
File names that are upto 15 characters long are stored directly in the
File names that are up to 15 characters long are stored directly in the
.Ar ar_name
field of the header, terminated by a
.Dq Li /
@ -237,7 +237,7 @@ the ASCII string
No padding is used to separate adjacent file names.
.Ss "Archive Symbol Tables"
Archive symbol tables are used to speed up link editing by providing a
mapping between the program symbols defined in the archive
mapping between the program symbols defined in the archive
and the corresponding archive members.
Archive symbol tables are managed by the
.Xr ranlib 1

View File

@ -72,7 +72,7 @@
#include "ar.h"
ELFTC_VCSID("$Id: ar.c 3174 2015-03-27 17:13:41Z emaste $");
ELFTC_VCSID("$Id: ar.c 3183 2015-04-10 16:18:42Z emaste $");
enum options
{
@ -117,7 +117,7 @@ main(int argc, char **argv)
/*
* Act like ranlib if our name ends in "ranlib"; this
* accomodates names like "arm-freebsd7.1-ranlib",
* accommodates names like "arm-freebsd7.1-ranlib",
* "bsdranlib", etc.
*/
len = strlen(bsdar->progname);

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: ranlib.1 2739 2012-12-09 17:07:46Z jkoshy $
.\" $Id: ranlib.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd December 9, 2012
.Os
@ -77,7 +77,7 @@ command first appeared in AT&T UNIX Version 7.
.Pp
In
.Fx 8.0 ,
.An "Kai Wang" Aq kaiw@FreeBSD.org
.An Kai Wang Aq Mt kaiw@FreeBSD.org
reimplemented
.Nm
using the

View File

@ -38,7 +38,7 @@
#include "ar.h"
ELFTC_VCSID("$Id: read.c 3174 2015-03-27 17:13:41Z emaste $");
ELFTC_VCSID("$Id: read.c 3180 2015-04-09 15:13:57Z emaste $");
/*
* Handle read modes: 'x', 't' and 'p'.
@ -181,7 +181,7 @@ ar_read_archive(struct bsdar *bsdar, int mode)
continue;
}
/* Basic path security flags. */
flags = ARCHIVE_EXTRACT_SECURE_SYMLINKS | \
flags = ARCHIVE_EXTRACT_SECURE_SYMLINKS |
ARCHIVE_EXTRACT_SECURE_NODOTDOT;
if (bsdar->options & AR_O)
flags |= ARCHIVE_EXTRACT_TIME;

View File

@ -40,7 +40,7 @@
#include "ar.h"
ELFTC_VCSID("$Id: write.c 3174 2015-03-27 17:13:41Z emaste $");
ELFTC_VCSID("$Id: write.c 3183 2015-04-10 16:18:42Z emaste $");
#define _ARMAG_LEN 8 /* length of the magic string */
#define _ARHDR_LEN 60 /* length of the archive header */
@ -69,7 +69,7 @@ static void write_objs(struct bsdar *bsdar);
/*
* Create an object from a file, and return the created object
* descriptor. Return NULL if either an error occurs, or if the '-u'
* option was specifed and the member is not newer than the existing
* option was specified and the member is not newer than the existing
* one in the archive.
*/
static struct ar_obj *
@ -426,7 +426,7 @@ ar_write_archive(struct bsdar *bsdar, int mode)
if (mode == 'A') {
/*
* Read objects from the target archive of the
* 'ADDLIB' command. If there are members spcified in
* 'ADDLIB' command. If there are members specified in
* 'argv', read those members only, otherwise the
* entire archive will be read.
*/
@ -447,7 +447,7 @@ ar_write_archive(struct bsdar *bsdar, int mode)
/*
* If we cannot find the position specified by the
* user, sliently insert objects at the tail of the
* user, silently insert objects at the tail of the
* list.
*/
if (pos == NULL)

View File

@ -26,7 +26,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: src/usr.bin/brandelf/brandelf.1,v 1.17 2007/03/09 14:36:18 ru Exp $
.\" $Id: brandelf.1 3101 2014-10-27 22:24:40Z jkoshy $
.\" $Id: brandelf.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd October 27, 2014
.Dt BRANDELF 1
@ -148,4 +148,4 @@ manual page first appeared in
.Fx 2.2 .
.Sh AUTHORS
This manual page was written by
.An John-Mark Gurney Aq gurney_j@efn.org .
.An John-Mark Gurney Aq Mt gurney_j@efn.org .

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $Id: native-elf-format 3167 2015-02-24 19:10:08Z emaste $
# $Id: native-elf-format 3186 2015-04-16 22:16:40Z emaste $
#
# Find the native ELF format for a host platform by compiling a
# test object and examining the resulting object.
@ -33,7 +33,7 @@ $1 ~ "Data:" {
$1 ~ "Machine:" {
if (match($0, "Intel.*386")) {
elfarch = "EM_386";
} else if (match($0, ".*X86-64")) {
} else if (match($0, ".*[xX]86-64")) {
elfarch = "EM_X86_64";
} else {
elfarch = "unknown";

View File

@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: c++filt.1 2175 2011-11-16 05:51:49Z jkoshy $
.\" $Id: c++filt.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd August 24, 2011
.Os
@ -106,4 +106,4 @@ and exit.
The
.Nm
utility was written by
.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elfcopy.1 3173 2015-03-27 16:46:13Z emaste $
.\" $Id: elfcopy.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd March 27, 2015
.Os
@ -330,4 +330,4 @@ Do not copy symbols that are not needed for relocation processing.
.Sh HISTORY
.Nm
has been implemented by
.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

View File

@ -34,7 +34,7 @@
#include "elfcopy.h"
ELFTC_VCSID("$Id: sections.c 3174 2015-03-27 17:13:41Z emaste $");
ELFTC_VCSID("$Id: sections.c 3185 2015-04-11 08:56:34Z kaiwang27 $");
static void add_gnu_debuglink(struct elfcopy *ecp);
static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);
@ -1223,6 +1223,14 @@ update_shdr(struct elfcopy *ecp, int update_link)
osh.sh_info != 0)
osh.sh_info = ecp->secndx[osh.sh_info];
/*
* sh_info of SHT_GROUP section needs to point to the correct
* string in the symbol table.
*/
if (s->type == SHT_GROUP && (ecp->flags & SYMTAB_EXIST) &&
(ecp->flags & SYMTAB_INTACT) == 0)
osh.sh_info = ecp->symndx[osh.sh_info];
if (!gelf_update_shdr(s->os, &osh))
errx(EXIT_FAILURE, "gelf_update_shdr() failed: %s",
elf_errmsg(-1));

View File

@ -34,7 +34,7 @@
#include "elfcopy.h"
ELFTC_VCSID("$Id: segments.c 3177 2015-03-30 18:19:41Z emaste $");
ELFTC_VCSID("$Id: segments.c 3196 2015-05-12 17:33:48Z emaste $");
static void insert_to_inseg_list(struct segment *seg, struct section *sec);
@ -442,7 +442,7 @@ copy_phdr(struct elfcopy *ecp)
s = seg->v_sec[i];
seg->msz = s->vma + s->sz - seg->addr;
if (s->type != SHT_NOBITS)
seg->fsz = seg->msz;
seg->fsz = s->off + s->sz - seg->off;
}
}

View File

@ -33,7 +33,7 @@
#include "elfcopy.h"
ELFTC_VCSID("$Id: symbols.c 3174 2015-03-27 17:13:41Z emaste $");
ELFTC_VCSID("$Id: symbols.c 3191 2015-05-04 17:07:01Z jkoshy $");
/* Symbol table buffer structure. */
struct symbuf {
@ -1090,7 +1090,7 @@ str_hash(const char *s)
{
uint32_t hash;
for (hash = 2166136261; *s; s++)
for (hash = 2166136261UL; *s; s++)
hash = (hash ^ *s) * 16777619;
return (hash & (STHASHSIZE - 1));

View File

@ -23,7 +23,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: src/usr.bin/elfdump/elfdump.1,v 1.6 2005/01/18 13:43:48 ru Exp $
.\" $Id: elfdump.1 2069 2011-10-26 15:53:48Z jkoshy $
.\" $Id: elfdump.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd August 25, 2011
.Dt ELFDUMP 1
@ -141,14 +141,14 @@ The
.Nm
utility
was written by
.An Jake Burkholder Aq jake@FreeBSD.org .
.An Jake Burkholder Aq Mt jake@FreeBSD.org .
Later it was rewritten based on the
libelf library.
This
manual page was written by
.An David O'Brien Aq obrien@FreeBSD.org .
.An David O'Brien Aq Mt obrien@FreeBSD.org .
.Pp
.An Kai Wang Aq kaiw@FreeBSD.org
.An Kai Wang Aq Mt kaiw@FreeBSD.org
rewrote it using the
.Lb libelf
and implemented additional functionality.

View File

@ -50,7 +50,7 @@
#include "_elftc.h"
ELFTC_VCSID("$Id: elfdump.c 3174 2015-03-27 17:13:41Z emaste $");
ELFTC_VCSID("$Id: elfdump.c 3189 2015-04-20 17:02:01Z emaste $");
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
#include "native-elf-format.h"
@ -933,12 +933,11 @@ main(int ac, char **av)
errx(EXIT_FAILURE, "ELF library initialization failed: %s",
elf_errmsg(-1));
for (i = 0; i < ac; i++)
if (av[i] != NULL) {
ed->filename = av[i];
ed->archive = NULL;
elf_print_object(ed);
}
for (i = 0; i < ac; i++) {
ed->filename = av[i];
ed->archive = NULL;
elf_print_object(ed);
}
exit(EXIT_SUCCESS);
}

View File

@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: findtextrel.1 2069 2011-10-26 15:53:48Z jkoshy $
.\" $Id: findtextrel.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd August 25, 2011
.Os
@ -101,4 +101,4 @@ toolset from Red Hat, Inc.
This implementation of the
.Nm
utility was created by
.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

View File

@ -22,7 +22,7 @@
\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: isa.1 2889 2013-01-13 15:36:04Z jkoshy $
.\" $Id: isa.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd January 13, 2013
.Os
@ -237,8 +237,7 @@ Elftoolchain project.
The
.Xr isa 1
utility was written by
.An Joseph Koshy
.Aq jkoshy@users.sourceforge.net .
.An Joseph Koshy Aq Mt jkoshy@users.sourceforge.net .
.Sh BUGS
The
.Nm

View File

@ -22,7 +22,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: isa.5 2900 2013-01-16 12:27:01Z jkoshy $
.\" $Id: isa.5 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd January 16, 2013
.Os
@ -352,8 +352,7 @@ Elftoolchain project.
The
.Xr isa 1
utility was written by
.An Joseph Koshy
.Aq jkoshy@users.sourceforge.net .
.An Joseph Koshy Aq Mt jkoshy@users.sourceforge.net .
.Sh BUGS
The
.Nm

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: dwarf.3 3130 2014-12-21 20:06:29Z jkoshy $
.\" $Id: dwarf.3 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd December 21, 2014
.Os
@ -44,7 +44,7 @@ is defined by the DWARF standard, see
.Xr dwarf 4 .
.Pp
The
.Xr DWARF 3
.Xr DWARF 3
API has two parts:
.Bl -bullet
.It
@ -349,7 +349,7 @@ Retrieve a debugging information entry given an offset.
.It Fn dwarf_siblingof , Fn dwarf_siblingof_b
Retrieve the sibling descriptor for a debugging information entry.
.It Fn dwarf_srclang
Retrive the source language attribute for a debugging information
Retrieve the source language attribute for a debugging information
entry.
.It Fn dwarf_tag
Retrieve the tag for a debugging information entry.
@ -742,12 +742,12 @@ The DWARF standard is defined by
The DWARF(3) API originated at Silicon Graphics Inc.
.Pp
A BSD-licensed implementation of a subset of the API was written by
.An "John Birrell" Aq jb@FreeBSD.org
.An John Birrell Aq Mt jb@FreeBSD.org
for the FreeBSD project.
The implementation was subsequently revised and completed by
.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .
.Pp
Manual pages for this implementation were written by
.An "Joseph Koshy" Aq jkoshy@users.sourceforge.net
.An Joseph Koshy Aq Mt jkoshy@users.sourceforge.net
and
.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_add_line_entry.3 2953 2013-06-30 20:21:38Z kaiwang27 $
.\" $Id: dwarf_add_line_entry.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd June 30, 2013
.Os
@ -66,7 +66,8 @@ Valid source file indices are those returned by the function
.Pp
Argument
.Ar off
specifies a relocatable program address. The ELF symbol to be used
specifies a relocatable program address.
The ELF symbol to be used
for relocation is set by a prior call to the function
.Xr dwarf_lne_set_address 3 .
.Pp

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_def_macro.3 2122 2011-11-09 15:35:14Z jkoshy $
.\" $Id: dwarf_def_macro.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd November 9, 2011
.Os
@ -72,7 +72,7 @@ Argument
.Ar value
should point to a NUL-terminated string containing the value
of the macro.
If the macro doesn't have a value, argument
If the macro does not have a value, argument
.Ar value
should be set to NULL.
.Pp

View File

@ -22,14 +22,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_expand_frame_instructions.3 2122 2011-11-09 15:35:14Z jkoshy $
.\" $Id: dwarf_expand_frame_instructions.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd November 9, 2011
.Os
.Dt DWARF_EXPAND_FRAME_INSTRUCTIONS 3
.Sh NAME
.Nm dwarf_expand_frame_instructions
.Nd expand frame instructions
.Nd expand frame instructions
.Sh LIBRARY
.Lb libdwarf
.Sh SYNOPSIS

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_formblock.3 2073 2011-10-27 03:30:47Z jkoshy $
.\" $Id: dwarf_formblock.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd July 23, 2010
.Os
@ -69,7 +69,7 @@ the DWARF(3) library.
The application should not attempt to free this memory
area.
Portable code may indicate that the memory area is to be freed by
by using
using
.Xr dwarf_dealloc 3 .
.Sh RETURN VALUES
Function

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_formflag.3 2073 2011-10-27 03:30:47Z jkoshy $
.\" $Id: dwarf_formflag.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd June 21, 2010
.Os
@ -58,7 +58,7 @@ or
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
of an error.
of an error.
.Sh RETURN VALUES
Function
.Fn dwarf_formflag

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_formref.3 2073 2011-10-27 03:30:47Z jkoshy $
.\" $Id: dwarf_formref.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd June 21, 2010
.Os
@ -101,7 +101,7 @@ ELF section.
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
of an error.
of an error.
.Sh RETURN VALUES
These functions return
.Dv DW_DLV_OK

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_formsig8.3 2073 2011-10-27 03:30:47Z jkoshy $
.\" $Id: dwarf_formsig8.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd July 24, 2010
.Os
@ -56,7 +56,7 @@ must be
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
of an error.
of an error.
.Sh RETURN VALUES
Function
.Fn dwarf_formsig8

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_formudata.3 2073 2011-10-27 03:30:47Z jkoshy $
.\" $Id: dwarf_formudata.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd June 21, 2010
.Os
@ -88,7 +88,7 @@ and
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
of an error.
of an error.
.Sh RETURN VALUES
These functions return
.Dv DW_DLV_OK

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_get_fde_info_for_all_regs.3 2071 2011-10-27 03:20:00Z jkoshy $
.\" $Id: dwarf_get_fde_info_for_all_regs.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd June 4, 2011
.Os
@ -90,7 +90,8 @@ typedef struct {
For each of the register rules returned,
the
.Va dw_offset_relevant
field is set to 1 if the register rule has a offset value. The
field is set to 1 if the register rule has a offset value.
The
.Va dw_regnum
field is set to the register number associated with the regsiter rule.
The

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_get_fde_info_for_reg.3 2071 2011-10-27 03:20:00Z jkoshy $
.\" $Id: dwarf_get_fde_info_for_reg.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd June 4, 2011
.Os
@ -99,7 +99,7 @@ counter address associated with the register rule found.
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
of an error.
of an error.
.Ss COMPATIBILITY
Function
.Fn dwarf_get_fde_info_for_reg

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_get_ranges.3 2122 2011-11-09 15:35:14Z jkoshy $
.\" $Id: dwarf_get_ranges.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd November 9, 2011
.Os
@ -137,7 +137,7 @@ For this type of entry, the field
.Va dwr_addr1
is the value of the largest representable address offset, and
.Va dwr_addr2
is a base address for the begining and ending address offsets of
is a base address for the beginning and ending address offsets of
subsequent address range entries in the list.
.It Dv DW_RANGES_END
An end of list mark.

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_hasattr.3 3142 2015-01-29 23:11:14Z jkoshy $
.\" $Id: dwarf_hasattr.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd April 17, 2010
.Os
@ -64,7 +64,7 @@ If the named attribute is not present, a zero is written instead.
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
of an error.
of an error.
.Sh RETURN VALUES
On success, function
.Fn dwarf_hasattr

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_next_cu_header.3 3128 2014-12-21 20:06:22Z jkoshy $
.\" $Id: dwarf_next_cu_header.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd December 21, 2014
.Os
@ -220,8 +220,7 @@ unit in the section.
.Ss Iterating Through Type Units in a Debug Context
When a DWARF debug context is allocated using
.Xr dwarf_init 3 ,
an internal pointer assoicated with the context will point to the
fisrt
an internal pointer associated with the context will point to the first
.Dq \&.debug_types
section found in the debug object.
The first call to function

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_producer_init.3 2074 2011-10-27 03:34:33Z jkoshy $
.\" $Id: dwarf_producer_init.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd August 20, 2011
.Os
@ -58,7 +58,7 @@ descriptor representing a DWARF producer instance.
.Pp
The argument
.Ar errhand
should contain the adddress of a function to be called in case of an
should contain the address of a function to be called in case of an
error.
If this argument is
.Dv NULL ,

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: dwarf_whatattr.3 3142 2015-01-29 23:11:14Z jkoshy $
.\" $Id: dwarf_whatattr.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd May 22, 2010
.Os
@ -51,7 +51,7 @@ and writes it to the location pointed to by argument
If argument
.Ar err
is not NULL, it will be used to return an error descriptor in case
of an error.
of an error.
.Sh RETURN VALUES
On success, function
.Fn dwarf_whatattr

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elf.3 3142 2015-01-29 23:11:14Z jkoshy $
.\" $Id: elf.3 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd July 28, 2014
.Os
@ -555,7 +555,7 @@ flag on an ELF descriptor using
.Xr elf_flagelf 3 ,
following which the library will use the data offsets and alignments
specified by the application when laying out the file.
Application control of file layout is described further in the
Application control of file layout is described further in the
.Xr elf_update 3
manual page.
.Pp
@ -608,5 +608,4 @@ The current implementation of the ELF(3) API appeared in
.Fx 7.0 .
.Sh AUTHORS
The ELF library was written by
.An "Joseph Koshy"
.Aq jkoshy@FreeBSD.org .
.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org .

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elf_begin.3 2313 2011-12-11 06:19:24Z jkoshy $
.\" $Id: elf_begin.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd December 11, 2011
.Os
@ -272,7 +272,7 @@ was created.
.It Bq Er ELF_E_ARGUMENT
An
.Xr ar 1
archive was opened with with
archive was opened with
.Ar cmd
set to
.Dv ELF_C_RDWR .

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elf_cntl.3 289 2009-01-08 08:26:08Z jkoshy $
.\" $Id: elf_cntl.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd August 9, 2006
.Os

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elf_getdata.3 1766 2011-08-22 06:01:03Z jkoshy $
.\" $Id: elf_getdata.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd January 26, 2011
.Os
@ -174,7 +174,7 @@ These functions return a valid pointer to a data descriptor if successful, or
NULL if an error occurs.
.Sh ERRORS
These functions may fail with the following errors:
.Bl -tag -width "[ELF_E_RESOURCE]"
.Bl -tag -width "[ELF_E_RESOURCE]"
.It Bq Er ELF_E_ARGUMENT
Either of the arguments
.Ar scn

View File

@ -21,11 +21,11 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elf_open.3 2512 2012-05-31 06:15:57Z jkoshy $
.\" $Id: elf_open.3 3181 2015-04-10 13:22:51Z emaste $
.\"
.Dd May 31, 2012
.Os
.Dt ELF_OPEN 3
.Dt ELF_OPEN 3
.Sh NAME
.Nm elf_open
.Nd open ELF objects and ar(1) archives

View File

@ -41,7 +41,7 @@
#include <sys/mman.h>
#endif
ELFTC_VCSID("$Id: elf_update.c 3013 2014-03-23 06:16:59Z jkoshy $");
ELFTC_VCSID("$Id: elf_update.c 3190 2015-05-04 15:23:08Z jkoshy $");
/*
* Layout strategy:
@ -271,8 +271,10 @@ _libelf_compute_section_extents(Elf *e, Elf_Scn *s, off_t rc)
* offsets and alignment for sanity.
*/
if (e->e_flags & ELF_F_LAYOUT) {
if (scn_alignment > sh_align || sh_offset % sh_align ||
sh_size < scn_size) {
if (scn_alignment > sh_align ||
sh_offset % sh_align ||
sh_size < scn_size ||
sh_offset % _libelf_falign(elftype, ec)) {
LIBELF_SET_ERROR(LAYOUT, 0);
return (0);
}

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: gelf.3 189 2008-07-20 10:38:08Z jkoshy $
.\" $Id: gelf.3 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd September 1, 2006
.Os
@ -197,5 +197,4 @@ This implementation of the API first appeared in
.Fx 7.0 .
.Sh AUTHORS
The GElf API was implemented by
.An "Joseph Koshy"
.Aq jkoshy@FreeBSD.org .
.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org .

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elftc_demangle.3 2065 2011-10-26 15:24:47Z jkoshy $
.\" $Id: elftc_demangle.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd August 24, 2011
.Os
@ -88,7 +88,7 @@ To decode a name that uses an unknown encoding style use:
.Bd -literal -offset indent
char buffer[1024];
const char *funcname;
funcname = ...; /* points to string to be demangled */
if (elftc_demangle(funcname, buffer, sizeof(buffer), 0) == 0)
printf("Demangled name: %\\n", buffer);

View File

@ -21,7 +21,7 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elftc_symbol_table_create.3 2825 2012-12-29 14:25:33Z jkoshy $
.\" $Id: elftc_symbol_table_create.3 3182 2015-04-10 16:08:10Z emaste $
.\"
.Dd December 29, 2012
.Os
@ -224,7 +224,7 @@ should point to a location that will be updated with one of
the following values:
.Bl -tag -width indent -compact -offset indent
.It Dv ELFTC_INSERT_ERROR
An error occured during insertion of the symbol.
An error occurred during insertion of the symbol.
.It Dv ELFTC_INSERT_EXISTING
The name in argument
.Ar symbolname

View File

@ -36,7 +36,7 @@
#include "_libelftc.h"
ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3123 2014-12-21 05:46:19Z kaiwang27 $");
ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3194 2015-05-05 17:55:16Z emaste $");
/**
* @file cpp_demangle.c
@ -316,7 +316,7 @@ cpp_demangle_push_fp(struct cpp_demangle_data *ddata,
rtn = 0;
if ((len = strlen(f)) > 0)
rtn = cpp_demangle_push_str(ddata, f, len);
rtn = cpp_demangle_push_str(ddata, f, len);
free(f);

View File

@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: nm.1 3145 2015-02-15 18:04:37Z emaste $
.\" $Id: nm.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd February 15, 2015
.Os
@ -335,4 +335,4 @@ were specified.
The
.Nm
utility and this manual page were written by
.An Hyogeol Lee Aq hyogeollee@gmail.com .
.An Hyogeol Lee Aq Mt hyogeollee@gmail.com .

View File

@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: readelf.1 3059 2014-06-02 00:42:32Z kaiwang27 $
.\" $Id: readelf.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd September 13, 2012
.Os
@ -194,4 +194,4 @@ separate lines.
The
.Nm
utility was written by
.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

View File

@ -46,7 +46,7 @@
#include "_elftc.h"
ELFTC_VCSID("$Id: readelf.c 3178 2015-03-30 18:29:13Z emaste $");
ELFTC_VCSID("$Id: readelf.c 3189 2015-04-20 17:02:01Z emaste $");
/*
* readelf(1) options.
@ -2673,7 +2673,7 @@ dump_phdr(struct readelf *re)
{
const char *rawfile;
GElf_Phdr phdr;
size_t phnum;
size_t phnum, size;
int i, j;
#define PH_HDR "Type", "Offset", "VirtAddr", "PhysAddr", "FileSiz", \
@ -2726,10 +2726,14 @@ dump_phdr(struct readelf *re)
" 0x%16.16jx 0x%16.16jx %c%c%c"
" %#jx\n", PH_CT);
if (phdr.p_type == PT_INTERP) {
if ((rawfile = elf_rawfile(re->elf, NULL)) == NULL) {
if ((rawfile = elf_rawfile(re->elf, &size)) == NULL) {
warnx("elf_rawfile failed: %s", elf_errmsg(-1));
continue;
}
if (phdr.p_offset >= size) {
warnx("invalid program header offset");
continue;
}
printf(" [Requesting program interpreter: %s]\n",
rawfile + phdr.p_offset);
}
@ -4378,13 +4382,22 @@ dump_mips_options(struct readelf *re, struct section *s)
p = d->d_buf;
pe = p + d->d_size;
while (p < pe) {
if (pe - p < 8) {
warnx("Truncated MIPS option header");
return;
}
kind = re->dw_decode(&p, 1);
size = re->dw_decode(&p, 1);
sndx = re->dw_decode(&p, 2);
info = re->dw_decode(&p, 4);
if (size < 8 || size - 8 > pe - p) {
warnx("Malformed MIPS option header");
return;
}
size -= 8;
switch (kind) {
case ODK_REGINFO:
dump_mips_odk_reginfo(re, p, size - 8);
dump_mips_odk_reginfo(re, p, size);
break;
case ODK_EXCEPTIONS:
printf(" EXCEPTIONS FPU_MIN: %#x\n",
@ -4435,7 +4448,7 @@ dump_mips_options(struct readelf *re, struct section *s)
default:
break;
}
p += size - 8;
p += size;
}
}
@ -7458,11 +7471,10 @@ main(int argc, char **argv)
errx(EXIT_FAILURE, "ELF library initialization failed: %s",
elf_errmsg(-1));
for (i = 0; i < argc; i++)
if (argv[i] != NULL) {
re->filename = argv[i];
dump_object(re);
}
for (i = 0; i < argc; i++) {
re->filename = argv[i];
dump_object(re);
}
exit(EXIT_SUCCESS);
}

View File

@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: size.1 2043 2011-10-23 14:49:16Z jkoshy $
.\" $Id: size.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd August 25, 2011
.Dt SIZE 1
@ -252,6 +252,6 @@ utility first appeared in
The
.Nm
utility was re-written by
.An S. Sam Arun Raj Aq samarunraj@gmail.com
.An S. Sam Arun Raj Aq Mt samarunraj@gmail.com
This manual page was written by
.An S. Sam Arun Raj Aq samarunraj@gmail.com
.An S. Sam Arun Raj Aq Mt samarunraj@gmail.com

View File

@ -38,7 +38,7 @@
#include "_elftc.h"
ELFTC_VCSID("$Id: size.c 3174 2015-03-27 17:13:41Z emaste $");
ELFTC_VCSID("$Id: size.c 3183 2015-04-10 16:18:42Z emaste $");
#define BUF_SIZE 1024
#define ELF_ALIGN(val,x) (((val)+(x)-1) & ~((x)-1))
@ -600,7 +600,7 @@ handle_elf(char const *name)
arhdr->ar_name);
continue;
}
/* Core dumps are handled seperately */
/* Core dumps are handled separately */
if (elfhdr.e_shnum == 0 && elfhdr.e_type == ET_CORE) {
exit_code = handle_core(name, elf, &elfhdr);
(void) elf_end(elf);

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: strings.1 2352 2011-12-19 11:21:10Z jkoshy $
.\" $Id: strings.1 3195 2015-05-12 17:22:19Z emaste $
.\"
.Dd December 19, 2011
.Dt STRINGS 1
@ -157,6 +157,6 @@ when i386-only a.out format was dropped in favor of ELF.
The
.Nm
utility was re-written by
.An S.Sam Arun Raj Aq samarunraj@gmail.com .
.An S.Sam Arun Raj Aq Mt samarunraj@gmail.com .
This manual page was written by
.An S.Sam Arun Raj Aq samarunraj@gmail.com .
.An S.Sam Arun Raj Aq Mt samarunraj@gmail.com .

View File

@ -1,4 +1,4 @@
# $Id: Makefile 3025 2014-04-18 16:20:25Z jkoshy $
# $Id: Makefile 3192 2015-05-04 17:20:15Z jkoshy $
PLUGINS= ardiff teraser
@ -9,7 +9,9 @@ ${PLUGINS}:
${MAKE} -f Makefile.${plugin}
.endfor
clean cleandepend depend:
test: .PHONY
clean cleandepend depend: .PHONY
.for plugin in ${PLUGINS}
${MAKE} -f Makefile.${plugin} ${.TARGET}
.endfor

View File

@ -1,4 +1,4 @@
# $Id: Makefile 3025 2014-04-18 16:20:25Z jkoshy $
# $Id: Makefile 3192 2015-05-04 17:20:15Z jkoshy $
PLUGINS= ardiff teraser
@ -9,7 +9,9 @@ ${PLUGINS}:
${MAKE} -f Makefile.${plugin}
.endfor
clean cleandepend depend:
test: .PHONY
clean cleandepend depend: .PHONY
.for plugin in ${PLUGINS}
${MAKE} -f Makefile.${plugin} ${.TARGET}
.endfor