| ... | ... | @@ -128,15 +128,11 @@ pub const MCValue = union(enum) { |
| 128 | 128 | /// The value is in memory at a hard-coded address. |
| 129 | 129 | /// If the type is a pointer, it means the pointer address is at this memory location. |
| 130 | 130 | memory: u64, |
| 131 | | /// The value is in memory referenced indirectly via a GOT entry index. |
| 132 | | /// If the type is a pointer, it means the pointer is referenced indirectly via GOT. |
| 133 | | /// When lowered, linker will emit a relocation of type X86_64_RELOC_GOT. |
| 134 | | got_load: u32, |
| 135 | | imports_load: u32, |
| 136 | | /// The value is in memory referenced directly via symbol index. |
| 137 | | /// If the type is a pointer, it means the pointer is referenced directly via symbol index. |
| 138 | | /// When lowered, linker will emit a relocation of type X86_64_RELOC_SIGNED. |
| 139 | | direct_load: u32, |
| 131 | /// The value is in memory but requires a linker relocation fixup: |
| 132 | /// * got - the value is referenced indirectly via GOT entry index (the linker emits a got-type reloc) |
| 133 | /// * direct - the value is referenced directly via symbol index index (the linker emits a displacement reloc) |
| 134 | /// * import - the value is referenced indirectly via import entry index (the linker emits an import-type reloc) |
| 135 | linker_load: struct { @"type": enum { got, direct, import }, sym_index: u32 }, |
| 140 | 136 | /// The value is one of the stack variables. |
| 141 | 137 | /// If the type is a pointer, it means the pointer address is in the stack at this offset. |
| 142 | 138 | stack_offset: i32, |
| ... | ... | @@ -150,9 +146,7 @@ pub const MCValue = union(enum) { |
| 150 | 146 | .memory, |
| 151 | 147 | .stack_offset, |
| 152 | 148 | .ptr_stack_offset, |
| 153 | | .direct_load, |
| 154 | | .got_load, |
| 155 | | .imports_load, |
| 149 | .linker_load, |
| 156 | 150 | => true, |
| 157 | 151 | else => false, |
| 158 | 152 | }; |
| ... | ... | @@ -165,26 +159,6 @@ pub const MCValue = union(enum) { |
| 165 | 159 | }; |
| 166 | 160 | } |
| 167 | 161 | |
| 168 | | fn isMutable(mcv: MCValue) bool { |
| 169 | | return switch (mcv) { |
| 170 | | .none => unreachable, |
| 171 | | .unreach => unreachable, |
| 172 | | .dead => unreachable, |
| 173 | | |
| 174 | | .immediate, |
| 175 | | .memory, |
| 176 | | .eflags, |
| 177 | | .ptr_stack_offset, |
| 178 | | .undef, |
| 179 | | .register_overflow, |
| 180 | | => false, |
| 181 | | |
| 182 | | .register, |
| 183 | | .stack_offset, |
| 184 | | => true, |
| 185 | | }; |
| 186 | | } |
| 187 | | |
| 188 | 162 | fn isRegister(mcv: MCValue) bool { |
| 189 | 163 | return switch (mcv) { |
| 190 | 164 | .register => true, |
| ... | ... | @@ -2307,11 +2281,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2307 | 2281 | .data = .{ .imm = @bitCast(u32, -off) }, |
| 2308 | 2282 | }); |
| 2309 | 2283 | }, |
| 2310 | | .memory, |
| 2311 | | .got_load, |
| 2312 | | .direct_load, |
| 2313 | | .imports_load, |
| 2314 | | => { |
| 2284 | .memory, .linker_load => { |
| 2315 | 2285 | try self.loadMemPtrIntoRegister(addr_reg, Type.usize, array); |
| 2316 | 2286 | }, |
| 2317 | 2287 | else => return self.fail("TODO implement array_elem_val when array is {}", .{array}), |
| ... | ... | @@ -2652,11 +2622,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!vo |
| 2652 | 2622 | else => return self.fail("TODO implement loading from register into {}", .{dst_mcv}), |
| 2653 | 2623 | } |
| 2654 | 2624 | }, |
| 2655 | | .memory, |
| 2656 | | .got_load, |
| 2657 | | .direct_load, |
| 2658 | | .imports_load, |
| 2659 | | => { |
| 2625 | .memory, .linker_load => { |
| 2660 | 2626 | const reg = try self.copyToTmpRegister(ptr_ty, ptr); |
| 2661 | 2627 | try self.load(dst_mcv, .{ .register = reg }, ptr_ty); |
| 2662 | 2628 | }, |
| ... | ... | @@ -2691,10 +2657,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 2691 | 2657 | |
| 2692 | 2658 | fn loadMemPtrIntoRegister(self: *Self, reg: Register, ptr_ty: Type, ptr: MCValue) InnerError!void { |
| 2693 | 2659 | switch (ptr) { |
| 2694 | | .got_load, |
| 2695 | | .direct_load, |
| 2696 | | .imports_load, |
| 2697 | | => |sym_index| { |
| 2660 | .linker_load => |load_struct| { |
| 2698 | 2661 | const abi_size = @intCast(u32, ptr_ty.abiSize(self.target.*)); |
| 2699 | 2662 | const mod = self.bin_file.options.module.?; |
| 2700 | 2663 | const fn_owner_decl = mod.declPtr(self.mod_fn.owner_decl); |
| ... | ... | @@ -2702,11 +2665,10 @@ fn loadMemPtrIntoRegister(self: *Self, reg: Register, ptr_ty: Type, ptr: MCValue |
| 2702 | 2665 | fn_owner_decl.link.macho.sym_index |
| 2703 | 2666 | else |
| 2704 | 2667 | fn_owner_decl.link.coff.sym_index; |
| 2705 | | const flags: u2 = switch (ptr) { |
| 2706 | | .got_load => 0b00, |
| 2707 | | .direct_load => 0b01, |
| 2708 | | .imports_load => 0b10, |
| 2709 | | else => unreachable, |
| 2668 | const flags: u2 = switch (load_struct.@"type") { |
| 2669 | .got => 0b00, |
| 2670 | .direct => 0b01, |
| 2671 | .import => 0b10, |
| 2710 | 2672 | }; |
| 2711 | 2673 | _ = try self.addInst(.{ |
| 2712 | 2674 | .tag = .lea_pic, |
| ... | ... | @@ -2717,7 +2679,7 @@ fn loadMemPtrIntoRegister(self: *Self, reg: Register, ptr_ty: Type, ptr: MCValue |
| 2717 | 2679 | .data = .{ |
| 2718 | 2680 | .relocation = .{ |
| 2719 | 2681 | .atom_index = atom_index, |
| 2720 | | .sym_index = sym_index, |
| 2682 | .sym_index = load_struct.sym_index, |
| 2721 | 2683 | }, |
| 2722 | 2684 | }, |
| 2723 | 2685 | }); |
| ... | ... | @@ -2801,9 +2763,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type |
| 2801 | 2763 | .register => |src_reg| { |
| 2802 | 2764 | try self.genInlineMemcpyRegisterRegister(value_ty, reg, src_reg, 0); |
| 2803 | 2765 | }, |
| 2804 | | .got_load, |
| 2805 | | .direct_load, |
| 2806 | | .imports_load, |
| 2766 | .linker_load, |
| 2807 | 2767 | .memory, |
| 2808 | 2768 | .stack_offset, |
| 2809 | 2769 | => { |
| ... | ... | @@ -2822,11 +2782,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type |
| 2822 | 2782 | }, |
| 2823 | 2783 | } |
| 2824 | 2784 | }, |
| 2825 | | .got_load, |
| 2826 | | .direct_load, |
| 2827 | | .imports_load, |
| 2828 | | .memory, |
| 2829 | | => { |
| 2785 | .linker_load, .memory => { |
| 2830 | 2786 | const value_lock: ?RegisterLock = switch (value) { |
| 2831 | 2787 | .register => |reg| self.register_manager.lockReg(reg), |
| 2832 | 2788 | else => null, |
| ... | ... | @@ -2894,11 +2850,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type |
| 2894 | 2850 | .register => { |
| 2895 | 2851 | return self.store(new_ptr, value, ptr_ty, value_ty); |
| 2896 | 2852 | }, |
| 2897 | | .got_load, |
| 2898 | | .direct_load, |
| 2899 | | .imports_load, |
| 2900 | | .memory, |
| 2901 | | => { |
| 2853 | .linker_load, .memory => { |
| 2902 | 2854 | if (abi_size <= 8) { |
| 2903 | 2855 | const tmp_reg = try self.register_manager.allocReg(null, gp); |
| 2904 | 2856 | const tmp_reg_lock = self.register_manager.lockRegAssumeUnused(tmp_reg); |
| ... | ... | @@ -3606,9 +3558,7 @@ fn genBinOpMir(self: *Self, mir_tag: Mir.Inst.Tag, dst_ty: Type, dst_mcv: MCValu |
| 3606 | 3558 | }); |
| 3607 | 3559 | }, |
| 3608 | 3560 | .memory, |
| 3609 | | .got_load, |
| 3610 | | .direct_load, |
| 3611 | | .imports_load, |
| 3561 | .linker_load, |
| 3612 | 3562 | .eflags, |
| 3613 | 3563 | => { |
| 3614 | 3564 | assert(abi_size <= 8); |
| ... | ... | @@ -3694,10 +3644,7 @@ fn genBinOpMir(self: *Self, mir_tag: Mir.Inst.Tag, dst_ty: Type, dst_mcv: MCValu |
| 3694 | 3644 | => { |
| 3695 | 3645 | return self.fail("TODO implement x86 ADD/SUB/CMP source memory", .{}); |
| 3696 | 3646 | }, |
| 3697 | | .got_load, |
| 3698 | | .direct_load, |
| 3699 | | .imports_load, |
| 3700 | | => { |
| 3647 | .linker_load => { |
| 3701 | 3648 | return self.fail("TODO implement x86 ADD/SUB/CMP source symbol at index in linker", .{}); |
| 3702 | 3649 | }, |
| 3703 | 3650 | .eflags => { |
| ... | ... | @@ -3708,10 +3655,7 @@ fn genBinOpMir(self: *Self, mir_tag: Mir.Inst.Tag, dst_ty: Type, dst_mcv: MCValu |
| 3708 | 3655 | .memory => { |
| 3709 | 3656 | return self.fail("TODO implement x86 ADD/SUB/CMP destination memory", .{}); |
| 3710 | 3657 | }, |
| 3711 | | .got_load, |
| 3712 | | .direct_load, |
| 3713 | | .imports_load, |
| 3714 | | => { |
| 3658 | .linker_load => { |
| 3715 | 3659 | return self.fail("TODO implement x86 ADD/SUB/CMP destination symbol at index", .{}); |
| 3716 | 3660 | }, |
| 3717 | 3661 | } |
| ... | ... | @@ -3779,10 +3723,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M |
| 3779 | 3723 | .memory => { |
| 3780 | 3724 | return self.fail("TODO implement x86 multiply source memory", .{}); |
| 3781 | 3725 | }, |
| 3782 | | .got_load, |
| 3783 | | .direct_load, |
| 3784 | | .imports_load, |
| 3785 | | => { |
| 3726 | .linker_load => { |
| 3786 | 3727 | return self.fail("TODO implement x86 multiply source symbol at index in linker", .{}); |
| 3787 | 3728 | }, |
| 3788 | 3729 | .eflags => { |
| ... | ... | @@ -3826,10 +3767,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M |
| 3826 | 3767 | .memory, .stack_offset => { |
| 3827 | 3768 | return self.fail("TODO implement x86 multiply source memory", .{}); |
| 3828 | 3769 | }, |
| 3829 | | .got_load, |
| 3830 | | .direct_load, |
| 3831 | | .imports_load, |
| 3832 | | => { |
| 3770 | .linker_load => { |
| 3833 | 3771 | return self.fail("TODO implement x86 multiply source symbol at index in linker", .{}); |
| 3834 | 3772 | }, |
| 3835 | 3773 | .eflags => { |
| ... | ... | @@ -3840,10 +3778,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M |
| 3840 | 3778 | .memory => { |
| 3841 | 3779 | return self.fail("TODO implement x86 multiply destination memory", .{}); |
| 3842 | 3780 | }, |
| 3843 | | .got_load, |
| 3844 | | .direct_load, |
| 3845 | | .imports_load, |
| 3846 | | => { |
| 3781 | .linker_load => { |
| 3847 | 3782 | return self.fail("TODO implement x86 multiply destination symbol at index in linker", .{}); |
| 3848 | 3783 | }, |
| 3849 | 3784 | } |
| ... | ... | @@ -4006,9 +3941,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. |
| 4006 | 3941 | .unreach => unreachable, |
| 4007 | 3942 | .dead => unreachable, |
| 4008 | 3943 | .memory => unreachable, |
| 4009 | | .got_load => unreachable, |
| 4010 | | .direct_load => unreachable, |
| 4011 | | .imports_load => unreachable, |
| 3944 | .linker_load => unreachable, |
| 4012 | 3945 | .eflags => unreachable, |
| 4013 | 3946 | .register_overflow => unreachable, |
| 4014 | 3947 | } |
| ... | ... | @@ -4066,7 +3999,10 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. |
| 4066 | 3999 | const func = func_payload.data; |
| 4067 | 4000 | const fn_owner_decl = mod.declPtr(func.owner_decl); |
| 4068 | 4001 | try self.genSetReg(Type.initTag(.usize), .rax, .{ |
| 4069 | | .got_load = fn_owner_decl.link.coff.sym_index, |
| 4002 | .linker_load = .{ |
| 4003 | .@"type" = .got, |
| 4004 | .sym_index = fn_owner_decl.link.coff.sym_index, |
| 4005 | }, |
| 4070 | 4006 | }); |
| 4071 | 4007 | _ = try self.addInst(.{ |
| 4072 | 4008 | .tag = .call, |
| ... | ... | @@ -4087,7 +4023,10 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. |
| 4087 | 4023 | } |
| 4088 | 4024 | const sym_index = try coff_file.getGlobalSymbol(mem.sliceTo(decl_name, 0)); |
| 4089 | 4025 | try self.genSetReg(Type.initTag(.usize), .rax, .{ |
| 4090 | | .imports_load = sym_index, |
| 4026 | .linker_load = .{ |
| 4027 | .@"type" = .import, |
| 4028 | .sym_index = sym_index, |
| 4029 | }, |
| 4091 | 4030 | }); |
| 4092 | 4031 | _ = try self.addInst(.{ |
| 4093 | 4032 | .tag = .call, |
| ... | ... | @@ -4119,7 +4058,12 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. |
| 4119 | 4058 | const func = func_payload.data; |
| 4120 | 4059 | const fn_owner_decl = mod.declPtr(func.owner_decl); |
| 4121 | 4060 | const sym_index = fn_owner_decl.link.macho.sym_index; |
| 4122 | | try self.genSetReg(Type.initTag(.usize), .rax, .{ .got_load = sym_index }); |
| 4061 | try self.genSetReg(Type.initTag(.usize), .rax, .{ |
| 4062 | .linker_load = .{ |
| 4063 | .@"type" = .got, |
| 4064 | .sym_index = sym_index, |
| 4065 | }, |
| 4066 | }); |
| 4123 | 4067 | // callq *%rax |
| 4124 | 4068 | _ = try self.addInst(.{ |
| 4125 | 4069 | .tag = .call, |
| ... | ... | @@ -4505,11 +4449,7 @@ fn genVarDbgInfo( |
| 4505 | 4449 | leb128.writeILEB128(dbg_info.writer(), -off) catch unreachable; |
| 4506 | 4450 | dbg_info.items[fixup] += @intCast(u8, dbg_info.items.len - fixup - 2); |
| 4507 | 4451 | }, |
| 4508 | | .memory, |
| 4509 | | .got_load, |
| 4510 | | .direct_load, |
| 4511 | | .imports_load, |
| 4512 | | => { |
| 4452 | .memory, .linker_load => { |
| 4513 | 4453 | const ptr_width = @intCast(u8, @divExact(self.target.cpu.arch.ptrBitWidth(), 8)); |
| 4514 | 4454 | const is_ptr = switch (tag) { |
| 4515 | 4455 | .dbg_var_ptr => true, |
| ... | ... | @@ -4540,10 +4480,11 @@ fn genVarDbgInfo( |
| 4540 | 4480 | try dbg_info.append(DW.OP.deref); |
| 4541 | 4481 | } |
| 4542 | 4482 | switch (mcv) { |
| 4543 | | .got_load, |
| 4544 | | .direct_load, |
| 4545 | | .imports_load, |
| 4546 | | => |index| try dw.addExprlocReloc(index, offset, is_ptr), |
| 4483 | .linker_load => |load_struct| try dw.addExprlocReloc( |
| 4484 | load_struct.sym_index, |
| 4485 | offset, |
| 4486 | is_ptr, |
| 4487 | ), |
| 4547 | 4488 | else => {}, |
| 4548 | 4489 | } |
| 4549 | 4490 | }, |
| ... | ... | @@ -5587,11 +5528,7 @@ fn genSetStackArg(self: *Self, ty: Type, stack_offset: i32, mcv: MCValue) InnerE |
| 5587 | 5528 | else => return self.fail("TODO implement inputs on stack for {} with abi size > 8", .{mcv}), |
| 5588 | 5529 | } |
| 5589 | 5530 | }, |
| 5590 | | .memory, |
| 5591 | | .direct_load, |
| 5592 | | .got_load, |
| 5593 | | .imports_load, |
| 5594 | | => { |
| 5531 | .memory, .linker_load => { |
| 5595 | 5532 | if (abi_size <= 8) { |
| 5596 | 5533 | const reg = try self.copyToTmpRegister(ty, mcv); |
| 5597 | 5534 | return self.genSetStackArg(ty, stack_offset, MCValue{ .register = reg }); |
| ... | ... | @@ -5835,11 +5772,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: i32, mcv: MCValue, opts: Inl |
| 5835 | 5772 | }, |
| 5836 | 5773 | } |
| 5837 | 5774 | }, |
| 5838 | | .memory, |
| 5839 | | .got_load, |
| 5840 | | .direct_load, |
| 5841 | | .imports_load, |
| 5842 | | => { |
| 5775 | .memory, .linker_load => { |
| 5843 | 5776 | if (abi_size <= 8) { |
| 5844 | 5777 | const reg = try self.copyToTmpRegister(ty, mcv); |
| 5845 | 5778 | return self.genSetStack(ty, stack_offset, MCValue{ .register = reg }, opts); |
| ... | ... | @@ -5959,11 +5892,7 @@ fn genInlineMemcpy( |
| 5959 | 5892 | const tmp_reg = regs[4].to8(); |
| 5960 | 5893 | |
| 5961 | 5894 | switch (dst_ptr) { |
| 5962 | | .memory, |
| 5963 | | .got_load, |
| 5964 | | .direct_load, |
| 5965 | | .imports_load, |
| 5966 | | => { |
| 5895 | .memory, .linker_load => { |
| 5967 | 5896 | try self.loadMemPtrIntoRegister(dst_addr_reg, Type.usize, dst_ptr); |
| 5968 | 5897 | }, |
| 5969 | 5898 | .ptr_stack_offset, .stack_offset => |off| { |
| ... | ... | @@ -5992,11 +5921,7 @@ fn genInlineMemcpy( |
| 5992 | 5921 | } |
| 5993 | 5922 | |
| 5994 | 5923 | switch (src_ptr) { |
| 5995 | | .memory, |
| 5996 | | .got_load, |
| 5997 | | .direct_load, |
| 5998 | | .imports_load, |
| 5999 | | => { |
| 5924 | .memory, .linker_load => { |
| 6000 | 5925 | try self.loadMemPtrIntoRegister(src_addr_reg, Type.usize, src_ptr); |
| 6001 | 5926 | }, |
| 6002 | 5927 | .ptr_stack_offset, .stack_offset => |off| { |
| ... | ... | @@ -6120,11 +6045,7 @@ fn genInlineMemset( |
| 6120 | 6045 | const index_reg = regs[1].to64(); |
| 6121 | 6046 | |
| 6122 | 6047 | switch (dst_ptr) { |
| 6123 | | .memory, |
| 6124 | | .got_load, |
| 6125 | | .direct_load, |
| 6126 | | .imports_load, |
| 6127 | | => { |
| 6048 | .memory, .linker_load => { |
| 6128 | 6049 | try self.loadMemPtrIntoRegister(addr_reg, Type.usize, dst_ptr); |
| 6129 | 6050 | }, |
| 6130 | 6051 | .ptr_stack_offset, .stack_offset => |off| { |
| ... | ... | @@ -6356,10 +6277,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void |
| 6356 | 6277 | .data = undefined, |
| 6357 | 6278 | }); |
| 6358 | 6279 | }, |
| 6359 | | .direct_load, |
| 6360 | | .got_load, |
| 6361 | | .imports_load, |
| 6362 | | => { |
| 6280 | .linker_load => { |
| 6363 | 6281 | switch (ty.zigTypeTag()) { |
| 6364 | 6282 | .Float => { |
| 6365 | 6283 | const base_reg = try self.register_manager.allocReg(null, gp); |
| ... | ... | @@ -6753,11 +6671,7 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void { |
| 6753 | 6671 | // TODO Is this the only condition for pointer dereference for memcpy? |
| 6754 | 6672 | const src: MCValue = blk: { |
| 6755 | 6673 | switch (src_ptr) { |
| 6756 | | .got_load, |
| 6757 | | .direct_load, |
| 6758 | | .imports_load, |
| 6759 | | .memory, |
| 6760 | | => { |
| 6674 | .linker_load, .memory => { |
| 6761 | 6675 | const reg = try self.register_manager.allocReg(null, gp); |
| 6762 | 6676 | try self.loadMemPtrIntoRegister(reg, src_ty, src_ptr); |
| 6763 | 6677 | _ = try self.addInst(.{ |
| ... | ... | @@ -6997,10 +6911,16 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl_index: Module.Decl.Index) Inne |
| 6997 | 6911 | return MCValue{ .memory = got_addr }; |
| 6998 | 6912 | } else if (self.bin_file.cast(link.File.MachO)) |_| { |
| 6999 | 6913 | assert(decl.link.macho.sym_index != 0); |
| 7000 | | return MCValue{ .got_load = decl.link.macho.sym_index }; |
| 6914 | return MCValue{ .linker_load = .{ |
| 6915 | .@"type" = .got, |
| 6916 | .sym_index = decl.link.macho.sym_index, |
| 6917 | } }; |
| 7001 | 6918 | } else if (self.bin_file.cast(link.File.Coff)) |_| { |
| 7002 | 6919 | assert(decl.link.coff.sym_index != 0); |
| 7003 | | return MCValue{ .got_load = decl.link.coff.sym_index }; |
| 6920 | return MCValue{ .linker_load = .{ |
| 6921 | .@"type" = .got, |
| 6922 | .sym_index = decl.link.coff.sym_index, |
| 6923 | } }; |
| 7004 | 6924 | } else if (self.bin_file.cast(link.File.Plan9)) |p9| { |
| 7005 | 6925 | try p9.seeDecl(decl_index); |
| 7006 | 6926 | const got_addr = p9.bases.data + decl.link.plan9.got_index.? * ptr_bytes; |
| ... | ... | @@ -7019,9 +6939,15 @@ fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue { |
| 7019 | 6939 | const vaddr = elf_file.local_symbols.items[local_sym_index].st_value; |
| 7020 | 6940 | return MCValue{ .memory = vaddr }; |
| 7021 | 6941 | } else if (self.bin_file.cast(link.File.MachO)) |_| { |
| 7022 | | return MCValue{ .direct_load = local_sym_index }; |
| 6942 | return MCValue{ .linker_load = .{ |
| 6943 | .@"type" = .direct, |
| 6944 | .sym_index = local_sym_index, |
| 6945 | } }; |
| 7023 | 6946 | } else if (self.bin_file.cast(link.File.Coff)) |_| { |
| 7024 | | return MCValue{ .direct_load = local_sym_index }; |
| 6947 | return MCValue{ .linker_load = .{ |
| 6948 | .@"type" = .direct, |
| 6949 | .sym_index = local_sym_index, |
| 6950 | } }; |
| 7025 | 6951 | } else if (self.bin_file.cast(link.File.Plan9)) |_| { |
| 7026 | 6952 | return self.fail("TODO lower unnamed const in Plan9", .{}); |
| 7027 | 6953 | } else { |