3
我有一個來自Tiny C編譯器的64位ELF對象代碼。我無法讓gobjdump顯示反彙編的代碼。我使用OS X 10.10.5。objdump無法在ELF 64位x86-64,
$ 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等人。在這裏受到鼓勵。
答案很簡單。您的'gobjdump'編譯時支持Mac OS X的Mach-O二進制格式_only_。你的'gobjdump'版本不支持解析ELF。 –
OSX上的原生對象文件格式是Mach-O,而不是ELF,因此它不支持ELF並不奇怪。 –
我有點認爲這可能是 - 有沒有辦法編譯binutils來支持OS X上的精靈?我不想運行代碼,只需用tcc編譯它,然後反彙編它。 – Nawal