diff --git a/src/Compilation.zig b/src/Compilation.zig index e58e9049b5ce4d3be24c7677c90681280923ca47..c9512dd26b9278c8a3957e9bd4741672be8f1e65 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -993,6 +993,12 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { } else if (options.target.os.tag == .windows and link_libcpp) { // https://github.com/ziglang/zig/issues/8531 break :blk false; + } else if (options.target.cpu.arch.isRISCV()) { + // Clang and LLVM currently don't support RISC-V target-abi for LTO. + // Compiling with LTO may fail or produce undesired results. + // See https://reviews.llvm.org/D71387 + // See https://reviews.llvm.org/D102582 + break :blk false; } else switch (options.output_mode) { .Lib, .Obj => break :blk false, .Exe => switch (options.optimize_mode) {