This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / gnu / usr.bin / cc25 / README
CommitLineData
0d12fbf7
PHK
1 ----------------------------------------------------------------------------
2 "THE BEER-WARE LICENSE" (Revision 42):
3 <phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
4 can do whatever you want with this stuff. If we meet some day, and you think
5 this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
6 ----------------------------------------------------------------------------
7
8cacc98c
PHK
8 $Id$
9
0d12fbf7
PHK
10"If you're looking for trouble,
11 you've come to the right place !"
12 The King.
13
14(I have taken the time to rewrite the README. It had become a proper mess,
15just like any other workspace of mine.)
16
17What is this ?
18--------------
19My intention is that this will be the link between the GNU-release of GCC,
20and the FreeBSD integrated version of GCC. The problem^H^H^H^H^H^Hchallenge
21is that FreeBSD uses BSD style Makefiles, whereas GNU uses their own scheme.
22Thus, everytime GNU adds a file, changes a flag and so on, we have to find
23out what consequences this should have for the FreeBSD Makefiles. This
24stuff, should make that process easier, and reproducible.
25
26The next challenge^H^H^H^H^H^H^H^H^Hproblem is that we need some modifications
27to the GNU source. For instance: we use gcc to compile FORTRAN via f2c, so
28we need to add the rules for that to gcc.c.
29
30In case you have ever wondered about what "dark runes" was, this is that.
31
32Overview:
33---------
34When a new release of GCC is to be brought into FreeBSD, this is what must
35be done:
36
37 - modify gnu2bsd.tcl as needed, until the resulting FreeBSD-tree
38 is compilable. It may not yet be correct, but it must be compilable.
39 - patch the GNU-tree as needed until the compiler generated from
40 the BSD-tree is correct.
41
42I think this will be the simplest way to do the second part:
43
44 - Run a virgin GNU-gcc-(N) through gnu2bsd.tcl.
45 - Create a patch from this to the patched FreeBSD-gcc-(N).
46 - Run a virgin GNU-gcc-(N+a) through gnu2bsd.tcl
47 - Apply as much of the above patch as makes sense.
48 - Twiddle until it works.
49 - Submit the needed patches to the GNU people, to avoid
50 needless diversion from their base.
51
52It is of course clear from the above, that unless you feel that you are
53sure why you need to do this, you shouldn't do it. There is some very
54interesting ways this can hose your system. Don't tell me I didn't
55warn you.
56
57Installation:
58-------------
59
60 0. Needed ingredients:
61 ======================
62 bison and tcl.
63
64 1. Create a emergency ready copy of your old gcc.
65 =================================================
66 Move the old compiler to a safe place
67 mv /usr/src/gnu/usr.bin/cc /usr/src/gnu/usr.bin/cc.old
68 for instance.
69
70 cd into the directory of the old compiler, and do:
71 find . -name 'obj' -exec rm -f {} \;
72 make clean all
73
74 It is necessary to remove the 'obj' sym-links, as a make world
75 is likely to remove the stuff they point at. Doing it this way
76 you can, in case you hose the installed c-compiler, go down here
77 and do a
78 make install
79 and things should work for you again.
80
81 2. Create the foundations for a new gcc.
82 ========================================
83 Create a new directory /usr/src/gnu/usr.bin/cc The name can
84 be anything you like actually, but some Makefiles "know" this place.
85 This directory is $BSDDIR in the rest of this instruction.
86
87 Copy the usr.bin.cpp and usr.bin.f77 with contents to $BSDDIR from
88 somewhere, either they came with this stuff, or you can take it
89 from the old cc on your system.
90
91 Copy Makefile and gnu2bsd.tcl also, and if any gcc???-freebsd.patch
92 files are there, you should copy those along too. This file (README)
93 will be nice to have too.
94
95 3. Install a GNU-release of GCC somewhere.
96 ==========================================
97 This can be anywhere you have the necesary disk-space. ($GNUDIR)
98
99 Apply patches to the GNU-dist. If any of the gcc???-freebsd.patch
100 has the same version as the GCC you're installing, use that, if you
101 are installing a newer version of gcc, you're a bit on your own. Try
102 the most recent of the gcc???-freebsd.patch files, and prepare for
103 some work.
104
105 4. Create the BSD-tree from the GNU-tree
106 ========================================
107 Edit gnu2bsd.tcl so that the various "TWEAKS" are right. If this is
108 a new version of GCC, all bets are off, and you might need to modify
109 in the main-part of the script too.
110
111 And now, the great moment:
112 cd $GNUDIR
113 configure
114 make realclean
115 configure
116 cd $BSDDIR
117 tclsh gnu2bsd.tcl
118
119 5. Bootstrap the new compiler
120 =============================
121
122 cd $BSDDIR
123 make clean obj clean depend
124 make -k ; make -k install
125 # The first make might fail on libgcc for instance,
126 # install the bits which was OK.
127 make clean all install
128 # this should succeed.
129 make clean all install
130 # Now things should be A1-OK.
131
132History:
133--------
134
8cacc98c
PHK
135199402272230
136 Received blessed patch for the ((packed)) problem from GNU.
137
138199402211500 (v5):
0d12fbf7
PHK
139
140 Got more patches from Richard to expmed.c, not quite right yet.
141
142 Tried to make a patch from 245 to 258 (FreeBSD-style directories),
143 uncompressed size: 4.4 Mb (the whole 258 is 10Mb). This actually
144 resolves my doubts about the renaming of 'lib' to 'gcc_int' &c &c.
145 We save nothing really by trying to make a patch.
146
147 I think that we should move from src/gnu/usr.bin/cc to
148 src/gnu/usr.bin/cc25 (and so on) to facilitate testing.
149
150 People tell me that usr.bin.cpp usr.bin.f77 should stay as
151 subdirs of gcc. OK, I don't really care...
152
153 Added %{Z} to gcc.c as per patch to -current.
154
155 README rewritten.
156
157revision: 199402140030 (v4)
158
159 Added the same patch to expmed.c for reading bit-fields.
160
161 The patch in v3 to gcc was wrong, sorry.
162
163revision: 199402132300 (v3)
164
165 Please notice that the both the patchfiles have changed.
166
167 Please use -O2 as much as possible, we must try to stress this
168 bugger to the limit. If you want to change the global defaults
169 you should change CFLAGS in /usr/src/share/mk/sys.mk and do a
170 make (or directly in /usr/share/mk/sys.mk but make world will
171 loose that change then). I suggest -O2, and -m486 in case you
172 have one. Sideeffect is faster machine, you can insert wait-
173 states or disable cache-memory if this is a problem for you :-)
174
175 cc1, abort(3)'s on this bit of code, modelled on
176 init386() in sys/i386/i386/machdep.c:
177
178 extern union descriptor gdt[40];
179 struct region_descriptor {
180 unsigned rd_limit:16;
181 unsigned rd_base:32 __attribute__ ((packed));
182 };
183 void foo() {
184 struct region_descriptor r_gdt;
185 r_gdt.rd_base = (unsigned) gdt;
186 }
187
188 I got a new expmed.c from Richard, and had to fix a problem
189 in it. This is all in the gcc258-freebsd.patch.3 file.
190
191 It seems that groff/grops chokes, but this could be libg++ which
192 should be updated. Nothing done about it for now.
193
194 Richard Kenner said that there will probably never be a 2.5.9 and that
195 2.6.0 should hit the ground between late March and May. I think that
196 if 1.2 is at 1st June, then we need to go ahead with 2.5.8, and
197 if 2.6.0 comes early, consider defecting to it. Comments invited.
198
199revision: 199402121100 (v2)
200 .size was -1 in /usr/src/lib/libc/errlst.o, this choked ld(1), which
201 went into a spin. Fixed by pulling in stuff from osfrose.h. As a
202 consequence the patch against the gnu-dist changed.
203 I have made the linked compier static for now, this is a temporary
204 measure to curtail havoc when things break. It works just as fine
205 when linked dynamic.
206
207revision: 199402111700 (v1)
208 First released version.
209