aboutsummaryrefslogtreecommitdiff
path: root/src/link/MachO/Atom.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-08-01 12:28:58 +0200
committerJakub Konka <kubkon@jakubkonka.com>2022-08-03 21:19:41 +0200
commitbb532584bc569edb563b757c658fd743731837ec (patch)
treeaa0c1356909f0be2431e5420b0e84ca5ae89e5ad /src/link/MachO/Atom.zig
parentf26d5ee7ea97c8fd6e5b2655f845be7e4293930e (diff)
downloadzig-bb532584bc569edb563b757c658fd743731837ec.tar.gz
zig-bb532584bc569edb563b757c658fd743731837ec.zip
macho: update how we insert output sections
Instead of generating sections upfront, allow generation by scanning the object files for input -> output sections mapping. Next, always strive to keep output sections in the final container sorted as they appear in the final binary. This makes the linker less messy wrt handling of output sections sort order for dyld/macOS not to complain. There's still more work to be done for incremental context though to make this work but looks promising already.
Diffstat (limited to 'src/link/MachO/Atom.zig')
-rw-r--r--src/link/MachO/Atom.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/link/MachO/Atom.zig b/src/link/MachO/Atom.zig
index 90c86e24ed..85b3ca1c2b 100644
--- a/src/link/MachO/Atom.zig
+++ b/src/link/MachO/Atom.zig
@@ -466,7 +466,7 @@ fn addPtrBindingOrRebase(
const section = context.macho_file.sections.get(source_sym.n_sect - 1);
const header = section.header;
const segment_index = section.segment_index;
- const sect_type = header.type_();
+ const sect_type = header.@"type"();
const should_rebase = rebase: {
if (rel.r_length != 3) break :rebase false;
@@ -571,7 +571,7 @@ pub fn resolveRelocs(self: *Atom, macho_file: *MachO) !void {
const is_tlv = is_tlv: {
const source_sym = self.getSymbol(macho_file);
const header = macho_file.sections.items(.header)[source_sym.n_sect - 1];
- break :is_tlv header.type_() == macho.S_THREAD_LOCAL_VARIABLES;
+ break :is_tlv header.@"type"() == macho.S_THREAD_LOCAL_VARIABLES;
};
const target_addr = blk: {
const target_atom = rel.getTargetAtom(macho_file) orelse {