| ... | @@ -311,11 +311,17 @@ pub fn writeRelocs(self: Atom, elf_file: *Elf, out_relocs: *std.ArrayList(elf.El | ... | @@ -311,11 +311,17 @@ pub fn writeRelocs(self: Atom, elf_file: *Elf, out_relocs: *std.ArrayList(elf.El |
| 311 | else => |r_type| r_type, | 311 | else => |r_type| r_type, |
| 312 | }; | 312 | }; |
| 313 | const r_offset = self.value + rel.r_offset; | 313 | const r_offset = self.value + rel.r_offset; |
| 314 | const r_addend = rel.r_addend; | 314 | var r_addend = rel.r_addend; |
| 315 | const r_sym = switch (target.type(elf_file)) { | 315 | var r_sym: u32 = 0; |
| 316 | elf.STT_SECTION => elf_file.sectionSymbolOutputSymtabIndex(target.outputShndx().?), | 316 | switch (target.type(elf_file)) { |
| 317 | else => target.outputSymtabIndex(elf_file), | 317 | elf.STT_SECTION => { |
| 318 | }; | 318 | r_addend += @intCast(target.value); |
| | 319 | r_sym = elf_file.sectionSymbolOutputSymtabIndex(target.outputShndx().?); |
| | 320 | }, |
| | 321 | else => { |
| | 322 | r_sym = target.outputSymtabIndex(elf_file); |
| | 323 | }, |
| | 324 | } |
| 319 | | 325 | |
| 320 | relocs_log.debug(" {s}: [{x} => {d}({s})] + {x}", .{ | 326 | relocs_log.debug(" {s}: [{x} => {d}({s})] + {x}", .{ |
| 321 | fmtRelocType(r_type), | 327 | fmtRelocType(r_type), |