The segmentation fault when invoking libtwoyi.so via linker64 has been fixed by setting the ELF entry point to the main function.
# 1. Build the library (if not already built)
cd app/rs
sh build_rs.sh --release
cd ../..
# 2. Run the test script
./test_libtwoyi.shExpected output:
✓ Library exists
✓ Entry point is set (0x3a3a8)
✓ Entry point matches 'main' function address
✓ JNI_OnLoad symbol found
✓ All twoyi_* functions exported
All tests passed! ✓
# 1. Build the library (if not already done)
cd app/rs && sh build_rs.sh --release && cd ../..
# 2. Push files to device
adb push app/src/main/jniLibs/arm64-v8a/libtwoyi.so /data/local/tmp/
adb push app/src/main/jniLibs/arm64-v8a/libloader.so /data/local/tmp/
# 3. Test the exact command from the problem statement
adb shell "cd /data/local/tmp && LD_LIBRARY_PATH=. /system/bin/linker64 ./libtwoyi.so --loader ./libloader.so --help"Expected: Help message should display without segmentation fault.
app/rs/.cargo/config.toml- New: Rust linker configurationapp/rs/build_rs.sh- Modified: Sets RUSTFLAGS to configure entry pointapp/rs/build.rs- Modified: Updated commentsSHELL_EXECUTION.md- Modified: Updated documentation
test_libtwoyi.sh- Test script to validate library structureTESTING_DIRECT_INVOCATION.md- Complete testing guideJNI_VERIFICATION.md- JNI compatibility explanationFIX_SUMMARY.md- Detailed fix summaryQUICK_START.md- This file
- Verify Local Build: Run
./test_libtwoyi.shto ensure the library was built correctly - Test on Device: Follow the Android device testing steps above
- Verify JNI Mode: Build and test the APK to ensure app functionality is not affected
- See
FIX_SUMMARY.mdfor complete technical details - See
TESTING_DIRECT_INVOCATION.mdfor comprehensive testing instructions - See
JNI_VERIFICATION.mdto understand JNI compatibility