aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-04-12 10:40:29 +0200
committerJakub Konka <kubkon@jakubkonka.com>2023-04-13 11:47:51 +0200
commit38ecaf3ab6c71aae213edbd38b8f661a03035b3a (patch)
treef8aba91386c89374bb871ce3008a9e2022f1be7a /src/link
parenteba280ce20d308ec0abb17719ab4cc43a27901eb (diff)
downloadzig-38ecaf3ab6c71aae213edbd38b8f661a03035b3a.tar.gz
zig-38ecaf3ab6c71aae213edbd38b8f661a03035b3a.zip
macho: add machinery for emitting TLV refs
Diffstat (limited to 'src/link')
-rw-r--r--src/link/MachO.zig3
-rw-r--r--src/link/MachO/Relocation.zig1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index cc5b9ecdc6..9e205417e3 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -613,6 +613,9 @@ pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.No
if (self.dyld_stub_binder_index == null) {
self.dyld_stub_binder_index = try self.addUndefined("dyld_stub_binder", .add_got);
}
+ if (!self.base.options.single_threaded) {
+ _ = try self.addUndefined("_tlv_bootstrap", .none);
+ }
try self.createMhExecuteHeaderSymbol();
diff --git a/src/link/MachO/Relocation.zig b/src/link/MachO/Relocation.zig
index 1d1d91279c..cb62ff98f0 100644
--- a/src/link/MachO/Relocation.zig
+++ b/src/link/MachO/Relocation.zig
@@ -48,6 +48,7 @@ pub fn isResolvable(self: Relocation, macho_file: *MachO) bool {
pub fn getTargetAtomIndex(self: Relocation, macho_file: *MachO) ?Atom.Index {
switch (self.type) {
.got, .got_page, .got_pageoff => return macho_file.getGotAtomIndexForSymbol(self.target),
+ .tlv, .tlv_page, .tlv_pageoff => return macho_file.getTlvpAtomIndexForSymbol(self.target),
else => {},
}
if (macho_file.getStubsAtomIndexForSymbol(self.target)) |stubs_atom| return stubs_atom;