c - objdump 不适用于 ELF 64 位 x86-64,

标签 c binutils

我有一个来自 Tiny C 编译器的 64 位 ELF 目标代码。我无法让 gobjdump 显示反汇编代码。我使用的是 OS X 10.10.5。

$ file hello.o 
hello.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
$ gobjdump -d hello.o
gobjdump: hello.o: File format not recognized

$ greadelf -h hello.o
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          0 (bytes into file)
  Start of section headers:          228 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           0 (bytes)
  Number of program headers:         0
  Size of section headers:           64 (bytes)
  Number of section headers:         7
  Section header string table index: 6

额外信息:

$uname -a
Darwin Nawals-MacBook-Air.local 14.5.0 Darwin Kernel Version 14.5.0: 

Tue Sep  1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64

$ gobjdump -i
BFD header file version (GNU Binutils) 2.24
mach-o-x86-64
mach-o-i386
mach-o-le
mach-o-be
mach-o-fat
pef
pef-xlib
sym
srec
symbolsrec
verilog
tekhex
binary
ihex

我不明白为什么堆栈溢出认为我的问题主要是代码——我想提供尽可能多的信息来帮助人们回答。我不认为 pastebin 等人。在这里受到鼓励。

最佳答案

根据手册页,可用的输出格式如下:

  -Wl,--oformat,fmt
       Use fmt as output format. The supported output formats are:

       "elf32-i386"
           ELF output format (default)

       "binary"
           Binary image (only for executable output)

       "coff"
           COFF output format (only for executable output for TMS320C67xx
           target)

因此,无论网上声称支持x86-64,最新版本不支持目标文件的x86-64输出

关于c - objdump 不适用于 ELF 64 位 x86-64,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34364287/

相关文章:

c - 程序控制权传递给函数,但函数 block 中的语句未执行

linux - 我们应该删除在 LFS 中创建的用于安装 binutils-2.20 的构建目录吗?

gcc - 在 Solaris 10 上使用 Binutils 构建失败

c - libopcodes : get the size of a instruction

rust - 调用cargo-binutils命令时,是否可以使用xbuild代替build?

dynamic - 如何仅将动态符号保留在共享对象中以进行动态链接?

c - 使用函数指针

c - 我在哪里可以学习链接列表/堆栈?

c - 使用 fprintf 时出现问题

c - 如何不忽略 dyld 的最大版本