| ... | @@ -2836,24 +2836,19 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! | ... | @@ -2836,24 +2836,19 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! |
| 2836 | try argv.append(entry); | 2836 | try argv.append(entry); |
| 2837 | } | 2837 | } |
| 2838 | | 2838 | |
| 2839 | if (self.base.options.output_mode == .Exe) { | 2839 | // Increase the default stack size to a more reasonable value of 1MB instead of |
| 2840 | // Increase the default stack size to a more reasonable value of 1MB instead of | 2840 | // the default of 1 Wasm page being 64KB, unless overridden by the user. |
| 2841 | // the default of 1 Wasm page being 64KB, unless overridden by the user. | 2841 | try argv.append("-z"); |
| 2842 | try argv.append("-z"); | 2842 | const stack_size = self.base.options.stack_size_override orelse wasm.page_size * 16; |
| 2843 | const stack_size = self.base.options.stack_size_override orelse 1048576; | 2843 | const arg = try std.fmt.allocPrint(arena, "stack-size={d}", .{stack_size}); |
| 2844 | const arg = try std.fmt.allocPrint(arena, "stack-size={d}", .{stack_size}); | 2844 | try argv.append(arg); |
| 2845 | try argv.append(arg); | | |
| 2846 | | 2845 | |
| | 2846 | if (self.base.options.output_mode == .Exe) { |
| 2847 | if (self.base.options.wasi_exec_model == .reactor) { | 2847 | if (self.base.options.wasi_exec_model == .reactor) { |
| 2848 | // Reactor execution model does not have _start so lld doesn't look for it. | 2848 | // Reactor execution model does not have _start so lld doesn't look for it. |
| 2849 | try argv.append("--no-entry"); | 2849 | try argv.append("--no-entry"); |
| 2850 | } | 2850 | } |
| 2851 | } else { | 2851 | } else if (self.base.options.entry == null) { |
| 2852 | if (self.base.options.stack_size_override) |stack_size| { | | |
| 2853 | try argv.append("-z"); | | |
| 2854 | const arg = try std.fmt.allocPrint(arena, "stack-size={d}", .{stack_size}); | | |
| 2855 | try argv.append(arg); | | |
| 2856 | } | | |
| 2857 | try argv.append("--no-entry"); // So lld doesn't look for _start. | 2852 | try argv.append("--no-entry"); // So lld doesn't look for _start. |
| 2858 | } | 2853 | } |
| 2859 | try argv.appendSlice(&[_][]const u8{ | 2854 | try argv.appendSlice(&[_][]const u8{ |