Skip to content

LLVM 22 support#4937

Open
peter-tatrai wants to merge 2 commits intobytecodealliance:mainfrom
peter-tatrai:llvm-21-22-support
Open

LLVM 22 support#4937
peter-tatrai wants to merge 2 commits intobytecodealliance:mainfrom
peter-tatrai:llvm-21-22-support

Conversation

@peter-tatrai
Copy link
Copy Markdown
Contributor

wffurr and others added 2 commits May 6, 2026 15:34
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+.
@peter-tatrai peter-tatrai force-pushed the llvm-21-22-support branch from 26e31b6 to cc38393 Compare May 6, 2026 13:34
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.

2 participants