简体   繁体   English

从剥离的ELF二进制文件估计编译器(GCC或LLVM-clang)版本

[英]Estimating compiler (GCC or LLVM-clang) version from a stripped ELF binary

ELF binaries of Linux distributions are stripped and don't include ".comment" section. Linux发行版的ELF二进制文件已删除,并且不包含“ .comment”部分。 Therefore, I could not get the information which compiler build the ELF binary. 因此,我无法获得编译器构建ELF二进制文件的信息。 I guess most of them are created by GCC and want to know which GCC version is used. 我想其中大多数是由GCC创建的,想知道使用了哪个GCC版本。

I know that if the ".comment" section is included in the ELF binary, I can get the compiler information using "readelf" or "objdump". 我知道如果ELF二进制文件中包含“ .comment”部分,则可以使用“ readelf”或“ objdump”获取编译器信息。 The method was posted before at the stackoverflow.com 该方法之前已发布在stackoverflow.com上

How to retrieve the GCC version used to compile a given ELF executable? 如何检索用于编译给定ELF可执行文件的GCC版本?

I guess I can you decompiling tools (eg, Hex-Rays Decompiler https://www.hex-rays.com/products/decompiler/ ) to estimate the compiler version. 我想我可以反编译工具(例如Hex-Rays Decompiler https://www.hex-rays.com/products/decompiler/ )来估计编译器版本。 I also want to know the compiler name if the binary is not created by GCC. 如果二进制不是由GCC创建的,我也想知道编译器的名称。 For example LLVM-clang. 例如LLVM-clang。

Do you know a tool to estimate the compiler name and version which create the ELF binary? 您是否知道估算ELF二进制文件的编译器名称和版本的工具? I prefer to use a free tool. 我更喜欢使用免费工具。

ELF binaries of Linux distributions are stripped and don't include ".comment" section. Linux发行版的ELF二进制文件已删除,并且不包含“ .comment”部分。 Therefore, I could not get the information which compiler build the ELF binary. 因此,我无法获得编译器构建ELF二进制文件的信息。

Most binaries also come with a separate debuginfo package, which does have .comment sections, and full source package which allows you to configure and build (almost) identical binary. 大多数二进制文件配备了独立的debuginfo包,里面确实.comment部分, 完整的源包,它允许您配置和构建(几乎)相同的二进制文件。

Examining either the debuginfo, or the source package is a much easier and more reliable way to answer your question, then guessing from the binary will ever be. 检查debuginfo或源程序包是回答您的问题的更简单 ,更可靠的方法,然后从二进制文件中进行猜测就可以了。

Do you know a tool to estimate the compiler name and version which create the ELF binary? 您是否知道估算ELF二进制文件的编译器名称和版本的工具?

I doubt such a tool exists: writing such a tool would be a mostly pointless exercise. 我怀疑是否存在这样的工具:编写这样的工具几乎是没有意义的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM