VOGONS


First post, by noshutdown

User metadata
Rank Oldbie
Rank
Oldbie

i would like to know a few details about it:
1. does it generate 286 protected mode(including the triple fault to reset to real mode and call interrupts), unreal mode with loadall instruction, or real mode only?
2. does it generate faster binaries compared to the old borland c++ or watcom? or just to port programs designed for gcc to 16bit dos rather than porting to watcom?
3. is it possible to bootstrap, and make itself run on a 286 or even 8088?

Reply 1 of 4, by reenigne

User metadata
Rank Oldbie
Rank
Oldbie

It's been a while since I worked on it, so my answers may be out of date.
1. It outputs 16-bit code, so not unreal mode (normal djgpp would be the thing to use for unreal mode). There would be no difference in the generated code for 16-bit real mode and 16-bit protected mode so either should work but you're on your own writing the code to switch between real and protected mode, accessing OS functions from protected mode etc.
2. In theory the generated code should be faster since you have the benefit of a huge amount of middle-end optimisation. But I never actually benchmarked against any other compilers, and deficiencies in the backend might let gcc-ia16 down.
3. That would be really difficult given that GCC is a huge program, wouldn't fit into an 8088's or 286's address space, and assumes a flat memory model everywhere. The easiest way to get it to work would be to emulate a larger machine with paging, which would be incredibly slow.

Reply 2 of 4, by mr.cat

User metadata
Rank Member
Rank
Member

Hmm what kind of progs are you planning to use it for?
I guess gcc-ia16 is about the only real mode one that can (somewhat) handle modernish C++ (well, there are limitations, as expected).
Heavily templated code can make the build process very slow, even on modern machines.
So C++ of that sort is not very well suited for compilation on an old host, you're better off with cross-compiling, AND sticking to plain C if possible.

OTOH if you're looking for a bootstrappable tool chain for real mode, you might want to take a look what the folks at ELKS are up to.
They already have several usable compiler options (gcc-ia16 among them) and looks like the goal is to eventually get a toolchain that is self-hosting and bootstrappable.
They're not there yet, but getting closer. I came across this explanation about it (but also see their Wiki etc):
https://github.com/pts/minixbcc/issues/1

EDIT: Found this real nice real mode compiler comparison:
https://github.com/davidly/dos_compilers
It's a bit hard to read actually because it's just a picture, but if I read this right gcc-ia16 holds up pretty well, performance-wise 😁

Reply 3 of 4, by Frenkel

User metadata
Rank Newbie
Rank
Newbie

2. I did some experiments with Ken Silverman's Build Engine and the executable gcc-ia16 generates is three times faster in DOSBox compared to Open Watcom's output. In case of Doom8088 and MacWolf for DOS gcc-ia16 produces faster code than Open Watcom, but it's not three times faster.
I did encounter multiple internal compiler errors using gcc-ia16, though.

Reply 4 of 4, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie

I wouldn't put too much faith in DOSBox benchmarks since it makes no effort to be cycle-accurate. There may simply be less hard-to-emulate opcodes, e.g. less usage of string instructions which would actually be less efficient on a real machine.