| ... | @@ -180,6 +180,7 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi | ... | @@ -180,6 +180,7 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi |
| 180 | if (self.dwarf) |*dwarf| { | 180 | if (self.dwarf) |*dwarf| { |
| 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 | try dwarf.resolveRelocs(); |
| 183 | | 184 | |
| 184 | // TODO invert this logic so that we manage the output section with the atom, not the | 185 | // TODO invert this logic so that we manage the output section with the atom, not the |
| 185 | // other way around | 186 | // other way around |
| ... | @@ -213,8 +214,17 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi | ... | @@ -213,8 +214,17 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi |
| 213 | | 214 | |
| 214 | const relocs = &self.relocs.items[atom_ptr.relocsShndx().?]; | 215 | const relocs = &self.relocs.items[atom_ptr.relocsShndx().?]; |
| 215 | _ = relocs; | 216 | _ = relocs; |
| 216 | for (sect.units.items) |unit| { | 217 | for (sect.units.items) |*unit| { |
| 217 | _ = unit; | 218 | for (unit.external_relocs.items) |reloc| { |
| | 219 | const tsym = self.symbol(reloc.target_sym); |
| | 220 | const r_offset = unit.off + unit.header_len + unit.getEntry(reloc.source_entry).off + reloc.source_off; |
| | 221 | const r_addend = reloc.target_off; |
| | 222 | std.debug.print("{s} <- r_off={x}, r_add={x}\n", .{ |
| | 223 | tsym.name(elf_file), |
| | 224 | r_offset, |
| | 225 | r_addend, |
| | 226 | }); |
| | 227 | } |
| 218 | } | 228 | } |
| 219 | } | 229 | } |
| 220 | | 230 | |