Date: Sat, 29 Jun 2019 15:27:19 +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: r349544 - in vendor/elftoolchain/dist: . addr2line common documentation/libelf-by-example elfcopy elfdump libdwarf libelf libelftc mk nm readelf test/ar/tc/add-nonexistent/out test/libe... Message-ID: <201906291527.x5TFRJDJ098270@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Sat Jun 29 15:27:18 2019 New Revision: 349544 URL: https://svnweb.freebsd.org/changeset/base/349544 Log: Import ELF Tool Chain snapshot at r3769 From https://svn.code.sf.net/p/elftoolchain/code/ Added: vendor/elftoolchain/dist/.cirrus.yml vendor/elftoolchain/dist/libelf/os.Linux.mk (contents, props changed) vendor/elftoolchain/dist/test/ar/tc/add-nonexistent/out/archive.a (contents, props changed) vendor/elftoolchain/dist/test/libelf/tset/common/ehdr-malformed-1.yaml vendor/elftoolchain/dist/test/libelf/tset/elf_begin/entry-too-large.ar (contents, props changed) vendor/elftoolchain/dist/test/libelf/tset/elf_rand/ vendor/elftoolchain/dist/test/libelf/tset/elf_rand/Makefile (contents, props changed) vendor/elftoolchain/dist/test/libelf/tset/elf_rand/empty-file.ar (contents, props changed) vendor/elftoolchain/dist/test/libelf/tset/elf_rand/missing-file.ar (contents, props changed) vendor/elftoolchain/dist/test/libelf/tset/elf_rand/rand.m4 vendor/elftoolchain/dist/test/libtest/driver/driver.c (contents, props changed) vendor/elftoolchain/dist/test/libtest/driver/driver.h (contents, props changed) vendor/elftoolchain/dist/test/libtest/driver/driver_main.c (contents, props changed) vendor/elftoolchain/dist/test/libtest/driver/test_driver.1 (contents, props changed) vendor/elftoolchain/dist/test/libtest/lib/test_case.h (contents, props changed) Deleted: vendor/elftoolchain/dist/test/libtest/driver/test_main.c vendor/elftoolchain/dist/test/libtest/lib/test_runner.c vendor/elftoolchain/dist/test/libtest/lib/test_runner.h Modified: vendor/elftoolchain/dist/README.rst vendor/elftoolchain/dist/addr2line/addr2line.c vendor/elftoolchain/dist/common/elfdefinitions.h vendor/elftoolchain/dist/common/native-elf-format vendor/elftoolchain/dist/documentation/libelf-by-example/libelf-by-example.tex vendor/elftoolchain/dist/documentation/libelf-by-example/prog3.txt vendor/elftoolchain/dist/documentation/libelf-by-example/prog4.txt vendor/elftoolchain/dist/documentation/libelf-by-example/prog6.txt vendor/elftoolchain/dist/elfcopy/ascii.c vendor/elftoolchain/dist/elfcopy/binary.c vendor/elftoolchain/dist/elfcopy/elfcopy.h vendor/elftoolchain/dist/elfcopy/main.c vendor/elftoolchain/dist/elfcopy/sections.c vendor/elftoolchain/dist/elfdump/elfdump.c vendor/elftoolchain/dist/libdwarf/dwarf.h vendor/elftoolchain/dist/libdwarf/dwarf_dump.c vendor/elftoolchain/dist/libdwarf/libdwarf_attr.c vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c vendor/elftoolchain/dist/libelf/_libelf.h vendor/elftoolchain/dist/libelf/_libelf_config.h vendor/elftoolchain/dist/libelf/elf.3 vendor/elftoolchain/dist/libelf/elf_data.c vendor/elftoolchain/dist/libelf/elf_end.c vendor/elftoolchain/dist/libelf/elf_flagdata.3 vendor/elftoolchain/dist/libelf/elf_getdata.3 vendor/elftoolchain/dist/libelf/elf_getident.c vendor/elftoolchain/dist/libelf/elf_next.3 vendor/elftoolchain/dist/libelf/elf_next.c vendor/elftoolchain/dist/libelf/elf_open.3 vendor/elftoolchain/dist/libelf/elf_rand.c vendor/elftoolchain/dist/libelf/elf_rawfile.c vendor/elftoolchain/dist/libelf/elf_scn.c vendor/elftoolchain/dist/libelf/elf_update.3 vendor/elftoolchain/dist/libelf/elf_update.c vendor/elftoolchain/dist/libelf/gelf.3 vendor/elftoolchain/dist/libelf/gelf_cap.c vendor/elftoolchain/dist/libelf/gelf_dyn.c vendor/elftoolchain/dist/libelf/gelf_getcap.3 vendor/elftoolchain/dist/libelf/gelf_getdyn.3 vendor/elftoolchain/dist/libelf/gelf_getmove.3 vendor/elftoolchain/dist/libelf/gelf_getrel.3 vendor/elftoolchain/dist/libelf/gelf_getrela.3 vendor/elftoolchain/dist/libelf/gelf_getsym.3 vendor/elftoolchain/dist/libelf/gelf_getsyminfo.3 vendor/elftoolchain/dist/libelf/gelf_getsymshndx.3 vendor/elftoolchain/dist/libelf/gelf_move.c vendor/elftoolchain/dist/libelf/gelf_newehdr.3 vendor/elftoolchain/dist/libelf/gelf_newphdr.3 vendor/elftoolchain/dist/libelf/gelf_rel.c vendor/elftoolchain/dist/libelf/gelf_rela.c vendor/elftoolchain/dist/libelf/gelf_sym.c vendor/elftoolchain/dist/libelf/gelf_syminfo.c vendor/elftoolchain/dist/libelf/gelf_symshndx.c vendor/elftoolchain/dist/libelf/libelf_allocate.c vendor/elftoolchain/dist/libelf/libelf_ar.c vendor/elftoolchain/dist/libelf/libelf_convert.m4 vendor/elftoolchain/dist/libelf/libelf_data.c vendor/elftoolchain/dist/libelf/libelf_ehdr.c vendor/elftoolchain/dist/libelf/libelf_extended.c vendor/elftoolchain/dist/libelf/libelf_memory.c vendor/elftoolchain/dist/libelf/libelf_msize.m4 vendor/elftoolchain/dist/libelf/libelf_phdr.c vendor/elftoolchain/dist/libelf/libelf_xlate.c vendor/elftoolchain/dist/libelftc/elftc_bfd_find_target.3 vendor/elftoolchain/dist/libelftc/elftc_reloc_type_str.c vendor/elftoolchain/dist/libelftc/elftc_string_table.c vendor/elftoolchain/dist/libelftc/elftc_string_table_create.3 vendor/elftoolchain/dist/libelftc/libelftc.h vendor/elftoolchain/dist/libelftc/libelftc_bfdtarget.c vendor/elftoolchain/dist/libelftc/make-toolchain-version vendor/elftoolchain/dist/mk/elftoolchain.subdir.mk vendor/elftoolchain/dist/mk/elftoolchain.test.mk vendor/elftoolchain/dist/nm/nm.c vendor/elftoolchain/dist/readelf/readelf.1 vendor/elftoolchain/dist/readelf/readelf.c vendor/elftoolchain/dist/test/libelf/tset/Makefile vendor/elftoolchain/dist/test/libelf/tset/bin/elfc vendor/elftoolchain/dist/test/libelf/tset/common/Makefile vendor/elftoolchain/dist/test/libelf/tset/common/ehdr_template.m4 vendor/elftoolchain/dist/test/libelf/tset/elf32_getehdr/Makefile vendor/elftoolchain/dist/test/libelf/tset/elf32_newehdr/Makefile vendor/elftoolchain/dist/test/libelf/tset/elf64_getehdr/Makefile vendor/elftoolchain/dist/test/libelf/tset/elf64_newehdr/Makefile vendor/elftoolchain/dist/test/libelf/tset/elf_begin/Makefile vendor/elftoolchain/dist/test/libelf/tset/elf_begin/begin.m4 vendor/elftoolchain/dist/test/libelf/tset/elf_getdata/getdata.m4 vendor/elftoolchain/dist/test/libtest/Makefile vendor/elftoolchain/dist/test/libtest/README.rst vendor/elftoolchain/dist/test/libtest/bin/make-test-scaffolding vendor/elftoolchain/dist/test/libtest/driver/Makefile vendor/elftoolchain/dist/test/libtest/examples/minimal_example.c vendor/elftoolchain/dist/test/libtest/examples/simple_example.c vendor/elftoolchain/dist/test/libtest/lib/Makefile vendor/elftoolchain/dist/test/libtest/lib/test.3 vendor/elftoolchain/dist/test/libtest/lib/test.h vendor/elftoolchain/dist/test/nm/ts/Makefile.tset vendor/elftoolchain/dist/test/tet/patches/configure.patch Added: vendor/elftoolchain/dist/.cirrus.yml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/elftoolchain/dist/.cirrus.yml Sat Jun 29 15:27:18 2019 (r349544) @@ -0,0 +1,22 @@ +freebsd_11_task: + freebsd_instance: + image: freebsd-11-2-release-amd64 + install_script: pkg install -y git py27-yaml + script: + - fetch http://tetworks.opengroup.org/downloads/38/software/Sources/3.8/tet3.8-src.tar.gz + - tar -x -C test/tet -f tet3.8-src.tar.gz + - make + +debian_stable_task: + container: + image: debian:stable + setup_script: + - apt-get update + - apt-get install -y + binutils bison bmake curl flex g++ gcc git + libarchive-dev libbsd-dev libc6-dev libexpat1-dev lsb-release + m4 perl python-yaml sharutils zlib1g-dev + script: + - curl -O http://tetworks.opengroup.org/downloads/38/software/Sources/3.8/tet3.8-src.tar.gz + - tar -x -C test/tet -z -f tet3.8-src.tar.gz + - bmake Modified: vendor/elftoolchain/dist/README.rst ============================================================================== --- vendor/elftoolchain/dist/README.rst Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/README.rst Sat Jun 29 15:27:18 2019 (r349544) @@ -62,12 +62,12 @@ The project uses subversion_ for its version control s The subversion branch for the current set of sources may be accessed at the following URL:: - https://elftoolchain.svn.sourceforge.net/svnroot/elftoolchain/trunk + https://sourceforge.net/p/elftoolchain/code/HEAD/tree/trunk/ The project's source tree may be checked out from its repository by using the ``svn checkout`` command:: - % svn checkout https://elftoolchain.svn.sourceforge.net/svnroot/elftoolchain/trunk + % svn checkout https://svn.code.sf.net/p/elftoolchain/code/trunk Checked-out sources may be kept upto-date by running ``svn update`` inside the source directory:: @@ -105,10 +105,10 @@ The project's developers may be contacted using the ma Reporting Bugs -------------- -Please use our `Trac instance`_ for viewing existing bug reports and +Please use our `bug tracker`_ for viewing existing bug reports and for submitting new bug reports. -.. _`Trac instance`: http://sourceforge.net/apps/trac/elftoolchain/report +.. _`bug tracker`: https://sourceforge.net/p/elftoolchain/tickets/ Additional Information @@ -119,7 +119,7 @@ website`_. .. _project website: http://elftoolchain.sourceforge.net/ -.. $Id: README.rst 3656 2018-12-26 09:46:24Z jkoshy $ +.. $Id: README.rst 3677 2019-02-11 09:37:09Z jkoshy $ .. Local Variables: .. mode: rst Modified: vendor/elftoolchain/dist/addr2line/addr2line.c ============================================================================== --- vendor/elftoolchain/dist/addr2line/addr2line.c Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/addr2line/addr2line.c Sat Jun 29 15:27:18 2019 (r349544) @@ -40,7 +40,7 @@ #include "uthash.h" #include "_elftc.h" -ELFTC_VCSID("$Id: addr2line.c 3544 2017-06-05 14:51:44Z emaste $"); +ELFTC_VCSID("$Id: addr2line.c 3499 2016-11-25 16:06:29Z emaste $"); struct Func { char *name; Modified: vendor/elftoolchain/dist/common/elfdefinitions.h ============================================================================== --- vendor/elftoolchain/dist/common/elfdefinitions.h Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/common/elfdefinitions.h Sat Jun 29 15:27:18 2019 (r349544) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfdefinitions.h 3515 2017-01-24 22:04:22Z emaste $ + * $Id: elfdefinitions.h 3769 2019-06-29 15:15:02Z emaste $ */ /* @@ -72,7 +72,39 @@ _ELF_DEFINE_DF(DF_TEXTREL, 0x4, \ _ELF_DEFINE_DF(DF_BIND_NOW, 0x8, \ "process relocation entries at load time") \ _ELF_DEFINE_DF(DF_STATIC_TLS, 0x10, \ - "uses static thread-local storage") + "uses static thread-local storage") \ +_ELF_DEFINE_DF(DF_1_BIND_NOW, 0x1, \ + "process relocation entries at load time") \ +_ELF_DEFINE_DF(DF_1_GLOBAL, 0x2, \ + "unused") \ +_ELF_DEFINE_DF(DF_1_GROUP, 0x4, \ + "object is a member of a group") \ +_ELF_DEFINE_DF(DF_1_NODELETE, 0x8, \ + "object cannot be deleted from a process") \ +_ELF_DEFINE_DF(DF_1_LOADFLTR, 0x10, \ + "immediate load filtees") \ +_ELF_DEFINE_DF(DF_1_INITFIRST, 0x20, \ + "initialize object first") \ +_ELF_DEFINE_DF(DF_1_NOOPEN, 0x40, \ + "disallow dlopen()") \ +_ELF_DEFINE_DF(DF_1_ORIGIN, 0x80, \ + "object being loaded may refer to $ORIGIN") \ +_ELF_DEFINE_DF(DF_1_DIRECT, 0x100, \ + "direct bindings enabled") \ +_ELF_DEFINE_DF(DF_1_INTERPOSE, 0x400, \ + "object is interposer") \ +_ELF_DEFINE_DF(DF_1_NODEFLIB, 0x800, \ + "ignore default library search path") \ +_ELF_DEFINE_DF(DF_1_NODUMP, 0x1000, \ + "disallow dldump()") \ +_ELF_DEFINE_DF(DF_1_CONFALT, 0x2000, \ + "object is a configuration alternative") \ +_ELF_DEFINE_DF(DF_1_ENDFILTEE, 0x4000, \ + "filtee terminates filter search") \ +_ELF_DEFINE_DF(DF_1_DISPRELDNE, 0x8000, \ + "displacement relocation done") \ +_ELF_DEFINE_DF(DF_1_DISPRELPND, 0x10000, \ + "displacement relocation pending") #undef _ELF_DEFINE_DF #define _ELF_DEFINE_DF(N, V, DESCR) N = V , enum { @@ -2448,7 +2480,10 @@ _ELF_DEFINE_NT(NT_PSTATUS, 10, "Linux process status") _ELF_DEFINE_NT(NT_FPREGS, 12, "Linux floating point regset") \ _ELF_DEFINE_NT(NT_PSINFO, 13, "Linux process information") \ _ELF_DEFINE_NT(NT_LWPSTATUS, 16, "Linux lwpstatus_t type") \ -_ELF_DEFINE_NT(NT_LWPSINFO, 17, "Linux lwpinfo_t type") +_ELF_DEFINE_NT(NT_LWPSINFO, 17, "Linux lwpinfo_t type") \ +_ELF_DEFINE_NT(NT_FREEBSD_NOINIT_TAG, 2, "FreeBSD no .init tag") \ +_ELF_DEFINE_NT(NT_FREEBSD_ARCH_TAG, 3, "FreeBSD arch tag") \ +_ELF_DEFINE_NT(NT_FREEBSD_FEATURE_CTL, 4, "FreeBSD feature control") #undef _ELF_DEFINE_NT #define _ELF_DEFINE_NT(N, V, DESCR) N = V , @@ -2806,7 +2841,8 @@ typedef struct { #define ELF64_R_SYM(I) ((I) >> 32) #define ELF64_R_TYPE(I) ((I) & 0xFFFFFFFFUL) -#define ELF64_R_INFO(S,T) (((S) << 32) + ((T) & 0xFFFFFFFFUL)) +#define ELF64_R_INFO(S,T) \ + (((Elf64_Xword) (S) << 32) + ((T) & 0xFFFFFFFFUL)) /* * Symbol versioning structures. Modified: vendor/elftoolchain/dist/common/native-elf-format ============================================================================== --- vendor/elftoolchain/dist/common/native-elf-format Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/common/native-elf-format Sat Jun 29 15:27:18 2019 (r349544) @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: native-elf-format 3650 2018-11-25 12:06:28Z jkoshy $ +# $Id: native-elf-format 3735 2019-04-25 19:44:47Z jkoshy $ # # Find the native ELF format for a host platform by compiling a # test object and examining the resulting object. @@ -37,6 +37,8 @@ $1 ~ "Machine:" { elfarch = "EM_MIPS"; } else if (match($0, ".*[xX]86[-_]64")) { elfarch = "EM_X86_64"; + } else if (match($0, "PowerPC64")) { + elfarch = "EM_PPC64"; } else { elfarch = "unknown"; } Modified: vendor/elftoolchain/dist/documentation/libelf-by-example/libelf-by-example.tex ============================================================================== --- vendor/elftoolchain/dist/documentation/libelf-by-example/libelf-by-example.tex Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/documentation/libelf-by-example/libelf-by-example.tex Sat Jun 29 15:27:18 2019 (r349544) @@ -24,7 +24,7 @@ % out of the use of this software, even if advised of the possibility of % such damage. % -% $Id: libelf-by-example.tex 2457 2012-03-09 14:38:10Z jkoshy $ +% $Id: libelf-by-example.tex 3699 2019-02-28 06:34:53Z jkoshy $ % \documentclass[a4paper,pdftex]{book} @@ -2700,6 +2700,12 @@ typedef struct { \emph{parent} archive descriptor (referenced by variable \parameter{ar} in this example) to return the next archive member on the next call to function \function{elf\_begin}. + + The \function{elf\_next} function ordinarily returns the value + \constant{ELF\_C\_READ}, allowing the traversal of the archive to + continue normally. In the event of an error the function + returns the value \constant{ELF\_C\_NULL}, which causes the function + \function{elf\_begin} to stop archive traversal. \item[\coref{6}] It is good programming practice to call \function{elf\_end} on descriptors that are no longer needed. \end{description} Modified: vendor/elftoolchain/dist/documentation/libelf-by-example/prog3.txt ============================================================================== --- vendor/elftoolchain/dist/documentation/libelf-by-example/prog3.txt Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/documentation/libelf-by-example/prog3.txt Sat Jun 29 15:27:18 2019 (r349544) @@ -1,7 +1,7 @@ /* * Print the ELF Program Header Table in an ELF object. * - * $Id: prog3.txt 2133 2011-11-10 08:28:22Z jkoshy $ + * $Id: prog3.txt 3686 2019-02-22 07:54:47Z jkoshy $ */ #include <err.h> @@ -11,7 +11,6 @@ #include <stdint.h> #include <stdlib.h> #include <unistd.h> -#include <vis.h> void print_ptype(size_t pt) @\co{7}@ Modified: vendor/elftoolchain/dist/documentation/libelf-by-example/prog4.txt ============================================================================== --- vendor/elftoolchain/dist/documentation/libelf-by-example/prog4.txt Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/documentation/libelf-by-example/prog4.txt Sat Jun 29 15:27:18 2019 (r349544) @@ -1,7 +1,7 @@ /* * Print the names of ELF sections. * - * $Id: prog4.txt 2133 2011-11-10 08:28:22Z jkoshy $ + * $Id: prog4.txt 3687 2019-02-22 07:55:09Z jkoshy $ */ #include <err.h> @@ -18,11 +18,11 @@ main(int argc, char **argv) { int fd; Elf *e; - char *name, *p, pc[4*sizeof(char)]; Elf_Scn *scn; Elf_Data *data; GElf_Shdr shdr; size_t n, shstrndx, sz; + char *name, *p, pc[(4 * sizeof(char)) + 1]; if (argc != 2) errx(EXIT_FAILURE, "usage: %s file-name", argv[0]); Modified: vendor/elftoolchain/dist/documentation/libelf-by-example/prog6.txt ============================================================================== --- vendor/elftoolchain/dist/documentation/libelf-by-example/prog6.txt Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/documentation/libelf-by-example/prog6.txt Sat Jun 29 15:27:18 2019 (r349544) @@ -1,7 +1,7 @@ /* * Iterate through an ar(1) archive. * - * $Id: prog6.txt 2135 2011-11-10 08:59:47Z jkoshy $ + * $Id: prog6.txt 3699 2019-02-28 06:34:53Z jkoshy $ */ #include <err.h> @@ -16,6 +16,7 @@ main(int argc, char **argv) { int fd; Elf *ar, *e; + Elf_Cmd cmd; Elf_Arhdr *arh; if (argc != 2) @@ -39,7 +40,8 @@ main(int argc, char **argv) errx(EXIT_FAILURE, "%s is not an ar(1) archive.", argv[1]); - while ((e = elf_begin(fd, ELF_C_READ, ar)) != NULL) { @\co{3}@ + cmd = ELF_C_READ; + while ((e = elf_begin(fd, cmd, ar)) != NULL) { @\co{3}@ if ((arh = elf_getarhdr(e)) == NULL) @\co{4}@ errx(EXIT_FAILURE, "elf_getarhdr() failed: %s.", elf_errmsg(-1)); @@ -47,7 +49,7 @@ main(int argc, char **argv) (void) printf("%20s %zd\n", arh->ar_name, arh->ar_size); - (void) elf_next(e); @\co{5}@ + cmd = elf_next(e); @\co{5}@ (void) elf_end(e); @\co{6}@ } Modified: vendor/elftoolchain/dist/elfcopy/ascii.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/ascii.c Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/elfcopy/ascii.c Sat Jun 29 15:27:18 2019 (r349544) @@ -36,7 +36,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: ascii.c 3487 2016-08-24 18:12:08Z emaste $"); +ELFTC_VCSID("$Id: ascii.c 3757 2019-06-28 01:15:28Z emaste $"); static void append_data(struct section *s, const void *buf, size_t sz); static char hex_digit(uint8_t n); @@ -378,9 +378,6 @@ done: errx(EXIT_FAILURE, "gelf_update_ehdr() failed: %s", elf_errmsg(-1)); - /* Generate section name string table (.shstrtab). */ - set_shstrtab(ecp); - /* Update sh_name pointer for each section header entry. */ update_shdr(ecp, 0); @@ -604,9 +601,6 @@ done: if (gelf_update_ehdr(ecp->eout, &oeh) == 0) errx(EXIT_FAILURE, "gelf_update_ehdr() failed: %s", elf_errmsg(-1)); - - /* Generate section name string table (.shstrtab). */ - set_shstrtab(ecp); /* Update sh_name pointer for each section header entry. */ update_shdr(ecp, 0); Modified: vendor/elftoolchain/dist/elfcopy/binary.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/binary.c Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/elfcopy/binary.c Sat Jun 29 15:27:18 2019 (r349544) @@ -36,7 +36,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: binary.c 3611 2018-04-16 21:35:18Z jkoshy $"); +ELFTC_VCSID("$Id: binary.c 3757 2019-06-28 01:15:28Z emaste $"); /* * Convert ELF object to `binary'. Sections with SHF_ALLOC flag set @@ -250,11 +250,8 @@ create_elf_from_binary(struct elfcopy *ecp, int ifd, c errx(EXIT_FAILURE, "gelf_update_ehdr() failed: %s", elf_errmsg(-1)); - /* Generate section name string table (.shstrtab). */ - ecp->flags |= SYMTAB_EXIST; - set_shstrtab(ecp); - /* Update sh_name pointer for each section header entry. */ + ecp->flags |= SYMTAB_EXIST; update_shdr(ecp, 0); /* Properly set sh_link field of .symtab section. */ Modified: vendor/elftoolchain/dist/elfcopy/elfcopy.h ============================================================================== --- vendor/elftoolchain/dist/elfcopy/elfcopy.h Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/elfcopy/elfcopy.h Sat Jun 29 15:27:18 2019 (r349544) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfcopy.h 3615 2018-05-17 04:12:24Z kaiwang27 $ + * $Id: elfcopy.h 3757 2019-06-28 01:15:28Z emaste $ */ #include <sys/queue.h> @@ -135,9 +135,13 @@ struct section { int pseudo; int nocopy; + Elftc_String_Table *strtab; + TAILQ_ENTRY(section) sec_list; /* next section */ }; +TAILQ_HEAD(sectionlist, section); + /* Internal data structure for segments. */ struct segment { uint64_t vaddr; /* virtual addr (VMA) */ @@ -311,7 +315,6 @@ struct sec_action *lookup_sec_act(struct elfcopy *_ecp struct symop *lookup_symop_list(struct elfcopy *_ecp, const char *_name, unsigned int _op); void resync_sections(struct elfcopy *_ecp); -void set_shstrtab(struct elfcopy *_ecp); void setup_phdr(struct elfcopy *_ecp); void update_shdr(struct elfcopy *_ecp, int _update_link); Modified: vendor/elftoolchain/dist/elfcopy/main.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/main.c Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/elfcopy/main.c Sat Jun 29 15:27:18 2019 (r349544) @@ -39,7 +39,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: main.c 3577 2017-09-14 02:19:42Z emaste $"); +ELFTC_VCSID("$Id: main.c 3757 2019-06-28 01:15:28Z emaste $"); enum options { @@ -388,9 +388,6 @@ create_elf(struct elfcopy *ecp) errx(EXIT_FAILURE, "gelf_update_ehdr() failed: %s", elf_errmsg(-1)); - /* Generate section name string table (.shstrtab). */ - set_shstrtab(ecp); - /* * Second processing of output sections: Update section headers. * At this stage we set name string index, update st_link and st_info @@ -486,6 +483,9 @@ free_elf(struct elfcopy *ecp) /* Free symbol table buffers. */ free_symtab(ecp); + /* Free section name string table. */ + elftc_string_table_destroy(ecp->shstrtab->strtab); + /* Free internal section list. */ if (!TAILQ_EMPTY(&ecp->v_sec)) { TAILQ_FOREACH_SAFE(sec, &ecp->v_sec, sec_list, sec_temp) { @@ -1565,7 +1565,6 @@ main(int argc, char **argv) ecp = calloc(1, sizeof(*ecp)); if (ecp == NULL) err(EXIT_FAILURE, "calloc failed"); - memset(ecp, 0, sizeof(*ecp)); ecp->itf = ecp->otf = ETF_ELF; ecp->iec = ecp->oec = ELFCLASSNONE; Modified: vendor/elftoolchain/dist/elfcopy/sections.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/sections.c Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/elfcopy/sections.c Sat Jun 29 15:27:18 2019 (r349544) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: sections.c 3646 2018-10-27 02:25:39Z emaste $"); +ELFTC_VCSID("$Id: sections.c 3758 2019-06-28 01:16:50Z emaste $"); static void add_gnu_debuglink(struct elfcopy *ecp); static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc); @@ -42,19 +42,18 @@ static void check_section_rename(struct elfcopy *ecp, static void filter_reloc(struct elfcopy *ecp, struct section *s); static int get_section_flags(struct elfcopy *ecp, const char *name); static void insert_sections(struct elfcopy *ecp); -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); static void modify_section(struct elfcopy *ecp, struct section *s); static void pad_section(struct elfcopy *ecp, struct section *s); static void print_data(const char *d, size_t sz); static void print_section(struct section *s); static void *read_section(struct section *s, size_t *size); +static void set_shstrtab(struct elfcopy *ecp); static void update_reloc(struct elfcopy *ecp, struct section *s); static void update_section_group(struct elfcopy *ecp, struct section *s); @@ -119,21 +118,19 @@ is_remove_reloc_sec(struct elfcopy *ecp, uint32_t sh_i errx(EXIT_FAILURE, "elf_getshstrndx failed: %s", elf_errmsg(-1)); - is = NULL; - while ((is = elf_nextscn(ecp->ein, is)) != NULL) { - if (sh_info == elf_ndxscn(is)) { - if (gelf_getshdr(is, &ish) == NULL) - errx(EXIT_FAILURE, "gelf_getshdr failed: %s", - elf_errmsg(-1)); - if ((name = elf_strptr(ecp->ein, indx, ish.sh_name)) == - NULL) - errx(EXIT_FAILURE, "elf_strptr failed: %s", - elf_errmsg(-1)); - if (is_remove_section(ecp, name)) - return (1); - else - return (0); - } + is = elf_getscn(ecp->ein, sh_info); + if (is != NULL) { + if (gelf_getshdr(is, &ish) == NULL) + errx(EXIT_FAILURE, "gelf_getshdr failed: %s", + elf_errmsg(-1)); + if ((name = elf_strptr(ecp->ein, indx, ish.sh_name)) == + NULL) + errx(EXIT_FAILURE, "elf_strptr failed: %s", + elf_errmsg(-1)); + if (is_remove_section(ecp, name)) + return (1); + else + return (0); } elferr = elf_errno(); if (elferr != 0) @@ -314,18 +311,18 @@ insert_to_sec_list(struct elfcopy *ecp, struct section { struct section *s; - if (!tail) { + if (tail || TAILQ_EMPTY(&ecp->v_sec) || + TAILQ_LAST(&ecp->v_sec, sectionlist)->off <= sec->off) { + TAILQ_INSERT_TAIL(&ecp->v_sec, sec, sec_list); + } else { TAILQ_FOREACH(s, &ecp->v_sec, sec_list) { if (sec->off < s->off) { TAILQ_INSERT_BEFORE(s, sec, sec_list); - goto inc_nos; + break; } } } - TAILQ_INSERT_TAIL(&ecp->v_sec, sec, sec_list); - -inc_nos: if (sec->pseudo == 0) ecp->nos++; } @@ -711,13 +708,13 @@ filter_reloc(struct elfcopy *ecp, struct section *s) #define COPYREL(REL, SZ) do { \ if (nrels == 0) { \ if ((REL##SZ = malloc(cap * \ - sizeof(Elf##SZ##_Rel))) == NULL) \ + sizeof(*REL##SZ))) == NULL) \ err(EXIT_FAILURE, "malloc failed"); \ } \ if (nrels >= cap) { \ cap *= 2; \ if ((REL##SZ = realloc(REL##SZ, cap * \ - sizeof(Elf##SZ##_Rel))) == NULL) \ + sizeof(*REL##SZ))) == NULL) \ err(EXIT_FAILURE, "realloc failed"); \ } \ REL##SZ[nrels].r_offset = REL.r_offset; \ @@ -1335,10 +1332,9 @@ insert_sections(struct elfcopy *ecp) void add_to_shstrtab(struct elfcopy *ecp, const char *name) { - struct section *s; - s = ecp->shstrtab; - insert_to_strtab(s, name); + if (elftc_string_table_insert(ecp->shstrtab->strtab, name) == 0) + errx(EXIT_FAILURE, "elftc_string_table_insert failed"); } void @@ -1348,6 +1344,9 @@ update_shdr(struct elfcopy *ecp, int update_link) GElf_Shdr osh; int elferr; + /* Finalize the section name string table (.shstrtab). */ + set_shstrtab(ecp); + TAILQ_FOREACH(s, &ecp->v_sec, sec_list) { if (s->pseudo) continue; @@ -1357,7 +1356,8 @@ update_shdr(struct elfcopy *ecp, int update_link) elf_errmsg(-1)); /* Find section name in string table and set sh_name. */ - osh.sh_name = lookup_string(ecp->shstrtab, s->name); + osh.sh_name = elftc_string_table_lookup(ecp->shstrtab->strtab, + s->name); /* * sh_link needs to be updated, since the index of the @@ -1395,8 +1395,24 @@ update_shdr(struct elfcopy *ecp, int update_link) void init_shstrtab(struct elfcopy *ecp) { + Elf_Scn *shstrtab; + GElf_Shdr shdr; struct section *s; + size_t indx, sizehint; + if (elf_getshstrndx(ecp->ein, &indx) != 0) { + shstrtab = elf_getscn(ecp->ein, indx); + if (shstrtab == NULL) + errx(EXIT_FAILURE, "elf_getscn failed: %s", + elf_errmsg(-1)); + if (gelf_getshdr(shstrtab, &shdr) != &shdr) + errx(EXIT_FAILURE, "gelf_getshdr failed: %s", + elf_errmsg(-1)); + sizehint = shdr.sh_size; + } else { + sizehint = 0; + } + if ((ecp->shstrtab = calloc(1, sizeof(*ecp->shstrtab))) == NULL) err(EXIT_FAILURE, "calloc failed"); s = ecp->shstrtab; @@ -1407,19 +1423,22 @@ init_shstrtab(struct elfcopy *ecp) s->loadable = 0; s->type = SHT_STRTAB; s->vma = 0; + s->strtab = elftc_string_table_create(sizehint); - insert_to_strtab(s, ""); - insert_to_strtab(s, ".symtab"); - insert_to_strtab(s, ".strtab"); - insert_to_strtab(s, ".shstrtab"); + add_to_shstrtab(ecp, ""); + add_to_shstrtab(ecp, ".symtab"); + add_to_shstrtab(ecp, ".strtab"); + add_to_shstrtab(ecp, ".shstrtab"); } -void +static void set_shstrtab(struct elfcopy *ecp) { struct section *s; Elf_Data *data; GElf_Shdr sh; + const char *image; + size_t sz; s = ecp->shstrtab; @@ -1452,19 +1471,21 @@ set_shstrtab(struct elfcopy *ecp) * which are reserved for this in the beginning of shstrtab. */ if (!(ecp->flags & SYMTAB_EXIST)) { - s->sz -= sizeof(".symtab\0.strtab"); - memmove(s->buf, (char *)s->buf + sizeof(".symtab\0.strtab"), - s->sz); + elftc_string_table_remove(s->strtab, ".symtab"); + elftc_string_table_remove(s->strtab, ".strtab"); } - sh.sh_size = s->sz; + image = elftc_string_table_image(s->strtab, &sz); + s->sz = sz; + + sh.sh_size = sz; if (!gelf_update_shdr(s->os, &sh)) errx(EXIT_FAILURE, "gelf_update_shdr() failed: %s", elf_errmsg(-1)); data->d_align = 1; - data->d_buf = s->buf; - data->d_size = s->sz; + data->d_buf = (void *)(uintptr_t)image; + data->d_size = sz; data->d_off = 0; data->d_type = ELF_T_BYTE; data->d_version = EV_CURRENT; @@ -1588,73 +1609,6 @@ add_gnu_debuglink(struct elfcopy *ecp) STAILQ_INSERT_TAIL(&ecp->v_sadd, sa, sadd_list); ecp->flags |= SEC_ADD; -} - -static void -insert_to_strtab(struct section *t, const char *s) -{ - const char *r; - char *b, *c; - size_t len, slen; - int append; - - if (t->sz == 0) { - t->cap = 512; - if ((t->buf = malloc(t->cap)) == NULL) - err(EXIT_FAILURE, "malloc failed"); - } - - slen = strlen(s); - append = 0; - b = t->buf; - for (c = b; c < b + t->sz;) { - len = strlen(c); - if (!append && len >= slen) { - r = c + (len - slen); - if (strcmp(r, s) == 0) - return; - } else if (len < slen && len != 0) { - r = s + (slen - len); - if (strcmp(c, r) == 0) { - t->sz -= len + 1; - memmove(c, c + len + 1, t->sz - (c - b)); - append = 1; - continue; - } - } - c += len + 1; - } - - while (t->sz + slen + 1 >= t->cap) { - t->cap *= 2; - if ((t->buf = realloc(t->buf, t->cap)) == NULL) - err(EXIT_FAILURE, "realloc failed"); - } - b = t->buf; - strncpy(&b[t->sz], s, slen); - b[t->sz + slen] = '\0'; - t->sz += slen + 1; -} - -static int -lookup_string(struct section *t, const char *s) -{ - const char *b, *c, *r; - size_t len, slen; - - slen = strlen(s); - b = t->buf; - for (c = b; c < b + t->sz;) { - len = strlen(c); - if (len >= slen) { - r = c + (len - slen); - if (strcmp(r, s) == 0) - return (r - b); - } - c += len + 1; - } - - return (-1); } static uint32_t crctable[256] = Modified: vendor/elftoolchain/dist/elfdump/elfdump.c ============================================================================== --- vendor/elftoolchain/dist/elfdump/elfdump.c Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/elfdump/elfdump.c Sat Jun 29 15:27:18 2019 (r349544) @@ -50,7 +50,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: elfdump.c 3584 2017-11-05 20:51:43Z jkoshy $"); +ELFTC_VCSID("$Id: elfdump.c 3762 2019-06-28 21:06:24Z emaste $"); #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #include "native-elf-format.h" @@ -343,17 +343,20 @@ elf_phdr_type_str(unsigned int type) static char s_type[32]; switch (type) { - case PT_NULL: return "PT_NULL"; - case PT_LOAD: return "PT_LOAD"; - case PT_DYNAMIC: return "PT_DYNAMIC"; - case PT_INTERP: return "PT_INTERP"; - case PT_NOTE: return "PT_NOTE"; - case PT_SHLIB: return "PT_SHLIB"; - case PT_PHDR: return "PT_PHDR"; - case PT_TLS: return "PT_TLS"; - case PT_GNU_EH_FRAME: return "PT_GNU_EH_FRAME"; - case PT_GNU_STACK: return "PT_GNU_STACK"; - case PT_GNU_RELRO: return "PT_GNU_RELRO"; + case PT_NULL: return "PT_NULL"; + case PT_LOAD: return "PT_LOAD"; + case PT_DYNAMIC: return "PT_DYNAMIC"; + case PT_INTERP: return "PT_INTERP"; + case PT_NOTE: return "PT_NOTE"; + case PT_SHLIB: return "PT_SHLIB"; + case PT_PHDR: return "PT_PHDR"; + case PT_TLS: return "PT_TLS"; + case PT_GNU_EH_FRAME: return "PT_GNU_EH_FRAME"; + case PT_GNU_STACK: return "PT_GNU_STACK"; + case PT_GNU_RELRO: return "PT_GNU_RELRO"; + case PT_OPENBSD_RANDOMIZE: return "PT_OPENBSD_RANDOMIZE"; + case PT_OPENBSD_WXNEEDED: return "PT_OPENBSD_WXNEEDED"; + case PT_OPENBSD_BOOTDATA: return "PT_OPENBSD_BOOTDATA"; } snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type); return (s_type); Modified: vendor/elftoolchain/dist/libdwarf/dwarf.h ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf.h Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/libdwarf/dwarf.h Sat Jun 29 15:27:18 2019 (r349544) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: dwarf.h 3494 2016-09-20 17:16:13Z emaste $ + * $Id: dwarf.h 3749 2019-06-28 01:10:44Z emaste $ */ #ifndef _DWARF_H_ @@ -523,6 +523,24 @@ #define DW_LANG_ObjC_plus_plus 0x0011 #define DW_LANG_UPC 0x0012 #define DW_LANG_D 0x0013 +#define DW_LANG_Python 0x0014 +#define DW_LANG_OpenCL 0x0015 +#define DW_LANG_Go 0x0016 +#define DW_LANG_Modula3 0x0017 +#define DW_LANG_Haskell 0x0018 +#define DW_LANG_C_plus_plus_03 0x0019 +#define DW_LANG_C_plus_plus_11 0x001a +#define DW_LANG_OCaml 0x001b +#define DW_LANG_Rust 0x001c +#define DW_LANG_C11 0x001d +#define DW_LANG_Swift 0x001e +#define DW_LANG_Julia 0x001f +#define DW_LANG_Dylan 0x0020 +#define DW_LANG_C_plus_plus_14 0x0021 +#define DW_LANG_Fortran03 0x0022 +#define DW_LANG_Fortran08 0x0023 +#define DW_LANG_RenderScript 0x0024 +#define DW_LANG_BLISS 0x0025 #define DW_LANG_lo_user 0x8000 #define DW_LANG_Mips_Assembler 0x8001 #define DW_LANG_hi_user 0xffff Modified: vendor/elftoolchain/dist/libdwarf/dwarf_dump.c ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_dump.c Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/libdwarf/dwarf_dump.c Sat Jun 29 15:27:18 2019 (r349544) @@ -27,7 +27,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: dwarf_dump.c 3494 2016-09-20 17:16:13Z emaste $"); +ELFTC_VCSID("$Id: dwarf_dump.c 3749 2019-06-28 01:10:44Z emaste $"); int dwarf_get_ACCESS_name(unsigned access, const char **s) @@ -605,7 +605,7 @@ dwarf_get_DS_name(unsigned ds, const char **s) case DW_DS_leading_separate: *s = "DW_DS_leading_separate"; break; case DW_DS_trailing_separate: - *s = "DW_DS_trailing_separate"; + *s = "DW_DS_trailing_separate"; break; default: return (DW_DLV_NO_ENTRY); } @@ -788,6 +788,42 @@ dwarf_get_LANG_name(unsigned lang, const char **s) *s = "DW_LANG_UPC"; break; case DW_LANG_D: *s = "DW_LANG_D"; break; + case DW_LANG_Python: + *s = "DW_LANG_Python"; break; + case DW_LANG_OpenCL: + *s = "DW_LANG_OpenCL"; break; + case DW_LANG_Go: + *s = "DW_LANG_Go"; break; + case DW_LANG_Modula3: + *s = "DW_LANG_Modula3"; break; + case DW_LANG_Haskell: + *s = "DW_LANG_Haskell"; break; + case DW_LANG_C_plus_plus_03: + *s = "DW_LANG_C_plus_plus_03"; break; + case DW_LANG_C_plus_plus_11: + *s = "DW_LANG_C_plus_plus_11"; break; + case DW_LANG_OCaml: + *s = "DW_LANG_OCaml"; break; + case DW_LANG_Rust: + *s = "DW_LANG_Rust"; break; + case DW_LANG_C11: + *s = "DW_LANG_C11"; break; + case DW_LANG_Swift: + *s = "DW_LANG_Swift"; break; + case DW_LANG_Julia: + *s = "DW_LANG_Julia"; break; + case DW_LANG_Dylan: + *s = "DW_LANG_Dylan"; break; + case DW_LANG_C_plus_plus_14: + *s = "DW_LANG_C_plus_plus_14"; break; + case DW_LANG_Fortran03: + *s = "DW_LANG_Fortran03"; break; + case DW_LANG_Fortran08: + *s = "DW_LANG_Fortran08"; break; + case DW_LANG_RenderScript: + *s = "DW_LANG_RenderScript"; break; + case DW_LANG_BLISS: + *s = "DW_LANG_BLISS"; break; case DW_LANG_lo_user: *s = "DW_LANG_lo_user"; break; case DW_LANG_Mips_Assembler: Modified: vendor/elftoolchain/dist/libdwarf/libdwarf_attr.c ============================================================================== --- vendor/elftoolchain/dist/libdwarf/libdwarf_attr.c Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/libdwarf/libdwarf_attr.c Sat Jun 29 15:27:18 2019 (r349544) @@ -27,7 +27,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: libdwarf_attr.c 3064 2014-06-06 19:35:55Z kaiwang27 $"); +ELFTC_VCSID("$Id: libdwarf_attr.c 3748 2019-06-28 01:11:13Z emaste $"); int _dwarf_attr_alloc(Dwarf_Die die, Dwarf_Attribute *atp, Dwarf_Error *error) @@ -100,7 +100,6 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u uint64_t form, int indirect, Dwarf_Error *error) { struct _Dwarf_Attribute atref; - Dwarf_Section *str; int ret; ret = DW_DLE_NONE; @@ -183,9 +182,7 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u break; case DW_FORM_strp: atref.u[0].u64 = dbg->read(ds->ds_data, offsetp, dwarf_size); - str = _dwarf_find_section(dbg, ".debug_str"); - assert(str != NULL); - atref.u[1].s = (char *) str->ds_data + atref.u[0].u64; + atref.u[1].s = _dwarf_strtab_get_table(dbg) + atref.u[0].u64; break; case DW_FORM_ref_sig8: atref.u[0].u64 = 8; Modified: vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c ============================================================================== --- vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/libdwarf/libdwarf_reloc.c Sat Jun 29 15:27:18 2019 (r349544) @@ -26,7 +26,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: libdwarf_reloc.c 3578 2017-09-14 02:21:28Z emaste $"); +ELFTC_VCSID("$Id: libdwarf_reloc.c 3741 2019-06-07 06:32:01Z jkoshy $"); Dwarf_Unsigned _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64) @@ -44,7 +44,7 @@ _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64) case DW_ISA_SPARC: return (is64 ? R_SPARC_UA64 : R_SPARC_UA32); case DW_ISA_PPC: - return (R_PPC_ADDR32); + return (is64 ? R_PPC64_ADDR64 : R_PPC_ADDR32); case DW_ISA_ARM: return (R_ARM_ABS32); case DW_ISA_MIPS: @@ -96,6 +96,12 @@ _dwarf_get_reloc_size(Dwarf_Debug dbg, Dwarf_Unsigned case EM_PPC: if (rel_type == R_PPC_ADDR32) return (4); + break; + case EM_PPC64: + if (rel_type == R_PPC_ADDR32) + return (4); + else if (rel_type == R_PPC64_ADDR64) + return (8); break; case EM_MIPS: if (rel_type == R_MIPS_32) Modified: vendor/elftoolchain/dist/libelf/_libelf.h ============================================================================== --- vendor/elftoolchain/dist/libelf/_libelf.h Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/libelf/_libelf.h Sat Jun 29 15:27:18 2019 (r349544) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: _libelf.h 3632 2018-10-10 21:12:43Z jkoshy $ + * $Id: _libelf.h 3738 2019-05-05 21:49:06Z jkoshy $ */ #ifndef __LIBELF_H_ @@ -90,7 +90,7 @@ struct _Elf { Elf_Kind e_kind; /* ELF_K_* */ Elf *e_parent; /* non-NULL for archive members */ unsigned char *e_rawfile; /* uninterpreted bytes */ - size_t e_rawsize; /* size of uninterpreted bytes */ + off_t e_rawsize; /* size of uninterpreted bytes */ unsigned int e_version; /* file version */ /* @@ -226,7 +226,7 @@ size_t _libelf_msize(Elf_Type _t, int _elfclass, unsig void *_libelf_newphdr(Elf *_e, int _elfclass, size_t _count); Elf *_libelf_open_object(int _fd, Elf_Cmd _c, int _reporterror); struct _Libelf_Data *_libelf_release_data(struct _Libelf_Data *_d); -Elf *_libelf_release_elf(Elf *_e); +void _libelf_release_elf(Elf *_e); Elf_Scn *_libelf_release_scn(Elf_Scn *_s); int _libelf_setphnum(Elf *_e, void *_eh, int _elfclass, size_t _phnum); int _libelf_setshnum(Elf *_e, void *_eh, int _elfclass, size_t _shnum); Modified: vendor/elftoolchain/dist/libelf/_libelf_config.h ============================================================================== --- vendor/elftoolchain/dist/libelf/_libelf_config.h Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/libelf/_libelf_config.h Sat Jun 29 15:27:18 2019 (r349544) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: _libelf_config.h 3566 2017-08-31 02:28:40Z emaste $ + * $Id: _libelf_config.h 3764 2019-06-28 21:44:46Z emaste $ */ #if defined(__APPLE__) || defined(__DragonFly__) @@ -98,6 +98,12 @@ #define LIBELF_CLASS ELFCLASS32 #elif defined(__riscv) && (__riscv_xlen == 64) + +#define LIBELF_ARCH EM_RISCV +#define LIBELF_BYTEORDER ELFDATA2LSB +#define LIBELF_CLASS ELFCLASS64 + +#elif defined(__riscv64) #define LIBELF_ARCH EM_RISCV #define LIBELF_BYTEORDER ELFDATA2LSB Modified: vendor/elftoolchain/dist/libelf/elf.3 ============================================================================== --- vendor/elftoolchain/dist/libelf/elf.3 Sat Jun 29 14:55:53 2019 (r349543) +++ vendor/elftoolchain/dist/libelf/elf.3 Sat Jun 29 15:27:18 2019 (r349544) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006-2008,2011 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006-2008,2011,2019 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf.3 3643 2018-10-14 21:09:24Z jkoshy $ +.\" $Id: elf.3 3743 2019-06-12 19:36:30Z jkoshy $ .\" -.Dd October 10, 2018 +.Dd June 12, 2019 .Dt ELF 3 .Os .Sh NAME @@ -266,36 +266,43 @@ The operating version for the data in this buffer. .El .Pp .Vt Elf_Data -descriptors are usually associated with +descriptors are usually used in conjunction with .Vt Elf_Scn descriptors. -Existing data descriptors associated with an ELF section may be -structures are retrieved using the -.Fn elf_getdata -and -.Fn elf_rawdata -functions. -The -.Fn elf_newdata -function may be used to attach new data descriptors to an ELF section. .It Vt Elf_Scn .Vt Elf_Scn -descriptors represent a section in an ELF object. +descriptors represent sections in an ELF object. +These descriptors are opaque and contain no application modifiable +fields. .Pp -They are retrieved using the +The +.Vt Elf_Scn *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906291527.x5TFRJDJ098270>