Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting gcc version information from static library

Assume that you have a static library built with gcc by another person and you want to find out the version number of gcc that was used for compiling. Is there an easy way to extract this information from the library file?

I already tried out readelf, but all the switches I've used so far did not lead to a gcc version number.

like image 638
sebs Avatar asked Jan 10 '23 03:01

sebs


1 Answers

This gets recorded in DW_AT_producer attribute in DWARF debug info. So if you have debug info, try this:

objdump -Wi yourlibrary.a|grep "DW_AT_producer"

I didn't see any official documentation for this attribute, so you might have to check...

like image 93
dbrank0 Avatar answered Jan 12 '23 16:01

dbrank0