我使用SCons编译了几个程序,然后我想检查它是什么类型的二进制文件。是64位还是32位,在windows中,我使用了dumpbin。我尝试在unix中使用nm,并返回以下内容
~/Documents/scons_unix/SCons_test$ nm VisualStudio08-32bit
0000000000600e50 d _DYNAMIC
0000000000600fe8 d _GLOBAL_OFFSET_TABLE_
00000000004005f8 R _IO_stdin_used
w _Jv_RegisterClasses
0000000000600e30 d __CTOR_END__
0000000000600e28 d __CTOR_LIST__
0000000000600e40 D __DTOR_END__
0000000000600e38 d __DTOR_LIST__
00000000004006f0 r __FRAME_END__
0000000000600e48 d __JCR_END__
0000000000600e48 d __JCR_LIST__
0000000000601020 A __bss_start
0000000000601010 D __data_start
00000000004005b0 t __do_global_ctors_aux
0000000000400460 t __do_global_dtors_aux
0000000000601018 D __dso_handle
w __gmon_start__
0000000000600e24 d __init_array_end
0000000000600e24 d __init_array_start
00000000004005a0 T __libc_csu_fini
0000000000400510 T __libc_csu_init
U __libc_start_main@@GLIBC_2.2.5
0000000000601020 A _edata
0000000000601030 A _end
00000000004005e8 T _fini
00000000004003c8 T _init
0000000000400410 T _start
000000000040043c t call_gmon_start
0000000000601020 b completed.6531
0000000000601010 W data_start
0000000000601028 b dtor_idx.6533
00000000004004d0 t frame_dummy
00000000004004f4 T main
U puts@@GLIBC_2.2.5然后我尝试使用objdump -f,这给了我以下结果
VisualStudio08-64bit: file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x0000000000400410但问题是,下面的结果来自一个32位文件,64位和32位在我看来都是一样的,
VisualStudio08-32bit: file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x0000000000400410我不知道这是怎么回事,不知道SCons是否破坏了构建。这就是我在SConstruct里的东西
#Builds a 32bit binary using the default compiler
env = Environment(TARGET_ARCH='x86')
env.Program('DefaultCompiler32-bit','helloworld-32bit.cpp')发布于 2012-08-13 22:24:28
file是判断unix上二进制文件(或任何其他文件)的最简单方法:
$ file program64
program64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
$ file program32
program32: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not strippedhttps://stackoverflow.com/questions/11942850
复制相似问题