Compilation.Config.resolve: explicit error set
Some logic has comptime-known conditions, causing the inferred error set to be different on different compiler build configurations.
This commit is contained in:
@@ -99,7 +99,39 @@ pub const Options = struct {
|
||||
rdynamic: ?bool = null,
|
||||
};
|
||||
|
||||
pub fn resolve(options: Options) !Config {
|
||||
pub const ResolveError = error{
|
||||
WasiExecModelRequiresWasi,
|
||||
SharedMemoryIsWasmOnly,
|
||||
ObjectFilesCannotShareMemory,
|
||||
SharedMemoryRequiresAtomicsAndBulkMemory,
|
||||
ThreadsRequireSharedMemory,
|
||||
UnknownTargetEntryPoint,
|
||||
NonExecutableEntryPoint,
|
||||
EmittingLlvmModuleRequiresLlvmBackend,
|
||||
LlvmLacksTargetSupport,
|
||||
ZigLacksTargetSupport,
|
||||
EmittingBinaryRequiresLlvmLibrary,
|
||||
LldIncompatibleObjectFormat,
|
||||
LtoRequiresLld,
|
||||
SanitizeThreadRequiresLibCpp,
|
||||
LibCppRequiresLibUnwind,
|
||||
OsRequiresLibC,
|
||||
LibCppRequiresLibC,
|
||||
LibUnwindRequiresLibC,
|
||||
TargetCannotDynamicLink,
|
||||
LibCRequiresDynamicLinking,
|
||||
SharedLibrariesRequireDynamicLinking,
|
||||
ExportMemoryAndDynamicIncompatible,
|
||||
DynamicLibraryPrecludesPie,
|
||||
TargetRequiresPie,
|
||||
SanitizeThreadRequiresPie,
|
||||
BackendLacksErrorTracing,
|
||||
LlvmLibraryUnavailable,
|
||||
LldUnavailable,
|
||||
ClangUnavailable,
|
||||
};
|
||||
|
||||
pub fn resolve(options: Options) ResolveError!Config {
|
||||
const target = options.resolved_target.result;
|
||||
|
||||
// WASI-only. Resolve the optional exec-model option, defaults to command.
|
||||
|
||||
@@ -3867,6 +3867,9 @@ fn createModule(
|
||||
error.TargetRequiresPie => fatal("the specified target requires position independent executables", .{}),
|
||||
error.SanitizeThreadRequiresPie => fatal("thread sanitization requires position independent executables", .{}),
|
||||
error.BackendLacksErrorTracing => fatal("the selected backend has not yet implemented error return tracing", .{}),
|
||||
error.LlvmLibraryUnavailable => fatal("zig was compiled without LLVM libraries", .{}),
|
||||
error.LldUnavailable => fatal("zig was compiled without LLD libraries", .{}),
|
||||
error.ClangUnavailable => fatal("zig was compiled without Clang libraries", .{}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user