Skip to content

Commit

Permalink
macho: recognise -r flag and error as unimplemented
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Dec 26, 2023
1 parent 1650b29 commit 31ba576
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ pub fn flush(self: *MachO) !void {

try self.addUndefinedGlobals();
try self.resolveSymbols();

if (self.options.relocatable) return relocatable.flush(self);

try self.resolveSyntheticSymbols();

try self.convertTentativeDefinitions();
Expand Down Expand Up @@ -3156,11 +3159,12 @@ const macho = std.macho;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
const thunks = @import("MachO/thunks.zig");
const trace = @import("tracy.zig").trace;
const relocatable = @import("MachO/relocatable.zig");
const synthetic = @import("MachO/synthetic.zig");
const state_log = std.log.scoped(.state);
const std = @import("std");
const thunks = @import("MachO/thunks.zig");
const trace = @import("tracy.zig").trace;

const Allocator = mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
Expand Down
4 changes: 4 additions & 0 deletions src/MachO/Options.zig
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const usage =
\\-platform_version [platform] [min_version] [sdk_version]
\\ Sets the platform, oldest supported version of that platform and
\\ the SDK it was built against
\\-r Create a relocatable object file
\\-reexport-l[name] Link against library and re-export it for the clients
\\ -reexport_library [name]
\\-rpath [path] Specify runtime path
Expand Down Expand Up @@ -91,6 +92,7 @@ const cmd = "ld64.zld";

emit: Zld.Emit,
dylib: bool = false,
relocatable: bool = false,
dynamic: bool = false,
cpu_arch: ?std.Target.Cpu.Arch = null,
platform: ?Platform = null,
Expand Down Expand Up @@ -238,6 +240,8 @@ pub fn parse(arena: Allocator, args: []const []const u8, ctx: anytype) !Options
try force_undefined_symbols.put(name, {});
} else if (p.flag1("S")) {
opts.strip = true;
} else if (p.flag1("r")) {
opts.relocatable = true;
} else if (p.flag1("all_load")) {
opts.all_load = true;
} else if (p.arg1("force_load")) |path| {
Expand Down
1 change: 1 addition & 0 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ pub fn main() !void {
error.UndefinedSymbols,
error.RelocError,
error.ResolveFailed,
error.Unimplemented,
=> {
zld.reportWarnings();
zld.reportErrors();
Expand Down

0 comments on commit 31ba576

Please sign in to comment.