Commit 60c0f522d9
Changed files (1)
src
codegen
src/codegen/llvm.zig
@@ -164,14 +164,34 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
};
if (llvm_sub_arch) |sub| try llvm_triple.appendSlice(sub);
+ try llvm_triple.append('-');
- // Unlike CPU backends, GPU backends actually care about the vendor tag.
- try llvm_triple.appendSlice(switch (target.cpu.arch) {
- .amdgcn => if (target.os.tag == .mesa3d) "-mesa-" else "-amd-",
- .nvptx, .nvptx64 => "-nvidia-",
- .spirv64 => if (target.os.tag == .amdhsa) "-amd-" else "-unknown-",
- else => "-unknown-",
+ try llvm_triple.appendSlice(switch (target.os.tag) {
+ .aix,
+ .zos,
+ => "ibm",
+ .bridgeos,
+ .driverkit,
+ .ios,
+ .macos,
+ .tvos,
+ .visionos,
+ .watchos,
+ => "apple",
+ .ps4,
+ .ps5,
+ => "scei",
+ .amdhsa,
+ .amdpal,
+ => "amd",
+ .cuda,
+ .nvcl,
+ => "nvidia",
+ .mesa3d,
+ => "mesa",
+ else => "unknown",
});
+ try llvm_triple.append('-');
const llvm_os = switch (target.os.tag) {
.freestanding => "unknown",