Skip to content
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

Force ASM compiler to target the same triple as C, in WASI build #83787

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

directhex
Copy link
Contributor

The upstream WASI SDK sets a default compiler triple of --target=wasm32-wasi. We don't, because we're compiling our for-WASI-use version of Clang as part of our more general LLVM, and as such, the default compiler triple is the LLVM default (i.e. linux-x64 on x64 Linux, etc).

In one place, we compile an Assembly file using Clang by setting CMAKE_ASM_COMPILER_VERSION = CMAKE_ASM_COMPILER_VERSION - but whilst CMAKE_C_COMPILER_TARGET is overridden to always be wasm32-wasi in the wasi-sdk.cmake toolchain file, the toolchain file does not set CMAKE_ASM_COMPILER_TARGET (and thus, when compiling Assembly, our Clang default to linux-x64 etc, not wasm32-wasi). Therefore, force the issue here in our CMakeLists.txt, so we use the correct compiler target.

The upstream WASI SDK sets a default compiler triple of `--target=wasm32-wasi`. We don't, because we're compiling our for-WASI-use version of Clang as part of our more general LLVM, and as such, the default compiler triple is the LLVM default (i.e. linux-x64 on x64 Linux, etc).

In one place, we compile an Assembly file using Clang by setting CMAKE_ASM_COMPILER_VERSION = CMAKE_ASM_COMPILER_VERSION - but whilst CMAKE_C_COMPILER_TARGET is overridden to always be wasm32-wasi in the wasi-sdk.cmake toolchain file, the toolchain file does not set CMAKE_ASM_COMPILER_TARGET (and thus, when compiling Assembly, our Clang default to linux-x64 etc, not wasm32-wasi). Therefore, force the issue here in our CMakeLists.txt, so we use the correct compiler target.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants