Commit b4e6b3c53c
Changed files (2)
src
link
src/link/MachO/relocatable.zig
@@ -26,68 +26,70 @@ pub fn flushObject(macho_file: *MachO, comp: *Compilation, module_obj_path: ?[]c
return;
}
- for (positionals.items) |obj| {
- macho_file.parsePositional(obj.path, obj.must_link) catch |err| switch (err) {
- error.MalformedObject,
- error.MalformedArchive,
- error.InvalidCpuArch,
- error.InvalidTarget,
- => continue, // already reported
- error.UnknownFileType => try macho_file.reportParseError(obj.path, "unknown file type for an object file", .{}),
- else => |e| try macho_file.reportParseError(
- obj.path,
- "unexpected error: parsing input file failed with error {s}",
- .{@errorName(e)},
- ),
- };
- }
-
- if (comp.link_errors.items.len > 0) return error.FlushFailure;
-
- try macho_file.addUndefinedGlobals();
- try macho_file.resolveSymbols();
- try macho_file.parseDebugInfo();
- try macho_file.dedupLiterals();
- markExports(macho_file);
- claimUnresolved(macho_file);
- try initOutputSections(macho_file);
- try macho_file.sortSections();
- try macho_file.addAtomsToSections();
- try calcSectionSizes(macho_file);
-
- try createSegment(macho_file);
- try allocateSections(macho_file);
- allocateSegment(macho_file);
-
- var off = off: {
- const seg = macho_file.segments.items[0];
- const off = math.cast(u32, seg.fileoff + seg.filesize) orelse return error.Overflow;
- break :off mem.alignForward(u32, off, @alignOf(macho.relocation_info));
- };
- off = allocateSectionsRelocs(macho_file, off);
+ @panic("TODO -r mode");
+
+ // for (positionals.items) |obj| {
+ // macho_file.parsePositional(obj.path, obj.must_link) catch |err| switch (err) {
+ // error.MalformedObject,
+ // error.MalformedArchive,
+ // error.InvalidCpuArch,
+ // error.InvalidTarget,
+ // => continue, // already reported
+ // error.UnknownFileType => try macho_file.reportParseError(obj.path, "unknown file type for an object file", .{}),
+ // else => |e| try macho_file.reportParseError(
+ // obj.path,
+ // "unexpected error: parsing input file failed with error {s}",
+ // .{@errorName(e)},
+ // ),
+ // };
+ // }
- if (build_options.enable_logging) {
- state_log.debug("{}", .{macho_file.dumpState()});
- }
+ // if (comp.link_errors.items.len > 0) return error.FlushFailure;
+
+ // try macho_file.addUndefinedGlobals();
+ // try macho_file.resolveSymbols();
+ // try macho_file.parseDebugInfo();
+ // try macho_file.dedupLiterals();
+ // markExports(macho_file);
+ // claimUnresolved(macho_file);
+ // try initOutputSections(macho_file);
+ // try macho_file.sortSections();
+ // try macho_file.addAtomsToSections();
+ // try calcSectionSizes(macho_file);
+
+ // try createSegment(macho_file);
+ // try allocateSections(macho_file);
+ // allocateSegment(macho_file);
+
+ // var off = off: {
+ // const seg = macho_file.segments.items[0];
+ // const off = math.cast(u32, seg.fileoff + seg.filesize) orelse return error.Overflow;
+ // break :off mem.alignForward(u32, off, @alignOf(macho.relocation_info));
+ // };
+ // off = allocateSectionsRelocs(macho_file, off);
+
+ // if (build_options.enable_logging) {
+ // state_log.debug("{}", .{macho_file.dumpState()});
+ // }
- try macho_file.calcSymtabSize();
- try writeAtoms(macho_file);
- try writeCompactUnwind(macho_file);
- try writeEhFrame(macho_file);
+ // try macho_file.calcSymtabSize();
+ // try writeAtoms(macho_file);
+ // try writeCompactUnwind(macho_file);
+ // try writeEhFrame(macho_file);
- off = mem.alignForward(u32, off, @alignOf(u64));
- off = try macho_file.writeDataInCode(0, off);
- off = mem.alignForward(u32, off, @alignOf(u64));
- off = try macho_file.writeSymtab(off);
- off = mem.alignForward(u32, off, @alignOf(u64));
- off = try macho_file.writeStrtab(off);
+ // off = mem.alignForward(u32, off, @alignOf(u64));
+ // off = try macho_file.writeDataInCode(0, off);
+ // off = mem.alignForward(u32, off, @alignOf(u64));
+ // off = try macho_file.writeSymtab(off);
+ // off = mem.alignForward(u32, off, @alignOf(u64));
+ // off = try macho_file.writeStrtab(off);
- // In order to please Apple ld (and possibly other MachO linkers in the wild),
- // we will now sanitize segment names of Zig-specific segments.
- sanitizeZigSections(macho_file);
+ // // In order to please Apple ld (and possibly other MachO linkers in the wild),
+ // // we will now sanitize segment names of Zig-specific segments.
+ // sanitizeZigSections(macho_file);
- const ncmds, const sizeofcmds = try writeLoadCommands(macho_file);
- try writeHeader(macho_file, ncmds, sizeofcmds);
+ // const ncmds, const sizeofcmds = try writeLoadCommands(macho_file);
+ // try writeHeader(macho_file, ncmds, sizeofcmds);
}
pub fn flushStaticLib(macho_file: *MachO, comp: *Compilation, module_obj_path: ?[]const u8) link.File.FlushError!void {
src/link/MachO.zig
@@ -357,7 +357,7 @@ pub fn flushModule(self: *MachO, arena: Allocator, tid: Zcu.PerThread.Id, prog_n
if (self.getZigObject()) |zo| try zo.flushModule(self, tid);
if (self.base.isStaticLib()) return relocatable.flushStaticLib(self, comp, module_obj_path);
- // if (self.base.isObject()) return relocatable.flushObject(self, comp, module_obj_path);
+ if (self.base.isObject()) return relocatable.flushObject(self, comp, module_obj_path);
var positionals = std.ArrayList(Compilation.LinkObject).init(gpa);
defer positionals.deinit();