Linux/Unix Elf-specific answer:
Library archives with the .a
extension are an ar
archive (a little like a tar
or an uncompressed zip
, modulo a few features), which contains nothing more than the original object files packed together. There is rarely any extra metadata in these files. You are unlikely to find any information about the compiler unless it stored that information in the original .o
files. You can view the contents of an archive with the ar
command:
ar -t /usr/lib/libz.a
Or the objdump
command:
objdump -a /usr/lib/libz.a
Shared object files (.so
) and executables are a different story. Using the readelf
and dumpelf
commands from elfutils, you can extract metadata about the shared object, including its canonical name, what libc
it was built for, which toolchain built it, and so on. See man readelf
and related pages for details.