河野真治 @ 琉球大学情報工学です。

       -arch arch
           Compile for the specified target architecture arch.  The allowable
           values are i386, ppc and ppc64.  Multiple options work, and direct
           the compiler to produce ``universal'' binaries including object
           code for each architecture specified with -arch.  This option only
           works if assembler and libraries are available for each architec-
           ture specified.  (APPLE ONLY)

ってことで、

    % gcc -arch ppc -arch i386 test/simp.c
    % ./a.out 
    #0031:1
    % file a.out
    a.out: Mach-O universal binary with 2 architectures
    a.out (for architecture ppc):   Mach-O executable ppc
    a.out (for architecture i386):  Mach-O executable i386

なのね。おおぉ、便利。しかも、ppc でもロゼッタでそのまま動く。
これもうれしい。

gdb も二種類入っているようなんですが、

% gcc -g -arch ppc hello.c
% file a.out
a.out: Mach-O executable ppc
% gdb -arch ppc a.out
GNU gdb 6.1-20040303 (Apple version gdb-437) (Sun Dec 25 08:36:20 GMT 2005)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i386-apple-darwin --target=powerpc-apple-darwin"...
(gdb) run
Starting program: /Users/kono/src/a.out 
Don't know how to run.  Try "help target".
(gdb) 

あらあら。

---
Shinji KONO @ Information Engineering, University of the Ryukyus
河野真治 @ 琉球大学工学部情報工学科