How to determine which compiler has been used to compile an executable?

前端 未结 4 1836
我寻月下人不归
我寻月下人不归 2020-12-15 15:43

From a compiled file, can I see which compiler has been used to generate the file?

相关标签:
4条回答
  • 2020-12-15 16:25

    In some cases you can run ldd on the binary and find out which standard library it's linked against. For example on Solaris gcc vs Sun CC vs whatever.

    For C++ code, you can also dump some of the symbols, find a mangled function name, and then figure out which demangler generates the correct original name.

    0 讨论(0)
  • 2020-12-15 16:25

    Try, IDA Pro which identifies the libraries and tools used to build up executable file.

    0 讨论(0)
  • 2020-12-15 16:33

    Many compilers/linkers insert a .comment section in the output file which identifies them. There are also a number of more subtle behaviors you could create compiler fingerprints off of, but I know of no existing tools for this.

    If you have the source, the easiest solution would be to try compiling with each compiler in question until you get a binary that matches byte-for-byte (or even closely).

    0 讨论(0)
  • 2020-12-15 16:43

    There's also the good old 'strings' utility. Dumps all ascii-ish looking strings it finds in the binary. Different compilers embed different amounts of information in the binaries they produce, but many will actually include obviously identifying strings.

    0 讨论(0)
提交回复
热议问题