Bringing up GNU C on the 386
James Van Artsdalen
james at bigtex.uucp
Tue Aug 9 15:09:36 AEST 1988
GNU C works almost as is out of the box. There are apparently some
problems with float (I don't know because I never use floating point),
but these supposedly go away when you use double instead. Below is
how I built it, giving minor variations to the instructions from RMS.
Warning: you're going to need about 23,000 free blocks of disk space
to compile (in addition to the .tar.Z archive, which is 3750 blocks).
There's one problem that needs to be fixed in the distributed files.
Make this change to the file tm-i386v.h:
*** /usr4/src/gcc-1.25/tm-i386v.h Sat Jul 16 16:27:55 1988
--- /usr4/src/gcc/tm-i386v.h Mon Aug 8 00:30:25 1988
***************
*** 54,56
! #undef ASM_FILE_START1
#define ASM_FILE_START_1(FILE)
--- 54,56 -----
! #undef ASM_FILE_START_1
#define ASM_FILE_START_1(FILE)
Use this as your config.h file. Don't link to config-i386v!
-----
#include "config-i386v.h"
#define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME)
#undef ASM_FILE_START
#define ASM_FILE_START(FILE) \
fprintf(FILE, "\t.file\t\"%s\"\n", dump_base_name);
#ifdef __GNUC__
#define alloca(n) __builtin_alloca(n)
#else
asm char *alloca(n)
{
%mem n
subl n, %esp
andl $-4, %esp
mov %esp,%eax
%reg n
subl n, %esp
andl $-4, %esp
mov %esp,%eax
%con n
subl n, %esp
andl $-4, %esp
mov %esp,%eax
}
#endif
#define STARTFILE_SPEC \
"%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s}}"
#define LIB_SPEC "%{!p:%{!pg:-lc crtn.o%s}}%{p:-lc_p}%{pg:-lc_p}"
-----
This fixes a couple of bugs (doesn't work with shared libraries as
distributed, causes as(1) to give a spurious warning if used without -g).
It also does alloca(3) as inline assembly for speed. DO NOT use the
alloca.c that comes with emacs: it consumes substantially more
memory and CPU time than the inline version (example: parse.tab.c
took 2.5 hours to optimize with alloca.c, but only 80 seconds with
the inline code).
make the first stage with
$ make CFLAGS= CLIB=-lc_s
Don't use -g unless something goes wrong, otherwise you consume huge
amounts of disk space. Nothing went wrong on bigtex. Do the second
stage like the first:
$ make stage1
$ make CFLAGS="-O -Bstage1/" CLIB=-lc_s CC=stage1/gcc
Do the third stage likewise:
$ make stage2
$ make CFLAGS="-O -Bstage2/" CLIB=-lc_s CC=stage2/gcc
I don't know of any utility to compare object files, so I just did
$ for f in *.o
> do
> dump -s $f >T
> (cd stage2; dump -s $f) | cmp - T
> done
There should be *>NO<* differences here.
I'd be interested in hearing about any other problems/fixes. Time to
add ANSI function prototypes to /usr/include/*.h ...
BTW: When compiling things like news, be prepared to use the
-traditional option, and particularly the -fwritable-strings option.
--
James R. Van Artsdalen ...!uunet!utastro!bigtex!james "Live Free or Die"
Home: 512-346-2444 Work: 328-0282; 110 Wild Basin Rd. Ste #230, Austin TX 78746
More information about the Comp.unix.microport
mailing list