delorie.com/djgpp/faq/cross/gcc270-unix-to-dos.html   search  
Building GCC 2.7.0 as a Unix to DOS cross-compiler

Unpack gcc-2.7.0 and binutils-2.5.2 in a directory. Let's call this directory X. Thus, you have X/gcc-2.7.0 and X/binutils-2.5.2.

mkdir $X/dos-binu

cd $X/dos-binu

../binutils-2.5.2/configure --target=i386-coff-go32

make CFLAGS=-O
Note that libiberty/concat.c fails on IRIX with -O, causing the built as to core on startup.
mkdir -p /usr/local/i386-go32-msdos/bin

cd binutils

cp ar c++filt objcopy objdump size /usr/local/i386-go32-msdos/bin
cp nm.new /usr/local/i386-go32-msdos/bin/nm
cp strip.new /usr/local/i386-go32-msdos/bin/strip

cd ../gas
cp as.new /usr/local/i386-go32-msdos/bin/as
cp gasp.new /usr/local/i386-go32-msdos/bin/gasp

cd ../ld
cp ld.new /usr/local/i386-go32-msdos/bin/ld

mkdir $X/dos-gcc

cd $X/dos-gcc

../gcc-2.7.0/configure --target=i386-go32-msdos

make LANGUAGES=c CFLAGS=-O

cp xgcc /usr/local/bin/gcc-dos
cp cc1 /usr/local/i386-go32-msdos/bin/cc1
cp cccp /usr/local/i386-go32-msdos/bin/cpp
Unzip djdev200.zip and gcc263l.zip in, say, /usr/local/djgpp. Ideally, build libgcc.a on a dos machine, although this doesn't work cleanly for gcc-2.7.0.

Remove all ^M characters from includes

Change lib/djgpp.lnk to use "coff-i386" instead of "coff-go32" and remove the ^M characters from that also.

mkdir -p /usr/local/lib/gcc-lib/i386-go32-msdos/2.7.0
cd /usr/local/lib/gcc-lib/i386-go32-msdos/2.7.0
ln -s /usr/local/djgpp/include .
ln -s /usr/local/djgpp/lib/* .
Build stubify and install it in /usr/local/i386-go32-msdos/bin

To build something:

gcc-dos hello.c -o hello.exe

  webmaster     delorie software   privacy  
  Copyright © 1995     Updated Aug 1995