authorgravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2024-04-29 13:37:47-07:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-06-19 20:13:21+02:00
loge5a3a10a5a255cc01f3b9944a09a76753e32a8b7
tree436e0b48915dca5ddbaf723dc54b83991432631c
parenta154d8da8e39e5d0ed180b4a1e5150349699e5df

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.

2 files changed, 7 insertions(+), 0 deletions(-)

src/Compilation/Config.zig+6
...@@ -119,6 +119,7 @@ pub const ResolveError = error{...@@ -119,6 +119,7 @@ pub const ResolveError = error{
119 ZigLacksTargetSupport,119 ZigLacksTargetSupport,
120 EmittingBinaryRequiresLlvmLibrary,120 EmittingBinaryRequiresLlvmLibrary,
121 LldIncompatibleObjectFormat,121 LldIncompatibleObjectFormat,
122 LldCannotIncrementallyLink,
122 LtoRequiresLld,123 LtoRequiresLld,
123 SanitizeThreadRequiresLibCpp,124 SanitizeThreadRequiresLibCpp,
124 LibCppRequiresLibUnwind,125 LibCppRequiresLibUnwind,
...@@ -257,6 +258,11 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -257,6 +258,11 @@ pub fn resolve(options: Options) ResolveError!Config {
257 break :b true;258 break :b true;
258 }259 }
259260
261 if (options.use_llvm == false) {
262 if (options.use_lld == true) return error.LldCannotIncrementallyLink;
263 break :b false;
264 }
265
260 if (options.use_lld) |x| break :b x;266 if (options.use_lld) |x| break :b x;
261 break :b true;267 break :b true;
262 };268 };
src/main.zig+1
...@@ -3949,6 +3949,7 @@ fn createModule(...@@ -3949,6 +3949,7 @@ fn createModule(
3949 error.ZigLacksTargetSupport => fatal("compiler backend unavailable for the specified target", .{}),3949 error.ZigLacksTargetSupport => fatal("compiler backend unavailable for the specified target", .{}),
3950 error.EmittingBinaryRequiresLlvmLibrary => fatal("producing machine code via LLVM requires using the LLVM library", .{}),3950 error.EmittingBinaryRequiresLlvmLibrary => fatal("producing machine code via LLVM requires using the LLVM library", .{}),
3951 error.LldIncompatibleObjectFormat => fatal("using LLD to link {s} files is unsupported", .{@tagName(target.ofmt)}),3951 error.LldIncompatibleObjectFormat => fatal("using LLD to link {s} files is unsupported", .{@tagName(target.ofmt)}),
3952 error.LldCannotIncrementallyLink => fatal("self-hosted backends do not support linking with LLD", .{}),
3952 error.LtoRequiresLld => fatal("LTO requires using LLD", .{}),3953 error.LtoRequiresLld => fatal("LTO requires using LLD", .{}),
3953 error.SanitizeThreadRequiresLibCpp => fatal("thread sanitization is (for now) implemented in C++, so it requires linking libc++", .{}),3954 error.SanitizeThreadRequiresLibCpp => fatal("thread sanitization is (for now) implemented in C++, so it requires linking libc++", .{}),
3954 error.LibCppRequiresLibUnwind => fatal("libc++ requires linking libunwind", .{}),3955 error.LibCppRequiresLibUnwind => fatal("libc++ requires linking libunwind", .{}),