-
Notifications
You must be signed in to change notification settings - Fork 3
Clang compilation #187
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
Open
Yaxuan-w
wants to merge
17
commits into
main
Choose a base branch
from
clang-compile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Clang compilation #187
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0136806
Cross-compile clang and lld to wasm32-wasi
rennergade e974dc9
update atomics
rennergade e55dcbc
update atomics
rennergade 8b02087
fix deps
rennergade b758135
fix deps
rennergade da73911
fix deps
rennergade b60b3d0
fix deps
rennergade a0c84f5
fix deps
rennergade fb714e5
fix deps
rennergade 698a5e0
fix deps
rennergade 25b1391
fix deps
rennergade 06b1633
fix deps
rennergade ec837de
fix staging/stacksize
rennergade 14339d9
rm sigstack fixes
rennergade f8c8e1c
debug info
rennergade ff0e5fe
Update clang scripts
Yaxuan-w 17c46cc
Merge branch 'main' into clang-compile
Yaxuan-w File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Auto-generated CMake toolchain for cross-compiling LLVM to wasm32-wasi | ||
| set(CMAKE_SYSTEM_NAME Linux) | ||
| set(CMAKE_SYSTEM_PROCESSOR wasm32) | ||
|
|
||
| # Compiler and tools | ||
| set(CMAKE_C_COMPILER "@CLANG@") | ||
| set(CMAKE_CXX_COMPILER "@CLANGXX@") | ||
| set(CMAKE_AR "@AR@") | ||
| set(CMAKE_NM "@NM@") | ||
| set(CMAKE_RANLIB "@RANLIB@") | ||
| set(CMAKE_SYSROOT "@BASE_SYSROOT@") | ||
| set(CMAKE_LINKER "@LD@") | ||
|
|
||
| # Target configuration | ||
| set(CMAKE_C_COMPILER_TARGET wasm32-unknown-wasi) | ||
| set(CMAKE_CXX_COMPILER_TARGET wasm32-unknown-wasi) | ||
|
|
||
| # Force CMake to accept compilers without try-run (can't run wasm on host) | ||
| set(CMAKE_C_COMPILER_WORKS TRUE) | ||
| set(CMAKE_CXX_COMPILER_WORKS TRUE) | ||
| set(CMAKE_EXECUTABLE_SUFFIX ".wasm") | ||
|
|
||
| # WASM C flags — use -Os to minimize binary size (clang is huge) | ||
| # Use CACHE FORCE so nothing can override these (not even a stale CMakeCache) | ||
| # WASI uses glibc headers — define __linux__ so LLVM uses <endian.h>, | ||
| # Linux-style struct fields, etc. (WASI is not Linux, but its glibc | ||
| # sysroot matches the Linux ABI for these purposes.) | ||
| set(CMAKE_C_FLAGS "-Os -pthread -matomics -mbulk-memory -fno-exceptions -fno-unwind-tables -D__linux__" CACHE STRING "" FORCE) | ||
|
|
||
| # WASM C++ flags — use libc++, no exceptions/RTTI/unwind to reduce binary size | ||
| set(CMAKE_CXX_FLAGS "-Os -pthread -matomics -mbulk-memory -fno-exceptions -fno-unwind-tables -fno-rtti -D__linux__ -nostdinc++ -isystem $LIBCXX_INCLUDE -include $SCRIPT_DIR/fix_std_maxmin.h" CACHE STRING "" FORCE) | ||
|
|
||
| # Linker flags | ||
| set(CMAKE_EXE_LINKER_FLAGS "\ | ||
| -L$MERGED_SYSROOT/lib/wasm32-wasi \ | ||
| -L$MERGED_SYSROOT/usr/lib/wasm32-wasi \ | ||
| -Wl,--export=__stack_pointer,--export=__stack_low \ | ||
| -Wl,--import-memory,--export-memory \ | ||
| -Wl,--max-memory=67108864 \ | ||
| -lm " CACHE STRING "" FORCE) | ||
|
|
||
| # Don't pass -rpath to the linker | ||
| set(CMAKE_SKIP_RPATH TRUE) | ||
| set(CMAKE_SKIP_INSTALL_RPATH TRUE) | ||
| set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||
| set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) | ||
|
|
||
| # Prevent try-run errors | ||
| set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) | ||
|
|
||
| # Skip old toolchain warnings | ||
| set(LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN ON CACHE BOOL "" FORCE) | ||
|
|
||
| set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this different from the other cmake file thats in the llvm repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
different from another one. This one has additional flags (ie:
-D_linux)