On Sun, Jan 24, 2010 at 12:57 PM, ZelluX <[email protected]> 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?
>

Why would you need special support in the kernel? As long as userspace has
write access to the memory segments (relocation tables and other information
to support dynamic linking), it will always work.

Take the cat program:
readelf -l /bin/cat

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x006f08 0x0804ff08 0x0804ff08 0x001d8 0x0035c RW  0x1000
  DYNAMIC        0x006f1c 0x0804ff1c 0x0804ff1c 0x000d0 0x000d0 RW  0x4

 Section to Segment mapping:
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic

Notice that the 3rd segment contains the .got and .got.plt tables which are
required by the dynamic linker. These segments are marked with the flags
"RW" so they can be written to in userspace after they've been loaded.

-Joel

Reply via email to