aboutsummaryrefslogtreecommitdiff
path: root/src/link/Plan9.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/link/Plan9.zig')
-rw-r--r--src/link/Plan9.zig48
1 files changed, 14 insertions, 34 deletions
diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig
index 5cbb9287d7..c99ebb81bb 100644
--- a/src/link/Plan9.zig
+++ b/src/link/Plan9.zig
@@ -301,7 +301,6 @@ pub fn createEmpty(
.stack_size = options.stack_size orelse 16777216,
.allow_shlib_undefined = options.allow_shlib_undefined orelse false,
.file = null,
- .disable_lld_caching = options.disable_lld_caching,
.build_id = options.build_id,
},
.sixtyfour_bit = sixtyfour_bit,
@@ -387,8 +386,7 @@ pub fn updateFunc(
self: *Plan9,
pt: Zcu.PerThread,
func_index: InternPool.Index,
- air: Air,
- liveness: Air.Liveness,
+ mir: *const codegen.AnyMir,
) link.File.UpdateNavError!void {
if (build_options.skip_non_native and builtin.object_format != .plan9) {
@panic("Attempted to compile for object format that was disabled by build configuration");
@@ -413,13 +411,12 @@ pub fn updateFunc(
};
defer dbg_info_output.dbg_line.deinit();
- try codegen.generateFunction(
+ try codegen.emitFunction(
&self.base,
pt,
zcu.navSrcLoc(func.owner_nav),
func_index,
- air,
- liveness,
+ mir,
&code_buffer,
.{ .plan9 = &dbg_info_output },
);
@@ -494,7 +491,7 @@ fn updateFinish(self: *Plan9, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index
// write the symbol
// we already have the got index
const sym: aout.Sym = .{
- .value = undefined, // the value of stuff gets filled in in flushModule
+ .value = undefined, // the value of stuff gets filled in in flush
.type = atom.type,
.name = try gpa.dupe(u8, nav.name.toSlice(ip)),
};
@@ -527,25 +524,6 @@ fn allocateGotIndex(self: *Plan9) usize {
}
}
-pub fn flush(
- self: *Plan9,
- arena: Allocator,
- tid: Zcu.PerThread.Id,
- prog_node: std.Progress.Node,
-) link.File.FlushError!void {
- const comp = self.base.comp;
- const diags = &comp.link_diags;
- const use_lld = build_options.have_llvm and comp.config.use_lld;
- assert(!use_lld);
-
- switch (link.File.effectiveOutputMode(use_lld, comp.config.output_mode)) {
- .Exe => {},
- .Obj => return diags.fail("writing plan9 object files unimplemented", .{}),
- .Lib => return diags.fail("writing plan9 lib files unimplemented", .{}),
- }
- return self.flushModule(arena, tid, prog_node);
-}
-
pub fn changeLine(l: *std.ArrayList(u8), delta_line: i32) !void {
if (delta_line > 0 and delta_line < 65) {
const toappend = @as(u8, @intCast(delta_line));
@@ -586,7 +564,7 @@ fn atomCount(self: *Plan9) usize {
return data_nav_count + fn_nav_count + lazy_atom_count + extern_atom_count + uav_atom_count;
}
-pub fn flushModule(
+pub fn flush(
self: *Plan9,
arena: Allocator,
/// TODO: stop using this
@@ -607,10 +585,16 @@ pub fn flushModule(
const gpa = comp.gpa;
const target = comp.root_mod.resolved_target.result;
+ switch (comp.config.output_mode) {
+ .Exe => {},
+ .Obj => return diags.fail("writing plan9 object files unimplemented", .{}),
+ .Lib => return diags.fail("writing plan9 lib files unimplemented", .{}),
+ }
+
const sub_prog_node = prog_node.start("Flush Module", 0);
defer sub_prog_node.end();
- log.debug("flushModule", .{});
+ log.debug("flush", .{});
defer assert(self.hdr.entry != 0x0);
@@ -1039,7 +1023,7 @@ pub fn getOrCreateAtomForLazySymbol(self: *Plan9, pt: Zcu.PerThread, lazy_sym: F
const atom = atom_ptr.*;
_ = try self.getAtomPtr(atom).getOrCreateSymbolTableEntry(self);
_ = self.getAtomPtr(atom).getOrCreateOffsetTableEntry(self);
- // anyerror needs to be deferred until flushModule
+ // anyerror needs to be deferred until flush
if (lazy_sym.ty != .anyerror_type) try self.updateLazySymbolAtom(pt, lazy_sym, atom);
return atom;
}
@@ -1182,11 +1166,7 @@ pub fn open(
const file = try emit.root_dir.handle.createFile(emit.sub_path, .{
.read = true,
- .mode = link.File.determineMode(
- use_lld,
- comp.config.output_mode,
- comp.config.link_mode,
- ),
+ .mode = link.File.determineMode(comp.config.output_mode, comp.config.link_mode),
});
errdefer file.close();
self.base.file = file;