I am trying to find the address range that my native Android code library occupies in the address space of a process. I read and understand /proc/self/maps . There are two sections to the library. One of them is code, the other is data, I suppose. I need to tell them apart. However, the difference between the two, well, however indirect. Testing on Android 2.3.3.
Code section permissions: r-xp, rwxp data are both executable. I feel embarrassed when deciding whether to write - what if the same Android accessories have a read-only data section?
Another difference is the offset of the displayed part relative to the file - the code section has an offset of 0. Again, what if some kind of iteration of the linker puts data before the code?
Tools like GDB and Android walk walker have no problem telling me which module the address of the code refers to and what its offset in the library. Just say.
EDIT: On Android 4.0, partitions are different: there is r-xp, rp, rw-p. Thus, it makes it easy to identify the executable section without crashing - but what about previous androids?
source share