I spent a lot of effort making the GCC 3.2.3 source code
C90-compliant instead of being riddled with POSIX stuff,
in order to allow the compiler to be hosted on the IBM mainframe.
I have now created a makefile for OS/2 that uses itself
to build itself. But it's quite simple to modify if you want
to use some other compiler in order to bootstrap from
source. I created such a makefile for Watcom and
Microsoft C for Windows, but don't have anything for
OS/2 currently (but you can bootstrap on Windows
from source if you want, and then use that to continue
over to OS/2).
Also in the chain are two assemblers (pdas and as86).
Note that as86 is a subset of Microsoft MASM unlike
most other assemblers available (including pdas) that
require some other syntax.
So with standard C90 and standard MASM you can
build everything required. The object code produced
is coff, but the pdld linker will take coff input and
produce an LX binary.
If you are interested, get pdoso.zip from
http://pdos.organd because I don't know how to make parted (see
\devel\parted on the disk) produce a VHD that can be
mounted in Virtualbox for use by OS/2 (I use 128
sector as the starting sector (for 4k alignment), but I
tried changing it to 504 (for both 63 sector multiple and
4k alignment), but that wasn't accepted either. But I
just realized now that maybe it needs me to specify 0C
instead of 0B:
< parted --boot devel\pdos\src\mbr.com mkpart 0x80,0x0b,504,956416 ..\pdos.vhd
---
> parted --boot devel\pdos\src\mbr.com mkpart 0x80,0x0b,128,956416 ..\pdos.vhd
given that it is FAT32.
So on Windows or Linux you need to mount a VHD that
is acceptable to OS/2 and then copy the contents of
pdoso.vhd across.
After that, let's say the new disk is the P drive, you can do:
path %path%;p:\dos
cd \devel\pdos\pdpclib
pdmake -f makefile.sos
(run pdptest abc def if you want)
cd \devel
unzip \misc\custom gcc-stage*
unzip gcc-stage*
del gcc-stage*
cd gcc\gcc
copy config\i386\genfiles (don't forget this step)
pdmake -f os2.mak
I see that "fc" is missing, but no problem, you can:
cd \devel\pdos\pdpclib
ren pdptest.c pdptest.bak
copy ..\util\fc.c pdptest.c
pdmake -f makefile.sos
copy pdptest.exe \dos\fc.exe
cd \devel\gcc\gcc
fc /b \dos\gccwin.exe gcc-new.exe
and have a byte-identical copy of the compiler.
Note that gccwin.exe is a historical name
(EDIT: for this OS/2 LX executable).
I'm planning
on renaming it to gcc386.exe in the future.
Note that I have only compiled the essential binaries
needed to be able to compile anything else you may need.
ie the other stuff in \dos are Windows executables mostly,
so "need" to be replaced, eventually.
I am hoping to replace gccwin.exe with SubC anyway.
Is anyone interested in compilers such that they would
like to assist with this?
A build error (will be fixed next drop) is preventing this
from working:
[P:\devel\pdos\world]pdmake -f worldos2.mak
pdcc -E -D__SUBC__ -U__WIN32__ -D__OS2__ -D__32BIT__ -Dunsigned= -Dlong=int -Dsh
ort=int -Dconst= -Ddouble=int -I ../pdpclib -o world.i world.c
sccwin -S world.i
rm -f world.i
pdas -o world.obj --oformat coff world.s
rm -f world.s
pdld -s --no-insert-timestamp -nostdlib --oformat lx --stub ../pdpclib/needpdos
.exe -o world.exe ../pdpclib/os2strt.obj world.obj ../pdpclib/pdpos2.lib ../pdpc
lib/os2.lib
[P:\devel\pdos\world]world
hello, world
[P:\devel\pdos\world]
Hopefully by then I have a mountable disk too.
Note that I cherish old targets including i370 unlike
others who like to obsolete old targets. YMMV. So
yeah, I have been patiently plugging away at GCC 3.2.3
(including this latest change), for 20 years, instead of
"keeping up with the Joneses". And all source code is
in C90, not Turtle Graphics or whatever "modern" GCC
is written in these days. Except for the minimal
assembler required in the C library.
All clean 32-bit code too (not a single bit of 16-bit in any
executable on the disk except for the MBR, boot sector and
IO.SYS which aren't used if you are running under OS/2),
and all memory allocated with OBJ_ANY.
BFN. Paul.
P.S. gccwin also rebuilds itself on PDOS/386 - which is
what that pdoso.vhd is. PDOS/386 is a sufficient OS/2
mini-clone for that task.
P.P.S. Let me know if you don't know how to mount a
VHD on either Windows or Linux.