diff --git a/lib/std/target.zig b/lib/std/target.zig index 0b2a4a4df694..04350cd4a042 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -905,6 +905,13 @@ pub const Target = struct { }; } + pub fn isPtx(arch: Arch) bool { + return switch (arch) { + .nvptx, .nvptx64 => true, + else => false, + }; + } + pub fn parseCpuModel(arch: Arch, cpu_name: []const u8) !*const Cpu.Model { for (arch.allCpuModels()) |cpu| { if (mem.eql(u8, cpu_name, cpu.name)) { diff --git a/src/target.zig b/src/target.zig index 2eff4f8445a4..7f6453e7ad1b 100644 --- a/src/target.zig +++ b/src/target.zig @@ -455,7 +455,9 @@ pub fn classifyCompilerRtLibName(target: std.Target, name: []const u8) CompilerR } pub fn hasDebugInfo(target: std.Target) bool { - return !target.cpu.arch.isWasm(); + // Debug info will be supported by PTX 7.5, which will come to Zig with LLVM 14 + // TODO(gwenzek): Check the target ptx version and keep debug info if possible + return !(target.cpu.arch.isWasm() or target.cpu.arch.isPtx()); } pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.Mode {