| ... | @@ -246,11 +246,11 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi | ... | @@ -246,11 +246,11 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi |
| 246 | .@"32" => .@"32", | 246 | .@"32" => .@"32", |
| 247 | .@"64" => .@"64", | 247 | .@"64" => .@"64", |
| 248 | }; | 248 | }; |
| 249 | log.debug(" {s} <- r_off={x}, r_add={x}, r_type={s}", .{ | 249 | log.debug(" {s} <- r_off={x}, r_add={x}, r_type={}", .{ |
| 250 | self.symbol(target_sym_index).name(elf_file), | 250 | self.symbol(target_sym_index).name(elf_file), |
| 251 | r_offset, | 251 | r_offset, |
| 252 | r_addend, | 252 | r_addend, |
| 253 | @tagName(r_type), | 253 | relocation.fmtRelocType(@intFromEnum(r_type), elf_file.getTarget().cpu.arch), |
| 254 | }); | 254 | }); |
| 255 | atom_ptr.addRelocAssumeCapacity(.{ | 255 | atom_ptr.addRelocAssumeCapacity(.{ |
| 256 | .r_offset = r_offset, | 256 | .r_offset = r_offset, |
| ... | @@ -261,18 +261,19 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi | ... | @@ -261,18 +261,19 @@ pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !voi |
| 261 | | 261 | |
| 262 | try relocs.ensureUnusedCapacity(gpa, unit.external_relocs.items.len); | 262 | try relocs.ensureUnusedCapacity(gpa, unit.external_relocs.items.len); |
| 263 | for (unit.external_relocs.items) |reloc| { | 263 | for (unit.external_relocs.items) |reloc| { |
| | 264 | const target_sym = self.symbol(reloc.target_sym); |
| 264 | const r_offset = unit.off + unit.header_len + unit.getEntry(reloc.source_entry).off + reloc.source_off; | 265 | const r_offset = unit.off + unit.header_len + unit.getEntry(reloc.source_entry).off + reloc.source_off; |
| 265 | const r_addend: i64 = @intCast(reloc.target_off); | 266 | const r_addend: i64 = @intCast(reloc.target_off); |
| 266 | const r_type: elf.R_X86_64 = switch (dwarf.address_size) { | 267 | const r_type: elf.R_X86_64 = switch (dwarf.address_size) { |
| 267 | .@"32" => .@"32", | 268 | .@"32" => if (target_sym.flags.is_tls) .DTPOFF32 else .@"32", |
| 268 | .@"64" => .@"64", | 269 | .@"64" => if (target_sym.flags.is_tls) .DTPOFF64 else .@"64", |
| 269 | else => unreachable, | 270 | else => unreachable, |
| 270 | }; | 271 | }; |
| 271 | log.debug(" {s} <- r_off={x}, r_add={x}, r_type={s}", .{ | 272 | log.debug(" {s} <- r_off={x}, r_add={x}, r_type={}", .{ |
| 272 | self.symbol(reloc.target_sym).name(elf_file), | 273 | target_sym.name(elf_file), |
| 273 | r_offset, | 274 | r_offset, |
| 274 | r_addend, | 275 | r_addend, |
| 275 | @tagName(r_type), | 276 | relocation.fmtRelocType(@intFromEnum(r_type), elf_file.getTarget().cpu.arch), |
| 276 | }); | 277 | }); |
| 277 | atom_ptr.addRelocAssumeCapacity(.{ | 278 | atom_ptr.addRelocAssumeCapacity(.{ |
| 278 | .r_offset = r_offset, | 279 | .r_offset = r_offset, |