我有一个.a文件,我想从中获取架构信息。运行file myFile.a
结果在file.a: current ar archive
。如何获得更多关于该文件包含哪些体系结构的信息?如何获得'.a'文件的体系结构?
20
A
回答
30
您也可以跳过ar
命令,并使用readelf对其进行检查,通过像:
readelf -h <archive>.a | grep 'Class\|File\|Machine'
[00:32:15] /usr/lib $ readelf -h libxslt.a | grep 'Class\|File\|Machine'
File: libxslt.a(attrvt.o)
Class: ELF32
Machine: Intel 80386
File: libxslt.a(xslt.o)
Class: ELF32
Machine: Intel 80386
... #Trimmed this, it goes on a bit
File: libxslt.a(transform.o)
Class: ELF32
Machine: Intel 80386
File: libxslt.a(security.o)
Class: ELF32
Machine: Intel 80386
[00:32:24] /usr/lib $
如果相关,可以从readelf -h
获取其他信息。我只是修剪以上grep
,很明显:
File: libxslt.a(security.o)
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: REL (Relocatable file)
Machine: Intel 80386
Version: 0x1
Entry point address: 0x0
Start of program headers: 0 (bytes into file)
Start of section headers: 2548 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 0 (bytes)
Number of program headers: 0
Size of section headers: 40 (bytes)
Number of section headers: 16
Section header string table index: 13
即输出为libxslt.a
目标文件一个,但它给每个文件相同的信息。
2
从归档中提取的目标文件,并用文件(1),纳米(1)等
5
objdump
是另一种选择:
objdump -a file.a|grep 'file format'
13
使用
脂-info libExample.a
这将是谁的架构是建立。其他功能,如otool或文件不会给出确切的答案,有时它会冗长以获取正确的信息。
+2
lipo似乎是特定于OS X的。 – MetalGodwin 2015-11-16 10:11:47
0
我会建议使用objdump而不是lipo。 objdump提供比lipo更详细的信息。
相关问题
- 1. C#如何获得操作系统体系结构(x86或x64)?
- 2. 如何获得程序集dll的处理器体系结构?
- 3. AJAX站点的文件结构/体系结构?
- 4. Angular 4简单的文件夹结构更改体系结构
- 5. 了解Symfony2中的体系结构和文件夹结构?
- 6. Ruby插件体系结构
- 7. 无论目标机器的体系结构如何获得Program Files的路径
- 8. 如何在android运行时得到芯片的体系结构
- 9. 获取当前的GCC体系结构
- 10. 如何在一次调用文件系统时获得目录结构?
- 11. 如何获得Edb文件Msg表的结构?
- 12. 如何获得新的laravel 5.4文件夹结构
- 13. 获取libxml2.2.dylib文件错误“文件不是必需的体系结构”
- 14. MVC体系结构
- 15. Elasticsearch体系结构
- 16. Graphql体系结构
- 17. Firebug体系结构
- 18. Rails体系结构?
- 19. 处理文件系统更改的最佳体系结构?
- 20. 如何使用Spring Data JPA获得一个DOMAIN-DRIVEN DESIGN体系结构?
- 21. 如何获得表依赖关系的唯一层次结构
- 22. 文档库的信息体系结构
- 23. GDB如何确定ARM体系结构
- 24. 软件体系结构与企业体系结构,每种体系何时使用?
- 25. jQuery Mobile软件的体系结构
- 26. Android的体系结构组件网线
- 27. 与MVP的Android体系结构组件
- 28. .NET中的插件式体系结构
- 29. 软件体系结构的问题
- 30. Kotlin,proguard,Android的体系结构组件
建议在该列表中添加'Machine'。这将包括目标文件所针对的特定CPU的信息,而不仅仅是32位或64位等等。 – cHao 2010-09-18 04:46:46
@cHao:是的,我也想到了。我正在做另一个编辑(并且我添加了'readelf -h'的整个输出)。 – eldarerathis 2010-09-18 04:50:20
谢谢!这正是我所期待的。 – Mike 2010-09-18 04:52:22