| author | |
| committer | |
| log | ba5e64ff6b3e759b83294e5cf940d940c832e13d |
| tree | 8c66a1c488f5c605c16db75739ed267b862527c2 |
| parent | a8af36ab10562e58ba237fa3dcc582228197402b |
Fixes the backend portion of #227983 files changed, 30 insertions(+), 20 deletions(-)
src/arch/x86_64/CodeGen.zig+21-11| ... | @@ -63262,17 +63262,27 @@ fn genSetReg( | ... | @@ -63262,17 +63262,27 @@ fn genSetReg( |
| 63262 | }); | 63262 | }); |
| 63263 | }, | 63263 | }, |
| 63264 | .lea_symbol => |sym_off| switch (self.bin_file.tag) { | 63264 | .lea_symbol => |sym_off| switch (self.bin_file.tag) { |
| 63265 | .elf, .macho => try self.asmRegisterMemory( | 63265 | .elf, .macho => { |
| 63266 | .{ ._, .lea }, | 63266 | try self.asmRegisterMemory( |
| 63267 | dst_reg.to64(), | 63267 | .{ ._, .lea }, |
| 63268 | .{ | 63268 | dst_reg.to64(), |
| 63269 | .base = .{ .reloc = sym_off.sym_index }, | 63269 | .{ |
| 63270 | .mod = .{ .rm = .{ | 63270 | .base = .{ .reloc = sym_off.sym_index }, |
| 63271 | .size = .qword, | 63271 | .mod = .{ .rm = .{ .size = .qword } }, |
| 63272 | .disp = sym_off.off, | 63272 | }, |
| 63273 | } }, | 63273 | ); |
| 63274 | }, | 63274 | if (sym_off.off != 0) try self.asmRegisterMemory( |
| 63275 | ), | 63275 | .{ ._, .lea }, |
| 63276 | dst_reg.to64(), | ||
| 63277 | .{ | ||
| 63278 | .base = .{ .reg = dst_reg.to64() }, | ||
| 63279 | .mod = .{ .rm = .{ | ||
| 63280 | .size = .qword, | ||
| 63281 | .disp = sym_off.off, | ||
| 63282 | } }, | ||
| 63283 | }, | ||
| 63284 | ); | ||
| 63285 | }, | ||
| 63276 | else => return self.fail("TODO emit symbol sequence on {s}", .{ | 63286 | else => return self.fail("TODO emit symbol sequence on {s}", .{ |
| 63277 | @tagName(self.bin_file.tag), | 63287 | @tagName(self.bin_file.tag), |
| 63278 | }), | 63288 | }), |
src/link/Dwarf.zig+5-5| ... | @@ -735,7 +735,7 @@ const Unit = struct { | ... | @@ -735,7 +735,7 @@ const Unit = struct { |
| 735 | try dwarf.resolveReloc( | 735 | try dwarf.resolveReloc( |
| 736 | unit_off + reloc.source_off, | 736 | unit_off + reloc.source_off, |
| 737 | target_unit.off + (if (reloc.target_entry.unwrap()) |target_entry| | 737 | target_unit.off + (if (reloc.target_entry.unwrap()) |target_entry| |
| 738 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(unit, sec, dwarf).off | 738 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(target_unit, sec, dwarf).off |
| 739 | else | 739 | else |
| 740 | 0) + reloc.target_off, | 740 | 0) + reloc.target_off, |
| 741 | dwarf.sectionOffsetBytes(), | 741 | dwarf.sectionOffsetBytes(), |
| ... | @@ -749,7 +749,7 @@ const Unit = struct { | ... | @@ -749,7 +749,7 @@ const Unit = struct { |
| 749 | try dwarf.resolveReloc( | 749 | try dwarf.resolveReloc( |
| 750 | unit_off + reloc.source_off, | 750 | unit_off + reloc.source_off, |
| 751 | target_unit.off + (if (reloc.target_entry.unwrap()) |target_entry| | 751 | target_unit.off + (if (reloc.target_entry.unwrap()) |target_entry| |
| 752 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(unit, sec, dwarf).off | 752 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(target_unit, sec, dwarf).off |
| 753 | else | 753 | else |
| 754 | 0) + reloc.target_off, | 754 | 0) + reloc.target_off, |
| 755 | dwarf.sectionOffsetBytes(), | 755 | dwarf.sectionOffsetBytes(), |
| ... | @@ -1000,7 +1000,7 @@ const Entry = struct { | ... | @@ -1000,7 +1000,7 @@ const Entry = struct { |
| 1000 | try dwarf.resolveReloc( | 1000 | try dwarf.resolveReloc( |
| 1001 | entry_off + reloc.source_off, | 1001 | entry_off + reloc.source_off, |
| 1002 | target_unit.off + (if (reloc.target_entry.unwrap()) |target_entry| | 1002 | target_unit.off + (if (reloc.target_entry.unwrap()) |target_entry| |
| 1003 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(unit, sec, dwarf).off | 1003 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(target_unit, sec, dwarf).off |
| 1004 | else | 1004 | else |
| 1005 | 0) + reloc.target_off, | 1005 | 0) + reloc.target_off, |
| 1006 | dwarf.sectionOffsetBytes(), | 1006 | dwarf.sectionOffsetBytes(), |
| ... | @@ -1014,7 +1014,7 @@ const Entry = struct { | ... | @@ -1014,7 +1014,7 @@ const Entry = struct { |
| 1014 | try dwarf.resolveReloc( | 1014 | try dwarf.resolveReloc( |
| 1015 | entry_off + reloc.source_off, | 1015 | entry_off + reloc.source_off, |
| 1016 | target_unit.off + (if (reloc.target_entry.unwrap()) |target_entry| | 1016 | target_unit.off + (if (reloc.target_entry.unwrap()) |target_entry| |
| 1017 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(unit, sec, dwarf).off | 1017 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(target_unit, sec, dwarf).off |
| 1018 | else | 1018 | else |
| 1019 | 0) + reloc.target_off, | 1019 | 0) + reloc.target_off, |
| 1020 | dwarf.sectionOffsetBytes(), | 1020 | dwarf.sectionOffsetBytes(), |
| ... | @@ -1850,7 +1850,7 @@ pub const WipNav = struct { | ... | @@ -1850,7 +1850,7 @@ pub const WipNav = struct { |
| 1850 | const ty = value.typeOf(zcu); | 1850 | const ty = value.typeOf(zcu); |
| 1851 | if (std.debug.runtime_safety) assert(ty.comptimeOnly(zcu) and try ty.onePossibleValue(wip_nav.pt) == null); | 1851 | if (std.debug.runtime_safety) assert(ty.comptimeOnly(zcu) and try ty.onePossibleValue(wip_nav.pt) == null); |
| 1852 | if (ty.toIntern() == .type_type) return wip_nav.getTypeEntry(value.toType()); | 1852 | if (ty.toIntern() == .type_type) return wip_nav.getTypeEntry(value.toType()); |
| 1853 | if (ip.isFunctionType(ty.toIntern())) return wip_nav.getNavEntry(zcu.funcInfo(value.toIntern()).owner_nav); | 1853 | if (ip.isFunctionType(ty.toIntern()) and !value.isUndef(zcu)) return wip_nav.getNavEntry(zcu.funcInfo(value.toIntern()).owner_nav); |
| 1854 | const gop = try wip_nav.dwarf.values.getOrPut(wip_nav.dwarf.gpa, value.toIntern()); | 1854 | const gop = try wip_nav.dwarf.values.getOrPut(wip_nav.dwarf.gpa, value.toIntern()); |
| 1855 | const unit: Unit.Index = .main; | 1855 | const unit: Unit.Index = .main; |
| 1856 | if (gop.found_existing) return .{ unit, gop.value_ptr.* }; | 1856 | if (gop.found_existing) return .{ unit, gop.value_ptr.* }; |
src/link/Elf/ZigObject.zig+4-4| ... | @@ -360,7 +360,7 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { | ... | @@ -360,7 +360,7 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { |
| 360 | const target_unit = sect.getUnit(reloc.target_unit); | 360 | const target_unit = sect.getUnit(reloc.target_unit); |
| 361 | const r_offset = unit.off + reloc.source_off; | 361 | const r_offset = unit.off + reloc.source_off; |
| 362 | const r_addend: i64 = @intCast(target_unit.off + reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry| | 362 | const r_addend: i64 = @intCast(target_unit.off + reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry| |
| 363 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(unit, sect, dwarf).off | 363 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(target_unit, sect, dwarf).off |
| 364 | else | 364 | else |
| 365 | 0)); | 365 | 0)); |
| 366 | const r_type = relocation.dwarf.crossSectionRelocType(dwarf.format, cpu_arch); | 366 | const r_type = relocation.dwarf.crossSectionRelocType(dwarf.format, cpu_arch); |
| ... | @@ -388,7 +388,7 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { | ... | @@ -388,7 +388,7 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { |
| 388 | const target_unit = target_sec.getUnit(reloc.target_unit); | 388 | const target_unit = target_sec.getUnit(reloc.target_unit); |
| 389 | const r_offset = unit.off + reloc.source_off; | 389 | const r_offset = unit.off + reloc.source_off; |
| 390 | const r_addend: i64 = @intCast(target_unit.off + reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry| | 390 | const r_addend: i64 = @intCast(target_unit.off + reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry| |
| 391 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(unit, sect, dwarf).off | 391 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(target_unit, sect, dwarf).off |
| 392 | else | 392 | else |
| 393 | 0)); | 393 | 0)); |
| 394 | const r_type = relocation.dwarf.crossSectionRelocType(dwarf.format, cpu_arch); | 394 | const r_type = relocation.dwarf.crossSectionRelocType(dwarf.format, cpu_arch); |
| ... | @@ -422,7 +422,7 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { | ... | @@ -422,7 +422,7 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { |
| 422 | const target_unit = sect.getUnit(reloc.target_unit); | 422 | const target_unit = sect.getUnit(reloc.target_unit); |
| 423 | const r_offset = entry_off + reloc.source_off; | 423 | const r_offset = entry_off + reloc.source_off; |
| 424 | const r_addend: i64 = @intCast(target_unit.off + reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry| | 424 | const r_addend: i64 = @intCast(target_unit.off + reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry| |
| 425 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(unit, sect, dwarf).off | 425 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(target_unit, sect, dwarf).off |
| 426 | else | 426 | else |
| 427 | 0)); | 427 | 0)); |
| 428 | const r_type = relocation.dwarf.crossSectionRelocType(dwarf.format, cpu_arch); | 428 | const r_type = relocation.dwarf.crossSectionRelocType(dwarf.format, cpu_arch); |
| ... | @@ -450,7 +450,7 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { | ... | @@ -450,7 +450,7 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { |
| 450 | const target_unit = target_sec.getUnit(reloc.target_unit); | 450 | const target_unit = target_sec.getUnit(reloc.target_unit); |
| 451 | const r_offset = entry_off + reloc.source_off; | 451 | const r_offset = entry_off + reloc.source_off; |
| 452 | const r_addend: i64 = @intCast(target_unit.off + reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry| | 452 | const r_addend: i64 = @intCast(target_unit.off + reloc.target_off + (if (reloc.target_entry.unwrap()) |target_entry| |
| 453 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(unit, sect, dwarf).off | 453 | target_unit.header_len + target_unit.getEntry(target_entry).assertNonEmpty(target_unit, sect, dwarf).off |
| 454 | else | 454 | else |
| 455 | 0)); | 455 | 0)); |
| 456 | const r_type = relocation.dwarf.crossSectionRelocType(dwarf.format, cpu_arch); | 456 | const r_type = relocation.dwarf.crossSectionRelocType(dwarf.format, cpu_arch); |