authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-30 06:11:06+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-01 06:23:59+01:00
log60c0f522d96ed455545552b567af6a6c345595a9
treeb14cbd6fd0eca053a9eb7a3e3c271e68de2a6d6d
parentf89982bf53d04d4f8e65a449c261eff2a8539169
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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.

1 files changed, 26 insertions(+), 6 deletions(-)

src/codegen/llvm.zig+26-6
......@@ -164,14 +164,34 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
164164 };
165165
166166 if (llvm_sub_arch) |sub| try llvm_triple.appendSlice(sub);
167 try llvm_triple.append('-');
167168
168 // Unlike CPU backends, GPU backends actually care about the vendor tag.
169 try llvm_triple.appendSlice(switch (target.cpu.arch) {
170 .amdgcn => if (target.os.tag == .mesa3d) "-mesa-" else "-amd-",
171 .nvptx, .nvptx64 => "-nvidia-",
172 .spirv64 => if (target.os.tag == .amdhsa) "-amd-" else "-unknown-",
173 else => "-unknown-",
169 try llvm_triple.appendSlice(switch (target.os.tag) {
170 .aix,
171 .zos,
172 => "ibm",
173 .bridgeos,
174 .driverkit,
175 .ios,
176 .macos,
177 .tvos,
178 .visionos,
179 .watchos,
180 => "apple",
181 .ps4,
182 .ps5,
183 => "scei",
184 .amdhsa,
185 .amdpal,
186 => "amd",
187 .cuda,
188 .nvcl,
189 => "nvidia",
190 .mesa3d,
191 => "mesa",
192 else => "unknown",
174193 });
194 try llvm_triple.append('-');
175195
176196 const llvm_os = switch (target.os.tag) {
177197 .freestanding => "unknown",