aboutsummaryrefslogtreecommitdiff
path: root/src/link/Coff
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-08-31 21:15:23 +0200
committerJakub Konka <kubkon@jakubkonka.com>2022-09-07 22:42:55 +0200
commit1ab149c5fc474e73cb52872e11cbd2b916961ede (patch)
treecdc61d8adf4f353e6c92919a4560a38ddc2ba738 /src/link/Coff
parent51fba37af70283427a7ef5d2f2fd39f97aaa1e35 (diff)
downloadzig-1ab149c5fc474e73cb52872e11cbd2b916961ede.tar.gz
zig-1ab149c5fc474e73cb52872e11cbd2b916961ede.zip
coff: create import atoms and matching bindings
Diffstat (limited to 'src/link/Coff')
-rw-r--r--src/link/Coff/Atom.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/link/Coff/Atom.zig b/src/link/Coff/Atom.zig
index a7608d9a34..1d6e511f3b 100644
--- a/src/link/Coff/Atom.zig
+++ b/src/link/Coff/Atom.zig
@@ -118,3 +118,13 @@ pub fn addBaseRelocation(self: *Atom, coff_file: *Coff, offset: u32) !void {
}
try gop.value_ptr.append(gpa, offset);
}
+
+pub fn addBinding(self: *Atom, coff_file: *Coff, target: SymbolWithLoc) !void {
+ const gpa = coff_file.base.allocator;
+ log.debug(" (adding binding to target %{d} in %{d})", .{ target.sym_index, self.sym_index });
+ const gop = try coff_file.bindings.getOrPut(gpa, self);
+ if (!gop.found_existing) {
+ gop.value_ptr.* = .{};
+ }
+ try gop.value_ptr.append(gpa, target);
+}