summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain/elfcopy/sections.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/elftoolchain/elfcopy/sections.c')
-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