I'm currently learning how native functions are implemented among the ELF SO files contained inside an APK. I'm using IDA.
Native calls are always achieved in this way.
// First load the library
class myClass{
public myClass(){
super();
v0 = system.loadLibrary("library-native");
//then declare the methods
}
public static native int nativeMethod(byte[] arg0, boolean arg1) ;
}
void a(){
// then uses it
ret = this.nativeMethod(byte,bool) ;
}
According to my little experiences in JNI, when looking to library-native.so using a disassembler I should see something like Java_package_name_libname_class_NativeMethod among the exported function.
I cannot see any of these elements. When I'm searching the desired function (nativeMethod in the past example) inside the disassembled code, I do not find any clue.
I wonder how Dalvik process manages to call the right function when a native call is performed, and how can I find myself the source code of the desired functions ?
Thanks
EDIT : I add the nm and readelf output to clarify.
nm --defined-only library-native.so
nm library-native.so : no symbols
readelf -s library-native.so | grep nativeMethod // gives no output
//The only JNI related function
nm -D --defined-only library-native.so | grep JNI
00XX: JNI_onLoad
nm
on the file, does it list the expected symbols?