This article analyzes the steps of so loading, in fact, in the previous Dalvik analysis of the two also mentioned, but that focus is the JNI. to load the so library in Android, the code is as follows:
LoadLibrary ("Nanosleep");
Let's take a look at its implementation process:
call Dlopen first to load the so file; Find_library to find out if the current so is loaded in the SOINFO structure (the process-loaded so chain), or to execute the so loading process. When so is loaded, Find_library returns Soinfo to execute the callconstructors function of so, and if so contains the init, Init_array segment, then this function executes the init and Init_array first. The execution of the Dlopen function means that the system is finished with the so operation, and then Dlsym gets the address to execute the jni_load. The loading and execution of so is generally the end of the implementation process that we typically focus on:
In general, this is the case, but it is not enough to satisfy our thirst for knowledge.
Resources:
1 Android linker analysis
Android so load