PowerPC G4は32bit CPU
当たり前過ぎて、確かめるまでも無いのですが、やってみました。PowerMac G4/MDDで実行しています。
次のCプログラム"sizeof.c"を作りました。
#include <stdio.h> int main(argc, argv) int argc; char *argv; { printf("sizeof(int) = %d\n", (int)sizeof(int)); printf("sizeof(long) = %d\n", (int)sizeof(long)); printf("sizeof(long long) = %d\n", (int)sizeof(long long)); }
Ubuntu 9.10でコンパイルと実行した結果です。表示結果は、折り返しています。
$ gcc -m32 -o sizeof32 sizeof.c $ file sizeof32 sizeof32: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, with unknown capability 0x41000000 = 0x13676e75, with unknown capability 0x10000 = 0xb0401, not stripped $ ./sizeof32 sizeof(int) = 4 sizeof(long) = 4 sizeof(long long) = 8 $ gcc -m64 -o sizeof64 sizeof.c $ file sizeof64 sizeof64: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped $ ./sizeof64 bash: ./sizeof64: バイナリファイルを実行できません
64bitバイナリは、エラーになります。
Mac OS X 10.5.8でも同じ事をやってみました。
$ gcc -m32 -o sizeof32 sizeof.c $ file sizeof32 sizeof32: Mach-O executable ppc $ ./sizeof32 sizeof(int) = 4 sizeof(long) = 4 sizeof(long long) = 8 $ gcc -m64 -o sizeof642 sizeof.c $ file sizeof64 sizeof64: Mach-O 64-bit executable ppc64 $ ./sizeof64 ./sizeof64: Bad CPU type in executable.
やはり、64bitバイナリは、エラーになります。
と言う訳で、PowerPC G4は32bit CPUです。
ちなみに、iMac(mid 2007)(OSはMac OS X 10.5.8 Leopard)で実行すると、次のようになります。
$ gcc -m32 -o sizeof32 sizeof.c $ ./sizeof32 sizeof(int) = 4 sizeof(long) = 4 sizeof(long long) = 8 $ gcc -m64 -o sizeof64 sizeof.c $ ./sizeof64 sizeof(int) = 4 sizeof(long) = 8 sizeof(long long) = 8
longの結果にご注目あれ。
ディスカッション
コメント一覧
まだ、コメントがありません