| ... | @@ -161,20 +161,6 @@ pub fn resolve(options: Options) ResolveError!Config { | ... | @@ -161,20 +161,6 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 161 | break :b options.shared_memory orelse false; | 161 | break :b options.shared_memory orelse false; |
| 162 | }; | 162 | }; |
| 163 | | 163 | |
| 164 | const entry: ?[]const u8 = switch (options.entry) { | | |
| 165 | .disabled => null, | | |
| 166 | .default => b: { | | |
| 167 | if (options.output_mode != .Exe) break :b null; | | |
| 168 | break :b target_util.defaultEntrySymbolName(target, wasi_exec_model) orelse | | |
| 169 | return error.UnknownTargetEntryPoint; | | |
| 170 | }, | | |
| 171 | .enabled => target_util.defaultEntrySymbolName(target, wasi_exec_model) orelse | | |
| 172 | return error.UnknownTargetEntryPoint, | | |
| 173 | .named => |name| name, | | |
| 174 | }; | | |
| 175 | if (entry != null and options.output_mode != .Exe) | | |
| 176 | return error.NonExecutableEntryPoint; | | |
| 177 | | | |
| 178 | // *If* the LLVM backend were to be selected, should Zig use the LLVM | 164 | // *If* the LLVM backend were to be selected, should Zig use the LLVM |
| 179 | // library to build the LLVM module? | 165 | // library to build the LLVM module? |
| 180 | const use_lib_llvm = b: { | 166 | const use_lib_llvm = b: { |
| ... | @@ -348,6 +334,29 @@ pub fn resolve(options: Options) ResolveError!Config { | ... | @@ -348,6 +334,29 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 348 | break :b false; | 334 | break :b false; |
| 349 | }; | 335 | }; |
| 350 | | 336 | |
| | 337 | const entry: ?[]const u8 = switch (options.entry) { |
| | 338 | .disabled => null, |
| | 339 | .default => b: { |
| | 340 | if (options.output_mode != .Exe) break :b null; |
| | 341 | |
| | 342 | // When linking libc, the entry point is inside libc and not in the |
| | 343 | // zig compilation unit. |
| | 344 | if (link_libc) break :b null; |
| | 345 | |
| | 346 | // When producing C source code, the decision of entry point is made |
| | 347 | // when compiling the C code, not when producing the C code. |
| | 348 | if (target.ofmt == .c) break :b null; |
| | 349 | |
| | 350 | break :b target_util.defaultEntrySymbolName(target, wasi_exec_model) orelse |
| | 351 | return error.UnknownTargetEntryPoint; |
| | 352 | }, |
| | 353 | .enabled => target_util.defaultEntrySymbolName(target, wasi_exec_model) orelse |
| | 354 | return error.UnknownTargetEntryPoint, |
| | 355 | .named => |name| name, |
| | 356 | }; |
| | 357 | if (entry != null and options.output_mode != .Exe) |
| | 358 | return error.NonExecutableEntryPoint; |
| | 359 | |
| 351 | const any_unwind_tables = options.any_unwind_tables or | 360 | const any_unwind_tables = options.any_unwind_tables or |
| 352 | link_libunwind or target_util.needUnwindTables(target); | 361 | link_libunwind or target_util.needUnwindTables(target); |
| 353 | | 362 | |