This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: m68k MacOS target support?


Michael Sokolov wrote:
> 
> As I'm doing some major work on the m68k target in the Cygnus toolchain and
> going to maintain it (it's currently unmaintained), I wanted to survey the
> state of target support for one rather major m68k system: MacOS. I don't see
> any in the mainline public tree. In ftp.cygnus.com:/pub/mac I see an old (1996)
> port of the toolchain to MPW. It mentions an m68k MacOS compiler, but doesn't
> contain one. I have also heard from multiple sources that Stan Shebs of Apple
> has developed and might still be maintaining an m68k MacOS compiler.

Yes; no. :-)

> Stan, are you reading this? Would you please fill me in on the state of various
> port(s) for the m68k MacOS target? Is there or has there ever been more than
> one? Is yours related to the one in ftp.cygnus.com:/pub/mac or not? What is the
> current status of the various port(s) (maintained, unmaintained, etc)? Where
> can I find the sources? Are you or is anyone else planning on integrating any
> m68k MacOS target support into the mainline Cygnus toolchain? TIA for filling
> me in on this.

Ah, brings back memories.  I'll answer publicly, just to put some of
the history on the record and maybe dispel a few myths.

I did three MacOS ports of GCC in all.  The first was in 1989, to
1.37, and was originally intended as a control case to compare with a
port of GCC to an experimental target (that project died quietly
later).  When, as part of benchmarking, we found that GCC was
producing code 10-20% better than Apple's own compiler, mgmt got real
interested and had me proceed to turn it into a complete port,
bootstrapping and all.  This ran under MPW, which is Apple's vaguely
Unix-like development environment for the Mac, and its output went
into the MPW assembler.

Being new to GNU, and not really thinking ahead, I hacked the wazoo
out of the 1.37 sources.  The assembler provided handling for the Mac
ABI, such as A5-relative references, essentially filling in the "(a5)"
for what looked like global variables and functions, and since GCC's
PIC was in a primitive state, I relied on the assembler.  The
assembler, however, also had a notion of modules that tied into jump
tables and the Mac's code segment architecture (remember that the Mac
OS had been mostly written in m68k assembly only a few years earlier),
and it actually required imports and exports of each symbol from each
function and initialized block of data!  So I had to make some really
horrendous hacks to final.c and varasm.c in order to get all this to
work.  I was pretty much on my own too, because at the time the FSF
was participating in the LPF boycott against Apple (ironic that Apple
now has a corporate commitment to GCC as its main compiler for OS X...).
I did talk to John Gilmore at one point about having Cygnus do some
of the work - interestingly, it would have been just a few months
after Cygnus was founded - but I didn't have any money to pay for it,
so that didn't go anywhere.

Eventually this port made it out to ftp sites (after some internal
debate settled by executive decision), and it enjoyed a small amount
of popularity both at Apple and externally.

A couple years later, Jeff Holcomb (who's now at RH), Brent Pease, and
I worked on moving all the patches to 2.3.3.  As you might imagine,
the many gratuitous changes made this was a nasty job, and the result
never seemed quite as solid as the original port.  During 1993, it was
actually in the running to be the compiler for building what became
MacOS 7.5, but that idea died due to internecine politics and I went
to Cygnus to continue with my GNU enthusiasm fulltime.  1993 was also
when I presented the "talking compiler" at MacHack, basically just MPW
GCC modified to play pre-recorded sounds by looking up identifiers
and/or error messages in a user-specified table.  It was great fun to
have it say "Oooh pizza" for any function with "pizza" in its name, or
to sing "You are an idiot" for syntax errors...

Anyway, among my other activities at Cygnus (such as GDB maintenance),
in late 1993 I started a new port that was to be "done right".  This
was initially for MPW-hosted cross-compilation - at that time Cygnus
would do almost anything for money :-) - and later, ca 1995, for
PowerMac native (this was the contract that also gave us the
(in?)famous Haifa scheduler).  This port strategy started out with
hacked clones of the Unix makefiles, but evolved into a complicated
script-and-sed-based mechanism to edit Unix makefiles; thus the mpw-*
files you see scattered around GNU sources today.  These ports
concentrated almost all of the MPW and Mac knowledge into separate
files, partly to simplify maintenance and partly to accommodate the
FSF boycott, which didn't end until 1995 or 1996.  The native Powermac
port eventually was finished in late 1996, and put up for ftp - just a
few weeks before Apple announced it was dropping MPW!  :-(  (They
revived it later though.)  I never did an m68k version of this port,
although I did sketch out a not-using-MPW plan at one point, nor did
the GCC changes get merged into egcs, because I had lost interest by
then and nobody else took it up - between the overwhelming popularity
of Metrowerks and Apple's declining market share, MPW GCC users became
almost nonexistent.

All three of these versions used to be at Cygnus' ftp site, presumably
they're still there, and you can get the talking compiler on MacHack's
CD (www.machack.com).  Alas, none of them is of much use for porting
current GCC to m68k MacOS, since they assume MPW, and now-unsupported
versions at that.  Most of the changes are highly MPW-specific anyway,
with the exception of Pascal string (\p) and four-char-constants ('oapp')
support in the frontend.

So given that m68k Macs are slowly fading into the sunset, and that
the PalmOS GCC port has little in common with the old Mac ports, I'd say
it's not worth spending much time worrying about m68k Mac support in
current GCC.

Stan

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]