Skip to content

Update wasi-sysroot version from 14 to 16 #5127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 3 additions & 1 deletion include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ namespace swift {
llvm::VersionTuple MinimumInliningTargetVersion;

/// The alternate name to use for the entry point instead of main.
std::string entryPointFunctionName = "main";
/// A value of 'None' means the default entry point name (usually main)
/// should be used.
Optional<std::string> entryPointFunctionName;

///
/// Language features
Expand Down
14 changes: 13 additions & 1 deletion lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5811,7 +5811,19 @@ ASTContext::SILTransformCtors ASTContext::getIRGenSILTransforms() const {
}

std::string ASTContext::getEntryPointFunctionName() const {
return LangOpts.entryPointFunctionName;
// If -entry-point-function-name was specified, use that.
if (auto entryPointName = LangOpts.entryPointFunctionName)
return entryPointName.getValue();

// Otherwise, use the platform-specific default entry point name.
switch (LangOpts.Target.getArch()) {
case llvm::Triple::wasm32:
// The WebAssembly entry point with argc/argv is distinguished from `int main(void)` by name
// https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md#user-entrypoint
return "__main_argc_argv";
default:
return "main";
}
}

SILLayout *SILLayout::get(ASTContext &C,
Expand Down
4 changes: 1 addition & 3 deletions utils/webassembly/install-build-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -eux

SOURCE_PATH="$( cd "$(dirname "$0")/../../../" && pwd )"
BUILD_SDK_PATH="$SOURCE_PATH/build-sdk"
PATCHES="$(cd "$(dirname "$0")/patches" && pwd)"

install_libxml2() {
LIBXML2_URL="https://github.com/swiftwasm/libxml2-wasm/releases/download/1.0.0/libxml2-wasm32-unknown-wasi.tar.gz"
Expand All @@ -21,12 +20,11 @@ install_icu() {
}

install_wasi-sysroot() {
WASI_SYSROOT_URL="https://github.com/swiftwasm/wasi-sdk-build/releases/download/wasi-sdk-14%2Bswiftwasm-2022-03-13/wasi-sysroot.tar.gz"
WASI_SYSROOT_URL="https://github.com/swiftwasm/wasi-sdk-build/releases/download/wasi-sdk-16%2Bswiftwasm-2023-01-03/wasi-sysroot.tar.gz"

curl -L "$WASI_SYSROOT_URL" | tar xz

mv "wasi-sysroot" "$BUILD_SDK_PATH/wasi-sysroot"
patch -p1 -d "$BUILD_SDK_PATH/wasi-sysroot" < "$PATCHES/wasi-sysroot"/*.patch
}

workdir=$(mktemp -d)
Expand Down

This file was deleted.