Mail Archives: djgpp/1996/08/16/05:59:23
Nick,
I built and have been using a Sun->DJGPP cross compiler for a long
time now, and I wrote down the steps I needed, just in case I had to
do it again....hope these help!
Note that I did step 4 (and some other cases) to make the --target
description be "i386-msdos-dpmi", rather than the default
"i386-msdos-go32". You may not need to do this.
Share and enjoy,
-- Neil Jarvis, Proteon International R&D, York, UK. (Neil DOT Jarvis AT proteon DOT com)
### How to build a V2.0 DJGPP cross compiler on a Sun
### December 1995, Neil Jarvis
1) Obtain cross-compiler kit file djcrx200.zip
2) Expand ZIP file in the correct place
cd /usr/local/i386-msdos-dpmi
unzip -dL djcrx200.zip
3) De-MSDOSify the include files
#!/usr/local/bin/tcsh
cd include
set files = (`find -type f`)
foreach file ($files)
dos2unix $file > $file.unix
mv $file.unix $file
end
4) Build and install cross-platform binutils
- Modified the following files to allow i386-msdos-dpmi to be
accepted as a valid target, instead of i386-msdos-go32
binutils/config.sub
binutils/configure.in
binutils/bfd/aclocal.m4
binutils/bfd/config.bfd
binutils/bfd/configure
binutils/bfd/configure.host
binutils/gas/configure
binutils/gas/configure.in
binutils/ld/configure
binutils/ld/configure.host
binutils/ld/configure.tgt
binutils/libiberty/config.table
- Configured using
./configure --host=sparc-sun-sunos4.1.3 --target=i386-msdos-dpmi
- Built using
setenv CC gcc-2.7.2
setenv CFLAGS "-g -O3"
gmake CC="gcc-2.7.2" CFLAGS="-g -O3"
- Installed using
gmake CC="gcc-2.7.2" CFLAGS="-g -O3" install
4) Build cross-platform gcc
- Make sure gcc/config/i386/go32.h defines HAVE_ATEXIT
- I modified gcc/configure and gcc/config.sub to accept i386-msdos-dpmi as a
valid target instead of i386-msdos-go32
- Configure using
./configure --host=sparc-sun-sunos4.1.3 --target=i386-msdos-dpmi
- Built using
setenv CC gcc-2.7.2
setenv CFLAGS "-g -O3"
gmake CC="gcc-2.7.2" CFLAGS="-g -O3"
- Installed using
gmake CC="gcc-2.7.2" CFLAGS="-g -O3" install
5) Rebuild stubify to execute on the Sun
- Add these extra include files to stubify.c, otherwise the
compiler will complain about SEEK_END and SEEK_CUR being
undefined.
#include <sys/types.h>
#include <unistd.h>
- Fix file modes for generate file to be 0777, not 0666
ofile = open(ofilename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0777);
- Build with gcc
gcc-2.7.2 -Wall -g -O3 -o stubify stubify.c
- Copy the exectuable to /usr/local/i386-msdos-go32/bin/coff2exe.
Create a logical link from here to
/usr/local/bin/i386-msdos-go32-coff2exe.
6) Fixup specs
- File /usr/local/lib/gcc-lib/i386-msdos-dpmi/2.7.2/specs needs to
be fixed:
- *cpp section
Add "-fno-strength-reduce"
- *cc1plus section
Add "-fno-strength-reduce"
- New section *link_command:
*link_command:
%{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
%{r} %{s} %{t} %{u*} %{x} %{z}\
%{!A:%{!nostartfiles:%{!nostdlib:%S}}} %{static:}\
%{L*} %D %{T*} %o -Tdjgpp.lnk\
%{!nostdlib:-lgcc %L -lgcc %{!A:%E}}}}}}}
%{!c:%{!M:%{!MM:%{!E:%{!S:i386-msdos-dpmi-coff2exe %{v} %{o*:%*} %{!o*:a.out}}}}}}
- *predefines section
Change "-Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=0 -Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386)"
7) Fixup djgpp.lnk
- File /usr/local/i386-msdos-dpmi/lib/djgpp.lnk. Output format
parameter should be :
OUTPUT_FORMAT("coff-i386")
8) Fixup system include files
- /usr/local/lib/gcc-lib/i386-msdos-dpmi/2.7.2/include/stdio.h
- Comment out section
__DJ_va_list
#undef __DJ_va_list
#define __DJ_va_list
- Change fprint and fscanf prototypes to remove "const char
*_format" parameter
9) Done
- Raw text -