ぱたへね

はてなダイアリーはrustの色分けができないのでこっちに来た

全部入りのbinutilsを作る。

バイナリアンへの道は遠いで悩んでいたら、shinhさんに良い方法を教わりました。http://shinh.skr.jp/m/?date=20080428#p07

ありがとうございます。

./configure --enable-targets=all --program-prefix=all-

で作ると、確かに全部入りができるのですが、アーキテクチャを特定できないので上手く動きません。

YUKI.N>~/study/gcc/binutils-2.18/objdir/binutils/objdump -D sparc_sub.o
cygdrive/d/home/study/gcc/binutils-2.18/objdir/binutils/.libs/objdump: Matching formats: elf32-sparc elf32-sparc-vxworks

と、sparcのオブジェクトファイルを入力すると、elf32-sparc elf32-sparc-vxworksの両方にマッチするので、objdumpしてくれません。今回は、mips、arm、sparc、shのOS無しelfと、cygwinx86(pe-i386)ができればよいので、configureをこのように実行します。

YUKI.N>../configure --enable-targets=sparc-elf,arm-elf,mips-elf,sh-elf --program-prefix=all-

 --enable-targets は、複数のターゲットをサポートさせるときは、カンマで区切ります。デフォルトの状態の追加になるので、hostと同じi386-peは特に追加する必要はありません。

READMEから抜粋
The --enable-targets option adds support for more binary file formats besides the default. List them as the argument to --enable-targets, separated by commas.

objdumpとnmは、ここに置いておきます。パスが通った所にコピーすれば動きます。
http://homepage3.nifty.com/~Natsutan/study/COAD/all-objdump.zip

実験してみました。

YUKI.N>/usr/bin/all-objdump.exe -D arm_imm.o

arm_imm.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <.text>:
   0:   e3a0110f        mov     r1, #-1073741821        ; 0xc0000003

YUKI.N>/usr/bin/all-objdump.exe -D sh_imm.o

sh_imm.o:     file format elf32-sh

Disassembly of section .text:

00000000 <.f>:
   0:   d1 00           mov.l   4 <.f+0x4>,r1   ! 12345678
   2:   00 09           nop
   4:   12 34           mov.l   r3,@(16,r2)
   6:   56 78           mov.l   @(32,r7),r6

YUKI.N>/usr/bin/all-objdump.exe -D x86_imm.o

x86_imm.o:     file format pe-i386

Disassembly of section .text:

0000000000000000 <.text>:
   0:   a1 78 56 34 12          mov    0x12345678,%eax
   5:   90                      nop
  (省略)

これは便利。