Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 May 2015 19:48:16 +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: r282918 - in head: contrib/elftoolchain/addr2line contrib/elftoolchain/common contrib/elftoolchain/cxxfilt contrib/elftoolchain/elfcopy contrib/elftoolchain/libdwarf contrib/elftoolchai...
Message-ID:  <201505141948.t4EJmGC7013754@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Thu May 14 19:48:15 2015
New Revision: 282918
URL: https://svnweb.freebsd.org/changeset/base/282918

Log:
  Update to ELF Tool Chain r3197
  
  Highlights:
   - Fix man page markup, whitespace, and typos
   - Fix sh_info of SHT_GROUP section to point to the correct string
   - Improve validation in readelf and elfcopy/strip
   - Handle DWARF 4's DW_AT_high_pc in addr2line
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/addr2line/addr2line.1
  head/contrib/elftoolchain/addr2line/addr2line.c
  head/contrib/elftoolchain/common/native-elf-format
  head/contrib/elftoolchain/cxxfilt/c++filt.1
  head/contrib/elftoolchain/elfcopy/elfcopy.1
  head/contrib/elftoolchain/elfcopy/sections.c
  head/contrib/elftoolchain/elfcopy/segments.c
  head/contrib/elftoolchain/elfcopy/symbols.c
  head/contrib/elftoolchain/libdwarf/dwarf.3
  head/contrib/elftoolchain/libdwarf/dwarf_add_line_entry.3
  head/contrib/elftoolchain/libdwarf/dwarf_def_macro.3
  head/contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.3
  head/contrib/elftoolchain/libdwarf/dwarf_formblock.3
  head/contrib/elftoolchain/libdwarf/dwarf_formflag.3
  head/contrib/elftoolchain/libdwarf/dwarf_formref.3
  head/contrib/elftoolchain/libdwarf/dwarf_formsig8.3
  head/contrib/elftoolchain/libdwarf/dwarf_formudata.3
  head/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.3
  head/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.3
  head/contrib/elftoolchain/libdwarf/dwarf_get_ranges.3
  head/contrib/elftoolchain/libdwarf/dwarf_hasattr.3
  head/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3
  head/contrib/elftoolchain/libdwarf/dwarf_producer_init.3
  head/contrib/elftoolchain/libdwarf/dwarf_whatattr.3
  head/contrib/elftoolchain/libelf/elf.3
  head/contrib/elftoolchain/libelf/elf_begin.3
  head/contrib/elftoolchain/libelf/elf_cntl.3
  head/contrib/elftoolchain/libelf/elf_getdata.3
  head/contrib/elftoolchain/libelf/elf_open.3
  head/contrib/elftoolchain/libelf/elf_update.c
  head/contrib/elftoolchain/libelf/gelf.3
  head/contrib/elftoolchain/libelftc/elftc_demangle.3
  head/contrib/elftoolchain/libelftc/elftc_symbol_table_create.3
  head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
  head/contrib/elftoolchain/nm/nm.1
  head/contrib/elftoolchain/readelf/readelf.1
  head/contrib/elftoolchain/readelf/readelf.c
  head/contrib/elftoolchain/size/size.1
  head/contrib/elftoolchain/size/size.c
  head/contrib/elftoolchain/strings/strings.1
  head/lib/libelftc/elftc_version.c
Directory Properties:
  head/contrib/elftoolchain/   (props changed)

Modified: head/contrib/elftoolchain/addr2line/addr2line.1
==============================================================================
--- head/contrib/elftoolchain/addr2line/addr2line.1	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/addr2line/addr2line.1	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $Id: addr2line.1 2066 2011-10-26 15:40:28Z jkoshy $
+.\" $Id: addr2line.1 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd July 25, 2010
 .Os
@@ -99,7 +99,7 @@ Print a help message.
 Print a version identifier and exit.
 .El
 .Sh OUTPUT FORMAT
-If the 
+If the
 .Fl f
 option was not specified,
 .Nm
@@ -156,4 +156,4 @@ its source file and line number use:
 The
 .Nm
 utility was written by
-.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
+.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

Modified: head/contrib/elftoolchain/addr2line/addr2line.c
==============================================================================
--- head/contrib/elftoolchain/addr2line/addr2line.c	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/addr2line/addr2line.c	Thu May 14 19:48:15 2015	(r282918)
@@ -39,7 +39,7 @@
 
 #include "_elftc.h"
 
-ELFTC_VCSID("$Id: addr2line.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: addr2line.c 3197 2015-05-12 21:01:31Z emaste $");
 
 static struct option longopts[] = {
 	{"target" , required_argument, NULL, 'b'},
@@ -84,6 +84,44 @@ version(void)
 	exit(0);
 }
 
+/*
+ * Handle DWARF 4 'offset from' DW_AT_high_pc.  Although we don't
+ * fully support DWARF 4, some compilers (like FreeBSD Clang 3.5.1)
+ * generate DW_AT_high_pc as an offset from DW_AT_low_pc.
+ *
+ * "If the value of the DW_AT_high_pc is of class address, it is the
+ * relocated address of the first location past the last instruction
+ * associated with the entity; if it is of class constant, the value
+ * is an unsigned integer offset which when added to the low PC gives
+ * the address of the first location past the last instruction
+ * associated with the entity."
+ *
+ * DWARF4 spec, section 2.17.2.
+ */
+static int
+handle_high_pc(Dwarf_Die die, Dwarf_Unsigned lopc, Dwarf_Unsigned *hipc)
+{
+	Dwarf_Error de;
+	Dwarf_Half form;
+	Dwarf_Attribute at;
+	int ret;
+
+	ret = dwarf_attr(die, DW_AT_high_pc, &at, &de);
+	if (ret == DW_DLV_ERROR) {
+		warnx("dwarf_attr failed: %s", dwarf_errmsg(de));
+		return (ret);
+	}
+	ret = dwarf_whatform(at, &form, &de);
+	if (ret == DW_DLV_ERROR) {
+		warnx("dwarf_whatform failed: %s", dwarf_errmsg(de));
+		return (ret);
+	}
+	if (dwarf_get_form_class(2, 0, 0, form) == DW_FORM_CLASS_CONSTANT)
+		*hipc += lopc;
+
+	return (DW_DLV_OK);
+}
+
 static void
 search_func(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Addr addr,
     const char **rlt_func)
@@ -108,6 +146,8 @@ search_func(Dwarf_Debug dbg, Dwarf_Die d
 		if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc, &de) ||
 		    dwarf_attrval_unsigned(die, DW_AT_high_pc, &hipc, &de))
 			goto cont_search;
+		if (handle_high_pc(die, lopc, &hipc) != DW_DLV_OK)
+			goto cont_search;
 		if (addr < lopc || addr >= hipc)
 			goto cont_search;
 
@@ -202,6 +242,8 @@ translate(Dwarf_Debug dbg, const char* a
 			 * Check if the address falls into the PC range of
 			 * this CU.
 			 */
+			if (handle_high_pc(die, lopc, &hipc) != DW_DLV_OK)
+				continue;
 			if (addr < lopc || addr >= hipc)
 				continue;
 		}

Modified: head/contrib/elftoolchain/common/native-elf-format
==============================================================================
--- head/contrib/elftoolchain/common/native-elf-format	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/common/native-elf-format	Thu May 14 19:48:15 2015	(r282918)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: native-elf-format 3167 2015-02-24 19:10:08Z emaste $
+# $Id: native-elf-format 3186 2015-04-16 22:16:40Z emaste $
 #
 # Find the native ELF format for a host platform by compiling a
 # test object and examining the resulting object.
@@ -33,7 +33,7 @@ $1 ~ "Data:"  {
 $1 ~ "Machine:" {
         if (match($0, "Intel.*386")) {
             elfarch = "EM_386";
-        } else if (match($0, ".*X86-64")) {
+        } else if (match($0, ".*[xX]86-64")) {
             elfarch = "EM_X86_64";
         } else {
             elfarch = "unknown";

Modified: head/contrib/elftoolchain/cxxfilt/c++filt.1
==============================================================================
--- head/contrib/elftoolchain/cxxfilt/c++filt.1	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/cxxfilt/c++filt.1	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $Id: c++filt.1 2175 2011-11-16 05:51:49Z jkoshy $
+.\" $Id: c++filt.1 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd August 24, 2011
 .Os
@@ -106,4 +106,4 @@ and exit.
 The
 .Nm
 utility was written by
-.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
+.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

Modified: head/contrib/elftoolchain/elfcopy/elfcopy.1
==============================================================================
--- head/contrib/elftoolchain/elfcopy/elfcopy.1	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/elfcopy/elfcopy.1	Thu May 14 19:48:15 2015	(r282918)
@@ -21,7 +21,7 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: elfcopy.1 3173 2015-03-27 16:46:13Z emaste $
+.\" $Id: elfcopy.1 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd March 27, 2015
 .Os
@@ -330,4 +330,4 @@ Do not copy symbols that are not needed 
 .Sh HISTORY
 .Nm
 has been implemented by
-.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
+.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

Modified: head/contrib/elftoolchain/elfcopy/sections.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/sections.c	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/elfcopy/sections.c	Thu May 14 19:48:15 2015	(r282918)
@@ -34,7 +34,7 @@
 
 #include "elfcopy.h"
 
-ELFTC_VCSID("$Id: sections.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: sections.c 3185 2015-04-11 08:56:34Z kaiwang27 $");
 
 static void	add_gnu_debuglink(struct elfcopy *ecp);
 static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);
@@ -1223,6 +1223,14 @@ update_shdr(struct elfcopy *ecp, int upd
 		    osh.sh_info != 0)
 			osh.sh_info = ecp->secndx[osh.sh_info];
 
+		/*
+		 * sh_info of SHT_GROUP section needs to point to the correct
+		 * string in the symbol table.
+		 */
+		if (s->type == SHT_GROUP && (ecp->flags & SYMTAB_EXIST) &&
+		    (ecp->flags & SYMTAB_INTACT) == 0)
+			osh.sh_info = ecp->symndx[osh.sh_info];
+
 		if (!gelf_update_shdr(s->os, &osh))
 			errx(EXIT_FAILURE, "gelf_update_shdr() failed: %s",
 			    elf_errmsg(-1));

Modified: head/contrib/elftoolchain/elfcopy/segments.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/segments.c	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/elfcopy/segments.c	Thu May 14 19:48:15 2015	(r282918)
@@ -34,7 +34,7 @@
 
 #include "elfcopy.h"
 
-ELFTC_VCSID("$Id: segments.c 3177 2015-03-30 18:19:41Z emaste $");
+ELFTC_VCSID("$Id: segments.c 3196 2015-05-12 17:33:48Z emaste $");
 
 static void	insert_to_inseg_list(struct segment *seg, struct section *sec);
 
@@ -442,7 +442,7 @@ copy_phdr(struct elfcopy *ecp)
 			s = seg->v_sec[i];
 			seg->msz = s->vma + s->sz - seg->addr;
 			if (s->type != SHT_NOBITS)
-				seg->fsz = seg->msz;
+				seg->fsz = s->off + s->sz - seg->off;
 		}
 	}
 

Modified: head/contrib/elftoolchain/elfcopy/symbols.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/symbols.c	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/elfcopy/symbols.c	Thu May 14 19:48:15 2015	(r282918)
@@ -33,7 +33,7 @@
 
 #include "elfcopy.h"
 
-ELFTC_VCSID("$Id: symbols.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: symbols.c 3191 2015-05-04 17:07:01Z jkoshy $");
 
 /* Symbol table buffer structure. */
 struct symbuf {
@@ -1090,7 +1090,7 @@ str_hash(const char *s)
 {
 	uint32_t hash;
 
-	for (hash = 2166136261; *s; s++)
+	for (hash = 2166136261UL; *s; s++)
 		hash = (hash ^ *s) * 16777619;
 
 	return (hash & (STHASHSIZE - 1));

Modified: head/contrib/elftoolchain/libdwarf/dwarf.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf.3	Thu May 14 19:48:15 2015	(r282918)
@@ -21,7 +21,7 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: dwarf.3 3130 2014-12-21 20:06:29Z jkoshy $
+.\" $Id: dwarf.3 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd December 21, 2014
 .Os
@@ -44,7 +44,7 @@ is defined by the DWARF standard, see
 .Xr dwarf 4 .
 .Pp
 The
-.Xr DWARF 3 
+.Xr DWARF 3
 API has two parts:
 .Bl -bullet
 .It
@@ -349,7 +349,7 @@ Retrieve a debugging information entry g
 .It Fn dwarf_siblingof , Fn dwarf_siblingof_b
 Retrieve the sibling descriptor for a debugging information entry.
 .It Fn dwarf_srclang
-Retrive the source language attribute for a debugging information
+Retrieve the source language attribute for a debugging information
 entry.
 .It Fn dwarf_tag
 Retrieve the tag for a debugging information entry.
@@ -742,12 +742,12 @@ The DWARF standard is defined by
 The DWARF(3) API originated at Silicon Graphics Inc.
 .Pp
 A BSD-licensed implementation of a subset of the API was written by
-.An "John Birrell" Aq jb@FreeBSD.org
+.An John Birrell Aq Mt jb@FreeBSD.org
 for the FreeBSD project.
 The implementation was subsequently revised and completed by
-.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
+.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .
 .Pp
 Manual pages for this implementation were written by
-.An "Joseph Koshy" Aq jkoshy@users.sourceforge.net
+.An Joseph Koshy Aq Mt jkoshy@users.sourceforge.net
 and
-.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
+.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

Modified: head/contrib/elftoolchain/libdwarf/dwarf_add_line_entry.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_add_line_entry.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_add_line_entry.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_add_line_entry.3 2953 2013-06-30 20:21:38Z kaiwang27 $
+.\" $Id: dwarf_add_line_entry.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd June 30, 2013
 .Os
@@ -66,7 +66,8 @@ Valid source file indices are those retu
 .Pp
 Argument
 .Ar off
-specifies a relocatable program address. The ELF symbol to be used
+specifies a relocatable program address.
+The ELF symbol to be used
 for relocation is set by a prior call to the function
 .Xr dwarf_lne_set_address 3 .
 .Pp

Modified: head/contrib/elftoolchain/libdwarf/dwarf_def_macro.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_def_macro.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_def_macro.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_def_macro.3 2122 2011-11-09 15:35:14Z jkoshy $
+.\" $Id: dwarf_def_macro.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd November 9, 2011
 .Os
@@ -72,7 +72,7 @@ Argument
 .Ar value
 should point to a NUL-terminated string containing the value
 of the macro.
-If the macro doesn't have a value, argument
+If the macro does not have a value, argument
 .Ar value
 should be set to NULL.
 .Pp

Modified: head/contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,14 +22,14 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_expand_frame_instructions.3 2122 2011-11-09 15:35:14Z jkoshy $
+.\" $Id: dwarf_expand_frame_instructions.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd November 9, 2011
 .Os
 .Dt DWARF_EXPAND_FRAME_INSTRUCTIONS 3
 .Sh NAME
 .Nm dwarf_expand_frame_instructions
-.Nd expand frame instructions 
+.Nd expand frame instructions
 .Sh LIBRARY
 .Lb libdwarf
 .Sh SYNOPSIS

Modified: head/contrib/elftoolchain/libdwarf/dwarf_formblock.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_formblock.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_formblock.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_formblock.3 2073 2011-10-27 03:30:47Z jkoshy $
+.\" $Id: dwarf_formblock.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd July 23, 2010
 .Os
@@ -69,7 +69,7 @@ the DWARF(3) library.
 The application should not attempt to free this memory
 area.
 Portable code may indicate that the memory area is to be freed by
-by using
+using
 .Xr dwarf_dealloc 3 .
 .Sh RETURN VALUES
 Function

Modified: head/contrib/elftoolchain/libdwarf/dwarf_formflag.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_formflag.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_formflag.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_formflag.3 2073 2011-10-27 03:30:47Z jkoshy $
+.\" $Id: dwarf_formflag.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd June 21, 2010
 .Os
@@ -58,7 +58,7 @@ or
 If argument
 .Ar err
 is not NULL, it will be used to return an error descriptor in case
-of an error. 
+of an error.
 .Sh RETURN VALUES
 Function
 .Fn dwarf_formflag

Modified: head/contrib/elftoolchain/libdwarf/dwarf_formref.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_formref.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_formref.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_formref.3 2073 2011-10-27 03:30:47Z jkoshy $
+.\" $Id: dwarf_formref.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd June 21, 2010
 .Os
@@ -101,7 +101,7 @@ ELF section.
 If argument
 .Ar err
 is not NULL, it will be used to return an error descriptor in case
-of an error. 
+of an error.
 .Sh RETURN VALUES
 These functions return
 .Dv DW_DLV_OK

Modified: head/contrib/elftoolchain/libdwarf/dwarf_formsig8.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_formsig8.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_formsig8.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_formsig8.3 2073 2011-10-27 03:30:47Z jkoshy $
+.\" $Id: dwarf_formsig8.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd July 24, 2010
 .Os
@@ -56,7 +56,7 @@ must be
 If argument
 .Ar err
 is not NULL, it will be used to return an error descriptor in case
-of an error. 
+of an error.
 .Sh RETURN VALUES
 Function
 .Fn dwarf_formsig8

Modified: head/contrib/elftoolchain/libdwarf/dwarf_formudata.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_formudata.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_formudata.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_formudata.3 2073 2011-10-27 03:30:47Z jkoshy $
+.\" $Id: dwarf_formudata.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd June 21, 2010
 .Os
@@ -88,7 +88,7 @@ and
 If argument
 .Ar err
 is not NULL, it will be used to return an error descriptor in case
-of an error. 
+of an error.
 .Sh RETURN VALUES
 These functions return
 .Dv DW_DLV_OK

Modified: head/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_get_fde_info_for_all_regs.3 2071 2011-10-27 03:20:00Z jkoshy $
+.\" $Id: dwarf_get_fde_info_for_all_regs.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd June 4, 2011
 .Os
@@ -90,7 +90,8 @@ typedef struct {
 For each of the register rules returned,
 the
 .Va dw_offset_relevant
-field is set to 1 if the register rule has a offset value. The
+field is set to 1 if the register rule has a offset value.
+The
 .Va dw_regnum
 field is set to the register number associated with the regsiter rule.
 The

Modified: head/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_get_fde_info_for_reg.3 2071 2011-10-27 03:20:00Z jkoshy $
+.\" $Id: dwarf_get_fde_info_for_reg.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd June 4, 2011
 .Os
@@ -99,7 +99,7 @@ counter address associated with the regi
 If argument
 .Ar err
 is not NULL, it will be used to return an error descriptor in case
-of an error. 
+of an error.
 .Ss COMPATIBILITY
 Function
 .Fn dwarf_get_fde_info_for_reg

Modified: head/contrib/elftoolchain/libdwarf/dwarf_get_ranges.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_get_ranges.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_get_ranges.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_get_ranges.3 2122 2011-11-09 15:35:14Z jkoshy $
+.\" $Id: dwarf_get_ranges.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd November 9, 2011
 .Os
@@ -137,7 +137,7 @@ For this type of entry, the field
 .Va dwr_addr1
 is the value of the largest representable address offset, and
 .Va dwr_addr2
-is a base address for the begining and ending address offsets of
+is a base address for the beginning and ending address offsets of
 subsequent address range entries in the list.
 .It Dv DW_RANGES_END
 An end of list mark.

Modified: head/contrib/elftoolchain/libdwarf/dwarf_hasattr.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_hasattr.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_hasattr.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_hasattr.3 3142 2015-01-29 23:11:14Z jkoshy $
+.\" $Id: dwarf_hasattr.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd April 17, 2010
 .Os
@@ -64,7 +64,7 @@ If the named attribute is not present, a
 If argument
 .Ar err
 is not NULL, it will be used to return an error descriptor in case
-of an error. 
+of an error.
 .Sh RETURN VALUES
 On success, function
 .Fn dwarf_hasattr

Modified: head/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_next_cu_header.3 3128 2014-12-21 20:06:22Z jkoshy $
+.\" $Id: dwarf_next_cu_header.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd December 21, 2014
 .Os
@@ -220,8 +220,7 @@ unit in the section.
 .Ss Iterating Through Type Units in a Debug Context
 When a DWARF debug context is allocated using
 .Xr dwarf_init 3 ,
-an internal pointer assoicated with the context will point to the
-fisrt
+an internal pointer associated with the context will point to the first
 .Dq \&.debug_types
 section found in the debug object.
 The first call to function

Modified: head/contrib/elftoolchain/libdwarf/dwarf_producer_init.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_producer_init.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_producer_init.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_producer_init.3 2074 2011-10-27 03:34:33Z jkoshy $
+.\" $Id: dwarf_producer_init.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd August 20, 2011
 .Os
@@ -58,7 +58,7 @@ descriptor representing a DWARF producer
 .Pp
 The argument
 .Ar errhand
-should contain the adddress of a function to be called in case of an
+should contain the address of a function to be called in case of an
 error.
 If this argument is
 .Dv NULL ,

Modified: head/contrib/elftoolchain/libdwarf/dwarf_whatattr.3
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_whatattr.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libdwarf/dwarf_whatattr.3	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: dwarf_whatattr.3 3142 2015-01-29 23:11:14Z jkoshy $
+.\" $Id: dwarf_whatattr.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd May 22, 2010
 .Os
@@ -51,7 +51,7 @@ and writes it to the location pointed to
 If argument
 .Ar err
 is not NULL, it will be used to return an error descriptor in case
-of an error. 
+of an error.
 .Sh RETURN VALUES
 On success, function
 .Fn dwarf_whatattr

Modified: head/contrib/elftoolchain/libelf/elf.3
==============================================================================
--- head/contrib/elftoolchain/libelf/elf.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelf/elf.3	Thu May 14 19:48:15 2015	(r282918)
@@ -21,7 +21,7 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: elf.3 3142 2015-01-29 23:11:14Z jkoshy $
+.\" $Id: elf.3 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd July 28, 2014
 .Os
@@ -555,7 +555,7 @@ flag on an ELF descriptor using
 .Xr elf_flagelf 3 ,
 following which the library will use the data offsets and alignments
 specified by the application when laying out the file.
-Application control of file layout is described further in the 
+Application control of file layout is described further in the
 .Xr elf_update 3
 manual page.
 .Pp
@@ -608,5 +608,4 @@ The current implementation of the ELF(3)
 .Fx 7.0 .
 .Sh AUTHORS
 The ELF library was written by
-.An "Joseph Koshy"
-.Aq jkoshy@FreeBSD.org .
+.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org .

Modified: head/contrib/elftoolchain/libelf/elf_begin.3
==============================================================================
--- head/contrib/elftoolchain/libelf/elf_begin.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelf/elf_begin.3	Thu May 14 19:48:15 2015	(r282918)
@@ -21,7 +21,7 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: elf_begin.3 2313 2011-12-11 06:19:24Z jkoshy $ 
+.\" $Id: elf_begin.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd December 11, 2011
 .Os
@@ -272,7 +272,7 @@ was created.
 .It Bq Er ELF_E_ARGUMENT
 An
 .Xr ar 1
-archive was opened with with
+archive was opened with
 .Ar cmd
 set to
 .Dv ELF_C_RDWR .

Modified: head/contrib/elftoolchain/libelf/elf_cntl.3
==============================================================================
--- head/contrib/elftoolchain/libelf/elf_cntl.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelf/elf_cntl.3	Thu May 14 19:48:15 2015	(r282918)
@@ -21,7 +21,7 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: elf_cntl.3 289 2009-01-08 08:26:08Z jkoshy $ 
+.\" $Id: elf_cntl.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd August 9, 2006
 .Os

Modified: head/contrib/elftoolchain/libelf/elf_getdata.3
==============================================================================
--- head/contrib/elftoolchain/libelf/elf_getdata.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelf/elf_getdata.3	Thu May 14 19:48:15 2015	(r282918)
@@ -21,7 +21,7 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: elf_getdata.3 1766 2011-08-22 06:01:03Z jkoshy $
+.\" $Id: elf_getdata.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd January 26, 2011
 .Os
@@ -174,7 +174,7 @@ These functions return a valid pointer t
 NULL if an error occurs.
 .Sh ERRORS
 These functions may fail with the following errors:
-.Bl -tag -width "[ELF_E_RESOURCE]" 
+.Bl -tag -width "[ELF_E_RESOURCE]"
 .It Bq Er ELF_E_ARGUMENT
 Either of the arguments
 .Ar scn

Modified: head/contrib/elftoolchain/libelf/elf_open.3
==============================================================================
--- head/contrib/elftoolchain/libelf/elf_open.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelf/elf_open.3	Thu May 14 19:48:15 2015	(r282918)
@@ -21,11 +21,11 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: elf_open.3 2512 2012-05-31 06:15:57Z jkoshy $ 
+.\" $Id: elf_open.3 3181 2015-04-10 13:22:51Z emaste $
 .\"
 .Dd May 31, 2012
 .Os
-.Dt ELF_OPEN 3 
+.Dt ELF_OPEN 3
 .Sh NAME
 .Nm elf_open
 .Nd open ELF objects and ar(1) archives

Modified: head/contrib/elftoolchain/libelf/elf_update.c
==============================================================================
--- head/contrib/elftoolchain/libelf/elf_update.c	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelf/elf_update.c	Thu May 14 19:48:15 2015	(r282918)
@@ -41,7 +41,7 @@
 #include <sys/mman.h>
 #endif
 
-ELFTC_VCSID("$Id: elf_update.c 3013 2014-03-23 06:16:59Z jkoshy $");
+ELFTC_VCSID("$Id: elf_update.c 3190 2015-05-04 15:23:08Z jkoshy $");
 
 /*
  * Layout strategy:
@@ -271,8 +271,10 @@ _libelf_compute_section_extents(Elf *e, 
 	 * offsets and alignment for sanity.
 	 */
 	if (e->e_flags & ELF_F_LAYOUT) {
-		if (scn_alignment > sh_align || sh_offset % sh_align ||
-		    sh_size < scn_size) {
+		if (scn_alignment > sh_align ||
+		    sh_offset % sh_align ||
+		    sh_size < scn_size ||
+		    sh_offset % _libelf_falign(elftype, ec)) {
 			LIBELF_SET_ERROR(LAYOUT, 0);
 			return (0);
 		}

Modified: head/contrib/elftoolchain/libelf/gelf.3
==============================================================================
--- head/contrib/elftoolchain/libelf/gelf.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelf/gelf.3	Thu May 14 19:48:15 2015	(r282918)
@@ -21,7 +21,7 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: gelf.3 189 2008-07-20 10:38:08Z jkoshy $
+.\" $Id: gelf.3 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd September 1, 2006
 .Os
@@ -197,5 +197,4 @@ This implementation of the API first app
 .Fx 7.0 .
 .Sh AUTHORS
 The GElf API was implemented by
-.An "Joseph Koshy"
-.Aq jkoshy@FreeBSD.org .
+.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org .

Modified: head/contrib/elftoolchain/libelftc/elftc_demangle.3
==============================================================================
--- head/contrib/elftoolchain/libelftc/elftc_demangle.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelftc/elftc_demangle.3	Thu May 14 19:48:15 2015	(r282918)
@@ -21,7 +21,7 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: elftc_demangle.3 2065 2011-10-26 15:24:47Z jkoshy $
+.\" $Id: elftc_demangle.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd August 24, 2011
 .Os
@@ -88,7 +88,7 @@ To decode a name that uses an unknown en
 .Bd -literal -offset indent
 char buffer[1024];
 const char *funcname;
-	
+
 funcname = ...; /* points to string to be demangled */
 if (elftc_demangle(funcname, buffer, sizeof(buffer), 0) == 0)
 	printf("Demangled name: %\\n", buffer);

Modified: head/contrib/elftoolchain/libelftc/elftc_symbol_table_create.3
==============================================================================
--- head/contrib/elftoolchain/libelftc/elftc_symbol_table_create.3	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelftc/elftc_symbol_table_create.3	Thu May 14 19:48:15 2015	(r282918)
@@ -21,7 +21,7 @@
 .\" out of the use of this software, even if advised of the possibility of
 .\" such damage.
 .\"
-.\" $Id: elftc_symbol_table_create.3 2825 2012-12-29 14:25:33Z jkoshy $
+.\" $Id: elftc_symbol_table_create.3 3182 2015-04-10 16:08:10Z emaste $
 .\"
 .Dd December 29, 2012
 .Os
@@ -224,7 +224,7 @@ should point to a location that will be 
 the following values:
 .Bl -tag -width indent -compact -offset indent
 .It Dv ELFTC_INSERT_ERROR
-An error occured during insertion of the symbol.
+An error occurred during insertion of the symbol.
 .It Dv ELFTC_INSERT_EXISTING
 The name in argument
 .Ar symbolname

Modified: head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
==============================================================================
--- head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c	Thu May 14 19:48:15 2015	(r282918)
@@ -36,7 +36,7 @@
 
 #include "_libelftc.h"
 
-ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3123 2014-12-21 05:46:19Z kaiwang27 $");
+ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3194 2015-05-05 17:55:16Z emaste $");
 
 /**
  * @file cpp_demangle.c
@@ -316,7 +316,7 @@ cpp_demangle_push_fp(struct cpp_demangle
 
 	rtn = 0;
 	if ((len = strlen(f)) > 0)
-	    rtn = cpp_demangle_push_str(ddata, f, len);
+		rtn = cpp_demangle_push_str(ddata, f, len);
 
 	free(f);
 

Modified: head/contrib/elftoolchain/nm/nm.1
==============================================================================
--- head/contrib/elftoolchain/nm/nm.1	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/nm/nm.1	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $Id: nm.1 3145 2015-02-15 18:04:37Z emaste $
+.\" $Id: nm.1 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd February 15, 2015
 .Os
@@ -335,4 +335,4 @@ were specified.
 The
 .Nm
 utility and this manual page were written by
-.An Hyogeol Lee Aq hyogeollee@gmail.com .
+.An Hyogeol Lee Aq Mt hyogeollee@gmail.com .

Modified: head/contrib/elftoolchain/readelf/readelf.1
==============================================================================
--- head/contrib/elftoolchain/readelf/readelf.1	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/readelf/readelf.1	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $Id: readelf.1 3059 2014-06-02 00:42:32Z kaiwang27 $
+.\" $Id: readelf.1 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd September 13, 2012
 .Os
@@ -194,4 +194,4 @@ separate lines.
 The
 .Nm
 utility was written by
-.An "Kai Wang" Aq kaiwang27@users.sourceforge.net .
+.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .

Modified: head/contrib/elftoolchain/readelf/readelf.c
==============================================================================
--- head/contrib/elftoolchain/readelf/readelf.c	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/readelf/readelf.c	Thu May 14 19:48:15 2015	(r282918)
@@ -46,7 +46,7 @@
 
 #include "_elftc.h"
 
-ELFTC_VCSID("$Id: readelf.c 3178 2015-03-30 18:29:13Z emaste $");
+ELFTC_VCSID("$Id: readelf.c 3189 2015-04-20 17:02:01Z emaste $");
 
 /*
  * readelf(1) options.
@@ -2673,7 +2673,7 @@ dump_phdr(struct readelf *re)
 {
 	const char	*rawfile;
 	GElf_Phdr	 phdr;
-	size_t		 phnum;
+	size_t		 phnum, size;
 	int		 i, j;
 
 #define	PH_HDR	"Type", "Offset", "VirtAddr", "PhysAddr", "FileSiz",	\
@@ -2726,10 +2726,14 @@ dump_phdr(struct readelf *re)
 			    "                 0x%16.16jx 0x%16.16jx  %c%c%c"
 			    "    %#jx\n", PH_CT);
 		if (phdr.p_type == PT_INTERP) {
-			if ((rawfile = elf_rawfile(re->elf, NULL)) == NULL) {
+			if ((rawfile = elf_rawfile(re->elf, &size)) == NULL) {
 				warnx("elf_rawfile failed: %s", elf_errmsg(-1));
 				continue;
 			}
+			if (phdr.p_offset >= size) {
+				warnx("invalid program header offset");
+				continue;
+			}
 			printf("      [Requesting program interpreter: %s]\n",
 				rawfile + phdr.p_offset);
 		}
@@ -4378,13 +4382,22 @@ dump_mips_options(struct readelf *re, st
 	p = d->d_buf;
 	pe = p + d->d_size;
 	while (p < pe) {
+		if (pe - p < 8) {
+			warnx("Truncated MIPS option header");
+			return;
+		}
 		kind = re->dw_decode(&p, 1);
 		size = re->dw_decode(&p, 1);
 		sndx = re->dw_decode(&p, 2);
 		info = re->dw_decode(&p, 4);
+		if (size < 8 || size - 8 > pe - p) {
+			warnx("Malformed MIPS option header");
+			return;
+		}
+		size -= 8;
 		switch (kind) {
 		case ODK_REGINFO:
-			dump_mips_odk_reginfo(re, p, size - 8);
+			dump_mips_odk_reginfo(re, p, size);
 			break;
 		case ODK_EXCEPTIONS:
 			printf(" EXCEPTIONS FPU_MIN: %#x\n",
@@ -4435,7 +4448,7 @@ dump_mips_options(struct readelf *re, st
 		default:
 			break;
 		}
-		p += size - 8;
+		p += size;
 	}
 }
 
@@ -7458,11 +7471,10 @@ main(int argc, char **argv)
 		errx(EXIT_FAILURE, "ELF library initialization failed: %s",
 		    elf_errmsg(-1));
 
-	for (i = 0; i < argc; i++)
-		if (argv[i] != NULL) {
-			re->filename = argv[i];
-			dump_object(re);
-		}
+	for (i = 0; i < argc; i++) {
+		re->filename = argv[i];
+		dump_object(re);
+	}
 
 	exit(EXIT_SUCCESS);
 }

Modified: head/contrib/elftoolchain/size/size.1
==============================================================================
--- head/contrib/elftoolchain/size/size.1	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/size/size.1	Thu May 14 19:48:15 2015	(r282918)
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: size.1 2043 2011-10-23 14:49:16Z jkoshy $
+.\" $Id: size.1 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd August 25, 2011
 .Dt SIZE 1
@@ -252,6 +252,6 @@ utility first appeared in
 The
 .Nm
 utility was re-written by
-.An S. Sam Arun Raj Aq samarunraj@gmail.com
+.An S. Sam Arun Raj Aq Mt samarunraj@gmail.com
 This manual page was written by
-.An S. Sam Arun Raj Aq samarunraj@gmail.com
+.An S. Sam Arun Raj Aq Mt samarunraj@gmail.com

Modified: head/contrib/elftoolchain/size/size.c
==============================================================================
--- head/contrib/elftoolchain/size/size.c	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/size/size.c	Thu May 14 19:48:15 2015	(r282918)
@@ -38,7 +38,7 @@
 
 #include "_elftc.h"
 
-ELFTC_VCSID("$Id: size.c 3174 2015-03-27 17:13:41Z emaste $");
+ELFTC_VCSID("$Id: size.c 3183 2015-04-10 16:18:42Z emaste $");
 
 #define	BUF_SIZE			1024
 #define	ELF_ALIGN(val,x) (((val)+(x)-1) & ~((x)-1))
@@ -604,7 +604,7 @@ handle_elf(char const *name)
 			    arhdr->ar_name);
 			continue;
 		}
-		/* Core dumps are handled seperately */
+		/* Core dumps are handled separately */
 		if (elfhdr.e_shnum == 0 && elfhdr.e_type == ET_CORE) {
 			exit_code = handle_core(name, elf, &elfhdr);
 			(void) elf_end(elf);

Modified: head/contrib/elftoolchain/strings/strings.1
==============================================================================
--- head/contrib/elftoolchain/strings/strings.1	Thu May 14 19:32:13 2015	(r282917)
+++ head/contrib/elftoolchain/strings/strings.1	Thu May 14 19:48:15 2015	(r282918)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: strings.1 2352 2011-12-19 11:21:10Z jkoshy $
+.\" $Id: strings.1 3195 2015-05-12 17:22:19Z emaste $
 .\"
 .Dd December 19, 2011
 .Dt STRINGS 1
@@ -157,6 +157,6 @@ when i386-only a.out format was dropped 
 The
 .Nm
 utility was re-written by
-.An S.Sam Arun Raj Aq samarunraj@gmail.com .
+.An S.Sam Arun Raj Aq Mt samarunraj@gmail.com .
 This manual page was written by
-.An S.Sam Arun Raj Aq samarunraj@gmail.com .
+.An S.Sam Arun Raj Aq Mt samarunraj@gmail.com .

Modified: head/lib/libelftc/elftc_version.c
==============================================================================
--- head/lib/libelftc/elftc_version.c	Thu May 14 19:32:13 2015	(r282917)
+++ head/lib/libelftc/elftc_version.c	Thu May 14 19:48:15 2015	(r282918)
@@ -6,5 +6,5 @@
 const char *
 elftc_version(void)
 {
-	return "elftoolchain r3179M";
+	return "elftoolchain r3197M";
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505141948.t4EJmGC7013754>