diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-12-11 21:21:01 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-01-01 17:51:19 -0700 |
| commit | 2be36c5b8d7d22c2ffc20b88e497da7e6612de5c (patch) | |
| tree | 05c9d7f58e82ff51ffa5be439ff75b37abe3b6ba /src/link | |
| parent | 2bef0715c740024c515dce73d267ead5af49d1a9 (diff) | |
| download | zig-2be36c5b8d7d22c2ffc20b88e497da7e6612de5c.tar.gz zig-2be36c5b8d7d22c2ffc20b88e497da7e6612de5c.zip | |
linker: update references to module
Diffstat (limited to 'src/link')
| -rw-r--r-- | src/link/C.zig | 8 | ||||
| -rw-r--r-- | src/link/Coff.zig | 20 | ||||
| -rw-r--r-- | src/link/Coff/lld.zig | 6 | ||||
| -rw-r--r-- | src/link/Elf.zig | 2 | ||||
| -rw-r--r-- | src/link/MachO.zig | 22 | ||||
| -rw-r--r-- | src/link/Plan9.zig | 30 | ||||
| -rw-r--r-- | src/link/SpirV.zig | 2 | ||||
| -rw-r--r-- | src/link/Wasm.zig | 30 |
8 files changed, 60 insertions, 60 deletions
diff --git a/src/link/C.zig b/src/link/C.zig index 4e40addcf7..e6827947ae 100644 --- a/src/link/C.zig +++ b/src/link/C.zig @@ -386,7 +386,7 @@ pub fn flushModule(self: *C, _: *Compilation, prog_node: *std.Progress.Node) !vo defer sub_prog_node.end(); const gpa = self.base.comp.gpa; - const module = self.base.options.module.?; + const module = self.base.comp.module.?; { var i: usize = 0; @@ -535,7 +535,7 @@ fn flushCTypes( decl_ctypes: codegen.CType.Store, ) FlushDeclError!void { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl_ctypes_len = decl_ctypes.count(); f.ctypes_map.clearRetainingCapacity(); @@ -623,7 +623,7 @@ fn flushErrDecls(self: *C, ctypes: *codegen.CType.Store) FlushDeclError!void { var object = codegen.Object{ .dg = .{ .gpa = gpa, - .module = self.base.options.module.?, + .module = self.base.comp.module.?, .error_msg = null, .pass = .flush, .is_naked_fn = false, @@ -665,7 +665,7 @@ fn flushLazyFn( var object = codegen.Object{ .dg = .{ .gpa = gpa, - .module = self.base.options.module.?, + .module = self.base.comp.module.?, .error_msg = null, .pass = .flush, .is_naked_fn = false, diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 2541d62eac..134d00feb0 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -1118,7 +1118,7 @@ pub fn updateFunc(self: *Coff, mod: *Module, func_index: InternPool.Index, air: pub fn lowerUnnamedConst(self: *Coff, tv: TypedValue, decl_index: InternPool.DeclIndex) !u32 { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); const gop = try self.unnamed_const_atoms.getOrPut(gpa, decl_index); if (!gop.found_existing) { @@ -1249,7 +1249,7 @@ fn updateLazySymbolAtom( section_index: u16, ) !void { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; var required_alignment: InternPool.Alignment = .none; var code_buffer = std.ArrayList(u8).init(gpa); @@ -1310,7 +1310,7 @@ fn updateLazySymbolAtom( pub fn getOrCreateAtomForLazySymbol(self: *Coff, sym: link.File.LazySymbol) !Atom.Index { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const gop = try self.lazy_syms.getOrPut(gpa, sym.getDecl(mod)); errdefer _ = if (!gop.found_existing) self.lazy_syms.pop(); if (!gop.found_existing) gop.value_ptr.* = .{}; @@ -1347,9 +1347,9 @@ pub fn getOrCreateAtomForDecl(self: *Coff, decl_index: InternPool.DeclIndex) !At } fn getDeclOutputSection(self: *Coff, decl_index: InternPool.DeclIndex) u16 { - const decl = self.base.options.module.?.declPtr(decl_index); + const decl = self.base.comp.module.?.declPtr(decl_index); const ty = decl.ty; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const zig_ty = ty.zigTypeTag(mod); const val = decl.val; const index: u16 = blk: { @@ -1373,7 +1373,7 @@ fn getDeclOutputSection(self: *Coff, decl_index: InternPool.DeclIndex) u16 { } fn updateDeclCode(self: *Coff, decl_index: InternPool.DeclIndex, code: []u8, complex_type: coff.ComplexType) !void { - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); const decl_name = mod.intern_pool.stringToSlice(try decl.getFullyQualifiedName(mod)); @@ -1443,7 +1443,7 @@ pub fn freeDecl(self: *Coff, decl_index: InternPool.DeclIndex) void { if (self.llvm_object) |llvm_object| return llvm_object.freeDecl(decl_index); const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); log.debug("freeDecl {*}", .{decl}); @@ -1599,7 +1599,7 @@ pub fn deleteDeclExport( ) void { if (self.llvm_object) |_| return; const metadata = self.decls.getPtr(decl_index) orelse return; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const name = mod.intern_pool.stringToSlice(name_ip); const sym_index = metadata.getExportPtr(self, name) orelse return; @@ -1678,7 +1678,7 @@ pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod const gpa = self.base.comp.gpa; - const module = self.base.options.module orelse return error.LinkingWithoutZigSourceUnimplemented; + const module = self.base.comp.module orelse return error.LinkingWithoutZigSourceUnimplemented; if (self.lazy_syms.getPtr(.none)) |metadata| { // Most lazy symbols can be updated on first use, but @@ -1818,7 +1818,7 @@ pub fn lowerAnonDecl( src_loc: Module.SrcLoc, ) !codegen.Result { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val)); const decl_alignment = switch (explicit_alignment) { .none => ty.abiAlignment(mod), diff --git a/src/link/Coff/lld.zig b/src/link/Coff/lld.zig index 4d4dd840cf..45a6f9c14c 100644 --- a/src/link/Coff/lld.zig +++ b/src/link/Coff/lld.zig @@ -30,7 +30,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod // If there is no Zig code to compile, then we should skip flushing the output file because it // will not be part of the linker line anyway. - const module_obj_path: ?[]const u8 = if (self.base.options.module != null) blk: { + const module_obj_path: ?[]const u8 = if (self.base.comp.module != null) blk: { try self.flushModule(comp, prog_node); if (fs.path.dirname(full_out_path)) |dirname| { @@ -289,7 +289,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod if (self.base.options.subsystem) |explicit| break :blk explicit; switch (target.os.tag) { .windows => { - if (self.base.options.module) |module| { + if (self.base.comp.module) |module| { if (module.stage1_flags.have_dllmain_crt_startup or is_dyn_lib) break :blk null; if (module.stage1_flags.have_c_main or self.base.options.is_test or @@ -450,7 +450,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod } else { try argv.append("-NODEFAULTLIB"); if (!is_lib and self.base.options.entry == null) { - if (self.base.options.module) |module| { + if (self.base.comp.module) |module| { if (module.stage1_flags.have_winmain_crt_startup) { try argv.append("-ENTRY:WinMainCRTStartup"); } else { diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 2bab459582..7db9b06fbc 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -2309,7 +2309,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v // If there is no Zig code to compile, then we should skip flushing the output file because it // will not be part of the linker line anyway. - const module_obj_path: ?[]const u8 = if (self.base.options.module != null) blk: { + const module_obj_path: ?[]const u8 = if (self.base.comp.module != null) blk: { try self.flushModule(comp, prog_node); if (fs.path.dirname(full_out_path)) |dirname| { diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 3af98aa42a..3b36b73fa3 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -356,7 +356,7 @@ pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.No defer sub_prog_node.end(); const output_mode = self.base.comp.config.output_mode; - const module = self.base.options.module orelse return error.LinkingWithoutZigSourceUnimplemented; + const module = self.base.comp.module orelse return error.LinkingWithoutZigSourceUnimplemented; if (self.lazy_syms.getPtr(.none)) |metadata| { // Most lazy symbols can be updated on first use, but @@ -2333,7 +2333,7 @@ pub fn updateFunc(self: *MachO, mod: *Module, func_index: InternPool.Index, air: pub fn lowerUnnamedConst(self: *MachO, typed_value: TypedValue, decl_index: InternPool.DeclIndex) !u32 { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const gop = try self.unnamed_const_atoms.getOrPut(gpa, decl_index); if (!gop.found_existing) { gop.value_ptr.* = .{}; @@ -2504,7 +2504,7 @@ fn updateLazySymbolAtom( section_index: u8, ) !void { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; var required_alignment: Alignment = .none; var code_buffer = std.ArrayList(u8).init(gpa); @@ -2568,7 +2568,7 @@ fn updateLazySymbolAtom( } pub fn getOrCreateAtomForLazySymbol(self: *MachO, sym: File.LazySymbol) !Atom.Index { - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const gpa = self.base.comp.gpa; const gop = try self.lazy_syms.getOrPut(gpa, sym.getDecl(mod)); errdefer _ = if (!gop.found_existing) self.lazy_syms.pop(); @@ -2600,7 +2600,7 @@ pub fn getOrCreateAtomForLazySymbol(self: *MachO, sym: File.LazySymbol) !Atom.In } fn updateThreadlocalVariable(self: *MachO, module: *Module, decl_index: InternPool.DeclIndex) !void { - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; // Lowering a TLV on macOS involves two stages: // 1. first we lower the initializer into appopriate section (__thread_data or __thread_bss) // 2. next, we create a corresponding threadlocal variable descriptor in __thread_vars @@ -2711,10 +2711,10 @@ pub fn getOrCreateAtomForDecl(self: *MachO, decl_index: InternPool.DeclIndex) !A } fn getDeclOutputSection(self: *MachO, decl_index: InternPool.DeclIndex) u8 { - const decl = self.base.options.module.?.declPtr(decl_index); + const decl = self.base.comp.module.?.declPtr(decl_index); const ty = decl.ty; const val = decl.val; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const zig_ty = ty.zigTypeTag(mod); const any_non_single_threaded = self.base.comp.config.any_non_single_threaded; const optimize_mode = self.base.comp.root_mod.optimize_mode; @@ -2751,7 +2751,7 @@ fn getDeclOutputSection(self: *MachO, decl_index: InternPool.DeclIndex) u8 { fn updateDeclCode(self: *MachO, decl_index: InternPool.DeclIndex, code: []u8) !u64 { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); const required_alignment = decl.getAlignment(mod); @@ -2967,7 +2967,7 @@ pub fn deleteDeclExport( const metadata = self.decls.getPtr(decl_index) orelse return; const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const exp_name = try std.fmt.allocPrint(gpa, "_{s}", .{mod.intern_pool.stringToSlice(name)}); defer gpa.free(exp_name); const sym_index = metadata.getExportPtr(self, exp_name) orelse return; @@ -3006,7 +3006,7 @@ fn freeUnnamedConsts(self: *MachO, decl_index: InternPool.DeclIndex) void { pub fn freeDecl(self: *MachO, decl_index: InternPool.DeclIndex) void { if (self.llvm_object) |llvm_object| return llvm_object.freeDecl(decl_index); const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); log.debug("freeDecl {*}", .{decl}); @@ -3049,7 +3049,7 @@ pub fn lowerAnonDecl( src_loc: Module.SrcLoc, ) !codegen.Result { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val)); const decl_alignment = switch (explicit_alignment) { .none => ty.abiAlignment(mod), diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig index a5bb943ada..ece949b01e 100644 --- a/src/link/Plan9.zig +++ b/src/link/Plan9.zig @@ -174,7 +174,7 @@ pub const Atom = struct { return .{ .code_ptr = slice.ptr, .other = .{ .code_len = slice.len } }; } fn getCode(self: CodePtr, plan9: *const Plan9) []u8 { - const mod = plan9.base.options.module.?; + const mod = plan9.base.comp.module.?; return if (self.code_ptr) |p| p[0..self.other.code_len] else blk: { const decl_index = self.other.decl_index; const decl = mod.declPtr(decl_index); @@ -324,7 +324,7 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*Plan9 { fn putFn(self: *Plan9, decl_index: InternPool.DeclIndex, out: FnDeclOutput) !void { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); const fn_map_res = try self.fn_decl_table.getOrPut(gpa, decl.getFileScope(mod)); if (fn_map_res.found_existing) { @@ -455,7 +455,7 @@ pub fn lowerUnnamedConst(self: *Plan9, tv: TypedValue, decl_index: InternPool.De var code_buffer = std.ArrayList(u8).init(gpa); defer code_buffer.deinit(); - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); const gop = try self.unnamed_const_atoms.getOrPut(gpa, decl_index); @@ -550,7 +550,7 @@ pub fn updateDecl(self: *Plan9, mod: *Module, decl_index: InternPool.DeclIndex) /// called at the end of update{Decl,Func} fn updateFinish(self: *Plan9, decl_index: InternPool.DeclIndex) !void { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); const is_fn = (decl.ty.zigTypeTag(mod) == .Fn); const sym_t: aout.Sym.Type = if (is_fn) .t else .d; @@ -670,7 +670,7 @@ pub fn flushModule(self: *Plan9, comp: *Compilation, prog_node: *std.Progress.No defer assert(self.hdr.entry != 0x0); - const mod = self.base.options.module orelse return error.LinkingWithoutZigSourceUnimplemented; + const mod = self.base.comp.module orelse return error.LinkingWithoutZigSourceUnimplemented; // finish up the lazy syms if (self.lazy_syms.getPtr(.none)) |metadata| { @@ -1032,7 +1032,7 @@ pub fn freeDecl(self: *Plan9, decl_index: InternPool.DeclIndex) void { // freeDecl without any updateDecl in between. // However that is planned to change, see the TODO comment in Module.zig // in the deleteUnusedDecl function. - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); const is_fn = decl.val.isFuncBody(mod); if (is_fn) { @@ -1112,7 +1112,7 @@ pub fn seeDecl(self: *Plan9, decl_index: InternPool.DeclIndex) !Atom.Index { } const atom_idx = gop.value_ptr.index; // handle externs here because they might not get updateDecl called on them - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); const name = mod.intern_pool.stringToSlice(decl.name); if (decl.isExtern(mod)) { @@ -1147,7 +1147,7 @@ pub fn updateExports( pub fn getOrCreateAtomForLazySymbol(self: *Plan9, sym: File.LazySymbol) !Atom.Index { const gpa = self.base.comp.gpa; - const gop = try self.lazy_syms.getOrPut(gpa, sym.getDecl(self.base.options.module.?)); + const gop = try self.lazy_syms.getOrPut(gpa, sym.getDecl(self.base.comp.module.?)); errdefer _ = if (!gop.found_existing) self.lazy_syms.pop(); if (!gop.found_existing) gop.value_ptr.* = .{}; @@ -1166,7 +1166,7 @@ pub fn getOrCreateAtomForLazySymbol(self: *Plan9, sym: File.LazySymbol) !Atom.In _ = try self.getAtomPtr(atom).getOrCreateSymbolTableEntry(self); _ = self.getAtomPtr(atom).getOrCreateOffsetTableEntry(self); // anyerror needs to be deferred until flushModule - if (sym.getDecl(self.base.options.module.?) != .none) { + if (sym.getDecl(self.base.comp.module.?) != .none) { try self.updateLazySymbolAtom(sym, atom); } return atom; @@ -1174,7 +1174,7 @@ pub fn getOrCreateAtomForLazySymbol(self: *Plan9, sym: File.LazySymbol) !Atom.In fn updateLazySymbolAtom(self: *Plan9, sym: File.LazySymbol, atom_index: Atom.Index) !void { const gpa = self.base.comp.gpa; - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; var required_alignment: InternPool.Alignment = .none; var code_buffer = std.ArrayList(u8).init(gpa); @@ -1348,7 +1348,7 @@ pub fn writeSym(self: *Plan9, w: anytype, sym: aout.Sym) !void { } pub fn writeSyms(self: *Plan9, buf: *std.ArrayList(u8)) !void { - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const ip = &mod.intern_pool; const writer = buf.writer(); // write __GOT @@ -1374,7 +1374,7 @@ pub fn writeSyms(self: *Plan9, buf: *std.ArrayList(u8)) !void { const atom = self.getAtom(decl_metadata.index); const sym = self.syms.items[atom.sym_index.?]; try self.writeSym(writer, sym); - if (self.base.options.module.?.decl_exports.get(decl_index)) |exports| { + if (self.base.comp.module.?.decl_exports.get(decl_index)) |exports| { for (exports.items) |e| if (decl_metadata.getExport(self, ip.stringToSlice(e.opts.name))) |exp_i| { try self.writeSym(writer, self.syms.items[exp_i]); }; @@ -1421,7 +1421,7 @@ pub fn writeSyms(self: *Plan9, buf: *std.ArrayList(u8)) !void { const atom = self.getAtom(decl_metadata.index); const sym = self.syms.items[atom.sym_index.?]; try self.writeSym(writer, sym); - if (self.base.options.module.?.decl_exports.get(decl_index)) |exports| { + if (self.base.comp.module.?.decl_exports.get(decl_index)) |exports| { for (exports.items) |e| if (decl_metadata.getExport(self, ip.stringToSlice(e.opts.name))) |exp_i| { const s = self.syms.items[exp_i]; if (mem.eql(u8, s.name, "_start")) @@ -1464,7 +1464,7 @@ pub fn getDeclVAddr( decl_index: InternPool.DeclIndex, reloc_info: link.File.RelocInfo, ) !u64 { - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; const decl = mod.declPtr(decl_index); log.debug("getDeclVAddr for {s}", .{mod.intern_pool.stringToSlice(decl.name)}); if (decl.isExtern(mod)) { @@ -1517,7 +1517,7 @@ pub fn lowerAnonDecl(self: *Plan9, decl_val: InternPool.Index, src_loc: Module.S // ... const gpa = self.base.comp.gpa; const gop = try self.anon_decls.getOrPut(gpa, decl_val); - const mod = self.base.options.module.?; + const mod = self.base.comp.module.?; if (!gop.found_existing) { const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val)); const val = Value.fromInterned(decl_val); diff --git a/src/link/SpirV.zig b/src/link/SpirV.zig index c6bb5f5588..414ebcf987 100644 --- a/src/link/SpirV.zig +++ b/src/link/SpirV.zig @@ -196,7 +196,7 @@ pub fn flushModule(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.No defer error_info.deinit(); try error_info.appendSlice("zig_errors"); - const module = self.base.options.module.?; + const module = self.base.comp.module.?; for (module.global_error_set.keys()) |name_nts| { const name = module.intern_pool.stringToSlice(name_nts); // Errors can contain pretty much any character - to encode them in a string we must escape diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index bb0d4447bb..c9bd90eacf 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -632,7 +632,7 @@ pub fn getOrCreateAtomForDecl(wasm: *Wasm, decl_index: InternPool.DeclIndex) !At gop.value_ptr.* = atom_index; const atom = wasm.getAtom(atom_index); const symbol = atom.symbolLoc().getSymbol(wasm); - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; const decl = mod.declPtr(decl_index); const full_name = mod.intern_pool.stringToSlice(try decl.getFullyQualifiedName(mod)); symbol.name = try wasm.string_table.put(gpa, full_name); @@ -1568,7 +1568,7 @@ pub fn updateDeclLineNumber(wasm: *Wasm, mod: *Module, decl_index: InternPool.De fn finishUpdateDecl(wasm: *Wasm, decl_index: InternPool.DeclIndex, code: []const u8, symbol_tag: Symbol.Tag) !void { const gpa = wasm.base.comp.gpa; - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; const decl = mod.declPtr(decl_index); const atom_index = wasm.decls.get(decl_index).?; const atom = wasm.getAtomPtr(atom_index); @@ -1632,7 +1632,7 @@ fn getFunctionSignature(wasm: *const Wasm, loc: SymbolLoc) std.wasm.Type { /// The given `decl` is the parent decl whom owns the constant. pub fn lowerUnnamedConst(wasm: *Wasm, tv: TypedValue, decl_index: InternPool.DeclIndex) !u32 { const gpa = wasm.base.comp.gpa; - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; assert(tv.ty.zigTypeTag(mod) != .Fn); // cannot create local symbols for functions const decl = mod.declPtr(decl_index); @@ -1665,7 +1665,7 @@ const LowerConstResult = union(enum) { fn lowerConst(wasm: *Wasm, name: []const u8, tv: TypedValue, src_loc: Module.SrcLoc) !LowerConstResult { const gpa = wasm.base.comp.gpa; - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; // Create and initialize a new local symbol and atom const atom_index = try wasm.createAtom(); @@ -1753,7 +1753,7 @@ pub fn getDeclVAddr( reloc_info: link.File.RelocInfo, ) !u64 { const gpa = wasm.base.comp.gpa; - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; const decl = mod.declPtr(decl_index); const target_atom_index = try wasm.getOrCreateAtomForDecl(decl_index); @@ -1798,7 +1798,7 @@ pub fn lowerAnonDecl( const gpa = wasm.base.comp.gpa; const gop = try wasm.anon_decls.getOrPut(gpa, decl_val); if (!gop.found_existing) { - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val)); const tv: TypedValue = .{ .ty = ty, .val = Value.fromInterned(decl_val) }; var name_buf: [32]u8 = undefined; @@ -1831,7 +1831,7 @@ pub fn getAnonDeclVAddr(wasm: *Wasm, decl_val: InternPool.Index, reloc_info: lin const parent_atom_index = wasm.symbol_atom.get(.{ .file = null, .index = reloc_info.parent_atom_index }).?; const parent_atom = wasm.getAtomPtr(parent_atom_index); const is_wasm32 = wasm.base.options.target.cpu.arch == .wasm32; - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val)); if (ty.zigTypeTag(mod) == .Fn) { assert(reloc_info.addend == 0); // addend not allowed for function relocations @@ -2004,7 +2004,7 @@ pub fn updateExports( pub fn freeDecl(wasm: *Wasm, decl_index: InternPool.DeclIndex) void { if (wasm.llvm_object) |llvm_object| return llvm_object.freeDecl(decl_index); const gpa = wasm.base.comp.gpa; - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; const decl = mod.declPtr(decl_index); const atom_index = wasm.decls.get(decl_index).?; const atom = wasm.getAtomPtr(atom_index); @@ -2492,7 +2492,7 @@ fn setupErrorsLen(wasm: *Wasm) !void { const gpa = wasm.base.comp.gpa; const loc = wasm.findGlobalSymbol("__zig_errors_len") orelse return; - const errors_len = wasm.base.options.module.?.global_error_set.count(); + const errors_len = wasm.base.comp.module.?.global_error_set.count(); // overwrite existing atom if it already exists (maybe the error set has increased) // if not, allcoate a new atom. const atom_index = if (wasm.symbol_atom.get(loc)) |index| blk: { @@ -3268,7 +3268,7 @@ pub fn getErrorTableSymbol(wasm: *Wasm) !u32 { const atom_index = try wasm.createAtom(); const atom = wasm.getAtomPtr(atom_index); const slice_ty = Type.slice_const_u8_sentinel_0; - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; atom.alignment = slice_ty.abiAlignment(mod); const sym_index = atom.sym_index; @@ -3322,7 +3322,7 @@ fn populateErrorNameTable(wasm: *Wasm) !void { // Addend for each relocation to the table var addend: u32 = 0; - const mod = wasm.base.options.module.?; + const mod = wasm.base.comp.module.?; for (mod.global_error_set.keys()) |error_name_nts| { const atom = wasm.getAtomPtr(atom_index); @@ -3708,7 +3708,7 @@ pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Nod try wasm.markReferences(); try wasm.setupErrorsLen(); try wasm.setupImports(); - if (wasm.base.options.module) |mod| { + if (wasm.base.comp.module) |mod| { var decl_it = wasm.decls.iterator(); while (decl_it.next()) |entry| { const decl = mod.declPtr(entry.key_ptr.*); @@ -3759,7 +3759,7 @@ pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Nod } if (wasm.dwarf) |*dwarf| { - try dwarf.flushModule(wasm.base.options.module.?); + try dwarf.flushModule(wasm.base.comp.module.?); } } @@ -4190,7 +4190,7 @@ fn writeToFile( } // if (wasm.dwarf) |*dwarf| { - // const mod = wasm.base.options.module.?; + // const mod = wasm.base.comp.module.?; // try dwarf.writeDbgAbbrev(); // // for debug info and ranges, the address is always 0, // // as locations are always offsets relative to 'code' section. @@ -4535,7 +4535,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! // If there is no Zig code to compile, then we should skip flushing the output file because it // will not be part of the linker line anyway. - const module_obj_path: ?[]const u8 = if (wasm.base.options.module != null) blk: { + const module_obj_path: ?[]const u8 = if (wasm.base.comp.module != null) blk: { try wasm.flushModule(comp, prog_node); if (fs.path.dirname(full_out_path)) |dirname| { |
