apple / swift-system

Low-level system calls and types for Swift
Apache License 2.0
1.18k stars 102 forks source link

Add support for `WASILibc` module #159

Closed MaxDesiatov closed 5 months ago

MaxDesiatov commented 5 months ago

Quoting the wasi.dev landing page:

The WebAssembly System Interface (WASI) is a group of standard API specifications for software compiled to the W3C WebAssembly (Wasm) standard. WASI is designed to provide a secure standard interface for applications that can be compiled to Wasm from any language, and that may run anywhere—from browsers to clouds to embedded devices.

Currently support for WASI in Swift is based on wasi-libc.

Adding support for wasi-libc mostly amounted to excluding unsupported errnos, adding TLS dictionary storage shim for single-threaded environment, and adding constants in C headers for macros that Clang importer currently doesn't support.

MaxDesiatov commented 5 months ago

@swift-ci test

MaxDesiatov commented 5 months ago

Adding CI jobs for WASI is currently blocked by https://github.com/apple/swift/pull/72728.

MaxDesiatov commented 5 months ago

@swift-ci test

MaxDesiatov commented 5 months ago

@swift-ci test

glessard commented 5 months ago

@swift-ci please test

kateinoigakukun commented 5 months ago

@glessard Yes, we have multi-threaded wasi target as a separate triple (wasm32-unknown-wasip1-threads) from the non-threaded one (wasm32-unknown-wasi)

MaxDesiatov commented 5 months ago

LGTM. Do we have multi-threaded wasi support on swift/main?

Yes, but that requires a special Swift SDK to be installed from artifacts built by the SwiftWasm org. There's ongoing work to build that on Swift CI directly in https://github.com/apple/swift/pull/72728.