1

是否可以查看目标代码并判断最初使用哪种语言来生成它?还是语言会在目标代码上留下痕迹或印记?各种语言的编译器是否使用给定 ISA 的固定格式来开发目标代码?

4

2 回答 2

2

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:

GHC

Here's what GCC's "copyright notice" looks like:

GCC

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.

于 2011-06-19T10:22:56.553 回答
1

没有。x86 就是 x86——一旦采用这种格式,就没有原始语言的痕迹。

于 2011-06-19T09:59:01.670 回答