In Windows, EXE and DLL have version info, including at least the following fields:
- file version
- product version
- internal name
- product name
- copyright
In Linux Library / Executable:
- Which fields are present?
- How to view such info?
- What tools/libraries to read?
Best Answer
The version info in not explicitly stored in an ELF file. What you have in there is the name of the library, the
soname
, which includes the major version. The full version is usually stored as a part of the library file name.If you have library, say
libtest.so
, then you usually have:libtest.so.1.0.1
- The library file itself, containing the full versionlibtest.so.1
- Symlink tolibtest.so.1.0.1
, having the same name assoname
libtest.so
- Symlink tolibtest.so.1
used for linking.In the library file
libtest.so.1.0.1
, there will be an entry calledSONAME
in dynamic section, that will say this library is calledlibtest.so.1
. When you link a program against this library, the linked program will store thesoname
of the library underNEEDED
entry in the dynamic section.If you want to verify, what exactly is in which ELF file, you can try to run:
where
elffile
can be either an library of an executable.If you simply want to get the library version, you can play with:
AFAIK, there's no such info (at least not by default) in executable files.
Or you can rely on the program itself or your packaging system, as Rahul Patil wrote.