Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

any objdump on solaris ?

255 views
Skip to first unread message

Banibrata Dutta

unread,
Aug 1, 2003, 4:11:35 AM8/1/03
to
hi,

is there any tool like "objdump" on Solaris (8.0 in particular)?
plz note that my binaries are actually not generated using the
GNU compiler toolset, but with the SUN Workshop compiler toolset.
i am wondering if such a thing is possible, i.e. to use objdump
to disassemble to source. my compilation was done with "-g".

tia,
bdutta.

ultra...@hotmail.com

unread,
Aug 1, 2003, 4:39:18 AM8/1/03
to

man dis

Alan Coopersmith

unread,
Aug 1, 2003, 11:42:19 AM8/1/03
to
bdu...@hotmail.com (Banibrata Dutta) writes in comp.unix.solaris:

|is there any tool like "objdump" on Solaris (8.0 in particular)?

Depends - what does objdump do? It sounds like it could be similar
to /usr/ccs/bin/elfdump, which shows all sorts of information about
ELF binaries.

|i am wondering if such a thing is possible, i.e. to use objdump
|to disassemble to source. my compilation was done with "-g".

Ah. /usr/ccs/bin/dis will disassemble, but I find the Sun cc -S output
much more useful as it shows the assembly output with comments showing
what part of the C source it relates to.

--
________________________________________________________________________
Alan Coopersmith al...@alum.calberkeley.org
http://www.CSUA.Berkeley.EDU/~alanc/ aka: Alan.Coo...@Sun.COM
Working for, but definitely not speaking for, Sun Microsystems, Inc.

Casper H.S. Dik

unread,
Aug 2, 2003, 11:13:22 AM8/2/03
to
Alan Coopersmith <al...@alum.calberkeley.org> writes:

>bdu...@hotmail.com (Banibrata Dutta) writes in comp.unix.solaris:
>|is there any tool like "objdump" on Solaris (8.0 in particular)?

>Depends - what does objdump do? It sounds like it could be similar
>to /usr/ccs/bin/elfdump, which shows all sorts of information about
>ELF binaries.


Or plain /usr/ccs/bin/dump which also shows information abotu
ELF binaries.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

Oscar del Rio

unread,
Aug 2, 2003, 1:26:06 PM8/2/03
to
> >Depends - what does objdump do? It sounds like it could be similar
> >to /usr/ccs/bin/elfdump, which shows all sorts of information about
> >ELF binaries.
>
> Or plain /usr/ccs/bin/dump which also shows information abotu
> ELF binaries.

Thanks, Alan & Casper
Those were the commands I was looking for (not related to the OP's post)
I just installed SunOne Directory Server Resource Kit 5.2
in /opt/sunone which is supposed to be the default dir according
to the README, (even though the installer defaults to / )
but all the commands (ldapcompare, ldapcmp, etc) failed
with various lib*.so not found (confirmed with ldd).

Obviously a bad precompiled RPATH or a required LD_LIBRARY_PATH.
I found the libraries in lib/ldapcsdk/lib-private/ but
the executables (or ld.so.1) are not searching there.

With "truss" I noticed ../lib and ../../lib were searched.
Now I can see with elfdump and dump -Lv that RPATH is preset to
..:../lib:../../lib:../../../lib:../../../../lib
obviously nothing with "lib/ldapcsdk/lib-private"

I made symlinks in /opt/sunone/lib but I guess I could also
write wrappers that set LD_LIBRARY_PATH to avoid any conflicts
with future sunone packages. Or Sun can fix the RPATH :-)

Thanks.

Oscar


Shaun Clowes

unread,
Aug 3, 2003, 5:58:31 PM8/3/03
to

"Banibrata Dutta" <bdu...@hotmail.com> wrote in message
news:ccecb365.03080...@posting.google.com...

> is there any tool like "objdump" on Solaris (8.0 in particular)?

Sure, you should have no problems compiling the GNU binutils (of which
objdump and the far more useful readelf are a part) on Solaris.

Cheers,
Shaun


Banibrata Dutta

unread,
Aug 4, 2003, 12:26:19 AM8/4/03
to
Thanks for all the answers (including Tony Walton, which i believe was
posted to me alone and not the group). "dis" did the job for me.
And comparing it with the output of "cc -S" was the perfect match, as
i was able to match instruction to instruction.

As far as the GNU binutils are concerned, i think due to the difference
in format of binaries generated by SunWorkshop CC compiler and GCC/G++
compiler, the gnu tool set doesn't work on Sun CC compiled libs/bins.

thanks,
bdutta.
--


"Shaun Clowes" <del...@no.spam.for.me.progsoc.org> wrote in message news:<bAfXa.317$U74....@news.optus.net.au>...

Shaun Clowes

unread,
Aug 4, 2003, 6:56:55 PM8/4/03
to

"Banibrata Dutta" <bdu...@hotmail.com> wrote in message
news:ccecb365.03080...@posting.google.com...
> Thanks for all the answers (including Tony Walton, which i believe was
> posted to me alone and not the group). "dis" did the job for me.
> And comparing it with the output of "cc -S" was the perfect match, as
> i was able to match instruction to instruction.
>
> As far as the GNU binutils are concerned, i think due to the difference
> in format of binaries generated by SunWorkshop CC compiler and GCC/G++
> compiler, the gnu tool set doesn't work on Sun CC compiled libs/bins.

If you're having problems using the binutils on these binaries you're
looking at bugs. The binaries generated by both Sun One and Gcc are simple
ELF files (which is perhaps the most widespread and well documented binary
file format outside the windows world). From our Solaris 8 machine with
binutils compiled with Sun Workshop:

$ ./binutils/readelf -d binutils/objdump

Dynamic segment at offset 0x14e428 contains 23 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.1]
0x6ffffffe (VERNEED) 0x1e278
0x6fffffff (VERNEEDNUM) 1

$ ./binutils/objdump -d binutils/objdump | head -40

binutils/objdump: file format elf32-sparc

Disassembly of section .init:

0001ecb0 <_init>:
1ecb0: 9d e3 bf a0 save %sp, -96, %sp
1ecb4: 40 00 00 03 call 1ecc0 <_init+0x10>
1ecb8: 01 00 00 00 nop
1ecbc: 00 14 f6 3c unimp 0x14f63c
1ecc0: d0 03 e0 08 ld [ %o7 + 8 ], %o0
1ecc4: 90 03 c0 08 add %o7, %o0, %o0
1ecc8: e0 02 3f f8 ld [ %o0 + -8 ], %l0
1eccc: e2 02 3f f0 ld [ %o0 + -16 ], %l1
1ecd0: 80 a4 00 00 cmp %l0, %g0
1ecd4: 02 80 00 04 be 1ece4 <_init+0x34>
1ecd8: 01 00 00 00 nop
1ecdc: 9f c4 00 00 call %l0
1ece0: 01 00 00 00 nop
1ece4: 80 a4 40 00 cmp %l1, %g0
1ece8: 02 80 00 04 be 1ecf8 <_init+0x48>

Cheers,
Shaun

0 new messages