tar jxf binutils-2.15.tar.bz2 cd binutils-2.15 ./configure --prefix=/usr make su make install
configure | 0m27.470s | 0m23.560s | 0m2.450s |
make | 20m14.738s | 15m53.130s | 4m4.740s |
install | 0m51.957s | 0m27.670s | 0m17.670s |
cd /usr/bin ls -lt |head -n 20 -rwxr-xr-x 2 root root 2287218 Mar 17 23:44 ld -rwxr-xr-x 1 root root 1868868 Mar 17 23:44 gprof -rwxr-xr-x 2 root root 2143894 Mar 17 23:44 as -rwxr-xr-x 1 root root 1660616 Mar 17 23:44 c++filt -rwxr-xr-x 2 root root 2086112 Mar 17 23:44 strip -rwxr-xr-x 2 root root 1714944 Mar 17 23:44 nm -rwxr-xr-x 1 root root 592882 Mar 17 23:44 readelf -rwxr-xr-x 1 root root 1708448 Mar 17 23:44 addr2line -rwxr-xr-x 1 root root 2086113 Mar 17 23:43 objcopy -rwxr-xr-x 2 root root 1549904 Mar 17 23:43 ranlib -rwxr-xr-x 1 root root 1517851 Mar 17 23:43 strings -rwxr-xr-x 2 root root 1547901 Mar 17 23:43 ar -rwxr-xr-x 1 root root 2238358 Mar 17 23:43 objdump -rwxr-xr-x 1 root root 1482840 Mar 17 23:43 size
stripコマンドは自分自身をstripできないため、コピーを作って実行します。
cp strip strip_cp ./strip_cp -p ld gprof as c++filt strip nm readelf addr2line ./strip_cp -p objcopy ranlib strings ar objdump size rm strip_cp ls -lt |head -n 20 -rwxr-xr-x 2 root root 830200 Mar 17 23:44 ld -rwxr-xr-x 1 root root 557076 Mar 17 23:44 gprof -rwxr-xr-x 2 root root 716280 Mar 17 23:44 as -rwxr-xr-x 1 root root 486980 Mar 17 23:44 c++filt -rwxr-xr-x 2 root root 655140 Mar 17 23:44 strip -rwxr-xr-x 2 root root 500576 Mar 17 23:44 nm -rwxr-xr-x 1 root root 217864 Mar 17 23:44 readelf -rwxr-xr-x 1 root root 488024 Mar 17 23:44 addr2line -rwxr-xr-x 1 root root 655140 Mar 17 23:43 objcopy -rwxr-xr-x 2 root root 454908 Mar 17 23:43 ranlib -rwxr-xr-x 1 root root 431960 Mar 17 23:43 strings -rwxr-xr-x 2 root root 454908 Mar 17 23:43 ar -rwxr-xr-x 1 root root 742340 Mar 17 23:43 objdump -rwxr-xr-x 1 root root 432012 Mar 17 23:43 size
バージョンを確認します。
$ as --version GNU assembler 2.15 Copyright 2002 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no warranty. This assembler was configured for a target of `powerpc-unknown-linux-gnu'. $
「hello, world」を表示するソースです。
# # hello.s # .text .align 4 .global _start _start: lis r4, msg@ha # address of msg addi r4, r4, msg@l li r3, 1 # stdout li r5, 13 # length li r0, 4 # sys_write sc li r3, 0 li r0, 1 # sys_exit sc .align 4 msg: .asciz "hello, world\n"
アセンブル、リンクして実行してみます。
$ as -mregnames -o hello.o hello.s $ ld -o hello hello.o $ ./hello hello, world