Re: Is there any reference or documents about how Linux supports dynamic library?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 24 Jan 2010, Mulyadi Santosa wrote:

> On Sun, Jan 24, 2010 at 2:27 PM, ZelluX <zellux@xxxxxxxxx> wrote:
> > So actually dynamic linking has nothing to do with kernel, or
> > there's no special system calls or other mechanisms provided by
> > kernel to support dynamic linking, is it right?
>
> Hi, please, no top posting :)
>
> Yes, kernel has nothing to do with linking. Kernel only helps
> loading the ELF objects...but for linking, it's up to the ld.so

  to be specific, if you're asking about what's happening in the
kernel, any shared libraries have to be pulled into the process'
address space and given their own virtual memory area (VMA).  how VMAs
work is explained in many places, like robert love's LKD book, chapter
14, "the process address space."

  if you have superuser access, you can examine the VMAs for any
process, like examining it for PID 1 (init):

# pmap 1
1:   /sbin/init
0000000000400000    132K r-x--  /sbin/init
0000000000621000      4K rw---  /sbin/init
0000000000a9e000    200K rw---    [ anon ]
00000039aae00000    120K r-x--  /lib64/ld-2.11.1.so
00000039ab01d000      4K r----  /lib64/ld-2.11.1.so
00000039ab01e000      4K rw---  /lib64/ld-2.11.1.so
00000039ab01f000      4K rw---    [ anon ]
00000039ab200000   1468K r-x--  /lib64/libc-2.11.1.so
00000039ab36f000   2048K -----  /lib64/libc-2.11.1.so
00000039ab56f000     16K r----  /lib64/libc-2.11.1.so
00000039ab573000      4K rw---  /lib64/libc-2.11.1.so
00000039ab574000     20K rw---    [ anon ]
00007f8397841000     12K rw---    [ anon ]
00007f8397864000      4K rw---    [ anon ]
00007fff890e2000     84K rw---    [ stack ]
00007fff891ff000      4K r-x--    [ anon ]
ffffffffff600000      4K r-x--    [ anon ]
 total             4132K
#

  note how the process' address space clearly incorporates VMAs for
the shared libs it needs.

  if you're asking about what happens in user space, that's really a
different question for a different mailing list.

rday
--


========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux