Operating System - HP-UX
1820483 Members
2399 Online
109624 Solutions
New Discussion юеВ

Re: How to get on which version of the OS the binary is compiled

 
Sreenivas_1
Occasional Advisor

How to get on which version of the OS the binary is compiled

Hi,
I have got some binary. It is mentioned that they have compiled on HP-UX10.X.

My question is how to find out what version of the OS is used while compiling the binary? and also what version is used for compiling the Shared Library.
The utilities like what, chatr and ldd are not giving this information.

Thanks in advance.
8 REPLIES 8
U.SivaKumar_2
Honored Contributor

Re: How to get on which version of the OS the binary is compiled

Hi,
#file binary_file
will give you more information.
regards,
U.SivaKumar
Innovations are made when conventions are broken
Leif Halvarsson_2
Honored Contributor

Re: How to get on which version of the OS the binary is compiled

Hi
Have you tried with
what
T. M. Louah
Esteemed Contributor

Re: How to get on which version of the OS the binary is compiled

Here is differrent outputs of file command on different HP-UX Kernels:

A- 9000/893/T600
HP-UX OS Release B.11.0 - 32 Bits
# file /stand/vmunix
/stand/vmunix: PA-RISC1.1 executable -not stripped

B- 9000/800/R390
HP-UX OS Release B.11.0 - 64 Bits
# file /stand/vmunix
/stand/vmunix: ELF-64 executable object file - PA-RISC 2.0 (LP64)

Cheers!
T??
Little learning is dangerous!
H.Merijn Brand (procura
Honored Contributor

Re: How to get on which version of the OS the binary is compiled

'file' gives you *for* what *architecture* the binary is compiled, but does not show on what machine or OS version it was built, nor does it show with what compiler it was built. OTOH, it might just what you need to know.

'what' /could/ give you more info (but not neccesarily). If it produces output, look for crt0.o

# what less
less:
$Revision: 92453-07 linker linker crt0.o B.11.30 010914 $
#

That'll show you on what system the binary was linked (and therefor most likely also compiled)

Some prefer 'ident' over 'what', because it shows RCS (Revision Control System) version info ('what' shows SCCS (Source Code Control System) info)

# ident less
less:
$Revision: 92453-07 linker linker crt0.o B.11.30 010914 $
#

For some binaries 'strings' reveal a whole lot of information about it that `standard' utilities hide for you. Also 'chatr' might be useful.
Enjoy, Have FUN! H.Merijn
Olav Baadsvik
Esteemed Contributor

Re: How to get on which version of the OS the binary is compiled


Hi,

There is a command odump that will
give you info about what compiler-version and
on what HP-UX version a binrary was compiled.

On hp-ux 10.20 you will find odump
in /usr/contrib/bin
On hp-ux 11.xx you will find odump in
/usr/ccs/bin/odump
If you do not find it there, install one
of the later ld-patches (e.ex PHSS_26262)

Use odump like this to get the info you
want:

odump -compunit

Regards
Olav
H.Merijn Brand (procura
Honored Contributor

Re: How to get on which version of the OS the binary is compiled

Forgot about odump, indeed, but I never use it since it fails way too often to yield some info. See for the less from my previous examples:

# odump -compunit !$
odump -compunit /pro/bin/less

Compilation Unit Dictionary from /pro/bin/less:

Index Chunk Language Name
Product_id ; Version_id
Compile time ; Source time
#

Uhhhh, no additional info whatsoever.
Enjoy, Have FUN! H.Merijn
Olav Baadsvik
Esteemed Contributor

Re: How to get on which version of the OS the binary is compiled

Hi,

I will still highly recommend the odump
command.
The output Procura has demonstrated is
exactly what you get from odump when
the binaray has been stripped with the
strip command.

You can see if a binary has been stripped
by using the file command:

file lesdir.exe
lesdir.exe: PA-RISC1.1 shared executable dynamically linked

showes that the executalble lesdir.exe has
been stripped, while
/home/olav/com: file meminfo.exe
meminfo.exe: PA-RISC1.1 shared executable -not stripped

show that meminfo.exe has not been stripped.

Regards
Olav

MANOJ SRIVASTAVA
Honored Contributor

Re: How to get on which version of the OS the binary is compiled

Hi


You may try man ident.


Manoj Srivastava