Skip to content

Update to LLVM 16#293

Closed
abrown wants to merge 5 commits intoWebAssembly:mainfrom
abrown:threads-prerelease
Closed

Update to LLVM 16#293
abrown wants to merge 5 commits intoWebAssembly:mainfrom
abrown:threads-prerelease

Conversation

@abrown
Copy link
Collaborator

@abrown abrown commented Feb 7, 2023

This change updates the src/llvm-project submodule to LLVM 16. It uses the same commit as the one in LLVM's own 16.0.0-rc1 pre-release. It also updates the src/wasi-libc submodule with some recent commits, WebAssembly/wasi-libc#388 and WebAssembly/wasi-libc#391, that seem useful to have.

This brings in two recent commits, WebAssembly/wasi-libc#388 and
WebAssembly/wasi-libc#391, that seem useful to have.
This change updates the `src/llvm-project` submodule to LLVM 16. It uses the same commit as the one in LLVM's own 16.0.0-rc1 [pre-release].

[pre-release]: https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.0-rc1
@sbc100
Copy link
Member

sbc100 commented Feb 7, 2023

Are we sure we want to use a pre-release here? Is that something we have done before?

@abrown
Copy link
Collaborator Author

abrown commented Feb 7, 2023

The point of this PR is to prepare a pre-release that has the needed LLVM 16 features and support for the new wasm32-wasi-threads target; the idea is to give users of wasi-threads a toolchain to experiment without immediately guaranteeing full, bug-free support. I eventually plan to pre-release this stuff as wasi-sdk-20+threads; if all goes well, then we could add the wasm32-wasi-threads target in by default in the official wasi-sdk-20 release (and use the official LLVM 16 tag once that is available).

If you don't think we should update to LLVM's 16.0.0-rc1 pre-release in wasi-sdk's main branch, these changes could all go in some other branch. The important thing is that I need to be able to get the CI-produced artifacts in order to draft the pre-release.

@sbc100
Copy link
Member

sbc100 commented Feb 7, 2023

Landing on a branch until the official release sgtm.

@TerrorJack
Copy link
Contributor

TerrorJack commented Feb 8, 2023

I tried bumping LLVM to 16.0.0-rc2 in wasi-sdk, and get this error when calling clang to compile & link:

wasm-ld: error: cannot open /workspace/wasi-sdk/build/install/opt/wasi-sdk/lib/clang/16/lib/wasi/libclang_rt.builtins-wasm32.a: No such file or directory

libclang_rt.builtins-wasm32.a has been installed to build/install/opt/wasi-sdk/lib/clang/16.0.0/lib/wasi/libclang_rt.builtins-wasm32.a instead, and the 16.0.0 part is produced by llvm_version.sh in Makefile. Has something in the LLVM tree changed in 16 that makes clang look into 16 instead?

EDIT: the same errors have been reproduced by CI on this branch.

EDIT: ah I see, https://reviews.llvm.org/D125860. so it's expected behavior. the wasi-sdk Makefile should be patched to correct the install prefix of clang_rt to only use major version number.

Due to [a change] in LLVM, Clang will expect to find the
`libclang_rt.builtins-wasm32.a` file in a path that only contains the
major version (`16`) instead of the entire version (`16.0.0`) as was
previously the case. This change modifies the `CMAKE_INSTALL_PREFIX` to
use Clang's major version only.

[a change]: https://reviews.llvm.org/D125860
While this branch was building, LLVM pre-released [rc2]. This commit
tries that out.

[rc2]: https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.0-rc2
-DLLVM_CONFIG_PATH=$(ROOT_DIR)/build/llvm/bin/llvm-config \
-DCOMPILER_RT_OS_DIR=wasi \
-DCMAKE_INSTALL_PREFIX=$(PREFIX)/lib/clang/$(CLANG_VERSION)/ \
-DCMAKE_INSTALL_PREFIX=$(PREFIX)/lib/clang/$(CLANG_MAJOR_VERSION)/ \
Copy link
Contributor

Choose a reason for hiding this comment

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

i suppose you can use clang -print-resource-dir

@abrown
Copy link
Collaborator Author

abrown commented Feb 14, 2023

Closing, this is superceded by #296.

@abrown abrown closed this Feb 14, 2023
@abrown abrown deleted the threads-prerelease branch February 14, 2023 01:35
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