diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-01-02 14:11:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-02 14:11:27 -0800 |
| commit | 289ae45c1b58e952867c4fa1e246d0ef7bc2ff64 (patch) | |
| tree | 5dd034143a2354b7b44496e684f1c764e2f9664c /src/link/MachO/Relocation.zig | |
| parent | c89bb3e141ee215add0b52930d48bffd8dae8342 (diff) | |
| parent | c546ddb3edc557fae4b932e5239b9dcb66117832 (diff) | |
| download | zig-289ae45c1b58e952867c4fa1e246d0ef7bc2ff64.tar.gz zig-289ae45c1b58e952867c4fa1e246d0ef7bc2ff64.zip | |
Merge pull request #18160 from ziglang/std-build-module
Move many settings from being per-Compilation to being per-Module
Diffstat (limited to 'src/link/MachO/Relocation.zig')
| -rw-r--r-- | src/link/MachO/Relocation.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/link/MachO/Relocation.zig b/src/link/MachO/Relocation.zig index 74be9eb0d5..85c19c7608 100644 --- a/src/link/MachO/Relocation.zig +++ b/src/link/MachO/Relocation.zig @@ -58,11 +58,12 @@ pub fn isStubTrampoline(self: Relocation, macho_file: *MachO) bool { } pub fn getTargetBaseAddress(self: Relocation, macho_file: *MachO) ?u64 { + const target = macho_file.base.comp.root_mod.resolved_target.result; if (self.isStubTrampoline(macho_file)) { const index = macho_file.stub_table.lookup.get(self.target) orelse return null; const header = macho_file.sections.items(.header)[macho_file.stubs_section_index.?]; return header.addr + - index * @import("stubs.zig").stubSize(macho_file.base.options.target.cpu.arch); + index * @import("stubs.zig").stubSize(target.cpu.arch); } switch (self.type) { .got, .got_page, .got_pageoff => { @@ -84,7 +85,8 @@ pub fn getTargetBaseAddress(self: Relocation, macho_file: *MachO) ?u64 { } pub fn resolve(self: Relocation, macho_file: *MachO, atom_index: Atom.Index, code: []u8) void { - const arch = macho_file.base.options.target.cpu.arch; + const target = macho_file.base.comp.root_mod.resolved_target.result; + const arch = target.cpu.arch; const atom = macho_file.getAtom(atom_index); const source_sym = atom.getSymbol(macho_file); const source_addr = source_sym.n_value + self.offset; |
