Skip to content

Commit dbb1cb2

Browse files
Merge pull request #1987 from kateinoigakukun/yt/fix-tagged-funcptr
2 parents 47eabce + ed96649 commit dbb1cb2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Sources/SwiftDriver/Jobs/WebAssemblyToolchain+LinkerSupport.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,11 @@ extension WebAssemblyToolchain {
160160
// The value of lowest valid address, called "global base", must be always
161161
// synchronized with `SWIFT_ABI_WASM32_LEAST_VALID_POINTER` defined in
162162
// apple/swift's runtime library.
163+
let SWIFT_ABI_WASM32_LEAST_VALID_POINTER = 4096
163164
commandLine.appendFlag(.Xlinker)
164-
commandLine.appendFlag("--global-base=4096")
165+
commandLine.appendFlag("--global-base=\(SWIFT_ABI_WASM32_LEAST_VALID_POINTER)")
166+
commandLine.appendFlag(.Xlinker)
167+
commandLine.appendFlag("--table-base=\(SWIFT_ABI_WASM32_LEAST_VALID_POINTER)")
165168

166169
// Delegate to Clang for sanitizers. It will figure out the correct linker
167170
// options.

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,6 +2532,7 @@ final class SwiftDriverTests: XCTestCase {
25322532
XCTAssertTrue(commandContainsTemporaryResponsePath(cmd, "Test.autolink"))
25332533
XCTAssertTrue(cmd.contains(.responseFilePath(.absolute(path.appending(components: "wasi", "static-executable-args.lnk")))))
25342534
XCTAssertTrue(cmd.contains(subsequence: [.flag("-Xlinker"), .flag("--global-base=4096")]))
2535+
XCTAssertTrue(cmd.contains(subsequence: [.flag("-Xlinker"), .flag("--table-base=4096")]))
25352536
XCTAssertTrue(cmd.contains(.flag("-O3")))
25362537
XCTAssertEqual(linkJob.outputs[0].file, try toPath("Test"))
25372538

0 commit comments

Comments
 (0)