Equivalent of genkld on solaris

Equivalent of genkld on solaris

Post by suni » Wed, 05 May 2004 08:34:49



Hi all,
 Anyone knows equivalent of genkld of AIX for SUNs so that I can
examine addresses at which different  shared libs are loaded. Also how
is the text segment of shared libs shared among processes in solaris.
I know that in SUN all shared libs loaded in any segment except 0xd
and oxf is process private and is NOT shared among processes. (This
occurs if shared library is readable only by me or if oxd and oxf
segments are full). What about SUN.
Thanks,
Sunil.
 
 
 

Equivalent of genkld on solaris

Post by Rich Tee » Wed, 05 May 2004 09:11:44



> Hi all,
>  Anyone knows equivalent of genkld of AIX for SUNs so that I can
> examine addresses at which different  shared libs are loaded. Also how
> is the text segment of shared libs shared among processes in solaris.
> I know that in SUN all shared libs loaded in any segment except 0xd
> and oxf is process private and is NOT shared among processes. (This
> occurs if shared library is readable only by me or if oxd and oxf
> segments are full). What about SUN.

The pmap command might be what you're after.

HTH,

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net

 
 
 

Equivalent of genkld on solaris

Post by Alan Coopersmit » Wed, 05 May 2004 11:41:27



| Anyone knows equivalent of genkld of AIX for SUNs so that I can
|examine addresses at which different  shared libs are loaded.

I have no idea what genkld is, but it sounds like you may want to look
at the pmap command on Solaris.

--
________________________________________________________________________


  Working for, but definitely not speaking for, Sun Microsystems, Inc.

 
 
 

Equivalent of genkld on solaris

Post by Dan Foste » Wed, 05 May 2004 11:50:06




>| Anyone knows equivalent of genkld of AIX for SUNs so that I can
>|examine addresses at which different  shared libs are loaded.

> I have no idea what genkld is, but it sounds like you may want to look
> at the pmap command on Solaris.

mybox:/# genkld
Virtual Address              Size File

        d00cd000             16f0
/usr/opt/perl5/lib/5.00503/aix/auto/Fcntl/Fcntl.so/
        d00c9000             3799
/usr/opt/perl5/lib/5.00503/aix/auto/Socket/Socket.so/
        d124e0c0            1b6e7 /lib/libspk4rcmd.a/shr.o
        d0c6e100            168ca /usr/lib/libvaliduser.a/shr.o
        d0c6e100            168ca /usr/lib/libvaliduser.a/shr.o
        d00c6000             289f /usr/lib/nls/loc/iconv/UCS-2_UTF-8/
[...snip...]

That's the output that genkld produces on an AIX 4.3.3 machine.
Basically, it lists what file is loaded, how big it is, and at what
virtual address it is loaded at.

Perhaps modinfo is the nearest equivalent? (From a Solaris 8 host)

# modinfo
 Id Loadaddr   Size Info Rev Module Name
  6 10156000   445b   1   1  specfs (filesystem for specfs)
  8 1015bd40   333c   1   1  TS (time sharing sched class)
  9 1015e938    8d4   -   1  TS_DPTBL (Time sharing dispatch table)
 10 1015e9c0  291e3   2   1  ufs (filesystem for ufs)
 11 10185b33    1f7   -   1  fssnap_if (File System Snapshot Interface)
[...snip...]

-Dan

 
 
 

Equivalent of genkld on solaris

Post by Alan Coopersmit » Wed, 05 May 2004 14:16:09





|>| Anyone knows equivalent of genkld of AIX for SUNs so that I can
|>|examine addresses at which different  shared libs are loaded.
|>
|> I have no idea what genkld is, but it sounds like you may want to look
|> at the pmap command on Solaris.
|
|mybox:/# genkld
|Virtual Address              Size File
|
|        d00cd000             16f0
|/usr/opt/perl5/lib/5.00503/aix/auto/Fcntl/Fcntl.so/
|        d00c9000             3799
|/usr/opt/perl5/lib/5.00503/aix/auto/Socket/Socket.so/
|        d124e0c0            1b6e7 /lib/libspk4rcmd.a/shr.o
|        d0c6e100            168ca /usr/lib/libvaliduser.a/shr.o
|        d0c6e100            168ca /usr/lib/libvaliduser.a/shr.o
|        d00c6000             289f /usr/lib/nls/loc/iconv/UCS-2_UTF-8/
|[...snip...]
|
|That's the output that genkld produces on an AIX 4.3.3 machine.
|Basically, it lists what file is loaded, how big it is, and at what
|virtual address it is loaded at.
|
|Perhaps modinfo is the nearest equivalent? (From a Solaris 8 host)

modinfo is for kernel modules, not shared libraries in user processes.
From a quick google search, it sounds like there is no equivalent to
genkld in Solaris, because the Solaris VM system doesn't work that way.
Each shared library can have a different address in each process using
it, not one systemwide address.  pmap on a specific process will show
you which libraries that process has loaded and where they are mapped
in that process.

--
________________________________________________________________________


  Working for, but definitely not speaking for, Sun Microsystems, Inc.

 
 
 

Equivalent of genkld on solaris

Post by Richard L. Hamilt » Wed, 05 May 2004 22:48:24








>|>| Anyone knows equivalent of genkld of AIX for SUNs so that I can
>|>|examine addresses at which different  shared libs are loaded.
>|>
>|> I have no idea what genkld is, but it sounds like you may want to look
>|> at the pmap command on Solaris.
>|
>|mybox:/# genkld
>|Virtual Address              Size File
>|
>|        d00cd000             16f0
>|/usr/opt/perl5/lib/5.00503/aix/auto/Fcntl/Fcntl.so/
>|        d00c9000             3799
>|/usr/opt/perl5/lib/5.00503/aix/auto/Socket/Socket.so/
>|        d124e0c0            1b6e7 /lib/libspk4rcmd.a/shr.o
>|        d0c6e100            168ca /usr/lib/libvaliduser.a/shr.o
>|        d0c6e100            168ca /usr/lib/libvaliduser.a/shr.o
>|        d00c6000             289f /usr/lib/nls/loc/iconv/UCS-2_UTF-8/
>|[...snip...]
>|
>|That's the output that genkld produces on an AIX 4.3.3 machine.
>|Basically, it lists what file is loaded, how big it is, and at what
>|virtual address it is loaded at.
>|
>|Perhaps modinfo is the nearest equivalent? (From a Solaris 8 host)

> modinfo is for kernel modules, not shared libraries in user processes.
> From a quick google search, it sounds like there is no equivalent to
> genkld in Solaris, because the Solaris VM system doesn't work that way.
> Each shared library can have a different address in each process using
> it, not one systemwide address.  pmap on a specific process will show
> you which libraries that process has loaded and where they are mapped
> in that process.

and memtool (from playground.sun.com; unsupported, and loads additional
kernel support, which you may not wish to risk on a critical system) will
show you a global picture, although without addresses per file, since as
previously implied, that's meaningless globally.  Also, it may not always
be able to determine the file names.

--

 
 
 

Equivalent of genkld on solaris

Post by suni » Thu, 06 May 2004 02:33:08


Hi all,
 Thanks for all your responses.

> modinfo is for kernel modules, not shared libraries in user processes.
> From a quick google search, it sounds like there is no equivalent to
> genkld in Solaris, because the Solaris VM system doesn't work that way.

--I couldn't get this information in any doc released by SUN. So you
are saying that each shared library can be loaded at any address and
still all processes that use these shared libraries share the text
segment?
Quote:> Each shared library can have a different address in each process using
> it, not one systemwide address.  pmap on a specific process will show
> you which libraries that process has loaded and where they are mapped
> in that process.

--I found one more interesting thing with solaris runtime linker. It
doesn't load shared libraries in the order from higher to lower
address i.e. I cannot look at o/p from pmap and say because b.so is at
higher address than a.so, b.so is loaded before. I checked this by
turning on LD_DEBUG=files when running my process. This prints out
messages like "generating link map" and I noticed that runtime linker
leaves some holes when it does this and uses these holes for loading
some shared libraries that it later loads. So I have been trying to
understand how I can know for sure the "load order" which is very
important w.r.t runtime symbol resolution mechanism that solaris
supports (libraries are searched in load order when resolving a symbol
at runtime). I have my libraries built with lazyloading enabled.
AFAIK, LD_DEBUG=files seems to be most reliable of all.
One final question is: is it possible to acheive LD_PRELOAD behavior
using some linker flag when building a task. I could find only one,
which was -z initfirst
but this says _init for this .so is called before others. This doesn't
mean that this .so is loaded before others right? Is the
initialization order and load order same? I tried with a test program
and that doesn't seem to be the case.
Thanks,
Sunil.