*BSD News Article 6723


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!agate!ames!think.com!paperboy.osf.org!paperboy.osf.org!boot
From: boot@donald.osf.org (Bruce Bauman)
Subject: Re: GCC 2.2.2 with 386BSD?
In-Reply-To: tholo@amanda.bbb.no's message of 9 Oct 1992 17:07:40 +0100
Message-ID: <BOOT.92Oct19082732@donald.osf.org>
Sender: news@osf.org (USENET News System)
Reply-To: boot@osf.org
Organization: Open Software Foundation
References: <tholo.718646778@amanda>
Date: 19 Oct 92 08:27:32
Lines: 159


I finally got around to building a kernel with gcc2, and it's running
fine on my machine. There were a few minor problems. The files npx.c
and pccons.c in i386/isa needed minor patches; these are included
below. Also, gcc2 generates slightly larger code, and the code becomes
much larger if you turn on 486 code generation with -m486. This is
partly because some longer code sequences are faster than the
equivalent shorter sequence, and also because the compiler aligns more
strictly with -m486. Note that -m486 still generates code that will
run on a 386; it's just not optimal code for that processor.

The Makefile.i386 in i386/conf should probably have the CC line
changed to:

	CC = gcc2 -fno-builtin

Finally, I compiled machdep.c with the old (1.39) compiler. There are
problems with the alignments of structures with bitfields; here's an
old article on the subject which may help. If anyone fixes machdep.c,
I'd like to obtain a copy.


>>Path: sserve!manuel!munnari.oz.au!spool.mu.edu!uunet!mcsun!Germany.EU.net!lemis!grog
>>From: grog@lemis.uucp (Greg Lehey)
>>Newsgroups: comp.unix.bsd
>>Subject: Re: gcc 2.2.2 - work for kernel compiles?
>>Keywords: kernel gcc
>>Message-ID: <2386@adagio.lemis.uucp>
>>Date: 19 Sep 92 12:04:31 GMT
>>References: <78r4028n22ZR01@JUTS.ccc.amdahl.com>
>>Organization: LEMIS, W-6324 Feldatal, Germany
>>Lines: 39
>>
>>In article <78r4028n22ZR01@JUTS.ccc.amdahl.com> gab10@cd.amdahl.com (Gary A Browning) writes:
>>>A while back there was a thread about compiling gcc-2.2.2.  The last I heard,
>>>there was problems trying to compile the kernel with it.  Anybody know what
>>>the current status is?
>>
>>I don't use 386BSD, but I believe the problems are probably the same
>>as in BSD/386: Jon Block recently recompiled that kernel with gcc
>>2.2.2. Here's his last message:
>>
>>> From: unido!gmf.eds.com!block (W. Jon Block)
>>> Subject: Kernel Build w/GCC-2.2.2 (SUCCESS!!)
>>> Date: Thu, 17 Sep 92 7:11:00 EDT
>>> 
>>>   I finally had some time to look into the problems with using
>>> gcc-2.2.2 to compile the kernel (actually only machdep.c). The
>>> problem is the way that bitfields are aligned. Because the sd_lobase
>>> field of the struct segment_descriptor (segments.h) is 24 bits, it
>>> is aligned at the next longword boundary, instead of packing half
>>> in the current, half in the next as in gcc-1.40. This causes problems
>>> when calling lgdt in locore.
>>> 
>>>   After making some changes, I was able to completely rebuild my
>>> kernel using gcc-2.2.2. I am still looking at was is the best way
>>> to resolve this, and will post more info as it is available.
>>
>>Other problems to look out for:
>>
>>- use -fnobuiltin when compiling
>>- a lot of warnings get generated for the args structure of system
>>  calls. So far I haven't found a way to fix this.
>>- A number of the i386/isa files won't compile with the -traditional
>>  option - they do fine without.
>>- i386/isa/npx.s dies with asm commands referring to constraint "=g"
>>  (just about any address, but not non-general registers). Changing
>>  this to "=m" allows it to compile. 
>>-- 
>>Greg Lehey                       | Tel: +49-6637-1488              
>>LEMIS                            | Fax: +49-6637-1489
>>Schellnhausen 2, W-6324 Feldatal, Germany


begin 664 kernel_patches.gcc2.uue
M*BHJ(&YP>"YC"5-U;B!/8W0@,3@@,34Z,S@Z,SD@,3DY,@HM+2T@;G!X+F,N
M;W)I9PE3=6X@3V-T(#$X(#$U.C,T.C0S(#$Y.3(**BHJ*BHJ*BHJ*BHJ*BHJ
M"BHJ*B`Q,C8L,3,R("HJ*BH*("`)87-M("@B"69N:6YI="(I.PH@(`EA<VTH
M(@EF;&1C=R`E,"(@.B`Z(")G(B`H=V0I*3L*("`):68@*&-U<G!C8BD@>PHA
M(`D)87-M*"()9FYS879E("4P("(@.B`Z(")M(B`H8W5R<&-B+3YP8V)?<V%V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