Question

On linux platform,

Could anyone tell me where is the dynamic library in the memory?

I learned that the dynamic library are mmap to the process according to the GOT of this process,

is that true?

Thank you!

Était-ce utile?

La solution

You can see where things got mapped in a Linux process by looking in /proc/pid/maps -- all you need to know is the process id. For example:

$ cat /proc/self/maps
00400000-0040b000 r-xp 00000000 08:01 71827604                           /bin/cat
0060a000-0060b000 r--p 0000a000 08:01 71827604                           /bin/cat
0060b000-0060c000 rw-p 0000b000 08:01 71827604                           /bin/cat
00690000-006b1000 rw-p 00000000 00:00 0                                  [heap]
7f07fbaf7000-7f07fbdc0000 r--p 00000000 08:01 18094104                   /usr/lib/locale/locale-archive
7f07fbdc0000-7f07fbf75000 r-xp 00000000 08:01 14552996                   /lib/x86_64-linux-gnu/libc-2.15.so
7f07fbf75000-7f07fc175000 ---p 001b5000 08:01 14552996                   /lib/x86_64-linux-gnu/libc-2.15.so
7f07fc175000-7f07fc179000 r--p 001b5000 08:01 14552996                   /lib/x86_64-linux-gnu/libc-2.15.so
7f07fc179000-7f07fc17b000 rw-p 001b9000 08:01 14552996                   /lib/x86_64-linux-gnu/libc-2.15.so
7f07fc17b000-7f07fc180000 rw-p 00000000 00:00 0 
7f07fc180000-7f07fc1a2000 r-xp 00000000 08:01 14553008                   /lib/x86_64-linux-gnu/ld-2.15.so
7f07fc37e000-7f07fc381000 rw-p 00000000 00:00 0 
7f07fc3a0000-7f07fc3a2000 rw-p 00000000 00:00 0 
7f07fc3a2000-7f07fc3a3000 r--p 00022000 08:01 14553008                   /lib/x86_64-linux-gnu/ld-2.15.so
7f07fc3a3000-7f07fc3a5000 rw-p 00023000 08:01 14553008                   /lib/x86_64-linux-gnu/ld-2.15.so
7fff90e28000-7fff90e49000 rw-p 00000000 00:00 0                          [stack]
7fff90f1f000-7fff90f20000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

shows everything that got mapped in to run the cat program.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top