aboutsummaryrefslogtreecommitdiff
path: root/src/link/Plan9.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-07-08 14:24:16 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-07-08 14:24:16 -0700
commit476faef97ab0f292159bb3eef42078f9b1e43dde (patch)
treefdbe0ebed92520fa7920409cc65c9b51ca9dd288 /src/link/Plan9.zig
parent4eb778fc3eeec62c5c45ccc0a21631ff757d8a23 (diff)
downloadzig-476faef97ab0f292159bb3eef42078f9b1e43dde.tar.gz
zig-476faef97ab0f292159bb3eef42078f9b1e43dde.zip
plan9 cleanups
* rename files to adhere to conventions * remove unnecessary function / optionality * fix merge conflict * better panic message * remove unnecessary TODO comment * proper namespacing of declarations * clean up documentation comments * no copyright header needed for a brand new zig file that is not copied from anywhere
Diffstat (limited to 'src/link/Plan9.zig')
-rw-r--r--src/link/Plan9.zig13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig
index f12b8af6b5..f880b40d85 100644
--- a/src/link/Plan9.zig
+++ b/src/link/Plan9.zig
@@ -1,10 +1,13 @@
+//! This implementation does all the linking work in flush(). A future improvement
+//! would be to add incremental linking in a similar way as ELF does.
+
const Plan9 = @This();
const std = @import("std");
const link = @import("../link.zig");
const Module = @import("../Module.zig");
const Compilation = @import("../Compilation.zig");
-const aout = @import("plan9/a.out.zig");
+const aout = @import("Plan9/aout.zig");
const codegen = @import("../codegen.zig");
const trace = @import("../tracy.zig").trace;
const mem = std.mem;
@@ -14,8 +17,6 @@ const Allocator = std.mem.Allocator;
const log = std.log.scoped(.link);
const assert = std.debug.assert;
-// TODO use incremental compilation
-
base: link.File,
sixtyfour_bit: bool,
error_flags: File.ErrorFlags = File.ErrorFlags{},
@@ -38,7 +39,7 @@ const Bases = struct {
data: u64,
};
-fn getAddr(self: Plan9, addr: u64, t: aout.SymType) u64 {
+fn getAddr(self: Plan9, addr: u64, t: aout.Sym.Type) u64 {
return addr + switch (t) {
.T, .t, .l, .L => self.bases.text,
.D, .d, .B, .b => self.bases.data,
@@ -46,7 +47,7 @@ fn getAddr(self: Plan9, addr: u64, t: aout.SymType) u64 {
};
}
/// opposite of getAddr
-fn takeAddr(self: Plan9, addr: u64, t: aout.SymType) u64 {
+fn takeAddr(self: Plan9, addr: u64, t: aout.Sym.Type) u64 {
return addr - switch (t) {
.T, .t, .l, .L => self.bases.text,
.D, .d, .B, .b => self.bases.data,
@@ -59,7 +60,7 @@ fn getSymAddr(self: Plan9, s: aout.Sym) u64 {
}
pub const DeclBlock = struct {
- type: aout.SymType,
+ type: aout.Sym.Type,
/// offset in the text or data sects
offset: ?u64,
/// offset into syms