Skip to content

Conversation

@kateinoigakukun
Copy link
Contributor

This change allows us to have per-target libclang_rt.* libraries instead of per-OS. This is particularly required for w/threads and wo/threads targets, whose rt libraries could be incompatible even with the same OS string.

This change starts building compiler-rt for w/threads and wo/threads separately, so that we can enable thread-related features for p1-threads target for building upcoming ASan clang_rt libraries. Also COMPILER_RT_OS_DIR is not set anymore as it's unused when LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is enabled.

@alexcrichton
Copy link
Collaborator

I think this may need updating too but otherwise seems resonable to me 👍, thanks!

wasi_sdk_add_tarball(dist-compiler-rt
${dist_dir}/libclang_rt.builtins-wasm32-wasi-${wasi_sdk_version}.tar.gz
${wasi_resource_dir}/lib/wasi)
${wasi_resource_dir}/lib/wasm32-unknown-wasi)
Copy link
Member

Choose a reason for hiding this comment

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

Is it normall for the target to appear both in the directory name ${wasi_resource_dir}/lib/wasm32-unknown-wasi and in the library name libclang_rt.builtins-wasm32-wasi? It seems somewhat redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, updated to archive the whole lib directory of the resource dir to include rt libraries for all targets

@kateinoigakukun kateinoigakukun force-pushed the yt/enable-per-target-resource-dir branch 3 times, most recently from 48ab22f to b9ed916 Compare June 12, 2025 07:15
@kateinoigakukun kateinoigakukun requested a review from sbc100 June 12, 2025 14:07
${clang_resource_dir}/include ${wasi_resource_dir}/include

# Copy the `lib/wasi` folder to `libc/wasi{p1,p2}` to ensure that those
# Copy the `lib/wasm32-unknown-wasi` folder to `libc/wasm32-unknown-wasi{p1,p2}` to ensure that those
Copy link
Member

Choose a reason for hiding this comment

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

Should libc here be just lib? Maybe a pre-existing typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

This change allows us to have per-target libclang_rt.* libraries instead
of per-OS. This is particularly required for w/threads and wo/threads
targets, whose rt libraries could be incompatible even with the same OS
string.

This change starts building `compiler-rt` for w/threads and wo/threads
separately, so that we can enable thread-related features for p1-threads
target for building upcoming ASan clang_rt libraries.
Also `COMPILER_RT_OS_DIR` is not set anymore as it's unused when
`LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` is enabled.
@kateinoigakukun kateinoigakukun force-pushed the yt/enable-per-target-resource-dir branch from b9ed916 to e4af2b7 Compare June 12, 2025 15:47
Copy link
Collaborator

@abrown abrown left a comment

Choose a reason for hiding this comment

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

Nice!

@abrown abrown merged commit fcc3b75 into WebAssembly:main Jun 12, 2025
9 checks passed
@yamt yamt mentioned this pull request Jul 2, 2025
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.

4 participants