Monday, March 11, 2013

Linux - Check Shared Object Compile Version - .SO and .A files - whether 32 bits or 64 bits - Using file and readelf commands


If you wish to check whether a shared object (.so) in Linux is 32 bits or 64 bits, you can use the following commands:
a. file
2. readelf

Lets see their usage one by one:

1. file XXX.so

file command will output the file type of the given file. It will work for .so files.
You must look for the ELF XX-bit in the output.
It tells you whether the file is 32 bits or 64 bits compiled.


2. readelf -h XXX.so

readelf command will output the information about elf files.
Look for the Class: ELFXX .
The XX will tell you whether the file is 32 bit or 64 bit compiled

It is important to note that that the readelf -h works for archive files (.a) as well.

And for the reference of our users, we can use the Dumpbin utility over Windows for similar and more information over the Windows platform.
A separate blog post will capture those details later.

No comments:

Post a Comment