svn commit: r333057 - in vendor/elftoolchain/dist: . ar as common documentation/libelf-by-example elfcopy elfdump ld libdwarf libelf libelftc libpe mk nm readelf strings test/ar/plugin test/elfcopy...
Ed Maste
emaste at FreeBSD.org
Fri Apr 27 12:02:14 UTC 2018
Author: emaste
Date: Fri Apr 27 12:02:11 2018
New Revision: 333057
URL: https://svnweb.freebsd.org/changeset/base/333057
Log:
Import ELF Tool Chain snapshot at r3614
From http://svn.code.sf.net/p/elftoolchain/code/
Added:
vendor/elftoolchain/dist/tools/build-automation/cli/
vendor/elftoolchain/dist/tools/build-automation/cli/yabs.1 (contents, props changed)
vendor/elftoolchain/dist/tools/build-automation/executor/
vendor/elftoolchain/dist/tools/build-automation/executor/yabs-executor.1 (contents, props changed)
Deleted:
vendor/elftoolchain/dist/tools/build-automation/Makefile.documentation
vendor/elftoolchain/dist/tools/build-automation/Makefile.manuals
vendor/elftoolchain/dist/tools/build-automation/Makefile.program
vendor/elftoolchain/dist/tools/build-automation/build-system.post.nw
vendor/elftoolchain/dist/tools/build-automation/build-system.pre.nw
vendor/elftoolchain/dist/tools/build-automation/implementation.nw
vendor/elftoolchain/dist/tools/build-automation/introduction.nw
vendor/elftoolchain/dist/tools/build-automation/master.nw
vendor/elftoolchain/dist/tools/build-automation/slave.nw
vendor/elftoolchain/dist/tools/build-automation/userguide.nw
vendor/elftoolchain/dist/tools/build-automation/utilities.nw
vendor/elftoolchain/dist/tools/build-automation/yabs-slave.1
vendor/elftoolchain/dist/tools/build-automation/yabs.1
Modified:
vendor/elftoolchain/dist/INSTALL
vendor/elftoolchain/dist/Makefile
vendor/elftoolchain/dist/ar/Makefile
vendor/elftoolchain/dist/as/as.c
vendor/elftoolchain/dist/common/Makefile
vendor/elftoolchain/dist/common/os.Linux.mk
vendor/elftoolchain/dist/documentation/libelf-by-example/Makefile
vendor/elftoolchain/dist/elfcopy/Makefile
vendor/elftoolchain/dist/elfcopy/binary.c
vendor/elftoolchain/dist/elfcopy/elfcopy.1
vendor/elftoolchain/dist/elfcopy/main.c
vendor/elftoolchain/dist/elfdump/elfdump.c
vendor/elftoolchain/dist/ld/Makefile
vendor/elftoolchain/dist/ld/ld_script.awk
vendor/elftoolchain/dist/libdwarf/Makefile
vendor/elftoolchain/dist/libdwarf/libdwarf.h
vendor/elftoolchain/dist/libdwarf/libdwarf_frame.c
vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c
vendor/elftoolchain/dist/libelf/Makefile
vendor/elftoolchain/dist/libelf/_libelf_config.h
vendor/elftoolchain/dist/libelf/gelf_phdr.c
vendor/elftoolchain/dist/libelf/libelf_ehdr.c
vendor/elftoolchain/dist/libelftc/Makefile
vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c
vendor/elftoolchain/dist/libelftc/libelftc_dem_gnu3.c
vendor/elftoolchain/dist/libpe/Makefile
vendor/elftoolchain/dist/mk/elftoolchain.components.mk
vendor/elftoolchain/dist/mk/elftoolchain.inc.mk
vendor/elftoolchain/dist/mk/elftoolchain.lib.mk
vendor/elftoolchain/dist/mk/elftoolchain.prog.mk
vendor/elftoolchain/dist/mk/elftoolchain.subdir.mk
vendor/elftoolchain/dist/mk/elftoolchain.tex.mk
vendor/elftoolchain/dist/nm/nm.1
vendor/elftoolchain/dist/readelf/readelf.c
vendor/elftoolchain/dist/strings/strings.c
vendor/elftoolchain/dist/test/ar/plugin/Makefile.ardiff
vendor/elftoolchain/dist/test/elfcopy/plugin/Makefile.ardiff
vendor/elftoolchain/dist/test/libdwarf/ts/common/driver.c
vendor/elftoolchain/dist/test/libelf/tset/bin/elf-hash
vendor/elftoolchain/dist/test/libelf/tset/bin/elfc
vendor/elftoolchain/dist/test/tet/Makefile
vendor/elftoolchain/dist/tools/build-automation/Makefile
vendor/elftoolchain/dist/tools/build-automation/README
Modified: vendor/elftoolchain/dist/INSTALL
==============================================================================
--- vendor/elftoolchain/dist/INSTALL Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/INSTALL Fri Apr 27 12:02:11 2018 (r333057)
@@ -13,12 +13,12 @@ operating systems.
================= ======== =======================
Operating System Version Supported Architectures
----------------- -------- -----------------------
- `DragonFly BSD`_ 2.10.1 i386
- FreeBSD_ 10.2 amd64 & i386
+ `DragonFly BSD`_ 5.2 amd64
+ FreeBSD_ 11.1 amd64 & i386
Minix_ 3.0.2 i386
- NetBSD_ 7.0 i386
- OpenBSD_ v5.0 i386
- Ubuntu_ GNU/Linux 14.04LTS x86_64
+ NetBSD_ 7.1.2 i386
+ OpenBSD_ 6.3 amd64
+ Ubuntu_ GNU/Linux 17.10 x86_64
================= ======== =======================
.. _DragonFly BSD: http://www.dragonflybsd.org/
@@ -40,7 +40,7 @@ directories are present.
Prerequisites
-------------
-:DragonFly BSD 2.10.1:
+:DragonFly BSD 5.2:
- The core libraries and utilities should build out of the box on
a stock install of DragonFly BSD.
@@ -49,14 +49,14 @@ Prerequisites
#. The current release of the `Test Execution Toolkit`_ needs to
be downloaded and unpacked into the ``test/tet/`` directory.
- #. The ``py26-yaml`` package needs to be installed::
+ #. The ``py27-yaml`` package needs to be installed::
- % sudo pkgin install py26-yaml
+ % sudo pkg install py27-yaml
- Building additional documentation is not currently supported
under DragonFly BSD.
-:FreeBSD 10.2:
+:FreeBSD 11.1:
- The core libraries and utilities should build out of the box on
a stock install of FreeBSD.
@@ -73,7 +73,7 @@ Prerequisites
% sudo pkg install python py27-yaml
- Building additional documentation is not currently supported under
- FreeBSD 10.2.
+ FreeBSD 11.1.
:Minix 3.2.0:
- The following packages are pre-requisites for building the
@@ -95,9 +95,9 @@ Prerequisites
- Building additional documentation is not currently supported
under Minix.
-:OpenBSD 5.0:
+:OpenBSD 6.3:
- The following packages are pre-requisites for building the
- sources on OpenBSD 5.0:
+ sources on OpenBSD 6.3:
=================== =====================================
**Package** **Description**
@@ -108,26 +108,6 @@ Prerequisites
The following command line may be used to install the necessary
pre-requisites::
- # pkg_add libarchive-2.8.4p0
-
- - The test suites cannot currently be built under OpenBSD.
-
- - Building additional documentation is not currently supported
- under OpenBSD.
-
-:OpenBSD 5.4:
- - The following packages are pre-requisites for building the
- sources on OpenBSD 5.4:
-
- =================== =====================================
- **Package** **Description**
- =================== =====================================
- ``libarchive`` An archive access library.
- =================== =====================================
-
- The following command line may be used to install the necessary
- pre-requisites::
-
# pkg_add libarchive
- The test suites cannot currently be built under OpenBSD.
@@ -135,21 +115,10 @@ Prerequisites
- Building additional documentation is not currently supported
under OpenBSD.
-:NetBSD 7.0:
- - The following packages are pre-requisites for building the
- sources on NetBSD 7.0:
+:NetBSD 7.1.2:
+ - The core libraries and utilities should build out of the box on
+ a stock install of NetBSD 7.1.2.
- =================== =====================================
- **Package** **Description**
- =================== =====================================
- ``libarchive`` An archive access library.
- =================== =====================================
-
- The following command line may be used to install the necessary
- pre-requisites::
-
- # pkg_add libarchive
-
- To build and run the test suite:
#. The current release of the `Test Execution Toolkit`_, needs
@@ -159,14 +128,14 @@ Prerequisites
#. The following additional package needs to be installed, as
listed in the example command line below ::
- % sudo pkg_add py27-yaml
+ % sudo pkgin install py27-yaml
- Building additional documentation is not currently supported
under NetBSD.
-:Ubuntu GNU/Linux 10.04:
+:Ubuntu GNU/Linux 17.10:
- The following packages are pre-requisites for building the
- sources on Ubuntu GNU/Linux 10.04:
+ sources on Ubuntu GNU/Linux 17.10:
=================== =====================================
**Package** **Description**
@@ -176,10 +145,11 @@ Prerequisites
``flex`` Lexical analyser.
``gcc`` C compiler.
``libarchive-dev`` Archive access library.
+ ``libbsd-dev`` BSD headers and libraries.
``libc6-dev`` Files for C language development.
``libexpat1-dev`` An XML processing library.
``m4`` Macro processor.
- ``pmake`` A ``make`` that uses BSD-make syntax.
+ ``bmake`` NetBSD ``make``.
``python-yaml`` A YAML library for Python.
``sharutils`` For ``uudecode``.
``zlib1g-dev`` Compression library.
@@ -189,7 +159,7 @@ Prerequisites
pre-requisites::
% sudo apt-get install binutils bison flex gcc libarchive-dev \
- libc6-dev m4 pmake zlib1g-dev
+ libc6-dev m4 bmake zlib1g-dev
- To build and run the test suite:
@@ -202,50 +172,12 @@ Prerequisites
% sudo apt-get install libexpat1-dev python-yaml sharutils
- - To build additional documentation, the ``pgf`` package is
- needed::
+ - To build additional documentation, the packages listed in the
+ example command line below are needed::
- % sudo apt-get install pgf
+ % sudo apt-get install texlive-latex-recommended texlive-pictures \
+ libbsd-dev
-:Ubuntu GNU/Linux 14.04:
- - The following packages are pre-requisites for building the
- sources on Ubuntu GNU/Linux 14.04:
-
- =================== =====================================
- **Package** **Description**
- =================== =====================================
- ``bison`` Parser generator.
- ``build-essential`` Basic build tools.
- ``flex`` Lexical analyser.
- ``libarchive-dev`` Archive access library.
- ``libexpat1-dev`` An XML processing library.
- ``m4`` Macro processor.
- ``bmake`` NetBSD ``make``.
- ``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 bmake zlib1g-dev
-
- - 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 following additional packages need to be installed, as
- listed in the example command line below::
-
- % sudo apt-get install libexpat1-dev python-yaml sharutils
-
- - Builds of additional documentation are not currently supported
- under Ubuntu GNU/Linux 14.04.
-
.. _Test Execution Toolkit: http://tetworks.opengroup.org/
.. _OpenGroup: http://www.opengroup.org/
@@ -259,9 +191,9 @@ On `DragonFly BSD`_, FreeBSD_, Minix_, NetBSD_ and Op
% make
-On Ubuntu GNU/Linux with the **pmake** package installed, use::
+On Ubuntu GNU/Linux with the **bmake** package installed, use::
- % pmake
+ % bmake
Testing the software
@@ -274,9 +206,9 @@ On `DragonFly BSD`_, FreeBSD_ and NetBSD_, use::
% make run-tests
-On Ubuntu GNU/Linux with the **pmake** package installed, use::
+On Ubuntu GNU/Linux with the **bmake** package installed, use::
- % pmake run-tests
+ % bmake run-tests
Installing the Software
=======================
@@ -287,9 +219,9 @@ On `DragonFly BSD`_, FreeBSD_, Minix_, NetBSD_ and Ope
% make install
-On Ubuntu GNU/Linux with the **pmake** package installed, use::
+On Ubuntu GNU/Linux with the **bmake** package installed, use::
- % pmake install
+ % bmake install
By default the ``install`` target will install utilities into
@@ -299,7 +231,7 @@ By default the ``install`` target will install utiliti
The installation directory may be changed using the ``DESTDIR``
variable. For example::
- % pmake DESTDIR=$HOME/local install
+ % bmake DESTDIR=$HOME/local install
Additional Information
@@ -310,7 +242,7 @@ website`_.
.. _project website: http://elftoolchain.sourceforge.net/
-.. $Id: INSTALL 3353 2016-01-18 21:50:13Z jkoshy $
+.. $Id: INSTALL 3613 2018-04-21 19:34:37Z jkoshy $
.. Local Variables:
.. mode: rst
Modified: vendor/elftoolchain/dist/Makefile
==============================================================================
--- vendor/elftoolchain/dist/Makefile Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/Makefile Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,4 +1,4 @@
-# $Id: Makefile 3382 2016-01-31 12:31:08Z jkoshy $
+# $Id: Makefile 3605 2018-04-13 18:15:09Z jkoshy $
TOP= .
@@ -14,12 +14,12 @@ SUBDIR += libdwarf
# Build additional APIs.
SUBDIR += libelftc
-.if defined(WITH_PE) && ${WITH_PE:tl} == "yes"
+.if defined(WITH_PE) && ${WITH_PE} == "yes"
SUBDIR += libpe
.endif
# The instruction set analyser.
-.if defined(WITH_ISA) && ${WITH_ISA:tl} == "yes"
+.if defined(WITH_ISA) && ${WITH_ISA} == "yes"
SUBDIR += isa # ('isa' does not build on all platforms yet).
.endif
@@ -39,18 +39,19 @@ SUBDIR += strings
SUBDIR += tools
# Build the test suites.
-.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS:tl} == "yes"
+.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS} == "yes"
SUBDIR += test
.endif
# Build additional build tooling.
-.if defined(WITH_BUILD_TOOLS) && ${WITH_BUILD_TOOLS:tl} == "yes"
+.if defined(WITH_BUILD_TOOLS) && ${WITH_BUILD_TOOLS} == "yes"
SUBDIR += tools
.endif
# Build documentation at the end.
-.if exists(${.CURDIR}/documentation) && defined(WITH_DOCUMENTATION) && \
- ${WITH_DOCUMENTATION:tl} == "yes"
+.if exists(${.CURDIR}/documentation) && \
+ defined(WITH_ADDITIONAL_DOCUMENTATION) && \
+ ${WITH_ADDITIONAL_DOCUMENTATION} == "yes"
SUBDIR += documentation
.endif
@@ -61,7 +62,7 @@ SUBDIR += documentation
#
# Run the test suites.
-.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS:tl} == "yes"
+.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS} == "yes"
run-tests: all .PHONY
(cd ${.CURDIR}/test; ${MAKE} test)
.endif
Modified: vendor/elftoolchain/dist/ar/Makefile
==============================================================================
--- vendor/elftoolchain/dist/ar/Makefile Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/ar/Makefile Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,4 +1,4 @@
-# $Id: Makefile 3107 2014-12-20 08:31:58Z kaiwang27 $
+# $Id: Makefile 3608 2018-04-14 21:23:04Z jkoshy $
TOP= ..
@@ -32,4 +32,6 @@ ${EXTRA_TARGETS}: ${PROG}
.if ${OS_HOST} == "OpenBSD"
CFLAGS+= -I/usr/local/include
LDFLAGS+= -L/usr/local/lib
+.elif ${OS_HOST} == "DragonFly"
+LDADD+= -lbz2
.endif
Modified: vendor/elftoolchain/dist/as/as.c
==============================================================================
--- vendor/elftoolchain/dist/as/as.c Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/as/as.c Fri Apr 27 12:02:11 2018 (r333057)
@@ -24,6 +24,7 @@
* SUCH DAMAGE.
*/
+#include <err.h>
#include <getopt.h>
#include <stdarg.h>
#include <stdio.h>
@@ -34,7 +35,7 @@
#include <libelftc.h>
-ELFTC_VCSID("$Id: as.c 2799 2012-12-22 09:03:29Z jkoshy $");
+ELFTC_VCSID("$Id: as.c 3581 2017-10-13 23:27:45Z emaste $");
enum as_long_option_index {
AS_OPT_DEFSYM,
@@ -204,7 +205,7 @@ main(int argc, char **argv)
if (option_index >= 0)
errx(1,
"ERROR: option \"--%s\" is unimplemented.",
- as_option_long_options[option_index]);
+ as_option_long_options[option_index].name);
else
errx(1,
"ERROR: option '-%c' is unimplemented.",
Modified: vendor/elftoolchain/dist/common/Makefile
==============================================================================
--- vendor/elftoolchain/dist/common/Makefile Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/common/Makefile Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,4 +1,4 @@
-# $Id: Makefile 3022 2014-04-17 18:05:58Z jkoshy $
+# $Id: Makefile 3594 2018-04-11 18:26:50Z jkoshy $
TOP= ..
@@ -7,12 +7,12 @@ INCSDIR= /usr/include
.PHONY: all clean clobber depend obj
-all depend obj:
+all depend:
clean clobber:
rm -f ${CLEANFILES}
cleandepend:
- rm -f .depend
+ rm -f ${.OBJDIR}/.depend
.include "${TOP}/mk/elftoolchain.inc.mk"
Modified: vendor/elftoolchain/dist/common/os.Linux.mk
==============================================================================
--- vendor/elftoolchain/dist/common/os.Linux.mk Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/common/os.Linux.mk Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,13 +1,15 @@
#
# Build recipes for Linux based operating systems.
#
-# $Id: os.Linux.mk 2064 2011-10-26 15:12:32Z jkoshy $
+# $Id: os.Linux.mk 3594 2018-04-11 18:26:50Z jkoshy $
_NATIVE_ELF_FORMAT = native-elf-format
-.BEGIN: ${_NATIVE_ELF_FORMAT}.h
+.if !make(obj)
+.BEGIN: ${.OBJDIR}/${_NATIVE_ELF_FORMAT}.h
-${_NATIVE_ELF_FORMAT}.h:
+${.OBJDIR}/${_NATIVE_ELF_FORMAT}.h:
${.CURDIR}/${_NATIVE_ELF_FORMAT} > ${.TARGET} || rm ${.TARGET}
+.endif
-CLEANFILES += ${_NATIVE_ELF_FORMAT}.h
+CLEANFILES += ${.OBJDIR}/${_NATIVE_ELF_FORMAT}.h
Modified: vendor/elftoolchain/dist/documentation/libelf-by-example/Makefile
==============================================================================
--- vendor/elftoolchain/dist/documentation/libelf-by-example/Makefile Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/documentation/libelf-by-example/Makefile Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,7 +1,7 @@
#
# Libelf by Example
#
-# $Id: Makefile 2441 2012-02-21 05:46:43Z jkoshy $
+# $Id: Makefile 3600 2018-04-12 06:45:40Z jkoshy $
TOP = ../..
@@ -10,19 +10,30 @@ DOC= libelf-by-example
SRCS= libelf-by-example.tex prog1.txt prog2.txt prog3.txt \
prog4.txt prog5.txt prog6.txt
+CLEANFILES+= ${SRCS:Mprog*:S/.txt/.c/}
+
.include "${TOP}/mk/elftoolchain.tex.mk"
.if ${OS_HOST} == "Linux"
+EXTRA_FLAGS= -I/usr/include/bsd -DLIBBSD_OVERLAY
EXTRA_LIBS= -lbsd
.endif
check-example-syntax: .PHONY
-.for f in ${SRCS:Mprog*}
- @c=$$(basename ${f} .txt).c; sed -e 's/@[^@]*@//' \
- ${.CURDIR}/${f} > ${.OBJDIR}/$${c}; \
- echo -n $${c} ' '; cc -I${.CURDIR}/${TOP}/common \
- -I${.CURDIR}/${TOP}/libelf ${.OBJDIR}/$${c} \
- -L${.CURDIR}/${TOP}/libelf -lelf ${EXTRA_LIBS} && \
- rm ${.OBJDIR}/$${c} a.out
+.for f in ${SRCS:Mprog*:S/.txt//}
+ @sed -e 's/@[^@]*@//' \
+ ${.CURDIR}/${f}.txt > ${.OBJDIR}/${f}.c; \
+ echo -n ${f} ' '; \
+ libelf="${.OBJDIR}/${TOP}/libelf"; \
+ if [ ! -d $${libelf} -a "${.CURDIR}" != "${.OBJDIR}" ]; then \
+ suffix="${.OBJDIR:S,${.CURDIR}/,,}"; \
+ libelf="${.CURDIR}/${TOP}/libelf/$${suffix}"; \
+ fi; \
+ cc -I${.CURDIR}/${TOP}/common \
+ -I${.CURDIR}/${TOP}/libelf \
+ ${EXTRA_FLAGS} \
+ ${.OBJDIR}/${f}.c \
+ -L"$${libelf}" -lelf ${EXTRA_LIBS} && \
+ rm ${.OBJDIR}/a.out
.endfor
@echo
Modified: vendor/elftoolchain/dist/elfcopy/Makefile
==============================================================================
--- vendor/elftoolchain/dist/elfcopy/Makefile Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/elfcopy/Makefile Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,4 +1,4 @@
-# $Id: Makefile 3381 2016-01-30 19:39:47Z jkoshy $
+# $Id: Makefile 3608 2018-04-14 21:23:04Z jkoshy $
TOP= ..
@@ -18,7 +18,7 @@ LDADD= -lelf -lelftc
LDADD+= -larchive
.endif
-.if defined(WITH_PE) && ${WITH_PE:tl} == "yes"
+.if defined(WITH_PE) && ${WITH_PE} == "yes"
SRCS+= pe.c
CFLAGS+= -DWITH_PE=1
@@ -51,4 +51,6 @@ ${EXTRA_TARGETS}: ${PROG}
.if ${OS_HOST} == "OpenBSD"
CFLAGS+= -I/usr/local/include
LDFLAGS+= -L/usr/local/lib
+.elif ${OS_HOST} == "DragonFly"
+LDADD+= -lbz2
.endif
Modified: vendor/elftoolchain/dist/elfcopy/binary.c
==============================================================================
--- vendor/elftoolchain/dist/elfcopy/binary.c Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/elfcopy/binary.c Fri Apr 27 12:02:11 2018 (r333057)
@@ -36,7 +36,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: binary.c 3445 2016-04-20 19:08:30Z emaste $");
+ELFTC_VCSID("$Id: binary.c 3611 2018-04-16 21:35:18Z jkoshy $");
/*
* Convert ELF object to `binary'. Sections with SHF_ALLOC flag set
@@ -215,7 +215,7 @@ create_elf_from_binary(struct elfcopy *ecp, int ifd, c
if ((sym_basename = strdup(ifn)) == NULL)
err(1, "strdup");
for (p = sym_basename; *p != '\0'; p++)
- if (!isalnum(*p))
+ if (!isalnum(*p & 0xFF))
*p = '_';
#define _GEN_SYMNAME(S) do { \
snprintf(name, sizeof(name), "%s%s%s", "_binary_", sym_basename, S); \
Modified: vendor/elftoolchain/dist/elfcopy/elfcopy.1
==============================================================================
--- vendor/elftoolchain/dist/elfcopy/elfcopy.1 Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/elfcopy/elfcopy.1 Fri Apr 27 12:02:11 2018 (r333057)
@@ -21,9 +21,9 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
-.\" $Id: elfcopy.1 3426 2016-03-05 13:32:28Z emaste $
+.\" $Id: elfcopy.1 3565 2017-08-31 02:24:19Z emaste $
.\"
-.Dd March 5, 2016
+.Dd August 30, 2017
.Os
.Dt ELFCOPY 1
.Sh NAME
@@ -83,6 +83,7 @@
.Op Fl -srec-forceS3
.Op Fl -srec-len Ns = Ns Ar val
.Op Fl -strip-dwo
+.Op Fl -strip-symbols= Ns Ar filename
.Op Fl -strip-unneeded
.Ar infile
.Op Ar outfile
@@ -339,6 +340,10 @@ This option is only meaningful when the output target
.Dq srec .
.It Fl -strip-dwo
Do not copy .dwo debug sections to the output file.
+.It Fl -strip-symbols= Ns Ar filename
+Do not copy any of the symbols specified by
+.Ar filename
+to the output.
.It Fl -strip-unneeded
Do not copy symbols that are not needed for relocation processing.
.El
Modified: vendor/elftoolchain/dist/elfcopy/main.c
==============================================================================
--- vendor/elftoolchain/dist/elfcopy/main.c Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/elfcopy/main.c Fri Apr 27 12:02:11 2018 (r333057)
@@ -39,7 +39,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: main.c 3520 2017-04-17 01:47:52Z kaiwang27 $");
+ELFTC_VCSID("$Id: main.c 3577 2017-09-14 02:19:42Z emaste $");
enum options
{
@@ -679,6 +679,8 @@ create_file(struct elfcopy *ecp, const char *src, cons
if ((ifd = open(elftemp, O_RDONLY)) == -1)
err(EXIT_FAILURE, "open %s failed", src);
close(efd);
+ if (unlink(elftemp) < 0)
+ err(EXIT_FAILURE, "unlink %s failed", elftemp);
free(elftemp);
}
@@ -1283,8 +1285,9 @@ parse_symlist_file(struct elfcopy *ecp, const char *fn
err(EXIT_FAILURE, "can not open %s", fn);
if ((data = malloc(sb.st_size + 1)) == NULL)
err(EXIT_FAILURE, "malloc failed");
- if (fread(data, 1, sb.st_size, fp) == 0 || ferror(fp))
- err(EXIT_FAILURE, "fread failed");
+ if (sb.st_size > 0)
+ if (fread(data, sb.st_size, 1, fp) != 1)
+ err(EXIT_FAILURE, "fread failed");
fclose(fp);
data[sb.st_size] = '\0';
@@ -1534,6 +1537,22 @@ print_version(void)
exit(EXIT_SUCCESS);
}
+/*
+ * Compare the ending of s with end.
+ */
+static int
+strrcmp(const char *s, const char *end)
+{
+ size_t endlen, slen;
+
+ slen = strlen(s);
+ endlen = strlen(end);
+
+ if (slen >= endlen)
+ s += slen - endlen;
+ return (strcmp(s, end));
+}
+
int
main(int argc, char **argv)
{
@@ -1567,12 +1586,16 @@ main(int argc, char **argv)
if ((ecp->progname = ELFTC_GETPROGNAME()) == NULL)
ecp->progname = "elfcopy";
- if (strcmp(ecp->progname, "strip") == 0)
+ if (strrcmp(ecp->progname, "strip") == 0)
strip_main(ecp, argc, argv);
- else if (strcmp(ecp->progname, "mcs") == 0)
+ else if (strrcmp(ecp->progname, "mcs") == 0)
mcs_main(ecp, argc, argv);
- else
+ else {
+ if (strrcmp(ecp->progname, "elfcopy") != 0 &&
+ strrcmp(ecp->progname, "objcopy") != 0)
+ warnx("program mode not known, defaulting to elfcopy");
elfcopy_main(ecp, argc, argv);
+ }
free_sec_add(ecp);
free_sec_act(ecp);
Modified: vendor/elftoolchain/dist/elfdump/elfdump.c
==============================================================================
--- vendor/elftoolchain/dist/elfdump/elfdump.c Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/elfdump/elfdump.c Fri Apr 27 12:02:11 2018 (r333057)
@@ -50,7 +50,7 @@
#include "_elftc.h"
-ELFTC_VCSID("$Id: elfdump.c 3521 2017-06-04 20:07:09Z jkoshy $");
+ELFTC_VCSID("$Id: elfdump.c 3584 2017-11-05 20:51:43Z jkoshy $");
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION)
#include "native-elf-format.h"
@@ -915,7 +915,7 @@ elf_print_ar(struct elfdump *ed, int fd)
Elf_Arhdr *arh;
Elf_Arsym *arsym;
Elf_Cmd cmd;
- char idx[10];
+ char idx[21];
size_t cnt, i;
ed->ar = ed->elf;
@@ -1496,7 +1496,7 @@ elf_print_symtab(struct elfdump *ed, int i)
struct section *s;
const char *name;
uint16_t *vs;
- char idx[10];
+ char idx[13];
Elf_Data *data;
GElf_Sym sym;
int len, j, elferr, nvs;
@@ -1590,7 +1590,7 @@ elf_print_dynamic(struct elfdump *ed)
{
struct section *s;
const char *name;
- char idx[10];
+ char idx[13];
Elf_Data *data;
GElf_Dyn dyn;
int elferr, i, len;
@@ -2052,7 +2052,7 @@ elf_print_note(struct elfdump *ed)
size_t count;
int elferr, i;
uint8_t *src;
- char idx[10];
+ char idx[17];
s = NULL;
for (i = 0; (size_t)i < ed->shnum; i++) {
Modified: vendor/elftoolchain/dist/ld/Makefile
==============================================================================
--- vendor/elftoolchain/dist/ld/Makefile Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/ld/Makefile Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,4 +1,4 @@
-# $Id: Makefile 3407 2016-02-14 17:47:23Z jkoshy $
+# $Id: Makefile 3594 2018-04-11 18:26:50Z jkoshy $
TOP= ..
@@ -47,6 +47,6 @@ YFLAGS= -d
.SUFFIXES: .ld .c
.ld.c:
- awk -f ld_script.awk ${.ALLSRC} > ${.TARGET}
+ awk -f ${.CURDIR}/ld_script.awk ${.ALLSRC} > ${.TARGET}
.include "${TOP}/mk/elftoolchain.prog.mk"
Modified: vendor/elftoolchain/dist/ld/ld_script.awk
==============================================================================
--- vendor/elftoolchain/dist/ld/ld_script.awk Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/ld/ld_script.awk Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,10 +1,19 @@
-# $Id: ld_script.awk 2493 2012-04-15 18:59:09Z kaiwang27 $
+# Transform text file contents into a string literal.
+#
+# Usage: awk -f THIS-SCRIPT INPUT > OUTPUT
+#
+# $Id: ld_script.awk 3593 2018-04-11 18:26:20Z jkoshy $
BEGIN {
+ # Generate a symbol name based on the last component
+ # of the input file name.
split(ARGV[1], s, ".");
+ sub(".*/", "", s[1]);
printf "const char *%s = ", s[1];
}
+# Enclose each line of text with a preceding and trailing '"',
+# escaping any '"' characters that are present.
{
printf "\"";
gsub("\"", "\\\"");
Modified: vendor/elftoolchain/dist/libdwarf/Makefile
==============================================================================
--- vendor/elftoolchain/dist/libdwarf/Makefile Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libdwarf/Makefile Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,6 +1,6 @@
-# $Id: Makefile 3097 2014-09-02 22:10:18Z kaiwang27 $
+# $Id: Makefile 3594 2018-04-11 18:26:50Z jkoshy $
-TOP= ${.CURDIR}/..
+TOP= ..
LIB= dwarf
Modified: vendor/elftoolchain/dist/libdwarf/libdwarf.h
==============================================================================
--- vendor/elftoolchain/dist/libdwarf/libdwarf.h Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libdwarf/libdwarf.h Fri Apr 27 12:02:11 2018 (r333057)
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: libdwarf.h 3295 2016-01-08 22:08:10Z jkoshy $
+ * $Id: libdwarf.h 3578 2017-09-14 02:21:28Z emaste $
*/
#ifndef _LIBDWARF_H_
@@ -440,6 +440,7 @@ enum Dwarf_ISA {
DW_ISA_X86,
DW_ISA_X86_64,
DW_ISA_AARCH64,
+ DW_ISA_RISCV,
DW_ISA_MAX
};
Modified: vendor/elftoolchain/dist/libdwarf/libdwarf_frame.c
==============================================================================
--- vendor/elftoolchain/dist/libdwarf/libdwarf_frame.c Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libdwarf/libdwarf_frame.c Fri Apr 27 12:02:11 2018 (r333057)
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_frame.c 3106 2014-12-19 16:00:58Z kaiwang27 $");
+ELFTC_VCSID("$Id: libdwarf_frame.c 3589 2018-03-13 20:34:33Z kaiwang27 $");
static int
_dwarf_frame_find_cie(Dwarf_FrameSec fs, Dwarf_Unsigned offset,
@@ -142,6 +142,8 @@ _dwarf_frame_parse_lsb_cie_augment(Dwarf_Debug dbg, Dw
augdata_p = cie->cie_augdata;
while (*aug_p != '\0') {
switch (*aug_p) {
+ case 'S':
+ break;
case 'L':
/* Skip one augment in augment data. */
augdata_p++;
Modified: vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c
==============================================================================
--- vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c Fri Apr 27 12:02:11 2018 (r333057)
@@ -26,7 +26,7 @@
#include "_libdwarf.h"
-ELFTC_VCSID("$Id: libdwarf_reloc.c 3198 2015-05-14 18:36:19Z emaste $");
+ELFTC_VCSID("$Id: libdwarf_reloc.c 3578 2017-09-14 02:21:28Z emaste $");
Dwarf_Unsigned
_dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64)
@@ -49,6 +49,8 @@ _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64)
return (R_ARM_ABS32);
case DW_ISA_MIPS:
return (is64 ? R_MIPS_64 : R_MIPS_32);
+ case DW_ISA_RISCV:
+ return (is64 ? R_RISCV_64 : R_RISCV_32);
case DW_ISA_IA64:
return (is64 ? R_IA_64_DIR64LSB : R_IA_64_DIR32LSB);
default:
@@ -99,6 +101,12 @@ _dwarf_get_reloc_size(Dwarf_Debug dbg, Dwarf_Unsigned
if (rel_type == R_MIPS_32)
return (4);
else if (rel_type == R_MIPS_64)
+ return (8);
+ break;
+ case EM_RISCV:
+ if (rel_type == R_RISCV_32)
+ return (4);
+ else if (rel_type == R_RISCV_64)
return (8);
break;
case EM_IA_64:
Modified: vendor/elftoolchain/dist/libelf/Makefile
==============================================================================
--- vendor/elftoolchain/dist/libelf/Makefile Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libelf/Makefile Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,6 +1,6 @@
-# $Id: Makefile 2605 2012-10-02 17:52:20Z jkoshy $
+# $Id: Makefile 3594 2018-04-11 18:26:50Z jkoshy $
-TOP= ${.CURDIR}/..
+TOP= ..
LIB= elf
Modified: vendor/elftoolchain/dist/libelf/_libelf_config.h
==============================================================================
--- vendor/elftoolchain/dist/libelf/_libelf_config.h Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libelf/_libelf_config.h Fri Apr 27 12:02:11 2018 (r333057)
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: _libelf_config.h 3400 2016-02-12 18:38:49Z emaste $
+ * $Id: _libelf_config.h 3566 2017-08-31 02:28:40Z emaste $
*/
#if defined(__APPLE__) || defined(__DragonFly__)
@@ -97,7 +97,7 @@
#define LIBELF_BYTEORDER ELFDATA2MSB
#define LIBELF_CLASS ELFCLASS32
-#elif defined(__riscv64)
+#elif defined(__riscv) && (__riscv_xlen == 64)
#define LIBELF_ARCH EM_RISCV
#define LIBELF_BYTEORDER ELFDATA2LSB
Modified: vendor/elftoolchain/dist/libelf/gelf_phdr.c
==============================================================================
--- vendor/elftoolchain/dist/libelf/gelf_phdr.c Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libelf/gelf_phdr.c Fri Apr 27 12:02:11 2018 (r333057)
@@ -31,7 +31,7 @@
#include "_libelf.h"
-ELFTC_VCSID("$Id: gelf_phdr.c 3177 2015-03-30 18:19:41Z emaste $");
+ELFTC_VCSID("$Id: gelf_phdr.c 3576 2017-09-14 02:15:29Z emaste $");
Elf32_Phdr *
elf32_getphdr(Elf *e)
@@ -53,24 +53,26 @@ gelf_getphdr(Elf *e, int index, GElf_Phdr *d)
Elf64_Ehdr *eh64;
Elf32_Phdr *ep32;
Elf64_Phdr *ep64;
+ size_t phnum;
if (d == NULL || e == NULL ||
((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) ||
- (e->e_kind != ELF_K_ELF) || index < 0) {
+ (e->e_kind != ELF_K_ELF) || index < 0 ||
+ elf_getphdrnum(e, &phnum) < 0) {
LIBELF_SET_ERROR(ARGUMENT, 0);
return (NULL);
}
+ if ((size_t)index >= phnum) {
+ LIBELF_SET_ERROR(ARGUMENT, 0);
+ return (NULL);
+ }
+
if (ec == ELFCLASS32) {
if ((eh32 = _libelf_ehdr(e, ELFCLASS32, 0)) == NULL ||
((ep32 = _libelf_getphdr(e, ELFCLASS32)) == NULL))
return (NULL);
- if (index >= eh32->e_phnum) {
- LIBELF_SET_ERROR(ARGUMENT, 0);
- return (NULL);
- }
-
ep32 += index;
d->p_type = ep32->p_type;
@@ -87,11 +89,6 @@ gelf_getphdr(Elf *e, int index, GElf_Phdr *d)
(ep64 = _libelf_getphdr(e, ELFCLASS64)) == NULL)
return (NULL);
- if (index >= eh64->e_phnum) {
- LIBELF_SET_ERROR(ARGUMENT, 0);
- return (NULL);
- }
-
ep64 += index;
*d = *ep64;
@@ -125,13 +122,15 @@ gelf_newphdr(Elf *e, size_t count)
int
gelf_update_phdr(Elf *e, int ndx, GElf_Phdr *s)
{
- int ec, phnum;
+ int ec;
+ size_t phnum;
void *ehdr;
Elf32_Phdr *ph32;
Elf64_Phdr *ph64;
if (s == NULL || e == NULL || e->e_kind != ELF_K_ELF ||
- ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) {
+ ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) ||
+ elf_getphdrnum(e, &phnum) < 0) {
LIBELF_SET_ERROR(ARGUMENT, 0);
return (0);
}
@@ -144,12 +143,7 @@ gelf_update_phdr(Elf *e, int ndx, GElf_Phdr *s)
if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL)
return (0);
- if (ec == ELFCLASS32)
- phnum = ((Elf32_Ehdr *) ehdr)->e_phnum;
- else
- phnum = ((Elf64_Ehdr *) ehdr)->e_phnum;
-
- if (ndx < 0 || ndx > phnum) {
+ if (ndx < 0 || (size_t)ndx > phnum) {
LIBELF_SET_ERROR(ARGUMENT, 0);
return (0);
}
Modified: vendor/elftoolchain/dist/libelf/libelf_ehdr.c
==============================================================================
--- vendor/elftoolchain/dist/libelf/libelf_ehdr.c Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libelf/libelf_ehdr.c Fri Apr 27 12:02:11 2018 (r333057)
@@ -31,7 +31,7 @@
#include "_libelf.h"
-ELFTC_VCSID("$Id: libelf_ehdr.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: libelf_ehdr.c 3575 2017-09-14 02:13:36Z emaste $");
/*
* Retrieve counts for sections, phdrs and the section string table index
@@ -170,10 +170,6 @@ _libelf_ehdr(Elf *e, int ec, int allocate)
(*xlator)((unsigned char*) ehdr, msz, e->e_rawfile, (size_t) 1,
e->e_byteorder != LIBELF_PRIVATE(byteorder));
- /*
- * If extended numbering is being used, read the correct
- * number of sections and program header entries.
- */
if (ec == ELFCLASS32) {
phnum = ((Elf32_Ehdr *) ehdr)->e_phnum;
shnum = ((Elf32_Ehdr *) ehdr)->e_shnum;
@@ -193,12 +189,19 @@ _libelf_ehdr(Elf *e, int ec, int allocate)
return (NULL);
}
- if (shnum != 0 || shoff == 0LL) { /* not using extended numbering */
+ /*
+ * If extended numbering is being used, read the correct
+ * number of sections and program header entries.
+ */
+ if ((shnum == 0 && shoff != 0) || phnum == PN_XNUM || strndx == SHN_XINDEX) {
+ if (_libelf_load_extended(e, ec, shoff, phnum, strndx) == 0)
+ return (NULL);
+ } else {
+ /* not using extended numbering */
e->e_u.e_elf.e_nphdr = phnum;
e->e_u.e_elf.e_nscn = shnum;
e->e_u.e_elf.e_strndx = strndx;
- } else if (_libelf_load_extended(e, ec, shoff, phnum, strndx) == 0)
- return (NULL);
+ }
return (ehdr);
}
Modified: vendor/elftoolchain/dist/libelftc/Makefile
==============================================================================
--- vendor/elftoolchain/dist/libelftc/Makefile Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libelftc/Makefile Fri Apr 27 12:02:11 2018 (r333057)
@@ -1,6 +1,6 @@
-# $Id: Makefile 3489 2016-08-31 00:12:15Z emaste $
+# $Id: Makefile 3601 2018-04-12 16:58:53Z jkoshy $
-TOP= ${.CURDIR}/..
+TOP= ..
LIB= elftc
@@ -28,7 +28,8 @@ SHLIB_MAJOR= 1
WARNS?= 6
-CLEANFILES+= elftc_version.c
+ELFTC_VERSION_FILE= ${.OBJDIR}/elftc_version.c
+CLEANFILES+= ${ELFTC_VERSION_FILE}
LDADD+= -lelf
@@ -50,10 +51,10 @@ MLINKS= elftc_bfd_find_target.3 elftc_bfd_target_byteo
elftc_string_table_create.3 elftc_string_table_insert.3 \
elftc_string_table_create.3 elftc_string_table_lookup.3
-.if !make(clean) && !make(clobber)
+.if !make(clean) && !make(clobber) && !make(obj)
.BEGIN: .SILENT
- ${.CURDIR}/make-toolchain-version -t ${TOP} -r ${RELEASE} \
- -h ${OS_HOST}
+ ${.CURDIR}/make-toolchain-version -t ${.CURDIR}/${TOP} \
+ -r ${RELEASE} -h ${OS_HOST} -o ${ELFTC_VERSION_FILE}
.endif
.include "${TOP}/mk/elftoolchain.lib.mk"
Modified: vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c
==============================================================================
--- vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c Fri Apr 27 11:00:12 2018 (r333056)
+++ vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c Fri Apr 27 12:02:11 2018 (r333057)
@@ -501,6 +501,120 @@ elftc_reloc_type_str(unsigned int mach, unsigned int t
case 116: return "R_PPC_EMB_RELSDA";
}
break;
+ case EM_PPC64:
+ switch(type) {
+ case 0: return "R_PPC64_NONE";
+ case 1: return "R_PPC64_ADDR32";
+ case 2: return "R_PPC64_ADDR24";
+ case 3: return "R_PPC64_ADDR16";
+ case 4: return "R_PPC64_ADDR16_LO";
+ case 5: return "R_PPC64_ADDR16_HI";
+ case 6: return "R_PPC64_ADDR16_HA";
+ case 7: return "R_PPC64_ADDR14";
+ case 8: return "R_PPC64_ADDR14_BRTAKEN";
+ case 9: return "R_PPC64_ADDR14_BRNTAKEN";
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list