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

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 @@ -160,8 +160,11 @@ extension WebAssemblyToolchain {
// The value of lowest valid address, called "global base", must be always
// synchronized with `SWIFT_ABI_WASM32_LEAST_VALID_POINTER` defined in
// apple/swift's runtime library.
let SWIFT_ABI_WASM32_LEAST_VALID_POINTER = 4096
commandLine.appendFlag(.Xlinker)
commandLine.appendFlag("--global-base=4096")
commandLine.appendFlag("--global-base=\(SWIFT_ABI_WASM32_LEAST_VALID_POINTER)")
commandLine.appendFlag(.Xlinker)
commandLine.appendFlag("--table-base=\(SWIFT_ABI_WASM32_LEAST_VALID_POINTER)")

// Delegate to Clang for sanitizers. It will figure out the correct linker
// options.
Expand Down
1 change: 1 addition & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2498,6 +2498,7 @@ final class SwiftDriverTests: XCTestCase {
XCTAssertTrue(commandContainsTemporaryResponsePath(cmd, "Test.autolink"))
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(.flag("-O3")))
XCTAssertEqual(linkJob.outputs[0].file, try toPath("Test"))

Expand Down