diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 418bcc4a26..c92c70b310 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -265,7 +265,12 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { .eabihf => "eabihf", .android => "android", .androideabi => "androideabi", - .musl => "musl", + .musl => switch (target.os.tag) { + // For WASI/Emscripten, "musl" refers to the libc, not really the ABI. + // "unknown" provides better compatibility with LLVM-based tooling for these targets. + .wasi, .emscripten => "unknown", + else => "musl", + }, .muslabin32 => "musl", // Should be muslabin32 in LLVM 20. .muslabi64 => "musl", // Should be muslabi64 in LLVM 20. .musleabi => "musleabi",