문제

I'm looking at proc/ID/maps under embedded Linux, And I've noticed that some shared libraries appear few times at the memory map of a process why is it so ?

40094000-400d9000 r-xp 00000000 b3:09 723        /system/lib/libc.so
400d9000-400da000 ---p 00000000 00:00 0 
400da000-400dc000 r-xp 00045000 b3:09 723        /system/lib/libc.so
400dc000-400de000 rwxp 00047000 b3:09 723        /system/lib/libc.so
400de000-400e9000 rwxp 00000000 00:00 0 
400e9000-400ed000 r-xp 00000000 b3:09 770        /system/lib/libgccdemangle.so
400ed000-400ee000 ---p 00000000 00:00 0 
400ee000-400ef000 r-xp 00004000 b3:09 770        /system/lib/libgccdemangle.so
400ef000-400f0000 rwxp 00005000 b3:09 770        /system/lib/libgccdemangle.so
40102000-40103000 r-xp 00000000 b3:09 869        /system/lib/libstdc++.so
40103000-40104000 r-xp 00000000 b3:09 869        /system/lib/libstdc++.so
40104000-40105000 rwxp 00001000 b3:09 869        /system/lib/libstdc++.so
40105000-40112000 r-xp 00000000 b3:09 738        /system/lib/libcutils.so
40112000-40113000 r-xp 0000c000 b3:09 738        /system/lib/libcutils.so
40113000-40114000 rwxp 0000d000 b3:09 738        /system/lib/libcutils.so
도움이 되었습니까?

해결책

Because an ELF shared library has, like an executable, several segments: often a "text" read only segment (which is mmap -ed shared, so all processes using that segment share some physical RAM), and a "data" read write segment (for static or "global" variables, and perhaps also the PLT...), private to each process.

This is explained in great detail in Drepper's paper: How to write a shared library

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top