diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-02-01 15:03:55 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-02-01 15:03:55 +0100 |
| commit | 5de2aae63cd75322e58204a6be8df49754e4851a (patch) | |
| tree | c8e61e82649f412b6a7c4b5bb422f9855df61665 /src/link.zig | |
| parent | d98fc53b8fbe479f828114b0276d5290146cc2a3 (diff) | |
| download | zig-5de2aae63cd75322e58204a6be8df49754e4851a.tar.gz zig-5de2aae63cd75322e58204a6be8df49754e4851a.zip | |
link: decouple DI atoms from linker atoms, and manage them in Dwarf linker
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/link.zig b/src/link.zig index c0eacf88a0..3dd182b586 100644 --- a/src/link.zig +++ b/src/link.zig @@ -273,9 +273,9 @@ pub const File = struct { }; pub const LinkFn = union { - elf: Dwarf.SrcFn, - coff: Coff.SrcFn, - macho: Dwarf.SrcFn, + elf: void, + coff: void, + macho: void, plan9: void, c: void, wasm: Wasm.FnData, @@ -580,22 +580,23 @@ pub const File = struct { } } - pub fn updateDeclLineNumber(base: *File, module: *Module, decl: *Module.Decl) UpdateDeclError!void { + pub fn updateDeclLineNumber(base: *File, module: *Module, decl_index: Module.Decl.Index) UpdateDeclError!void { + const decl = module.declPtr(decl_index); log.debug("updateDeclLineNumber {*} ({s}), line={}", .{ decl, decl.name, decl.src_line + 1, }); assert(decl.has_tv); if (build_options.only_c) { assert(base.tag == .c); - return @fieldParentPtr(C, "base", base).updateDeclLineNumber(module, decl); + return @fieldParentPtr(C, "base", base).updateDeclLineNumber(module, decl_index); } switch (base.tag) { - .coff => return @fieldParentPtr(Coff, "base", base).updateDeclLineNumber(module, decl), - .elf => return @fieldParentPtr(Elf, "base", base).updateDeclLineNumber(module, decl), - .macho => return @fieldParentPtr(MachO, "base", base).updateDeclLineNumber(module, decl), - .c => return @fieldParentPtr(C, "base", base).updateDeclLineNumber(module, decl), - .wasm => return @fieldParentPtr(Wasm, "base", base).updateDeclLineNumber(module, decl), - .plan9 => return @fieldParentPtr(Plan9, "base", base).updateDeclLineNumber(module, decl), + .coff => return @fieldParentPtr(Coff, "base", base).updateDeclLineNumber(module, decl_index), + .elf => return @fieldParentPtr(Elf, "base", base).updateDeclLineNumber(module, decl_index), + .macho => return @fieldParentPtr(MachO, "base", base).updateDeclLineNumber(module, decl_index), + .c => return @fieldParentPtr(C, "base", base).updateDeclLineNumber(module, decl_index), + .wasm => return @fieldParentPtr(Wasm, "base", base).updateDeclLineNumber(module, decl_index), + .plan9 => return @fieldParentPtr(Plan9, "base", base).updateDeclLineNumber(module, decl_index), .spirv, .nvptx => {}, } } |
