aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-08-12 22:04:18 +0200
committerJakub Konka <kubkon@jakubkonka.com>2024-08-13 13:30:24 +0200
commit16abf51ceef2ba2ebb38f27270af676387435f05 (patch)
tree868f8623a5a8fb8f01b99f0bdc60044b4cf55704 /src
parentf968dd0cb1fc9197fc6483ce235b037f6c86c8ce (diff)
downloadzig-16abf51ceef2ba2ebb38f27270af676387435f05.tar.gz
zig-16abf51ceef2ba2ebb38f27270af676387435f05.zip
x86_64: handle lea_symbol returned by genNavRef
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86_64/CodeGen.zig3
-rw-r--r--src/codegen.zig5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig
index cfeca4c390..dede09fc71 100644
--- a/src/arch/x86_64/CodeGen.zig
+++ b/src/arch/x86_64/CodeGen.zig
@@ -14104,7 +14104,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
.{ .reg = try self.copyToTmpRegister(Type.usize, .{ .lea_got = sym_index }) }
else
return self.fail("invalid modifier: '{s}'", .{modifier}),
- .load_symbol => |sym_off| if (mem.eql(u8, modifier, "P"))
+ .lea_symbol => |sym_off| if (mem.eql(u8, modifier, "P"))
.{ .reg = try self.copyToTmpRegister(Type.usize, .{ .lea_symbol = sym_off }) }
else
return self.fail("invalid modifier: '{s}'", .{modifier}),
@@ -18798,6 +18798,7 @@ fn genTypedValue(self: *Self, val: Value) InnerError!MCValue {
.immediate => |imm| .{ .immediate = imm },
.memory => |addr| .{ .memory = addr },
.load_symbol => |sym_index| .{ .load_symbol = .{ .sym = sym_index } },
+ .lea_symbol => |sym_index| .{ .lea_symbol = .{ .sym = sym_index } },
.load_direct => |sym_index| .{ .load_direct = sym_index },
.load_got => |sym_index| .{ .lea_got = sym_index },
.load_tlv => |sym_index| .{ .lea_tlv = sym_index },
diff --git a/src/codegen.zig b/src/codegen.zig
index f2fa60fdf8..679ee03c27 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -828,6 +828,9 @@ pub const GenResult = union(enum) {
/// Reference to memory location but deferred until linker allocated the Decl in memory.
/// Traditionally, this corresponds to emitting a relocation in a relocatable object file.
load_symbol: u32,
+ /// Reference to memory location but deferred until linker allocated the Decl in memory.
+ /// Traditionally, this corresponds to emitting a relocation in a relocatable object file.
+ lea_symbol: u32,
};
fn mcv(val: MCValue) GenResult {
@@ -904,7 +907,7 @@ fn genNavRef(
if (!single_threaded and is_threadlocal) {
return GenResult.mcv(.{ .load_tlv = sym_index });
}
- return GenResult.mcv(.{ .load_symbol = sym_index });
+ return GenResult.mcv(.{ .lea_symbol = sym_index });
} else if (lf.cast(.macho)) |macho_file| {
const zo = macho_file.getZigObject().?;
if (is_extern) {