summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain/elfcopy
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-06-13 14:24:31 +0000
committeremaste <emaste@FreeBSD.org>2015-06-13 14:24:31 +0000
commit9d2a9401e66e5e2fff78d0a246f2c2a564c56ed8 (patch)
tree295900a385c4db5d24870b663ee541bf3e70258b /contrib/elftoolchain/elfcopy
parent77a3f16a9762f3efba549cedd477734a0d77badd (diff)
downloadFreeBSD-src-9d2a9401e66e5e2fff78d0a246f2c2a564c56ed8.zip
FreeBSD-src-9d2a9401e66e5e2fff78d0a246f2c2a564c56ed8.tar.gz
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
Diffstat (limited to 'contrib/elftoolchain/elfcopy')
-rw-r--r--contrib/elftoolchain/elfcopy/sections.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/elftoolchain/elfcopy/sections.c b/contrib/elftoolchain/elfcopy/sections.c
index a407a42..a6fd25d 100644
--- a/contrib/elftoolchain/elfcopy/sections.c
+++ b/contrib/elftoolchain/elfcopy/sections.c
@@ -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));
OpenPOWER on IntegriCloud