aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL8
-rw-r--r--addr2line/addr2line.c3
-rw-r--r--ar/acplex.l4
-rw-r--r--ar/acpyacc.y2
-rw-r--r--ar/ar.c4
-rw-r--r--ar/read.c13
-rw-r--r--ar/util.c3
-rw-r--r--ar/write.c3
-rw-r--r--brandelf/brandelf.c4
-rw-r--r--common/_elftc.h32
-rw-r--r--common/elfdefinitions.h4
-rwxr-xr-xcommon/native-elf-format4
-rw-r--r--cxxfilt/cxxfilt.c3
-rw-r--r--elfcopy/archive.c4
-rw-r--r--elfcopy/ascii.c4
-rw-r--r--elfcopy/binary.c3
-rw-r--r--elfcopy/elfcopy.114
-rw-r--r--elfcopy/elfcopy.h5
-rw-r--r--elfcopy/main.c21
-rw-r--r--elfcopy/sections.c19
-rw-r--r--elfcopy/segments.c4
-rw-r--r--elfcopy/symbols.c23
-rw-r--r--elfdump/elfdump.c3
-rw-r--r--findtextrel/findtextrel.c3
-rw-r--r--ld/ld.h3
-rw-r--r--libdwarf/_libdwarf.h3
-rw-r--r--libdwarf/libdwarf.h10
-rw-r--r--libdwarf/libdwarf_lineno.c4
-rw-r--r--libelf/_libelf.h10
-rw-r--r--libelf/_libelf_config.h4
-rw-r--r--libelf/elf_data.c3
-rw-r--r--libelf/elf_end.c4
-rw-r--r--libelf/elf_errmsg.c4
-rw-r--r--libelf/elf_errno.c4
-rw-r--r--libelf/elf_fill.c4
-rw-r--r--libelf/elf_flag.c4
-rw-r--r--libelf/elf_getarhdr.c4
-rw-r--r--libelf/elf_getarsym.c4
-rw-r--r--libelf/elf_getbase.c4
-rw-r--r--libelf/elf_getident.c4
-rw-r--r--libelf/elf_hash.c4
-rw-r--r--libelf/elf_kind.c4
-rw-r--r--libelf/elf_next.c4
-rw-r--r--libelf/elf_phnum.c4
-rw-r--r--libelf/elf_rand.c4
-rw-r--r--libelf/elf_rawfile.c4
-rw-r--r--libelf/elf_scn.c4
-rw-r--r--libelf/elf_shnum.c4
-rw-r--r--libelf/elf_shstrndx.c4
-rw-r--r--libelf/elf_version.c4
-rw-r--r--libelf/gelf.h12
-rw-r--r--libelf/gelf_cap.c5
-rw-r--r--libelf/gelf_checksum.c4
-rw-r--r--libelf/gelf_dyn.c5
-rw-r--r--libelf/gelf_ehdr.c5
-rw-r--r--libelf/gelf_fsize.c4
-rw-r--r--libelf/gelf_getclass.c4
-rw-r--r--libelf/gelf_move.c5
-rw-r--r--libelf/gelf_phdr.c5
-rw-r--r--libelf/gelf_rel.c5
-rw-r--r--libelf/gelf_rela.c5
-rw-r--r--libelf/gelf_shdr.c5
-rw-r--r--libelf/gelf_sym.c5
-rw-r--r--libelf/gelf_syminfo.c4
-rw-r--r--libelf/gelf_symshndx.c4
-rw-r--r--libelf/gelf_xlate.c4
-rw-r--r--libelf/libelf.h10
-rw-r--r--libelf/libelf_align.c4
-rw-r--r--libelf/libelf_allocate.c4
-rw-r--r--libelf/libelf_ar.c4
-rw-r--r--libelf/libelf_ar_util.c4
-rw-r--r--libelf/libelf_checksum.c4
-rw-r--r--libelf/libelf_convert.m44
-rw-r--r--libelf/libelf_data.c4
-rw-r--r--libelf/libelf_ehdr.c4
-rw-r--r--libelf/libelf_extended.c4
-rw-r--r--libelf/libelf_msize.m44
-rw-r--r--libelf/libelf_phdr.c4
-rw-r--r--libelf/libelf_shdr.c4
-rw-r--r--libelf/libelf_xlate.c4
-rw-r--r--libelftc/_libelftc.h10
-rw-r--r--libelftc/elftc_bfdtarget.c4
-rw-r--r--libelftc/elftc_demangle.c4
-rw-r--r--libelftc/libelftc.h10
-rw-r--r--libelftc/libelftc_bfdtarget.c4
-rw-r--r--nm/nm.c70
-rw-r--r--readelf/readelf.c10
-rw-r--r--size/size.c3
-rw-r--r--strings/strings.c3
-rw-r--r--test/libelf/tset/common/ehdr_template.m44
-rw-r--r--test/libelf/tset/common/gelf_ehdr_template.h4
-rw-r--r--test/libelf/tset/common/phdr_template.c4
-rw-r--r--test/libelf/tset/common/xlate_template.c3
-rw-r--r--test/libelf/tset/elf32_getehdr/ehdr.m44
-rw-r--r--test/libelf/tset/elf32_getphdr/phdr.m44
-rw-r--r--test/libelf/tset/elf32_newehdr/ehdr.m44
-rw-r--r--test/libelf/tset/elf64_getehdr/ehdr.m44
-rw-r--r--test/libelf/tset/elf64_getphdr/phdr.m44
-rw-r--r--test/libelf/tset/elf64_newehdr/ehdr.m44
-rw-r--r--test/libelf/tset/gelf_getehdr/ehdr.m44
-rw-r--r--test/libelf/tset/gelf_newehdr/ehdr.m44
-rw-r--r--test/libelf/tset/gelf_xlate/xlate.m44
102 files changed, 308 insertions, 307 deletions
diff --git a/INSTALL b/INSTALL
index 4171ce816f7b..ddab88de4728 100644
--- a/INSTALL
+++ b/INSTALL
@@ -171,13 +171,14 @@ Prerequisites
``pmake`` A ``make`` that uses BSD-make syntax.
``python-yaml`` A YAML library for Python.
``sharutils`` For ``uudecode``.
+ ``zlib1g-dev`` Compression library.
=================== =====================================
The following command line may be used to install the necessary
pre-requisites::
% sudo apt-get install binutils bison flex gcc libarchive-dev \
- libc6-dev m4 pmake
+ libc6-dev m4 pmake zlib1g-dev
- To build and run the test suite:
@@ -211,13 +212,14 @@ Prerequisites
``pmake`` A ``make`` that uses BSD-make syntax.
``python-yaml`` A YAML library for Python.
``sharutils`` For ``uudecode``.
+ ``zlib1g-dev`` Compression library.
=================== =====================================
The following command line may be used to install the necessary
pre-requisites::
% sudo apt-get install bison build-essential flex libarchive-dev \
- m4 pmake
+ m4 pmake zlib1g-dev
- To build and run the test suite:
@@ -297,7 +299,7 @@ website`_.
.. _project website: http://elftoolchain.sourceforge.net/
-.. $Id: INSTALL 3020 2014-04-17 15:52:31Z jkoshy $
+.. $Id: INSTALL 3165 2015-02-20 20:52:18Z emaste $
.. Local Variables:
.. mode: rst
diff --git a/addr2line/addr2line.c b/addr2line/addr2line.c
index 6dcf19ceca4a..d6f5d73e8d7a 100644
--- a/addr2line/addr2line.c
+++ b/addr2line/addr2line.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <dwarf.h>
#include <err.h>
@@ -40,7 +39,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: addr2line.c 3148 2015-02-15 18:47:39Z emaste $");
+ELFTC_VCSID("$Id: addr2line.c 3174 2015-03-27 17:13:41Z emaste $");
static struct option longopts[] = {
{"target" , required_argument, NULL, 'b'},
diff --git a/ar/acplex.l b/ar/acplex.l
index cde256f96499..6b50fb3b19dd 100644
--- a/ar/acplex.l
+++ b/ar/acplex.l
@@ -25,8 +25,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <err.h>
#include <errno.h>
#include <stdio.h>
@@ -34,7 +32,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: acplex.l 3162 2015-02-15 21:43:41Z emaste $");
+ELFTC_VCSID("$Id: acplex.l 3174 2015-03-27 17:13:41Z emaste $");
#include "acpyacc.h"
diff --git a/ar/acpyacc.y b/ar/acpyacc.y
index e1d02ec82513..84f08e2393af 100644
--- a/ar/acpyacc.y
+++ b/ar/acpyacc.y
@@ -25,8 +25,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/queue.h>
diff --git a/ar/ar.c b/ar/ar.c
index 9cdddb2ca406..05327a2b186c 100644
--- a/ar/ar.c
+++ b/ar/ar.c
@@ -58,8 +58,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <sys/queue.h>
#include <sys/types.h>
#include <archive.h>
@@ -74,7 +72,7 @@
#include "ar.h"
-ELFTC_VCSID("$Id: ar.c 2485 2012-04-07 15:54:59Z kaiwang27 $");
+ELFTC_VCSID("$Id: ar.c 3174 2015-03-27 17:13:41Z emaste $");
enum options
{
diff --git a/ar/read.c b/ar/read.c
index f047a430caef..84bb032231a7 100644
--- a/ar/read.c
+++ b/ar/read.c
@@ -25,7 +25,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/queue.h>
#include <sys/stat.h>
@@ -39,7 +38,7 @@
#include "ar.h"
-ELFTC_VCSID("$Id: read.c 3163 2015-02-15 21:43:51Z emaste $");
+ELFTC_VCSID("$Id: read.c 3174 2015-03-27 17:13:41Z emaste $");
/*
* Handle read modes: 'x', 't' and 'p'.
@@ -175,7 +174,15 @@ ar_read_archive(struct bsdar *bsdar, int mode)
if (bsdar->options & AR_V)
(void)fprintf(out, "x - %s\n", name);
- flags = 0;
+ /* Disallow absolute paths. */
+ if (name[0] == '/') {
+ bsdar_warnc(bsdar, 0,
+ "Absolute path '%s'", name);
+ continue;
+ }
+ /* Basic path security flags. */
+ flags = ARCHIVE_EXTRACT_SECURE_SYMLINKS | \
+ ARCHIVE_EXTRACT_SECURE_NODOTDOT;
if (bsdar->options & AR_O)
flags |= ARCHIVE_EXTRACT_TIME;
diff --git a/ar/util.c b/ar/util.c
index 8ed877a60269..f22542e67db2 100644
--- a/ar/util.c
+++ b/ar/util.c
@@ -24,7 +24,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -38,7 +37,7 @@
#include "ar.h"
-ELFTC_VCSID("$Id: util.c 2130 2011-11-10 06:56:46Z jkoshy $");
+ELFTC_VCSID("$Id: util.c 3174 2015-03-27 17:13:41Z emaste $");
static void bsdar_vwarnc(struct bsdar *, int code,
const char *fmt, va_list ap);
diff --git a/ar/write.c b/ar/write.c
index 490b22fab07b..0b962d22cd82 100644
--- a/ar/write.c
+++ b/ar/write.c
@@ -24,7 +24,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/queue.h>
#include <sys/stat.h>
@@ -41,7 +40,7 @@
#include "ar.h"
-ELFTC_VCSID("$Id: write.c 3102 2014-10-29 21:09:01Z jkoshy $");
+ELFTC_VCSID("$Id: write.c 3174 2015-03-27 17:13:41Z emaste $");
#define _ARMAG_LEN 8 /* length of the magic string */
#define _ARHDR_LEN 60 /* length of the archive header */
diff --git a/brandelf/brandelf.c b/brandelf/brandelf.c
index 286b6ab12359..5f5e6317b7b6 100644
--- a/brandelf/brandelf.c
+++ b/brandelf/brandelf.c
@@ -28,8 +28,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <sys/types.h>
#include <sys/stat.h>
#include <err.h>
@@ -46,7 +44,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: brandelf.c 3101 2014-10-27 22:24:40Z jkoshy $");
+ELFTC_VCSID("$Id: brandelf.c 3174 2015-03-27 17:13:41Z emaste $");
static int elftype(const char *);
static const char *iselftype(int);
diff --git a/common/_elftc.h b/common/_elftc.h
index d6c878402747..45f0abd80774 100644
--- a/common/_elftc.h
+++ b/common/_elftc.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: _elftc.h 3139 2015-01-05 03:17:06Z kaiwang27 $
+ * $Id: _elftc.h 3175 2015-03-27 17:21:24Z emaste $
*/
/**
@@ -294,7 +294,8 @@ struct name { \
#define ELFTC_VCSID(ID) __FBSDID(ID)
#endif
-#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
+#if defined(__APPLE__) || defined(__GLIBC__) || defined(__GNU__) || \
+ defined(__linux__)
#if defined(__GNUC__)
#define ELFTC_VCSID(ID) __asm__(".ident\t\"" ID "\"")
#else
@@ -330,8 +331,8 @@ struct name { \
#ifndef ELFTC_GETPROGNAME
-#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__minix) || \
- defined(__NetBSD__)
+#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || \
+ defined(__minix) || defined(__NetBSD__)
#include <stdlib.h>
@@ -340,7 +341,7 @@ struct name { \
#endif /* __DragonFly__ || __FreeBSD__ || __minix || __NetBSD__ */
-#if defined(__GLIBC__)
+#if defined(__GLIBC__) || defined(__linux__)
/*
* GLIBC based systems have a global 'char *' pointer referencing
@@ -350,7 +351,7 @@ extern const char *program_invocation_short_name;
#define ELFTC_GETPROGNAME() program_invocation_short_name
-#endif /* __GLIBC__ */
+#endif /* __GLIBC__ || __linux__ */
#if defined(__OpenBSD__)
@@ -368,6 +369,21 @@ extern const char *__progname;
** Per-OS configuration.
**/
+#if defined(__APPLE__)
+
+#include <machine/endian.h>
+#define roundup2 roundup
+
+#define ELFTC_BYTE_ORDER _BYTE_ORDER
+#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN _LITTLE_ENDIAN
+#define ELFTC_BYTE_ORDER_BIG_ENDIAN _BIG_ENDIAN
+
+#define ELFTC_HAVE_MMAP 1
+#define ELFTC_HAVE_STRMODE 1
+
+#endif /* __APPLE__ */
+
+
#if defined(__DragonFly__)
#include <osreldate.h>
@@ -381,7 +397,7 @@ extern const char *__progname;
#endif
-#if defined(__GLIBC__)
+#if defined(__GLIBC__) || defined(__linux__)
#include <endian.h>
@@ -401,7 +417,7 @@ extern const char *__progname;
#define roundup2 roundup
-#endif /* __GLIBC__ */
+#endif /* __GLIBC__ || __linux__ */
#if defined(__FreeBSD__)
diff --git a/common/elfdefinitions.h b/common/elfdefinitions.h
index f0a2fc2dade5..a53acde8b6ce 100644
--- a/common/elfdefinitions.h
+++ b/common/elfdefinitions.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: elfdefinitions.h 3149 2015-02-15 19:00:06Z emaste $
+ * $Id: elfdefinitions.h 3178 2015-03-30 18:29:13Z emaste $
*/
/*
@@ -171,7 +171,7 @@ _ELF_DEFINE_DT(DT_MOVEENT, 0x6FFFFDFAUL, \
"size of DT_MOVETAB entries") \
_ELF_DEFINE_DT(DT_MOVESZ, 0x6FFFFDFBUL, \
"total size of the MOVETAB table") \
-_ELF_DEFINE_DT(DT_FEATURE_1, 0x6FFFFDFCUL, "feature values") \
+_ELF_DEFINE_DT(DT_FEATURE, 0x6FFFFDFCUL, "feature values") \
_ELF_DEFINE_DT(DT_POSFLAG_1, 0x6FFFFDFDUL, \
"dynamic position flags") \
_ELF_DEFINE_DT(DT_SYMINSZ, 0x6FFFFDFEUL, \
diff --git a/common/native-elf-format b/common/native-elf-format
index af707591d19d..34d84bf28967 100755
--- a/common/native-elf-format
+++ b/common/native-elf-format
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $Id: native-elf-format 2064 2011-10-26 15:12:32Z jkoshy $
+# $Id: native-elf-format 3167 2015-02-24 19:10:08Z emaste $
#
# Find the native ELF format for a host platform by compiling a
# test object and examining the resulting object.
@@ -19,7 +19,7 @@ touch ${tmp_c}
echo "/* Generated by ${program} on `date` */"
cc -c ${tmp_c} -o ${tmp_o}
-readelf -h ${tmp_o} | awk '
+LC_ALL=C readelf -h ${tmp_o} | awk '
$1 ~ "Class:" {
sub("ELF","",$2); elfclass = $2;
}
diff --git a/cxxfilt/cxxfilt.c b/cxxfilt/cxxfilt.c
index d30cfaeffdd7..4efa45b33f22 100644
--- a/cxxfilt/cxxfilt.c
+++ b/cxxfilt/cxxfilt.c
@@ -24,7 +24,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <ctype.h>
#include <err.h>
@@ -36,7 +35,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: cxxfilt.c 2185 2011-11-19 16:07:16Z jkoshy $");
+ELFTC_VCSID("$Id: cxxfilt.c 3174 2015-03-27 17:13:41Z emaste $");
#define STRBUFSZ 8192
diff --git a/elfcopy/archive.c b/elfcopy/archive.c
index 4735f02296e3..682a1df66dcc 100644
--- a/elfcopy/archive.c
+++ b/elfcopy/archive.c
@@ -24,8 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <sys/param.h>
#include <sys/stat.h>
#include <err.h>
@@ -40,7 +38,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: archive.c 3102 2014-10-29 21:09:01Z jkoshy $");
+ELFTC_VCSID("$Id: archive.c 3174 2015-03-27 17:13:41Z emaste $");
#define _ARMAG_LEN 8 /* length of ar magic string */
#define _ARHDR_LEN 60 /* length of ar header */
diff --git a/elfcopy/ascii.c b/elfcopy/ascii.c
index 968e5c667f63..cad4eb8a91eb 100644
--- a/elfcopy/ascii.c
+++ b/elfcopy/ascii.c
@@ -24,11 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <ctype.h>
#include <err.h>
#include <gelf.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -36,7 +36,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: ascii.c 2358 2011-12-19 18:22:32Z kaiwang27 $");
+ELFTC_VCSID("$Id: ascii.c 3177 2015-03-30 18:19:41Z emaste $");
static void append_data(struct section *s, const void *buf, size_t sz);
static char hex_digit(uint8_t n);
diff --git a/elfcopy/binary.c b/elfcopy/binary.c
index 65b49fbe874f..23e46e77f392 100644
--- a/elfcopy/binary.c
+++ b/elfcopy/binary.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <err.h>
@@ -36,7 +35,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: binary.c 2358 2011-12-19 18:22:32Z kaiwang27 $");
+ELFTC_VCSID("$Id: binary.c 3174 2015-03-27 17:13:41Z emaste $");
/*
* Convert ELF object to `binary'. Sections with SHF_ALLOC flag set
diff --git a/elfcopy/elfcopy.1 b/elfcopy/elfcopy.1
index 2976da377d2b..ce8f120196ac 100644
--- a/elfcopy/elfcopy.1
+++ b/elfcopy/elfcopy.1
@@ -21,9 +21,9 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: elfcopy.1 2373 2011-12-30 07:13:44Z jkoshy $
+.\" $Id: elfcopy.1 3173 2015-03-27 16:46:13Z emaste $
.\"
-.Dd October 03, 2011
+.Dd March 27, 2015
.Os
.Dt ELFCOPY 1
.Sh NAME
@@ -63,7 +63,9 @@
.Op Fl -adjust-warnings | Fl -change-warnings
.Op Fl -change-section-lma Ar section Ns {+|-|=} Ns Ar val
.Op Fl -change-section-vma Ar section Ns {+|-|=} Ns Ar val
+.Op Fl -extract-dwo
.Op Fl -gap-fill Ns = Ns Ar val
+.Op Fl -localize-hidden
.Op Fl -no-adjust-warnings | Fl -no-change-warnings
.Op Fl -only-keep-debug
.Op Fl -pad-to Ns = Ns Ar address
@@ -75,6 +77,7 @@
.Op Fl -set-start Ns = Ns Ar address
.Op Fl -srec-forceS3
.Op Fl -srec-len Ns = Ns Ar val
+.Op Fl -strip-dwo
.Op Fl -strip-unneeded
.Ar infile
.Op Ar outfile
@@ -220,10 +223,15 @@ Depending on the operator specified, the value in argument
.Ar val
will be used as an increment, a decrement or as the new value
of the virtual memory address.
+.It Fl -extract-dwo
+Copy only .dwo debug sections to the output file.
.It Fl -gap-fill Ns = Ns Ar val
Fill the gaps between sections with the byte value specified by
the argument
.Ar val .
+.It Fl -localize-hidden
+Make all hidden symbols local to the output file.
+This includes symbols with internal visiblity.
.It Fl -no-adjust-warnings | Fl -no-change-warnings
Do not issue a warning if the section specified by the options
.Fl -change-section-address ,
@@ -304,6 +312,8 @@ Set the maximum length of an S-record line to
.Ar val .
This option is only meaningful when the output target is set to
.Dq srec .
+.It Fl -strip-dwo
+Do not copy .dwo debug sections to the output file.
.It Fl -strip-unneeded
Do not copy symbols that are not needed for relocation processing.
.El
diff --git a/elfcopy/elfcopy.h b/elfcopy/elfcopy.h
index 7b3a9b1af9b4..b750246d850d 100644
--- a/elfcopy/elfcopy.h
+++ b/elfcopy/elfcopy.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: elfcopy.h 3134 2014-12-23 10:43:59Z kaiwang27 $
+ * $Id: elfcopy.h 3173 2015-03-27 16:46:13Z emaste $
*/
#include <sys/queue.h>
@@ -190,7 +190,9 @@ struct elfcopy {
STRIP_NONE = 0,
STRIP_ALL,
STRIP_DEBUG,
+ STRIP_DWO,
STRIP_NONDEBUG,
+ STRIP_NONDWO,
STRIP_UNNEEDED
} strip;
@@ -216,6 +218,7 @@ struct elfcopy {
#define SEC_REMOVE 0x00800000U
#define SEC_COPY 0x01000000U
#define DISCARD_LLABEL 0x02000000U
+#define LOCALIZE_HIDDEN 0x04000000U
int flags; /* elfcopy run control flags. */
int64_t change_addr; /* Section address adjustment. */
diff --git a/elfcopy/main.c b/elfcopy/main.c
index e5bea86fb6fa..a48aea589748 100644
--- a/elfcopy/main.c
+++ b/elfcopy/main.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/stat.h>
@@ -40,7 +39,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: main.c 3156 2015-02-15 21:40:01Z emaste $");
+ELFTC_VCSID("$Id: main.c 3174 2015-03-27 17:13:41Z emaste $");
enum options
{
@@ -57,9 +56,11 @@ enum options
ECP_GLOBALIZE_SYMBOLS,
ECP_KEEP_SYMBOLS,
ECP_KEEP_GLOBAL_SYMBOLS,
+ ECP_LOCALIZE_HIDDEN,
ECP_LOCALIZE_SYMBOLS,
ECP_NO_CHANGE_WARN,
ECP_ONLY_DEBUG,
+ ECP_ONLY_DWO,
ECP_PAD_TO,
ECP_PREFIX_ALLOC,
ECP_PREFIX_SEC,
@@ -72,6 +73,7 @@ enum options
ECP_SET_START,
ECP_SREC_FORCE_S3,
ECP_SREC_LEN,
+ ECP_STRIP_DWO,
ECP_STRIP_SYMBOLS,
ECP_STRIP_UNNEEDED,
ECP_WEAKEN_ALL,
@@ -124,6 +126,7 @@ static struct option elfcopy_longopts[] =
{"change-warnings", no_argument, NULL, ECP_CHANGE_WARN},
{"discard-all", no_argument, NULL, 'x'},
{"discard-locals", no_argument, NULL, 'X'},
+ {"extract-dwo", no_argument, NULL, ECP_ONLY_DWO},
{"gap-fill", required_argument, NULL, ECP_GAP_FILL},
{"globalize-symbol", required_argument, NULL, ECP_GLOBALIZE_SYMBOL},
{"globalize-symbols", required_argument, NULL, ECP_GLOBALIZE_SYMBOLS},
@@ -134,6 +137,7 @@ static struct option elfcopy_longopts[] =
{"keep-global-symbol", required_argument, NULL, 'G'},
{"keep-global-symbols", required_argument, NULL,
ECP_KEEP_GLOBAL_SYMBOLS},
+ {"localize-hidden", no_argument, NULL, ECP_LOCALIZE_HIDDEN},
{"localize-symbol", required_argument, NULL, 'L'},
{"localize-symbols", required_argument, NULL, ECP_LOCALIZE_SYMBOLS},
{"no-adjust-warnings", no_argument, NULL, ECP_NO_CHANGE_WARN},
@@ -157,6 +161,7 @@ static struct option elfcopy_longopts[] =
{"srec-len", required_argument, NULL, ECP_SREC_LEN},
{"strip-all", no_argument, NULL, 'S'},
{"strip-debug", no_argument, 0, 'g'},
+ {"strip-dwo", no_argument, NULL, ECP_STRIP_DWO},
{"strip-symbol", required_argument, NULL, 'N'},
{"strip-symbols", required_argument, NULL, ECP_STRIP_SYMBOLS},
{"strip-unneeded", no_argument, NULL, ECP_STRIP_UNNEEDED},
@@ -348,6 +353,7 @@ create_elf(struct elfcopy *ecp)
if (ecp->strip == STRIP_DEBUG ||
ecp->strip == STRIP_UNNEEDED ||
ecp->flags & WEAKEN_ALL ||
+ ecp->flags & LOCALIZE_HIDDEN ||
ecp->flags & DISCARD_LOCAL ||
ecp->flags & DISCARD_LLABEL ||
ecp->prefix_sym != NULL ||
@@ -870,6 +876,9 @@ elfcopy_main(struct elfcopy *ecp, int argc, char **argv)
case ECP_KEEP_GLOBAL_SYMBOLS:
parse_symlist_file(ecp, optarg, SYMOP_KEEPG);
break;
+ case ECP_LOCALIZE_HIDDEN:
+ ecp->flags |= LOCALIZE_HIDDEN;
+ break;
case ECP_LOCALIZE_SYMBOLS:
parse_symlist_file(ecp, optarg, SYMOP_LOCALIZE);
break;
@@ -879,6 +888,9 @@ elfcopy_main(struct elfcopy *ecp, int argc, char **argv)
case ECP_ONLY_DEBUG:
ecp->strip = STRIP_NONDEBUG;
break;
+ case ECP_ONLY_DWO:
+ ecp->strip = STRIP_NONDWO;
+ break;
case ECP_PAD_TO:
ecp->pad_to = (uint64_t) strtoull(optarg, NULL, 0);
break;
@@ -939,6 +951,9 @@ elfcopy_main(struct elfcopy *ecp, int argc, char **argv)
ecp->flags |= SREC_FORCE_LEN;
ecp->srec_len = strtoul(optarg, NULL, 0);
break;
+ case ECP_STRIP_DWO:
+ ecp->strip = STRIP_DWO;
+ break;
case ECP_STRIP_SYMBOLS:
parse_symlist_file(ecp, optarg, SYMOP_STRIP);
break;
@@ -1379,6 +1394,8 @@ Usage: %s [options] infile [outfile]\n\
section by VAL.\n\
--gap-fill=VAL Fill the gaps between sections with bytes\n\
of value VAL.\n\
+ --localize-hidden Make all hidden symbols local to the output\n\
+ file.\n\
--no-adjust-warning| --no-change-warnings\n\
Do not issue warnings for non-existent\n\
sections.\n\
diff --git a/elfcopy/sections.c b/elfcopy/sections.c
index ee6d17278ee6..077bb74b0f53 100644
--- a/elfcopy/sections.c
+++ b/elfcopy/sections.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <err.h>
@@ -35,7 +34,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: sections.c 3150 2015-02-15 19:07:46Z emaste $");
+ELFTC_VCSID("$Id: sections.c 3174 2015-03-27 17:13:41Z emaste $");
static void add_gnu_debuglink(struct elfcopy *ecp);
static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);
@@ -47,6 +46,7 @@ static void insert_to_strtab(struct section *t, const char *s);
static int is_append_section(struct elfcopy *ecp, const char *name);
static int is_compress_section(struct elfcopy *ecp, const char *name);
static int is_debug_section(const char *name);
+static int is_dwo_section(const char *name);
static int is_modify_section(struct elfcopy *ecp, const char *name);
static int is_print_section(struct elfcopy *ecp, const char *name);
static int lookup_string(struct section *t, const char *s);
@@ -73,6 +73,11 @@ is_remove_section(struct elfcopy *ecp, const char *name)
return (0);
}
+ if (ecp->strip == STRIP_DWO && is_dwo_section(name))
+ return (1);
+ if (ecp->strip == STRIP_NONDWO && !is_dwo_section(name))
+ return (1);
+
if (is_debug_section(name)) {
if (ecp->strip == STRIP_ALL ||
ecp->strip == STRIP_DEBUG ||
@@ -234,6 +239,16 @@ is_debug_section(const char *name)
}
static int
+is_dwo_section(const char *name)
+{
+ size_t len;
+
+ if ((len = strlen(name)) > 4 && strcmp(name + len - 4, ".dwo") == 0)
+ return (1);
+ return (0);
+}
+
+static int
is_print_section(struct elfcopy *ecp, const char *name)
{
struct sec_action *sac;
diff --git a/elfcopy/segments.c b/elfcopy/segments.c
index 1cdf4664ebec..3ed6d93bbcd1 100644
--- a/elfcopy/segments.c
+++ b/elfcopy/segments.c
@@ -24,17 +24,17 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/queue.h>
#include <err.h>
#include <gelf.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "elfcopy.h"
-ELFTC_VCSID("$Id: segments.c 3134 2014-12-23 10:43:59Z kaiwang27 $");
+ELFTC_VCSID("$Id: segments.c 3177 2015-03-30 18:19:41Z emaste $");
static void insert_to_inseg_list(struct segment *seg, struct section *sec);
diff --git a/elfcopy/symbols.c b/elfcopy/symbols.c
index 7fb6ccba7dd8..49bb23988657 100644
--- a/elfcopy/symbols.c
+++ b/elfcopy/symbols.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <err.h>
#include <fnmatch.h>
@@ -34,7 +33,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: symbols.c 3135 2014-12-24 08:22:43Z kaiwang27 $");
+ELFTC_VCSID("$Id: symbols.c 3174 2015-03-27 17:13:41Z emaste $");
/* Symbol table buffer structure. */
struct symbuf {
@@ -129,6 +128,17 @@ is_local_symbol(unsigned char st_info)
}
static int
+is_hidden_symbol(unsigned char st_other)
+{
+
+ if (GELF_ST_VISIBILITY(st_other) == STV_HIDDEN ||
+ GELF_ST_VISIBILITY(st_other) == STV_INTERNAL)
+ return (1);
+
+ return (0);
+}
+
+static int
is_local_label(const char *name)
{
@@ -457,6 +467,11 @@ generate_symbols(struct elfcopy *ecp)
lookup_symop_list(ecp, name, SYMOP_KEEPG) == NULL)
sym.st_info = GELF_ST_INFO(STB_LOCAL,
GELF_ST_TYPE(sym.st_info));
+ if (ecp->flags & LOCALIZE_HIDDEN &&
+ sym.st_shndx != SHN_UNDEF &&
+ is_hidden_symbol(sym.st_other))
+ sym.st_info = GELF_ST_INFO(STB_LOCAL,
+ GELF_ST_TYPE(sym.st_info));
} else {
/* STB_LOCAL binding. */
if (lookup_symop_list(ecp, name, SYMOP_GLOBALIZE) !=
@@ -1036,10 +1051,8 @@ match_wildcard(const char *name, const char *pattern)
}
match = 0;
- if (!fnmatch(pattern, name, 0)) {
+ if (!fnmatch(pattern, name, 0))
match = 1;
- printf("string '%s' match to pattern '%s'\n", name, pattern);
- }
return (reverse ? !match : match);
}
diff --git a/elfdump/elfdump.c b/elfdump/elfdump.c
index f7fc42644232..93420fed936c 100644
--- a/elfdump/elfdump.c
+++ b/elfdump/elfdump.c
@@ -26,7 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
@@ -51,7 +50,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: elfdump.c 3146 2015-02-15 18:20:03Z emaste $");
+ELFTC_VCSID("$Id: elfdump.c 3174 2015-03-27 17:13:41Z emaste $");
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
#include "native-elf-format.h"
diff --git a/findtextrel/findtextrel.c b/findtextrel/findtextrel.c
index a744ca5b0b13..91baa54618cd 100644
--- a/findtextrel/findtextrel.c
+++ b/findtextrel/findtextrel.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <err.h>
#include <dwarf.h>
@@ -39,7 +38,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: findtextrel.c 2185 2011-11-19 16:07:16Z jkoshy $");
+ELFTC_VCSID("$Id: findtextrel.c 3174 2015-03-27 17:13:41Z emaste $");
static struct option longopts[] = {
{"help", no_argument, NULL, 'H'},
diff --git a/ld/ld.h b/ld/ld.h
index 624abfcb39ec..1de1853b55ec 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -23,10 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ld.h 2940 2013-05-04 22:22:10Z kaiwang27 $
+ * $Id: ld.h 3174 2015-03-27 17:13:41Z emaste $
*/
-#include <sys/cdefs.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/queue.h>
diff --git a/libdwarf/_libdwarf.h b/libdwarf/_libdwarf.h
index 06413beeb583..e6eb496feed1 100644
--- a/libdwarf/_libdwarf.h
+++ b/libdwarf/_libdwarf.h
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: _libdwarf.h 3161 2015-02-15 21:43:36Z emaste $
+ * $Id: _libdwarf.h 3164 2015-02-19 01:20:12Z kaiwang27 $
*/
#ifndef __LIBDWARF_H_
@@ -190,6 +190,7 @@ struct _Dwarf_LineInfo {
Dwarf_Half li_version; /* Version of line info. */
Dwarf_Unsigned li_hdrlen; /* Length of line info header. */
Dwarf_Small li_minlen; /* Minimum instrutction length. */
+ Dwarf_Small li_maxop; /* Maximum operations per inst. */
Dwarf_Small li_defstmt; /* Default value of is_stmt. */
int8_t li_lbase; /* Line base for special opcode. */
Dwarf_Small li_lrange; /* Line range for special opcode. */
diff --git a/libdwarf/libdwarf.h b/libdwarf/libdwarf.h
index fdbcb4e05b63..0cb8b1ae8cbc 100644
--- a/libdwarf/libdwarf.h
+++ b/libdwarf/libdwarf.h
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: libdwarf.h 3149 2015-02-15 19:00:06Z emaste $
+ * $Id: libdwarf.h 3174 2015-03-27 17:13:41Z emaste $
*/
#ifndef _LIBDWARF_H_
@@ -444,7 +444,9 @@ enum Dwarf_ISA {
};
/* Function prototype definitions. */
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
Dwarf_P_Attribute dwarf_add_AT_comp_dir(Dwarf_P_Die, char *, Dwarf_Error *);
Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die, Dwarf_Signed,
Dwarf_Error *);
@@ -831,6 +833,8 @@ int dwarf_whatattr(Dwarf_Attribute, Dwarf_Half *, Dwarf_Error *);
int dwarf_whatform(Dwarf_Attribute, Dwarf_Half *, Dwarf_Error *);
int dwarf_whatform_direct(Dwarf_Attribute, Dwarf_Half *,
Dwarf_Error *);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* !_LIBDWARF_H_ */
diff --git a/libdwarf/libdwarf_lineno.c b/libdwarf/libdwarf_lineno.c
index 63627f736f7f..d0ff5f8e80da 100644
--- a/libdwarf/libdwarf_lineno.c
+++ b/libdwarf/libdwarf_lineno.c
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_lineno.c 3100 2014-10-25 20:34:29Z jkoshy $");
+ELFTC_VCSID("$Id: libdwarf_lineno.c 3164 2015-02-19 01:20:12Z kaiwang27 $");
static int
_dwarf_lineno_add_file(Dwarf_LineInfo li, uint8_t **p, const char *compdir,
@@ -315,6 +315,8 @@ _dwarf_lineno_init(Dwarf_Die die, uint64_t offset, Dwarf_Error *error)
li->li_hdrlen = dbg->read(ds->ds_data, &offset, dwarf_size);
hdroff = offset;
li->li_minlen = dbg->read(ds->ds_data, &offset, 1);
+ if (li->li_version == 4)
+ li->li_maxop = dbg->read(ds->ds_data, &offset, 1);
li->li_defstmt = dbg->read(ds->ds_data, &offset, 1);
li->li_lbase = dbg->read(ds->ds_data, &offset, 1);
li->li_lrange = dbg->read(ds->ds_data, &offset, 1);
diff --git a/libelf/_libelf.h b/libelf/_libelf.h
index d5803a4e44ff..be45335907f3 100644
--- a/libelf/_libelf.h
+++ b/libelf/_libelf.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: _libelf.h 3011 2014-03-23 03:32:42Z jkoshy $
+ * $Id: _libelf.h 3174 2015-03-27 17:13:41Z emaste $
*/
#ifndef __LIBELF_H_
@@ -194,7 +194,9 @@ enum {
* Function Prototypes.
*/
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
struct _Libelf_Data *_libelf_allocate_data(Elf_Scn *_s);
Elf *_libelf_allocate_elf(void);
Elf_Scn *_libelf_allocate_scn(Elf *_e, size_t _ndx);
@@ -230,6 +232,8 @@ int _libelf_setshstrndx(Elf *_e, void *_eh, int _elfclass,
Elf_Data *_libelf_xlate(Elf_Data *_d, const Elf_Data *_s,
unsigned int _encoding, int _elfclass, int _direction);
int _libelf_xlate_shtype(uint32_t _sht);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* __LIBELF_H_ */
diff --git a/libelf/_libelf_config.h b/libelf/_libelf_config.h
index 45d8714b2ae6..1b8f35b2242d 100644
--- a/libelf/_libelf_config.h
+++ b/libelf/_libelf_config.h
@@ -23,10 +23,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: _libelf_config.h 3143 2015-02-15 17:57:38Z emaste $
+ * $Id: _libelf_config.h 3168 2015-02-24 19:17:47Z emaste $
*/
-#ifdef __DragonFly__
+#if defined(__APPLE__) || defined(__DragonFly__)
#if defined(__amd64__)
#define LIBELF_ARCH EM_X86_64
diff --git a/libelf/elf_data.c b/libelf/elf_data.c
index 9960b77bea27..ce80e1c94c40 100644
--- a/libelf/elf_data.c
+++ b/libelf/elf_data.c
@@ -27,11 +27,12 @@
#include <assert.h>
#include <errno.h>
#include <libelf.h>
+#include <stdint.h>
#include <stdlib.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_data.c 3009 2014-03-23 01:49:59Z jkoshy $");
+ELFTC_VCSID("$Id: elf_data.c 3177 2015-03-30 18:19:41Z emaste $");
Elf_Data *
elf_getdata(Elf_Scn *s, Elf_Data *ed)
diff --git a/libelf/elf_end.c b/libelf/elf_end.c
index 097664c12579..3f32ebbee8ec 100644
--- a/libelf/elf_end.c
+++ b/libelf/elf_end.c
@@ -24,8 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <libelf.h>
#include <stdlib.h>
@@ -36,7 +34,7 @@
#include <sys/mman.h>
#endif
-ELFTC_VCSID("$Id: elf_end.c 2240 2011-11-28 06:36:48Z jkoshy $");
+ELFTC_VCSID("$Id: elf_end.c 3174 2015-03-27 17:13:41Z emaste $");
int
elf_end(Elf *e)
diff --git a/libelf/elf_errmsg.c b/libelf/elf_errmsg.c
index 409862cc1557..9e5b2e92ee1b 100644
--- a/libelf/elf_errmsg.c
+++ b/libelf/elf_errmsg.c
@@ -24,15 +24,13 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include <stdio.h>
#include <string.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_errmsg.c 3012 2014-03-23 03:41:38Z jkoshy $");
+ELFTC_VCSID("$Id: elf_errmsg.c 3174 2015-03-27 17:13:41Z emaste $");
/*
* Retrieve a human readable translation for an error message.
diff --git a/libelf/elf_errno.c b/libelf/elf_errno.c
index c78d4c7a7cea..10ae69acbe58 100644
--- a/libelf/elf_errno.c
+++ b/libelf/elf_errno.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_errno.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_errno.c 3174 2015-03-27 17:13:41Z emaste $");
int
elf_errno(void)
diff --git a/libelf/elf_fill.c b/libelf/elf_fill.c
index 4c9facc78273..427d78d5ad66 100644
--- a/libelf/elf_fill.c
+++ b/libelf/elf_fill.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_fill.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_fill.c 3174 2015-03-27 17:13:41Z emaste $");
void
elf_fill(int fill)
diff --git a/libelf/elf_flag.c b/libelf/elf_flag.c
index 89af3160da6a..73503214a9fe 100644
--- a/libelf/elf_flag.c
+++ b/libelf/elf_flag.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_flag.c 2988 2014-03-17 08:51:49Z jkoshy $");
+ELFTC_VCSID("$Id: elf_flag.c 3174 2015-03-27 17:13:41Z emaste $");
unsigned int
elf_flagarhdr(Elf_Arhdr *a, Elf_Cmd c, unsigned int flags)
diff --git a/libelf/elf_getarhdr.c b/libelf/elf_getarhdr.c
index 07f6888147bf..75e2e86226ec 100644
--- a/libelf/elf_getarhdr.c
+++ b/libelf/elf_getarhdr.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_getarhdr.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_getarhdr.c 3174 2015-03-27 17:13:41Z emaste $");
Elf_Arhdr *
elf_getarhdr(Elf *e)
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
index eeb8513aa4ec..3679b81e155b 100644
--- a/libelf/elf_getarsym.c
+++ b/libelf/elf_getarsym.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_getarsym.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_getarsym.c 3174 2015-03-27 17:13:41Z emaste $");
Elf_Arsym *
elf_getarsym(Elf *ar, size_t *ptr)
diff --git a/libelf/elf_getbase.c b/libelf/elf_getbase.c
index 417808df360c..b038c3ddd260 100644
--- a/libelf/elf_getbase.c
+++ b/libelf/elf_getbase.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_getbase.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_getbase.c 3174 2015-03-27 17:13:41Z emaste $");
off_t
elf_getbase(Elf *e)
diff --git a/libelf/elf_getident.c b/libelf/elf_getident.c
index aeea996b9fac..a69139c932cf 100644
--- a/libelf/elf_getident.c
+++ b/libelf/elf_getident.c
@@ -24,15 +24,13 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <ar.h>
#include <assert.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_getident.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_getident.c 3174 2015-03-27 17:13:41Z emaste $");
char *
elf_getident(Elf *e, size_t *sz)
diff --git a/libelf/elf_hash.c b/libelf/elf_hash.c
index 373523714bcb..ef7e44d1afdb 100644
--- a/libelf/elf_hash.c
+++ b/libelf/elf_hash.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_hash.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_hash.c 3174 2015-03-27 17:13:41Z emaste $");
/*
* This elf_hash function is defined by the System V ABI.
diff --git a/libelf/elf_kind.c b/libelf/elf_kind.c
index ba83adce8453..f497bd315a8f 100644
--- a/libelf/elf_kind.c
+++ b/libelf/elf_kind.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_kind.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_kind.c 3174 2015-03-27 17:13:41Z emaste $");
Elf_Kind
elf_kind(Elf *e)
diff --git a/libelf/elf_next.c b/libelf/elf_next.c
index 7da8ba6fe857..4c33714f291a 100644
--- a/libelf/elf_next.c
+++ b/libelf/elf_next.c
@@ -24,15 +24,13 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <ar.h>
#include <assert.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_next.c 2989 2014-03-17 09:56:46Z jkoshy $");
+ELFTC_VCSID("$Id: elf_next.c 3174 2015-03-27 17:13:41Z emaste $");
Elf_Cmd
elf_next(Elf *e)
diff --git a/libelf/elf_phnum.c b/libelf/elf_phnum.c
index 59948061b407..4ac665df308d 100644
--- a/libelf/elf_phnum.c
+++ b/libelf/elf_phnum.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <ar.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_phnum.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_phnum.c 3174 2015-03-27 17:13:41Z emaste $");
static int
_libelf_getphdrnum(Elf *e, size_t *phnum)
diff --git a/libelf/elf_rand.c b/libelf/elf_rand.c
index 8c36ff809702..eb2c9eaa2c1a 100644
--- a/libelf/elf_rand.c
+++ b/libelf/elf_rand.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <ar.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_rand.c 2991 2014-03-17 09:57:04Z jkoshy $");
+ELFTC_VCSID("$Id: elf_rand.c 3174 2015-03-27 17:13:41Z emaste $");
off_t
elf_rand(Elf *ar, off_t offset)
diff --git a/libelf/elf_rawfile.c b/libelf/elf_rawfile.c
index a5b5b3ed5f7f..f63982fb0b4b 100644
--- a/libelf/elf_rawfile.c
+++ b/libelf/elf_rawfile.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_rawfile.c 3013 2014-03-23 06:16:59Z jkoshy $");
+ELFTC_VCSID("$Id: elf_rawfile.c 3174 2015-03-27 17:13:41Z emaste $");
char *
elf_rawfile(Elf *e, size_t *sz)
diff --git a/libelf/elf_scn.c b/libelf/elf_scn.c
index f07f6ae9ea16..d3e274715b78 100644
--- a/libelf/elf_scn.c
+++ b/libelf/elf_scn.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/queue.h>
#include <assert.h>
@@ -32,11 +31,12 @@
#include <gelf.h>
#include <libelf.h>
#include <stddef.h>
+#include <stdint.h>
#include <stdlib.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_scn.c 3147 2015-02-15 18:45:23Z emaste $");
+ELFTC_VCSID("$Id: elf_scn.c 3177 2015-03-30 18:19:41Z emaste $");
/*
* Load an ELF section table and create a list of Elf_Scn structures.
diff --git a/libelf/elf_shnum.c b/libelf/elf_shnum.c
index a06a9e411310..5c0560fb5567 100644
--- a/libelf/elf_shnum.c
+++ b/libelf/elf_shnum.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <ar.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_shnum.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_shnum.c 3174 2015-03-27 17:13:41Z emaste $");
static int
_libelf_getshdrnum(Elf *e, size_t *shnum)
diff --git a/libelf/elf_shstrndx.c b/libelf/elf_shstrndx.c
index 0a7bab96b1fc..dac40c99a0dd 100644
--- a/libelf/elf_shstrndx.c
+++ b/libelf/elf_shstrndx.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <ar.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_shstrndx.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_shstrndx.c 3174 2015-03-27 17:13:41Z emaste $");
static int
_libelf_getshdrstrndx(Elf *e, size_t *strndx)
diff --git a/libelf/elf_version.c b/libelf/elf_version.c
index 3aa466ad3c4f..cd25954b44e9 100644
--- a/libelf/elf_version.c
+++ b/libelf/elf_version.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: elf_version.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: elf_version.c 3174 2015-03-27 17:13:41Z emaste $");
unsigned int
elf_version(unsigned int v)
diff --git a/libelf/gelf.h b/libelf/gelf.h
index 0a7dc2494024..6eae0a5f27f5 100644
--- a/libelf/gelf.h
+++ b/libelf/gelf.h
@@ -23,14 +23,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: gelf.h 1168 2010-09-04 01:03:25Z jkoshy $
+ * $Id: gelf.h 3174 2015-03-27 17:13:41Z emaste $
*/
#ifndef _GELF_H_
#define _GELF_H_
-#include <sys/cdefs.h>
-
#include <libelf.h>
typedef Elf64_Addr GElf_Addr; /* Addresses */
@@ -69,7 +67,9 @@ typedef Elf64_Syminfo GElf_Syminfo; /* Symbol information */
#define GELF_ST_TYPE ELF64_ST_TYPE
#define GELF_ST_VISIBILITY ELF64_ST_VISIBILITY
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
long gelf_checksum(Elf *_elf);
size_t gelf_fsize(Elf *_elf, Elf_Type _type, size_t _count,
unsigned int _version);
@@ -103,6 +103,8 @@ GElf_Syminfo *gelf_getsyminfo(Elf_Data *_src, int _index, GElf_Syminfo *_dst);
int gelf_update_cap(Elf_Data *_dst, int _index, GElf_Cap *_src);
int gelf_update_move(Elf_Data *_dst, int _index, GElf_Move *_src);
int gelf_update_syminfo(Elf_Data *_dst, int _index, GElf_Syminfo *_src);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* _GELF_H_ */
diff --git a/libelf/gelf_cap.c b/libelf/gelf_cap.c
index 9925d1bd214f..f509c69c2ba5 100644
--- a/libelf/gelf_cap.c
+++ b/libelf/gelf_cap.c
@@ -24,15 +24,14 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <limits.h>
+#include <stdint.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_cap.c 2995 2014-03-18 02:16:31Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_cap.c 3177 2015-03-30 18:19:41Z emaste $");
GElf_Cap *
gelf_getcap(Elf_Data *ed, int ndx, GElf_Cap *dst)
diff --git a/libelf/gelf_checksum.c b/libelf/gelf_checksum.c
index af707daeba1b..b16272f39610 100644
--- a/libelf/gelf_checksum.c
+++ b/libelf/gelf_checksum.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_checksum.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_checksum.c 3174 2015-03-27 17:13:41Z emaste $");
long
elf32_checksum(Elf *e)
diff --git a/libelf/gelf_dyn.c b/libelf/gelf_dyn.c
index 4e09afd12ce2..74233094bf6c 100644
--- a/libelf/gelf_dyn.c
+++ b/libelf/gelf_dyn.c
@@ -24,15 +24,14 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <limits.h>
+#include <stdint.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_dyn.c 2998 2014-03-18 17:19:00Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_dyn.c 3177 2015-03-30 18:19:41Z emaste $");
GElf_Dyn *
gelf_getdyn(Elf_Data *ed, int ndx, GElf_Dyn *dst)
diff --git a/libelf/gelf_ehdr.c b/libelf/gelf_ehdr.c
index 1efd8178c560..dcd260e14ba2 100644
--- a/libelf/gelf_ehdr.c
+++ b/libelf/gelf_ehdr.c
@@ -24,17 +24,16 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <libelf.h>
#include <limits.h>
+#include <stdint.h>
#include <string.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_ehdr.c 2268 2011-12-03 17:05:11Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_ehdr.c 3177 2015-03-30 18:19:41Z emaste $");
Elf32_Ehdr *
elf32_getehdr(Elf *e)
diff --git a/libelf/gelf_fsize.c b/libelf/gelf_fsize.c
index 7eeac69bf8f1..afdea7381fc9 100644
--- a/libelf/gelf_fsize.c
+++ b/libelf/gelf_fsize.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_fsize.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_fsize.c 3174 2015-03-27 17:13:41Z emaste $");
size_t
elf32_fsize(Elf_Type t, size_t c, unsigned int v)
diff --git a/libelf/gelf_getclass.c b/libelf/gelf_getclass.c
index 214e60282ce4..d7f680382077 100644
--- a/libelf/gelf_getclass.c
+++ b/libelf/gelf_getclass.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_getclass.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_getclass.c 3174 2015-03-27 17:13:41Z emaste $");
int
gelf_getclass(Elf *e)
diff --git a/libelf/gelf_move.c b/libelf/gelf_move.c
index 2b734eba53b8..2ec8f251f8fa 100644
--- a/libelf/gelf_move.c
+++ b/libelf/gelf_move.c
@@ -24,15 +24,14 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <limits.h>
+#include <stdint.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_move.c 2998 2014-03-18 17:19:00Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_move.c 3177 2015-03-30 18:19:41Z emaste $");
GElf_Move *
gelf_getmove(Elf_Data *ed, int ndx, GElf_Move *dst)
diff --git a/libelf/gelf_phdr.c b/libelf/gelf_phdr.c
index ade82dbdf877..31e20b0680c5 100644
--- a/libelf/gelf_phdr.c
+++ b/libelf/gelf_phdr.c
@@ -24,15 +24,14 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include <libelf.h>
#include <limits.h>
+#include <stdint.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_phdr.c 2268 2011-12-03 17:05:11Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_phdr.c 3177 2015-03-30 18:19:41Z emaste $");
Elf32_Phdr *
elf32_getphdr(Elf *e)
diff --git a/libelf/gelf_rel.c b/libelf/gelf_rel.c
index 3b798c042201..02a613383dfb 100644
--- a/libelf/gelf_rel.c
+++ b/libelf/gelf_rel.c
@@ -24,15 +24,14 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <limits.h>
+#include <stdint.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_rel.c 2998 2014-03-18 17:19:00Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_rel.c 3177 2015-03-30 18:19:41Z emaste $");
GElf_Rel *
gelf_getrel(Elf_Data *ed, int ndx, GElf_Rel *dst)
diff --git a/libelf/gelf_rela.c b/libelf/gelf_rela.c
index ed289a674d1f..d485ab909299 100644
--- a/libelf/gelf_rela.c
+++ b/libelf/gelf_rela.c
@@ -24,15 +24,14 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <limits.h>
+#include <stdint.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_rela.c 2998 2014-03-18 17:19:00Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_rela.c 3177 2015-03-30 18:19:41Z emaste $");
GElf_Rela *
gelf_getrela(Elf_Data *ed, int ndx, GElf_Rela *dst)
diff --git a/libelf/gelf_shdr.c b/libelf/gelf_shdr.c
index d4024895c602..1a9d949e42eb 100644
--- a/libelf/gelf_shdr.c
+++ b/libelf/gelf_shdr.c
@@ -24,16 +24,15 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <libelf.h>
#include <limits.h>
+#include <stdint.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_shdr.c 2268 2011-12-03 17:05:11Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_shdr.c 3177 2015-03-30 18:19:41Z emaste $");
Elf32_Shdr *
elf32_getshdr(Elf_Scn *s)
diff --git a/libelf/gelf_sym.c b/libelf/gelf_sym.c
index e32a1869cea7..ecd85fceefb4 100644
--- a/libelf/gelf_sym.c
+++ b/libelf/gelf_sym.c
@@ -24,15 +24,14 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <limits.h>
+#include <stdint.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_sym.c 2999 2014-03-18 17:19:06Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_sym.c 3177 2015-03-30 18:19:41Z emaste $");
GElf_Sym *
gelf_getsym(Elf_Data *ed, int ndx, GElf_Sym *dst)
diff --git a/libelf/gelf_syminfo.c b/libelf/gelf_syminfo.c
index e54258292aa1..f6d7b6c367fa 100644
--- a/libelf/gelf_syminfo.c
+++ b/libelf/gelf_syminfo.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_syminfo.c 2998 2014-03-18 17:19:00Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_syminfo.c 3174 2015-03-27 17:13:41Z emaste $");
GElf_Syminfo *
gelf_getsyminfo(Elf_Data *ed, int ndx, GElf_Syminfo *dst)
diff --git a/libelf/gelf_symshndx.c b/libelf/gelf_symshndx.c
index 69fabe55ce03..b490aa2bb11f 100644
--- a/libelf/gelf_symshndx.c
+++ b/libelf/gelf_symshndx.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_symshndx.c 2998 2014-03-18 17:19:00Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_symshndx.c 3174 2015-03-27 17:13:41Z emaste $");
GElf_Sym *
gelf_getsymshndx(Elf_Data *d, Elf_Data *id, int ndx, GElf_Sym *dst,
diff --git a/libelf/gelf_xlate.c b/libelf/gelf_xlate.c
index 15f30eebc264..f50181925f21 100644
--- a/libelf/gelf_xlate.c
+++ b/libelf/gelf_xlate.c
@@ -24,15 +24,13 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include <libelf.h>
#include <string.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_xlate.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: gelf_xlate.c 3174 2015-03-27 17:13:41Z emaste $");
Elf_Data *
elf32_xlatetof(Elf_Data *dst, const Elf_Data *src, unsigned int encoding)
diff --git a/libelf/libelf.h b/libelf/libelf.h
index 41e7224956fc..47c11b901585 100644
--- a/libelf/libelf.h
+++ b/libelf/libelf.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: libelf.h 2988 2014-03-17 08:51:49Z jkoshy $
+ * $Id: libelf.h 3174 2015-03-27 17:13:41Z emaste $
*/
#ifndef _LIBELF_H_
@@ -176,7 +176,9 @@ enum Elf_Error {
#define ELF_F_ARCHIVE 0x100U /* archive creation */
#define ELF_F_ARCHIVE_SYSV 0x200U /* SYSV style archive */
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
Elf *elf_begin(int _fd, Elf_Cmd _cmd, Elf *_elf);
int elf_cntl(Elf *_elf, Elf_Cmd _cmd);
int elf_end(Elf *_elf);
@@ -247,6 +249,8 @@ Elf_Data *elf64_xlatetof(Elf_Data *_dst, const Elf_Data *_src,
unsigned int _enc);
Elf_Data *elf64_xlatetom(Elf_Data *_dst, const Elf_Data *_src,
unsigned int _enc);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* _LIBELF_H_ */
diff --git a/libelf/libelf_align.c b/libelf/libelf_align.c
index 817fd1588565..5afb98bb4145 100644
--- a/libelf/libelf_align.c
+++ b/libelf/libelf_align.c
@@ -24,15 +24,13 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <sys/types.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_align.c 3006 2014-03-22 08:10:07Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_align.c 3174 2015-03-27 17:13:41Z emaste $");
struct align {
unsigned int a32;
diff --git a/libelf/libelf_allocate.c b/libelf/libelf_allocate.c
index 9a5df6bb495c..0a74facc9fc4 100644
--- a/libelf/libelf_allocate.c
+++ b/libelf/libelf_allocate.c
@@ -28,8 +28,6 @@
* Internal APIs
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <errno.h>
#include <libelf.h>
@@ -38,7 +36,7 @@
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_allocate.c 2272 2011-12-03 17:07:31Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_allocate.c 3174 2015-03-27 17:13:41Z emaste $");
Elf *
_libelf_allocate_elf(void)
diff --git a/libelf/libelf_ar.c b/libelf/libelf_ar.c
index 0830dd6fc069..faeec2c60765 100644
--- a/libelf/libelf_ar.c
+++ b/libelf/libelf_ar.c
@@ -24,8 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <ctype.h>
#include <libelf.h>
@@ -35,7 +33,7 @@
#include "_libelf.h"
#include "_libelf_ar.h"
-ELFTC_VCSID("$Id: libelf_ar.c 3013 2014-03-23 06:16:59Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_ar.c 3174 2015-03-27 17:13:41Z emaste $");
#define LIBELF_NALLOC_SIZE 16
diff --git a/libelf/libelf_ar_util.c b/libelf/libelf_ar_util.c
index 7b824fb579a9..239612e7915a 100644
--- a/libelf/libelf_ar_util.c
+++ b/libelf/libelf_ar_util.c
@@ -24,8 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <libelf.h>
#include <stdlib.h>
@@ -34,7 +32,7 @@
#include "_libelf.h"
#include "_libelf_ar.h"
-ELFTC_VCSID("$Id: libelf_ar_util.c 3157 2015-02-15 21:42:02Z emaste $");
+ELFTC_VCSID("$Id: libelf_ar_util.c 3174 2015-03-27 17:13:41Z emaste $");
/*
* Convert a string bounded by `start' and `start+sz' (exclusive) to a
diff --git a/libelf/libelf_checksum.c b/libelf/libelf_checksum.c
index f05f9a936404..ef868773105e 100644
--- a/libelf/libelf_checksum.c
+++ b/libelf/libelf_checksum.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_checksum.c 3003 2014-03-22 07:43:10Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_checksum.c 3174 2015-03-27 17:13:41Z emaste $");
static unsigned long
_libelf_sum(unsigned long c, const unsigned char *s, size_t size)
diff --git a/libelf/libelf_convert.m4 b/libelf/libelf_convert.m4
index f400367c3619..9f99f1ead866 100644
--- a/libelf/libelf_convert.m4
+++ b/libelf/libelf_convert.m4
@@ -24,15 +24,13 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <libelf.h>
#include <string.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_convert.m4 3158 2015-02-15 21:42:07Z emaste $");
+ELFTC_VCSID("$Id: libelf_convert.m4 3174 2015-03-27 17:13:41Z emaste $");
/* WARNING: GENERATED FROM __file__. */
diff --git a/libelf/libelf_data.c b/libelf/libelf_data.c
index f078c36ab755..fcffd8bd9d1c 100644
--- a/libelf/libelf_data.c
+++ b/libelf/libelf_data.c
@@ -24,13 +24,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_data.c 3080 2014-07-28 08:46:17Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_data.c 3174 2015-03-27 17:13:41Z emaste $");
int
_libelf_xlate_shtype(uint32_t sht)
diff --git a/libelf/libelf_ehdr.c b/libelf/libelf_ehdr.c
index d59f61f2ba1e..d375fb30028c 100644
--- a/libelf/libelf_ehdr.c
+++ b/libelf/libelf_ehdr.c
@@ -24,8 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <libelf.h>
@@ -33,7 +31,7 @@
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_ehdr.c 3009 2014-03-23 01:49:59Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_ehdr.c 3174 2015-03-27 17:13:41Z emaste $");
/*
* Retrieve counts for sections, phdrs and the section string table index
diff --git a/libelf/libelf_extended.c b/libelf/libelf_extended.c
index f1a77d17efba..96765a8293e1 100644
--- a/libelf/libelf_extended.c
+++ b/libelf/libelf_extended.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_extended.c 3005 2014-03-22 07:43:25Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_extended.c 3174 2015-03-27 17:13:41Z emaste $");
/*
* Retrieve section #0, allocating a new section if needed.
diff --git a/libelf/libelf_msize.m4 b/libelf/libelf_msize.m4
index 411019bd9127..179880c43278 100644
--- a/libelf/libelf_msize.m4
+++ b/libelf/libelf_msize.m4
@@ -24,15 +24,13 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <libelf.h>
#include <string.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_msize.m4 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_msize.m4 3174 2015-03-27 17:13:41Z emaste $");
/* WARNING: GENERATED FROM __file__. */
diff --git a/libelf/libelf_phdr.c b/libelf/libelf_phdr.c
index f44c3cd7e44e..ba872bbb9744 100644
--- a/libelf/libelf_phdr.c
+++ b/libelf/libelf_phdr.c
@@ -24,8 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <gelf.h>
#include <libelf.h>
@@ -33,7 +31,7 @@
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_phdr.c 3009 2014-03-23 01:49:59Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_phdr.c 3174 2015-03-27 17:13:41Z emaste $");
void *
_libelf_getphdr(Elf *e, int ec)
diff --git a/libelf/libelf_shdr.c b/libelf/libelf_shdr.c
index fc48423a99dd..862264b50439 100644
--- a/libelf/libelf_shdr.c
+++ b/libelf/libelf_shdr.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_shdr.c 2225 2011-11-26 18:55:54Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_shdr.c 3174 2015-03-27 17:13:41Z emaste $");
void *
_libelf_getshdr(Elf_Scn *s, int ec)
diff --git a/libelf/libelf_xlate.c b/libelf/libelf_xlate.c
index 4cc6a452e4dd..6ee76244b83e 100644
--- a/libelf/libelf_xlate.c
+++ b/libelf/libelf_xlate.c
@@ -24,14 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <assert.h>
#include <libelf.h>
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_xlate.c 3007 2014-03-22 08:10:14Z jkoshy $");
+ELFTC_VCSID("$Id: libelf_xlate.c 3174 2015-03-27 17:13:41Z emaste $");
/*
* Translate to/from the file representation of ELF objects.
diff --git a/libelftc/_libelftc.h b/libelftc/_libelftc.h
index c300f9105aee..ba0b10112a57 100644
--- a/libelftc/_libelftc.h
+++ b/libelftc/_libelftc.h
@@ -24,7 +24,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: _libelftc.h 2856 2013-01-04 16:00:26Z jkoshy $
+ * $Id: _libelftc.h 3174 2015-03-27 17:13:41Z emaste $
*/
#ifndef __LIBELFTC_H_
@@ -64,7 +64,9 @@ struct vector_str {
#define VECTOR_DEF_CAPACITY 8
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
char *cpp_demangle_ARM(const char *_org);
char *cpp_demangle_gnu2(const char *_org);
char *cpp_demangle_gnu3(const char *_org);
@@ -84,6 +86,8 @@ bool vector_str_push_vector_head(struct vector_str *_dst,
struct vector_str *_org);
char *vector_str_substr(const struct vector_str *_vs, size_t _begin,
size_t _end, size_t *_rlen);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* __LIBELFTC_H */
diff --git a/libelftc/elftc_bfdtarget.c b/libelftc/elftc_bfdtarget.c
index 351e5e467e67..a5ae1a671893 100644
--- a/libelftc/elftc_bfdtarget.c
+++ b/libelftc/elftc_bfdtarget.c
@@ -24,15 +24,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <sys/param.h>
#include <string.h>
#include <libelftc.h>
#include "_libelftc.h"
-ELFTC_VCSID("$Id: elftc_bfdtarget.c 2251 2011-11-30 16:50:06Z jkoshy $");
+ELFTC_VCSID("$Id: elftc_bfdtarget.c 3174 2015-03-27 17:13:41Z emaste $");
Elftc_Bfd_Target *
elftc_bfd_find_target(const char *tgt_name)
diff --git a/libelftc/elftc_demangle.c b/libelftc/elftc_demangle.c
index 9639d630c6e8..ff3095504286 100644
--- a/libelftc/elftc_demangle.c
+++ b/libelftc/elftc_demangle.c
@@ -24,8 +24,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <sys/param.h>
#include <assert.h>
#include <errno.h>
@@ -35,7 +33,7 @@
#include "_libelftc.h"
-ELFTC_VCSID("$Id: elftc_demangle.c 3030 2014-05-01 06:30:48Z kaiwang27 $");
+ELFTC_VCSID("$Id: elftc_demangle.c 3174 2015-03-27 17:13:41Z emaste $");
static int
is_mangled(const char *s, int style)
diff --git a/libelftc/libelftc.h b/libelftc/libelftc.h
index 85e4feb3a710..062db318c4d2 100644
--- a/libelftc/libelftc.h
+++ b/libelftc/libelftc.h
@@ -24,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $
- * $Id: libelftc.h 3031 2014-05-01 17:45:41Z jkoshy $
+ * $Id: libelftc.h 3174 2015-03-27 17:13:41Z emaste $
*/
#ifndef _LIBELFTC_H_
@@ -62,7 +62,9 @@ typedef enum {
/* Demangling behaviour control. */
#define ELFTC_DEM_NOPARAM 0x00010000U
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
Elftc_Bfd_Target *elftc_bfd_find_target(const char *_tgt_name);
Elftc_Bfd_Target_Flavor elftc_bfd_target_flavor(Elftc_Bfd_Target *_tgt);
unsigned int elftc_bfd_target_byteorder(Elftc_Bfd_Target *_tgt);
@@ -87,6 +89,8 @@ int elftc_string_table_remove(Elftc_String_Table *_table,
const char *elftc_string_table_to_string(Elftc_String_Table *_table,
size_t offset);
const char *elftc_version(void);
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* _LIBELFTC_H_ */
diff --git a/libelftc/libelftc_bfdtarget.c b/libelftc/libelftc_bfdtarget.c
index 31c89b74f14a..00ba2254fc16 100644
--- a/libelftc/libelftc_bfdtarget.c
+++ b/libelftc/libelftc_bfdtarget.c
@@ -24,15 +24,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-
#include <sys/param.h>
#include <libelf.h>
#include <libelftc.h>
#include "_libelftc.h"
-ELFTC_VCSID("$Id: libelftc_bfdtarget.c 2251 2011-11-30 16:50:06Z jkoshy $");
+ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3174 2015-03-27 17:13:41Z emaste $");
struct _Elftc_Bfd_Target _libelftc_targets[] = {
diff --git a/nm/nm.c b/nm/nm.c
index f9849660f659..87a456ee97cb 100644
--- a/nm/nm.c
+++ b/nm/nm.c
@@ -48,7 +48,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: nm.c 3145 2015-02-15 18:04:37Z emaste $");
+ELFTC_VCSID("$Id: nm.c 3179 2015-03-31 19:38:56Z emaste $");
/* symbol information list */
STAILQ_HEAD(sym_head, sym_entry);
@@ -379,7 +379,7 @@ cmp_value(const void *lp, const void *rp)
/* Both defined */
if (l->sym->st_value == r->sym->st_value)
return (strcmp(l->name, r->name));
- return (l->sym->st_value - r->sym->st_value);
+ return (l->sym->st_value > r->sym->st_value ? 1 : -1);
case 1:
/* One undefined */
return (l_is_undef == 0 ? 1 : -1);
@@ -948,6 +948,36 @@ get_block_value(Dwarf_Debug dbg, Dwarf_Block *block)
return (0);
}
+static char *
+find_object_name(Dwarf_Debug dbg, Dwarf_Die die)
+{
+ Dwarf_Die ret_die;
+ Dwarf_Attribute at;
+ Dwarf_Off off;
+ Dwarf_Error de;
+ const char *str;
+ char *name;
+
+ if (dwarf_attrval_string(die, DW_AT_name, &str, &de) == DW_DLV_OK) {
+ if ((name = strdup(str)) == NULL) {
+ warn("strdup");
+ return (NULL);
+ }
+ return (name);
+ }
+
+ if (dwarf_attr(die, DW_AT_specification, &at, &de) != DW_DLV_OK)
+ return (NULL);
+
+ if (dwarf_global_formref(at, &off, &de) != DW_DLV_OK)
+ return (NULL);
+
+ if (dwarf_offdie(dbg, off, &ret_die, &de) != DW_DLV_OK)
+ return (NULL);
+
+ return (find_object_name(dbg, ret_die));
+}
+
static void
search_line_attr(Dwarf_Debug dbg, struct func_info_head *func_info,
struct var_info_head *var_info, Dwarf_Die die, char **src_files,
@@ -962,7 +992,6 @@ search_line_attr(Dwarf_Debug dbg, struct func_info_head *func_info,
Dwarf_Error de;
struct func_info_entry *func;
struct var_info_entry *var;
- const char *str;
int ret;
if (dwarf_tag(die, &tag, &de) != DW_DLV_OK) {
@@ -1012,16 +1041,12 @@ search_line_attr(Dwarf_Debug dbg, struct func_info_head *func_info,
DW_DLV_OK)
var->line = udata;
- if (dwarf_attrval_string(die, DW_AT_name, &str, &de) ==
- DW_DLV_OK) {
- var->name = strdup(str);
- if (var->name == NULL) {
- warn("strdup");
- if (var->file)
- free(var->file);
- free(var);
- goto cont_search;
- }
+ var->name = find_object_name(dbg, die);
+ if (var->name == NULL) {
+ if (var->file)
+ free(var->file);
+ free(var);
+ goto cont_search;
}
if (dwarf_attr(die, DW_AT_location, &at, &de) == DW_DLV_OK &&
@@ -1064,16 +1089,12 @@ search_line_attr(Dwarf_Debug dbg, struct func_info_head *func_info,
DW_DLV_OK)
func->line = udata;
- if (dwarf_attrval_string(die, DW_AT_name, &str, &de) ==
- DW_DLV_OK) {
- func->name = strdup(str);
- if (func->name == NULL) {
- warn("strdup");
- if (func->file)
- free(func->file);
- free(func);
- goto cont_search;
- }
+ func->name = find_object_name(dbg, die);
+ if (func->name == NULL) {
+ if (func->file)
+ free(func->file);
+ free(func);
+ goto cont_search;
}
if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &udata, &de) ==
@@ -1525,7 +1546,8 @@ print_lineno(struct sym_entry *ep, struct func_info_head *func_info,
/* For function symbol, search the function line information list. */
if ((ep->sym->st_info & 0xf) == STT_FUNC && func_info != NULL) {
SLIST_FOREACH(func, func_info, entries) {
- if (!strcmp(ep->name, func->name) &&
+ if (func->name != NULL &&
+ !strcmp(ep->name, func->name) &&
ep->sym->st_value >= func->lowpc &&
ep->sym->st_value < func->highpc) {
printf("\t%s:%" PRIu64, func->file, func->line);
diff --git a/readelf/readelf.c b/readelf/readelf.c
index 775172646ffa..bca228cec135 100644
--- a/readelf/readelf.c
+++ b/readelf/readelf.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <ar.h>
@@ -38,6 +37,7 @@
#include <libelftc.h>
#include <libgen.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -46,7 +46,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: readelf.c 3155 2015-02-15 19:15:57Z emaste $");
+ELFTC_VCSID("$Id: readelf.c 3178 2015-03-30 18:29:13Z emaste $");
/*
* readelf(1) options.
@@ -910,7 +910,7 @@ dt_type(unsigned int mach, unsigned int dtype)
case DT_PLTPADSZ: return "PLTPADSZ";
case DT_MOVEENT: return "MOVEENT";
case DT_MOVESZ: return "MOVESZ";
- case DT_FEATURE_1: return "FEATURE_1";
+ case DT_FEATURE: return "FEATURE";
case DT_POSFLAG_1: return "POSFLAG_1";
case DT_SYMINSZ: return "SYMINSZ";
case DT_SYMINENT: return "SYMINENT";
@@ -1142,7 +1142,11 @@ r_type(unsigned int mach, unsigned int type)
case 1025: return "R_AARCH64_GLOB_DAT";
case 1026: return "R_AARCH64_JUMP_SLOT";
case 1027: return "R_AARCH64_RELATIVE";
+ case 1028: return "R_AARCH64_TLS_DTPREL64";
+ case 1029: return "R_AARCH64_TLS_DTPMOD64";
+ case 1030: return "R_AARCH64_TLS_TPREL64";
case 1031: return "R_AARCH64_TLSDESC";
+ case 1032: return "R_AARCH64_IRELATIVE";
default: return "";
}
case EM_ARM:
diff --git a/size/size.c b/size/size.c
index c5c5b64cb0d0..8380f750ded2 100644
--- a/size/size.c
+++ b/size/size.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <assert.h>
#include <err.h>
#include <fcntl.h>
@@ -39,7 +38,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: size.c 2350 2011-12-19 10:20:06Z jkoshy $");
+ELFTC_VCSID("$Id: size.c 3174 2015-03-27 17:13:41Z emaste $");
#define BUF_SIZE 1024
#define ELF_ALIGN(val,x) (((val)+(x)-1) & ~((x)-1))
diff --git a/strings/strings.c b/strings/strings.c
index 5964f64f19d5..6eab165e0bf4 100644
--- a/strings/strings.c
+++ b/strings/strings.c
@@ -24,7 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -46,7 +45,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: strings.c 3124 2014-12-21 05:46:28Z kaiwang27 $");
+ELFTC_VCSID("$Id: strings.c 3174 2015-03-27 17:13:41Z emaste $");
enum return_code {
RETURN_OK,
diff --git a/test/libelf/tset/common/ehdr_template.m4 b/test/libelf/tset/common/ehdr_template.m4
index 4f60fffa1a3e..872e0ff3b7c8 100644
--- a/test/libelf/tset/common/ehdr_template.m4
+++ b/test/libelf/tset/common/ehdr_template.m4
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ehdr_template.m4 2077 2011-10-27 03:59:40Z jkoshy $
+ * $Id: ehdr_template.m4 3174 2015-03-27 17:13:41Z emaste $
*/
include(`elfts.m4')
@@ -42,8 +42,6 @@ ifdef(`TS_EHDRFUNC',`',`errprint(`TS_EHDRFUNC was not defined')m4exit(1)')
ifdef(`TS_EHDRSZ',`',`errprint(`TS_EHDRSZ was not defined')m4exit(1)')
define(`TS_OTHERSIZE',`ifelse(TS_EHDRSZ,32,64,32)')
-#include <sys/cdefs.h>
-
define(`TS_ICFUNC',`elf'TS_EHDRSZ`'TS_EHDRFUNC)
define(`TS_EHDR',`Elf'TS_EHDRSZ`_Ehdr')
define(`TS_ICNAME',TS_ICFUNC)
diff --git a/test/libelf/tset/common/gelf_ehdr_template.h b/test/libelf/tset/common/gelf_ehdr_template.h
index 741409e28d02..30c7c675a331 100644
--- a/test/libelf/tset/common/gelf_ehdr_template.h
+++ b/test/libelf/tset/common/gelf_ehdr_template.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: gelf_ehdr_template.h 223 2008-08-10 15:40:06Z jkoshy $
+ * $Id: gelf_ehdr_template.h 3174 2015-03-27 17:13:41Z emaste $
*/
#include <sys/types.h>
@@ -50,8 +50,6 @@
* #include "gelf_getehdr_template.c"
*/
-#include <sys/cdefs.h>
-
IC_REQUIRES_VERSION_INIT();
/*
diff --git a/test/libelf/tset/common/phdr_template.c b/test/libelf/tset/common/phdr_template.c
index 808743d9639d..3bca4ceca27d 100644
--- a/test/libelf/tset/common/phdr_template.c
+++ b/test/libelf/tset/common/phdr_template.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: phdr_template.c 1074 2010-08-09 11:43:34Z jkoshy $
+ * $Id: phdr_template.c 3174 2015-03-27 17:13:41Z emaste $
*/
/*
@@ -36,8 +36,6 @@
* #include "phdr_template.c"
*/
-#include <sys/cdefs.h>
-
/* Variations of __CONCAT and __STRING which expand their arguments. */
#define __XCONCAT(x,y) __CONCAT(x,y)
#ifndef __XSTRING
diff --git a/test/libelf/tset/common/xlate_template.c b/test/libelf/tset/common/xlate_template.c
index 84bdb4c1b97a..b361ab3f7cc9 100644
--- a/test/libelf/tset/common/xlate_template.c
+++ b/test/libelf/tset/common/xlate_template.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: xlate_template.c 2586 2012-09-15 14:32:47Z jkoshy $
+ * $Id: xlate_template.c 3174 2015-03-27 17:13:41Z emaste $
*/
/*
@@ -36,7 +36,6 @@
*/
#include <sys/param.h>
-#include <sys/cdefs.h>
#define __XCONCAT(x,y) __CONCAT(x,y)
#ifndef __XSTRING
diff --git a/test/libelf/tset/elf32_getehdr/ehdr.m4 b/test/libelf/tset/elf32_getehdr/ehdr.m4
index 54f058380bcd..bd69b1bf7c20 100644
--- a/test/libelf/tset/elf32_getehdr/ehdr.m4
+++ b/test/libelf/tset/elf32_getehdr/ehdr.m4
@@ -23,11 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ehdr.m4 2054 2011-10-26 12:12:06Z jkoshy $
+ * $Id: ehdr.m4 3174 2015-03-27 17:13:41Z emaste $
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include <stdint.h>
#include <string.h>
diff --git a/test/libelf/tset/elf32_getphdr/phdr.m4 b/test/libelf/tset/elf32_getphdr/phdr.m4
index eb27e0ecbb54..ea00caadc339 100644
--- a/test/libelf/tset/elf32_getphdr/phdr.m4
+++ b/test/libelf/tset/elf32_getphdr/phdr.m4
@@ -23,11 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: phdr.m4 2054 2011-10-26 12:12:06Z jkoshy $
+ * $Id: phdr.m4 3174 2015-03-27 17:13:41Z emaste $
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include <stdint.h>
#include <string.h>
diff --git a/test/libelf/tset/elf32_newehdr/ehdr.m4 b/test/libelf/tset/elf32_newehdr/ehdr.m4
index fb3fbdd5ed84..04577441caf9 100644
--- a/test/libelf/tset/elf32_newehdr/ehdr.m4
+++ b/test/libelf/tset/elf32_newehdr/ehdr.m4
@@ -23,11 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ehdr.m4 2054 2011-10-26 12:12:06Z jkoshy $
+ * $Id: ehdr.m4 3174 2015-03-27 17:13:41Z emaste $
*/
-#include <sys/cdefs.h>
-
#include <errno.h>
#include <fcntl.h>
#include <libelf.h>
diff --git a/test/libelf/tset/elf64_getehdr/ehdr.m4 b/test/libelf/tset/elf64_getehdr/ehdr.m4
index 3cda7e222006..ce7774c7c21f 100644
--- a/test/libelf/tset/elf64_getehdr/ehdr.m4
+++ b/test/libelf/tset/elf64_getehdr/ehdr.m4
@@ -23,11 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ehdr.m4 2054 2011-10-26 12:12:06Z jkoshy $
+ * $Id: ehdr.m4 3174 2015-03-27 17:13:41Z emaste $
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include <stdint.h>
#include <string.h>
diff --git a/test/libelf/tset/elf64_getphdr/phdr.m4 b/test/libelf/tset/elf64_getphdr/phdr.m4
index fbb6154d2583..97af5fa1dd79 100644
--- a/test/libelf/tset/elf64_getphdr/phdr.m4
+++ b/test/libelf/tset/elf64_getphdr/phdr.m4
@@ -23,11 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: phdr.m4 2054 2011-10-26 12:12:06Z jkoshy $
+ * $Id: phdr.m4 3174 2015-03-27 17:13:41Z emaste $
*/
-#include <sys/cdefs.h>
-
#include <libelf.h>
#include <stdint.h>
#include <string.h>
diff --git a/test/libelf/tset/elf64_newehdr/ehdr.m4 b/test/libelf/tset/elf64_newehdr/ehdr.m4
index a1ee794f1fc5..36c5d8e38fbf 100644
--- a/test/libelf/tset/elf64_newehdr/ehdr.m4
+++ b/test/libelf/tset/elf64_newehdr/ehdr.m4
@@ -23,11 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ehdr.m4 2054 2011-10-26 12:12:06Z jkoshy $
+ * $Id: ehdr.m4 3174 2015-03-27 17:13:41Z emaste $
*/
-#include <sys/cdefs.h>
-
#include <errno.h>
#include <fcntl.h>
#include <libelf.h>
diff --git a/test/libelf/tset/gelf_getehdr/ehdr.m4 b/test/libelf/tset/gelf_getehdr/ehdr.m4
index ba8f948c9e83..29f9960c239d 100644
--- a/test/libelf/tset/gelf_getehdr/ehdr.m4
+++ b/test/libelf/tset/gelf_getehdr/ehdr.m4
@@ -23,13 +23,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ehdr.m4 2054 2011-10-26 12:12:06Z jkoshy $
+ * $Id: ehdr.m4 3174 2015-03-27 17:13:41Z emaste $
*/
include(`elfts.m4')
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include <libelf.h>
#include <stdint.h>
diff --git a/test/libelf/tset/gelf_newehdr/ehdr.m4 b/test/libelf/tset/gelf_newehdr/ehdr.m4
index 3cf55b66bc96..a22a65bef09e 100644
--- a/test/libelf/tset/gelf_newehdr/ehdr.m4
+++ b/test/libelf/tset/gelf_newehdr/ehdr.m4
@@ -23,11 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ehdr.m4 2054 2011-10-26 12:12:06Z jkoshy $
+ * $Id: ehdr.m4 3174 2015-03-27 17:13:41Z emaste $
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include <libelf.h>
#include <stdint.h>
diff --git a/test/libelf/tset/gelf_xlate/xlate.m4 b/test/libelf/tset/gelf_xlate/xlate.m4
index 1b9b447510aa..906211c4445b 100644
--- a/test/libelf/tset/gelf_xlate/xlate.m4
+++ b/test/libelf/tset/gelf_xlate/xlate.m4
@@ -23,11 +23,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: xlate.m4 2586 2012-09-15 14:32:47Z jkoshy $
+ * $Id: xlate.m4 3174 2015-03-27 17:13:41Z emaste $
*/
-#include <sys/cdefs.h>
-
#include <gelf.h>
#include <libelf.h>
#include <stdint.h>