improve: rewrite to C; add: Java 21 support - #1
Conversation
This commit rewrites the entire module from C++ to C, and adds support to Java 21.
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.
|
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). |
|
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 |
|
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. |
|
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. |
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.
This commit rewrites the entire module from C++ to C, and adds support to Java 21.