mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
fix Nvptx backend outputing files at the top level of zig-cache
This commit is contained in:
parent
6064477928
commit
91b8d9e370
@ -193,7 +193,7 @@ pub fn binNameAlloc(allocator: std.mem.Allocator, options: BinNameOptions) error
|
||||
target.libPrefix(), root_name,
|
||||
}),
|
||||
},
|
||||
.nvptx => return std.fmt.allocPrint(allocator, "{s}", .{root_name}),
|
||||
.nvptx => return std.fmt.allocPrint(allocator, "{s}.ptx", .{root_name}),
|
||||
.dxcontainer => @panic("TODO what's the file extension for these?"),
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ const LlvmObject = @import("../codegen/llvm.zig").Object;
|
||||
|
||||
base: link.File,
|
||||
llvm_object: *LlvmObject,
|
||||
ptx_file_name: []const u8,
|
||||
|
||||
pub fn createEmpty(gpa: Allocator, options: link.Options) !*NvPtx {
|
||||
if (!build_options.have_llvm) return error.PtxArchNotSupported;
|
||||
@ -46,6 +47,7 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*NvPtx {
|
||||
.allocator = gpa,
|
||||
},
|
||||
.llvm_object = llvm_object,
|
||||
.ptx_file_name = try std.mem.join(gpa, "", &[_][]const u8{ options.root_name, ".ptx" }),
|
||||
};
|
||||
|
||||
return nvptx;
|
||||
@ -63,6 +65,7 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option
|
||||
pub fn deinit(self: *NvPtx) void {
|
||||
if (!build_options.have_llvm) return;
|
||||
self.llvm_object.destroy(self.base.allocator);
|
||||
self.base.allocator.free(self.ptx_file_name);
|
||||
}
|
||||
|
||||
pub fn updateFunc(self: *NvPtx, module: *Module, func: *Module.Fn, air: Air, liveness: Liveness) !void {
|
||||
@ -111,8 +114,9 @@ pub fn flushModule(self: *NvPtx, comp: *Compilation, prog_node: *std.Progress.No
|
||||
// This is required by the LLVM PTX backend.
|
||||
comp.bin_file.options.emit = null;
|
||||
comp.emit_asm = .{
|
||||
.directory = outfile.directory,
|
||||
.basename = comp.bin_file.intermediary_basename.?,
|
||||
// 'null' means using the default cache dir: zig-cache/o/...
|
||||
.directory = null,
|
||||
.basename = self.ptx_file_name,
|
||||
};
|
||||
defer {
|
||||
comp.bin_file.options.emit = outfile;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user