| ... | @@ -181,6 +181,43 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi | ... | @@ -181,6 +181,43 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi |
| 181 | const pt: Zcu.PerThread = .{ .zcu = elf_file.base.comp.module.?, .tid = tid }; | 181 | const pt: Zcu.PerThread = .{ .zcu = elf_file.base.comp.module.?, .tid = tid }; |
| 182 | try dwarf.flushModule(pt); | 182 | try dwarf.flushModule(pt); |
| 183 | | 183 | |
| | 184 | // TODO invert this logic so that we manage the output section with the atom, not the |
| | 185 | // other way around |
| | 186 | for ([_]u32{ |
| | 187 | self.debug_info_index.?, |
| | 188 | self.debug_abbrev_index.?, |
| | 189 | self.debug_str_index.?, |
| | 190 | self.debug_aranges_index.?, |
| | 191 | self.debug_line_index.?, |
| | 192 | self.debug_line_str_index.?, |
| | 193 | self.debug_loclists_index.?, |
| | 194 | self.debug_rnglists_index.?, |
| | 195 | }, [_]Dwarf.Section{ |
| | 196 | dwarf.debug_info.section, |
| | 197 | dwarf.debug_abbrev.section, |
| | 198 | dwarf.debug_str.section, |
| | 199 | dwarf.debug_aranges.section, |
| | 200 | dwarf.debug_line.section, |
| | 201 | dwarf.debug_line_str.section, |
| | 202 | dwarf.debug_loclists.section, |
| | 203 | dwarf.debug_rnglists.section, |
| | 204 | }) |sym_index, sect| { |
| | 205 | const sym = self.symbol(sym_index); |
| | 206 | const atom_ptr = self.atom(sym.ref.index).?; |
| | 207 | if (!atom_ptr.alive) continue; |
| | 208 | const shdr = elf_file.shdrs.items[sym.outputShndx(elf_file).?]; |
| | 209 | const esym = &self.symtab.items(.elf_sym)[sym.esym_index]; |
| | 210 | esym.st_size = shdr.sh_size; |
| | 211 | atom_ptr.size = shdr.sh_size; |
| | 212 | atom_ptr.alignment = Atom.Alignment.fromNonzeroByteUnits(shdr.sh_addralign); |
| | 213 | |
| | 214 | const relocs = &self.relocs.items[atom_ptr.relocsShndx().?]; |
| | 215 | _ = relocs; |
| | 216 | for (sect.units.items) |unit| { |
| | 217 | _ = unit; |
| | 218 | } |
| | 219 | } |
| | 220 | |
| 184 | self.debug_abbrev_section_dirty = false; | 221 | self.debug_abbrev_section_dirty = false; |
| 185 | self.debug_aranges_section_dirty = false; | 222 | self.debug_aranges_section_dirty = false; |
| 186 | self.debug_rnglists_section_dirty = false; | 223 | self.debug_rnglists_section_dirty = false; |