From 4b403c7eaca50815cae8f2ddde19b4fb476ae8ca Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 26 Sep 2020 21:23:12 -0700 Subject: [PATCH] fix non-ELF linkAsArchive --- BRANCH_TODO | 4 ++-- src/link.zig | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/BRANCH_TODO b/BRANCH_TODO index 5306f29746..6eb9cbc34b 100644 --- a/BRANCH_TODO +++ b/BRANCH_TODO @@ -1,7 +1,7 @@ - * MachO LLD linking * subsystem - * mingw-w64 * COFF LLD linking + * mingw-w64 + * MachO LLD linking * WASM LLD linking * audit the CLI options for stage2 * audit the base cache hash diff --git a/src/link.zig b/src/link.zig index 6cf1d775e4..b90dce9766 100644 --- a/src/link.zig +++ b/src/link.zig @@ -417,7 +417,11 @@ pub const File = struct { const module_obj_path: ?[]const u8 = if (base.options.module) |module| blk: { const use_stage1 = build_options.is_stage1 and base.options.use_llvm; if (use_stage1) { - const obj_basename = try std.fmt.allocPrint(arena, "{}.o", .{base.options.root_name}); + const obj_basename = try std.zig.binNameAlloc(arena, .{ + .root_name = base.options.root_name, + .target = base.options.target, + .output_mode = .Obj, + }); const full_obj_path = try directory.join(arena, &[_][]const u8{obj_basename}); break :blk full_obj_path; }