What is qdos-gcc ?
This is (currently) a gcc cross-compiler for Linux (should work under other UNICES as well) which is able to generate QDOS/SMS executables. Only the cc front-end (gcc), the pre-processor (cpp) and the compiler phase (cc1) are actually gcc-specific. Some C68 utilities (as68, ld and slb) are still used by qdos-gcc so to generate the final QDOS/SMS binaries. The libraries that qdos-gcc may use are all the existing (unmodified) C68 libraries, but the main library (libc_a) had to be adapted slightly so that its (excellent and fast) math routines could be used by qdos-gcc.
The qdos-gcc project is currently maintained by:
In fact this project arose from the many messages exchanged through the ql-users mailing list. Richard and I both agreed (this is so rare we agree on something that this must indeed be noticed ;-) that QDOS/SMS was lacking a C/C++ compiler able to generate really fast code; this point of view was warmly seconded by a few other well known QLers. A few weeks after the messages were exchanged, Richard sent us the first gcc patch: qdos-gcc was born !
Why should I use qdos-gcc ?
The QDOS/SMS systems already have an excellent C compiler: C68. This compiler is small (c68, the compiler phase, is less than 140Kb), ANSI C compliant, fast, and generates small and reasonably fast code.
On the other hand, most of the other operating systems have got gcc which is big (cc1, the compiler phase, is over 1.5Mb) but generates much faster code and can deal with C++, Objective C and Java as well (qdos-gcc is not yet ready to deal with these languages though).
Another thing to consider is that qdos-gcc being (so far) a cross-compiler, you can take benefit of all UNIX utilities (such as GNU make, autogen, autoconf and automake which are used in most major projects) that have not (yet) been ported to QDOS/SMS. Porting a C-written software to QDOS/SMS is therefore made easier (no more manual generation/editing of the makefile/config.h/etc... files !).
The last argument in favour of a cross-compiler is the compiling speed benefit for those who are running this cross-compiler on a hardware which is faster than their QL-compatible computer/QL emulator (compiling the whole libc.a library on a 400MHz K6-III takes less than 1'30"...).
And what speed gain over c68 compiled software can I expect ?
This is of course dependant on the compiled software and on the plateform you run it on... Here are some results of tests I made on a QXL (with a full blown 68040):
OK, you convinced me ! Now how to install qdos-gcc ?
The prerequisit is to have a running Linux (or UNIX) system with a shell account, GNU make, sh (bash2 preferred), tar (bzip2 aware), bzip2, and a native gcc compiler with associated utilities (as, ld, etc..., usualy known as "binutils") and development libraries.
(*) Your Linux distribution may well already include the gcc v2.95.2 full sources either in a tarball (Slackware), in a .deb package (Debian), or in a RPM file (Redhat, Suse, Mandrake, many others). As for RPM, you may install the gcc sources (rpm -ivh gcc-2.95.2.src.rpm) and move the tarball from /usr/src/{redhat,packages, RPM}/SOURCES to your home directory.
$ mkdir /usr/src/qdos
$ cd /usr/src/qdos
$ tar xyvf ~/gcc-core-2.95.2.tar.bz2
$ tar xyvf ~/qdos-gcc-utils.tar.bz2
$ tar xyvf ~/libc-4.24.5.tar.bz2
Note: depending on your (g)tar, either xyvf or xIvf may be required...
$ cd gcc-2.95.2
$ bzcat ~/qdos-gcc-diff-091000.bz2 | patch -p1 -s
$ cd ..
$ cd qdos-gcc-utils
$ make
$ make install
$ cd ..
$ cd libc-4.24.5
$ make install-includes
$ cd ..
$ mkdir build-qdos-gcc
$ cd build-qdos-gcc
$ ../gcc-2.95.2/configure --target=qdos
$ make (1)
$ make install (2)
$ cd ..
Note: if you installed the full gcc v2.95 sources from a RPM package or another distribution source, then you will have to type the following:
$ make "LANGUAGES=C"
$ make install "LANGUAGES=C"
$ qdos-gcc-utils/scripts/post-gcc-install
$ cd libc-4.24.5
$ make install
$ cd ..
Known bugs and incompatibilities:
#define LN l
move.LN d0,d1
Expands as:
move. l d0,d1 (an extraneous space is put before the l)
The example above corresponds to a pre-processed assembler source and this is where it may be problematic (well, it actually was for libc.a sources !). C sources should not be affected...
They are detailed into the qdos/c68.interoperability file of the patched gcc-core source tree. In short, they deal with:
To do: