Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jun 2015 14:24:32 +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: r284339 - head/contrib/elftoolchain/elfcopy
Message-ID:  <201506131424.t5DEOWW7075275@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Sat Jun 13 14:24:31 2015
New Revision: 284339
URL: https://svnweb.freebsd.org/changeset/base/284339

Log:
  elfcopy: Handle objects without a ".shstrtab" section string table
  
  As of LLVM revision 238073, LLVM stores symbols and section names in
  the same string table.  From the upstream commit mesage:
  
    With the scheme of naming sections like ".text.foo" where foo is a
    symbol, there is a big potential saving in using a single one.
  
  This is a cherry-pick of ELF Tool Chain revision 3225.
  
  Sponsored by:	The FreeBSD Foundation

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

Modified: head/contrib/elftoolchain/elfcopy/sections.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/sections.c	Sat Jun 13 07:31:50 2015	(r284338)
+++ head/contrib/elftoolchain/elfcopy/sections.c	Sat Jun 13 14:24:31 2015	(r284339)
@@ -1349,6 +1349,14 @@ set_shstrtab(struct elfcopy *ecp)
 
 	s = ecp->shstrtab;
 
+	if (s->os == NULL) {
+		/* Input object does not contain .shstrtab section */
+		if ((s->os = elf_newscn(ecp->eout)) == NULL)
+			errx(EXIT_FAILURE, "elf_newscn failed: %s",
+			    elf_errmsg(-1));
+		insert_to_sec_list(ecp, s, 1);
+	}
+
 	if (gelf_getshdr(s->os, &sh) == NULL)
 		errx(EXIT_FAILURE, "692 gelf_getshdr() failed: %s",
 		    elf_errmsg(-1));



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