Merge pull request #10280 from ziglang/zld-rel-code-path
macho: add preliminary non-prealloc path to the linker
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -344,7 +344,8 @@ pub fn parseRelocs(self: *Atom, relocs: []macho.relocation_info, context: RelocC
|
||||
const local_sym_index = context.object.sections_as_symbols.get(sect_id) orelse blk: {
|
||||
const seg = context.object.load_commands.items[context.object.segment_cmd_index.?].Segment;
|
||||
const sect = seg.sections.items[sect_id];
|
||||
const match = (try context.macho_file.getMatchingSection(sect)) orelse unreachable;
|
||||
const match = (try context.macho_file.getMatchingSection(sect)) orelse
|
||||
unreachable;
|
||||
const local_sym_index = @intCast(u32, context.macho_file.locals.items.len);
|
||||
try context.macho_file.locals.append(context.allocator, .{
|
||||
.n_strx = 0,
|
||||
|
||||
@@ -474,7 +474,9 @@ pub fn parseIntoAtoms(self: *Object, allocator: Allocator, macho_file: *MachO) !
|
||||
try self.sections_as_symbols.putNoClobber(allocator, sect_id, atom_local_sym_index);
|
||||
break :blk atom_local_sym_index;
|
||||
};
|
||||
const atom = try macho_file.createEmptyAtom(atom_local_sym_index, sect.size, sect.@"align");
|
||||
const alignment = try math.powi(u32, 2, sect.@"align");
|
||||
const aligned_size = mem.alignForwardGeneric(u64, sect.size, alignment);
|
||||
const atom = try macho_file.createEmptyAtom(atom_local_sym_index, aligned_size, sect.@"align");
|
||||
|
||||
const is_zerofill = blk: {
|
||||
const section_type = commands.sectionType(sect);
|
||||
|
||||
Reference in New Issue
Block a user