Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Dec 2014 16:31:10 +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: r276061 - head/contrib/elftoolchain/elfcopy
Message-ID:  <201412221631.sBMGVAJM022757@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Mon Dec 22 16:31:09 2014
New Revision: 276061
URL: https://svnweb.freebsd.org/changeset/base/276061

Log:
  Set up default shstrtab entries at shstrtab initialization
  
  Instead of waiting until the addition of the first non-default entry.
  This fixes a segfault when strip(1) is asked to remove every section from
  an object file.
  
  Upstream elftoolchain ticket 463
  
  Reviewed by:	imp
  Sponsored by:	The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D1341

Modified:
  head/contrib/elftoolchain/elfcopy/sections.c

Modified: head/contrib/elftoolchain/elfcopy/sections.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/sections.c	Mon Dec 22 16:29:15 2014	(r276060)
+++ head/contrib/elftoolchain/elfcopy/sections.c	Mon Dec 22 16:31:09 2014	(r276061)
@@ -1139,12 +1139,6 @@ add_to_shstrtab(struct elfcopy *ecp, con
 	struct section *s;
 
 	s = ecp->shstrtab;
-	if (s->buf == NULL) {
-		insert_to_strtab(s, "");
-		insert_to_strtab(s, ".symtab");
-		insert_to_strtab(s, ".strtab");
-		insert_to_strtab(s, ".shstrtab");
-	}
 	insert_to_strtab(s, name);
 }
 
@@ -1206,6 +1200,11 @@ init_shstrtab(struct elfcopy *ecp)
 	s->loadable = 0;
 	s->type = SHT_STRTAB;
 	s->vma = 0;
+
+	insert_to_strtab(s, "");
+	insert_to_strtab(s, ".symtab");
+	insert_to_strtab(s, ".strtab");
+	insert_to_strtab(s, ".shstrtab");
 }
 
 void



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