Is it possible to look at an object code and tell which language has been used originally to produce it? or does the language leaves a trace or a stamp on the object code ? do the compilers of various languages use a fixed format for a given ISA to develop the object code?
2 Answers
There is no general algorithm, but in practice it is often possible. Usually you can just look at the libraries that the application depends on - if a Windows application depends on msvcrt.dll, for example, then there's a high chance that it's a C or C++ program compiled with Visual C++. Sometimes a compiler leaves traces of evidence in the .data
section. Here is what I see when opening a "Hello, World!"-like Haskell binary (compiled with GHC) in a hex editor:
Here's what GCC's "copyright notice" looks like:
A trained eye can even recognize compiler version by looking at disassembly (every compiler optimizes code slightly differently and has its own implementation quirks). If you need to automate this, I suggest looking at machine learning techniques.

- 14,928
- 3
- 52
- 65
-
+1 In fact there were heuristic tools to tell which compiler was used back in DOS days. I'm sure there are some still around. – Sedat Kapanoglu Jun 19 '11 at 10:36
Nope. x86 is x86- once it's in that format, there's no trace of the original language.

- 144,682
- 38
- 256
- 465