Skip to content

LLVM21 support#149

Open
gast04 wants to merge 1 commit into
open-obfuscator:mainfrom
gast04:main
Open

LLVM21 support#149
gast04 wants to merge 1 commit into
open-obfuscator:mainfrom
gast04:main

Conversation

@gast04
Copy link
Copy Markdown

@gast04 gast04 commented Apr 21, 2026

Not sure if needed but these would be the required API changes for LLVM 21 support, to support Xcode 26.4 and up.
Tested with llvm/llvm-project Tag 21.1.8

@alexland7219
Copy link
Copy Markdown
Collaborator

@gast04 Thank you so much for your contribution. We indeed were about to start working on supporting Xcode 26.4. Soon we are going to review your contribution

Comment thread src/CMakeLists.txt

if(OMVLL_ABI STREQUAL "Apple")
set(LLVM_REQUIRED_VERSION 19.1.4)
set(LLVM_REQUIRED_VERSION 21.1.8)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the generated deps are going to be using 21.1.6, we would prefer if LLVM_REQUIRED_VERSION was set to 21.1.6

@@ -637,7 +637,8 @@ bool StringEncoding::processGlobal(Use &Op, GlobalVariable &G,
/* no var args */ false);

#if LLVM_VERSION_MAJOR > 18
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if LLVM_VERSION_MAJOR > 18
#if LLVM_VERSION_MAJOR >= 20

In theory unnecessary since NDK version is still at 17 but helps us

return PreservedAnalyses::all();

JIT = std::make_unique<Jitter>(M.getTargetTriple());
JIT = std::make_unique<Jitter>(M.getTargetTriple().str());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a preprocessor conditional so NDK still compiles

Suggested change
JIT = std::make_unique<Jitter>(M.getTargetTriple().str());
#if LLVM_VERSION_MAJOR >= 20
JIT = std::make_unique<Jitter>(M.getTargetTriple().str());
#else
JIT = std::make_unique<Jitter>(M.getTargetTriple());
#endif

PyConfig &Config = PyConfig::instance();
SINFO("[{}] Executing on module {}", name(), M.getName());
JIT = std::make_unique<Jitter>(M.getTargetTriple());
JIT = std::make_unique<Jitter>(M.getTargetTriple().str());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a preprocessor conditional so NDK still compiles

Suggested change
JIT = std::make_unique<Jitter>(M.getTargetTriple().str());
#if LLVM_VERSION_MAJOR >= 20
JIT = std::make_unique<Jitter>(M.getTargetTriple().str());
#else
JIT = std::make_unique<Jitter>(M.getTargetTriple());
#endif

Comment thread src/core/plugin.cpp
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file was updated with a new feature (passes to later step). You should add the ThinOrFullLTOPhase for each block and duplicate each with a #if LLVM_VERSION_MAJOR >= 20 so that the previous version still compiles (for the NDK which uses LLVM17)

Copy link
Copy Markdown
Collaborator

@alexland7219 alexland7219 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall very good and we extremely appreciate your contribution. Just solve the merge conflict, set the version to 21.1.6 and add #if preprocessor conditionals so that the code still compiles for LLVM 17 (NDK)

@gast04
Copy link
Copy Markdown
Author

gast04 commented May 7, 2026

@alexland7219 will do, thanks for the review, true I didn't test the compilation with LLVM 17, my bad

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