diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index ea9929bbcd70986deacc74d28f94660b060dd217..ce180f9ead8c4f545f4e5e8ea2a6ecc3c7b33179 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -130,7 +130,7 @@ pub const ResolveError = error{ ZigLacksTargetSupport, EmittingBinaryRequiresLlvmLibrary, LldIncompatibleObjectFormat, - LldCannotIncrementallyLink, + LldIncompatibleWithSelfHostedBackend, LtoRequiresLld, SanitizeThreadRequiresLibCpp, LibCRequiresLibUnwind, @@ -400,10 +400,10 @@ pub fn resolve(options: Options) ResolveError!Config { break :b true; } - // If there's no ZCU we aren't using the LLVM backend but - // it shouldn't influence which linker we pick - if (!use_llvm and options.have_zcu) { - if (options.use_lld == true) return error.LldCannotIncrementallyLink; + // If we have Zig code (i.e. a ZCU) and are compiling with a self-hosted backend, then we + // also need to use a self-hosted linker. + if (options.have_zcu and !use_llvm) { + if (options.use_lld == true) return error.LldIncompatibleWithSelfHostedBackend; break :b false; } diff --git a/src/main.zig b/src/main.zig index 7dc632c7b184298e3d4b7f5242cd69281ef5c334..e55100f89171452f0d1d9e457d8595c8756d8319 100644 --- a/src/main.zig +++ b/src/main.zig @@ -4115,7 +4115,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.LldIncompatibleWithSelfHostedBackend => 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.LibCRequiresLibUnwind => fatal("libc of the specified target requires linking libunwind", .{}),