Skip to content

Commit

Permalink
write/elf: don't write empty strtab
Browse files Browse the repository at this point in the history
If there were no strings, we were writing a strtab section header,
but not writing any data for the section.
  • Loading branch information
philipc committed Jul 23, 2024
1 parent fd84037 commit 07b8c23
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/write/elf/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,12 @@ impl<'a> Object<'a> {
writer.reserve_symtab();
if writer.symtab_shndx_needed() {
writer.reserve_symtab_shndx_section_index();
writer.reserve_symtab_shndx();
}
if writer.strtab_needed() {
writer.reserve_strtab_section_index();
writer.reserve_strtab();
}
writer.reserve_symtab_shndx();
writer.reserve_strtab_section_index();
writer.reserve_strtab();

// Calculate size of relocations.
for (index, section) in self.sections.iter().enumerate() {
Expand Down

0 comments on commit 07b8c23

Please sign in to comment.