Skip to content

[wasm] Split wasi-sysroot for wasi and wasip1-threads #73077

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

Conversation

kateinoigakukun
Copy link
Member

libclang_rt.builtins library is placed in the clang resource directory per OS and architecture, so "environment" field is not used to find the library (except for android). wasi and wasip1-threads require different target features, so we need to split wasi-sysroot for them.

Before

wasi-sysroot
├── include
├── lib
│   ├── wasi
│   │   └── libclang_rt.builtins-wasm32.a
│   ├── wasm32-wasi
│   │   ├── ...
│   │   └── libc.a
│   ├── wasip1
│   │   └── libclang_rt.builtins-wasm32.a
│   └── wasm32-wasip1-threads
│       ├── ...
│       └── libc.a
└── share

After

wasi-sysroot
├── wasm32-wasi
│   ├── include
│   ├── lib
│   │   ├── wasi ---------- (will be renamed to wasip1)
│   │   │   └── libclang_rt.builtins-wasm32.a
│   │   └── wasm32-wasi --- (will be renamed to wasm32-wasip1)
│   │       ├── ...
│   │       └── libc.a
│   └── share
└── wasm32-wasip1-threads
    ├── include
    ├── lib
    │   ├── wasip1
    │   │   └── libclang_rt.builtins-wasm32.a
    │   └── wasm32-wasip1-threads
    │       ├── ...
    │       └── libc.a
    └── share

@kateinoigakukun
Copy link
Member Author

@swift-ci test WebAssembly

kateinoigakukun added a commit to swiftwasm/swiftwasm-build that referenced this pull request Apr 17, 2024
`compiler-rt/lib/builtins/atomic.c` has to be built with atomics feature
enabled for wasip1-threads target. We had been sharing the same
libclang_rt.builtins.a for both wasi and wasip1-threads targets, but
enabling atomics feature breaks non-threaded wasi target due to
unnecessary feature dependencies.
swiftlang/swift#73077 will build libclang_rt.builtins.a
separately and install wasi-sysroot under different directories for each
target.
@kateinoigakukun
Copy link
Member Author

@swift-ci smoke test

libclang_rt.builtins library is placed in the clang resource directory
per OS and architecture, so "environment" field is not used to find the
library (except for android). wasi and wasip1-threads require different
target features, so we need to split wasi-sysroot for them.

Before
```
wasi-sysroot
├── include
├── lib
│   ├── wasi
│   │   └── libclang_rt.builtins-wasm32.a
│   ├── wasm32-wasi
│   │   ├── ...
│   │   └── libc.a
│   ├── wasip1
│   │   └── libclang_rt.builtins-wasm32.a
│   └── wasm32-wasip1-threads
│       ├── ...
│       └── libc.a
└── share
```

After
```
wasi-sysroot
├── wasm32-wasi
│   ├── include
│   ├── lib
│   │   ├── wasi ---------- (will be renamed to wasip1)
│   │   │   └── libclang_rt.builtins-wasm32.a
│   │   └── wasm32-wasi --- (will be renamed to wasm32-wasip1)
│   │       ├── ...
│   │       └── libc.a
│   └── share
└── wasm32-wasip1-threads
    ├── include
    ├── lib
    │   ├── wasip1
    │   │   └── libclang_rt.builtins-wasm32.a
    │   └── wasm32-wasip1-threads
    │       ├── ...
    │       └── libc.a
    └── share
```
@kateinoigakukun kateinoigakukun force-pushed the yt/split-wasi-sysroot-for-targets branch from 4c9cbdb to 1136d50 Compare April 17, 2024 17:45
@kateinoigakukun
Copy link
Member Author

@swift-ci smoke test

@kateinoigakukun kateinoigakukun marked this pull request as ready for review April 17, 2024 17:46
@kateinoigakukun kateinoigakukun merged commit e20e1c6 into swiftlang:main Apr 17, 2024
kateinoigakukun added a commit to swiftwasm/swiftwasm-build that referenced this pull request Apr 18, 2024
`compiler-rt/lib/builtins/atomic.c` has to be built with atomics feature
enabled for wasip1-threads target. We had been sharing the same
libclang_rt.builtins.a for both wasi and wasip1-threads targets, but
enabling atomics feature breaks non-threaded wasi target due to
unnecessary feature dependencies.
swiftlang/swift#73077 will build libclang_rt.builtins.a
separately and install wasi-sysroot under different directories for each
target.
kateinoigakukun added a commit to swiftwasm/swiftwasm-build that referenced this pull request Apr 23, 2024
`compiler-rt/lib/builtins/atomic.c` has to be built with atomics feature
enabled for wasip1-threads target. We had been sharing the same
libclang_rt.builtins.a for both wasi and wasip1-threads targets, but
enabling atomics feature breaks non-threaded wasi target due to
unnecessary feature dependencies.
swiftlang/swift#73077 will build libclang_rt.builtins.a
separately and install wasi-sysroot under different directories for each
target.
kateinoigakukun added a commit to swiftwasm/swiftwasm-build that referenced this pull request Apr 25, 2024
`compiler-rt/lib/builtins/atomic.c` has to be built with atomics feature
enabled for wasip1-threads target. We had been sharing the same
libclang_rt.builtins.a for both wasi and wasip1-threads targets, but
enabling atomics feature breaks non-threaded wasi target due to
unnecessary feature dependencies.
swiftlang/swift#73077 will build libclang_rt.builtins.a
separately and install wasi-sysroot under different directories for each
target.
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.

1 participant