authorgravatar for arnaudchesse@outlook.comjohan0A <arnaudchesse@outlook.com> 2026-03-14 21:25:59+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-05-05 17:17:15+02:00
log6a37df00ece82f6c9c73b07a77c22c918fc3257c
tree06b9131cd9487d5a69f134a02309346acdd9c9ea
parent0add2dfc4131c69dbca6866d814eb5538468c0a0

Config.resolve: don't error on explicit dynamic linker for Lib/Obj outputs


2 files changed, 1 insertions(+), 10 deletions(-)

src/Compilation/Config.zig+1-8
...@@ -123,7 +123,6 @@ pub const ResolveError = error{...@@ -123,7 +123,6 @@ pub const ResolveError = error{
123 WasiExecModelRequiresWasi,123 WasiExecModelRequiresWasi,
124 SharedMemoryIsWasmOnly,124 SharedMemoryIsWasmOnly,
125 ObjectFilesCannotShareMemory,125 ObjectFilesCannotShareMemory,
126 ObjectFilesCannotSpecifyDynamicLinker,
127 SharedMemoryRequiresAtomicsAndBulkMemory,126 SharedMemoryRequiresAtomicsAndBulkMemory,
128 ThreadsRequireSharedMemory,127 ThreadsRequireSharedMemory,
129 EmittingLlvmModuleRequiresLlvmBackend,128 EmittingLlvmModuleRequiresLlvmBackend,
...@@ -132,7 +131,6 @@ pub const ResolveError = error{...@@ -132,7 +131,6 @@ pub const ResolveError = error{
132 EmittingBinaryRequiresLlvmLibrary,131 EmittingBinaryRequiresLlvmLibrary,
133 LldIncompatibleObjectFormat,132 LldIncompatibleObjectFormat,
134 LldCannotIncrementallyLink,133 LldCannotIncrementallyLink,
135 LldCannotSpecifyDynamicLinkerForSharedLibraries,
136 LtoRequiresLld,134 LtoRequiresLld,
137 SanitizeThreadRequiresLibCpp,135 SanitizeThreadRequiresLibCpp,
138 LibCRequiresLibUnwind,136 LibCRequiresLibUnwind,
...@@ -421,12 +419,7 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -421,12 +419,7 @@ pub fn resolve(options: Options) ResolveError!Config {
421 // linking to any shared libraries.419 // linking to any shared libraries.
422 if (link_mode == .dynamic) return error.DynamicLinkingWithLldRequiresSharedLibraries;420 if (link_mode == .dynamic) return error.DynamicLinkingWithLldRequiresSharedLibraries;
423 },421 },
424 .Lib => if (use_lld and options.resolved_target.is_explicit_dynamic_linker) {422 .Lib, .Obj => {},
425 return error.LldCannotSpecifyDynamicLinkerForSharedLibraries;
426 },
427 .Obj => if (options.resolved_target.is_explicit_dynamic_linker) {
428 return error.ObjectFilesCannotSpecifyDynamicLinker;
429 },
430 }423 }
431424
432 const use_new_linker = b: {425 const use_new_linker = b: {
src/main.zig-2
...@@ -4144,7 +4144,6 @@ fn createModule(...@@ -4144,7 +4144,6 @@ fn createModule(
4144 error.WasiExecModelRequiresWasi => fatal("only WASI OS targets support execution model", .{}),4144 error.WasiExecModelRequiresWasi => fatal("only WASI OS targets support execution model", .{}),
4145 error.SharedMemoryIsWasmOnly => fatal("only WebAssembly CPU targets support shared memory", .{}),4145 error.SharedMemoryIsWasmOnly => fatal("only WebAssembly CPU targets support shared memory", .{}),
4146 error.ObjectFilesCannotShareMemory => fatal("object files cannot share memory", .{}),4146 error.ObjectFilesCannotShareMemory => fatal("object files cannot share memory", .{}),
4147 error.ObjectFilesCannotSpecifyDynamicLinker => fatal("object files cannot specify --dynamic-linker", .{}),
4148 error.SharedMemoryRequiresAtomicsAndBulkMemory => fatal("shared memory requires atomics and bulk_memory CPU features", .{}),4147 error.SharedMemoryRequiresAtomicsAndBulkMemory => fatal("shared memory requires atomics and bulk_memory CPU features", .{}),
4149 error.ThreadsRequireSharedMemory => fatal("threads require shared memory", .{}),4148 error.ThreadsRequireSharedMemory => fatal("threads require shared memory", .{}),
4150 error.EmittingLlvmModuleRequiresLlvmBackend => fatal("emitting an LLVM module requires using the LLVM backend", .{}),4149 error.EmittingLlvmModuleRequiresLlvmBackend => fatal("emitting an LLVM module requires using the LLVM backend", .{}),
...@@ -4153,7 +4152,6 @@ fn createModule(...@@ -4153,7 +4152,6 @@ fn createModule(
4153 error.EmittingBinaryRequiresLlvmLibrary => fatal("producing machine code via LLVM requires using the LLVM library", .{}),4152 error.EmittingBinaryRequiresLlvmLibrary => fatal("producing machine code via LLVM requires using the LLVM library", .{}),
4154 error.LldIncompatibleObjectFormat => fatal("using LLD to link {s} files is unsupported", .{@tagName(target.ofmt)}),4153 error.LldIncompatibleObjectFormat => fatal("using LLD to link {s} files is unsupported", .{@tagName(target.ofmt)}),
4155 error.LldCannotIncrementallyLink => fatal("self-hosted backends do not support linking with LLD", .{}),4154 error.LldCannotIncrementallyLink => fatal("self-hosted backends do not support linking with LLD", .{}),
4156 error.LldCannotSpecifyDynamicLinkerForSharedLibraries => fatal("LLD does not support --dynamic-linker on shared libraries", .{}),
4157 error.LtoRequiresLld => fatal("LTO requires using LLD", .{}),4155 error.LtoRequiresLld => fatal("LTO requires using LLD", .{}),
4158 error.SanitizeThreadRequiresLibCpp => fatal("thread sanitization is (for now) implemented in C++, so it requires linking libc++", .{}),4156 error.SanitizeThreadRequiresLibCpp => fatal("thread sanitization is (for now) implemented in C++, so it requires linking libc++", .{}),
4159 error.LibCRequiresLibUnwind => fatal("libc of the specified target requires linking libunwind", .{}),4157 error.LibCRequiresLibUnwind => fatal("libc of the specified target requires linking libunwind", .{}),