-
Notifications
You must be signed in to change notification settings - Fork 35
[wip] Add llvm 21 support #672
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
mcbarton
wants to merge
21
commits into
compiler-research:main
Choose a base branch
from
mcbarton:Add-llvm-21-support
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
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
af6b0fc
Make CppInterOp llvm 21 compatible
mcbarton 3d74a26
Update Windows-emscripten-clang21-1-CrossCompile.patch
mcbarton aef6370
Update exports.ld
mcbarton 2a280d1
Update exports.ld
mcbarton 8c81b18
Merge branch 'main' into Add-llvm-21-support
mcbarton bbd2a48
Define Print_Canonical_Types for llvm 21 compatibility
mcbarton f8c7163
Merge branch 'main' into Add-llvm-21-support
mcbarton 68a3695
Make CppInterOp llvm 21 compatible
mcbarton a6919e7
Update Windows-emscripten-clang21-1-CrossCompile.patch
mcbarton a4801b4
Update exports.ld
mcbarton 113b7a6
Update exports.ld
mcbarton ed5b80c
Define Print_Canonical_Types for llvm 21 compatibility
mcbarton 19e1951
fix instantiation of templated class
Vipul-Cariappa eaf352c
fix instantiation of templated class
Vipul-Cariappa 71f02da
Merge branch 'Add-llvm-21-support' into mcbarton/Add-llvm-21-support
Vipul-Cariappa a884dee
Merge pull request #1 from Vipul-Cariappa/mcbarton/Add-llvm-21-support
mcbarton c6fb53f
Merge branch 'main' into Add-llvm-21-support
mcbarton bbbf6d0
Apply some PR comments
mcbarton c97eb37
Updat 1.x to 21.x readme.md
mcbarton 541711e
Update rest of docs for llvm 21
mcbarton 7e1bd6e
Merge branch 'main' into Add-llvm-21-support
mcbarton 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
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
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
20 changes: 20 additions & 0 deletions
20
patches/llvm/Windows-emscripten-clang21-1-CrossCompile.patch
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,20 @@ | ||
diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake | ||
index 39b4abaa0..474ceddbb 100644 | ||
--- a/llvm/cmake/modules/CrossCompile.cmake | ||
+++ b/llvm/cmake/modules/CrossCompile.cmake | ||
@@ -74,10 +74,12 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) | ||
endif() | ||
|
||
add_custom_command(OUTPUT ${${project_name}_${target_name}_BUILD}/CMakeCache.txt | ||
- COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" | ||
+ COMMAND ${CMAKE_COMMAND} -G Ninja | ||
"-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}" | ||
- "-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}" | ||
- "-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}" | ||
+ -DCMAKE_C_COMPILER="clang-cl" | ||
+ -DCMAKE_CXX_COMPILER="clang-cl" | ||
+ -DCMAKE_ASM_MASM_COMPILER=llvm-ml | ||
+ -DCMAKE_ASM_MASM_FLAGS="-m64" | ||
${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_CURRENT_SOURCE_DIR} | ||
${CROSS_TOOLCHAIN_FLAGS_${project_name}_${target_name}} | ||
-DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE |
15 changes: 15 additions & 0 deletions
15
patches/llvm/emscripten-clang21-2-shift-temporary-files-to-tmp-dir.patch
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,15 @@ | ||
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp | ||
index aa10b160ccf8..184867e2b55f 100644 | ||
--- a/clang/lib/Interpreter/Wasm.cpp | ||
+++ b/clang/lib/Interpreter/Wasm.cpp | ||
@@ -76,8 +76,8 @@ llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) { | ||
llvm::TargetMachine *TargetMachine = Target->createTargetMachine( | ||
PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_); | ||
PTU.TheModule->setDataLayout(TargetMachine->createDataLayout()); | ||
- std::string ObjectFileName = PTU.TheModule->getName().str() + ".o"; | ||
- std::string BinaryFileName = PTU.TheModule->getName().str() + ".wasm"; | ||
+ std::string ObjectFileName = "/tmp/" + PTU.TheModule->getName().str() + ".o"; | ||
+ std::string BinaryFileName = "/tmp/" + PTU.TheModule->getName().str() + ".wasm"; | ||
|
||
std::error_code Error; | ||
llvm::raw_fd_ostream ObjectFileOutput(llvm::StringRef(ObjectFileName), Error); |
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
This patch needs removing now since we no longer need it. The other llvm patch is one we have used for Emscripten builds for both llvm 19 and 20 (it isn't needed for functionality, but helps the xeus-cpp deployment have a clear folder when executing cells). I think we also need to add the exception handling patch to this PR too, so that the deployment will work correctly.