Date: Wed, 10 Feb 2016 19:39:36 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r295484 - in vendor/elftoolchain/dist: . addr2line ar brandelf common cxxfilt elfcopy elfdump findtextrel ld libdwarf libelftc libpe mk nm readelf size strings test/ar/plugin test/ar/tc... Message-ID: <201602101939.u1AJdaR7063441@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Wed Feb 10 19:39:36 2016 New Revision: 295484 URL: https://svnweb.freebsd.org/changeset/base/295484 Log: Import ELF Tool Chain snapshot revision 3395 This is close to the upcoming 0.7.1 release. From http://svn.code.sf.net/p/elftoolchain/code Added: vendor/elftoolchain/dist/addr2line/os.NetBSD.mk (contents, props changed) vendor/elftoolchain/dist/elfcopy/pe.c (contents, props changed) vendor/elftoolchain/dist/elfdump/os.NetBSD.mk (contents, props changed) vendor/elftoolchain/dist/ld/bigmips_script.ld vendor/elftoolchain/dist/ld/littlemips_script.ld vendor/elftoolchain/dist/ld/mips.c (contents, props changed) vendor/elftoolchain/dist/ld/mips.h (contents, props changed) vendor/elftoolchain/dist/libdwarf/os.NetBSD.mk (contents, props changed) vendor/elftoolchain/dist/libelftc/os.NetBSD.mk (contents, props changed) vendor/elftoolchain/dist/libpe/ vendor/elftoolchain/dist/libpe/Makefile (contents, props changed) vendor/elftoolchain/dist/libpe/_libpe.h (contents, props changed) vendor/elftoolchain/dist/libpe/libpe.h (contents, props changed) vendor/elftoolchain/dist/libpe/libpe_buffer.c (contents, props changed) vendor/elftoolchain/dist/libpe/libpe_coff.c (contents, props changed) vendor/elftoolchain/dist/libpe/libpe_dos.c (contents, props changed) vendor/elftoolchain/dist/libpe/libpe_init.c (contents, props changed) vendor/elftoolchain/dist/libpe/libpe_rich.c (contents, props changed) vendor/elftoolchain/dist/libpe/libpe_section.c (contents, props changed) vendor/elftoolchain/dist/libpe/libpe_utils.c (contents, props changed) vendor/elftoolchain/dist/libpe/os.Linux.mk (contents, props changed) vendor/elftoolchain/dist/libpe/os.NetBSD.mk (contents, props changed) vendor/elftoolchain/dist/libpe/pe.h (contents, props changed) vendor/elftoolchain/dist/libpe/pe_buffer.c (contents, props changed) vendor/elftoolchain/dist/libpe/pe_cntl.c (contents, props changed) vendor/elftoolchain/dist/libpe/pe_coff.c (contents, props changed) vendor/elftoolchain/dist/libpe/pe_dos.c (contents, props changed) vendor/elftoolchain/dist/libpe/pe_flag.c (contents, props changed) vendor/elftoolchain/dist/libpe/pe_init.c (contents, props changed) vendor/elftoolchain/dist/libpe/pe_rich.c (contents, props changed) vendor/elftoolchain/dist/libpe/pe_section.c (contents, props changed) vendor/elftoolchain/dist/libpe/pe_symtab.c (contents, props changed) vendor/elftoolchain/dist/libpe/pe_update.c (contents, props changed) vendor/elftoolchain/dist/mk/elftoolchain.components.mk (contents, props changed) vendor/elftoolchain/dist/nm/os.NetBSD.mk (contents, props changed) vendor/elftoolchain/dist/readelf/os.NetBSD.mk (contents, props changed) vendor/elftoolchain/dist/size/os.NetBSD.mk (contents, props changed) vendor/elftoolchain/dist/strings/os.NetBSD.mk (contents, props changed) Deleted: vendor/elftoolchain/dist/libelftc/elftc_symbol_table_create.3 Modified: vendor/elftoolchain/dist/INSTALL vendor/elftoolchain/dist/Makefile vendor/elftoolchain/dist/RELEASE-NOTES vendor/elftoolchain/dist/addr2line/addr2line.c vendor/elftoolchain/dist/ar/ar.c vendor/elftoolchain/dist/brandelf/brandelf.c vendor/elftoolchain/dist/common/elfdefinitions.h vendor/elftoolchain/dist/common/native-elf-format vendor/elftoolchain/dist/cxxfilt/cxxfilt.c vendor/elftoolchain/dist/elfcopy/Makefile vendor/elftoolchain/dist/elfcopy/archive.c vendor/elftoolchain/dist/elfcopy/elfcopy.1 vendor/elftoolchain/dist/elfcopy/elfcopy.h vendor/elftoolchain/dist/elfcopy/main.c vendor/elftoolchain/dist/elfcopy/sections.c vendor/elftoolchain/dist/elfcopy/segments.c vendor/elftoolchain/dist/elfcopy/symbols.c vendor/elftoolchain/dist/elfdump/elfdump.c vendor/elftoolchain/dist/findtextrel/findtextrel.c vendor/elftoolchain/dist/ld/Makefile vendor/elftoolchain/dist/ld/amd64.c vendor/elftoolchain/dist/ld/i386.c vendor/elftoolchain/dist/ld/ld_arch.c vendor/elftoolchain/dist/ld/ld_arch.h vendor/elftoolchain/dist/ld/ld_dynamic.c vendor/elftoolchain/dist/ld/ld_exp.c vendor/elftoolchain/dist/ld/ld_file.c vendor/elftoolchain/dist/ld/ld_layout.c vendor/elftoolchain/dist/ld/ld_output.c vendor/elftoolchain/dist/ld/ld_script.c vendor/elftoolchain/dist/ld/ld_script.h vendor/elftoolchain/dist/ld/ld_script_lexer.l vendor/elftoolchain/dist/ld/ld_script_parser.y vendor/elftoolchain/dist/ld/ld_strtab.c vendor/elftoolchain/dist/ld/ld_symbols.c vendor/elftoolchain/dist/libdwarf/_libdwarf.h vendor/elftoolchain/dist/libdwarf/dwarf.3 vendor/elftoolchain/dist/libdwarf/dwarf_str.c vendor/elftoolchain/dist/libdwarf/libdwarf.h vendor/elftoolchain/dist/libdwarf/libdwarf_rw.c vendor/elftoolchain/dist/libelftc/Makefile vendor/elftoolchain/dist/libelftc/elftc_bfd_find_target.3 vendor/elftoolchain/dist/libelftc/elftc_copyfile.c vendor/elftoolchain/dist/libelftc/elftc_demangle.c vendor/elftoolchain/dist/libelftc/libelftc.h vendor/elftoolchain/dist/libelftc/libelftc_bfdtarget.c vendor/elftoolchain/dist/libelftc/libelftc_dem_gnu3.c vendor/elftoolchain/dist/libelftc/make-toolchain-version vendor/elftoolchain/dist/mk/elftoolchain.prog.mk vendor/elftoolchain/dist/readelf/readelf.c vendor/elftoolchain/dist/strings/strings.1 vendor/elftoolchain/dist/strings/strings.c vendor/elftoolchain/dist/test/ar/plugin/Makefile vendor/elftoolchain/dist/test/ar/plugin/ardiff.c vendor/elftoolchain/dist/test/ar/plugin/teraser.c vendor/elftoolchain/dist/test/ar/tc/usage-bi/usage-bi.err vendor/elftoolchain/dist/test/elfcopy/plugin/Makefile vendor/elftoolchain/dist/test/elfcopy/plugin/ardiff.c vendor/elftoolchain/dist/test/elfcopy/plugin/teraser.c vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-L-1/out/elfcopy-L-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-L-2/out/elfcopy-L-2.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-N-1/out/elfcopy-N-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-N-2/out/elfcopy-N-2.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-noops-1/out/elfcopy-noops-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-noops-2/out/elfcopy-noops-2.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-noops-3/out/elfcopy-noops-3.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-noops-4/out/elfcopy-noops-4.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-noops-5/out/elfcopy-noops-5.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-noops-6/out/elfcopy-noops-6.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-noops-7/out/elfcopy-noops-7.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-noops-archive-1/out/elfcopy-noops-archive-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-noops-archive-2/out/elfcopy-noops-archive-2.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/elfcopy-rename-1/out/elfcopy-rename-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-K-2/out/strip-K-2.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-1/out/strip-all-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-10/out/strip-all-10.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-2/out/strip-all-2.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-3/out/strip-all-3.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-4/out/strip-all-4.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-5/out/strip-all-5.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-6/out/strip-all-6.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-7/out/strip-all-7.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-8/out/strip-all-8.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-9/out/strip-all-9.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-archive-1/out/strip-all-archive-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-all-archive-2/out/strip-all-archive-2.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-debug-1/out/strip-debug-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-debug-2/out/strip-debug-2.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-debug-3/out/strip-debug-3.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-debug-4/out/strip-debug-4.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-onlydebug-1/out/strip-onlydebug-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-unneeded-1/out/strip-unneeded-1.out.shar vendor/elftoolchain/dist/test/elfcopy/tc/strip-unneeded-2/out/strip-unneeded-2.out.shar vendor/elftoolchain/dist/test/elfdump/ts/dso1/@G%libelf.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso1/@S@G%libelf.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso1/@S@r%libelf.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@G%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@S@G%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@S@r%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@e%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@e@i%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/dso2/@e@p@c%test.so.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@G%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@G@e%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@S@G%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@S@r%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec1/@S@r@N%.rela.dyn@N%.rela.plt%ls.out vendor/elftoolchain/dist/test/elfdump/ts/exec2/@G%cp.out vendor/elftoolchain/dist/test/elfdump/ts/exec2/@G@e%cp.out vendor/elftoolchain/dist/test/elfdump/ts/exec2/@S@G%cp.out vendor/elftoolchain/dist/test/elfdump/ts/exec2/@S@r%cp.out vendor/elftoolchain/dist/test/libdwarf/ts/Makefile.tset Modified: vendor/elftoolchain/dist/INSTALL ============================================================================== --- vendor/elftoolchain/dist/INSTALL Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/INSTALL Wed Feb 10 19:39:36 2016 (r295484) @@ -14,13 +14,11 @@ operating systems. Operating System Version Supported Architectures ----------------- -------- ----------------------- `DragonFly BSD`_ 2.10.1 i386 - FreeBSD_ v8.2 amd64 & i386 - FreeBSD_ v10.1 i386 + FreeBSD_ 10.2 amd64 & i386 Minix_ 3.0.2 i386 - NetBSD_ v5.0.2 i386 + NetBSD_ 7.0 i386 OpenBSD_ v5.0 i386 - Ubuntu_ GNU/Linux 10.04LTS i386 & x86_64 - Ubuntu_ GNU/Linux 12.04LTS i386 & x86_64 + Ubuntu_ GNU/Linux 14.04LTS x86_64 ================= ======== ======================= .. _DragonFly BSD: http://www.dragonflybsd.org/ @@ -35,9 +33,9 @@ Building the Source Tree The core libraries and utilities that make up the software release are always built by default. Builds of the project's test suites (in the -``test/`` subdirectory), and of additional documentation (in the -directory ``documentation/``) are optional and will only be attempted -if these directories are present. +``test/`` subdirectory), and of additional documentation (in the directory +``documentation/``) are optional, and will only be attempted if these +directories are present. Prerequisites ------------- @@ -58,39 +56,24 @@ Prerequisites - Building additional documentation is not currently supported under DragonFly BSD. -:FreeBSD 8.2: +:FreeBSD 10.2: - The core libraries and utilities should build out of the box on a stock install of FreeBSD. - To build and run the test suite: #. The current release of the `Test Execution Toolkit`_ needs to - be downloaded and unpacked into the ``test/tet/`` directory. - - #. The ``py-yaml`` package needs to be installed:: + be downloaded and unpacked into the ``test/tet/`` directory:: - % sudo pkg_add -r py-yaml - - - To build additional documentation, the ``latex-pgf`` package is - needed:: - - % sudo pkg_add -r latex-pgf - -:FreeBSD 10.1: - - The core libraries and utilities should build out of the box on - a stock install of FreeBSD. - - - To build and run the test suite: - - #. The current release of the `Test Execution Toolkit`_ needs to - be downloaded and unpacked into the ``test/tet/`` directory. + % cd <SRCDIR>/test/tet + % tar -xf /PATH/TO/DOWNLOADED/TET-3.8-SOURCES #. The ``python`` and ``py27-yaml`` packages need to be installed:: % sudo pkg install python py27-yaml - Building additional documentation is not currently supported under - FreeBSD 10.1. + FreeBSD 10.2. :Minix 3.2.0: - The following packages are pre-requisites for building the @@ -152,9 +135,20 @@ Prerequisites - Building additional documentation is not currently supported under OpenBSD. -:NetBSD 5.0.2: - - The core libraries and utilities should build out of the box - on a stock install of NetBSD. +:NetBSD 7.0: + - The following packages are pre-requisites for building the + sources on NetBSD 7.0: + + =================== ===================================== + **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: @@ -165,7 +159,7 @@ Prerequisites #. The following additional package needs to be installed, as listed in the example command line below :: - % sudo pkg_add py26-yaml + % sudo pkg_add py27-yaml - Building additional documentation is not currently supported under NetBSD. @@ -213,9 +207,9 @@ Prerequisites % sudo apt-get install pgf -:Ubuntu GNU/Linux 12.04: +:Ubuntu GNU/Linux 14.04: - The following packages are pre-requisites for building the - sources on Ubuntu GNU/Linux 12.04: + sources on Ubuntu GNU/Linux 14.04: =================== ===================================== **Package** **Description** @@ -226,7 +220,7 @@ Prerequisites ``libarchive-dev`` Archive access library. ``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. @@ -236,7 +230,7 @@ Prerequisites pre-requisites:: % sudo apt-get install bison build-essential flex libarchive-dev \ - m4 pmake zlib1g-dev + m4 bmake zlib1g-dev - To build and run the test suite: @@ -250,7 +244,7 @@ Prerequisites % sudo apt-get install libexpat1-dev python-yaml sharutils - Builds of additional documentation are not currently supported - under Ubuntu GNU/Linux 12.04. + under Ubuntu GNU/Linux 14.04. .. _Test Execution Toolkit: http://tetworks.opengroup.org/ .. _OpenGroup: http://www.opengroup.org/ @@ -316,7 +310,7 @@ website`_. .. _project website: http://elftoolchain.sourceforge.net/ -.. $Id: INSTALL 3193 2015-05-04 17:47:14Z jkoshy $ +.. $Id: INSTALL 3353 2016-01-18 21:50:13Z jkoshy $ .. Local Variables: .. mode: rst Modified: vendor/elftoolchain/dist/Makefile ============================================================================== --- vendor/elftoolchain/dist/Makefile Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/Makefile Wed Feb 10 19:39:36 2016 (r295484) @@ -1,7 +1,8 @@ -# $Id: Makefile 3016 2014-04-10 16:01:42Z jkoshy $ +# $Id: Makefile 3382 2016-01-31 12:31:08Z jkoshy $ TOP= . +.include "${TOP}/mk/elftoolchain.components.mk" .include "${TOP}/mk/elftoolchain.os.mk" # Build configuration information first. @@ -13,10 +14,14 @@ SUBDIR += libdwarf # Build additional APIs. SUBDIR += libelftc +.if defined(WITH_PE) && ${WITH_PE:tl} == "yes" +SUBDIR += libpe +.endif -# Build the tools needed for the rest of the build. - -# SUBDIR += isa # ('isa' does not build on all platforms yet). +# The instruction set analyser. +.if defined(WITH_ISA) && ${WITH_ISA:tl} == "yes" +SUBDIR += isa # ('isa' does not build on all platforms yet). +.endif # Build tools after the libraries. SUBDIR += addr2line @@ -26,6 +31,7 @@ SUBDIR += cxxfilt SUBDIR += elfcopy SUBDIR += elfdump SUBDIR += findtextrel +SUBDIR += ld SUBDIR += nm SUBDIR += readelf SUBDIR += size @@ -33,12 +39,18 @@ SUBDIR += strings SUBDIR += tools # Build the test suites. -.if exists(${.CURDIR}/test) && defined(MKTESTS) && ${MKTESTS} == "yes" +.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS:tl} == "yes" SUBDIR += test .endif +# Build additional build tooling. +.if defined(WITH_BUILD_TOOLS) && ${WITH_BUILD_TOOLS:tl} == "yes" +SUBDIR += tools +.endif + # Build documentation at the end. -.if exists(${.CURDIR}/documentation) && defined(MKDOC) && ${MKDOC} == "yes" +.if exists(${.CURDIR}/documentation) && defined(WITH_DOCUMENTATION) && \ + ${WITH_DOCUMENTATION:tl} == "yes" SUBDIR += documentation .endif @@ -49,7 +61,7 @@ SUBDIR += documentation # # Run the test suites. -.if exists(${.CURDIR}/test) && defined(MKTESTS) && ${MKTESTS} == "yes" +.if exists(${.CURDIR}/test) && defined(WITH_TESTS) && ${WITH_TESTS:tl} == "yes" run-tests: all .PHONY (cd ${.CURDIR}/test; ${MAKE} test) .endif Modified: vendor/elftoolchain/dist/RELEASE-NOTES ============================================================================== --- vendor/elftoolchain/dist/RELEASE-NOTES Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/RELEASE-NOTES Wed Feb 10 19:39:36 2016 (r295484) @@ -1,4 +1,4 @@ -.. $Id: RELEASE-NOTES 2599 2012-09-25 06:25:51Z jkoshy $ +.. $Id: RELEASE-NOTES 3353 2016-01-18 21:50:13Z jkoshy $ .. This file contains a template for use when writing release notes. .. It needs to be updated with release-specific content prior to @@ -96,11 +96,11 @@ systems: **Operating System** **Version** **Supported Architectures** -------------------- ----------- --------------------------- `DragonFly BSD`_ 2.10.1 i386 - FreeBSD_ v8.2 amd64 & i386 + FreeBSD_ 10.2 amd64 & i386 Minix_ 3.2.0 i386 - NetBSD_ v5.0.2 i386 + NetBSD_ 7.0 i386 OpenBSD_ v5.0 i386 - Ubuntu_ GNU/Linux 10.04LTS i386 & x86_64 + Ubuntu_ GNU/Linux 14.04LTS x86_64 ==================== =========== =========================== Modified: vendor/elftoolchain/dist/addr2line/addr2line.c ============================================================================== --- vendor/elftoolchain/dist/addr2line/addr2line.c Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/addr2line/addr2line.c Wed Feb 10 19:39:36 2016 (r295484) @@ -40,7 +40,7 @@ #include "uthash.h" #include "_elftc.h" -ELFTC_VCSID("$Id: addr2line.c 3264 2015-11-30 05:38:14Z kaiwang27 $"); +ELFTC_VCSID("$Id: addr2line.c 3273 2015-12-11 21:38:57Z kaiwang27 $"); struct Func { char *name; @@ -368,7 +368,8 @@ print_inlines(struct CU *cu, struct Func printf("%s\n", f->name); } } - (void) printf("%s:%ju\n", base ? basename(file) : file, call_line); + (void) printf("%s:%ju\n", base ? basename(file) : file, + (uintmax_t) call_line); if (f->inlined_caller != NULL) print_inlines(cu, f->inlined_caller, f->call_file, @@ -562,7 +563,8 @@ out: } } - (void) printf("%s:%ju\n", base ? basename(file) : file, lineno); + (void) printf("%s:%ju\n", base ? basename(file) : file, + (uintmax_t) lineno); if (ret == DW_DLV_OK && inlines && cu != NULL && cu->srcfiles != NULL && f != NULL && f->inlined_caller != NULL) Added: vendor/elftoolchain/dist/addr2line/os.NetBSD.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/elftoolchain/dist/addr2line/os.NetBSD.mk Wed Feb 10 19:39:36 2016 (r295484) @@ -0,0 +1,2 @@ +# TODO(#511): Revert after the source tree is -Wconversion clean. +WARNS=5 Modified: vendor/elftoolchain/dist/ar/ar.c ============================================================================== --- vendor/elftoolchain/dist/ar/ar.c Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/ar/ar.c Wed Feb 10 19:39:36 2016 (r295484) @@ -72,7 +72,7 @@ #include "ar.h" -ELFTC_VCSID("$Id: ar.c 3243 2015-08-31 19:28:45Z emaste $"); +ELFTC_VCSID("$Id: ar.c 3319 2016-01-13 21:37:53Z jkoshy $"); enum options { @@ -407,7 +407,7 @@ Usage: %s <command> [options] archive fi -F FORMAT | --flavor=FORMAT\n\ Create archives with the specified format.\n\ -S Do not generate an archive symbol table.\n\ - -U Use original metadata, for unique archive checksums.\n" + -U Use original metadata for archive members.\n" static void bsdar_usage(void) Modified: vendor/elftoolchain/dist/brandelf/brandelf.c ============================================================================== --- vendor/elftoolchain/dist/brandelf/brandelf.c Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/brandelf/brandelf.c Wed Feb 10 19:39:36 2016 (r295484) @@ -44,7 +44,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: brandelf.c 3234 2015-07-31 12:35:09Z emaste $"); +ELFTC_VCSID("$Id: brandelf.c 3354 2016-01-18 21:50:15Z jkoshy $"); static int elftype(const char *); static const char *iselftype(int); @@ -212,7 +212,7 @@ main(int argc, char **argv) /* * Update the ABI type. */ - ehdr.e_ident[EI_OSABI] = type; + ehdr.e_ident[EI_OSABI] = (unsigned char) type; if (gelf_update_ehdr(elf, &ehdr) == 0) { warnx("gelf_update_ehdr error: %s", elf_errmsg(-1)); Modified: vendor/elftoolchain/dist/common/elfdefinitions.h ============================================================================== --- vendor/elftoolchain/dist/common/elfdefinitions.h Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/common/elfdefinitions.h Wed Feb 10 19:39:36 2016 (r295484) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfdefinitions.h 3253 2015-10-10 18:31:33Z kaiwang27 $ + * $Id: elfdefinitions.h 3392 2016-02-05 19:51:22Z emaste $ */ /* @@ -1228,6 +1228,7 @@ _ELF_DEFINE_STB(STB_GLOBAL, 1, _ELF_DEFINE_STB(STB_WEAK, 2, \ "visible across all object files but with low precedence") \ _ELF_DEFINE_STB(STB_LOOS, 10, "start of OS-specific range") \ +_ELF_DEFINE_STB(STB_GNU_UNIQUE, 10, "unique symbol (GNU)") \ _ELF_DEFINE_STB(STB_HIOS, 12, "end of OS-specific range") \ _ELF_DEFINE_STB(STB_LOPROC, 13, \ "start of processor-specific range") \ @@ -1259,6 +1260,7 @@ _ELF_DEFINE_STT(STT_LOPROC, 13, "start of processor-specific types") \ _ELF_DEFINE_STT(STT_ARM_TFUNC, 13, "Thumb function (GNU)") \ _ELF_DEFINE_STT(STT_ARM_16BIT, 15, "Thumb label (GNU)") \ +_ELF_DEFINE_STT(STT_SPARC_REGISTER, 13, "SPARC register information") \ _ELF_DEFINE_STT(STT_HIPROC, 15, \ "end of processor-specific types") @@ -1395,7 +1397,7 @@ _ELF_DEFINE_RELOC(R_386_GOT32, 3) \ _ELF_DEFINE_RELOC(R_386_PLT32, 4) \ _ELF_DEFINE_RELOC(R_386_COPY, 5) \ _ELF_DEFINE_RELOC(R_386_GLOB_DAT, 6) \ -_ELF_DEFINE_RELOC(R_386_JMP_SLOT, 7) \ +_ELF_DEFINE_RELOC(R_386_JUMP_SLOT, 7) \ _ELF_DEFINE_RELOC(R_386_RELATIVE, 8) \ _ELF_DEFINE_RELOC(R_386_GOTOFF, 9) \ _ELF_DEFINE_RELOC(R_386_GOTPC, 10) \ @@ -1407,9 +1409,129 @@ _ELF_DEFINE_RELOC(R_386_PC8, 23) /* */ -#define _ELF_DEFINE_AARCH64_RELOCATIONS() \ -_ELF_DEFINE_RELOC(R_AARCH64_ABS64, 257) \ -_ELF_DEFINE_RELOC(R_AARCH64_ABS32, 258) \ +#define _ELF_DEFINE_AARCH64_RELOCATIONS() \ +_ELF_DEFINE_RELOC(R_AARCH64_NONE, 0) \ +_ELF_DEFINE_RELOC(R_AARCH64_ABS64, 257) \ +_ELF_DEFINE_RELOC(R_AARCH64_ABS32, 258) \ +_ELF_DEFINE_RELOC(R_AARCH64_ABS16, 259) \ +_ELF_DEFINE_RELOC(R_AARCH64_PREL64, 260) \ +_ELF_DEFINE_RELOC(R_AARCH64_PREL32, 261) \ +_ELF_DEFINE_RELOC(R_AARCH64_PREL16, 262) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G0, 263) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G0_NC, 264) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G1, 265) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G1_NC, 266) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G2, 267) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G2_NC, 268) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G3, 269) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_SABS_G0, 270) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_SABS_G1, 271) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_SABS_G2, 272) \ +_ELF_DEFINE_RELOC(R_AARCH64_LD_PREL_LO19, 273) \ +_ELF_DEFINE_RELOC(R_AARCH64_ADR_PREL_LO21, 274) \ +_ELF_DEFINE_RELOC(R_AARCH64_ADR_PREL_PG_HI21, 275) \ +_ELF_DEFINE_RELOC(R_AARCH64_ADR_PREL_PG_HI21_NC, 276) \ +_ELF_DEFINE_RELOC(R_AARCH64_ADD_ABS_LO12_NC, 277) \ +_ELF_DEFINE_RELOC(R_AARCH64_LDST8_ABS_LO12_NC, 278) \ +_ELF_DEFINE_RELOC(R_AARCH64_TSTBR14, 279) \ +_ELF_DEFINE_RELOC(R_AARCH64_CONDBR19, 280) \ +_ELF_DEFINE_RELOC(R_AARCH64_JUMP26, 282) \ +_ELF_DEFINE_RELOC(R_AARCH64_CALL26, 283) \ +_ELF_DEFINE_RELOC(R_AARCH64_LDST16_ABS_LO12_NC, 284) \ +_ELF_DEFINE_RELOC(R_AARCH64_LDST32_ABS_LO12_NC, 285) \ +_ELF_DEFINE_RELOC(R_AARCH64_LDST64_ABS_LO12_NC, 286) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G0, 287) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G0_NC, 288) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G1, 289) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G1_NC, 290) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G2, 291) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G2_NC, 292) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G3, 293) \ +_ELF_DEFINE_RELOC(R_AARCH64_LDST128_ABS_LO12_NC, 299) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G0, 300) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G0_NC, 301) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G1, 302) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G1_NC, 303) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G2, 304) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G2_NC, 305) \ +_ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G3, 306) \ +_ELF_DEFINE_RELOC(R_AARCH64_GOTREL64, 307) \ +_ELF_DEFINE_RELOC(R_AARCH64_GOTREL32, 308) \ +_ELF_DEFINE_RELOC(R_AARCH64_GOT_LD_PREL19, 309) \ +_ELF_DEFINE_RELOC(R_AARCH64_LD64_GOTOFF_LO15, 310) \ +_ELF_DEFINE_RELOC(R_AARCH64_ADR_GOT_PAGE, 311) \ +_ELF_DEFINE_RELOC(R_AARCH64_LD64_GOT_LO12_NC, 312) \ +_ELF_DEFINE_RELOC(R_AARCH64_LD64_GOTPAGE_LO15, 313) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_ADR_PREL21, 512) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_ADR_PAGE21, 513) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_ADD_LO12_NC, 514) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_MOVW_G1, 515) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSGD_MOVW_G0_NC, 516) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADR_PREL21, 517) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADR_PAGE21, 518) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADD_LO12_NC, 519) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_G1, 520) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_G0_NC, 521) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LD_PREL19, 522) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G2, 523) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G1, 524) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, 525) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G0, 526) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, 527) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADD_DTPREL_HI12, 529) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC, 530) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST8_DTPREL_LO12, 531) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, 532) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST16_DTPREL_LO12, 533) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, 534) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST32_DTPREL_LO12, 535) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, 536) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST64_DTPREL_LO12, 537) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, 538) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_MOVW_GOTTPREL_G1, 539) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, 540) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, 541) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC, 542) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSIE_LD_GOTTPREL_PREL19, 543) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G2, 544) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G1, 545) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G1_NC, 546) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G0, 547) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G0_NC, 548) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_ADD_TPREL_HI12, 549) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_ADD_TPREL_LO12, 550) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_ADD_TPREL_LO12_NC, 551) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST8_TPREL_LO12, 552) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC, 553) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST16_TPREL_LO12, 554) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC, 555) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST32_TPREL_LO12, 556) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC, 557) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST64_TPREL_LO12, 558) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC, 559) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_LD_PREL19, 560) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADR_PREL21, 561) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADR_PAGE21, 562) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_LD64_LO12, 563) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADD_LO12, 564) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_OFF_G1, 565) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_OFF_G0_NC, 566) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_LDR, 567) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADD, 568) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_CALL, 569) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST128_TPREL_LO12, 570) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC, 571) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST128_DTPREL_LO12, 572) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC, 573) \ +_ELF_DEFINE_RELOC(R_AARCH64_COPY, 1024) \ +_ELF_DEFINE_RELOC(R_AARCH64_GLOB_DAT, 1025) \ +_ELF_DEFINE_RELOC(R_AARCH64_JUMP_SLOT, 1026) \ +_ELF_DEFINE_RELOC(R_AARCH64_RELATIVE, 1027) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLS_DTPREL64, 1028) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLS_DTPMOD64, 1029) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLS_TPREL64, 1030) \ +_ELF_DEFINE_RELOC(R_AARCH64_TLSDESC, 1031) \ +_ELF_DEFINE_RELOC(R_AARCH64_IRELATIVE, 1032) /* * These are the symbols used in the Sun ``Linkers and Loaders @@ -1633,7 +1755,7 @@ _ELF_DEFINE_RELOC(R_IA_64_LTV32MSB, 0x7 _ELF_DEFINE_RELOC(R_IA_64_LTV32LSB, 0x75) \ _ELF_DEFINE_RELOC(R_IA_64_LTV64MSB, 0x76) \ _ELF_DEFINE_RELOC(R_IA_64_LTV64LSB, 0x77) \ -_ELF_DEFINE_RELOC(R_IA_64_PCREL21BIa, 0x79) \ +_ELF_DEFINE_RELOC(R_IA_64_PCREL21BI, 0x79) \ _ELF_DEFINE_RELOC(R_IA_64_PCREL22, 0x7A) \ _ELF_DEFINE_RELOC(R_IA_64_PCREL64I, 0x7B) \ _ELF_DEFINE_RELOC(R_IA_64_IPLTMSB, 0x80) \ @@ -1723,7 +1845,7 @@ _ELF_DEFINE_RELOC(R_PPC_REL32, 26) \ _ELF_DEFINE_RELOC(R_PPC_PLT32, 27) \ _ELF_DEFINE_RELOC(R_PPC_PLTREL32, 28) \ _ELF_DEFINE_RELOC(R_PPC_PLT16_LO, 29) \ -_ELF_DEFINE_RELOC(R_PPL_PLT16_HI, 30) \ +_ELF_DEFINE_RELOC(R_PPC_PLT16_HI, 30) \ _ELF_DEFINE_RELOC(R_PPC_PLT16_HA, 31) \ _ELF_DEFINE_RELOC(R_PPC_SDAREL16, 32) \ _ELF_DEFINE_RELOC(R_PPC_SECTOFF, 33) \ @@ -1926,7 +2048,7 @@ _ELF_DEFINE_RELOC(R_RISCV_SUB32, 39) \ _ELF_DEFINE_RELOC(R_RISCV_SUB64, 40) \ _ELF_DEFINE_RELOC(R_RISCV_GNU_VTINHERIT, 41) \ _ELF_DEFINE_RELOC(R_RISCV_GNU_VTENTRY, 42) \ -_ELF_DEFINE_RELOC(R_RISCV_ALIGN 43) \ +_ELF_DEFINE_RELOC(R_RISCV_ALIGN, 43) \ _ELF_DEFINE_RELOC(R_RISCV_RVC_BRANCH, 44) \ _ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45) @@ -2042,6 +2164,7 @@ _ELF_DEFINE_IA64_RELOCATIONS() \ _ELF_DEFINE_MIPS_RELOCATIONS() \ _ELF_DEFINE_PPC32_RELOCATIONS() \ _ELF_DEFINE_PPC64_RELOCATIONS() \ +_ELF_DEFINE_RISCV_RELOCATIONS() \ _ELF_DEFINE_SPARC_RELOCATIONS() \ _ELF_DEFINE_X86_64_RELOCATIONS() Modified: vendor/elftoolchain/dist/common/native-elf-format ============================================================================== --- vendor/elftoolchain/dist/common/native-elf-format Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/common/native-elf-format Wed Feb 10 19:39:36 2016 (r295484) @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: native-elf-format 3186 2015-04-16 22:16:40Z emaste $ +# $Id: native-elf-format 3293 2016-01-07 19:26:27Z emaste $ # # Find the native ELF format for a host platform by compiling a # test object and examining the resulting object. @@ -33,6 +33,8 @@ $1 ~ "Data:" { $1 ~ "Machine:" { if (match($0, "Intel.*386")) { elfarch = "EM_386"; + } else if (match($0, "MIPS")) { + elfarch = "EM_MIPS"; } else if (match($0, ".*[xX]86-64")) { elfarch = "EM_X86_64"; } else { Modified: vendor/elftoolchain/dist/cxxfilt/cxxfilt.c ============================================================================== --- vendor/elftoolchain/dist/cxxfilt/cxxfilt.c Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/cxxfilt/cxxfilt.c Wed Feb 10 19:39:36 2016 (r295484) @@ -35,7 +35,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: cxxfilt.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: cxxfilt.c 3356 2016-01-22 22:31:38Z jkoshy $"); #define STRBUFSZ 8192 @@ -112,11 +112,11 @@ find_format(const char *fstr) } static char * -demangle(char *name, int strict, int *pos) +demangle(char *name, int strict, size_t *pos) { static char dem[STRBUFSZ]; char nb[STRBUFSZ]; - int p, t; + size_t p, t; if (stripus && *name == '_') { strncpy(nb, name + 1, sizeof(nb) - 1); @@ -128,10 +128,10 @@ demangle(char *name, int strict, int *po nb[sizeof(nb) - 1] = '\0'; p = strlen(nb); - if (p <= 0) + if (p == 0) return NULL; - while (elftc_demangle(nb, dem, sizeof(dem), format) < 0) { + while (elftc_demangle(nb, dem, sizeof(dem), (unsigned) format) < 0) { if (!strict && p > 1) { nb[--p] = '\0'; continue; @@ -149,7 +149,8 @@ int main(int argc, char **argv) { char *dem, buf[STRBUFSZ]; - int c, i, p, s, opt; + size_t i, p, s; + int c, n, opt; while ((opt = getopt_long(argc, argv, "_nps:V", longopts, NULL)) != -1) { @@ -182,9 +183,9 @@ main(int argc, char **argv) argc -= optind; if (*argv != NULL) { - for (i = 0; i < argc; i++) { - if ((dem = demangle(argv[i], 1, NULL)) == NULL) - fprintf(stderr, "Failed: %s\n", argv[i]); + for (n = 0; n < argc; n++) { + if ((dem = demangle(argv[n], 1, NULL)) == NULL) + fprintf(stderr, "Failed: %s\n", argv[n]); else printf("%s\n", dem); } @@ -213,7 +214,7 @@ main(int argc, char **argv) if ((size_t) p >= sizeof(buf) - 1) warnx("buffer overflowed"); else - buf[p++] = c; + buf[p++] = (char) c; } } Modified: vendor/elftoolchain/dist/elfcopy/Makefile ============================================================================== --- vendor/elftoolchain/dist/elfcopy/Makefile Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/elfcopy/Makefile Wed Feb 10 19:39:36 2016 (r295484) @@ -1,10 +1,13 @@ -# $Id: Makefile 2290 2011-12-04 07:20:46Z jkoshy $ +# $Id: Makefile 3381 2016-01-30 19:39:47Z jkoshy $ TOP= .. +.include "${TOP}/mk/elftoolchain.components.mk" + PROG= elfcopy -SRCS= archive.c ascii.c binary.c main.c sections.c segments.c symbols.c +SRCS= archive.c ascii.c binary.c main.c sections.c segments.c \ + symbols.c WARNS?= 5 @@ -15,14 +18,24 @@ LDADD= -lelf -lelftc LDADD+= -larchive .endif +.if defined(WITH_PE) && ${WITH_PE:tl} == "yes" +SRCS+= pe.c +CFLAGS+= -DWITH_PE=1 + +DPADD+= ${LIBPE} +LDADD+= -lpe +.endif + MAN= elfcopy.1 mcs.1 strip.1 +MLINKS= elfcopy.1 objcopy.1 NO_SHARED?= yes -LINKS= ${BINDIR}/elfcopy ${BINDIR}/strip \ - ${BINDIR}/elfcopy ${BINDIR}/mcs +LINKS= ${BINDIR}/elfcopy ${BINDIR}/mcs \ + ${BINDIR}/elfcopy ${BINDIR}/objcopy \ + ${BINDIR}/elfcopy ${BINDIR}/strip -EXTRA_TARGETS= strip mcs +EXTRA_TARGETS= mcs strip objcopy CLEANFILES+= ${EXTRA_TARGETS} Modified: vendor/elftoolchain/dist/elfcopy/archive.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/archive.c Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/elfcopy/archive.c Wed Feb 10 19:39:36 2016 (r295484) @@ -38,7 +38,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: archive.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: archive.c 3287 2015-12-31 16:58:48Z emaste $"); #define _ARMAG_LEN 8 /* length of ar magic string */ #define _ARHDR_LEN 60 /* length of ar header */ @@ -382,7 +382,7 @@ ac_read_objs(struct elfcopy *ecp, int if if (lseek(ifd, 0, SEEK_SET) == -1) err(EXIT_FAILURE, "lseek failed"); if ((a = archive_read_new()) == NULL) - errx(EXIT_FAILURE, "%s", archive_error_string(a)); + errx(EXIT_FAILURE, "archive_read_new failed"); archive_read_support_format_ar(a); AC(archive_read_open_fd(a, ifd, 10240)); for(;;) { @@ -443,7 +443,7 @@ ac_write_objs(struct elfcopy *ecp, int o int nr; if ((a = archive_write_new()) == NULL) - errx(EXIT_FAILURE, "%s", archive_error_string(a)); + errx(EXIT_FAILURE, "archive_write_new failed"); archive_write_set_format_ar_svr4(a); AC(archive_write_open_fd(a, ofd)); Modified: vendor/elftoolchain/dist/elfcopy/elfcopy.1 ============================================================================== --- vendor/elftoolchain/dist/elfcopy/elfcopy.1 Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/elfcopy/elfcopy.1 Wed Feb 10 19:39:36 2016 (r295484) @@ -21,13 +21,14 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elfcopy.1 3266 2015-12-07 15:38:26Z emaste $ +.\" $Id: elfcopy.1 3381 2016-01-30 19:39:47Z jkoshy $ .\" -.Dd December 7, 2015 +.Dd January 29, 2016 .Os .Dt ELFCOPY 1 .Sh NAME -.Nm elfcopy +.Nm elfcopy , +.Nm objcopy .Nd copy and translate object files .Sh SYNOPSIS .Nm @@ -85,7 +86,7 @@ .Sh DESCRIPTION The .Nm -utility copies the content of the ELF object named by argument +utility copies the content of the binary object named by argument .Ar infile to that named by argument .Ar outfile , @@ -121,6 +122,10 @@ to the output. .It Fl O Ar objformat | Fl -output-target= Ns Ar objformat Write the output file using the object format specified in argument .Ar objformat . +The argument +.Ar objformat +should be one of the target names recognized by +.Xr elftc_bfd_find_target 3 . .It Fl R Ar sectionname | Fl -remove-section= Ns Ar sectionname Remove any section with name .Ar sectionname @@ -330,8 +335,14 @@ Do not copy symbols that are not needed .Xr mcs 1 , .Xr strip 1 , .Xr elf 3 , +.Xr elftc_bfd_find_target 3 , .Xr ar 5 , .Xr elf 5 +.Sh COMPATIBILITY +The +.Nm +utility is expected to be option compatible with GNU +.Nm objcopy . .Sh HISTORY .Nm has been implemented by Modified: vendor/elftoolchain/dist/elfcopy/elfcopy.h ============================================================================== --- vendor/elftoolchain/dist/elfcopy/elfcopy.h Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/elfcopy/elfcopy.h Wed Feb 10 19:39:36 2016 (r295484) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfcopy.h 3221 2015-05-24 23:42:43Z kaiwang27 $ + * $Id: elfcopy.h 3310 2016-01-10 09:10:54Z kaiwang27 $ */ #include <sys/queue.h> @@ -287,6 +287,7 @@ struct section *create_external_section( int _loadable); void create_external_symtab(struct elfcopy *_ecp); void create_ihex(int _ifd, int _ofd); +void create_pe(struct elfcopy *_ecp, int _ifd, int _ofd); void create_scn(struct elfcopy *_ecp); void create_srec(struct elfcopy *_ecp, int _ifd, int _ofd, const char *_ofn); void create_symtab(struct elfcopy *_ecp); Modified: vendor/elftoolchain/dist/elfcopy/main.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/main.c Wed Feb 10 19:01:26 2016 (r295483) +++ vendor/elftoolchain/dist/elfcopy/main.c Wed Feb 10 19:39:36 2016 (r295484) @@ -39,7 +39,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: main.c 3268 2015-12-07 20:30:55Z emaste $"); +ELFTC_VCSID("$Id: main.c 3381 2016-01-30 19:39:47Z jkoshy $"); enum options { @@ -722,6 +722,15 @@ create_file(struct elfcopy *ecp, const c create_srec(ecp, ofd, ofd0, dst != NULL ? dst : src); break; + case ETF_PE: + case ETF_EFI: +#if WITH_PE + create_pe(ecp, ofd, ofd0); +#else + errx(EXIT_FAILURE, "PE/EFI support not enabled" + " at compile time"); +#endif + break; default: errx(EXIT_FAILURE, "Internal: unsupported" " output flavour %d", ecp->oec); @@ -1345,6 +1354,9 @@ set_output_target(struct elfcopy *ecp, c ecp->oed = elftc_bfd_target_byteorder(tgt); ecp->oem = elftc_bfd_target_machine(tgt); } + if (ecp->otf == ETF_EFI || ecp->otf == ETF_PE) + ecp->oem = elftc_bfd_target_machine(tgt); + ecp->otgt = target_name; } @@ -1366,7 +1378,7 @@ set_osabi(struct elfcopy *ecp, const cha #define ELFCOPY_USAGE_MESSAGE "\ Usage: %s [options] infile [outfile]\n\ - Transform an ELF object.\n\n\ + Transform object files.\n\n\ Options:\n\ -d | -g | --strip-debug Remove debugging information from the output.\n\ -j SECTION | --only-section=SECTION\n\ @@ -1382,6 +1394,8 @@ Usage: %s [options] infile [outfile]\n\ -N SYM | --strip-symbol=SYM Do not copy symbol SYM to the output.\n\ -O FORMAT | --output-target=FORMAT\n\ Specify object format for the output file.\n\ + FORMAT should be a target name understood by\n\ + elftc_bfd_find_target(3).\n\ -R NAME | --remove-section=NAME\n\ Remove the named section.\n\ -S | --strip-all Remove all symbol and relocation information\n\ Added: vendor/elftoolchain/dist/elfcopy/pe.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/elftoolchain/dist/elfcopy/pe.c Wed Feb 10 19:39:36 2016 (r295484) @@ -0,0 +1,233 @@ +/*- + * Copyright (c) 2016 Kai Wang + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/param.h> +#include <err.h> +#include <gelf.h> +#include <libpe.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include "elfcopy.h" + +ELFTC_VCSID("$Id: pe.c 3312 2016-01-10 09:23:51Z kaiwang27 $"); + +/* Convert ELF object to Portable Executable (PE). */ +void +create_pe(struct elfcopy *ecp, int ifd, int ofd) +{ + Elf *e; + Elf_Scn *scn; + Elf_Data *d; + GElf_Ehdr eh; + GElf_Shdr sh; + PE *pe; + PE_Scn *ps; + PE_SecHdr psh; + PE_CoffHdr pch; + PE_OptHdr poh; + PE_Object po; + PE_Buffer *pb; + const char *name; + size_t indx; + int elferr, i; + + if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64) + po = PE_O_PE32P; + else + po = PE_O_PE32; + + if ((e = elf_begin(ifd, ELF_C_READ, NULL)) == NULL) + errx(EXIT_FAILURE, "elf_begin() failed: %s", + elf_errmsg(-1)); + + if (gelf_getehdr(e, &eh) == NULL) + errx(EXIT_FAILURE, "gelf_getehdr() failed: %s", + elf_errmsg(-1)); + + if (elf_getshstrndx(ecp->ein, &indx) == 0) + errx(EXIT_FAILURE, "elf_getshstrndx() failed: %s", + elf_errmsg(-1)); + + if ((pe = pe_init(ofd, PE_C_WRITE, po)) == NULL) + err(EXIT_FAILURE, "pe_init() failed"); + + /* Setup PE COFF header. */ + memset(&pch, 0, sizeof(pch)); + switch (ecp->oem) { + case EM_386: + pch.ch_machine = IMAGE_FILE_MACHINE_I386; + break; + case EM_X86_64: + pch.ch_machine = IMAGE_FILE_MACHINE_AMD64; + break; + default: + pch.ch_machine = IMAGE_FILE_MACHINE_UNKNOWN; + break; + } + pch.ch_timestamp = (uint32_t) time(NULL); + if (pe_update_coff_header(pe, &pch) < 0) + err(EXIT_FAILURE, "pe_update_coff_header() failed"); + + /* Setup PE optional header. */ + memset(&poh, 0, sizeof(poh)); + if (ecp->otf == ETF_EFI) + poh.oh_subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION; + poh.oh_entry = (uint32_t) eh.e_entry; + + /* + * Default section alignment and file alignment. (Here the + * section alignment is set to the default page size of the + * archs supported. We should use different section alignment + * for some arch. (e.g. IA64) + */ + poh.oh_secalign = 0x1000; + poh.oh_filealign = 0x200; + + /* Copy sections. */ + scn = NULL; + while ((scn = elf_nextscn(e, scn)) != NULL) { + + /* + * Read in ELF section. + */ + + if (gelf_getshdr(scn, &sh) == NULL) { + warnx("gelf_getshdr() failed: %s", elf_errmsg(-1)); + (void) elf_errno(); + continue; + } + if ((name = elf_strptr(ecp->ein, indx, sh.sh_name)) == + NULL) { + warnx("elf_strptr() failed: %s", elf_errmsg(-1)); + (void) elf_errno(); + continue; + } + + /* Skip sections unneeded. */ + if (strcmp(name, ".shstrtab") == 0 || + strcmp(name, ".symtab") == 0 || + strcmp(name, ".strtab") == 0) + continue; + + if ((d = elf_getdata(scn, NULL)) == NULL) { + warnx("elf_getdata() failed: %s", elf_errmsg(-1)); + (void) elf_errno(); + continue; + } + + if (strcmp(name, ".text") == 0) { + poh.oh_textbase = (uint32_t) sh.sh_addr; + poh.oh_textsize = (uint32_t) roundup(sh.sh_size, + poh.oh_filealign); + } else { + if (po == PE_O_PE32 && strcmp(name, ".data") == 0) + poh.oh_database = sh.sh_addr; + if (sh.sh_type == SHT_NOBITS) + poh.oh_bsssize += (uint32_t) + roundup(sh.sh_size, poh.oh_filealign); + else if (sh.sh_flags & SHF_ALLOC) + poh.oh_datasize += (uint32_t) + roundup(sh.sh_size, poh.oh_filealign); + } + + /* + * Create PE/COFF section. + */ + + if ((ps = pe_newscn(pe)) == NULL) { + warn("pe_newscn() failed"); + continue; + } + + /* + * Setup PE/COFF section header. The section name is not + * NUL-terminated if its length happens to be 8. Long + * section name should be truncated for PE image according + * to the PE/COFF specification. + */ + memset(&psh, 0, sizeof(psh)); + strncpy(psh.sh_name, name, sizeof(psh.sh_name)); + psh.sh_addr = sh.sh_addr; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602101939.u1AJdaR7063441>