| author | |
| committer | |
| log | e675af06984d0709d308e3faf60b33cadadf2bbf |
| tree | 02f4ecea2131478f58688cff124e4e88182263d9 |
| parent | d7032705456a67cebeb17ad09a11e10d13f5fb21 |
Otherwise, we were risking having strtab zero-sized and overlap
with another section.2 files changed, 3 insertions(+), 1 deletions(-)
src/link/Elf.zig+2-1| ... | @@ -756,10 +756,11 @@ pub fn populateMissingMetadata(self: *Elf) !void { | ... | @@ -756,10 +756,11 @@ pub fn populateMissingMetadata(self: *Elf) !void { |
| 756 | try self.writeSymbol(0); | 756 | try self.writeSymbol(0); |
| 757 | } | 757 | } |
| 758 | 758 | ||
| 759 | if (self.dwarf) |dw| { | 759 | if (self.dwarf) |*dw| { |
| 760 | if (self.debug_str_section_index == null) { | 760 | if (self.debug_str_section_index == null) { |
| 761 | self.debug_str_section_index = @intCast(u16, self.sections.items.len); | 761 | self.debug_str_section_index = @intCast(u16, self.sections.items.len); |
| 762 | assert(dw.strtab.items.len == 0); | 762 | assert(dw.strtab.items.len == 0); |
| 763 | try dw.strtab.append(self.base.allocator, 0); | ||
| 763 | try self.sections.append(self.base.allocator, .{ | 764 | try self.sections.append(self.base.allocator, .{ |
| 764 | .sh_name = try self.makeString(".debug_str"), | 765 | .sh_name = try self.makeString(".debug_str"), |
| 765 | .sh_type = elf.SHT_PROGBITS, | 766 | .sh_type = elf.SHT_PROGBITS, |
src/link/MachO/DebugSymbols.zig+1| ... | @@ -83,6 +83,7 @@ pub fn populateMissingMetadata(self: *DebugSymbols) !void { | ... | @@ -83,6 +83,7 @@ pub fn populateMissingMetadata(self: *DebugSymbols) !void { |
| 83 | 83 | ||
| 84 | if (self.debug_str_section_index == null) { | 84 | if (self.debug_str_section_index == null) { |
| 85 | assert(self.dwarf.strtab.items.len == 0); | 85 | assert(self.dwarf.strtab.items.len == 0); |
| 86 | try self.dwarf.strtab.append(self.allocator, 0); | ||
| 86 | self.debug_str_section_index = try self.allocateSection( | 87 | self.debug_str_section_index = try self.allocateSection( |
| 87 | "__debug_str", | 88 | "__debug_str", |
| 88 | @intCast(u32, self.dwarf.strtab.items.len), | 89 | @intCast(u32, self.dwarf.strtab.items.len), |