commit 3e2d1ccaad03e7e1a9efe905863d3af793e61500 (tree)
parent b58a2a4de6f9ce82d969d076dea798daf22d4b69
Author: Jakub Konka <kubkon@jakubkonka.com>
Date: Wed, 2 Dec 2020 00:03:07 +0100
lld+macho: rename final artefact in main.zig
Diffstat:
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
@@ -762,9 +762,6 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
try self.writeHeader();
// Generate adhoc code signature
try self.writeCodeSignature();
- // Move file in-place to please the kernel
- const emit = self.base.options.emit.?;
- try emit.directory.handle.copyFile(emit.sub_path, emit.directory.handle, emit.sub_path, .{});
}
}
}
diff --git a/src/main.zig b/src/main.zig
@@ -1773,8 +1773,16 @@ fn buildOutputType(
error.SemanticAnalyzeFail => process.exit(1),
else => |e| return e,
};
- if (output_mode == .Exe) {
- try comp.makeBinFileExecutable();
+ switch (output_mode) {
+ .Exe => try comp.makeBinFileExecutable(),
+ .Lib => {
+ if (link_mode) |lm| {
+ if (lm == .Dynamic) {
+ try comp.makeBinFileExecutable();
+ }
+ }
+ },
+ else => {},
}
if (build_options.is_stage1 and comp.stage1_lock != null and watch) {
@@ -2413,6 +2421,7 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
defer comp.destroy();
try updateModule(gpa, comp, null, .none);
+ try comp.makeBinFileExecutable();
child_argv.items[argv_index_exe] = try comp.bin_file.options.emit.?.directory.join(
arena,