mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Legacy Driver][wasm] Pass --table-base to reserve low function addresses
WebAssembly does not have a reserved address space by default, so we need to explicitly reserve low addresses for extra inhabitants for enum types with pointer payloads. https://github.com/swiftlang/swift/pull/39300 added `--global-base` to reserve low data addresses, but we also need to reserve low function addresses with `--table-base` for function pointers because WebAssembly uses a separate address space for function pointers.
This commit is contained in:
@@ -194,6 +194,10 @@ toolchains::WebAssembly::constructInvocation(const DynamicLinkJobAction &job,
|
|||||||
Arguments.push_back(context.Args.MakeArgString(
|
Arguments.push_back(context.Args.MakeArgString(
|
||||||
Twine("--global-base=") +
|
Twine("--global-base=") +
|
||||||
std::to_string(SWIFT_ABI_WASM32_LEAST_VALID_POINTER)));
|
std::to_string(SWIFT_ABI_WASM32_LEAST_VALID_POINTER)));
|
||||||
|
Arguments.push_back("-Xlinker");
|
||||||
|
Arguments.push_back(context.Args.MakeArgString(
|
||||||
|
Twine("--table-base=") +
|
||||||
|
std::to_string(SWIFT_ABI_WASM32_LEAST_VALID_POINTER)));
|
||||||
|
|
||||||
// These custom arguments should be right before the object file at the end.
|
// These custom arguments should be right before the object file at the end.
|
||||||
context.Args.AddAllArgs(Arguments, options::OPT_linker_option_Group);
|
context.Args.AddAllArgs(Arguments, options::OPT_linker_option_Group);
|
||||||
|
|||||||
Reference in New Issue
Block a user