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
This commit is contained in:
parent
a59806b252
commit
9ef62fdb87
@ -1139,12 +1139,6 @@ add_to_shstrtab(struct elfcopy *ecp, const char *name)
|
|||||||
struct section *s;
|
struct section *s;
|
||||||
|
|
||||||
s = ecp->shstrtab;
|
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);
|
insert_to_strtab(s, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1206,6 +1200,11 @@ init_shstrtab(struct elfcopy *ecp)
|
|||||||
s->loadable = 0;
|
s->loadable = 0;
|
||||||
s->type = SHT_STRTAB;
|
s->type = SHT_STRTAB;
|
||||||
s->vma = 0;
|
s->vma = 0;
|
||||||
|
|
||||||
|
insert_to_strtab(s, "");
|
||||||
|
insert_to_strtab(s, ".symtab");
|
||||||
|
insert_to_strtab(s, ".strtab");
|
||||||
|
insert_to_strtab(s, ".shstrtab");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user