确定二进制文件在Linux中的目标体系结构(库或可执行文件) [英] Determine target architecture of binary file in Linux (library or executable)

查看:371
本文介绍了确定二进制文件在Linux中的目标体系结构(库或可执行文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个与使用Via C3处理器的Advantech POS板上的(而不是旧的)FC3下运行的Java应用程序相关的问题。 java应用程序有几个编译的共享库,通过JNI访问。

We have an issue related to a Java application running under a (rather old) FC3 on a Advantech POS board with a Via C3 processor. The java application has several compiled shared libs that are accessed via JNI.

通过C3处理器被认为是i686兼容。一段时间以前,在具有相同处理器的MiniItx板上安装Ubuntu 6.10之后,我发现前面的语句不是100%true。 Ubuntu内核在启动时挂起,因为缺少在C3处理器中设置的i686的一些特定和可选指令。在使用i686优化时,GCC编译器默认使用i686集合的C3实现中缺少的这些指令。这种情况下的解决方案是使用i386编译版本的Ubuntu发行版。

Via C3 processor is suppossed to be i686 compatible. Some time ago after installing Ubuntu 6.10 on a MiniItx board with the same processor I found out that the previous statement is not 100% true. The Ubuntu kernel hanged on startup due to the lack of some specific and optional instructions of the i686 set in the C3 processor. These instructions missing in C3 implementation of i686 set are used by default by GCC compiler when using i686 optimizations. The solution in this case was to go with a i386 compiled version of Ubuntu distribution.

Java应用程序的基本问题是FC3发行版安装在HD上克隆从另一台PC的高清图像,这一次是一个英特尔P4。然后分发需要一些黑客来运行它,例如用i383编译版本替换一些软件包(例如内核软件包)。

The base problem with the Java application is that the FC3 distribution was installed on the HD by cloning from an image of the HD of another PC, this time an Intel P4. Afterwards the distribution needed some hacking to have it running such as replacing some packages (such as the kernel one) with the i383 compiled version.

问题是,一会儿系统完全挂起没有痕迹。我恐怕一些i686代码留在系统中的某个地方,可以随时执行(例如从挂起模式或类似的状态恢复后)。

The problem is that after working for a while the system completely hangs without a trace. I am afraid that some i686 code is left somewhere in the system and could be executed randomly at any time (for example after recovering from suspend mode or something like that).

我的问题是:


  • 是否有任何工具或方法来了解什么特定的架构是一个二进制文件文件没有提供这么多信息?

  • Is there any tool or way to find out at what specific architecture is an binary file (executable or library) aimed provided that "file" does not give so much information?

推荐答案

我认为你需要一个工具来检查每个指令,属于。是否甚至有一个官方名称由C3处理器实现的特定指令集?

I think you need a tool that checks every instruction, to determine exactly which set it belongs to. Is there even an offical name for the specific set of instructions implemented by the C3 processor? If not, it's even hairier.

如果你能确定不允许的位模式,一个快速的不变的变体可能是在文件中做原始搜索说明。只是直接测试他们,可以通过一个简单的 objdump | grep 链。

A quick'n'dirty variant might be to do a raw search in the file, if you can determine the bit pattern of the disallowed instructions. Just test for them directly, could be done by a simple objdump | grep chain, for instance.

这篇关于确定二进制文件在Linux中的目标体系结构(库或可执行文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆