Operating System - HP-UX
1820160 Members
2748 Online
109620 Solutions
New Discussion юеВ

Re: How to know the object files in a shared library

 
V V Durga Prasad
Occasional Contributor

How to know the object files in a shared library

Hi,

Can someone help me how to know the object files in a .sl or a .a file?

Regards,
Durga
6 REPLIES 6
Tom Geudens
Honored Contributor

Re: How to know the object files in a shared library

Hi Durga,
I believe "nm" can give you that information.
#man nm

Hope this helps,
Tom
A life ? Cool ! Where can I download one of those from ?
Rainer von Bongartz
Honored Contributor

Re: How to know the object files in a shared library


The nm command displays the symbol table of each object file

Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Olav Baadsvik
Esteemed Contributor

Re: How to know the object files in a shared library


Hi,

As your question is "hot to know the object files...", the two first responses are not
correct.

To see what object-files are ina .a use the
following (exampe for libc.a)

ar -tv /usr/lib/libc.a

For shared libs you may use this command:

odump -compunit /usr/lib/libc.1

It will give a lot of output but also what
source-files were used to compile to the
.o files. It will also show when compilation
was done and compiler used, options etc.

Regards
Olav
V V Durga Prasad
Occasional Contributor

Re: How to know the object files in a shared library

Hi Olav,

Thanks for the info.

For the .a files, "ar -tv" is working perfectly. But for the .sl files, "odump -compunit" is not giving the list of .o files.

Rather, 'strings <.sl file> | grep "\.o' is useful to some extent with non-striped .sl files. Is there a way further if we can get the list of .o files from a striped .sl file?

Regards,
Durga
Kyoungjin Kim_1
Occasional Advisor

Re: How to know the object files in a shared library

Hello,

odump is not included in HPUX11.0 CORE OS Media.

If you install recent "ld(1) Linker & Tools Cumulative Patch", (PHSS_24303: recommended, PHSS_26262: most recent)
odump will be installed in /usr/ccs/bin.

Hope this helps.


Olav Baadsvik
Esteemed Contributor

Re: How to know the object files in a shared library


Hi again,

You are right in saying that odump -compunit
does not give a list of .o files.
But it gives info about what source-files
were compiled to produce the .o files that
make up the library. It is listed under
column name.
So assuming that
the files were compiled without using -o
option, the .o filename will be the same
as the source-filename except for the .o
For striped .sl files I see no solution.

What problem do have that makes you need this
info? I ask because knowing the real problem
often leads to solutions along other paths
than first followed.

Regards
Olav