| author | |
| committer | |
| log | 7c5a24e08cd0bffd2a5cce6d1fd592a7d2bee678 |
| tree | 40b072ebb155f4c487f7c01b009a79d034e7df73 |
| parent | 9952a072cc120f5dc134bb1070ad02dfab59cefa |
3 files changed, 86 insertions(+), 71 deletions(-)
src/codegen.zig+12-18| ... | ... | @@ -17,9 +17,6 @@ const DW = std.dwarf; |
| 17 | 17 | const leb128 = std.debug.leb; |
| 18 | 18 | const log = std.log.scoped(.codegen); |
| 19 | 19 | |
| 20 | // TODO Turn back on zig fmt when https://github.com/ziglang/zig/issues/5948 is implemented. | |
| 21 | // zig fmt: off | |
| 22 | ||
| 23 | 20 | /// The codegen-related data that is stored in `ir.Inst.Block` instructions. |
| 24 | 21 | pub const BlockData = struct { |
| 25 | 22 | relocs: std.ArrayListUnmanaged(Reloc) = undefined, |
| ... | ... | @@ -170,7 +167,6 @@ pub fn generateSymbol( |
| 170 | 167 | }, |
| 171 | 168 | .Pointer => { |
| 172 | 169 | // TODO populate .debug_info for the pointer |
| 173 | ||
| 174 | 170 | if (typed_value.val.cast(Value.Payload.DeclRef)) |payload| { |
| 175 | 171 | const decl = payload.decl; |
| 176 | 172 | if (decl.analysis != .complete) return error.AnalysisFail; |
| ... | ... | @@ -206,7 +202,6 @@ pub fn generateSymbol( |
| 206 | 202 | }, |
| 207 | 203 | .Int => { |
| 208 | 204 | // TODO populate .debug_info for the integer |
| 209 | ||
| 210 | 205 | const info = typed_value.ty.intInfo(bin_file.options.target); |
| 211 | 206 | if (info.bits == 8 and !info.signed) { |
| 212 | 207 | const x = typed_value.val.toUnsignedInt(); |
| ... | ... | @@ -399,7 +394,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 399 | 394 | self.free_registers &= ~(@as(FreeRegInt, 1) << free_index); |
| 400 | 395 | const reg = callee_preserved_regs[free_index]; |
| 401 | 396 | self.registers.putAssumeCapacityNoClobber(reg, inst); |
| 402 | log.debug("alloc {} => {*}", .{reg, inst}); | |
| 397 | log.debug("alloc {} => {*}", .{ reg, inst }); | |
| 403 | 398 | return reg; |
| 404 | 399 | } |
| 405 | 400 | |
| ... | ... | @@ -439,7 +434,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 439 | 434 | } |
| 440 | 435 | try branch_stack.append(.{}); |
| 441 | 436 | |
| 442 | const src_data: struct {lbrace_src: usize, rbrace_src: usize, source: []const u8} = blk: { | |
| 437 | const src_data: struct { lbrace_src: usize, rbrace_src: usize, source: []const u8 } = blk: { | |
| 443 | 438 | if (module_fn.owner_decl.scope.cast(Module.Scope.Container)) |container_scope| { |
| 444 | 439 | const tree = container_scope.file_scope.contents.tree; |
| 445 | 440 | const fn_proto = tree.root_node.decls()[module_fn.owner_decl.src_index].castTag(.FnProto).?; |
| ... | ... | @@ -619,7 +614,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 619 | 614 | |
| 620 | 615 | const mcv = try self.genFuncInst(inst); |
| 621 | 616 | if (!inst.isUnused()) { |
| 622 | log.debug("{*} => {}", .{inst, mcv}); | |
| 617 | log.debug("{*} => {}", .{ inst, mcv }); | |
| 623 | 618 | const branch = &self.branch_stack.items[self.branch_stack.items.len - 1]; |
| 624 | 619 | try branch.inst_table.putNoClobber(self.gpa, inst, mcv); |
| 625 | 620 | } |
| ... | ... | @@ -884,7 +879,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 884 | 879 | // No side effects, so if it's unreferenced, do nothing. |
| 885 | 880 | if (inst.base.isUnused()) |
| 886 | 881 | return MCValue.dead; |
| 887 | ||
| 882 | ||
| 888 | 883 | const operand = try self.resolveInst(inst.operand); |
| 889 | 884 | const info_a = inst.operand.ty.intInfo(self.target.*); |
| 890 | 885 | const info_b = inst.base.ty.intInfo(self.target.*); |
| ... | ... | @@ -1005,10 +1000,10 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1005 | 1000 | if (self.registers.getEntry(toCanonicalReg(reg))) |entry| { |
| 1006 | 1001 | entry.value = inst; |
| 1007 | 1002 | } |
| 1008 | log.debug("reusing {} => {*}", .{reg, inst}); | |
| 1003 | log.debug("reusing {} => {*}", .{ reg, inst }); | |
| 1009 | 1004 | }, |
| 1010 | 1005 | .stack_offset => |off| { |
| 1011 | log.debug("reusing stack offset {} => {*}", .{off, inst}); | |
| 1006 | log.debug("reusing stack offset {} => {*}", .{ off, inst }); | |
| 1012 | 1007 | return true; |
| 1013 | 1008 | }, |
| 1014 | 1009 | else => return false, |
| ... | ... | @@ -1307,7 +1302,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1307 | 1302 | const result = self.args[self.arg_index]; |
| 1308 | 1303 | self.arg_index += 1; |
| 1309 | 1304 | |
| 1310 | const name_with_null = inst.name[0..mem.lenZ(inst.name) + 1]; | |
| 1305 | const name_with_null = inst.name[0 .. mem.lenZ(inst.name) + 1]; | |
| 1311 | 1306 | switch (result) { |
| 1312 | 1307 | .register => |reg| { |
| 1313 | 1308 | self.registers.putAssumeCapacityNoClobber(toCanonicalReg(reg), &inst.base); |
| ... | ... | @@ -1779,7 +1774,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1779 | 1774 | self.code.items.len += 4; |
| 1780 | 1775 | break :reloc reloc; |
| 1781 | 1776 | }, |
| 1782 | else => return self.fail(inst.base.src, "TODO implement condbr {}", .{ self.target.cpu.arch }), | |
| 1777 | else => return self.fail(inst.base.src, "TODO implement condbr {}", .{self.target.cpu.arch}), | |
| 1783 | 1778 | }; |
| 1784 | 1779 | |
| 1785 | 1780 | // Capture the state of register and stack allocation state so that we can revert to it. |
| ... | ... | @@ -1859,7 +1854,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1859 | 1854 | } |
| 1860 | 1855 | } |
| 1861 | 1856 | }; |
| 1862 | log.debug("consolidating else_entry {*} {}=>{}", .{else_entry.key, else_entry.value, canon_mcv}); | |
| 1857 | log.debug("consolidating else_entry {*} {}=>{}", .{ else_entry.key, else_entry.value, canon_mcv }); | |
| 1863 | 1858 | // TODO make sure the destination stack offset / register does not already have something |
| 1864 | 1859 | // going on there. |
| 1865 | 1860 | try self.setRegOrMem(inst.base.src, else_entry.key.ty, canon_mcv, else_entry.value); |
| ... | ... | @@ -1883,7 +1878,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1883 | 1878 | } |
| 1884 | 1879 | } |
| 1885 | 1880 | }; |
| 1886 | log.debug("consolidating then_entry {*} {}=>{}", .{then_entry.key, parent_mcv, then_entry.value}); | |
| 1881 | log.debug("consolidating then_entry {*} {}=>{}", .{ then_entry.key, parent_mcv, then_entry.value }); | |
| 1887 | 1882 | // TODO make sure the destination stack offset / register does not already have something |
| 1888 | 1883 | // going on there. |
| 1889 | 1884 | try self.setRegOrMem(inst.base.src, then_entry.key.ty, parent_mcv, then_entry.value); |
| ... | ... | @@ -1950,7 +1945,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1950 | 1945 | // break instruction will choose a MCValue for the block result and overwrite |
| 1951 | 1946 | // this field. Following break instructions will use that MCValue to put their |
| 1952 | 1947 | // block results. |
| 1953 | .mcv = @bitCast(AnyMCValue, MCValue { .none = {} }), | |
| 1948 | .mcv = @bitCast(AnyMCValue, MCValue{ .none = {} }), | |
| 1954 | 1949 | }; |
| 1955 | 1950 | defer inst.codegen.relocs.deinit(self.gpa); |
| 1956 | 1951 | |
| ... | ... | @@ -2232,7 +2227,7 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 2232 | 2227 | mem.writeIntLittle(u64, &buf, x_big); |
| 2233 | 2228 | |
| 2234 | 2229 | // mov DWORD PTR [rbp+offset+4], immediate |
| 2235 | self.code.appendSliceAssumeCapacity(&[_]u8{ 0xc7, 0x45, twos_comp + 4}); | |
| 2230 | self.code.appendSliceAssumeCapacity(&[_]u8{ 0xc7, 0x45, twos_comp + 4 }); | |
| 2236 | 2231 | self.code.appendSliceAssumeCapacity(buf[4..8]); |
| 2237 | 2232 | |
| 2238 | 2233 | // mov DWORD PTR [rbp+offset], immediate |
| ... | ... | @@ -2288,7 +2283,6 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 2288 | 2283 | } else if (x <= math.maxInt(u16)) { |
| 2289 | 2284 | // TODO Use movw Note: Not supported on |
| 2290 | 2285 | // all ARM targets! |
| 2291 | ||
| 2292 | 2286 | mem.writeIntLittle(u32, try self.code.addManyAsArray(4), Instruction.mov(.al, reg, Instruction.Operand.imm(@truncate(u8, x), 0)).toU32()); |
| 2293 | 2287 | mem.writeIntLittle(u32, try self.code.addManyAsArray(4), Instruction.orr(.al, reg, reg, Instruction.Operand.imm(@truncate(u8, x >> 8), 12)).toU32()); |
| 2294 | 2288 | } else if (x <= math.maxInt(u32)) { |
src/glibc.zig+18-9| ... | ... | @@ -689,9 +689,6 @@ pub const BuiltSharedObjects = struct { |
| 689 | 689 | |
| 690 | 690 | const all_map_basename = "all.map"; |
| 691 | 691 | |
| 692 | // TODO Turn back on zig fmt when https://github.com/ziglang/zig/issues/5948 is implemented. | |
| 693 | // zig fmt: off | |
| 694 | ||
| 695 | 692 | pub fn buildSharedObjects(comp: *Compilation) !void { |
| 696 | 693 | const tracy = trace(@src()); |
| 697 | 694 | defer tracy.end(); |
| ... | ... | @@ -827,8 +824,9 @@ pub fn buildSharedObjects(comp: *Compilation) !void { |
| 827 | 824 | |
| 828 | 825 | if (ver.patch == 0) { |
| 829 | 826 | const sym_plus_ver = try std.fmt.allocPrint( |
| 830 | arena, "{s}_{d}_{d}", | |
| 831 | .{sym_name, ver.major, ver.minor}, | |
| 827 | arena, | |
| 828 | "{s}_{d}_{d}", | |
| 829 | .{ sym_name, ver.major, ver.minor }, | |
| 832 | 830 | ); |
| 833 | 831 | try zig_body.writer().print( |
| 834 | 832 | \\.globl {s} |
| ... | ... | @@ -840,13 +838,19 @@ pub fn buildSharedObjects(comp: *Compilation) !void { |
| 840 | 838 | , .{ |
| 841 | 839 | sym_plus_ver, |
| 842 | 840 | sym_plus_ver, |
| 843 | sym_plus_ver, sym_name, at_sign_str, ver.major, ver.minor, | |
| 841 | sym_plus_ver, | |
| 842 | sym_name, | |
| 843 | at_sign_str, | |
| 844 | ver.major, | |
| 845 | ver.minor, | |
| 844 | 846 | sym_plus_ver, |
| 845 | 847 | sym_plus_ver, |
| 846 | 848 | }); |
| 847 | 849 | } else { |
| 848 | const sym_plus_ver = try std.fmt.allocPrint(arena, "{s}_{d}_{d}_{d}", | |
| 849 | .{sym_name, ver.major, ver.minor, ver.patch}, | |
| 850 | const sym_plus_ver = try std.fmt.allocPrint( | |
| 851 | arena, | |
| 852 | "{s}_{d}_{d}_{d}", | |
| 853 | .{ sym_name, ver.major, ver.minor, ver.patch }, | |
| 850 | 854 | ); |
| 851 | 855 | try zig_body.writer().print( |
| 852 | 856 | \\.globl {s} |
| ... | ... | @@ -858,7 +862,12 @@ pub fn buildSharedObjects(comp: *Compilation) !void { |
| 858 | 862 | , .{ |
| 859 | 863 | sym_plus_ver, |
| 860 | 864 | sym_plus_ver, |
| 861 | sym_plus_ver, sym_name, at_sign_str, ver.major, ver.minor, ver.patch, | |
| 865 | sym_plus_ver, | |
| 866 | sym_name, | |
| 867 | at_sign_str, | |
| 868 | ver.major, | |
| 869 | ver.minor, | |
| 870 | ver.patch, | |
| 862 | 871 | sym_plus_ver, |
| 863 | 872 | sym_plus_ver, |
| 864 | 873 | }); |
src/link/Elf.zig+56-44| ... | ... | @@ -27,9 +27,6 @@ const Cache = @import("../Cache.zig"); |
| 27 | 27 | |
| 28 | 28 | const default_entry_addr = 0x8000000; |
| 29 | 29 | |
| 30 | // TODO Turn back on zig fmt when https://github.com/ziglang/zig/issues/5948 is implemented. | |
| 31 | // zig fmt: off | |
| 32 | ||
| 33 | 30 | pub const base_tag: File.Tag = .elf; |
| 34 | 31 | |
| 35 | 32 | base: File, |
| ... | ... | @@ -273,8 +270,8 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio |
| 273 | 270 | |
| 274 | 271 | pub fn createEmpty(gpa: *Allocator, options: link.Options) !*Elf { |
| 275 | 272 | const ptr_width: PtrWidth = switch (options.target.cpu.arch.ptrBitWidth()) { |
| 276 | 0 ... 32 => .p32, | |
| 277 | 33 ... 64 => .p64, | |
| 273 | 0...32 => .p32, | |
| 274 | 33...64 => .p64, | |
| 278 | 275 | else => return error.UnsupportedELFArchitecture, |
| 279 | 276 | }; |
| 280 | 277 | const self = try gpa.create(Elf); |
| ... | ... | @@ -752,40 +749,52 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void { |
| 752 | 749 | // These are LEB encoded but since the values are all less than 127 |
| 753 | 750 | // we can simply append these bytes. |
| 754 | 751 | const abbrev_buf = [_]u8{ |
| 755 | abbrev_compile_unit, DW.TAG_compile_unit, DW.CHILDREN_yes, // header | |
| 756 | DW.AT_stmt_list, DW.FORM_sec_offset, DW.AT_low_pc, | |
| 757 | DW.FORM_addr, DW.AT_high_pc, DW.FORM_addr, | |
| 758 | DW.AT_name, DW.FORM_strp, DW.AT_comp_dir, | |
| 759 | DW.FORM_strp, DW.AT_producer, DW.FORM_strp, | |
| 760 | DW.AT_language, DW.FORM_data2, 0, | |
| 752 | abbrev_compile_unit, DW.TAG_compile_unit, DW.CHILDREN_yes, // header | |
| 753 | DW.AT_stmt_list, DW.FORM_sec_offset, DW.AT_low_pc, | |
| 754 | DW.FORM_addr, DW.AT_high_pc, DW.FORM_addr, | |
| 755 | DW.AT_name, DW.FORM_strp, DW.AT_comp_dir, | |
| 756 | DW.FORM_strp, DW.AT_producer, DW.FORM_strp, | |
| 757 | DW.AT_language, DW.FORM_data2, 0, | |
| 761 | 758 | 0, // table sentinel |
| 762 | abbrev_subprogram, DW.TAG_subprogram, | |
| 759 | abbrev_subprogram, | |
| 760 | DW.TAG_subprogram, | |
| 763 | 761 | DW.CHILDREN_yes, // header |
| 764 | DW.AT_low_pc, DW.FORM_addr, | |
| 765 | DW.AT_high_pc, DW.FORM_data4, DW.AT_type, | |
| 766 | DW.FORM_ref4, DW.AT_name, DW.FORM_string, | |
| 767 | 0, 0, // table sentinel | |
| 768 | abbrev_subprogram_retvoid, | |
| 769 | DW.TAG_subprogram, DW.CHILDREN_yes, // header | |
| 770 | DW.AT_low_pc, | |
| 771 | DW.FORM_addr, DW.AT_high_pc, DW.FORM_data4, | |
| 772 | DW.AT_name, DW.FORM_string, 0, | |
| 762 | DW.AT_low_pc, | |
| 763 | DW.FORM_addr, | |
| 764 | DW.AT_high_pc, | |
| 765 | DW.FORM_data4, | |
| 766 | DW.AT_type, | |
| 767 | DW.FORM_ref4, | |
| 768 | DW.AT_name, | |
| 769 | DW.FORM_string, | |
| 770 | 0, 0, // table sentinel | |
| 771 | abbrev_subprogram_retvoid, | |
| 772 | DW.TAG_subprogram, DW.CHILDREN_yes, // header | |
| 773 | DW.AT_low_pc, DW.FORM_addr, | |
| 774 | DW.AT_high_pc, DW.FORM_data4, | |
| 775 | DW.AT_name, DW.FORM_string, | |
| 776 | 0, | |
| 773 | 777 | 0, // table sentinel |
| 774 | abbrev_base_type, DW.TAG_base_type, | |
| 778 | abbrev_base_type, | |
| 779 | DW.TAG_base_type, | |
| 775 | 780 | DW.CHILDREN_no, // header |
| 776 | DW.AT_encoding, DW.FORM_data1, | |
| 777 | DW.AT_byte_size, DW.FORM_data1, DW.AT_name, | |
| 778 | DW.FORM_string, 0, 0, // table sentinel | |
| 779 | ||
| 780 | abbrev_pad1, DW.TAG_unspecified_type, DW.CHILDREN_no, // header | |
| 781 | 0, 0, // table sentinel | |
| 782 | abbrev_parameter, | |
| 781 | DW.AT_encoding, | |
| 782 | DW.FORM_data1, | |
| 783 | DW.AT_byte_size, | |
| 784 | DW.FORM_data1, | |
| 785 | DW.AT_name, | |
| 786 | DW.FORM_string, 0, 0, // table sentinel | |
| 787 | abbrev_pad1, DW.TAG_unspecified_type, DW.CHILDREN_no, // header | |
| 788 | 0, 0, // table sentinel | |
| 789 | abbrev_parameter, | |
| 783 | 790 | DW.TAG_formal_parameter, DW.CHILDREN_no, // header |
| 784 | DW.AT_location, | |
| 785 | DW.FORM_exprloc, DW.AT_type, DW.FORM_ref4, | |
| 786 | DW.AT_name, DW.FORM_string, 0, | |
| 791 | DW.AT_location, DW.FORM_exprloc, | |
| 792 | DW.AT_type, DW.FORM_ref4, | |
| 793 | DW.AT_name, DW.FORM_string, | |
| 794 | 0, | |
| 787 | 795 | 0, // table sentinel |
| 788 | 0, 0, | |
| 796 | 0, | |
| 797 | 0, | |
| 789 | 798 | 0, // section sentinel |
| 790 | 799 | }; |
| 791 | 800 | |
| ... | ... | @@ -1021,7 +1030,6 @@ pub fn flushModule(self: *Elf, comp: *Compilation) !void { |
| 1021 | 1030 | 0, // `DW.LNS_set_prologue_end` |
| 1022 | 1031 | 0, // `DW.LNS_set_epilogue_begin` |
| 1023 | 1032 | 1, // `DW.LNS_set_isa` |
| 1024 | ||
| 1025 | 1033 | 0, // include_directories (none except the compilation unit cwd) |
| 1026 | 1034 | }); |
| 1027 | 1035 | // file_names[0] |
| ... | ... | @@ -1319,7 +1327,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1319 | 1327 | |
| 1320 | 1328 | var prev_digest_buf: [digest.len]u8 = undefined; |
| 1321 | 1329 | const prev_digest: []u8 = directory.handle.readLink(id_symlink_basename, &prev_digest_buf) catch |err| blk: { |
| 1322 | log.debug("ELF LLD new_digest={} readlink error: {}", .{digest, @errorName(err)}); | |
| 1330 | log.debug("ELF LLD new_digest={} readlink error: {}", .{ digest, @errorName(err) }); | |
| 1323 | 1331 | // Handle this as a cache miss. |
| 1324 | 1332 | break :blk prev_digest_buf[0..0]; |
| 1325 | 1333 | }; |
| ... | ... | @@ -1329,7 +1337,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1329 | 1337 | self.base.lock = man.toOwnedLock(); |
| 1330 | 1338 | return; |
| 1331 | 1339 | } |
| 1332 | log.debug("ELF LLD prev_digest={} new_digest={}", .{prev_digest, digest}); | |
| 1340 | log.debug("ELF LLD prev_digest={} new_digest={}", .{ prev_digest, digest }); | |
| 1333 | 1341 | |
| 1334 | 1342 | // We are about to change the output file to be different, so we invalidate the build hash now. |
| 1335 | 1343 | directory.handle.deleteFile(id_symlink_basename) catch |err| switch (err) { |
| ... | ... | @@ -1370,7 +1378,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1370 | 1378 | if (self.base.options.eh_frame_hdr) { |
| 1371 | 1379 | try argv.append("--eh-frame-hdr"); |
| 1372 | 1380 | } |
| 1373 | ||
| 1381 | ||
| 1374 | 1382 | if (self.base.options.emit_relocs) { |
| 1375 | 1383 | try argv.append("--emit-relocs"); |
| 1376 | 1384 | } |
| ... | ... | @@ -1491,9 +1499,9 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1491 | 1499 | |
| 1492 | 1500 | if (is_dyn_lib) { |
| 1493 | 1501 | const soname = self.base.options.override_soname orelse if (self.base.options.version) |ver| |
| 1494 | try std.fmt.allocPrint(arena, "lib{}.so.{}", .{self.base.options.root_name, ver.major}) | |
| 1495 | else | |
| 1496 | try std.fmt.allocPrint(arena, "lib{}.so", .{self.base.options.root_name}); | |
| 1502 | try std.fmt.allocPrint(arena, "lib{}.so.{}", .{ self.base.options.root_name, ver.major }) | |
| 1503 | else | |
| 1504 | try std.fmt.allocPrint(arena, "lib{}.so", .{self.base.options.root_name}); | |
| 1497 | 1505 | try argv.append("-soname"); |
| 1498 | 1506 | try argv.append(soname); |
| 1499 | 1507 | |
| ... | ... | @@ -1616,7 +1624,11 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1616 | 1624 | }; |
| 1617 | 1625 | defer stdout_context.data.deinit(); |
| 1618 | 1626 | const llvm = @import("../llvm.zig"); |
| 1619 | const ok = llvm.Link(.ELF, new_argv.ptr, new_argv.len, append_diagnostic, | |
| 1627 | const ok = llvm.Link( | |
| 1628 | .ELF, | |
| 1629 | new_argv.ptr, | |
| 1630 | new_argv.len, | |
| 1631 | append_diagnostic, | |
| 1620 | 1632 | @ptrToInt(&stdout_context), |
| 1621 | 1633 | @ptrToInt(&stderr_context), |
| 1622 | 1634 | ); |
| ... | ... | @@ -1642,7 +1654,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1642 | 1654 | }; |
| 1643 | 1655 | // Again failure here only means an unnecessary cache miss. |
| 1644 | 1656 | man.writeManifest() catch |err| { |
| 1645 | std.log.warn("failed to write cache manifest when linking: {}", .{ @errorName(err) }); | |
| 1657 | std.log.warn("failed to write cache manifest when linking: {}", .{@errorName(err)}); | |
| 1646 | 1658 | }; |
| 1647 | 1659 | // We hang on to this lock so that the output file path can be used without |
| 1648 | 1660 | // other processes clobbering it. |
| ... | ... | @@ -2877,8 +2889,8 @@ fn dbgLineNeededHeaderBytes(self: Elf) u32 { |
| 2877 | 2889 | const root_src_dir_path_len = if (self.base.options.module.?.root_pkg.root_src_directory.path) |p| p.len else 1; // "." |
| 2878 | 2890 | return @intCast(u32, 53 + directory_entry_format_count * 2 + file_name_entry_format_count * 2 + |
| 2879 | 2891 | directory_count * 8 + file_name_count * 8 + |
| 2880 | // These are encoded as DW.FORM_string rather than DW.FORM_strp as we would like | |
| 2881 | // because of a workaround for readelf and gdb failing to understand DWARFv5 correctly. | |
| 2892 | // These are encoded as DW.FORM_string rather than DW.FORM_strp as we would like | |
| 2893 | // because of a workaround for readelf and gdb failing to understand DWARFv5 correctly. | |
| 2882 | 2894 | root_src_dir_path_len + |
| 2883 | 2895 | self.base.options.module.?.root_pkg.root_src_path.len); |
| 2884 | 2896 | } |