authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-27 13:20:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 19:49:07-07:00
log791e83c22396e029e0f2bc19b75fd86f8cd7851f
tree674d129710f6920bcfb81b345b283723b0d9ee99
parent476484f09c98a3a49e0a6be3b92d563ad362ee04

frontend: make dll_export_fns=false on non-windows

Fixes a regression introduced in this branch.

2 files changed, 9 insertions(+), 2 deletions(-)

src/Compilation/Config.zig+6
......@@ -138,6 +138,7 @@ pub const ResolveError = error{
138138 LlvmLibraryUnavailable,
139139 LldUnavailable,
140140 ClangUnavailable,
141 DllExportFnsRequiresWindows,
141142};
142143
143144pub fn resolve(options: Options) ResolveError!Config {
......@@ -459,6 +460,11 @@ pub fn resolve(options: Options) ResolveError!Config {
459460 const rdynamic = options.rdynamic orelse false;
460461
461462 const dll_export_fns = b: {
463 if (target.os.tag != .windows) {
464 if (options.dll_export_fns == true)
465 return error.DllExportFnsRequiresWindows;
466 break :b false;
467 }
462468 if (options.dll_export_fns) |x| break :b x;
463469 if (rdynamic) break :b true;
464470 break :b switch (options.output_mode) {
src/main.zig+3-2
......@@ -3842,8 +3842,8 @@ fn createModule(
38423842 create_module.opts.any_dyn_libs = true;
38433843
38443844 create_module.resolved_options = Compilation.Config.resolve(create_module.opts) catch |err| switch (err) {
3845 error.WasiExecModelRequiresWasi => fatal("execution model only allowed for WASI OS targets", .{}),
3846 error.SharedMemoryIsWasmOnly => fatal("shared memory only allowed for WebAssembly CPU targets", .{}),
3845 error.WasiExecModelRequiresWasi => fatal("only WASI OS targets support execution model", .{}),
3846 error.SharedMemoryIsWasmOnly => fatal("only WebAssembly CPU targets support shared memory", .{}),
38473847 error.ObjectFilesCannotShareMemory => fatal("object files cannot share memory", .{}),
38483848 error.SharedMemoryRequiresAtomicsAndBulkMemory => fatal("shared memory requires atomics and bulk_memory CPU features", .{}),
38493849 error.ThreadsRequireSharedMemory => fatal("threads require shared memory", .{}),
......@@ -3869,6 +3869,7 @@ fn createModule(
38693869 error.LlvmLibraryUnavailable => fatal("zig was compiled without LLVM libraries", .{}),
38703870 error.LldUnavailable => fatal("zig was compiled without LLD libraries", .{}),
38713871 error.ClangUnavailable => fatal("zig was compiled without Clang libraries", .{}),
3872 error.DllExportFnsRequiresWindows => fatal("only Windows OS targets support DLLs", .{}),
38723873 };
38733874 }
38743875