mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
llvm: Set vendor type in LLVM target triple for more OSs.
Annoyingly, LLVM and Clang have various checks throughout that depend on these vendor types being set.
This commit is contained in:
parent
f89982bf53
commit
60c0f522d9
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user