Android so load

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.