Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150030234
D20544.id59063.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D20544.id59063.diff
View Options
Index: head/contrib/elftoolchain/elfcopy/sections.c
===================================================================
--- head/contrib/elftoolchain/elfcopy/sections.c
+++ head/contrib/elftoolchain/elfcopy/sections.c
@@ -1398,8 +1398,24 @@
void
init_shstrtab(struct elfcopy *ecp)
{
+ Elf_Scn *shstrtab;
+ GElf_Shdr shdr;
struct section *s;
+ size_t indx, sizehint;
+ if (elf_getshstrndx(ecp->ein, &indx) != 0) {
+ shstrtab = elf_getscn(ecp->ein, indx);
+ if (shstrtab == NULL)
+ errx(EXIT_FAILURE, "elf_getscn failed: %s",
+ elf_errmsg(-1));
+ if (gelf_getshdr(shstrtab, &shdr) != &shdr)
+ errx(EXIT_FAILURE, "gelf_getshdr failed: %s",
+ elf_errmsg(-1));
+ sizehint = shdr.sh_size;
+ } else {
+ sizehint = 0;
+ }
+
if ((ecp->shstrtab = calloc(1, sizeof(*ecp->shstrtab))) == NULL)
err(EXIT_FAILURE, "calloc failed");
s = ecp->shstrtab;
@@ -1410,7 +1426,7 @@
s->loadable = 0;
s->type = SHT_STRTAB;
s->vma = 0;
- s->strtab = elftc_string_table_create(0);
+ s->strtab = elftc_string_table_create(sizehint);
add_to_shstrtab(ecp, "");
add_to_shstrtab(ecp, ".symtab");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 29, 9:02 PM (46 m, 18 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30554575
Default Alt Text
D20544.id59063.diff (1 KB)
Attached To
Mode
D20544: strip: Provide a size hint when creating the string table.
Attached
Detach File
Event Timeline
Log In to Comment