From e5a3a10a5a255cc01f3b9944a09a76753e32a8b7 Mon Sep 17 00:00:00 2001 From: David Rubin Date: Mon, 29 Apr 2024 13:37:47 -0700 Subject: [PATCH] add error message for `-fno-llvm` `-flld` We plan to remove all dependency on LLD either way, so this will not be a supported usecase. --- src/Compilation/Config.zig | 6 ++++++ src/main.zig | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index d692fe5623..2de2184252 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -119,6 +119,7 @@ pub const ResolveError = error{ ZigLacksTargetSupport, EmittingBinaryRequiresLlvmLibrary, LldIncompatibleObjectFormat, + LldCannotIncrementallyLink, LtoRequiresLld, SanitizeThreadRequiresLibCpp, LibCppRequiresLibUnwind, @@ -257,6 +258,11 @@ pub fn resolve(options: Options) ResolveError!Config { break :b true; } + if (options.use_llvm == false) { + if (options.use_lld == true) return error.LldCannotIncrementallyLink; + break :b false; + } + if (options.use_lld) |x| break :b x; break :b true; }; diff --git a/src/main.zig b/src/main.zig index 21f7281d74..6b6dd0ec39 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3949,6 +3949,7 @@ fn createModule( error.ZigLacksTargetSupport => fatal("compiler backend unavailable for the specified target", .{}), error.EmittingBinaryRequiresLlvmLibrary => fatal("producing machine code via LLVM requires using the LLVM library", .{}), error.LldIncompatibleObjectFormat => fatal("using LLD to link {s} files is unsupported", .{@tagName(target.ofmt)}), + error.LldCannotIncrementallyLink => fatal("self-hosted backends do not support linking with LLD", .{}), error.LtoRequiresLld => fatal("LTO requires using LLD", .{}), error.SanitizeThreadRequiresLibCpp => fatal("thread sanitization is (for now) implemented in C++, so it requires linking libc++", .{}), error.LibCppRequiresLibUnwind => fatal("libc++ requires linking libunwind", .{}),