Skip to content

Commit

Permalink
add error message for -fno-llvm -flld
Browse files Browse the repository at this point in the history
Zig will never support linking in stage2 with LLD as the self-hosted backends are linker driven.
We plan to remove all dependency on LLD either way, so this will not be a supported usecase.
  • Loading branch information
Rexicon226 committed Apr 29, 2024
1 parent c231d94 commit 688a932
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Compilation/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ pub const ResolveError = error{
ZigLacksTargetSupport,
EmittingBinaryRequiresLlvmLibrary,
LldIncompatibleObjectFormat,
LldIncompatibleWithStage2,
LtoRequiresLld,
SanitizeThreadRequiresLibCpp,
LibCppRequiresLibUnwind,
Expand Down Expand Up @@ -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.LldIncompatibleWithStage2;
break :b false;
}

if (options.use_lld) |x| break :b x;
break :b true;
};
Expand Down
1 change: 1 addition & 0 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3931,6 +3931,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.LldIncompatibleWithStage2 => 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", .{}),
Expand Down

0 comments on commit 688a932

Please sign in to comment.