Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ extension WebAssemblyToolchain {
commandLine.appendFlag(.Xlinker)
commandLine.appendFlag("--table-base=\(SWIFT_ABI_WASM32_LEAST_VALID_POINTER)")

// Set slightly higher than the default (64K) stack size so that basic
// workflows like Swift Testing can run within this limited stack space.
let SWIFT_WASM_DEFAULT_STACK_SIZE = 1024 * 128
commandLine.appendFlag(.Xlinker)
commandLine.appendFlag("--stack-size=\(SWIFT_WASM_DEFAULT_STACK_SIZE)")

// Delegate to Clang for sanitizers. It will figure out the correct linker
// options.
if linkerOutputType == .executable && !sanitizers.isEmpty {
Expand Down
1 change: 1 addition & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2766,6 +2766,7 @@ final class SwiftDriverTests: XCTestCase {
XCTAssertTrue(cmd.contains(.responseFilePath(.absolute(path.appending(components: "wasi", "static-executable-args.lnk")))))
XCTAssertTrue(cmd.contains(subsequence: [.flag("-Xlinker"), .flag("--global-base=4096")]))
XCTAssertTrue(cmd.contains(subsequence: [.flag("-Xlinker"), .flag("--table-base=4096")]))
XCTAssertTrue(cmd.contains(subsequence: [.flag("-Xlinker"), .flag("--stack-size=\(128 * 1024)")]))
XCTAssertTrue(cmd.contains(.flag("-O3")))
XCTAssertEqual(linkJob.outputs[0].file, try toPath("Test"))

Expand Down
Loading