aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
Diffstat (limited to 'src/link')
-rw-r--r--src/link/C.zig2
-rw-r--r--src/link/Coff.zig6
-rw-r--r--src/link/Coff/lld.zig6
-rw-r--r--src/link/Elf.zig4
-rw-r--r--src/link/Elf/ZigObject.zig6
-rw-r--r--src/link/MachO.zig2
-rw-r--r--src/link/MachO/ZigObject.zig6
-rw-r--r--src/link/Plan9.zig10
-rw-r--r--src/link/SpirV.zig2
-rw-r--r--src/link/Wasm.zig4
-rw-r--r--src/link/Wasm/ZigObject.zig12
11 files changed, 30 insertions, 30 deletions
diff --git a/src/link/C.zig b/src/link/C.zig
index 585389aa3f..18e6b5d0eb 100644
--- a/src/link/C.zig
+++ b/src/link/C.zig
@@ -418,7 +418,7 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:
const comp = self.base.comp;
const gpa = comp.gpa;
- const zcu = self.base.comp.module.?;
+ const zcu = self.base.comp.zcu.?;
const ip = &zcu.intern_pool;
const pt: Zcu.PerThread = .{ .zcu = zcu, .tid = tid };
diff --git a/src/link/Coff.zig b/src/link/Coff.zig
index 74f2c903e7..323fba7016 100644
--- a/src/link/Coff.zig
+++ b/src/link/Coff.zig
@@ -1354,7 +1354,7 @@ pub fn getOrCreateAtomForNav(self: *Coff, nav_index: InternPool.Nav.Index) !Atom
}
fn getNavOutputSection(self: *Coff, nav_index: InternPool.Nav.Index) u16 {
- const zcu = self.base.comp.module.?;
+ const zcu = self.base.comp.zcu.?;
const ip = &zcu.intern_pool;
const nav = ip.getNav(nav_index);
const ty = Type.fromInterned(nav.typeOf(ip));
@@ -1609,7 +1609,7 @@ pub fn deleteExport(
.nav => |nav| self.navs.getPtr(nav),
.uav => |uav| self.uavs.getPtr(uav),
} orelse return;
- const zcu = self.base.comp.module.?;
+ const zcu = self.base.comp.zcu.?;
const name_slice = name.toSlice(&zcu.intern_pool);
const sym_index = metadata.getExportPtr(self, name_slice) orelse return;
@@ -1691,7 +1691,7 @@ pub fn flushModule(self: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_no
defer sub_prog_node.end();
const pt: Zcu.PerThread = .{
- .zcu = comp.module orelse return error.LinkingWithoutZigSourceUnimplemented,
+ .zcu = comp.zcu orelse return error.LinkingWithoutZigSourceUnimplemented,
.tid = tid,
};
diff --git a/src/link/Coff/lld.zig b/src/link/Coff/lld.zig
index 7273aa39b6..9225399c94 100644
--- a/src/link/Coff/lld.zig
+++ b/src/link/Coff/lld.zig
@@ -32,7 +32,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_no
// 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 (comp.module != null) blk: {
+ const module_obj_path: ?[]const u8 = if (comp.zcu != null) blk: {
try self.flushModule(arena, tid, prog_node);
if (fs.path.dirname(full_out_path)) |dirname| {
@@ -296,7 +296,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_no
if (self.subsystem) |explicit| break :blk explicit;
switch (target.os.tag) {
.windows => {
- if (comp.module) |module| {
+ if (comp.zcu) |module| {
if (module.stage1_flags.have_dllmain_crt_startup or is_dyn_lib)
break :blk null;
if (module.stage1_flags.have_c_main or comp.config.is_test or
@@ -440,7 +440,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_no
} else {
try argv.append("-NODEFAULTLIB");
if (!is_lib and entry_name == null) {
- if (comp.module) |module| {
+ if (comp.zcu) |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 088485a78d..e89c475d10 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -212,7 +212,7 @@ pub fn createEmpty(
const use_lld = build_options.have_llvm and comp.config.use_lld;
const use_llvm = comp.config.use_llvm;
- const opt_zcu = comp.module;
+ const opt_zcu = comp.zcu;
const output_mode = comp.config.output_mode;
const link_mode = comp.config.link_mode;
const optimize_mode = comp.root_mod.optimize_mode;
@@ -2084,7 +2084,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s
// 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 (comp.module != null) blk: {
+ const module_obj_path: ?[]const u8 = if (comp.zcu != null) blk: {
try self.flushModule(arena, tid, prog_node);
if (fs.path.dirname(full_out_path)) |dirname| {
diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig
index ac16fb7a48..a7a758b5c4 100644
--- a/src/link/Elf/ZigObject.zig
+++ b/src/link/Elf/ZigObject.zig
@@ -128,7 +128,7 @@ pub fn deinit(self: *ZigObject, allocator: Allocator) void {
pub fn flushModule(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void {
// Handle any lazy symbols that were emitted by incremental compilation.
if (self.lazy_syms.getPtr(.anyerror_type)) |metadata| {
- const pt: Zcu.PerThread = .{ .zcu = elf_file.base.comp.module.?, .tid = tid };
+ const pt: Zcu.PerThread = .{ .zcu = elf_file.base.comp.zcu.?, .tid = tid };
// Most lazy symbols can be updated on first use, but
// anyerror needs to wait for everything to be flushed.
@@ -949,7 +949,7 @@ pub fn getOrCreateMetadataForNav(
if (!gop.found_existing) {
const any_non_single_threaded = elf_file.base.comp.config.any_non_single_threaded;
const symbol_index = try self.newSymbolWithAtom(gpa, 0);
- const zcu = elf_file.base.comp.module.?;
+ const zcu = elf_file.base.comp.zcu.?;
const nav_val = Value.fromInterned(zcu.intern_pool.getNav(nav_index).status.resolved.val);
const sym = self.symbol(symbol_index);
if (nav_val.getVariable(zcu)) |variable| {
@@ -1626,7 +1626,7 @@ pub fn deleteExport(
.nav => |nav| self.navs.getPtr(nav),
.uav => |uav| self.uavs.getPtr(uav),
} orelse return;
- const mod = elf_file.base.comp.module.?;
+ const mod = elf_file.base.comp.zcu.?;
const exp_name = name.toSlice(&mod.intern_pool);
const esym_index = metadata.@"export"(self, exp_name) orelse return;
log.debug("deleting export '{s}'", .{exp_name});
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index cfcf6b7965..d0e0d3d489 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -164,7 +164,7 @@ pub fn createEmpty(
const gpa = comp.gpa;
const use_llvm = comp.config.use_llvm;
- const opt_zcu = comp.module;
+ const opt_zcu = comp.zcu;
const optimize_mode = comp.root_mod.optimize_mode;
const output_mode = comp.config.output_mode;
const link_mode = comp.config.link_mode;
diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig
index e12ffd5cf7..9ef0fb0acd 100644
--- a/src/link/MachO/ZigObject.zig
+++ b/src/link/MachO/ZigObject.zig
@@ -566,7 +566,7 @@ pub fn getInputSection(self: ZigObject, atom: Atom, macho_file: *MachO) macho.se
pub fn flushModule(self: *ZigObject, macho_file: *MachO, tid: Zcu.PerThread.Id) !void {
// Handle any lazy symbols that were emitted by incremental compilation.
if (self.lazy_syms.getPtr(.anyerror_type)) |metadata| {
- const pt: Zcu.PerThread = .{ .zcu = macho_file.base.comp.module.?, .tid = tid };
+ const pt: Zcu.PerThread = .{ .zcu = macho_file.base.comp.zcu.?, .tid = tid };
// Most lazy symbols can be updated on first use, but
// anyerror needs to wait for everything to be flushed.
@@ -1437,7 +1437,7 @@ pub fn deleteExport(
exported: Zcu.Exported,
name: InternPool.NullTerminatedString,
) void {
- const mod = macho_file.base.comp.module.?;
+ const mod = macho_file.base.comp.zcu.?;
const metadata = switch (exported) {
.nav => |nav| self.navs.getPtr(nav),
@@ -1545,7 +1545,7 @@ pub fn getOrCreateMetadataForLazySymbol(
fn isThreadlocal(macho_file: *MachO, nav_index: InternPool.Nav.Index) bool {
if (!macho_file.base.comp.config.any_non_single_threaded)
return false;
- const ip = &macho_file.base.comp.module.?.intern_pool;
+ const ip = &macho_file.base.comp.zcu.?.intern_pool;
return switch (ip.indexToKey(ip.getNav(nav_index).status.resolved.val)) {
.variable => |variable| variable.is_threadlocal,
.@"extern" => |@"extern"| @"extern".is_threadlocal,
diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig
index 27a3bf7bc8..0d397dfff7 100644
--- a/src/link/Plan9.zig
+++ b/src/link/Plan9.zig
@@ -152,7 +152,7 @@ pub const Atom = struct {
return .{ .code_ptr = slice.ptr, .other = .{ .code_len = slice.len } };
}
fn getCode(self: CodePtr, plan9: *const Plan9) []u8 {
- const zcu = plan9.base.comp.module.?;
+ const zcu = plan9.base.comp.zcu.?;
const ip = &zcu.intern_pool;
return if (self.code_ptr) |p| p[0..self.other.code_len] else blk: {
const nav_index = self.other.nav_index;
@@ -317,7 +317,7 @@ pub fn createEmpty(
fn putFn(self: *Plan9, nav_index: InternPool.Nav.Index, out: FnNavOutput) !void {
const gpa = self.base.comp.gpa;
- const mod = self.base.comp.module.?;
+ const mod = self.base.comp.zcu.?;
const file_scope = mod.navFileScopeIndex(nav_index);
const fn_map_res = try self.fn_nav_table.getOrPut(gpa, file_scope);
if (fn_map_res.found_existing) {
@@ -607,7 +607,7 @@ pub fn flushModule(self: *Plan9, arena: Allocator, tid: Zcu.PerThread.Id, prog_n
defer assert(self.hdr.entry != 0x0);
const pt: Zcu.PerThread = .{
- .zcu = self.base.comp.module orelse return error.LinkingWithoutZigSourceUnimplemented,
+ .zcu = self.base.comp.zcu orelse return error.LinkingWithoutZigSourceUnimplemented,
.tid = tid,
};
@@ -952,7 +952,7 @@ pub fn freeDecl(self: *Plan9, decl_index: InternPool.DeclIndex) void {
const gpa = self.base.comp.gpa;
// TODO audit the lifetimes of decls table entries. It's possible to get
// freeDecl without any updateDecl in between.
- const mod = self.base.comp.module.?;
+ const mod = self.base.comp.zcu.?;
const decl = mod.declPtr(decl_index);
const is_fn = decl.val.isFuncBody(mod);
if (is_fn) {
@@ -1256,7 +1256,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.comp.module.?;
+ const mod = self.base.comp.zcu.?;
const ip = &mod.intern_pool;
const writer = buf.writer();
// write __GOT
diff --git a/src/link/SpirV.zig b/src/link/SpirV.zig
index 9964c09df0..7263b6d28d 100644
--- a/src/link/SpirV.zig
+++ b/src/link/SpirV.zig
@@ -229,7 +229,7 @@ pub fn flushModule(self: *SpirV, arena: Allocator, tid: Zcu.PerThread.Id, prog_n
defer error_info.deinit();
try error_info.appendSlice("zig_errors:");
- const ip = &self.base.comp.module.?.intern_pool;
+ const ip = &self.base.comp.zcu.?.intern_pool;
for (ip.global_error_set.getNamesFromMainThread()) |name| {
// Errors can contain pretty much any character - to encode them in a string we must escape
// them somehow. Easiest here is to use some established scheme, one which also preseves the
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig
index 2c5fc3fe7a..749719d5fc 100644
--- a/src/link/Wasm.zig
+++ b/src/link/Wasm.zig
@@ -556,7 +556,7 @@ pub fn createEmpty(
}
}
- if (comp.module) |zcu| {
+ if (comp.zcu) |zcu| {
if (!use_llvm) {
const index: File.Index = @enumFromInt(wasm.files.len);
var zig_object: ZigObject = .{
@@ -3352,7 +3352,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, tid: Zcu.PerThread.Id, prog_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 (comp.module != null) blk: {
+ const module_obj_path: ?[]const u8 = if (comp.zcu != null) blk: {
try wasm.flushModule(arena, tid, prog_node);
if (fs.path.dirname(full_out_path)) |dirname| {
diff --git a/src/link/Wasm/ZigObject.zig b/src/link/Wasm/ZigObject.zig
index a8312f71a5..82437a3f66 100644
--- a/src/link/Wasm/ZigObject.zig
+++ b/src/link/Wasm/ZigObject.zig
@@ -487,7 +487,7 @@ fn lowerConst(
src_loc: Zcu.LazySrcLoc,
) !LowerConstResult {
const gpa = wasm_file.base.comp.gpa;
- const zcu = wasm_file.base.comp.module.?;
+ const zcu = wasm_file.base.comp.zcu.?;
const ty = val.typeOf(zcu);
@@ -604,7 +604,7 @@ fn populateErrorNameTable(zig_object: *ZigObject, wasm_file: *Wasm, tid: Zcu.Per
// Addend for each relocation to the table
var addend: u32 = 0;
- const pt: Zcu.PerThread = .{ .zcu = wasm_file.base.comp.module.?, .tid = tid };
+ const pt: Zcu.PerThread = .{ .zcu = wasm_file.base.comp.zcu.?, .tid = tid };
const slice_ty = Type.slice_const_u8_sentinel_0;
const atom = wasm_file.getAtomPtr(atom_index);
{
@@ -803,7 +803,7 @@ pub fn getUavVAddr(
const parent_atom_index = wasm_file.symbol_atom.get(.{ .file = zig_object.index, .index = @enumFromInt(reloc_info.parent_atom_index) }).?;
const parent_atom = wasm_file.getAtomPtr(parent_atom_index);
const is_wasm32 = target.cpu.arch == .wasm32;
- const mod = wasm_file.base.comp.module.?;
+ const mod = wasm_file.base.comp.zcu.?;
const ty = Type.fromInterned(mod.intern_pool.typeOf(uav));
if (ty.zigTypeTag(mod) == .Fn) {
std.debug.assert(reloc_info.addend == 0); // addend not allowed for function relocations
@@ -834,7 +834,7 @@ pub fn deleteExport(
exported: Zcu.Exported,
name: InternPool.NullTerminatedString,
) void {
- const mod = wasm_file.base.comp.module.?;
+ const mod = wasm_file.base.comp.zcu.?;
const nav_index = switch (exported) {
.nav => |nav_index| nav_index,
.uav => @panic("TODO: implement Wasm linker code for exporting a constant value"),
@@ -930,7 +930,7 @@ pub fn updateExports(
pub fn freeNav(zig_object: *ZigObject, wasm_file: *Wasm, nav_index: InternPool.Nav.Index) void {
const gpa = wasm_file.base.comp.gpa;
- const mod = wasm_file.base.comp.module.?;
+ const mod = wasm_file.base.comp.zcu.?;
const ip = &mod.intern_pool;
const nav_info = zig_object.navs.getPtr(nav_index).?;
const atom_index = nav_info.atom;
@@ -1016,7 +1016,7 @@ fn setupErrorsLen(zig_object: *ZigObject, wasm_file: *Wasm) !void {
const gpa = wasm_file.base.comp.gpa;
const sym_index = zig_object.findGlobalSymbol("__zig_errors_len") orelse return;
- const errors_len = 1 + wasm_file.base.comp.module.?.intern_pool.global_error_set.getNamesFromMainThread().len;
+ const errors_len = 1 + wasm_file.base.comp.zcu.?.intern_pool.global_error_set.getNamesFromMainThread().len;
// overwrite existing atom if it already exists (maybe the error set has increased)
// if not, allocate a new atom.
const atom_index = if (wasm_file.symbol_atom.get(.{ .file = zig_object.index, .index = sym_index })) |index| blk: {