commit 1eb4264b7aa9e9e2b8ec46a95b508dfa7a7ab0f7 (tree)
parent c984201ddb10d2977290c6f1d6857e78573a2dff
Author: Jakub Konka <kubkon@jakubkonka.com>
Date: Wed, 22 Mar 2023 15:13:52 +0100
macho+zld: make sure we populate source section index lookup if no undefs
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig
@@ -239,6 +239,12 @@ pub fn parse(self: *Object, allocator: Allocator, cpu_arch: std.Target.Cpu.Arch)
self.strtab_lookup[i] = @intCast(u32, sym_name_len);
}
+ // If there were no undefined symbols, make sure we populate the
+ // source section index lookup for the last scanned section.
+ if (section_index_lookup) |lookup| {
+ self.source_section_index_lookup[prev_sect_id - 1] = lookup;
+ }
+
// Parse __TEXT,__eh_frame header if one exists
self.eh_frame_sect_id = self.getSourceSectionIndexByName("__TEXT", "__eh_frame");