| author | |
| committer | |
| log | bac57b3d15b84b1e4d5365acde3a78d98f439de3 |
| tree | f6ebfb619bec8703852c9580e44e9ec9d1437f38 |
| parent | be38eff2c0723d995df56c97bc582c8403c6803d |
28 files changed, 269 insertions(+), 187 deletions(-)
src/Compilation.zig+1| ... | ... | @@ -2384,6 +2384,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2384 | 2384 | comp.verbose_llvm_bc != null)) |
| 2385 | 2385 | { |
| 2386 | 2386 | if (opt_zcu) |zcu| { |
| 2387 | dev.check(.llvm_backend); | |
| 2387 | 2388 | zcu.llvm_object = try LlvmObject.create(arena, zcu); |
| 2388 | 2389 | } |
| 2389 | 2390 | } |
src/Zcu.zig+99-62| ... | ... | @@ -4572,13 +4572,17 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.lang.CallingConvention) union(enum) |
| 4572 | 4572 | if (allowed_arch == target.cpu.arch) break; |
| 4573 | 4573 | } else return .{ .bad_arch = cc.archs() }, |
| 4574 | 4574 | } |
| 4575 | const backend_ok = switch (backend) { | |
| 4575 | const backend_ok = ok: switch (backend) { | |
| 4576 | 4576 | .stage1 => unreachable, |
| 4577 | 4577 | .other => unreachable, |
| 4578 | 4578 | _ => unreachable, |
| 4579 | 4579 | |
| 4580 | .stage2_llvm => @import("codegen/llvm.zig").toLlvmCallConv(cc, target) != null, | |
| 4581 | .stage2_c => ok: { | |
| 4580 | .stage2_llvm => { | |
| 4581 | dev.check(.llvm_backend); | |
| 4582 | break :ok @import("codegen/llvm.zig").toLlvmCallConv(cc, target) != null; | |
| 4583 | }, | |
| 4584 | .stage2_c => { | |
| 4585 | dev.check(.c_backend); | |
| 4582 | 4586 | if (target.cCallingConvention()) |default_c| { |
| 4583 | 4587 | if (cc.eql(default_c)) { |
| 4584 | 4588 | break :ok true; |
| ... | ... | @@ -4636,74 +4640,107 @@ pub fn callconvSupported(zcu: *Zcu, cc: std.lang.CallingConvention) union(enum) |
| 4636 | 4640 | else => false, |
| 4637 | 4641 | }; |
| 4638 | 4642 | }, |
| 4639 | .stage2_wasm => switch (cc) { | |
| 4640 | .wasm_mvp => |opts| opts.incoming_stack_alignment == null, | |
| 4641 | else => false, | |
| 4642 | }, | |
| 4643 | .stage2_arm => switch (cc) { | |
| 4644 | .arm_aapcs => |opts| opts.incoming_stack_alignment == null, | |
| 4645 | .naked => true, | |
| 4646 | else => false, | |
| 4647 | }, | |
| 4648 | .stage2_x86_64 => switch (cc) { | |
| 4649 | .x86_64_sysv, .x86_64_win, .naked => true, // incoming stack alignment supported | |
| 4650 | else => false, | |
| 4643 | .stage2_wasm => { | |
| 4644 | dev.check(.wasm_backend); | |
| 4645 | break :ok switch (cc) { | |
| 4646 | .wasm_mvp => |opts| opts.incoming_stack_alignment == null, | |
| 4647 | else => false, | |
| 4648 | }; | |
| 4651 | 4649 | }, |
| 4652 | .stage2_aarch64 => switch (cc) { | |
| 4653 | .aarch64_aapcs, .aarch64_aapcs_darwin, .naked => true, | |
| 4654 | else => false, | |
| 4650 | .stage2_arm => { | |
| 4651 | dev.check(.arm_backend); | |
| 4652 | break :ok switch (cc) { | |
| 4653 | .arm_aapcs => |opts| opts.incoming_stack_alignment == null, | |
| 4654 | .naked => true, | |
| 4655 | else => false, | |
| 4656 | }; | |
| 4655 | 4657 | }, |
| 4656 | .stage2_x86 => switch (cc) { | |
| 4657 | .x86_sysv, | |
| 4658 | .x86_win, | |
| 4659 | .x86_mingw, | |
| 4660 | => |opts| opts.incoming_stack_alignment == null and opts.register_params == 0, | |
| 4661 | .naked => true, | |
| 4662 | else => false, | |
| 4658 | .stage2_x86_64 => { | |
| 4659 | dev.check(.x86_64_backend); | |
| 4660 | break :ok switch (cc) { | |
| 4661 | .x86_64_sysv, .x86_64_win, .naked => true, // incoming stack alignment supported | |
| 4662 | else => false, | |
| 4663 | }; | |
| 4663 | 4664 | }, |
| 4664 | .stage2_powerpc => switch (target.cpu.arch) { | |
| 4665 | .powerpc, .powerpcle => switch (cc) { | |
| 4666 | .powerpc_sysv, | |
| 4667 | .powerpc_sysv_altivec, | |
| 4668 | .powerpc_aix, | |
| 4669 | .powerpc_aix_altivec, | |
| 4670 | .naked, | |
| 4671 | => true, | |
| 4665 | .stage2_aarch64 => { | |
| 4666 | dev.check(.aarch64_backend); | |
| 4667 | break :ok switch (cc) { | |
| 4668 | .aarch64_aapcs, .aarch64_aapcs_darwin, .naked => true, | |
| 4672 | 4669 | else => false, |
| 4673 | }, | |
| 4674 | .powerpc64, .powerpc64le => switch (cc) { | |
| 4675 | .powerpc64_elf, | |
| 4676 | .powerpc64_elf_altivec, | |
| 4677 | .powerpc64_elf_v2, | |
| 4678 | .naked, | |
| 4679 | => true, | |
| 4670 | }; | |
| 4671 | }, | |
| 4672 | .stage2_x86 => { | |
| 4673 | dev.check(.x86_backend); | |
| 4674 | break :ok switch (cc) { | |
| 4675 | .x86_sysv, | |
| 4676 | .x86_win, | |
| 4677 | .x86_mingw, | |
| 4678 | => |opts| opts.incoming_stack_alignment == null and opts.register_params == 0, | |
| 4679 | .naked => true, | |
| 4680 | 4680 | else => false, |
| 4681 | }, | |
| 4682 | else => unreachable, | |
| 4681 | }; | |
| 4683 | 4682 | }, |
| 4684 | .stage2_riscv64 => switch (cc) { | |
| 4685 | .riscv64_lp64 => |opts| opts.incoming_stack_alignment == null, | |
| 4686 | .naked => true, | |
| 4687 | else => false, | |
| 4683 | .stage2_powerpc => { | |
| 4684 | dev.check(.powerpc_backend); | |
| 4685 | break :ok switch (target.cpu.arch) { | |
| 4686 | .powerpc, .powerpcle => switch (cc) { | |
| 4687 | .powerpc_sysv, | |
| 4688 | .powerpc_sysv_altivec, | |
| 4689 | .powerpc_aix, | |
| 4690 | .powerpc_aix_altivec, | |
| 4691 | .naked, | |
| 4692 | => true, | |
| 4693 | else => false, | |
| 4694 | }, | |
| 4695 | .powerpc64, .powerpc64le => switch (cc) { | |
| 4696 | .powerpc64_elf, | |
| 4697 | .powerpc64_elf_altivec, | |
| 4698 | .powerpc64_elf_v2, | |
| 4699 | .naked, | |
| 4700 | => true, | |
| 4701 | else => false, | |
| 4702 | }, | |
| 4703 | else => unreachable, | |
| 4704 | }; | |
| 4688 | 4705 | }, |
| 4689 | .stage2_sparc64 => switch (cc) { | |
| 4690 | .sparc64_sysv => |opts| opts.incoming_stack_alignment == null, | |
| 4691 | .naked => true, | |
| 4692 | else => false, | |
| 4706 | .stage2_riscv64 => { | |
| 4707 | dev.check(.riscv64_backend); | |
| 4708 | break :ok switch (cc) { | |
| 4709 | .riscv64_lp64 => |opts| opts.incoming_stack_alignment == null, | |
| 4710 | .naked => true, | |
| 4711 | else => false, | |
| 4712 | }; | |
| 4713 | }, | |
| 4714 | .stage2_sparc64 => { | |
| 4715 | dev.check(.sparc64_backend); | |
| 4716 | break :ok switch (cc) { | |
| 4717 | .sparc64_sysv => |opts| opts.incoming_stack_alignment == null, | |
| 4718 | .naked => true, | |
| 4719 | else => false, | |
| 4720 | }; | |
| 4693 | 4721 | }, |
| 4694 | .stage2_spirv => switch (cc) { | |
| 4695 | .spirv_device, .spirv_kernel => true, | |
| 4696 | .spirv_fragment, .spirv_vertex => target.os.tag == .vulkan or target.os.tag == .opengl, | |
| 4697 | .spirv_task, .spirv_mesh => target.os.tag == .vulkan, | |
| 4698 | else => false, | |
| 4722 | .stage2_spirv => { | |
| 4723 | dev.check(.spirv_backend); | |
| 4724 | break :ok switch (cc) { | |
| 4725 | .spirv_device, .spirv_kernel => true, | |
| 4726 | .spirv_fragment, .spirv_vertex => target.os.tag == .vulkan or target.os.tag == .opengl, | |
| 4727 | .spirv_task, .spirv_mesh => target.os.tag == .vulkan, | |
| 4728 | else => false, | |
| 4729 | }; | |
| 4699 | 4730 | }, |
| 4700 | .stage2_loongarch => switch (cc) { | |
| 4701 | .loongarch64_lp64, .loongarch32_ilp32, .naked => true, | |
| 4702 | else => false, | |
| 4731 | .stage2_loongarch => { | |
| 4732 | dev.check(.loongarch_backend); | |
| 4733 | break :ok switch (cc) { | |
| 4734 | .loongarch64_lp64, .loongarch32_ilp32, .naked => true, | |
| 4735 | else => false, | |
| 4736 | }; | |
| 4703 | 4737 | }, |
| 4704 | .zsf_spork8 => switch (cc) { | |
| 4705 | .spork8, .naked => true, | |
| 4706 | else => false, | |
| 4738 | .zsf_spork8 => { | |
| 4739 | dev.check(.spork8_backend); | |
| 4740 | break :ok switch (cc) { | |
| 4741 | .spork8, .naked => true, | |
| 4742 | else => false, | |
| 4743 | }; | |
| 4707 | 4744 | }, |
| 4708 | 4745 | }; |
| 4709 | 4746 | if (!backend_ok) return .{ .bad_backend = backend }; |
| ... | ... | @@ -5243,7 +5280,7 @@ pub const CodegenTaskPool = struct { |
| 5243 | 5280 | /// memory on AIR/MIR, we see a limit of around 10 MiB of AIR in-flight. |
| 5244 | 5281 | const max_air_bytes_in_flight = 10 * 1024 * 1024; |
| 5245 | 5282 | |
| 5246 | const max_funcs_in_flight = @import("link.zig").Queue.buffer_size; | |
| 5283 | const max_funcs_in_flight = link.Queue.buffer_size; | |
| 5247 | 5284 | |
| 5248 | 5285 | available_air_bytes: u32, |
| 5249 | 5286 |
src/Zcu/PerThread.zig+1-2| ... | ... | @@ -4461,8 +4461,7 @@ pub fn runCodegen(pt: Zcu.PerThread, func_index: InternPool.Index, air: *Air) Ru |
| 4461 | 4461 | comp.config.use_llvm, |
| 4462 | 4462 | )) { |
| 4463 | 4463 | else => unreachable, // assertion failure |
| 4464 | .stage2_llvm, | |
| 4465 | => {}, | |
| 4464 | .stage2_llvm => {}, | |
| 4466 | 4465 | }, |
| 4467 | 4466 | error.Canceled => |e| return e, |
| 4468 | 4467 | } |
src/codegen.zig-2| ... | ... | @@ -744,7 +744,6 @@ fn lowerUavRef( |
| 744 | 744 | .c => unreachable, |
| 745 | 745 | .spirv => unreachable, |
| 746 | 746 | .wasm => { |
| 747 | dev.check(link.File.Tag.wasm.devFeature()); | |
| 748 | 747 | const wasm = lf.cast(.wasm).?; |
| 749 | 748 | assert(reloc_parent == .none); |
| 750 | 749 | try wasm.addUavReloc(w.end, uav.val, uav.orig_ty, @intCast(offset)); |
| ... | ... | @@ -797,7 +796,6 @@ fn lowerNavRef( |
| 797 | 796 | .c => unreachable, |
| 798 | 797 | .spirv => unreachable, |
| 799 | 798 | .wasm => { |
| 800 | dev.check(link.File.Tag.wasm.devFeature()); | |
| 801 | 799 | const wasm = lf.cast(.wasm).?; |
| 802 | 800 | assert(reloc_parent == .none); |
| 803 | 801 | try wasm.addNavReloc(w.end, nav_index, nav_ty, @intCast(offset)); |
src/codegen/c.zig+1-2| ... | ... | @@ -7,7 +7,6 @@ const Allocator = mem.Allocator; |
| 7 | 7 | const Writer = std.Io.Writer; |
| 8 | 8 | |
| 9 | 9 | const codegen = @import("../codegen.zig"); |
| 10 | const dev = @import("../dev.zig"); | |
| 11 | 10 | const link = @import("../link.zig"); |
| 12 | 11 | const Zcu = @import("../Zcu.zig"); |
| 13 | 12 | const Module = @import("../Module.zig"); |
| ... | ... | @@ -25,7 +24,7 @@ const BigIntLimb = std.math.big.Limb; |
| 25 | 24 | const BigInt = std.math.big.int; |
| 26 | 25 | |
| 27 | 26 | pub fn legalizeFeatures(_: *const std.Target) ?*const Air.Legalize.Features { |
| 28 | return comptime switch (dev.env.supports(.legalize)) { | |
| 27 | return comptime switch (@import("../dev.zig").env.supports(.legalize)) { | |
| 29 | 28 | inline false, true => |supports_legalize| &.init(.{ |
| 30 | 29 | // we don't currently ask zig1 to use safe optimization modes |
| 31 | 30 | .expand_bit_cast_safe = supports_legalize, |
src/codegen/llvm.zig+1-3| ... | ... | @@ -10,7 +10,6 @@ const build_options = @import("build_options"); |
| 10 | 10 | const Air = @import("../Air.zig"); |
| 11 | 11 | const codegen = @import("../codegen.zig"); |
| 12 | 12 | const Compilation = @import("../Compilation.zig"); |
| 13 | const dev = @import("../dev.zig"); | |
| 14 | 13 | const InternPool = @import("../InternPool.zig"); |
| 15 | 14 | const link = @import("../link.zig"); |
| 16 | 15 | const Module = @import("../Module.zig"); |
| ... | ... | @@ -155,12 +154,11 @@ pub const Object = struct { |
| 155 | 154 | /// Values for `@llvm.used`. |
| 156 | 155 | used: std.ArrayList(Builder.Constant), |
| 157 | 156 | |
| 158 | pub const Ptr = if (dev.env.supports(.llvm_backend)) *Object else noreturn; | |
| 157 | pub const Ptr = if (@import("../dev.zig").env.supports(.llvm_backend)) *Object else noreturn; | |
| 159 | 158 | |
| 160 | 159 | const TypeMap = std.AutoHashMapUnmanaged(InternPool.Index, Builder.Type); |
| 161 | 160 | |
| 162 | 161 | pub fn create(arena: Allocator, zcu: *Zcu) !Ptr { |
| 163 | dev.check(.llvm_backend); | |
| 164 | 162 | const comp = zcu.comp; |
| 165 | 163 | const gpa = comp.gpa; |
| 166 | 164 | const target = zcu.getTarget(); |
src/crash_report.zig-1| ... | ... | @@ -215,7 +215,6 @@ const Sema = @import("Sema.zig"); |
| 215 | 215 | const Zcu = @import("Zcu.zig"); |
| 216 | 216 | const link = @import("link.zig"); |
| 217 | 217 | const InternPool = @import("InternPool.zig"); |
| 218 | const dev = @import("dev.zig"); | |
| 219 | 218 | const print_zir = @import("print_zir.zig"); |
| 220 | 219 | |
| 221 | 220 | const build_options = @import("build_options"); |
src/dev.zig-1| ... | ... | @@ -227,7 +227,6 @@ pub const Env = enum { |
| 227 | 227 | else => Env.sema.supports(feature), |
| 228 | 228 | }, |
| 229 | 229 | .@"x86_64-windows" => switch (feature) { |
| 230 | .build_command, | |
| 231 | 230 | .stdio_listen, |
| 232 | 231 | .incremental, |
| 233 | 232 | .legalize, |
src/link.zig+1-5| ... | ... | @@ -97,7 +97,6 @@ pub const Diags = struct { |
| 97 | 97 | return switch (msg.source_location) { |
| 98 | 98 | .none => try bundle.addString(msg.msg), |
| 99 | 99 | .wasm => |sl| { |
| 100 | dev.check(.wasm_linker); | |
| 101 | 100 | const wasm = base.?.cast(.wasm).?; |
| 102 | 101 | return sl.string(msg.msg, bundle, wasm); |
| 103 | 102 | }, |
| ... | ... | @@ -396,8 +395,6 @@ pub const Diags = struct { |
| 396 | 395 | } |
| 397 | 396 | }; |
| 398 | 397 | |
| 399 | pub const producer_string = if (builtin.is_test) "zig test" else "zig " ++ build_options.version; | |
| 400 | ||
| 401 | 398 | pub const File = struct { |
| 402 | 399 | tag: Tag, |
| 403 | 400 | |
| ... | ... | @@ -655,7 +652,6 @@ pub const File = struct { |
| 655 | 652 | base.file = try emit.root_dir.handle.openFile(io, emit.sub_path, .{ .mode = .read_write }); |
| 656 | 653 | }, |
| 657 | 654 | .elf2, .coff2 => if (base.file == null) { |
| 658 | dev.checkAny(&.{ .elf2_linker, .coff2_linker }); | |
| 659 | 655 | const mf = if (base.cast(.elf2)) |elf| |
| 660 | 656 | &elf.mf |
| 661 | 657 | else if (base.cast(.coff2)) |coff| |
| ... | ... | @@ -1347,7 +1343,7 @@ pub const File = struct { |
| 1347 | 1343 | }; |
| 1348 | 1344 | } |
| 1349 | 1345 | |
| 1350 | pub fn devFeature(tag: Tag) dev.Feature { | |
| 1346 | fn devFeature(tag: Tag) dev.Feature { | |
| 1351 | 1347 | return @field(dev.Feature, @tagName(tag) ++ "_linker"); |
| 1352 | 1348 | } |
| 1353 | 1349 | }; |
src/link/Coff.zig+1-1| ... | ... | @@ -13,7 +13,7 @@ const codegen = @import("../codegen.zig"); |
| 13 | 13 | const Compilation = @import("../Compilation.zig"); |
| 14 | 14 | const InternPool = @import("../InternPool.zig"); |
| 15 | 15 | const link = @import("../link.zig"); |
| 16 | const MappedFile = @import("MappedFile.zig"); | |
| 16 | const MappedFile = link.MappedFile; | |
| 17 | 17 | const target_util = @import("../target.zig"); |
| 18 | 18 | const Type = @import("../Type.zig"); |
| 19 | 19 | const Value = @import("../Value.zig"); |
src/link/ConstPool.zig+25-4| ... | ... | @@ -45,11 +45,22 @@ pub const Index = enum(u32) { |
| 45 | 45 | }; |
| 46 | 46 | |
| 47 | 47 | pub const User = union(enum) { |
| 48 | dwarf: *@import("Dwarf.zig"), | |
| 48 | elf: *@import("Dwarf.zig"), | |
| 49 | 49 | elf2: *@import("Elf2.zig"), |
| 50 | macho: *@import("Dwarf.zig"), | |
| 50 | 51 | c: *@import("C.zig"), |
| 51 | 52 | llvm: @import("../codegen/llvm.zig").Object.Ptr, |
| 52 | 53 | |
| 54 | fn devFeature(tag: @typeInfo(User).@"union".tag_type.?) dev.Feature { | |
| 55 | return switch (tag) { | |
| 56 | .elf => .elf_linker, | |
| 57 | .elf2 => .elf2_linker, | |
| 58 | .macho => .macho_linker, | |
| 59 | .c => .c_linker, | |
| 60 | .llvm => .llvm_backend, | |
| 61 | }; | |
| 62 | } | |
| 63 | ||
| 53 | 64 | /// Inform the debug info implementation that the new constant `val` was added to the pool at |
| 54 | 65 | /// the given index (which equals the current pool length) due to a `get` call. It is guaranteed |
| 55 | 66 | /// that there will eventually be a call to either `updateConst` or `updateConstIncomplete` |
| ... | ... | @@ -61,7 +72,10 @@ pub const User = union(enum) { |
| 61 | 72 | val: InternPool.Index, |
| 62 | 73 | ) link.Error!void { |
| 63 | 74 | switch (user) { |
| 64 | inline else => |impl| return impl.addConst(pt, index, val), | |
| 75 | inline else => |impl, tag| { | |
| 76 | dev.check(devFeature(tag)); | |
| 77 | return impl.addConst(pt, index, val); | |
| 78 | }, | |
| 65 | 79 | } |
| 66 | 80 | } |
| 67 | 81 | |
| ... | ... | @@ -76,7 +90,10 @@ pub const User = union(enum) { |
| 76 | 90 | val: InternPool.Index, |
| 77 | 91 | ) link.Error!void { |
| 78 | 92 | switch (user) { |
| 79 | inline else => |impl| return impl.updateConst(pt, index, val), | |
| 93 | inline else => |impl, tag| { | |
| 94 | dev.check(devFeature(tag)); | |
| 95 | return impl.updateConst(pt, index, val); | |
| 96 | }, | |
| 80 | 97 | } |
| 81 | 98 | } |
| 82 | 99 | |
| ... | ... | @@ -92,7 +109,10 @@ pub const User = union(enum) { |
| 92 | 109 | val: InternPool.Index, |
| 93 | 110 | ) link.Error!void { |
| 94 | 111 | switch (user) { |
| 95 | inline else => |impl| return impl.updateConstIncomplete(pt, index, val), | |
| 112 | inline else => |impl, tag| { | |
| 113 | dev.check(devFeature(tag)); | |
| 114 | return impl.updateConstIncomplete(pt, index, val); | |
| 115 | }, | |
| 96 | 116 | } |
| 97 | 117 | } |
| 98 | 118 | }; |
| ... | ... | @@ -289,6 +309,7 @@ fn registerTypeDeps(pool: *ConstPool, root: Index, ty: Type, zcu: *const Zcu) Al |
| 289 | 309 | const std = @import("std"); |
| 290 | 310 | const Allocator = std.mem.Allocator; |
| 291 | 311 | |
| 312 | const dev = @import("../dev.zig"); | |
| 292 | 313 | const InternPool = @import("../InternPool.zig"); |
| 293 | 314 | const link = @import("../link.zig"); |
| 294 | 315 | const Type = @import("../Type.zig"); |
src/link/Dwarf.zig+24-16| ... | ... | @@ -122,7 +122,7 @@ const DebugFrame = struct { |
| 122 | 122 | uleb128Bytes(1) + 1, |
| 123 | 123 | } + switch (target.cpu.arch) { |
| 124 | 124 | .x86_64 => len: { |
| 125 | dev.check(.x86_64_backend); | |
| 125 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 126 | 126 | const Register = @import("../codegen/x86_64/bits.zig").Register; |
| 127 | 127 | break :len uleb128Bytes(1) + sleb128Bytes(-8) + uleb128Bytes(Register.rip.dwarfNum()) + |
| 128 | 128 | 1 + uleb128Bytes(Register.rsp.dwarfNum()) + sleb128Bytes(-1) + |
| ... | ... | @@ -2092,7 +2092,7 @@ pub const WipNav = struct { |
| 2092 | 2092 | assert(value.typeOf(wip_nav.pt.zcu).comptimeOnly(wip_nav.pt.zcu)); |
| 2093 | 2093 | } |
| 2094 | 2094 | const dwarf = wip_nav.dwarf; |
| 2095 | const index = try dwarf.const_pool.get(wip_nav.pt, .{ .dwarf = dwarf }, value.toIntern()); | |
| 2095 | const index = try dwarf.const_pool.get(wip_nav.pt, dwarf.constPoolUser(), value.toIntern()); | |
| 2096 | 2096 | return dwarf.values.items[@backingInt(index)]; |
| 2097 | 2097 | } |
| 2098 | 2098 | |
| ... | ... | @@ -3005,7 +3005,7 @@ fn finishWipNavWriterError( |
| 3005 | 3005 | try dwarf.debug_line.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_line.written()); |
| 3006 | 3006 | try dwarf.debug_loclists.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_loclists.written()); |
| 3007 | 3007 | |
| 3008 | try dwarf.const_pool.flushPending(pt, .{ .dwarf = dwarf }); | |
| 3008 | try dwarf.const_pool.flushPending(pt, dwarf.constPoolUser()); | |
| 3009 | 3009 | } |
| 3010 | 3010 | |
| 3011 | 3011 | pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) link.Error!void { |
| ... | ... | @@ -3067,8 +3067,8 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3067 | 3067 | const loaded_struct = ip.loadStructType(nav_val.toIntern()); |
| 3068 | 3068 | if (nav_index.toOptional() == loaded_struct.name_nav) { |
| 3069 | 3069 | // This Nav's entry is populated by the type, not the actual Nav. |
| 3070 | _ = try dwarf.const_pool.get(pt, .{ .dwarf = dwarf }, nav_val.toIntern()); | |
| 3071 | try dwarf.const_pool.flushPending(pt, .{ .dwarf = dwarf }); | |
| 3070 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | |
| 3071 | try dwarf.const_pool.flushPending(pt, dwarf.constPoolUser()); | |
| 3072 | 3072 | return; |
| 3073 | 3073 | } |
| 3074 | 3074 | break :tag .alias; |
| ... | ... | @@ -3077,8 +3077,8 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3077 | 3077 | const loaded_enum = ip.loadEnumType(nav_val.toIntern()); |
| 3078 | 3078 | if (nav_index.toOptional() == loaded_enum.name_nav) { |
| 3079 | 3079 | // This Nav's entry is populated by the type, not the actual Nav. |
| 3080 | _ = try dwarf.const_pool.get(pt, .{ .dwarf = dwarf }, nav_val.toIntern()); | |
| 3081 | try dwarf.const_pool.flushPending(pt, .{ .dwarf = dwarf }); | |
| 3080 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | |
| 3081 | try dwarf.const_pool.flushPending(pt, dwarf.constPoolUser()); | |
| 3082 | 3082 | return; |
| 3083 | 3083 | } |
| 3084 | 3084 | break :tag .alias; |
| ... | ... | @@ -3087,8 +3087,8 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3087 | 3087 | const loaded_union = ip.loadUnionType(nav_val.toIntern()); |
| 3088 | 3088 | if (nav_index.toOptional() == loaded_union.name_nav) { |
| 3089 | 3089 | // This Nav's entry is populated by the type, not the actual Nav. |
| 3090 | _ = try dwarf.const_pool.get(pt, .{ .dwarf = dwarf }, nav_val.toIntern()); | |
| 3091 | try dwarf.const_pool.flushPending(pt, .{ .dwarf = dwarf }); | |
| 3090 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | |
| 3091 | try dwarf.const_pool.flushPending(pt, dwarf.constPoolUser()); | |
| 3092 | 3092 | return; |
| 3093 | 3093 | } |
| 3094 | 3094 | break :tag .alias; |
| ... | ... | @@ -3097,8 +3097,8 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3097 | 3097 | const loaded_opaque = ip.loadOpaqueType(nav_val.toIntern()); |
| 3098 | 3098 | if (nav_index.toOptional() == loaded_opaque.name_nav) { |
| 3099 | 3099 | // This Nav's entry is populated by the type, not the actual Nav. |
| 3100 | _ = try dwarf.const_pool.get(pt, .{ .dwarf = dwarf }, nav_val.toIntern()); | |
| 3101 | try dwarf.const_pool.flushPending(pt, .{ .dwarf = dwarf }); | |
| 3100 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | |
| 3101 | try dwarf.const_pool.flushPending(pt, dwarf.constPoolUser()); | |
| 3102 | 3102 | return; |
| 3103 | 3103 | } |
| 3104 | 3104 | break :tag .alias; |
| ... | ... | @@ -3274,7 +3274,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3274 | 3274 | }, |
| 3275 | 3275 | } |
| 3276 | 3276 | try dwarf.debug_info.section.replaceEntry(unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 3277 | try dwarf.const_pool.flushPending(pt, .{ .dwarf = dwarf }); | |
| 3277 | try dwarf.const_pool.flushPending(pt, dwarf.constPoolUser()); | |
| 3278 | 3278 | } |
| 3279 | 3279 | |
| 3280 | 3280 | pub fn updateContainerType( |
| ... | ... | @@ -3283,7 +3283,7 @@ pub fn updateContainerType( |
| 3283 | 3283 | ty: InternPool.Index, |
| 3284 | 3284 | success: bool, |
| 3285 | 3285 | ) !void { |
| 3286 | try dwarf.const_pool.updateContainerType(pt, .{ .dwarf = dwarf }, ty, success); | |
| 3286 | try dwarf.const_pool.updateContainerType(pt, dwarf.constPoolUser(), ty, success); | |
| 3287 | 3287 | } |
| 3288 | 3288 | /// Should only be called by the `link.ConstPool` implementation. |
| 3289 | 3289 | pub fn addConst(dwarf: *Dwarf, pt: Zcu.PerThread, index: link.ConstPool.Index, val: InternPool.Index) Allocator.Error!void { |
| ... | ... | @@ -4702,7 +4702,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4702 | 4702 | |
| 4703 | 4703 | // Update `anyerror` based on the finished global error set. |
| 4704 | 4704 | { |
| 4705 | const index = try dwarf.const_pool.get(pt, .{ .dwarf = dwarf }, .anyerror_type); | |
| 4705 | const index = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), .anyerror_type); | |
| 4706 | 4706 | const unit, const entry = dwarf.values.items[@backingInt(index)]; |
| 4707 | 4707 | var wip_nav: WipNav = .{ |
| 4708 | 4708 | .dwarf = dwarf, |
| ... | ... | @@ -4737,7 +4737,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4737 | 4737 | } |
| 4738 | 4738 | if (global_error_set_names.len > 0) try diw.writeUleb128(@backingInt(AbbrevCode.null)); |
| 4739 | 4739 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 4740 | try dwarf.const_pool.flushPending(pt, .{ .dwarf = dwarf }); | |
| 4740 | try dwarf.const_pool.flushPending(pt, dwarf.constPoolUser()); | |
| 4741 | 4741 | } |
| 4742 | 4742 | |
| 4743 | 4743 | for (dwarf.mods.keys(), dwarf.mods.values()) |mod, *mod_info| { |
| ... | ... | @@ -4789,7 +4789,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4789 | 4789 | .debug_frame => unreachable, |
| 4790 | 4790 | .eh_frame => switch (target.cpu.arch) { |
| 4791 | 4791 | .x86_64 => { |
| 4792 | dev.check(.x86_64_backend); | |
| 4792 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 4793 | 4793 | const Register = @import("../codegen/x86_64/bits.zig").Register; |
| 4794 | 4794 | for (dwarf.debug_frame.section.units.items) |*unit| { |
| 4795 | 4795 | header_aw.clearRetainingCapacity(); |
| ... | ... | @@ -6307,6 +6307,14 @@ fn getFile(dwarf: *Dwarf) ?Io.File { |
| 6307 | 6307 | return dwarf.bin_file.file; |
| 6308 | 6308 | } |
| 6309 | 6309 | |
| 6310 | fn constPoolUser(dwarf: *Dwarf) link.ConstPool.User { | |
| 6311 | return switch (dwarf.bin_file.tag) { | |
| 6312 | else => unreachable, | |
| 6313 | .elf => .{ .elf = dwarf }, | |
| 6314 | .macho => .{ .macho = dwarf }, | |
| 6315 | }; | |
| 6316 | } | |
| 6317 | ||
| 6310 | 6318 | fn addCommonEntry(dwarf: *Dwarf, unit: Unit.Index) UpdateError!Entry.Index { |
| 6311 | 6319 | const entry = try dwarf.debug_aranges.section.getUnit(unit).addEntry(dwarf.gpa); |
| 6312 | 6320 | assert(try dwarf.debug_frame.section.getUnit(unit).addEntry(dwarf.gpa) == entry); |
src/link/Dwarf2.zig+69-64| ... | ... | @@ -27,15 +27,15 @@ pub const Unit = struct { |
| 27 | 27 | alive: bool, |
| 28 | 28 | dirs: std.array_hash_map.Auto(Unit.Index, void), |
| 29 | 29 | files: std.array_hash_map.Auto(Zcu.File.Index, void), |
| 30 | frame_ni: MappedFile.Node.Index.Optional, | |
| 31 | cie_ni: MappedFile.Node.Index.Optional, | |
| 32 | debug_info_ni: MappedFile.Node.Index.Optional, | |
| 33 | debug_info_header_ni: MappedFile.Node.Index.Optional, | |
| 34 | debug_info_footer_ni: MappedFile.Node.Index.Optional, | |
| 35 | debug_line_ni: MappedFile.Node.Index.Optional, | |
| 36 | debug_line_header_ni: MappedFile.Node.Index.Optional, | |
| 30 | frame_ni: link.MappedFile.Node.Index.Optional, | |
| 31 | cie_ni: link.MappedFile.Node.Index.Optional, | |
| 32 | debug_info_ni: link.MappedFile.Node.Index.Optional, | |
| 33 | debug_info_header_ni: link.MappedFile.Node.Index.Optional, | |
| 34 | debug_info_footer_ni: link.MappedFile.Node.Index.Optional, | |
| 35 | debug_line_ni: link.MappedFile.Node.Index.Optional, | |
| 36 | debug_line_header_ni: link.MappedFile.Node.Index.Optional, | |
| 37 | 37 | debug_line_header_changed: bool, |
| 38 | debug_rnglists_ni: MappedFile.Node.Index.Optional, | |
| 38 | debug_rnglists_ni: link.MappedFile.Node.Index.Optional, | |
| 39 | 39 | debug_rnglists_offsets_table_offset: usize, |
| 40 | 40 | debug_rnglists_end: usize, |
| 41 | 41 | |
| ... | ... | @@ -96,7 +96,7 @@ pub const Unit = struct { |
| 96 | 96 | }; |
| 97 | 97 | |
| 98 | 98 | pub const Const = struct { |
| 99 | debug_info_ni: MappedFile.Node.Index.Optional, | |
| 99 | debug_info_ni: link.MappedFile.Node.Index.Optional, | |
| 100 | 100 | |
| 101 | 101 | pub fn get(cpi: link.ConstPool.Index, dwarf: *Dwarf) *Const { |
| 102 | 102 | return &dwarf.consts.items[@backingInt(cpi)]; |
| ... | ... | @@ -104,7 +104,7 @@ pub const Const = struct { |
| 104 | 104 | }; |
| 105 | 105 | |
| 106 | 106 | pub const Global = struct { |
| 107 | debug_info_ni: MappedFile.Node.Index.Optional, | |
| 107 | debug_info_ni: link.MappedFile.Node.Index.Optional, | |
| 108 | 108 | |
| 109 | 109 | pub const Index = enum(u32) { |
| 110 | 110 | _, |
| ... | ... | @@ -121,9 +121,9 @@ pub const Global = struct { |
| 121 | 121 | |
| 122 | 122 | pub const Func = struct { |
| 123 | 123 | state: State, |
| 124 | fde_ni: MappedFile.Node.Index.Optional, | |
| 125 | debug_info_ni: MappedFile.Node.Index.Optional, | |
| 126 | debug_line_ni: MappedFile.Node.Index.Optional, | |
| 124 | fde_ni: link.MappedFile.Node.Index.Optional, | |
| 125 | debug_info_ni: link.MappedFile.Node.Index.Optional, | |
| 126 | debug_line_ni: link.MappedFile.Node.Index.Optional, | |
| 127 | 127 | |
| 128 | 128 | pub const State = enum { unresolved, resolved }; |
| 129 | 129 | |
| ... | ... | @@ -141,7 +141,7 @@ pub const Func = struct { |
| 141 | 141 | }; |
| 142 | 142 | |
| 143 | 143 | pub const Decl = struct { |
| 144 | debug_info_ni: MappedFile.Node.Index.Optional, | |
| 144 | debug_info_ni: link.MappedFile.Node.Index.Optional, | |
| 145 | 145 | |
| 146 | 146 | pub const Index = enum(u32) { |
| 147 | 147 | _, |
| ... | ... | @@ -170,7 +170,7 @@ pub const Frame = struct { |
| 170 | 170 | }; |
| 171 | 171 | |
| 172 | 172 | pub const Abbrev = struct { |
| 173 | ni: MappedFile.Node.Index.Optional, | |
| 173 | ni: link.MappedFile.Node.Index.Optional, | |
| 174 | 174 | end: usize, |
| 175 | 175 | set: std.enums.EnumSet(AbbrevCode), |
| 176 | 176 | }; |
| ... | ... | @@ -191,16 +191,16 @@ pub const Line = struct { |
| 191 | 191 | }; |
| 192 | 192 | |
| 193 | 193 | pub const Str = struct { |
| 194 | ni: MappedFile.Node.Index.Optional, | |
| 194 | ni: link.MappedFile.Node.Index.Optional, | |
| 195 | 195 | offset: usize, |
| 196 | 196 | map: std.HashMapUnmanaged(usize, void, Context, std.hash_map.default_max_load_percentage), |
| 197 | 197 | |
| 198 | 198 | fn get( |
| 199 | 199 | s: *Str, |
| 200 | 200 | gpa: std.mem.Allocator, |
| 201 | mf: *MappedFile, | |
| 201 | mf: *link.MappedFile, | |
| 202 | 202 | str: []const u8, |
| 203 | ) MappedFile.Error!usize { | |
| 203 | ) link.MappedFile.Error!usize { | |
| 204 | 204 | const ni = s.ni.unwrap().?; |
| 205 | 205 | const slice = ni.sliceConst(mf); |
| 206 | 206 | const gop = try s.map.getOrPutContextAdapted( |
| ... | ... | @@ -250,7 +250,7 @@ pub const Rnglists = struct { |
| 250 | 250 | }; |
| 251 | 251 | |
| 252 | 252 | pub const StrOffsets = struct { |
| 253 | ni: MappedFile.Node.Index.Optional, | |
| 253 | ni: link.MappedFile.Node.Index.Optional, | |
| 254 | 254 | offset: usize, |
| 255 | 255 | }; |
| 256 | 256 | |
| ... | ... | @@ -268,13 +268,13 @@ pub const Loc = union(enum) { |
| 268 | 268 | push_object_address, |
| 269 | 269 | call: struct { |
| 270 | 270 | args: []const Loc = &.{}, |
| 271 | node: MappedFile.Node.Index, | |
| 271 | node: link.MappedFile.Node.Index, | |
| 272 | 272 | }, |
| 273 | 273 | form_tls_address: *const Loc, |
| 274 | 274 | implicit_value: []const u8, |
| 275 | 275 | stack_value: *const Loc, |
| 276 | 276 | implicit_pointer: struct { |
| 277 | node: MappedFile.Node.Index, | |
| 277 | node: link.MappedFile.Node.Index, | |
| 278 | 278 | offset: i65 = 0, |
| 279 | 279 | }, |
| 280 | 280 | wasm_ext: union(enum) { |
| ... | ... | @@ -311,7 +311,7 @@ pub const Loc = union(enum) { |
| 311 | 311 | |
| 312 | 312 | fn write(loc: Loc, writer: union(enum) { |
| 313 | 313 | io: *std.Io.Writer, |
| 314 | mf: *MappedFile.Node.Writer, | |
| 314 | mf: *link.MappedFile.Node.Writer, | |
| 315 | 315 | }, dwarf: *Dwarf) link.EmitError!void { |
| 316 | 316 | const w = switch (writer) { |
| 317 | 317 | .io => |w| w, |
| ... | ... | @@ -631,7 +631,7 @@ pub const WipNav = struct { |
| 631 | 631 | cfa: Cfa.RegOff, |
| 632 | 632 | }, |
| 633 | 633 | frame_format: Frame.Format, |
| 634 | fde_writer: MappedFile.Node.Writer, | |
| 634 | fde_writer: link.MappedFile.Node.Writer, | |
| 635 | 635 | frame_func_length: struct { offset: usize, size: AddressSize }, |
| 636 | 636 | |
| 637 | 637 | pub const Debug = struct { |
| ... | ... | @@ -643,9 +643,9 @@ pub const WipNav = struct { |
| 643 | 643 | low_pc_off: usize, |
| 644 | 644 | high_pc: u32, |
| 645 | 645 | }), |
| 646 | info_writer: MappedFile.Node.Writer, | |
| 646 | info_writer: link.MappedFile.Node.Writer, | |
| 647 | 647 | info_func_length_offset: usize, |
| 648 | line_writer: MappedFile.Node.Writer, | |
| 648 | line_writer: link.MappedFile.Node.Writer, | |
| 649 | 649 | |
| 650 | 650 | pub fn deinit(debug: *Debug) void { |
| 651 | 651 | const gpa = debug.pt.zcu.gpa; |
| ... | ... | @@ -1268,7 +1268,7 @@ pub fn init(lf: *link.File, format: DW.Format) Dwarf { |
| 1268 | 1268 | }, |
| 1269 | 1269 | .frame = .{ |
| 1270 | 1270 | .header = if (target.cpu.arch == .x86_64 and target.ofmt == .elf) header: { |
| 1271 | dev.check(.x86_64_backend); | |
| 1271 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1272 | 1272 | const Register = @import("../codegen/x86_64/bits.zig").Register; |
| 1273 | 1273 | break :header comptime .{ |
| 1274 | 1274 | .code_alignment_factor = 1, |
| ... | ... | @@ -1385,7 +1385,7 @@ pub fn getUnit(dwarf: *Dwarf, mod: *Module) Unit.Index { |
| 1385 | 1385 | |
| 1386 | 1386 | pub fn getConst(dwarf: *Dwarf, pt: Zcu.PerThread, val: Value) link.Error!link.ConstPool.Index { |
| 1387 | 1387 | assert(val.typeOf(pt.zcu).comptimeOnly(pt.zcu)); |
| 1388 | return dwarf.const_pool.get(pt, .{ .elf2 = dwarf.lf.cast(.elf2).? }, val.toIntern()); | |
| 1388 | return dwarf.const_pool.get(pt, dwarf.constPoolUser(), val.toIntern()); | |
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | 1391 | pub fn getGlobal(dwarf: *Dwarf, nav: InternPool.Nav.Index) link.Error!Global.Index { |
| ... | ... | @@ -1514,7 +1514,7 @@ pub fn getDecl( |
| 1514 | 1514 | dwarf: *Dwarf, |
| 1515 | 1515 | pt: Zcu.PerThread, |
| 1516 | 1516 | instance_val: InternPool.Index, |
| 1517 | ) link.Error!MappedFile.Node.Index { | |
| 1517 | ) link.Error!link.MappedFile.Node.Index { | |
| 1518 | 1518 | assert(dwarf.pending_decl.instance_val == .none); |
| 1519 | 1519 | const comp = dwarf.lf.comp; |
| 1520 | 1520 | const gpa = comp.gpa; |
| ... | ... | @@ -1634,7 +1634,7 @@ pub fn genDebugFrameCie( |
| 1634 | 1634 | switch (arch orelse return) { |
| 1635 | 1635 | else => unreachable, |
| 1636 | 1636 | .x86_64 => { |
| 1637 | dev.check(.x86_64_backend); | |
| 1637 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1638 | 1638 | const Register = @import("../codegen/x86_64/bits.zig").Register; |
| 1639 | 1639 | switch (format) { |
| 1640 | 1640 | .eh_frame => try df_w.writeAll("zR\x00"), |
| ... | ... | @@ -1682,7 +1682,7 @@ pub fn genDebugInfoHeader( |
| 1682 | 1682 | zcu: *Zcu, |
| 1683 | 1683 | mod: *Module, |
| 1684 | 1684 | unit: *Unit, |
| 1685 | dih_nw: *MappedFile.Node.Writer, | |
| 1685 | dih_nw: *link.MappedFile.Node.Writer, | |
| 1686 | 1686 | ) link.EmitError!void { |
| 1687 | 1687 | const comp = zcu.comp; |
| 1688 | 1688 | const dih_w = &dih_nw.interface; |
| ... | ... | @@ -1728,7 +1728,7 @@ pub fn genDebugInfoHeader( |
| 1728 | 1728 | |
| 1729 | 1729 | fn genModuleDependency( |
| 1730 | 1730 | dwarf: *Dwarf, |
| 1731 | di_nw: *MappedFile.Node.Writer, | |
| 1731 | di_nw: *link.MappedFile.Node.Writer, | |
| 1732 | 1732 | name: []const u8, |
| 1733 | 1733 | dep: *Module, |
| 1734 | 1734 | module_offset: usize, |
| ... | ... | @@ -1773,7 +1773,7 @@ pub fn genDebugInfoPadding(dwarf: *Dwarf, di_w: *std.Io.Writer, size: u64) std.I |
| 1773 | 1773 | pub fn genDebugLineHeader( |
| 1774 | 1774 | dwarf: *Dwarf, |
| 1775 | 1775 | unit: *Unit, |
| 1776 | dlh_nw: *MappedFile.Node.Writer, | |
| 1776 | dlh_nw: *link.MappedFile.Node.Writer, | |
| 1777 | 1777 | zcu: *Zcu, |
| 1778 | 1778 | ) link.EmitError!void { |
| 1779 | 1779 | const comp = zcu.comp; |
| ... | ... | @@ -1911,7 +1911,7 @@ pub fn genDebugLinePadding(dl_w: *std.Io.Writer, size: u64) std.Io.Writer.Error! |
| 1911 | 1911 | pub fn genDebugRnglistsHeader( |
| 1912 | 1912 | dwarf: *Dwarf, |
| 1913 | 1913 | unit: *Unit, |
| 1914 | drh_nw: *MappedFile.Node.Writer, | |
| 1914 | drh_nw: *link.MappedFile.Node.Writer, | |
| 1915 | 1915 | ) std.Io.Writer.Error!void { |
| 1916 | 1916 | const drh_w = &drh_nw.interface; |
| 1917 | 1917 | try dwarf.genUnitLength(drh_w); |
| ... | ... | @@ -1931,7 +1931,7 @@ pub fn genDebugRnglistsHeader( |
| 1931 | 1931 | pub fn genDebugRnglists( |
| 1932 | 1932 | dwarf: *Dwarf, |
| 1933 | 1933 | unit: *Unit, |
| 1934 | dr_nw: *MappedFile.Node.Writer, | |
| 1934 | dr_nw: *link.MappedFile.Node.Writer, | |
| 1935 | 1935 | func_si: link.File.SymbolId, |
| 1936 | 1936 | func_length: u64, |
| 1937 | 1937 | ) link.EmitError!void { |
| ... | ... | @@ -1965,7 +1965,7 @@ pub fn updateComptimeNav( |
| 1965 | 1965 | .struct_type => { |
| 1966 | 1966 | const loaded_struct = ip.loadStructType(nav_val.toIntern()); |
| 1967 | 1967 | if (nav_index.toOptional() == loaded_struct.name_nav) { |
| 1968 | _ = try dwarf.const_pool.get(pt, .{ .elf2 = dwarf.lf.cast(.elf2).? }, nav_val.toIntern()); | |
| 1968 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | |
| 1969 | 1969 | break :done; |
| 1970 | 1970 | } |
| 1971 | 1971 | return; |
| ... | ... | @@ -1973,7 +1973,7 @@ pub fn updateComptimeNav( |
| 1973 | 1973 | .enum_type => { |
| 1974 | 1974 | const loaded_enum = ip.loadEnumType(nav_val.toIntern()); |
| 1975 | 1975 | if (nav_index.toOptional() == loaded_enum.name_nav) { |
| 1976 | _ = try dwarf.const_pool.get(pt, .{ .elf2 = dwarf.lf.cast(.elf2).? }, nav_val.toIntern()); | |
| 1976 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | |
| 1977 | 1977 | break :done; |
| 1978 | 1978 | } |
| 1979 | 1979 | return; |
| ... | ... | @@ -1981,7 +1981,7 @@ pub fn updateComptimeNav( |
| 1981 | 1981 | .union_type => { |
| 1982 | 1982 | const loaded_union = ip.loadUnionType(nav_val.toIntern()); |
| 1983 | 1983 | if (nav_index.toOptional() == loaded_union.name_nav) { |
| 1984 | _ = try dwarf.const_pool.get(pt, .{ .elf2 = dwarf.lf.cast(.elf2).? }, nav_val.toIntern()); | |
| 1984 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | |
| 1985 | 1985 | break :done; |
| 1986 | 1986 | } |
| 1987 | 1987 | return; |
| ... | ... | @@ -1989,13 +1989,13 @@ pub fn updateComptimeNav( |
| 1989 | 1989 | .opaque_type => { |
| 1990 | 1990 | const loaded_opaque = ip.loadOpaqueType(nav_val.toIntern()); |
| 1991 | 1991 | if (nav_index.toOptional() == loaded_opaque.name_nav) { |
| 1992 | _ = try dwarf.const_pool.get(pt, .{ .elf2 = dwarf.lf.cast(.elf2).? }, nav_val.toIntern()); | |
| 1992 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | |
| 1993 | 1993 | break :done; |
| 1994 | 1994 | } |
| 1995 | 1995 | return; |
| 1996 | 1996 | }, |
| 1997 | 1997 | .func => |func| if (func.owner_nav == nav_index and func.generic_owner == .none) { |
| 1998 | _ = try dwarf.const_pool.get(pt, .{ .elf2 = dwarf.lf.cast(.elf2).? }, nav_val.toIntern()); | |
| 1998 | _ = try dwarf.const_pool.get(pt, dwarf.constPoolUser(), nav_val.toIntern()); | |
| 1999 | 1999 | break :done; |
| 2000 | 2000 | } else return, |
| 2001 | 2001 | |
| ... | ... | @@ -2004,7 +2004,7 @@ pub fn updateComptimeNav( |
| 2004 | 2004 | // memoization, not values |
| 2005 | 2005 | .memoized_call => unreachable, |
| 2006 | 2006 | } |
| 2007 | try dwarf.const_pool.flushPending(pt, .{ .elf2 = dwarf.lf.cast(.elf2).? }); | |
| 2007 | try dwarf.const_pool.flushPending(pt, dwarf.constPoolUser()); | |
| 2008 | 2008 | } |
| 2009 | 2009 | |
| 2010 | 2010 | pub fn addConst( |
| ... | ... | @@ -2015,7 +2015,7 @@ pub fn addConst( |
| 2015 | 2015 | lf: *link.File, |
| 2016 | 2016 | ui: Unit.Index, |
| 2017 | 2017 | cpi: link.ConstPool.Index, |
| 2018 | ) link.Error!MappedFile.Node.Index, | |
| 2018 | ) link.Error!link.MappedFile.Node.Index, | |
| 2019 | 2019 | ) link.Error!void { |
| 2020 | 2020 | const zcu = dwarf.lf.comp.zcu.?; |
| 2021 | 2021 | const ip = &zcu.intern_pool; |
| ... | ... | @@ -2053,7 +2053,7 @@ pub fn addConst( |
| 2053 | 2053 | pub fn updateConst( |
| 2054 | 2054 | dwarf: *Dwarf, |
| 2055 | 2055 | pt: Zcu.PerThread, |
| 2056 | di_nw: *MappedFile.Node.Writer, | |
| 2056 | di_nw: *link.MappedFile.Node.Writer, | |
| 2057 | 2057 | val: InternPool.Index, |
| 2058 | 2058 | ) link.Error!void { |
| 2059 | 2059 | switch (val) { |
| ... | ... | @@ -2068,7 +2068,7 @@ pub fn updateConst( |
| 2068 | 2068 | fn updateConstInner( |
| 2069 | 2069 | dwarf: *Dwarf, |
| 2070 | 2070 | pt: Zcu.PerThread, |
| 2071 | di_nw: *MappedFile.Node.Writer, | |
| 2071 | di_nw: *link.MappedFile.Node.Writer, | |
| 2072 | 2072 | val: InternPool.Index, |
| 2073 | 2073 | ) link.EmitError!void { |
| 2074 | 2074 | const zcu = pt.zcu; |
| ... | ... | @@ -2956,7 +2956,7 @@ fn optRepr(opt_child_type: Type, zcu: *const Zcu) enum { unpacked, opv_null, err |
| 2956 | 2956 | pub fn updateConstIncomplete( |
| 2957 | 2957 | dwarf: *Dwarf, |
| 2958 | 2958 | pt: Zcu.PerThread, |
| 2959 | di_nw: *MappedFile.Node.Writer, | |
| 2959 | di_nw: *link.MappedFile.Node.Writer, | |
| 2960 | 2960 | val: InternPool.Index, |
| 2961 | 2961 | ) link.Error!void { |
| 2962 | 2962 | log.debug("updateConstIncomplete({f})", .{Value.fromInterned(val).fmtValue(pt)}); |
| ... | ... | @@ -2968,7 +2968,7 @@ pub fn updateConstIncomplete( |
| 2968 | 2968 | fn updateConstIncompleteInner( |
| 2969 | 2969 | dwarf: *Dwarf, |
| 2970 | 2970 | pt: Zcu.PerThread, |
| 2971 | di_nw: *MappedFile.Node.Writer, | |
| 2971 | di_nw: *link.MappedFile.Node.Writer, | |
| 2972 | 2972 | val: InternPool.Index, |
| 2973 | 2973 | ) link.EmitError!void { |
| 2974 | 2974 | const zcu = pt.zcu; |
| ... | ... | @@ -3185,7 +3185,7 @@ fn updateConstIncompleteInner( |
| 3185 | 3185 | fn genCaptures( |
| 3186 | 3186 | dwarf: *Dwarf, |
| 3187 | 3187 | pt: Zcu.PerThread, |
| 3188 | di_nw: *MappedFile.Node.Writer, | |
| 3188 | di_nw: *link.MappedFile.Node.Writer, | |
| 3189 | 3189 | captures: anytype, |
| 3190 | 3190 | ) link.EmitError!void { |
| 3191 | 3191 | const zcu = pt.zcu; |
| ... | ... | @@ -3229,7 +3229,7 @@ fn genCaptures( |
| 3229 | 3229 | pub fn genDecl( |
| 3230 | 3230 | dwarf: *Dwarf, |
| 3231 | 3231 | pt: Zcu.PerThread, |
| 3232 | di_nw: *MappedFile.Node.Writer, | |
| 3232 | di_nw: *link.MappedFile.Node.Writer, | |
| 3233 | 3233 | instance_val: InternPool.Index, |
| 3234 | 3234 | ) link.Error!void { |
| 3235 | 3235 | log.debug("genDecl({f})", .{Value.fromInterned(instance_val).fmtValue(pt)}); |
| ... | ... | @@ -3241,7 +3241,7 @@ pub fn genDecl( |
| 3241 | 3241 | fn genDeclInner( |
| 3242 | 3242 | dwarf: *Dwarf, |
| 3243 | 3243 | pt: Zcu.PerThread, |
| 3244 | di_nw: *MappedFile.Node.Writer, | |
| 3244 | di_nw: *link.MappedFile.Node.Writer, | |
| 3245 | 3245 | instance_val: InternPool.Index, |
| 3246 | 3246 | ) link.EmitError!void { |
| 3247 | 3247 | const zcu = pt.zcu; |
| ... | ... | @@ -3458,7 +3458,7 @@ fn genDeclInner( |
| 3458 | 3458 | |
| 3459 | 3459 | pub fn updateLineNumber( |
| 3460 | 3460 | dwarf: *Dwarf, |
| 3461 | mf: *MappedFile, | |
| 3461 | mf: *link.MappedFile, | |
| 3462 | 3462 | inst: InternPool.TrackedInst.Index, |
| 3463 | 3463 | line: u32, |
| 3464 | 3464 | ) void { |
| ... | ... | @@ -3472,7 +3472,7 @@ pub fn updateLineNumber( |
| 3472 | 3472 | ); |
| 3473 | 3473 | } |
| 3474 | 3474 | |
| 3475 | pub fn lostTracking(dwarf: *Dwarf, di_nw: *MappedFile.Node.Writer) link.EmitError!void { | |
| 3475 | pub fn lostTracking(dwarf: *Dwarf, di_nw: *link.MappedFile.Node.Writer) link.EmitError!void { | |
| 3476 | 3476 | try dwarf.abbrevCode(di_nw, .decl_lost); |
| 3477 | 3477 | } |
| 3478 | 3478 | |
| ... | ... | @@ -3485,14 +3485,14 @@ fn refAbbrevCodeIfExists( |
| 3485 | 3485 | } |
| 3486 | 3486 | fn refAbbrevCode( |
| 3487 | 3487 | dwarf: *Dwarf, |
| 3488 | mf: *MappedFile, | |
| 3488 | mf: *link.MappedFile, | |
| 3489 | 3489 | abbrev_code: AbbrevCode, |
| 3490 | 3490 | ) link.Error!@typeInfo(AbbrevCode).@"enum".tag_type { |
| 3491 | 3491 | if (dwarf.refAbbrevCodeIfExists(abbrev_code)) |backing_int| { |
| 3492 | 3492 | @branchHint(.likely); |
| 3493 | 3493 | return backing_int; |
| 3494 | 3494 | } |
| 3495 | var da_nw: MappedFile.Node.Writer = undefined; | |
| 3495 | var da_nw: link.MappedFile.Node.Writer = undefined; | |
| 3496 | 3496 | dwarf.debug_abbrev.ni.unwrap().?.writer(dwarf.lf.comp.gpa, mf, &da_nw); |
| 3497 | 3497 | defer da_nw.deinit(); |
| 3498 | 3498 | dwarf.genDebugAbbrev(&da_nw, abbrev_code) catch |err| switch (err) { |
| ... | ... | @@ -3504,7 +3504,7 @@ fn refAbbrevCode( |
| 3504 | 3504 | } |
| 3505 | 3505 | fn abbrevCode( |
| 3506 | 3506 | dwarf: *Dwarf, |
| 3507 | nw: *MappedFile.Node.Writer, | |
| 3507 | nw: *link.MappedFile.Node.Writer, | |
| 3508 | 3508 | abbrev_code: AbbrevCode, |
| 3509 | 3509 | ) link.EmitError!void { |
| 3510 | 3510 | try nw.interface.writeUleb128(try dwarf.refAbbrevCode(nw.mf, abbrev_code)); |
| ... | ... | @@ -3512,7 +3512,7 @@ fn abbrevCode( |
| 3512 | 3512 | |
| 3513 | 3513 | fn genDebugAbbrev( |
| 3514 | 3514 | dwarf: *Dwarf, |
| 3515 | da_nw: *MappedFile.Node.Writer, | |
| 3515 | da_nw: *link.MappedFile.Node.Writer, | |
| 3516 | 3516 | abbrev_code: AbbrevCode, |
| 3517 | 3517 | ) link.EmitError!void { |
| 3518 | 3518 | const abbrev = AbbrevCode.abbrevs.get(abbrev_code); |
| ... | ... | @@ -3543,8 +3543,8 @@ fn secOffsetPlaceholder(dwarf: *Dwarf, w: *std.Io.Writer) std.Io.Writer.Error!vo |
| 3543 | 3543 | } |
| 3544 | 3544 | fn secOffset( |
| 3545 | 3545 | dwarf: *Dwarf, |
| 3546 | nw: *MappedFile.Node.Writer, | |
| 3547 | target_ni: MappedFile.Node.Index, | |
| 3546 | nw: *link.MappedFile.Node.Writer, | |
| 3547 | target_ni: link.MappedFile.Node.Index, | |
| 3548 | 3548 | addend: usize, |
| 3549 | 3549 | ) link.EmitError!void { |
| 3550 | 3550 | const offset = nw.interface.end; |
| ... | ... | @@ -3566,7 +3566,7 @@ fn addrPlaceholder(dwarf: *Dwarf, w: *std.Io.Writer) std.Io.Writer.Error!void { |
| 3566 | 3566 | } |
| 3567 | 3567 | fn addrSym( |
| 3568 | 3568 | dwarf: *Dwarf, |
| 3569 | nw: *MappedFile.Node.Writer, | |
| 3569 | nw: *link.MappedFile.Node.Writer, | |
| 3570 | 3570 | target_si: link.File.SymbolId, |
| 3571 | 3571 | addend: usize, |
| 3572 | 3572 | ) link.EmitError!void { |
| ... | ... | @@ -3584,7 +3584,7 @@ fn addrSym( |
| 3584 | 3584 | fn blockConst( |
| 3585 | 3585 | dwarf: *Dwarf, |
| 3586 | 3586 | pt: Zcu.PerThread, |
| 3587 | nw: *MappedFile.Node.Writer, | |
| 3587 | nw: *link.MappedFile.Node.Writer, | |
| 3588 | 3588 | val: Value, |
| 3589 | 3589 | ) link.EmitError!void { |
| 3590 | 3590 | const ty = val.typeOf(pt.zcu); |
| ... | ... | @@ -3604,7 +3604,7 @@ fn blockConst( |
| 3604 | 3604 | fn refType( |
| 3605 | 3605 | dwarf: *Dwarf, |
| 3606 | 3606 | pt: Zcu.PerThread, |
| 3607 | nw: *MappedFile.Node.Writer, | |
| 3607 | nw: *link.MappedFile.Node.Writer, | |
| 3608 | 3608 | ty: Type, |
| 3609 | 3609 | ) link.EmitError!void { |
| 3610 | 3610 | return dwarf.refConst(pt, nw, ty.toValue()); |
| ... | ... | @@ -3612,7 +3612,7 @@ fn refType( |
| 3612 | 3612 | fn refConst( |
| 3613 | 3613 | dwarf: *Dwarf, |
| 3614 | 3614 | pt: Zcu.PerThread, |
| 3615 | nw: *MappedFile.Node.Writer, | |
| 3615 | nw: *link.MappedFile.Node.Writer, | |
| 3616 | 3616 | val: Value, |
| 3617 | 3617 | ) link.EmitError!void { |
| 3618 | 3618 | try dwarf.secOffset(nw, Const.get(try dwarf.getConst(pt, val), dwarf).debug_info_ni.unwrap().?, 0); |
| ... | ... | @@ -3685,7 +3685,7 @@ fn enumConstValue( |
| 3685 | 3685 | ); |
| 3686 | 3686 | } |
| 3687 | 3687 | |
| 3688 | fn exprLoc(dwarf: *Dwarf, nw: *MappedFile.Node.Writer, loc: Loc) link.EmitError!void { | |
| 3688 | fn exprLoc(dwarf: *Dwarf, nw: *link.MappedFile.Node.Writer, loc: Loc) link.EmitError!void { | |
| 3689 | 3689 | var buf: [@max(8, std.atomic.cache_line)]u8 = undefined; |
| 3690 | 3690 | var dw: std.Io.Writer.Discarding = .init(&buf); |
| 3691 | 3691 | try loc.write(.{ .io = &dw.writer }, dwarf); |
| ... | ... | @@ -3694,7 +3694,7 @@ fn exprLoc(dwarf: *Dwarf, nw: *MappedFile.Node.Writer, loc: Loc) link.EmitError! |
| 3694 | 3694 | try loc.write(.{ .mf = nw }, dwarf); |
| 3695 | 3695 | } |
| 3696 | 3696 | |
| 3697 | fn strp(dwarf: *Dwarf, s: *Str, nw: *MappedFile.Node.Writer, str: []const u8) link.EmitError!void { | |
| 3697 | fn strp(dwarf: *Dwarf, s: *Str, nw: *link.MappedFile.Node.Writer, str: []const u8) link.EmitError!void { | |
| 3698 | 3698 | const comp = dwarf.lf.comp; |
| 3699 | 3699 | try dwarf.secOffset(nw, s.ni.unwrap().?, s.get(comp.gpa, nw.mf, str) catch |err| switch (err) { |
| 3700 | 3700 | error.MappedFileIo => return comp.link_diags.fail("failed to write output file: {t}", .{ |
| ... | ... | @@ -3704,7 +3704,7 @@ fn strp(dwarf: *Dwarf, s: *Str, nw: *MappedFile.Node.Writer, str: []const u8) li |
| 3704 | 3704 | }); |
| 3705 | 3705 | } |
| 3706 | 3706 | |
| 3707 | fn reportWriteError(dwarf: *Dwarf, nw: *const MappedFile.Node.Writer) link.Error { | |
| 3707 | fn reportWriteError(dwarf: *Dwarf, nw: *const link.MappedFile.Node.Writer) link.Error { | |
| 3708 | 3708 | switch (nw.err.?) { |
| 3709 | 3709 | else => |e| return e, |
| 3710 | 3710 | error.MappedFileIo => return dwarf.lf.comp.link_diags.fail( |
| ... | ... | @@ -3714,6 +3714,12 @@ fn reportWriteError(dwarf: *Dwarf, nw: *const MappedFile.Node.Writer) link.Error |
| 3714 | 3714 | } |
| 3715 | 3715 | } |
| 3716 | 3716 | |
| 3717 | fn constPoolUser(dwarf: *Dwarf) link.ConstPool.User { | |
| 3718 | return if (dwarf.lf.cast(.elf2)) |elf| .{ | |
| 3719 | .elf2 = elf, | |
| 3720 | } else unreachable; | |
| 3721 | } | |
| 3722 | ||
| 3717 | 3723 | fn DeclValEnum(comptime T: type) type { |
| 3718 | 3724 | const decl_names = @typeInfo(T).@"struct".decl_names; |
| 3719 | 3725 | @setEvalBranchQuota(10 * decl_names.len); |
| ... | ... | @@ -5239,7 +5245,6 @@ const Dwarf = @This(); |
| 5239 | 5245 | const InternPool = @import("../InternPool.zig"); |
| 5240 | 5246 | const link = @import("../link.zig"); |
| 5241 | 5247 | const log = std.log.scoped(.dwarf); |
| 5242 | const MappedFile = @import("MappedFile.zig"); | |
| 5243 | 5248 | const Module = @import("../Module.zig"); |
| 5244 | 5249 | const std = @import("std"); |
| 5245 | 5250 | const target_info = @import("../target.zig"); |
src/link/Elf.zig-1| ... | ... | @@ -4410,7 +4410,6 @@ const Path = std.Build.Cache.Path; |
| 4410 | 4410 | const Stat = std.Build.Cache.File.Stat; |
| 4411 | 4411 | |
| 4412 | 4412 | const codegen = @import("../codegen.zig"); |
| 4413 | const dev = @import("../dev.zig"); | |
| 4414 | 4413 | const eh_frame = @import("Elf/eh_frame.zig"); |
| 4415 | 4414 | const gc = @import("Elf/gc.zig"); |
| 4416 | 4415 | const musl = @import("../libs/musl.zig"); |
src/link/Elf/Atom.zig+17-11| ... | ... | @@ -945,7 +945,7 @@ const x86_64 = struct { |
| 945 | 945 | code: ?[]const u8, |
| 946 | 946 | it: *RelocsIterator, |
| 947 | 947 | ) !void { |
| 948 | dev.check(.x86_64_backend); | |
| 948 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 949 | 949 | const t = &elf_file.base.comp.root_mod.resolved_target.result; |
| 950 | 950 | const is_static = elf_file.base.isStatic(); |
| 951 | 951 | const is_dyn_lib = elf_file.isEffectivelyDynLib(); |
| ... | ... | @@ -1059,7 +1059,7 @@ const x86_64 = struct { |
| 1059 | 1059 | it: *RelocsIterator, |
| 1060 | 1060 | code: []u8, |
| 1061 | 1061 | ) !void { |
| 1062 | dev.check(.x86_64_backend); | |
| 1062 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1063 | 1063 | const t = &elf_file.base.comp.root_mod.resolved_target.result; |
| 1064 | 1064 | const diags = &elf_file.base.comp.link_diags; |
| 1065 | 1065 | const r_type: elf.R_X86_64 = @fromBackingInt(@intCast(rel.r_type())); |
| ... | ... | @@ -1200,7 +1200,7 @@ const x86_64 = struct { |
| 1200 | 1200 | args: ResolveArgs, |
| 1201 | 1201 | code: []u8, |
| 1202 | 1202 | ) !void { |
| 1203 | dev.check(.x86_64_backend); | |
| 1203 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1204 | 1204 | const r_type: elf.R_X86_64 = @fromBackingInt(@intCast(rel.r_type())); |
| 1205 | 1205 | |
| 1206 | 1206 | _, const A, const S, const GOT, _, _, const DTP = args; |
| ... | ... | @@ -1240,7 +1240,7 @@ const x86_64 = struct { |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | fn relaxGotpcrelx(code: []u8, t: *const std.Target) !void { |
| 1243 | dev.check(.x86_64_backend); | |
| 1243 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1244 | 1244 | const old_inst = disassemble(code) orelse return error.RelaxFailure; |
| 1245 | 1245 | const inst: Instruction = switch (old_inst.encoding.mnemonic) { |
| 1246 | 1246 | .call => try .new(old_inst.prefix, .call, &.{ |
| ... | ... | @@ -1259,7 +1259,7 @@ const x86_64 = struct { |
| 1259 | 1259 | } |
| 1260 | 1260 | |
| 1261 | 1261 | fn relaxRexGotpcrelx(code: []u8, t: *const std.Target) !void { |
| 1262 | dev.check(.x86_64_backend); | |
| 1262 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1263 | 1263 | const old_inst = disassemble(code) orelse return error.RelaxFailure; |
| 1264 | 1264 | switch (old_inst.encoding.mnemonic) { |
| 1265 | 1265 | .mov => { |
| ... | ... | @@ -1279,7 +1279,7 @@ const x86_64 = struct { |
| 1279 | 1279 | code: []u8, |
| 1280 | 1280 | r_offset: usize, |
| 1281 | 1281 | ) !void { |
| 1282 | dev.check(.x86_64_backend); | |
| 1282 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1283 | 1283 | assert(rels.len == 2); |
| 1284 | 1284 | const diags = &elf_file.base.comp.link_diags; |
| 1285 | 1285 | const rel: elf.R_X86_64 = @fromBackingInt(@intCast(rels[1].r_type())); |
| ... | ... | @@ -1319,7 +1319,7 @@ const x86_64 = struct { |
| 1319 | 1319 | code: []u8, |
| 1320 | 1320 | r_offset: usize, |
| 1321 | 1321 | ) !void { |
| 1322 | dev.check(.x86_64_backend); | |
| 1322 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1323 | 1323 | assert(rels.len == 2); |
| 1324 | 1324 | const diags = &elf_file.base.comp.link_diags; |
| 1325 | 1325 | const rel: elf.R_X86_64 = @fromBackingInt(@intCast(rels[1].r_type())); |
| ... | ... | @@ -1366,7 +1366,7 @@ const x86_64 = struct { |
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | fn canRelaxGotTpOff(code: []const u8, t: *const std.Target) bool { |
| 1369 | dev.check(.x86_64_backend); | |
| 1369 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1370 | 1370 | const old_inst = disassemble(code) orelse return false; |
| 1371 | 1371 | switch (old_inst.encoding.mnemonic) { |
| 1372 | 1372 | .mov => { |
| ... | ... | @@ -1384,7 +1384,7 @@ const x86_64 = struct { |
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | 1386 | fn relaxGotTpOff(code: []u8, t: *const std.Target) void { |
| 1387 | dev.check(.x86_64_backend); | |
| 1387 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1388 | 1388 | const old_inst = disassemble(code) orelse unreachable; |
| 1389 | 1389 | switch (old_inst.encoding.mnemonic) { |
| 1390 | 1390 | .mov => { |
| ... | ... | @@ -1401,7 +1401,7 @@ const x86_64 = struct { |
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | 1403 | fn relaxGotPcTlsDesc(code: []u8, target: *const std.Target) !void { |
| 1404 | dev.check(.x86_64_backend); | |
| 1404 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1405 | 1405 | const old_inst = disassemble(code) orelse return error.RelaxFailure; |
| 1406 | 1406 | switch (old_inst.encoding.mnemonic) { |
| 1407 | 1407 | .lea => { |
| ... | ... | @@ -1425,7 +1425,7 @@ const x86_64 = struct { |
| 1425 | 1425 | code: []u8, |
| 1426 | 1426 | r_offset: usize, |
| 1427 | 1427 | ) !void { |
| 1428 | dev.check(.x86_64_backend); | |
| 1428 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1429 | 1429 | assert(rels.len == 2); |
| 1430 | 1430 | const diags = &elf_file.base.comp.link_diags; |
| 1431 | 1431 | const rel: elf.R_X86_64 = @fromBackingInt(@intCast(rels[1].r_type())); |
| ... | ... | @@ -1492,6 +1492,7 @@ const aarch64 = struct { |
| 1492 | 1492 | ) !void { |
| 1493 | 1493 | _ = code; |
| 1494 | 1494 | _ = it; |
| 1495 | dev.checkAny(&.{ .llvm_backend, .aarch64_backend }); | |
| 1495 | 1496 | |
| 1496 | 1497 | const r_type: elf.R_AARCH64 = @fromBackingInt(@intCast(rel.r_type())); |
| 1497 | 1498 | const is_dyn_lib = elf_file.isEffectivelyDynLib(); |
| ... | ... | @@ -1569,6 +1570,7 @@ const aarch64 = struct { |
| 1569 | 1570 | code_buffer: []u8, |
| 1570 | 1571 | ) (error{ UnexpectedRemainder, DivisionByZero } || RelocError)!void { |
| 1571 | 1572 | _ = it; |
| 1573 | dev.checkAny(&.{ .llvm_backend, .aarch64_backend }); | |
| 1572 | 1574 | |
| 1573 | 1575 | const diags = &elf_file.base.comp.link_diags; |
| 1574 | 1576 | const r_type: elf.R_AARCH64 = @fromBackingInt(@intCast(rel.r_type())); |
| ... | ... | @@ -1742,6 +1744,7 @@ const aarch64 = struct { |
| 1742 | 1744 | args: ResolveArgs, |
| 1743 | 1745 | code: []u8, |
| 1744 | 1746 | ) !void { |
| 1747 | dev.checkAny(&.{ .llvm_backend, .aarch64_backend }); | |
| 1745 | 1748 | const r_type: elf.R_AARCH64 = @fromBackingInt(@intCast(rel.r_type())); |
| 1746 | 1749 | |
| 1747 | 1750 | _, const A, const S, _, _, _, _ = args; |
| ... | ... | @@ -1772,6 +1775,7 @@ const riscv = struct { |
| 1772 | 1775 | ) !void { |
| 1773 | 1776 | _ = code; |
| 1774 | 1777 | _ = it; |
| 1778 | dev.checkAny(&.{ .llvm_backend, .riscv64_backend }); | |
| 1775 | 1779 | |
| 1776 | 1780 | const r_type: elf.R_RISCV = @fromBackingInt(@intCast(rel.r_type())); |
| 1777 | 1781 | |
| ... | ... | @@ -1815,6 +1819,7 @@ const riscv = struct { |
| 1815 | 1819 | it: *RelocsIterator, |
| 1816 | 1820 | code: []u8, |
| 1817 | 1821 | ) !void { |
| 1822 | dev.checkAny(&.{ .llvm_backend, .riscv64_backend }); | |
| 1818 | 1823 | const diags = &elf_file.base.comp.link_diags; |
| 1819 | 1824 | const r_type: elf.R_RISCV = @fromBackingInt(@intCast(rel.r_type())); |
| 1820 | 1825 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| ... | ... | @@ -1951,6 +1956,7 @@ const riscv = struct { |
| 1951 | 1956 | args: ResolveArgs, |
| 1952 | 1957 | code: []u8, |
| 1953 | 1958 | ) !void { |
| 1959 | dev.checkAny(&.{ .llvm_backend, .riscv64_backend }); | |
| 1954 | 1960 | const r_type: elf.R_RISCV = @fromBackingInt(@intCast(rel.r_type())); |
| 1955 | 1961 | |
| 1956 | 1962 | _, const A, const S, const GOT, _, _, const DTP = args; |
src/link/Elf/Thunk.zig+2| ... | ... | @@ -91,6 +91,7 @@ pub const Index = u32; |
| 91 | 91 | |
| 92 | 92 | const aarch64 = struct { |
| 93 | 93 | fn write(thunk: Thunk, elf_file: *Elf, writer: anytype) !void { |
| 94 | dev.checkAny(&.{ .llvm_backend, .aarch64_backend }); | |
| 94 | 95 | for (thunk.symbols.keys(), 0..) |ref, i| { |
| 95 | 96 | const sym = elf_file.symbol(ref).?; |
| 96 | 97 | const saddr = thunk.address(elf_file) + @as(i64, @intCast(i * trampoline_size)); |
| ... | ... | @@ -113,6 +114,7 @@ const aarch64 = struct { |
| 113 | 114 | }; |
| 114 | 115 | |
| 115 | 116 | const assert = std.debug.assert; |
| 117 | const dev = @import("../../dev.zig"); | |
| 116 | 118 | const elf = std.elf; |
| 117 | 119 | const log = std.log.scoped(.link); |
| 118 | 120 | const math = std.math; |
src/link/Elf/ZigObject.zig+2| ... | ... | @@ -2396,6 +2396,7 @@ const TlsTable = std.array_hash_map.Auto(Atom.Index, void); |
| 2396 | 2396 | |
| 2397 | 2397 | const x86_64 = struct { |
| 2398 | 2398 | fn writeTrampolineCode(source_addr: i64, target_addr: i64, buf: *[max_trampoline_len]u8) ![]u8 { |
| 2399 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 2399 | 2400 | const disp = @as(i64, @intCast(target_addr)) - source_addr - 5; |
| 2400 | 2401 | var bytes = [_]u8{ |
| 2401 | 2402 | 0xe9, 0x00, 0x00, 0x00, 0x00, // jmp rel32 |
| ... | ... | @@ -2411,6 +2412,7 @@ const assert = std.debug.assert; |
| 2411 | 2412 | const build_options = @import("build_options"); |
| 2412 | 2413 | const builtin = @import("builtin"); |
| 2413 | 2414 | const codegen = @import("../../codegen.zig"); |
| 2415 | const dev = @import("../../dev.zig"); | |
| 2414 | 2416 | const elf = std.elf; |
| 2415 | 2417 | const link = @import("../../link.zig"); |
| 2416 | 2418 | const log = std.log.scoped(.link); |
src/link/Elf/eh_frame.zig+4| ... | ... | @@ -535,6 +535,7 @@ pub fn writeEhFrameHdr(elf_file: *Elf, writer: anytype) !void { |
| 535 | 535 | |
| 536 | 536 | const x86_64 = struct { |
| 537 | 537 | fn resolveReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela, source: i64, target: i64, data: []u8) !void { |
| 538 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 538 | 539 | const r_type: elf.R_X86_64 = @fromBackingInt(@intCast(rel.r_type())); |
| 539 | 540 | switch (r_type) { |
| 540 | 541 | .NONE => {}, |
| ... | ... | @@ -549,6 +550,7 @@ const x86_64 = struct { |
| 549 | 550 | |
| 550 | 551 | const aarch64 = struct { |
| 551 | 552 | fn resolveReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela, source: i64, target: i64, data: []u8) !void { |
| 553 | dev.checkAny(&.{ .llvm_backend, .aarch64_backend }); | |
| 552 | 554 | const r_type: elf.R_AARCH64 = @fromBackingInt(@intCast(rel.r_type())); |
| 553 | 555 | switch (r_type) { |
| 554 | 556 | .NONE => {}, |
| ... | ... | @@ -562,6 +564,7 @@ const aarch64 = struct { |
| 562 | 564 | |
| 563 | 565 | const riscv = struct { |
| 564 | 566 | fn resolveReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela, source: i64, target: i64, data: []u8) !void { |
| 567 | dev.checkAny(&.{ .llvm_backend, .riscv64_backend }); | |
| 565 | 568 | const r_type: elf.R_RISCV = @fromBackingInt(@intCast(rel.r_type())); |
| 566 | 569 | switch (r_type) { |
| 567 | 570 | .NONE => {}, |
| ... | ... | @@ -584,6 +587,7 @@ fn reportInvalidReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela) !void { |
| 584 | 587 | |
| 585 | 588 | const std = @import("std"); |
| 586 | 589 | const assert = std.debug.assert; |
| 590 | const dev = @import("../../dev.zig"); | |
| 587 | 591 | const elf = std.elf; |
| 588 | 592 | const math = std.math; |
| 589 | 593 | const relocs_log = std.log.scoped(.link_relocs); |
src/link/Elf/synthetic_sections.zig+5| ... | ... | @@ -772,6 +772,7 @@ pub const PltSection = struct { |
| 772 | 772 | |
| 773 | 773 | const x86_64 = struct { |
| 774 | 774 | fn write(plt: PltSection, elf_file: *Elf, writer: *std.Io.Writer) !void { |
| 775 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 775 | 776 | const shdrs = elf_file.sections.items(.shdr); |
| 776 | 777 | const plt_addr = shdrs[elf_file.section_indexes.plt.?].sh_addr; |
| 777 | 778 | const got_plt_addr = shdrs[elf_file.section_indexes.got_plt.?].sh_addr; |
| ... | ... | @@ -807,6 +808,7 @@ pub const PltSection = struct { |
| 807 | 808 | |
| 808 | 809 | const aarch64 = struct { |
| 809 | 810 | fn write(plt: PltSection, elf_file: *Elf, writer: *std.Io.Writer) !void { |
| 811 | dev.checkAny(&.{ .llvm_backend, .aarch64_backend }); | |
| 810 | 812 | { |
| 811 | 813 | const shdrs = elf_file.sections.items(.shdr); |
| 812 | 814 | const plt_addr: i64 = @intCast(shdrs[elf_file.section_indexes.plt.?].sh_addr); |
| ... | ... | @@ -949,6 +951,7 @@ pub const PltGotSection = struct { |
| 949 | 951 | |
| 950 | 952 | const x86_64 = struct { |
| 951 | 953 | pub fn write(plt_got: PltGotSection, elf_file: *Elf, writer: *std.Io.Writer) !void { |
| 954 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 952 | 955 | for (plt_got.symbols.items) |ref| { |
| 953 | 956 | const sym = elf_file.symbol(ref).?; |
| 954 | 957 | const target_addr = sym.gotAddress(elf_file); |
| ... | ... | @@ -967,6 +970,7 @@ pub const PltGotSection = struct { |
| 967 | 970 | |
| 968 | 971 | const aarch64 = struct { |
| 969 | 972 | fn write(plt_got: PltGotSection, elf_file: *Elf, writer: *std.Io.Writer) !void { |
| 973 | dev.checkAny(&.{ .llvm_backend, .aarch64_backend }); | |
| 970 | 974 | for (plt_got.symbols.items) |ref| { |
| 971 | 975 | const sym = elf_file.symbol(ref).?; |
| 972 | 976 | const target_addr = sym.gotAddress(elf_file); |
| ... | ... | @@ -1518,6 +1522,7 @@ fn writeInt(value: anytype, elf_file: *Elf, writer: *std.Io.Writer) !void { |
| 1518 | 1522 | |
| 1519 | 1523 | const assert = std.debug.assert; |
| 1520 | 1524 | const builtin = @import("builtin"); |
| 1525 | const dev = @import("../../dev.zig"); | |
| 1521 | 1526 | const elf = std.elf; |
| 1522 | 1527 | const math = std.math; |
| 1523 | 1528 | const mem = std.mem; |
src/link/Elf2.zig+1-2| ... | ... | @@ -7,11 +7,10 @@ const log = std.log.scoped(.link); |
| 7 | 7 | |
| 8 | 8 | const codegen = @import("../codegen.zig"); |
| 9 | 9 | const Compilation = @import("../Compilation.zig"); |
| 10 | const dev = @import("../dev.zig"); | |
| 11 | 10 | const Dwarf = @import("Dwarf2.zig"); |
| 12 | 11 | const InternPool = @import("../InternPool.zig"); |
| 13 | 12 | const link = @import("../link.zig"); |
| 14 | const MappedFile = @import("MappedFile.zig"); | |
| 13 | const MappedFile = link.MappedFile; | |
| 15 | 14 | const target_util = @import("../target.zig"); |
| 16 | 15 | const tracy = @import("../tracy.zig"); |
| 17 | 16 | const Type = @import("../Type.zig"); |
src/link/MachO.zig-1| ... | ... | @@ -5503,4 +5503,3 @@ const Value = @import("../Value.zig"); |
| 5503 | 5503 | const UnwindInfo = @import("MachO/UnwindInfo.zig"); |
| 5504 | 5504 | const WeakBind = bind.WeakBind; |
| 5505 | 5505 | const ZigObject = @import("MachO/ZigObject.zig"); |
| 5506 | const dev = @import("../dev.zig"); |
src/link/MachO/Atom.zig+2-2| ... | ... | @@ -853,7 +853,7 @@ fn resolveRelocInner( |
| 853 | 853 | |
| 854 | 854 | const x86_64 = struct { |
| 855 | 855 | fn relaxGotLoad(self: Atom, code: []u8, rel: Relocation, macho_file: *MachO) ResolveError!void { |
| 856 | dev.check(.x86_64_backend); | |
| 856 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 857 | 857 | const t = &macho_file.base.comp.root_mod.resolved_target.result; |
| 858 | 858 | const diags = &macho_file.base.comp.link_diags; |
| 859 | 859 | const old_inst = disassemble(code) orelse return error.RelaxFail; |
| ... | ... | @@ -879,7 +879,7 @@ const x86_64 = struct { |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | fn relaxTlv(code: []u8, t: *const std.Target) error{RelaxFail}!void { |
| 882 | dev.check(.x86_64_backend); | |
| 882 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 883 | 883 | const old_inst = disassemble(code) orelse return error.RelaxFail; |
| 884 | 884 | switch (old_inst.encoding.mnemonic) { |
| 885 | 885 | .mov => { |
src/link/MachO/Object.zig+5| ... | ... | @@ -3,6 +3,7 @@ const Object = @This(); |
| 3 | 3 | const trace = @import("../../tracy.zig").trace; |
| 4 | 4 | const Archive = @import("Archive.zig"); |
| 5 | 5 | const Atom = @import("Atom.zig"); |
| 6 | const dev = @import("../../dev.zig"); | |
| 6 | 7 | const Dwarf = @import("Dwarf.zig"); |
| 7 | 8 | const File = @import("file.zig").File; |
| 8 | 9 | const MachO = @import("../MachO.zig"); |
| ... | ... | @@ -2826,6 +2827,7 @@ const x86_64 = struct { |
| 2826 | 2827 | handle: File.Handle, |
| 2827 | 2828 | macho_file: *MachO, |
| 2828 | 2829 | ) !void { |
| 2830 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 2829 | 2831 | const comp = macho_file.base.comp; |
| 2830 | 2832 | const io = comp.io; |
| 2831 | 2833 | const gpa = comp.gpa; |
| ... | ... | @@ -2938,6 +2940,7 @@ const x86_64 = struct { |
| 2938 | 2940 | } |
| 2939 | 2941 | |
| 2940 | 2942 | fn validateRelocType(rel: macho.relocation_info, rel_type: macho.reloc_type_x86_64, is_extern: bool) !Relocation.Type { |
| 2943 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 2941 | 2944 | switch (rel_type) { |
| 2942 | 2945 | .X86_64_RELOC_UNSIGNED => { |
| 2943 | 2946 | if (rel.r_pcrel == 1) return error.Pcrel; |
| ... | ... | @@ -2995,6 +2998,7 @@ const aarch64 = struct { |
| 2995 | 2998 | handle: File.Handle, |
| 2996 | 2999 | macho_file: *MachO, |
| 2997 | 3000 | ) !void { |
| 3001 | dev.checkAny(&.{ .llvm_backend, .aarch64_backend }); | |
| 2998 | 3002 | const comp = macho_file.base.comp; |
| 2999 | 3003 | const io = comp.io; |
| 3000 | 3004 | const gpa = comp.gpa; |
| ... | ... | @@ -3131,6 +3135,7 @@ const aarch64 = struct { |
| 3131 | 3135 | } |
| 3132 | 3136 | |
| 3133 | 3137 | fn validateRelocType(rel: macho.relocation_info, rel_type: macho.reloc_type_arm64, is_extern: bool) !Relocation.Type { |
| 3138 | dev.checkAny(&.{ .llvm_backend, .aarch64_backend }); | |
| 3134 | 3139 | switch (rel_type) { |
| 3135 | 3140 | .ARM64_RELOC_UNSIGNED => { |
| 3136 | 3141 | if (rel.r_pcrel == 1) return error.Pcrel; |
src/link/MachO/ZigObject.zig+2| ... | ... | @@ -1744,6 +1744,7 @@ const TlvInitializerTable = std.array_hash_map.Auto(Atom.Index, TlvInitializer); |
| 1744 | 1744 | |
| 1745 | 1745 | const x86_64 = struct { |
| 1746 | 1746 | fn writeTrampolineCode(source_addr: u64, target_addr: u64, buf: *[max_trampoline_len]u8) ![]u8 { |
| 1747 | dev.checkAny(&.{ .llvm_backend, .x86_64_backend }); | |
| 1747 | 1748 | const disp = @as(i64, @intCast(target_addr)) - @as(i64, @intCast(source_addr)) - 5; |
| 1748 | 1749 | var bytes = [_]u8{ |
| 1749 | 1750 | 0xe9, 0x00, 0x00, 0x00, 0x00, // jmp rel32 |
| ... | ... | @@ -1758,6 +1759,7 @@ const x86_64 = struct { |
| 1758 | 1759 | const assert = std.debug.assert; |
| 1759 | 1760 | const builtin = @import("builtin"); |
| 1760 | 1761 | const codegen = @import("../../codegen.zig"); |
| 1762 | const dev = @import("../../dev.zig"); | |
| 1761 | 1763 | const link = @import("../../link.zig"); |
| 1762 | 1764 | const log = std.log.scoped(.link); |
| 1763 | 1765 | const macho = std.macho; |
src/link/Spork8.zig-2| ... | ... | @@ -18,7 +18,6 @@ const Mir = @import("../codegen/spork8/Mir.zig"); |
| 18 | 18 | const link = @import("../link.zig"); |
| 19 | 19 | const Compilation = @import("../Compilation.zig"); |
| 20 | 20 | const Liveness = @import("../Air/Liveness.zig"); |
| 21 | const dev = @import("../dev.zig"); | |
| 22 | 21 | const Value = @import("../Value.zig"); |
| 23 | 22 | |
| 24 | 23 | base: link.File, |
| ... | ... | @@ -89,7 +88,6 @@ pub fn updateFunc( |
| 89 | 88 | func_index: InternPool.Index, |
| 90 | 89 | any_mir: *const codegen.AnyMir, |
| 91 | 90 | ) !void { |
| 92 | dev.check(.spork8_backend); | |
| 93 | 91 | // This linker implementation only works with `std.lang.CompilerBackend.zsf_spork8`. |
| 94 | 92 | const mir = &any_mir.spork8; |
| 95 | 93 | const zcu = pt.zcu; |
src/link/Wasm.zig-3| ... | ... | @@ -38,7 +38,6 @@ const Dwarf = @import("Dwarf.zig"); |
| 38 | 38 | const InternPool = @import("../InternPool.zig"); |
| 39 | 39 | const Zcu = @import("../Zcu.zig"); |
| 40 | 40 | const codegen = @import("../codegen.zig"); |
| 41 | const dev = @import("../dev.zig"); | |
| 42 | 41 | const link = @import("../link.zig"); |
| 43 | 42 | const trace = @import("../tracy.zig").trace; |
| 44 | 43 | const wasi_libc = @import("../libs/wasi_libc.zig"); |
| ... | ... | @@ -3575,8 +3574,6 @@ pub fn updateFunc( |
| 3575 | 3574 | func_index: InternPool.Index, |
| 3576 | 3575 | any_mir: *const codegen.AnyMir, |
| 3577 | 3576 | ) !void { |
| 3578 | dev.check(.wasm_backend); | |
| 3579 | ||
| 3580 | 3577 | // This linker implementation only works with codegen backend `.stage2_wasm`. |
| 3581 | 3578 | const mir = &any_mir.wasm; |
| 3582 | 3579 | const zcu = pt.zcu; |
src/main.zig+1-1| ... | ... | @@ -36,7 +36,7 @@ const Module = @import("Module.zig"); |
| 36 | 36 | |
| 37 | 37 | test { |
| 38 | 38 | _ = @import("codegen.zig"); |
| 39 | _ = @import("link/MappedFile.zig"); | |
| 39 | _ = link.MappedFile; | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | const thread_stack_size = 60 << 20; |
src/target.zig+5-1| ... | ... | @@ -2,6 +2,7 @@ const builtin = @import("builtin"); |
| 2 | 2 | const std = @import("std"); |
| 3 | 3 | const assert = std.debug.assert; |
| 4 | 4 | |
| 5 | const dev = @import("dev.zig"); | |
| 5 | 6 | const Type = @import("Type.zig"); |
| 6 | 7 | const AddressSpace = std.lang.AddressSpace; |
| 7 | 8 | const Alignment = @import("InternPool.zig").Alignment; |
| ... | ... | @@ -855,7 +856,10 @@ pub fn functionPointerMask(target: *const std.Target) ?u64 { |
| 855 | 856 | |
| 856 | 857 | pub fn supportsTailCall(target: *const std.Target, backend: std.lang.CompilerBackend) bool { |
| 857 | 858 | switch (backend) { |
| 858 | .stage2_llvm => return @import("codegen/llvm.zig").supportsTailCall(target), | |
| 859 | .stage2_llvm => { | |
| 860 | dev.check(.llvm_backend); | |
| 861 | return @import("codegen/llvm.zig").supportsTailCall(target); | |
| 862 | }, | |
| 859 | 863 | .stage2_c => return true, |
| 860 | 864 | else => return false, |
| 861 | 865 | } |