authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-10-27 20:51:38+02:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-10-28 03:48:18-04:00
logdf7db0c4beae6c491a4354a8fd10bf30b11c8e5d
treef7dcb3f0181647d667d5b111097a2b236ac34502
parent2be1250f244a362b832cfc3d519a27363495f130

x86_64: pass behavior tests PIC and non-PIC


1 files changed, 3 insertions(+), 4 deletions(-)

src/arch/x86_64/CodeGen.zig+3-4
...@@ -10013,7 +10013,7 @@ fn genCall(self: *Self, info: union(enum) {...@@ -10013,7 +10013,7 @@ fn genCall(self: *Self, info: union(enum) {
10013 const sym = elf_file.symbol(sym_index);10013 const sym = elf_file.symbol(sym_index);
10014 _ = try sym.getOrCreateZigGotEntry(sym_index, elf_file);10014 _ = try sym.getOrCreateZigGotEntry(sym_index, elf_file);
10015 if (self.bin_file.options.pic) {10015 if (self.bin_file.options.pic) {
10016 try self.genSetReg(.rax, Type.usize, .{ .lea_symbol = sym.esym_index });10016 try self.genSetReg(.rax, Type.usize, .{ .load_symbol = sym.esym_index });
10017 try self.asmRegister(.{ ._, .call }, .rax);10017 try self.asmRegister(.{ ._, .call }, .rax);
10018 } else {10018 } else {
10019 _ = try self.addInst(.{10019 _ = try self.addInst(.{
...@@ -12766,7 +12766,7 @@ fn genLazySymbolRef(...@@ -12766,7 +12766,7 @@ fn genLazySymbolRef(
1276612766
12767 if (self.bin_file.options.pic) {12767 if (self.bin_file.options.pic) {
12768 switch (tag) {12768 switch (tag) {
12769 .lea, .call => try self.genSetReg(reg, Type.usize, .{ .lea_symbol = sym.esym_index }),12769 .lea, .call => try self.genSetReg(reg, Type.usize, .{ .load_symbol = sym.esym_index }),
12770 .mov => try self.genSetReg(reg, Type.usize, .{ .load_symbol = sym.esym_index }),12770 .mov => try self.genSetReg(reg, Type.usize, .{ .load_symbol = sym.esym_index }),
12771 else => unreachable,12771 else => unreachable,
12772 }12772 }
...@@ -12782,7 +12782,7 @@ fn genLazySymbolRef(...@@ -12782,7 +12782,7 @@ fn genLazySymbolRef(
12782 };12782 };
12783 switch (tag) {12783 switch (tag) {
12784 .lea, .mov => _ = try self.addInst(.{12784 .lea, .mov => _ = try self.addInst(.{
12785 .tag = tag,12785 .tag = .mov,
12786 .ops = .linker_reloc,12786 .ops = .linker_reloc,
12787 .data = .{ .rx = .{12787 .data = .{ .rx = .{
12788 .r1 = reg.to64(),12788 .r1 = reg.to64(),
...@@ -14686,7 +14686,6 @@ fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue {...@@ -14686,7 +14686,6 @@ fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue {
14686 .ty = ty,14686 .ty = ty,
14687 .val = ip_index.toValue(),14687 .val = ip_index.toValue(),
14688 });14688 });
14689 std.debug.print("genTypedValue: {any}\n", .{mcv});
14690 if (!gop.found_existing) gop.value_ptr.* = InstTracking.init(mcv);14689 if (!gop.found_existing) gop.value_ptr.* = InstTracking.init(mcv);
14691 break :mcv gop.value_ptr.short;14690 break :mcv gop.value_ptr.short;
14692 };14691 };