LLVM 22 support#4937
Open
peter-tatrai wants to merge 2 commits intobytecodealliance:mainfrom
Open
Conversation
Contributor
peter-tatrai
commented
May 6, 2026
- adds compatibility with LLVM 22.x
- based on Update LLVM to 21.1.2. #4654
LLVM 21 makes a breaking change in LLVMContext construction: LLVMOrcCreateNewThreadSafeContext() no longer creates an implicit LLVMContext. Instead, a context must be constructed first and then wrapped in a ThreadSafeContext using the new LLVMOrcCreateNewThreadSafeContextFromLLVMContext() API. WAMR still needs to support older LLVM versions (e.g. for xtensa/esp32 support which is only available in at most LLVM 19), so the new code path is guarded with LLVM_VERSION_MAJOR >= 21. Co-authored-by: Peter Tatrai <peter.tatrai.ext@siemens.com> Ref: bytecodealliance#4654
LLVM 22 removes the IntrusiveRefCntPtr<vfs::FileSystem> parameter from the PGOOptions constructor. The VFS was moved to PassBuilder directly (see llvm/llvm-project#160188), allowing all passes that need filesystem access to get it from PassBuilder rather than routing it through PGOOptions. Add LLVM_VERSION_MAJOR version guards to retain the FS argument for LLVM 17-21 while dropping it for LLVM 22+.
26e31b6 to
cc38393
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.