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{...@@ -138,6 +138,7 @@ pub const ResolveError = error{
138 LlvmLibraryUnavailable,138 LlvmLibraryUnavailable,
139 LldUnavailable,139 LldUnavailable,
140 ClangUnavailable,140 ClangUnavailable,
141 DllExportFnsRequiresWindows,
141};142};
142143
143pub fn resolve(options: Options) ResolveError!Config {144pub fn resolve(options: Options) ResolveError!Config {
...@@ -459,6 +460,11 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -459,6 +460,11 @@ pub fn resolve(options: Options) ResolveError!Config {
459 const rdynamic = options.rdynamic orelse false;460 const rdynamic = options.rdynamic orelse false;
460461
461 const dll_export_fns = b: {462 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 }
462 if (options.dll_export_fns) |x| break :b x;468 if (options.dll_export_fns) |x| break :b x;
463 if (rdynamic) break :b true;469 if (rdynamic) break :b true;
464 break :b switch (options.output_mode) {470 break :b switch (options.output_mode) {
src/main.zig+3-2
...@@ -3842,8 +3842,8 @@ fn createModule(...@@ -3842,8 +3842,8 @@ fn createModule(
3842 create_module.opts.any_dyn_libs = true;3842 create_module.opts.any_dyn_libs = true;
38433843
3844 create_module.resolved_options = Compilation.Config.resolve(create_module.opts) catch |err| switch (err) {3844 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", .{}),3845 error.WasiExecModelRequiresWasi => fatal("only WASI OS targets support execution model", .{}),
3846 error.SharedMemoryIsWasmOnly => fatal("shared memory only allowed for WebAssembly CPU targets", .{}),3846 error.SharedMemoryIsWasmOnly => fatal("only WebAssembly CPU targets support shared memory", .{}),
3847 error.ObjectFilesCannotShareMemory => fatal("object files cannot share memory", .{}),3847 error.ObjectFilesCannotShareMemory => fatal("object files cannot share memory", .{}),
3848 error.SharedMemoryRequiresAtomicsAndBulkMemory => fatal("shared memory requires atomics and bulk_memory CPU features", .{}),3848 error.SharedMemoryRequiresAtomicsAndBulkMemory => fatal("shared memory requires atomics and bulk_memory CPU features", .{}),
3849 error.ThreadsRequireSharedMemory => fatal("threads require shared memory", .{}),3849 error.ThreadsRequireSharedMemory => fatal("threads require shared memory", .{}),
...@@ -3869,6 +3869,7 @@ fn createModule(...@@ -3869,6 +3869,7 @@ fn createModule(
3869 error.LlvmLibraryUnavailable => fatal("zig was compiled without LLVM libraries", .{}),3869 error.LlvmLibraryUnavailable => fatal("zig was compiled without LLVM libraries", .{}),
3870 error.LldUnavailable => fatal("zig was compiled without LLD libraries", .{}),3870 error.LldUnavailable => fatal("zig was compiled without LLD libraries", .{}),
3871 error.ClangUnavailable => fatal("zig was compiled without Clang libraries", .{}),3871 error.ClangUnavailable => fatal("zig was compiled without Clang libraries", .{}),
3872 error.DllExportFnsRequiresWindows => fatal("only Windows OS targets support DLLs", .{}),
3872 };3873 };
3873 }3874 }
38743875