Skip to content

improve: rewrite to C; add: Java 21 support - #1

Open
ThePedroo wants to merge 7 commits into
aerath-stuff:mainfrom
ThePedroo:main
Open

improve: rewrite to C; add: Java 21 support#1
ThePedroo wants to merge 7 commits into
aerath-stuff:mainfrom
ThePedroo:main

Conversation

@ThePedroo

Copy link
Copy Markdown

This commit rewrites the entire module from C++ to C, and adds support to Java 21.

This commit rewrites the entire module from C++ to C, and adds support to Java 21.
frknkrc44 and others added 3 commits March 9, 2026 20:00
This commit moves error check macro to "dex.c", so that it doesn't go to the rest of the codebase as it is unused elsewhere.
This commit simplifies the project organization by utilizing GNU Make instead of gradle, making it simpler to understand.

Co-Authored-By: j4nDr01d <30553123+j4nDr01d@users.noreply.github.com>
This commit fixes the bug where ZygoteLoader would make Zygote possibly crash by unloading a different module, which could have hooks, resulting in that. This happens because ReZygisk stores module identifier in `impl`, and it must be passed to it.
@vova7878

vova7878 commented Mar 28, 2026

Copy link
Copy Markdown

Hi. Could you explain why you want to use C instead of C++? They are equivalent if you use C++ with stdlib turned off (and it is explicitly disabled in the configuration). C language is less convenient because C++ destructors give some guarantees.

Furthermore, when porting, you broke the logic for enabling packages. ".all" worked via xor operation and acted as a toggle between whitelist behavior (all except those listed are prohibited) and blacklist behavior (all except those listed are permitted).

@ThePedroo

Copy link
Copy Markdown
Author

Hi, I decided that because I don't find C++ an appropriate programming language to be used in Zygisk modules. This reflects in things such as atexit detection (which required more code [see atexit.cpp] just to deal with those, since they are auto generated usually when using C++). Not only that, but the use of RAII and other C++ features lead to increasing complexity.

My goal was to keep the module remove the need of adding atexit hiding, reduce its complexity and improve readability, use GNU Make instead of gradle. Moreover, a gift to Aerath due to his collaborations with us in ReZygisk stability.

Also, thanks for the heads ups in .all. I will be fixing it.

@vova7878

Copy link
Copy Markdown

The atexit hack is only needed if the binary contains global objects that require destruction. My module simply doesn't have any. Did you disassemble the debug build of the module? __cxa_aexit isn't linked there because it's not needed.

@ThePedroo

Copy link
Copy Markdown
Author

Before posting that, I in fact did check that. I was unsure, as no appeared, but thought it was there for a reason (I mean, if smart enough the compiler can not even include them at GOT). However even without this atexit detection for it, the rest still applies, and atexit detection impacts so many C++ modules that most have to use it. Zygisk modules are meant to be minimal (more to being less disconnected to libc and having less hidden tricks), and C++ focus in simplicity, not being minimal binary-wise.

ThePedroo added a commit to ThePedroo/ZygoteLoader that referenced this pull request Apr 12, 2026
This commit restores the original behavior of ".all" file being a toggle between blacklist and whitelist. Bug reported at aerath-stuff#1 (comment).
This commit restores the original behavior of ".all" file being a toggle between blacklist and whitelist. Bug reported at aerath-stuff#1 (comment).
This commit adds the "impl" field value, as per required of ZN.
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.

3 participants