Skip to content

[WebAssembly] enable shims and stubs for WASI #29505

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

Merged
merged 3 commits into from
Jan 29, 2020

Conversation

MaxDesiatov
Copy link
Contributor

Adds #if defined(__wasi__) in stdlib/public/stubs and implements _swift_stdlib_getUnsafeArgvArgc to fix corresponding code when compiling for WASI.

This is a part of SR-9307 and #24684.

(cc @kateinoigakukun)

@MaxDesiatov MaxDesiatov requested a review from gribozavr January 28, 2020 14:41
@@ -42,6 +42,10 @@
#include "swift/Runtime/Mutex.h"
#include "../SwiftShims/Random.h"

#if defined(__wasi__)
#include <algorithm> // required for std::min
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just make this unconditional. This is inside the implementation, so it is fine.

@@ -511,6 +513,8 @@ void swift::_swift_stdlib_flockfile_stdout() {
void swift::_swift_stdlib_funlockfile_stdout() {
#if defined(_WIN32)
_unlock_file(stdout);
#elif defined(__wasi__)
// WebAssembly/WASI doesn't support file locking yet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a JIRA issue for supporting threading/locking on WASI and reference it here.

@MaxDesiatov MaxDesiatov requested a review from compnerd January 28, 2020 18:30
@compnerd
Copy link
Member

@swift-ci please smoke test

@compnerd compnerd merged commit 44a6475 into swiftlang:master Jan 29, 2020
@MaxDesiatov MaxDesiatov deleted the swiftwasm-shims branch January 29, 2020 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants