Date: Mon, 17 Apr 2017 23:56:48 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317075 - in head/contrib/elftoolchain: addr2line ar common cxxfilt elfcopy elfdump libdwarf libelf libelftc nm readelf strings Message-ID: <201704172356.v3HNumwh079291@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Mon Apr 17 23:56:48 2017 New Revision: 317075 URL: https://svnweb.freebsd.org/changeset/base/317075 Log: Update ELF Tool Chain to upstream r3520 Highlights of changes between r3490 and r3520: - Improve C++ demangling - Improve compatibility with Binutils tools wrt. error messages - Handle additional types/sections/etc. in readelf and elfdump - addr2line, cxxfilt: use setvbuf to set line buffering for filter use PR: 218395 MFC after: 2 weeks Relnotes: Yes Sponsored by: The FreeBSD Foundation Added: head/contrib/elftoolchain/ar/os.FreeBSD.mk - copied unchanged from r317073, vendor/elftoolchain/dist/ar/os.FreeBSD.mk head/contrib/elftoolchain/elfcopy/os.FreeBSD.mk - copied unchanged from r317073, vendor/elftoolchain/dist/elfcopy/os.FreeBSD.mk Modified: head/contrib/elftoolchain/addr2line/addr2line.c head/contrib/elftoolchain/common/elfdefinitions.h head/contrib/elftoolchain/cxxfilt/cxxfilt.c head/contrib/elftoolchain/elfcopy/main.c head/contrib/elftoolchain/elfcopy/pe.c head/contrib/elftoolchain/elfcopy/symbols.c head/contrib/elftoolchain/elfdump/elfdump.c head/contrib/elftoolchain/libdwarf/dwarf.h head/contrib/elftoolchain/libdwarf/dwarf_attrval.c head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 head/contrib/elftoolchain/libdwarf/dwarf_dump.c head/contrib/elftoolchain/libelf/gelf_newehdr.3 head/contrib/elftoolchain/libelf/gelf_newphdr.3 head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c head/contrib/elftoolchain/libelftc/libelftc_dem_arm.c head/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c head/contrib/elftoolchain/nm/nm.c head/contrib/elftoolchain/readelf/readelf.c head/contrib/elftoolchain/strings/strings.c Directory Properties: head/contrib/elftoolchain/ (props changed) head/contrib/elftoolchain/ar/ (props changed) head/contrib/elftoolchain/elfdump/ (props changed) Modified: head/contrib/elftoolchain/addr2line/addr2line.c ============================================================================== --- head/contrib/elftoolchain/addr2line/addr2line.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/addr2line/addr2line.c Mon Apr 17 23:56:48 2017 (r317075) @@ -40,7 +40,7 @@ #include "uthash.h" #include "_elftc.h" -ELFTC_VCSID("$Id: addr2line.c 3446 2016-05-03 01:31:17Z emaste $"); +ELFTC_VCSID("$Id: addr2line.c 3499 2016-11-25 16:06:29Z emaste $"); struct Func { char *name; @@ -720,11 +720,11 @@ main(int argc, char **argv) if (argc > 0) for (i = 0; i < argc; i++) translate(dbg, e, argv[i]); - else - while (fgets(line, sizeof(line), stdin) != NULL) { + else { + setvbuf(stdout, NULL, _IOLBF, 0); + while (fgets(line, sizeof(line), stdin) != NULL) translate(dbg, e, line); - fflush(stdout); - } + } dwarf_finish(dbg, &de); Copied: head/contrib/elftoolchain/ar/os.FreeBSD.mk (from r317073, vendor/elftoolchain/dist/ar/os.FreeBSD.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/elftoolchain/ar/os.FreeBSD.mk Mon Apr 17 23:56:48 2017 (r317075, copy of r317073, vendor/elftoolchain/dist/ar/os.FreeBSD.mk) @@ -0,0 +1,2 @@ +DPADD+= ${LIBBZ2} +LDADD+= -lbz2 Modified: head/contrib/elftoolchain/common/elfdefinitions.h ============================================================================== --- head/contrib/elftoolchain/common/elfdefinitions.h Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/common/elfdefinitions.h Mon Apr 17 23:56:48 2017 (r317075) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfdefinitions.h 3485 2016-08-18 13:38:52Z emaste $ + * $Id: elfdefinitions.h 3515 2017-01-24 22:04:22Z emaste $ */ /* @@ -153,6 +153,8 @@ _ELF_DEFINE_DT(DT_SUNW_FILTER, 0x60 "offset of string naming standard filtees") \ _ELF_DEFINE_DT(DT_SUNW_CAP, 0x60000010UL, \ "address of hardware capabilities section") \ +_ELF_DEFINE_DT(DT_SUNW_ASLR, 0x60000023UL, \ + "Address Space Layout Randomization flag") \ _ELF_DEFINE_DT(DT_HIOS, 0x6FFFF000UL, \ "end of OS-specific types") \ _ELF_DEFINE_DT(DT_VALRNGLO, 0x6FFFFD00UL, \ @@ -919,6 +921,12 @@ _ELF_DEFINE_PT(PT_GNU_STACK, 0x6474E "Stack flags") \ _ELF_DEFINE_PT(PT_GNU_RELRO, 0x6474E552UL, \ "Segment becomes read-only after relocation") \ +_ELF_DEFINE_PT(PT_OPENBSD_RANDOMIZE,0x65A3DBE6UL, \ + "Segment filled with random data") \ +_ELF_DEFINE_PT(PT_OPENBSD_WXNEEDED, 0x65A3DBE7UL, \ + "Program violates W^X") \ +_ELF_DEFINE_PT(PT_OPENBSD_BOOTDATA, 0x65A41BE6UL, \ + "Boot data") \ _ELF_DEFINE_PT(PT_SUNWBSS, 0x6FFFFFFAUL, \ "A Solaris .SUNW_bss section") \ _ELF_DEFINE_PT(PT_SUNWSTACK, 0x6FFFFFFBUL, \ Modified: head/contrib/elftoolchain/cxxfilt/cxxfilt.c ============================================================================== --- head/contrib/elftoolchain/cxxfilt/cxxfilt.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/cxxfilt/cxxfilt.c Mon Apr 17 23:56:48 2017 (r317075) @@ -35,7 +35,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: cxxfilt.c 3454 2016-05-07 17:11:05Z kaiwang27 $"); +ELFTC_VCSID("$Id: cxxfilt.c 3499 2016-11-25 16:06:29Z emaste $"); #define STRBUFSZ 8192 @@ -175,6 +175,7 @@ main(int argc, char **argv) } else { p = 0; for (;;) { + setvbuf(stdout, NULL, _IOLBF, 0); c = fgetc(stdin); if (c == EOF || !(isalnum(c) || strchr(".$_", c))) { if (p > 0) { Modified: head/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/main.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/elfcopy/main.c Mon Apr 17 23:56:48 2017 (r317075) @@ -39,7 +39,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: main.c 3446 2016-05-03 01:31:17Z emaste $"); +ELFTC_VCSID("$Id: main.c 3520 2017-04-17 01:47:52Z kaiwang27 $"); enum options { @@ -285,6 +285,7 @@ create_elf(struct elfcopy *ecp) size_t ishnum; ecp->flags |= SYMTAB_INTACT; + ecp->flags &= ~SYMTAB_EXIST; /* Create EHDR. */ if (gelf_getehdr(ecp->ein, &ieh) == NULL) @@ -499,6 +500,10 @@ free_elf(struct elfcopy *ecp) } } + ecp->symtab = NULL; + ecp->strtab = NULL; + ecp->shstrtab = NULL; + if (ecp->secndx != NULL) { free(ecp->secndx); ecp->secndx = NULL; Copied: head/contrib/elftoolchain/elfcopy/os.FreeBSD.mk (from r317073, vendor/elftoolchain/dist/elfcopy/os.FreeBSD.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/elftoolchain/elfcopy/os.FreeBSD.mk Mon Apr 17 23:56:48 2017 (r317075, copy of r317073, vendor/elftoolchain/dist/elfcopy/os.FreeBSD.mk) @@ -0,0 +1,4 @@ +.if !defined(LIBELF_AR) +DPADD+= ${LIBBZ2} +LDADD+= -lbz2 +.endif Modified: head/contrib/elftoolchain/elfcopy/pe.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/pe.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/elfcopy/pe.c Mon Apr 17 23:56:48 2017 (r317075) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: pe.c 3490 2016-08-31 00:12:22Z emaste $"); +ELFTC_VCSID("$Id: pe.c 3508 2016-12-27 06:19:39Z kaiwang27 $"); /* Convert ELF object to Portable Executable (PE). */ void Modified: head/contrib/elftoolchain/elfcopy/symbols.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/symbols.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/elfcopy/symbols.c Mon Apr 17 23:56:48 2017 (r317075) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: symbols.c 3446 2016-05-03 01:31:17Z emaste $"); +ELFTC_VCSID("$Id: symbols.c 3520 2017-04-17 01:47:52Z kaiwang27 $"); /* Backwards compatibility for systems with older ELF definitions. */ #ifndef STB_GNU_UNIQUE @@ -676,6 +676,8 @@ create_symtab(struct elfcopy *ecp) sy = ecp->symtab; st = ecp->strtab; + assert(sy != NULL && st != NULL); + /* * Set section index map for .symtab and .strtab. We need to set * these map because otherwise symbols which refer to .symtab and Modified: head/contrib/elftoolchain/elfdump/elfdump.c ============================================================================== --- head/contrib/elftoolchain/elfdump/elfdump.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/elfdump/elfdump.c Mon Apr 17 23:56:48 2017 (r317075) @@ -50,7 +50,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: elfdump.c 3482 2016-08-02 18:47:00Z emaste $"); +ELFTC_VCSID("$Id: elfdump.c 3497 2016-10-17 20:57:22Z emaste $"); #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #include "native-elf-format.h" @@ -223,9 +223,9 @@ d_tags(uint64_t tag) case 0x6ffffff0: return "DT_GNU_VERSYM"; /* 0x70000000 - 0x7fffffff processor-specific semantics */ case 0x70000000: return "DT_IA_64_PLT_RESERVE"; - case 0x7ffffffd: return "DT_SUNW_AUXILIARY"; - case 0x7ffffffe: return "DT_SUNW_USED"; - case 0x7fffffff: return "DT_SUNW_FILTER"; + case DT_AUXILIARY: return "DT_AUXILIARY"; + case DT_USED: return "DT_USED"; + case DT_FILTER: return "DT_FILTER"; } snprintf(unknown_buf, sizeof(unknown_buf), Modified: head/contrib/elftoolchain/libdwarf/dwarf.h ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf.h Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libdwarf/dwarf.h Mon Apr 17 23:56:48 2017 (r317075) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: dwarf.h 3052 2014-05-26 20:36:24Z kaiwang27 $ + * $Id: dwarf.h 3494 2016-09-20 17:16:13Z emaste $ */ #ifndef _DWARF_H_ @@ -208,6 +208,25 @@ #define DW_AT_lo_user 0x2000 #define DW_AT_hi_user 0x3fff +/* SGI/MIPS extensions. */ +#define DW_AT_MIPS_fde 0x2001 +#define DW_AT_MIPS_loop_begin 0x2002 +#define DW_AT_MIPS_tail_loop_begin 0x2003 +#define DW_AT_MIPS_epilog_begin 0x2004 +#define DW_AT_MIPS_loop_unroll_factor 0x2005 +#define DW_AT_MIPS_software_pipeline_depth 0x2006 +#define DW_AT_MIPS_linkage_name 0x2007 +#define DW_AT_MIPS_stride 0x2008 +#define DW_AT_MIPS_abstract_name 0x2009 +#define DW_AT_MIPS_clone_origin 0x200a +#define DW_AT_MIPS_has_inlines 0x200b +#define DW_AT_MIPS_stride_byte 0x200c +#define DW_AT_MIPS_stride_elem 0x200d +#define DW_AT_MIPS_ptr_dopetype 0x200e +#define DW_AT_MIPS_allocatable_dopetype 0x200f +#define DW_AT_MIPS_assumed_shape_dopetype 0x2010 +#define DW_AT_MIPS_assumed_size 0x2011 + /* GNU extensions. */ #define DW_AT_sf_names 0x2101 #define DW_AT_src_info 0x2102 @@ -505,6 +524,7 @@ #define DW_LANG_UPC 0x0012 #define DW_LANG_D 0x0013 #define DW_LANG_lo_user 0x8000 +#define DW_LANG_Mips_Assembler 0x8001 #define DW_LANG_hi_user 0xffff #define DW_ID_case_sensitive 0x00 Modified: head/contrib/elftoolchain/libdwarf/dwarf_attrval.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_attrval.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libdwarf/dwarf_attrval.c Mon Apr 17 23:56:48 2017 (r317075) @@ -26,7 +26,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: dwarf_attrval.c 3159 2015-02-15 21:43:27Z emaste $"); +ELFTC_VCSID("$Id: dwarf_attrval.c 3509 2016-12-29 03:58:41Z emaste $"); int dwarf_attrval_flag(Dwarf_Die die, Dwarf_Half attr, Dwarf_Bool *valp, Dwarf_Error *err) Modified: head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 Mon Apr 17 23:56:48 2017 (r317075) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_attrval_signed.3 2980 2014-01-21 20:15:54Z kaiwang27 $ +.\" $Id: dwarf_attrval_signed.3 3509 2016-12-29 03:58:41Z emaste $ .\" .Dd December 26, 2016 .Os Modified: head/contrib/elftoolchain/libdwarf/dwarf_dump.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_dump.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libdwarf/dwarf_dump.c Mon Apr 17 23:56:48 2017 (r317075) @@ -27,7 +27,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: dwarf_dump.c 3052 2014-05-26 20:36:24Z kaiwang27 $"); +ELFTC_VCSID("$Id: dwarf_dump.c 3494 2016-09-20 17:16:13Z emaste $"); int dwarf_get_ACCESS_name(unsigned access, const char **s) @@ -262,6 +262,40 @@ dwarf_get_AT_name(unsigned attr, const c *s = "DW_AT_body_begin"; break; case DW_AT_body_end: *s = "DW_AT_body_end"; break; + case DW_AT_MIPS_fde: + *s = "DW_AT_MIPS_fde"; break; + case DW_AT_MIPS_loop_begin: + *s = "DW_AT_MIPS_loop_begin"; break; + case DW_AT_MIPS_tail_loop_begin: + *s = "DW_AT_MIPS_tail_loop_begin"; break; + case DW_AT_MIPS_epilog_begin: + *s = "DW_AT_MIPS_epilog_begin"; break; + case DW_AT_MIPS_loop_unroll_factor: + *s = "DW_AT_MIPS_loop_unroll_factor"; break; + case DW_AT_MIPS_software_pipeline_depth: + *s = "DW_AT_MIPS_software_pipeline_depth"; break; + case DW_AT_MIPS_linkage_name: + *s = "DW_AT_MIPS_linkage_name"; break; + case DW_AT_MIPS_stride: + *s = "DW_AT_MIPS_stride"; break; + case DW_AT_MIPS_abstract_name: + *s = "DW_AT_MIPS_abstract_name"; break; + case DW_AT_MIPS_clone_origin: + *s = "DW_AT_MIPS_clone_origin"; break; + case DW_AT_MIPS_has_inlines: + *s = "DW_AT_MIPS_has_inlines"; break; + case DW_AT_MIPS_stride_byte: + *s = "DW_AT_MIPS_stride_byte"; break; + case DW_AT_MIPS_stride_elem: + *s = "DW_AT_MIPS_stride_elem"; break; + case DW_AT_MIPS_ptr_dopetype: + *s = "DW_AT_MIPS_ptr_dopetype"; break; + case DW_AT_MIPS_allocatable_dopetype: + *s = "DW_AT_MIPS_allocatable_dopetype"; break; + case DW_AT_MIPS_assumed_shape_dopetype: + *s = "DW_AT_MIPS_assumed_shape_dopetype"; break; + case DW_AT_MIPS_assumed_size: + *s = "DW_AT_MIPS_assumed_size"; break; case DW_AT_GNU_vector: *s = "DW_AT_GNU_vector"; break; case DW_AT_GNU_guarded_by: @@ -756,6 +790,8 @@ dwarf_get_LANG_name(unsigned lang, const *s = "DW_LANG_D"; break; case DW_LANG_lo_user: *s = "DW_LANG_lo_user"; break; + case DW_LANG_Mips_Assembler: + *s = "DW_LANG_Mips_Assembler"; break; case DW_LANG_hi_user: *s = "DW_LANG_hi_user"; break; default: Modified: head/contrib/elftoolchain/libelf/gelf_newehdr.3 ============================================================================== --- head/contrib/elftoolchain/libelf/gelf_newehdr.3 Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libelf/gelf_newehdr.3 Mon Apr 17 23:56:48 2017 (r317075) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: gelf_newehdr.3 189 2008-07-20 10:38:08Z jkoshy $ +.\" $Id: gelf_newehdr.3 3500 2016-12-04 11:08:44Z jkoshy $ .\" .Dd October 22, 2007 .Os @@ -127,6 +127,15 @@ flag on ELF descriptor .Sh RETURN VALUES These functions return a pointer to a translated header descriptor if successful, or NULL on failure. +.Sh COMPATIBILITY +The +.Fn gelf_newehdr +function uses a type of +.Ft "void *" +for its returned value. +This differs from some other implementations of the ELF(3) API, which use an +.Ft "unsigned long" +return type. .Sh ERRORS These functions can fail with the following errors: .Bl -tag -width "[ELF_E_RESOURCE]" Modified: head/contrib/elftoolchain/libelf/gelf_newphdr.3 ============================================================================== --- head/contrib/elftoolchain/libelf/gelf_newphdr.3 Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libelf/gelf_newphdr.3 Mon Apr 17 23:56:48 2017 (r317075) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: gelf_newphdr.3 189 2008-07-20 10:38:08Z jkoshy $ +.\" $Id: gelf_newphdr.3 3500 2016-12-04 11:08:44Z jkoshy $ .\" .Dd October 22, 2007 .Os @@ -97,6 +97,15 @@ will no longer be valid. .Sh RETURN VALUES The functions a valid pointer if successful, or NULL in case an error was encountered. +.Sh COMPATIBILITY +The +.Fn gelf_newphdr +function uses a type of +.Ft "void *" +for its returned value. +This differs from some other implementations of the ELF(3) API, which use an +.Ft "unsigned long" +return type. .Sh ERRORS These functions may fail with the following errors: .Bl -tag -width "[ELF_E_RESOURCE]" Modified: head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 ============================================================================== --- head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Mon Apr 17 23:56:48 2017 (r317075) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elftc_bfd_find_target.3 3488 2016-08-24 18:15:57Z emaste $ +.\" $Id: elftc_bfd_find_target.3 3516 2017-02-10 02:33:08Z emaste $ .\" .Dd November 30, 2011 .Os @@ -74,6 +74,7 @@ Known descriptor names and their propert .It Li elf32-littlearm Ta ELF Ta LSB Ta 32 .It Li elf32-littlemips Ta ELF Ta LSB Ta 32 .It Li elf32-powerpc Ta ELF Ta MSB Ta 32 +.It Li elf32-powerpc-freebsd Ta ELF Ta MSB Ta 32 .It Li elf32-powerpcle Ta ELF Ta LSB Ta 32 .It Li elf32-sh Ta ELF Ta MSB Ta 32 .It Li elf32-shl Ta ELF Ta LSB Ta 32 @@ -94,6 +95,7 @@ Known descriptor names and their propert .It Li elf64-littleaarch64 Ta ELF Ta LSB Ta 64 .It Li elf64-littlemips Ta ELF Ta LSB Ta 64 .It Li elf64-powerpc Ta ELF Ta MSB Ta 64 +.It Li elf64-powerpc-freebsd Ta ELF Ta MSB Ta 64 .It Li elf64-powerpcle Ta ELF Ta LSB Ta 64 .It Li elf64-sh64 Ta ELF Ta MSB Ta 64 .It Li elf64-sh64l Ta ELF Ta LSB Ta 64 Modified: head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c ============================================================================== --- head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Mon Apr 17 23:56:48 2017 (r317075) @@ -30,7 +30,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3488 2016-08-24 18:15:57Z emaste $"); +ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3516 2017-02-10 02:33:08Z emaste $"); struct _Elftc_Bfd_Target _libelftc_targets[] = { Modified: head/contrib/elftoolchain/libelftc/libelftc_dem_arm.c ============================================================================== --- head/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Mon Apr 17 23:56:48 2017 (r317075) @@ -37,7 +37,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_dem_arm.c 3447 2016-05-03 13:32:23Z emaste $"); +ELFTC_VCSID("$Id: libelftc_dem_arm.c 3513 2016-12-29 07:04:22Z kaiwang27 $"); /** * @file cpp_demangle_arm.c @@ -68,6 +68,7 @@ struct demangle_data { }; #define SIMPLE_HASH(x,y) (64 * x + y) +#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s))) #define CPP_DEMANGLE_ARM_TRY 128 static void dest_cstring(struct cstring *); @@ -137,7 +138,7 @@ cpp_demangle_ARM(const char *org) ++d.p; /* start argument types */ - if (vector_str_push(&d.vec, "(", 1) == false) + if (VEC_PUSH_STR(&d.vec, "(") == false) goto clean; for (;;) { @@ -169,21 +170,21 @@ cpp_demangle_ARM(const char *org) goto clean; if (d.ptr == true) { - if (vector_str_push(&d.vec, "*", 1) == false) + if (VEC_PUSH_STR(&d.vec, "*") == false) goto clean; d.ptr = false; } if (d.ref == true) { - if (vector_str_push(&d.vec, "&", 1) == false) + if (VEC_PUSH_STR(&d.vec, "&") == false) goto clean; d.ref = false; } if (d.cnst == true) { - if (vector_str_push(&d.vec, " const", 6) == false) + if (VEC_PUSH_STR(&d.vec, " const") == false) goto clean; d.cnst = false; @@ -210,7 +211,7 @@ cpp_demangle_ARM(const char *org) free(arg); - if (vector_str_push(&d.vec, ", ", 2) == false) + if (VEC_PUSH_STR(&d.vec, ", ") == false) goto clean; if (++try > CPP_DEMANGLE_ARM_TRY) @@ -218,7 +219,7 @@ cpp_demangle_ARM(const char *org) } /* end argument types */ - if (vector_str_push(&d.vec, ")", 1) == false) + if (VEC_PUSH_STR(&d.vec, ")") == false) goto clean; flat: @@ -323,11 +324,10 @@ push_CTDT(const char *s, size_t l, struc return (false); assert(v->size > 1); - if (vector_str_push(v, v->container[v->size - 2], - strlen(v->container[v->size - 2])) == false) + if (VEC_PUSH_STR(v, v->container[v->size - 2]) == false) return (false); - if (vector_str_push(v, "()", 2) == false) + if (VEC_PUSH_STR(v, "()") == false) return (false); return (true); @@ -429,7 +429,7 @@ read_func(struct demangle_data *d) if (read_class(d) == false) return (false); - if (vector_str_push(&d->vec, "::", 2) == false) + if (VEC_PUSH_STR(&d->vec, "::") == false) return (false); } @@ -486,7 +486,7 @@ read_func_name(struct demangle_data *d) if (read_qual_name(d) == false) goto clean; - if (vector_str_push(&d->vec, "::", 2) == false) + if (VEC_PUSH_STR(&d->vec, "::") == false) goto clean; if (vector_str_push(&d->vec, op_name, len) == false) @@ -508,7 +508,7 @@ read_func_name(struct demangle_data *d) if (read_class(d) == false) goto clean; - if (vector_str_push(&d->vec, "::", 2) == false) + if (VEC_PUSH_STR(&d->vec, "::") == false) goto clean; if (vector_str_push(&d->vec, op_name, len) == false) @@ -553,7 +553,7 @@ read_func_ptr(struct demangle_data *d) } if (fptr.ptr == true) { - if (vector_str_push(&fptr.vec, "*", 1) == false) { + if (VEC_PUSH_STR(&fptr.vec, "*") == false) { dest_demangle_data(&fptr); return (false); @@ -563,7 +563,7 @@ read_func_ptr(struct demangle_data *d) } if (fptr.ref == true) { - if (vector_str_push(&fptr.vec, "&", 1) == false) { + if (VEC_PUSH_STR(&fptr.vec, "&") == false) { dest_demangle_data(&fptr); return (false); @@ -573,7 +573,7 @@ read_func_ptr(struct demangle_data *d) } if (fptr.cnst == true) { - if (vector_str_push(&fptr.vec, " const", 6) == false) { + if (VEC_PUSH_STR(&fptr.vec, " const") == false) { dest_demangle_data(&fptr); return (false); @@ -585,7 +585,7 @@ read_func_ptr(struct demangle_data *d) if (*fptr.p == '_') break; - if (vector_str_push(&fptr.vec, ", ", 2) == false) { + if (VEC_PUSH_STR(&fptr.vec, ", ") == false) { dest_demangle_data(&fptr); return (false); @@ -636,7 +636,7 @@ read_func_ptr(struct demangle_data *d) free(rtn_type); - if (vector_str_push(&d->vec, " (*)(", 5) == false) { + if (VEC_PUSH_STR(&d->vec, " (*)(") == false) { free(arg_type); return (false); @@ -650,7 +650,7 @@ read_func_ptr(struct demangle_data *d) free(arg_type); - return (vector_str_push(&d->vec, ")", 1)); + return (VEC_PUSH_STR(&d->vec, ")")); } static bool @@ -689,7 +689,7 @@ read_memptr(struct demangle_data *d) if (vector_str_push(&d->vec, mptr_str, len) == false) goto clean; - if (vector_str_push(&d->vec, "::*", 3) == false) + if (VEC_PUSH_STR(&d->vec, "::*") == false) goto clean; rtn = true; @@ -712,108 +712,102 @@ read_op(struct demangle_data *d) switch (SIMPLE_HASH(*(d->p), *(d->p+1))) { case SIMPLE_HASH('m', 'l') : d->p += 2; - return (vector_str_push(&d->vec, "operator*", 9)); + return (VEC_PUSH_STR(&d->vec, "operator*")); case SIMPLE_HASH('d', 'v') : d->p += 2; - return (vector_str_push(&d->vec, "operator/", 9)); + return (VEC_PUSH_STR(&d->vec, "operator/")); case SIMPLE_HASH('m', 'd') : d->p += 2; - return (vector_str_push(&d->vec, "operator%", 9)); + return (VEC_PUSH_STR(&d->vec, "operator%")); case SIMPLE_HASH('p', 'l') : d->p += 2; - return (vector_str_push(&d->vec, "operator+", 9)); + return (VEC_PUSH_STR(&d->vec, "operator+")); case SIMPLE_HASH('m', 'i') : d->p += 2; - return (vector_str_push(&d->vec, "operator-", 9)); + return (VEC_PUSH_STR(&d->vec, "operator-")); case SIMPLE_HASH('l', 's') : d->p += 2; - return (vector_str_push(&d->vec, "operator<<", 10)); + return (VEC_PUSH_STR(&d->vec, "operator<<")); case SIMPLE_HASH('r', 's') : d->p += 2; - return (vector_str_push(&d->vec, "operator>>", 10)); + return (VEC_PUSH_STR(&d->vec, "operator>>")); case SIMPLE_HASH('e', 'q') : d->p += 2; - return (vector_str_push(&d->vec, "operator==", 10)); + return (VEC_PUSH_STR(&d->vec, "operator==")); case SIMPLE_HASH('n', 'e') : d->p += 2; - return (vector_str_push(&d->vec, "operator!=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator!=")); case SIMPLE_HASH('l', 't') : d->p += 2; - return (vector_str_push(&d->vec, "operator<", 9)); + return (VEC_PUSH_STR(&d->vec, "operator<")); case SIMPLE_HASH('g', 't') : d->p += 2; - return (vector_str_push(&d->vec, "operator>", 9)); + return (VEC_PUSH_STR(&d->vec, "operator>")); case SIMPLE_HASH('l', 'e') : d->p += 2; - return (vector_str_push(&d->vec, "operator<=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator<=")); case SIMPLE_HASH('g', 'e') : d->p += 2; - return (vector_str_push(&d->vec, "operator>=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator>=")); case SIMPLE_HASH('a', 'd') : d->p += 2; if (*d->p == 'v') { ++d->p; - return (vector_str_push(&d->vec, "operator/=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator/=")); } else - return (vector_str_push(&d->vec, "operator&", 9)); + return (VEC_PUSH_STR(&d->vec, "operator&")); case SIMPLE_HASH('o', 'r') : d->p += 2; - return (vector_str_push(&d->vec, "operator|", 9)); + return (VEC_PUSH_STR(&d->vec, "operator|")); case SIMPLE_HASH('e', 'r') : d->p += 2; - return (vector_str_push(&d->vec, "operator^", 9)); + return (VEC_PUSH_STR(&d->vec, "operator^")); case SIMPLE_HASH('a', 'a') : d->p += 2; if (*d->p == 'd') { ++d->p; - return (vector_str_push(&d->vec, "operator&=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator&=")); } else - return (vector_str_push(&d->vec, "operator&&", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator&&")); case SIMPLE_HASH('o', 'o') : d->p += 2; - return (vector_str_push(&d->vec, "operator||", 10)); + return (VEC_PUSH_STR(&d->vec, "operator||")); case SIMPLE_HASH('n', 't') : d->p += 2; - return (vector_str_push(&d->vec, "operator!", 9)); + return (VEC_PUSH_STR(&d->vec, "operator!")); case SIMPLE_HASH('c', 'o') : d->p += 2; - return (vector_str_push(&d->vec, "operator~", 9)); + return (VEC_PUSH_STR(&d->vec, "operator~")); case SIMPLE_HASH('p', 'p') : d->p += 2; - return (vector_str_push(&d->vec, "operator++", 10)); + return (VEC_PUSH_STR(&d->vec, "operator++")); case SIMPLE_HASH('m', 'm') : d->p += 2; - return (vector_str_push(&d->vec, "operator--", 10)); + return (VEC_PUSH_STR(&d->vec, "operator--")); case SIMPLE_HASH('a', 's') : d->p += 2; - return (vector_str_push(&d->vec, "operator=", 9)); + return (VEC_PUSH_STR(&d->vec, "operator=")); case SIMPLE_HASH('r', 'f') : d->p += 2; - return (vector_str_push(&d->vec, "operator->", 10)); + return (VEC_PUSH_STR(&d->vec, "operator->")); case SIMPLE_HASH('a', 'p') : /* apl */ if (*(d->p + 2) != 'l') return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator+=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator+=")); case SIMPLE_HASH('a', 'm') : d->p += 2; if (*d->p == 'i') { ++d->p; - return (vector_str_push(&d->vec, "operator-=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator-=")); } else if (*d->p == 'u') { ++d->p; - return (vector_str_push(&d->vec, "operator*=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator*=")); } else if (*d->p == 'd') { ++d->p; - return (vector_str_push(&d->vec, "operator%=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator%=")); } return (false); @@ -823,40 +817,40 @@ read_op(struct demangle_data *d) return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator<<=", 11)); + return (VEC_PUSH_STR(&d->vec, "operator<<=")); case SIMPLE_HASH('a', 'r') : /* ars */ if (*(d->p + 2) != 's') return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator>>=", 11)); + return (VEC_PUSH_STR(&d->vec, "operator>>=")); case SIMPLE_HASH('a', 'o') : /* aor */ if (*(d->p + 2) != 'r') return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator|=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator|=")); case SIMPLE_HASH('a', 'e') : /* aer */ if (*(d->p + 2) != 'r') return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator^=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator^=")); case SIMPLE_HASH('c', 'm') : d->p += 2; - return (vector_str_push(&d->vec, "operator,", 9)); + return (VEC_PUSH_STR(&d->vec, "operator,")); case SIMPLE_HASH('r', 'm') : d->p += 2; - return (vector_str_push(&d->vec, "operator->*", 11)); + return (VEC_PUSH_STR(&d->vec, "operator->*")); case SIMPLE_HASH('c', 'l') : d->p += 2; - return (vector_str_push(&d->vec, "()", 2)); + return (VEC_PUSH_STR(&d->vec, "()")); case SIMPLE_HASH('v', 'c') : d->p += 2; - return (vector_str_push(&d->vec, "[]", 2)); + return (VEC_PUSH_STR(&d->vec, "[]")); case SIMPLE_HASH('c', 't') : d->p += 4; d->type = ENCODE_OP_CT; @@ -883,11 +877,10 @@ read_op(struct demangle_data *d) return (false); case SIMPLE_HASH('n', 'w') : d->p += 2; - return (vector_str_push(&d->vec, "operator new()", 14)); + return (VEC_PUSH_STR(&d->vec, "operator new()")); case SIMPLE_HASH('d', 'l') : d->p += 2; - return (vector_str_push(&d->vec, "operator delete()", - 17)); + return (VEC_PUSH_STR(&d->vec, "operator delete()")); case SIMPLE_HASH('o', 'p') : /* __op<TO_TYPE>__<FROM_TYPE> */ d->p += 2; @@ -962,13 +955,13 @@ read_op_user(struct demangle_data *d) if (vector_str_push(&d->vec, from_str, from_len) == false) goto clean; - if (vector_str_push(&d->vec, "::operator ", 11) == false) + if (VEC_PUSH_STR(&d->vec, "::operator ") == false) return (false); if (vector_str_push(&d->vec, to_str, to_len) == false) goto clean; - rtn = vector_str_push(&d->vec, "()", 2); + rtn = VEC_PUSH_STR(&d->vec, "()"); clean: free(to_str); free(from_str); @@ -1000,7 +993,7 @@ read_qual_name(struct demangle_data *d) if (read_class(d) == false) return (false); - if (vector_str_push(&d->vec, "::", 2) == false) + if (VEC_PUSH_STR(&d->vec, "::") == false) return (false); } @@ -1029,12 +1022,10 @@ read_subst(struct demangle_data *d) d->p = str; - if (vector_str_push(&d->vec, d->arg.container[idx - 1], - strlen(d->arg.container[idx - 1])) == false) + if (VEC_PUSH_STR(&d->vec, d->arg.container[idx - 1]) == false) return (-1); - if (vector_str_push(&d->arg, d->arg.container[idx - 1], - strlen(d->arg.container[idx - 1])) == false) + if (VEC_PUSH_STR(&d->arg, d->arg.container[idx - 1]) == false) return (-1); if (*d->p == '\0') @@ -1073,16 +1064,14 @@ read_subst_iter(struct demangle_data *d) d->p = str; for (i = 0; i < repeat ; ++i) { - if (vector_str_push(&d->vec, d->arg.container[idx - 1], - strlen(d->arg.container[idx - 1])) == false) + if (VEC_PUSH_STR(&d->vec, d->arg.container[idx - 1]) == false) return (-1); - if (vector_str_push(&d->arg, d->arg.container[idx - 1], - strlen(d->arg.container[idx - 1])) == false) + if (VEC_PUSH_STR(&d->arg, d->arg.container[idx - 1]) == false) return (-1); if (i != repeat - 1 && - vector_str_push(&d->vec, ", ", 2) == false) + VEC_PUSH_STR(&d->vec, ", ") == false) return (-1); } @@ -1108,7 +1097,7 @@ read_type(struct demangle_data *d) case 'U' : ++d->p; - if (vector_str_push(&d->vec, "unsigned ", 9) == false) + if (VEC_PUSH_STR(&d->vec, "unsigned ") == false) return (false); break; @@ -1118,7 +1107,7 @@ read_type(struct demangle_data *d) if (*d->p == 'P') d->cnst = true; else { - if (vector_str_push(&d->vec, "const ", 6) == + if (VEC_PUSH_STR(&d->vec, "const ") == false) return (false); } @@ -1127,14 +1116,14 @@ read_type(struct demangle_data *d) case 'V' : ++d->p; - if (vector_str_push(&d->vec, "volatile ", 9) == false) + if (VEC_PUSH_STR(&d->vec, "volatile ") == false) return (false); break; case 'S' : ++d->p; - if (vector_str_push(&d->vec, "signed ", 7) == false) + if (VEC_PUSH_STR(&d->vec, "signed ") == false) return (false); break; @@ -1185,39 +1174,39 @@ read_type(struct demangle_data *d) case 'v' : ++d->p; - return (vector_str_push(&d->vec, "void", 4)); + return (VEC_PUSH_STR(&d->vec, "void")); case 'c' : ++d->p; - return (vector_str_push(&d->vec, "char", 4)); + return (VEC_PUSH_STR(&d->vec, "char")); case 's' : ++d->p; - return (vector_str_push(&d->vec, "short", 5)); + return (VEC_PUSH_STR(&d->vec, "short")); case 'i' : ++d->p; - return (vector_str_push(&d->vec, "int", 3)); + return (VEC_PUSH_STR(&d->vec, "int")); case 'l' : ++d->p; - return (vector_str_push(&d->vec, "long", 4)); + return (VEC_PUSH_STR(&d->vec, "long")); case 'f' : ++d->p; - return (vector_str_push(&d->vec, "float", 5)); + return (VEC_PUSH_STR(&d->vec, "float")); case 'd': ++d->p; - return (vector_str_push(&d->vec, "double", 6)); + return (VEC_PUSH_STR(&d->vec, "double")); case 'r': ++d->p; - return (vector_str_push(&d->vec, "long double", 11)); + return (VEC_PUSH_STR(&d->vec, "long double")); case 'e': ++d->p; - return (vector_str_push(&d->vec, "...", 3)); + return (VEC_PUSH_STR(&d->vec, "...")); default: return (false); }; Modified: head/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c ============================================================================== --- head/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Mon Apr 17 23:30:21 2017 (r317074) +++ head/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Mon Apr 17 23:56:48 2017 (r317075) @@ -37,7 +37,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 3447 2016-05-03 13:32:23Z emaste $"); +ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 3513 2016-12-29 07:04:22Z kaiwang27 $"); /** * @file cpp_demangle_gnu2.c @@ -66,6 +66,7 @@ struct demangle_data { }; #define SIMPLE_HASH(x,y) (64 * x + y) +#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s))) #define CPP_DEMANGLE_GNU2_TRY 128 static void dest_cstring(struct cstring *); @@ -126,7 +127,7 @@ cpp_demangle_gnu2(const char *org) if (push_CTDT("::~", 3, &d.vec) == false) goto clean; - if (vector_str_push(&d.vec, "(void)", 6) == false) + if (VEC_PUSH_STR(&d.vec, "(void)") == false) goto clean; goto flat; @@ -141,7 +142,7 @@ cpp_demangle_gnu2(const char *org) ++d.p; else if (*d.p == '\0') { if (d.class_name == true) { - if (vector_str_push(&d.vec, "(void)", 6) == false) + if (VEC_PUSH_STR(&d.vec, "(void)") == false) goto clean; goto flat; @@ -150,7 +151,7 @@ cpp_demangle_gnu2(const char *org) } /* start argument types */ - if (vector_str_push(&d.vec, "(", 1) == false) + if (VEC_PUSH_STR(&d.vec, "(") == false) goto clean; for (;;) { @@ -182,21 +183,21 @@ cpp_demangle_gnu2(const char *org) goto clean; if (d.ptr == true) { - if (vector_str_push(&d.vec, "*", 1) == false) + if (VEC_PUSH_STR(&d.vec, "*") == false) goto clean; d.ptr = false; } if (d.ref == true) { - if (vector_str_push(&d.vec, "&", 1) == false) + if (VEC_PUSH_STR(&d.vec, "&") == false) goto clean; d.ref = false; } if (d.cnst == true) { - if (vector_str_push(&d.vec, " const", 6) == false) + if (VEC_PUSH_STR(&d.vec, " const") == false) goto clean; d.cnst = false; @@ -223,7 +224,7 @@ cpp_demangle_gnu2(const char *org) free(arg); - if (vector_str_push(&d.vec, ", ", 2) == false) + if (VEC_PUSH_STR(&d.vec, ", ") == false) goto clean; if (++try > CPP_DEMANGLE_GNU2_TRY) @@ -231,10 +232,10 @@ cpp_demangle_gnu2(const char *org) } *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704172356.v3HNumwh079291>