OSDN Git Service

* c-decl.c (struct language_function): Renamed from struct c_function.
[pf3gnuchains/gcc-fork.git] / gcc / install.texi
1 @c Copyright (C) 1988, 89, 92-98, 1999 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @c The text of this file appears in the file INSTALL
6 @c in the GCC distribution, as well as in the GCC manual.
7
8 Note most of this information is out of date and superseded by the EGCS
9 install procedures.  It is provided for historical reference only.
10
11 @ifclear INSTALLONLY
12 @node Installation
13 @chapter Installing GNU CC
14 @end ifclear
15 @cindex installing GNU CC
16
17 @menu
18 * Configuration Files::  Files created by running @code{configure}.
19 * Configurations::    Configurations Supported by GNU CC.
20 * Other Dir::     Compiling in a separate directory (not where the source is).
21 * Cross-Compiler::   Building and installing a cross-compiler.
22 * Sun Install::   See below for installation on the Sun.
23 * VMS Install::   See below for installation on VMS.
24 * Collect2::      How @code{collect2} works; how it finds @code{ld}.
25 * Header Dirs::   Understanding the standard header file directories.
26 @end menu
27
28 Here is the procedure for installing GNU CC on a GNU or Unix system.
29 See @ref{VMS Install}, for VMS systems.  In this section we assume you
30 compile in the same directory that contains the source files; see
31 @ref{Other Dir}, to find out how to compile in a separate directory on
32 Unix systems.
33
34 You cannot install GNU C by itself on MSDOS; it will not compile under
35 any MSDOS compiler except itself.  You need to get the complete
36 compilation package DJGPP, which includes binaries as well as sources,
37 and includes all the necessary compilation tools and libraries.
38
39 @enumerate
40 @item
41 If you have built GNU CC previously in the same directory for a
42 different target machine, do @samp{make distclean} to delete all files
43 that might be invalid.  One of the files this deletes is
44 @file{Makefile}; if @samp{make distclean} complains that @file{Makefile}
45 does not exist, it probably means that the directory is already suitably
46 clean.
47
48 @item
49 On a System V release 4 system, make sure @file{/usr/bin} precedes
50 @file{/usr/ucb} in @code{PATH}.  The @code{cc} command in
51 @file{/usr/ucb} uses libraries which have bugs.
52
53 @cindex Bison parser generator
54 @cindex parser generator, Bison
55 @item
56 Make sure the Bison parser generator is installed.  (This is
57 unnecessary if the Bison output files @file{c-parse.c} and
58 @file{cexp.c} are more recent than @file{c-parse.y} and @file{cexp.y}
59 and you do not plan to change the @samp{.y} files.)
60
61 Bison versions older than Sept 8, 1988 will produce incorrect output
62 for @file{c-parse.c}.
63
64 @item
65 If you have chosen a configuration for GNU CC which requires other GNU
66 tools (such as GAS or the GNU linker) instead of the standard system
67 tools, install the required tools in the build directory under the names
68 @file{as}, @file{ld} or whatever is appropriate.  This will enable the
69 compiler to find the proper tools for compilation of the program
70 @file{enquire}.
71
72 Alternatively, you can do subsequent compilation using a value of the
73 @code{PATH} environment variable such that the necessary GNU tools come
74 before the standard system tools.
75
76 @item
77 Specify the host, build and target machine configurations.  You do this
78 when you run the @file{configure} script.
79
80 The @dfn{build} machine is the system which you are using, the
81 @dfn{host} machine is the system where you want to run the resulting
82 compiler (normally the build machine), and the @dfn{target} machine is
83 the system for which you want the compiler to generate code.
84
85 If you are building a compiler to produce code for the machine it runs
86 on (a native compiler), you normally do not need to specify any operands
87 to @file{configure}; it will try to guess the type of machine you are on
88 and use that as the build, host and target machines.  So you don't need
89 to specify a configuration when building a native compiler unless
90 @file{configure} cannot figure out what your configuration is or guesses
91 wrong.
92
93 In those cases, specify the build machine's @dfn{configuration name}
94 with the @samp{--host} option; the host and target will default to be
95 the same as the host machine.  (If you are building a cross-compiler,
96 see @ref{Cross-Compiler}.)
97
98 Here is an example:
99
100 @smallexample
101 ./configure --host=sparc-sun-sunos4.1
102 @end smallexample
103
104 A configuration name may be canonical or it may be more or less
105 abbreviated.
106
107 A canonical configuration name has three parts, separated by dashes.
108 It looks like this: @samp{@var{cpu}-@var{company}-@var{system}}.
109 (The three parts may themselves contain dashes; @file{configure}
110 can figure out which dashes serve which purpose.)  For example,
111 @samp{m68k-sun-sunos4.1} specifies a Sun 3.
112
113 You can also replace parts of the configuration by nicknames or aliases.
114 For example, @samp{sun3} stands for @samp{m68k-sun}, so
115 @samp{sun3-sunos4.1} is another way to specify a Sun 3.  You can also
116 use simply @samp{sun3-sunos}, since the version of SunOS is assumed by
117 default to be version 4.
118
119 You can specify a version number after any of the system types, and some
120 of the CPU types.  In most cases, the version is irrelevant, and will be
121 ignored.  So you might as well specify the version if you know it.
122
123 See @ref{Configurations}, for a list of supported configuration names and
124 notes on many of the configurations.  You should check the notes in that
125 section before proceeding any further with the installation of GNU CC.
126
127 @item
128 When running @code{configure}, you may also need to specify certain
129 additional options that describe variant hardware and software
130 configurations.  These are @samp{--with-gnu-as}, @samp{--with-gnu-ld},
131 @samp{--with-stabs} and @samp{--nfp}.
132
133 @table @samp
134 @item --with-gnu-as
135 If you will use GNU CC with the GNU assembler (GAS), you should declare
136 this by using the @samp{--with-gnu-as} option when you run
137 @file{configure}.
138
139 Using this option does not install GAS.  It only modifies the output of
140 GNU CC to work with GAS.  Building and installing GAS is up to you.
141
142 Conversely, if you @emph{do not} wish to use GAS and do not specify
143 @samp{--with-gnu-as} when building GNU CC, it is up to you to make sure
144 that GAS is not installed.  GNU CC searches for a program named
145 @code{as} in various directories; if the program it finds is GAS, then
146 it runs GAS.  If you are not sure where GNU CC finds the assembler it is
147 using, try specifying @samp{-v} when you run it.
148
149 The systems where it makes a difference whether you use GAS are@*
150 @samp{hppa1.0-@var{any}-@var{any}}, @samp{hppa1.1-@var{any}-@var{any}},
151 @samp{i386-@var{any}-sysv}, @samp{i386-@var{any}-isc},@*
152 @samp{i860-@var{any}-bsd}, @samp{m68k-bull-sysv},@*
153 @samp{m68k-hp-hpux}, @samp{m68k-sony-bsd},@*
154 @samp{m68k-altos-sysv}, @samp{m68000-hp-hpux},@*
155 @samp{m68000-att-sysv}, @samp{@var{any}-lynx-lynxos},
156 and @samp{mips-@var{any}}).
157 On any other system, @samp{--with-gnu-as} has no effect.
158
159 On the systems listed above (except for the HP-PA, for ISC on the
160 386, and for @samp{mips-sgi-irix5.*}), if you use GAS, you should also
161 use the GNU linker (and specify @samp{--with-gnu-ld}).
162
163 @item --with-gnu-ld
164 Specify the option @samp{--with-gnu-ld} if you plan to use the GNU
165 linker with GNU CC.
166
167 This option does not cause the GNU linker to be installed; it just
168 modifies the behavior of GNU CC to work with the GNU linker.
169 @c Specifically, it inhibits the installation of @code{collect2}, a program
170 @c which otherwise serves as a front-end for the system's linker on most
171 @c configurations.
172
173 @item --with-stabs
174 On MIPS based systems and on Alphas, you must specify whether you want
175 GNU CC to create the normal ECOFF debugging format, or to use BSD-style
176 stabs passed through the ECOFF symbol table.  The normal ECOFF debug
177 format cannot fully handle languages other than C.  BSD stabs format can
178 handle other languages, but it only works with the GNU debugger GDB.
179
180 Normally, GNU CC uses the ECOFF debugging format by default; if you
181 prefer BSD stabs, specify @samp{--with-stabs} when you configure GNU
182 CC.
183
184 No matter which default you choose when you configure GNU CC, the user
185 can use the @samp{-gcoff} and @samp{-gstabs+} options to specify explicitly
186 the debug format for a particular compilation.
187
188 @samp{--with-stabs} is meaningful on the ISC system on the 386, also, if
189 @samp{--with-gas} is used.  It selects use of stabs debugging
190 information embedded in COFF output.  This kind of debugging information
191 supports C++ well; ordinary COFF debugging information does not.
192
193 @samp{--with-stabs} is also meaningful on 386 systems running SVR4.  It
194 selects use of stabs debugging information embedded in ELF output.  The
195 C++ compiler currently (2.6.0) does not support the DWARF debugging
196 information normally used on 386 SVR4 platforms; stabs provide a
197 workable alternative.  This requires gas and gdb, as the normal SVR4
198 tools can not generate or interpret stabs.
199
200 @item --nfp
201 On certain systems, you must specify whether the machine has a floating
202 point unit.  These systems include @samp{m68k-sun-sunos@var{n}} and
203 @samp{m68k-isi-bsd}.  On any other system, @samp{--nfp} currently has no
204 effect, though perhaps there are other systems where it could usefully
205 make a difference.
206
207 @cindex Haifa scheduler
208 @cindex scheduler, experimental
209 @item --enable-haifa
210 @itemx --disable-haifa
211 Use @samp{--enable-haifa} to enable use of an experimental instruction
212 scheduler (from IBM Haifa).  This may or may not produce better code.
213 Some targets on which it is known to be a win enable it by default; use
214 @samp{--disable-haifa} to disable it in these cases.  @code{configure}
215 will print out whether the Haifa scheduler is enabled when it is run.
216
217 @cindex Objective C threads
218 @cindex threads, Objective C
219 @item --enable-threads=@var{type}
220 Certain systems, notably Linux-based GNU systems, can't be relied on to
221 supply a threads facility for the Objective C runtime and so will
222 default to single-threaded runtime.  They may, however, have a library
223 threads implementation available, in which case threads can be enabled
224 with this option by supplying a suitable @var{type}, probably
225 @samp{posix}.  The possibilities for @var{type} are @samp{single},
226 @samp{posix}, @samp{win32}, @samp{solaris}, @samp{irix} and @samp{mach}.
227
228 @cindex Internal Compiler Checking
229 @item --enable-checking
230 When you specify this option, the compiler is built to perform checking
231 of tree node types when referencing fields of that node.  This does not
232 change the generated code, but adds error checking within the compiler.
233 This will slow down the compiler and may only work properly if you
234 are building the compiler with GNU C.
235
236 The @file{configure} script searches subdirectories of the source
237 directory for other compilers that are to be integrated into GNU CC.
238 The GNU compiler for C++, called G++ is in a subdirectory named
239 @file{cp}.  @file{configure} inserts rules into @file{Makefile} to build
240 all of those compilers.
241
242 Here we spell out what files will be set up by @code{configure}.  Normally
243 you need not be concerned with these files.
244
245 @itemize @bullet
246 @item
247 @ifset INTERNALS
248 A file named @file{config.h} is created that contains a @samp{#include}
249 of the top-level config file for the machine you will run the compiler
250 on (@pxref{Config}).  This file is responsible for defining information
251 about the host machine.  It includes @file{tm.h}.
252 @end ifset
253 @ifclear INTERNALS
254 A file named @file{config.h} is created that contains a @samp{#include}
255 of the top-level config file for the machine you will run the compiler
256 on (@pxref{Config,,The Configuration File, gcc.info, Using and Porting
257 GCC}).  This file is responsible for defining information about the host
258 machine.  It includes @file{tm.h}.
259 @end ifclear
260
261 The top-level config file is located in the subdirectory @file{config}.
262 Its name is always @file{xm-@var{something}.h}; usually
263 @file{xm-@var{machine}.h}, but there are some exceptions.
264
265 If your system does not support symbolic links, you might want to
266 set up @file{config.h} to contain a @samp{#include} command which
267 refers to the appropriate file.
268
269 @item
270 A file named @file{tconfig.h} is created which includes the top-level config
271 file for your target machine.  This is used for compiling certain
272 programs to run on that machine.
273
274 @item
275 A file named @file{tm.h} is created which includes the
276 machine-description macro file for your target machine.  It should be in
277 the subdirectory @file{config} and its name is often
278 @file{@var{machine}.h}.
279 @end itemize
280
281 @cindex Native Language Support
282 @cindex NLS
283 @item --enable-nls
284 @itemx --disable-nls
285 The @samp{--enable-nls} option enables Native Language Support (NLS),
286 which lets GCC output diagnostics in languages other than American
287 English.  No translations are available yet, so the main users of this
288 option now are those translating GCC's diagnostics who want to test
289 their work.  Once translations become available, Native Language Support
290 will become enabled by default.  The @samp{--disable-nls} option
291 disables NLS.
292
293 @cindex @code{gettext}
294 @item --with-included-gettext
295 If NLS is enabled, the GCC build procedure normally attempts to use the
296 host's @code{gettext} libraries, and falls back on GCC's copy of the GNU
297 @code{gettext} library only if the host libraries do not suffice.  The
298 @samp{--with-included-gettext} option causes the build procedure to
299 prefer its copy of GNU @code{gettext}.
300
301 @cindex @code{catgets}
302 @item --with-catgets
303 If NLS is enabled, and if the host lacks @code{gettext} but has the
304 inferior @code{catgets} interface, the GCC build procedure normally
305 ignores @code{catgets} and instead uses GCC's copy of the GNU
306 @code{gettext} library.  The @samp{--with-catgets} option causes the
307 build procedure to use the host's @code{catgets} in this situation.
308
309 @cindex Windows32 Registry support
310 @item --enable-win32-registry
311 @itemx --enable-win32-registry=@var{KEY}
312 @itemx --disable-win32-registry
313 The @samp{--enable-win32-registry} option enables Windows-hosted GCC
314 to look up installations paths in the registry using the following key:
315
316 @smallexample
317 @code{HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\<KEY>}
318 @end smallexample
319
320 <KEY> defaults to GCC version number, and can be overridden by the
321 @code{--enable-win32-registry=KEY} option. Vendors and distributors
322 who use custom installers are encouraged to provide a different key,
323 perhaps one comprised of vendor name and GCC version number, to
324 avoid conflict with existing installations. This feature is enabled
325 by default, and can be disabled by @code{--disable-win32-registry}
326 option.  This option has no effect on the other hosts.
327 @end table
328
329 @item
330 In certain cases, you should specify certain other options when you run
331 @code{configure}.
332
333 @itemize @bullet
334 @item
335 The standard directory for installing GNU CC is @file{/usr/local/lib}.
336 If you want to install its files somewhere else, specify
337 @samp{--prefix=@var{dir}} when you run @file{configure}.  Here @var{dir}
338 is a directory name to use instead of @file{/usr/local} for all purposes
339 with one exception: the directory @file{/usr/local/include} is searched
340 for header files no matter where you install the compiler.  To override
341 this name, use the @code{--with-local-prefix} option below.  The directory
342 you specify need not exist, but its parent directory must exist.
343
344 @item
345 Specify @samp{--with-local-prefix=@var{dir}} if you want the compiler to
346 search directory @file{@var{dir}/include} for locally installed header
347 files @emph{instead} of @file{/usr/local/include}.
348
349 You should specify @samp{--with-local-prefix} @strong{only} if your site has
350 a different convention (not @file{/usr/local}) for where to put
351 site-specific files.
352
353 The default value for @samp{--with-local-prefix} is @file{/usr/local}
354 regardless of the value of @samp{--prefix}.  Specifying @samp{--prefix}
355 has no effect on which directory GNU CC searches for local header files.
356 This may seem counterintuitive, but actually it is logical.
357
358 The purpose of @samp{--prefix} is to specify where to @emph{install GNU
359 CC}.  The local header files in @file{/usr/local/include}---if you put
360 any in that directory---are not part of GNU CC.  They are part of other
361 programs---perhaps many others.  (GNU CC installs its own header files
362 in another directory which is based on the @samp{--prefix} value.)
363
364 @strong{Do not} specify @file{/usr} as the @samp{--with-local-prefix}!  The
365 directory you use for @samp{--with-local-prefix} @strong{must not} contain
366 any of the system's standard header files.  If it did contain them,
367 certain programs would be miscompiled (including GNU Emacs, on certain
368 targets), because this would override and nullify the header file
369 corrections made by the @code{fixincludes} script.
370
371 Indications are that people who use this option use it based on
372 mistaken ideas of what it is for.  People use it as if it specified
373 where to install part of GNU CC.  Perhaps they make this assumption
374 because installing GNU CC creates the directory.
375 @end itemize
376
377 @item
378 Build the compiler.  Just type @samp{make LANGUAGES=c} in the compiler
379 directory.
380
381 @samp{LANGUAGES=c} specifies that only the C compiler should be
382 compiled.  The makefile normally builds compilers for all the supported
383 languages; currently, C, C++ and Objective C.  However, C is the only
384 language that is sure to work when you build with other non-GNU C
385 compilers.  In addition, building anything but C at this stage is a
386 waste of time.
387
388 In general, you can specify the languages to build by typing the
389 argument @samp{LANGUAGES="@var{list}"}, where @var{list} is one or more
390 words from the list @samp{c}, @samp{c++}, and @samp{objective-c}.  If
391 you have any additional GNU compilers as subdirectories of the GNU CC
392 source directory, you may also specify their names in this list.
393
394 Ignore any warnings you may see about ``statement not reached'' in
395 @file{insn-emit.c}; they are normal.  Also, warnings about ``unknown
396 escape sequence'' are normal in @file{genopinit.c} and perhaps some
397 other files.  Likewise, you should ignore warnings about ``constant is
398 so large that it is unsigned'' in @file{insn-emit.c} and
399 @file{insn-recog.c}, a warning about a comparison always being zero
400 in @file{enquire.o}, and warnings about shift counts exceeding type
401 widths in @file{cexp.y}.  Any other compilation errors may represent bugs in
402 the port to your machine or operating system, and
403 @ifclear INSTALLONLY
404 should be investigated and reported (@pxref{Bugs}).
405 @end ifclear
406 @ifset INSTALLONLY
407 should be investigated and reported.
408 @end ifset
409
410 Some compilers fail to compile GNU CC because they have bugs or
411 limitations.  For example, the Microsoft compiler is said to run out of
412 macro space.  Some Ultrix compilers run out of expression space; then
413 you need to break up the statement where the problem happens.
414
415 @item
416 If you are building a cross-compiler, stop here.  @xref{Cross-Compiler}.
417
418 @cindex stage1
419 @item
420 Move the first-stage object files and executables into a subdirectory
421 with this command:
422
423 @smallexample
424 make stage1
425 @end smallexample
426
427 The files are moved into a subdirectory named @file{stage1}.
428 Once installation is complete, you may wish to delete these files
429 with @code{rm -r stage1}.
430
431 @item
432 If you have chosen a configuration for GNU CC which requires other GNU
433 tools (such as GAS or the GNU linker) instead of the standard system
434 tools, install the required tools in the @file{stage1} subdirectory
435 under the names @file{as}, @file{ld} or whatever is appropriate.  This
436 will enable the stage 1 compiler to find the proper tools in the
437 following stage.
438
439 Alternatively, you can do subsequent compilation using a value of the
440 @code{PATH} environment variable such that the necessary GNU tools come
441 before the standard system tools.
442
443 @item
444 Recompile the compiler with itself, with this command:
445
446 @smallexample
447 make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2"
448 @end smallexample
449
450 This is called making the stage 2 compiler.
451
452 The command shown above builds compilers for all the supported
453 languages.  If you don't want them all, you can specify the languages to
454 build by typing the argument @samp{LANGUAGES="@var{list}"}.  @var{list}
455 should contain one or more words from the list @samp{c}, @samp{c++},
456 @samp{objective-c}, and @samp{proto}.  Separate the words with spaces.
457 @samp{proto} stands for the programs @code{protoize} and
458 @code{unprotoize}; they are not a separate language, but you use
459 @code{LANGUAGES} to enable or disable their installation.
460
461 If you are going to build the stage 3 compiler, then you might want to
462 build only the C language in stage 2.
463
464 Once you have built the stage 2 compiler, if you are short of disk
465 space, you can delete the subdirectory @file{stage1}.
466
467 On a 68000 or 68020 system lacking floating point hardware,
468 unless you have selected a @file{tm.h} file that expects by default
469 that there is no such hardware, do this instead:
470
471 @smallexample
472 make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2 -msoft-float"
473 @end smallexample
474
475 @item
476 If you wish to test the compiler by compiling it with itself one more
477 time, install any other necessary GNU tools (such as GAS or the GNU
478 linker) in the @file{stage2} subdirectory as you did in the
479 @file{stage1} subdirectory, then do this:
480
481 @smallexample
482 make stage2
483 make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"
484 @end smallexample
485
486 @noindent
487 This is called making the stage 3 compiler.  Aside from the @samp{-B}
488 option, the compiler options should be the same as when you made the
489 stage 2 compiler.  But the @code{LANGUAGES} option need not be the
490 same.  The command shown above builds compilers for all the supported
491 languages; if you don't want them all, you can specify the languages to
492 build by typing the argument @samp{LANGUAGES="@var{list}"}, as described
493 above.
494
495 If you do not have to install any additional GNU tools, you may use the
496 command
497
498 @smallexample
499 make bootstrap LANGUAGES=@var{language-list} BOOT_CFLAGS=@var{option-list}
500 @end smallexample
501
502 @noindent
503 instead of making @file{stage1}, @file{stage2}, and performing
504 the two compiler builds.
505
506 @item
507 Compare the latest object files with the stage 2 object files---they
508 ought to be identical, aside from time stamps (if any).
509
510 On some systems, meaningful comparison of object files is impossible;
511 they always appear ``different.''  This is currently true on Solaris and
512 some systems that use ELF object file format.  On some versions of Irix
513 on SGI machines and DEC Unix (OSF/1) on Alpha systems, you will not be
514 able to compare the files without specifying @file{-save-temps}; see the
515 description of individual systems above to see if you get comparison
516 failures.  You may have similar problems on other systems.
517
518 Use this command to compare the files:
519
520 @smallexample
521 make compare
522 @end smallexample
523
524 This will mention any object files that differ between stage 2 and stage
525 3.  Any difference, no matter how innocuous, indicates that the stage 2
526 compiler has compiled GNU CC incorrectly, and is therefore a potentially
527 @ifclear INSTALLONLY
528 serious bug which you should investigate and report (@pxref{Bugs}).
529 @end ifclear
530 @ifset INSTALLONLY
531 serious bug which you should investigate and report.
532 @end ifset
533
534 If your system does not put time stamps in the object files, then this
535 is a faster way to compare them (using the Bourne shell):
536
537 @smallexample
538 for file in *.o; do
539 cmp $file stage2/$file
540 done
541 @end smallexample
542
543 If you have built the compiler with the @samp{-mno-mips-tfile} option on
544 MIPS machines, you will not be able to compare the files.
545
546 @item
547 Install the compiler driver, the compiler's passes and run-time support
548 with @samp{make install}.  Use the same value for @code{CC},
549 @code{CFLAGS} and @code{LANGUAGES} that you used when compiling the
550 files that are being installed.  One reason this is necessary is that
551 some versions of Make have bugs and recompile files gratuitously when
552 you do this step.  If you use the same variable values, those files will
553 be recompiled properly.
554
555 For example, if you have built the stage 2 compiler, you can use the
556 following command:
557
558 @smallexample
559 make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="@var{list}"
560 @end smallexample
561
562 @noindent
563 This copies the files @file{cc1}, @file{cpp} and @file{libgcc.a} to
564 files @file{cc1}, @file{cpp} and @file{libgcc.a} in the directory
565 @file{/usr/local/lib/gcc-lib/@var{target}/@var{version}}, which is where
566 the compiler driver program looks for them.  Here @var{target} is the
567 canonicalized form of target machine type specified when you ran
568 @file{configure}, and @var{version} is the version number of GNU CC.
569 This naming scheme permits various versions and/or cross-compilers to
570 coexist.  It also copies the executables for compilers for other
571 languages (e.g., @file{cc1plus} for C++) to the same directory.
572
573 This also copies the driver program @file{xgcc} into
574 @file{/usr/local/bin/gcc}, so that it appears in typical execution
575 search paths.  It also copies @file{gcc.1} into
576 @file{/usr/local/man/man1} and info pages into @file{/usr/local/info}.
577
578 On some systems, this command causes recompilation of some files.  This
579 is usually due to bugs in @code{make}.  You should either ignore this
580 problem, or use GNU Make.
581
582 @cindex @code{alloca} and SunOS
583 @strong{Warning: there is a bug in @code{alloca} in the Sun library.  To
584 avoid this bug, be sure to install the executables of GNU CC that were
585 compiled by GNU CC.  (That is, the executables from stage 2 or 3, not
586 stage 1.)  They use @code{alloca} as a built-in function and never the
587 one in the library.}
588
589 (It is usually better to install GNU CC executables from stage 2 or 3,
590 since they usually run faster than the ones compiled with some other
591 compiler.)
592
593 @item
594 @cindex C++ runtime library
595 @cindex @code{libstdc++}
596 If you're going to use C++, you need to install the C++ runtime library.
597 This includes all I/O functionality, special class libraries, etc.
598
599 The standard C++ runtime library for GNU CC is called @samp{libstdc++}.
600 An obsolescent library @samp{libg++} may also be available, but it's
601 necessary only for older software that hasn't been converted yet; if
602 you don't know whether you need @samp{libg++} then you probably don't
603 need it.
604
605 Here's one way to build and install @samp{libstdc++} for GNU CC:
606
607 @itemize @bullet
608 @item
609 Build and install GNU CC, so that invoking @samp{gcc} obtains the GNU CC
610 that was just built.
611
612 @item
613 Obtain a copy of a compatible @samp{libstdc++} distribution.  For
614 example, the @samp{libstdc++-2.8.0.tar.gz} distribution should be
615 compatible with GCC 2.8.0.  GCC distributors normally distribute
616 @samp{libstdc++} as well.
617
618 @item
619 Set the @samp{CXX} environment variable to @samp{gcc} while running the
620 @samp{libstdc++} distribution's @file{configure} command.  Use the same
621 @file{configure} options that you used when you invoked GCC's
622 @file{configure} command.
623
624 @item
625 Invoke @samp{make} to build the C++ runtime.
626
627 @item
628 Invoke @samp{make install} to install the C++ runtime.
629
630 @end itemize
631
632 To summarize, after building and installing GNU CC, invoke the following
633 shell commands in the topmost directory of the C++ library distribution.
634 For @var{configure-options}, use the same options that
635 you used to configure GNU CC.
636
637 @example
638 $ CXX=gcc ./configure @var{configure-options}
639 $ make
640 $ make install
641 @end example
642
643 @item
644 GNU CC includes a runtime library for Objective-C because it is an
645 integral part of the language.  You can find the files associated with
646 the library in the subdirectory @file{objc}.  The GNU Objective-C
647 Runtime Library requires header files for the target's C library in
648 order to be compiled,and also requires the header files for the target's
649 thread library if you want thread support.  @xref{Cross Headers,
650 Cross-Compilers and Header Files, Cross-Compilers and Header Files}, for
651 discussion about header files issues for cross-compilation.
652
653 When you run @file{configure}, it picks the appropriate Objective-C
654 thread implementation file for the target platform.  In some situations,
655 you may wish to choose a different back-end as some platforms support
656 multiple thread implementations or you may wish to disable thread
657 support completely.  You do this by specifying a value for the
658 @var{OBJC_THREAD_FILE} makefile variable on the command line when you
659 run make, for example:
660
661 @smallexample
662 make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2" OBJC_THREAD_FILE=thr-single
663 @end smallexample
664
665 @noindent
666 Below is a list of the currently available back-ends.
667
668 @itemize @bullet
669 @item thr-single
670 Disable thread support, should work for all platforms.
671 @item thr-decosf1
672 DEC OSF/1 thread support.
673 @item thr-irix
674 SGI IRIX thread support.
675 @item thr-mach
676 Generic MACH thread support, known to work on NEXTSTEP.
677 @item thr-os2
678 IBM OS/2 thread support.
679 @item thr-posix
680 Generix POSIX thread support.
681 @item thr-pthreads
682 PCThreads on Linux-based GNU systems.
683 @item thr-solaris
684 SUN Solaris thread support.
685 @item thr-win32
686 Microsoft Win32 API thread support.
687 @end itemize
688 @end enumerate
689
690 @node Configuration Files
691 @section Files Created by @code{configure}
692
693 Here we spell out what files will be set up by @code{configure}.  Normally
694 you need not be concerned with these files.
695
696 @itemize @bullet
697 @item
698 @ifset INTERNALS
699 A file named @file{config.h} is created that contains a @samp{#include}
700 of the top-level config file for the machine you will run the compiler
701 on (@pxref{Config}).  This file is responsible for defining information
702 about the host machine.  It includes @file{tm.h}.
703 @end ifset
704 @ifclear INTERNALS
705 A file named @file{config.h} is created that contains a @samp{#include}
706 of the top-level config file for the machine you will run the compiler
707 on (@pxref{Config,,The Configuration File, gcc.info, Using and Porting
708 GCC}).  This file is responsible for defining information about the host
709 machine.  It includes @file{tm.h}.
710 @end ifclear
711
712 The top-level config file is located in the subdirectory @file{config}.
713 Its name is always @file{xm-@var{something}.h}; usually
714 @file{xm-@var{machine}.h}, but there are some exceptions.
715
716 If your system does not support symbolic links, you might want to
717 set up @file{config.h} to contain a @samp{#include} command which
718 refers to the appropriate file.
719
720 @item
721 A file named @file{tconfig.h} is created which includes the top-level config
722 file for your target machine.  This is used for compiling certain
723 programs to run on that machine.
724
725 @item
726 A file named @file{tm.h} is created which includes the
727 machine-description macro file for your target machine.  It should be in
728 the subdirectory @file{config} and its name is often
729 @file{@var{machine}.h}.
730
731 @item
732 The command file @file{configure} also constructs the file
733 @file{Makefile} by adding some text to the template file
734 @file{Makefile.in}.  The additional text comes from files in the
735 @file{config} directory, named @file{t-@var{target}} and
736 @file{x-@var{host}}.  If these files do not exist, it means nothing
737 needs to be added for a given target or host.
738 @end itemize
739
740 @node Configurations
741 @section Configurations Supported by GNU CC
742 @cindex configurations supported by GNU CC
743
744 Here are the possible CPU types:
745
746 @quotation
747 @c gmicro, alliant, spur and tahoe omitted since they don't work.
748 1750a, a29k, alpha, arm, c@var{n}, clipper, dsp16xx, elxsi, h8300,
749 hppa1.0, hppa1.1, i370, i386, i486, i586, i860, i960, m32r, m68000, m68k,
750 m88k, mips, mipsel, mips64, mips64el, ns32k, powerpc, powerpcle,
751 pyramid, romp, rs6000, sh, sparc, sparclite, sparc64, vax, we32k.
752 @end quotation
753
754 Here are the recognized company names.  As you can see, customary
755 abbreviations are used rather than the longer official names.
756
757 @c What should be done about merlin, tek*, dolphin?
758 @quotation
759 acorn, alliant, altos, apollo, apple, att, bull,
760 cbm, convergent, convex, crds, dec, dg, dolphin,
761 elxsi, encore, harris, hitachi, hp, ibm, intergraph, isi,
762 mips, motorola, ncr, next, ns, omron, plexus,
763 sequent, sgi, sony, sun, tti, unicom, wrs.
764 @end quotation
765
766 The company name is meaningful only to disambiguate when the rest of
767 the information supplied is insufficient.  You can omit it, writing
768 just @samp{@var{cpu}-@var{system}}, if it is not needed.  For example,
769 @samp{vax-ultrix4.2} is equivalent to @samp{vax-dec-ultrix4.2}.
770
771 Here is a list of system types:
772
773 @quotation
774 386bsd, aix, acis, amigaos, aos, aout, aux, bosx, bsd, clix, coff, ctix, cxux,
775 dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms, genix, gnu, linux-gnu,
776 hiux, hpux, iris, irix, isc, luna, lynxos, mach, minix, msdos, mvs,
777 netbsd, newsos, nindy, ns, osf, osfrose, ptx, riscix, riscos, rtu, sco, sim,
778 solaris, sunos, sym, sysv, udi, ultrix, unicos, uniplus, unos, vms, vsta,
779 vxworks, winnt, xenix.
780 @end quotation
781
782 @noindent
783 You can omit the system type; then @file{configure} guesses the
784 operating system from the CPU and company.
785
786 You can add a version number to the system type; this may or may not
787 make a difference.  For example, you can write @samp{bsd4.3} or
788 @samp{bsd4.4} to distinguish versions of BSD.  In practice, the version
789 number is most needed for @samp{sysv3} and @samp{sysv4}, which are often
790 treated differently.
791
792 If you specify an impossible combination such as @samp{i860-dg-vms},
793 then you may get an error message from @file{configure}, or it may
794 ignore part of the information and do the best it can with the rest.
795 @file{configure} always prints the canonical name for the alternative
796 that it used.  GNU CC does not support all possible alternatives.
797
798 Often a particular model of machine has a name.  Many machine names are
799 recognized as aliases for CPU/company combinations.  Thus, the machine
800 name @samp{sun3}, mentioned above, is an alias for @samp{m68k-sun}.
801 Sometimes we accept a company name as a machine name, when the name is
802 popularly used for a particular machine.  Here is a table of the known
803 machine names:
804
805 @quotation
806 3300, 3b1, 3b@var{n}, 7300, altos3068, altos,
807 apollo68, att-7300, balance,
808 convex-c@var{n}, crds, decstation-3100,
809 decstation, delta, encore,
810 fx2800, gmicro, hp7@var{nn}, hp8@var{nn},
811 hp9k2@var{nn}, hp9k3@var{nn}, hp9k7@var{nn},
812 hp9k8@var{nn}, iris4d, iris, isi68,
813 m3230, magnum, merlin, miniframe,
814 mmax, news-3600, news800, news, next,
815 pbd, pc532, pmax, powerpc, powerpcle, ps2, risc-news,
816 rtpc, sun2, sun386i, sun386, sun3,
817 sun4, symmetry, tower-32, tower.
818 @end quotation
819
820 @noindent
821 Remember that a machine name specifies both the cpu type and the company
822 name.
823 If you want to install your own homemade configuration files, you can
824 use @samp{local} as the company name to access them.  If you use
825 configuration @samp{@var{cpu}-local}, the configuration name
826 without the cpu prefix
827 is used to form the configuration file names.
828
829 Thus, if you specify @samp{m68k-local}, configuration uses
830 files @file{m68k.md}, @file{local.h}, @file{m68k.c},
831 @file{xm-local.h}, @file{t-local}, and @file{x-local}, all in the
832 directory @file{config/m68k}.
833
834 Here is a list of configurations that have special treatment or special
835 things you must know:
836
837 @table @samp
838 @item 1750a-*-*
839 MIL-STD-1750A processors.
840
841 The MIL-STD-1750A cross configuration produces output for
842 @code{as1750}, an assembler/linker available under the GNU Public
843 License for the 1750A. @code{as1750} can be obtained at 
844 @emph{ftp://ftp.fta-berlin.de/pub/crossgcc/1750gals/}.
845 A similarly licensed simulator for
846 the 1750A is available from same address.
847
848 You should ignore a fatal error during the building of libgcc (libgcc is
849 not yet implemented for the 1750A.)
850
851 The @code{as1750} assembler requires the file @file{ms1750.inc}, which is
852 found in the directory @file{config/1750a}.
853
854 GNU CC produced the same sections as the Fairchild F9450 C Compiler,
855 namely:
856
857 @table @code
858 @item Normal
859 The program code section.
860
861 @item Static
862 The read/write (RAM) data section.
863
864 @item Konst
865 The read-only (ROM) constants section.
866
867 @item Init
868 Initialization section (code to copy KREL to SREL).
869 @end table
870
871 The smallest addressable unit is 16 bits (BITS_PER_UNIT is 16).  This
872 means that type `char' is represented with a 16-bit word per character.
873 The 1750A's "Load/Store Upper/Lower Byte" instructions are not used by
874 GNU CC.
875
876 @item alpha-*-osf1
877 Systems using processors that implement the DEC Alpha architecture and
878 are running the DEC Unix (OSF/1) operating system, for example the DEC
879 Alpha AXP systems.CC.)
880
881 GNU CC writes a @samp{.verstamp} directive to the assembler output file
882 unless it is built as a cross-compiler.  It gets the version to use from
883 the system header file @file{/usr/include/stamp.h}.  If you install a
884 new version of DEC Unix, you should rebuild GCC to pick up the new version
885 stamp.
886
887 Note that since the Alpha is a 64-bit architecture, cross-compilers from
888 32-bit machines will not generate code as efficient as that generated
889 when the compiler is running on a 64-bit machine because many
890 optimizations that depend on being able to represent a word on the
891 target in an integral value on the host cannot be performed.  Building
892 cross-compilers on the Alpha for 32-bit machines has only been tested in
893 a few cases and may not work properly.
894
895 @code{make compare} may fail on old versions of DEC Unix unless you add
896 @samp{-save-temps} to @code{CFLAGS}.  On these systems, the name of the
897 assembler input file is stored in the object file, and that makes
898 comparison fail if it differs between the @code{stage1} and
899 @code{stage2} compilations.  The option @samp{-save-temps} forces a
900 fixed name to be used for the assembler input file, instead of a
901 randomly chosen name in @file{/tmp}.  Do not add @samp{-save-temps}
902 unless the comparisons fail without that option.  If you add
903 @samp{-save-temps}, you will have to manually delete the @samp{.i} and
904 @samp{.s} files after each series of compilations.
905
906 GNU CC now supports both the native (ECOFF) debugging format used by DBX
907 and GDB and an encapsulated STABS format for use only with GDB.  See the
908 discussion of the @samp{--with-stabs} option of @file{configure} above
909 for more information on these formats and how to select them.
910
911 There is a bug in DEC's assembler that produces incorrect line numbers
912 for ECOFF format when the @samp{.align} directive is used.  To work
913 around this problem, GNU CC will not emit such alignment directives
914 while writing ECOFF format debugging information even if optimization is
915 being performed.  Unfortunately, this has the very undesirable
916 side-effect that code addresses when @samp{-O} is specified are
917 different depending on whether or not @samp{-g} is also specified.
918
919 To avoid this behavior, specify @samp{-gstabs+} and use GDB instead of
920 DBX.  DEC is now aware of this problem with the assembler and hopes to
921 provide a fix shortly.
922
923 @item arc-*-elf
924 Argonaut ARC processor.
925 This configuration is intended for embedded systems.
926
927 @item arm-*-aout
928 Advanced RISC Machines ARM-family processors.  These are often used in
929 embedded applications.  There are no standard Unix configurations.
930 This configuration corresponds to the basic instruction sequences and will
931 produce @file{a.out} format object modules.
932
933 You may need to make a variant of the file @file{arm.h} for your particular
934 configuration.
935
936 @item arm-*-elf
937 This configuration is intended for embedded systems.
938
939 @item arm-*-linux-gnuaout
940 Any of the ARM-family processors running the Linux-based GNU system with
941 the @file{a.out} binary format.  This is an obsolete configuration.
942
943 @item arm-*-linux-gnu
944 @itemx arm-*-linux-gnuoldld
945 Any of the ARM-family processors running the Linux-based GNU system with
946 the @file{ELF} binary format.  You must use version 2.9.1.0.22 or later
947 of the GNU/Linux binutils, which you can download from
948 @file{ftp.varesearch.com:/pub/support/hjl/binutils}.
949
950 These two configurations differ only in the required version of GNU
951 binutils.  For binutils 2.9.1.0.x, use @samp{arm-*-linux-gnuoldld}.  For 
952 newer versions of binutils, use @samp{arm-*-linux-gnu}.
953
954 @item arm-*-riscix
955 The ARM2 or ARM3 processor running RISC iX, Acorn's port of BSD Unix.
956 If you are running a version of RISC iX prior to 1.2 then you must
957 specify the version number during configuration.  Note that the
958 assembler shipped with RISC iX does not support stabs debugging
959 information; a new version of the assembler, with stabs support
960 included, is now available from Acorn and via ftp
961 @file{ftp.acorn.com:/pub/riscix/as+xterm.tar.Z}.  To enable stabs
962 debugging, pass @samp{--with-gnu-as} to configure.
963
964 You will need to install GNU @file{sed} before you can run configure.
965
966 @item a29k
967 AMD Am29k-family processors.  These are normally used in embedded
968 applications.  There are no standard Unix configurations.
969 This configuration
970 corresponds to AMD's standard calling sequence and binary interface
971 and is compatible with other 29k tools.
972
973 You may need to make a variant of the file @file{a29k.h} for your
974 particular configuration.
975
976 @item a29k-*-bsd
977 AMD Am29050 used in a system running a variant of BSD Unix.
978
979 @item decstation-*
980 MIPS-based DECstations can support three different personalities:
981 Ultrix, DEC OSF/1, and OSF/rose.  (Alpha-based DECstation products have
982 a configuration name beginning with @samp{alpha-dec}.)  To configure GCC
983 for these platforms use the following configurations:
984
985 @table @samp
986 @item decstation-ultrix
987 Ultrix configuration.
988
989 @item decstation-osf1
990 Dec's version of OSF/1.
991
992 @item decstation-osfrose
993 Open Software Foundation reference port of OSF/1 which uses the
994 OSF/rose object file format instead of ECOFF.  Normally, you
995 would not select this configuration.
996 @end table
997
998 The MIPS C compiler needs to be told to increase its table size
999 for switch statements with the @samp{-Wf,-XNg1500} option in
1000 order to compile @file{cp/parse.c}.  If you use the @samp{-O2}
1001 optimization option, you also need to use @samp{-Olimit 3000}.
1002 Both of these options are automatically generated in the
1003 @file{Makefile} that the shell script @file{configure} builds.
1004 If you override the @code{CC} make variable and use the MIPS
1005 compilers, you may need to add @samp{-Wf,-XNg1500 -Olimit 3000}.
1006
1007 @item elxsi-elxsi-bsd
1008 The Elxsi's C compiler has known limitations that prevent it from
1009 compiling GNU C.  Please contact @code{mrs@@cygnus.com} for more details.
1010
1011 @item dsp16xx
1012 A port to the AT&T DSP1610 family of processors.
1013
1014 @ignore
1015 @item fx80
1016 Alliant FX/8 computer.  Note that the standard installed C compiler in
1017 Concentrix 5.0 has a bug which prevent it from compiling GNU CC
1018 correctly.  You can patch the compiler bug as follows:
1019
1020 @smallexample
1021 cp /bin/pcc ./pcc
1022 adb -w ./pcc - << EOF
1023 15f6?w 6610
1024 EOF
1025 @end smallexample
1026
1027 Then you must use the @samp{-ip12} option when compiling GNU CC
1028 with the patched compiler, as shown here:
1029
1030 @smallexample
1031 make CC="./pcc -ip12" CFLAGS=-w
1032 @end smallexample
1033
1034 Note also that Alliant's version of DBX does not manage to work with the
1035 output from GNU CC.
1036 @end ignore
1037
1038 @item h8300-*-*
1039 Hitachi H8/300 series of processors.
1040
1041 The calling convention and structure layout has changed in release 2.6.
1042 All code must be recompiled.  The calling convention now passes the
1043 first three arguments in function calls in registers.  Structures are no
1044 longer a multiple of 2 bytes.
1045
1046 @item hppa*-*-*
1047 There are several variants of the HP-PA processor which run a variety
1048 of operating systems.  GNU CC must be configured to use the correct
1049 processor type and operating system, or GNU CC will not function correctly.
1050 The easiest way to handle this problem is to @emph{not} specify a target
1051 when configuring GNU CC, the @file{configure} script will try to automatically
1052 determine the right processor type and operating system.
1053
1054 @samp{-g} does not work on HP-UX, since that system uses a peculiar
1055 debugging format which GNU CC does not know about.  However, @samp{-g}
1056 will work if you also use GAS and GDB in conjunction with GCC.  We
1057 highly recommend using GAS for all HP-PA configurations.
1058
1059 You should be using GAS-2.6 (or later) along with GDB-4.16 (or later).  These
1060 can be retrieved from all the traditional GNU ftp archive sites.
1061
1062 On some versions of HP-UX, you will need to install GNU @file{sed}.
1063
1064 You will need to be install GAS into a directory before @code{/bin},
1065 @code{/usr/bin}, and @code{/usr/ccs/bin} in your search path.  You
1066 should install GAS before you build GNU CC.
1067
1068 To enable debugging, you must configure GNU CC with the @samp{--with-gnu-as}
1069 option before building.
1070
1071 @item i370-*-*
1072 This port is very preliminary and has many known bugs.  We hope to
1073 have a higher-quality port for this machine soon.
1074
1075 @item i386-*-linux-gnuoldld
1076 Use this configuration to generate @file{a.out} binaries on Linux-based
1077 GNU systems if you do not have gas/binutils version 2.5.2 or later
1078 installed. This is an obsolete configuration.
1079
1080 @item i386-*-linux-gnuaout
1081 Use this configuration to generate @file{a.out} binaries on Linux-based
1082 GNU systems. This configuration is being superseded. You must use
1083 gas/binutils version 2.5.2 or later.
1084
1085 @item i386-*-linux-gnu
1086 Use this configuration to generate ELF binaries on Linux-based GNU
1087 systems.  You must use gas/binutils version 2.5.2 or later.
1088
1089 @item i386-*-sco
1090 Compilation with RCC is recommended.  Also, it may be a good idea to
1091 link with GNU malloc instead of the malloc that comes with the system.
1092
1093 @item i386-*-sco3.2v4
1094 Use this configuration for SCO release 3.2 version 4.
1095
1096 @item i386-*-sco3.2v5*
1097 Use this for the SCO OpenServer Release family including 5.0.0, 5.0.2, 
1098 5.0.4, 5.0.5, Internet FastStart 1.0, and Internet FastStart 1.1.
1099
1100 GNU CC can generate COFF binaries if you specify @samp{-mcoff} or ELF
1101 binaries, the default.    A full @samp{make bootstrap} is recommended
1102 so that an ELF compiler that builds ELF is generated.                   
1103
1104 You must have TLS597 from @uref{ftp://ftp.sco.com/TLS} installed for ELF
1105 C++ binaries to work correctly on releases before 5.0.4. 
1106
1107 The native SCO assembler that is provided with the OS at no charge
1108 is normally required.  If, however, you must be able to use the GNU
1109 assembler (perhaps you have complex asms) you must configure this
1110 package @samp{--with-gnu-as}.  To do this, install (cp or symlink)
1111 gcc/as to your copy of the GNU assembler.  You must use a recent version
1112 of GNU binutils; version 2.9.1 seems to work well.  If you select this
1113 option, you will be unable to build COFF images.  Trying to do so will
1114 result in non-obvious failures.  In general, the "--with-gnu-as" option
1115 isn't as well tested as the native assembler.
1116
1117 @emph{NOTE:} If you are building C++, you must follow the instructions
1118 about invoking @samp{make bootstrap} because the native OpenServer
1119 compiler may build a @file{cc1plus} that will not correctly parse many
1120 valid C++ programs.  You must do a @samp{make bootstrap} if you are
1121 building with the native compiler.
1122
1123 @item i386-*-isc
1124 It may be a good idea to link with GNU malloc instead of the malloc that
1125 comes with the system.
1126
1127 In ISC version 4.1, @file{sed} core dumps when building
1128 @file{deduced.h}.  Use the version of @file{sed} from version 4.0.
1129
1130 @item i386-*-esix
1131 It may be good idea to link with GNU malloc instead of the malloc that
1132 comes with the system.
1133
1134 @item i386-ibm-aix
1135 You need to use GAS version 2.1 or later, and LD from
1136 GNU binutils version 2.2 or later.
1137
1138 @item i386-sequent-bsd
1139 Go to the Berkeley universe before compiling.
1140
1141 @item i386-sequent-ptx1*
1142 @itemx i386-sequent-ptx2*
1143 You must install GNU @file{sed} before running @file{configure}.
1144
1145 @item i386-sun-sunos4
1146 You may find that you need another version of GNU CC to begin
1147 bootstrapping with, since the current version when built with the
1148 system's own compiler seems to get an infinite loop compiling part of
1149 @file{libgcc2.c}.  GNU CC version 2 compiled with GNU CC (any version)
1150 seems not to have this problem.
1151
1152 See @ref{Sun Install}, for information on installing GNU CC on Sun
1153 systems.
1154
1155 @item i[345]86-*-winnt3.5
1156 This version requires a GAS that has not yet been released.  Until it
1157 is, you can get a prebuilt binary version via anonymous ftp from
1158 @file{cs.washington.edu:pub/gnat} or @file{cs.nyu.edu:pub/gnat}. You
1159 must also use the Microsoft header files from the Windows NT 3.5 SDK.
1160 Find these on the CDROM in the @file{/mstools/h} directory dated 9/4/94.  You
1161 must use a fixed version of Microsoft linker made especially for NT 3.5,
1162 which is also is available on the NT 3.5 SDK CDROM.  If you do not have
1163 this linker, can you also use the linker from Visual C/C++ 1.0 or 2.0.
1164
1165 Installing GNU CC for NT builds a wrapper linker, called @file{ld.exe},
1166 which mimics the behaviour of Unix @file{ld} in the specification of
1167 libraries (@samp{-L} and @samp{-l}).  @file{ld.exe} looks for both Unix
1168 and Microsoft named libraries.  For example, if you specify
1169 @samp{-lfoo}, @file{ld.exe} will look first for @file{libfoo.a}
1170 and then for @file{foo.lib}.
1171
1172 You may install GNU CC for Windows NT in one of two ways, depending on
1173 whether or not you have a Unix-like shell and various Unix-like
1174 utilities.
1175
1176 @enumerate
1177 @item
1178 If you do not have a Unix-like shell and few Unix-like utilities, you
1179 will use a DOS style batch script called @file{configure.bat}.  Invoke
1180 it as @code{configure winnt} from an MSDOS console window or from the
1181 program manager dialog box.  @file{configure.bat} assumes you have
1182 already installed and have in your path a Unix-like @file{sed} program
1183 which is used to create a working @file{Makefile} from @file{Makefile.in}.
1184
1185 @file{Makefile} uses the Microsoft Nmake program maintenance utility and
1186 the Visual C/C++ V8.00 compiler to build GNU CC.  You need only have the
1187 utilities @file{sed} and @file{touch} to use this installation method,
1188 which only automatically builds the compiler itself.  You must then
1189 examine what @file{fixinc.winnt} does, edit the header files by hand and
1190 build @file{libgcc.a} manually.
1191
1192 @item
1193 The second type of installation assumes you are running a Unix-like
1194 shell, have a complete suite of Unix-like utilities in your path, and
1195 have a previous version of GNU CC already installed, either through
1196 building it via the above installation method or acquiring a pre-built
1197 binary.  In this case, use the @file{configure} script in the normal
1198 fashion.
1199 @end enumerate
1200
1201 @item i860-intel-osf1
1202 This is the Paragon.
1203 @ifset INSTALLONLY
1204 If you have version 1.0 of the operating system, you need to take
1205 special steps to build GNU CC due to peculiarities of the system.  Newer
1206 system versions have no problem.  See the section `Installation Problems'
1207 in the GNU CC Manual.
1208 @end ifset
1209 @ifclear INSTALLONLY
1210 If you have version 1.0 of the operating system,
1211 see @ref{Installation Problems}, for special things you need to do to
1212 compensate for peculiarities in the system.
1213 @end ifclear
1214
1215 @item *-lynx-lynxos
1216 LynxOS 2.2 and earlier comes with GNU CC 1.x already installed as
1217 @file{/bin/gcc}.  You should compile with this instead of @file{/bin/cc}.
1218 You can tell GNU CC to use the GNU assembler and linker, by specifying
1219 @samp{--with-gnu-as --with-gnu-ld} when configuring.  These will produce
1220 COFF format object files and executables;  otherwise GNU CC will use the
1221 installed tools, which produce @file{a.out} format executables.
1222
1223 @item m32r-*-elf
1224 Mitsubishi M32R processor.
1225 This configuration is intended for embedded systems.
1226
1227 @item m68000-hp-bsd
1228 HP 9000 series 200 running BSD.  Note that the C compiler that comes
1229 with this system cannot compile GNU CC; contact @code{law@@cygnus.com}
1230 to get binaries of GNU CC for bootstrapping.
1231
1232 @item m68k-altos
1233 Altos 3068.  You must use the GNU assembler, linker and debugger.
1234 Also, you must fix a kernel bug.  Details in the file @file{README.ALTOS}.
1235
1236 @item m68k-apple-aux
1237 Apple Macintosh running A/UX.
1238 You may configure GCC  to use either the system assembler and
1239 linker or the GNU assembler and linker.  You should use the GNU configuration
1240 if you can, especially if you also want to use GNU C++.  You enabled
1241 that configuration with + the @samp{--with-gnu-as} and @samp{--with-gnu-ld}
1242 options to @code{configure}.
1243
1244 Note the C compiler that comes
1245 with this system cannot compile GNU CC.  You can find binaries of GNU CC
1246 for bootstrapping on @code{jagubox.gsfc.nasa.gov}.
1247 You will also a patched version of @file{/bin/ld} there that
1248 raises some of the arbitrary limits found in the original.
1249
1250 @item m68k-att-sysv
1251 AT&T 3b1, a.k.a. 7300 PC.  Special procedures are needed to compile GNU
1252 CC with this machine's standard C compiler, due to bugs in that
1253 compiler.  You can bootstrap it more easily with
1254 previous versions of GNU CC if you have them.
1255
1256 Installing GNU CC on the 3b1 is difficult if you do not already have
1257 GNU CC running, due to bugs in the installed C compiler.  However,
1258 the following procedure might work.  We are unable to test it.
1259
1260 @enumerate
1261 @item
1262 Comment out the @samp{#include "config.h"} line near the start of
1263 @file{cccp.c} and do @samp{make cpp}.  This makes a preliminary version
1264 of GNU cpp.
1265
1266 @item
1267 Save the old @file{/lib/cpp} and copy the preliminary GNU cpp to that
1268 file name.
1269
1270 @item
1271 Undo your change in @file{cccp.c}, or reinstall the original version,
1272 and do @samp{make cpp} again.
1273
1274 @item
1275 Copy this final version of GNU cpp into @file{/lib/cpp}.
1276
1277 @findex obstack_free
1278 @item
1279 Replace every occurrence of @code{obstack_free} in the file
1280 @file{tree.c} with @code{_obstack_free}.
1281
1282 @item
1283 Run @code{make} to get the first-stage GNU CC.
1284
1285 @item
1286 Reinstall the original version of @file{/lib/cpp}.
1287
1288 @item
1289 Now you can compile GNU CC with itself and install it in the normal
1290 fashion.
1291 @end enumerate
1292
1293 @item m68k-bull-sysv
1294 Bull DPX/2 series 200 and 300 with BOS-2.00.45 up to BOS-2.01. GNU CC works
1295 either with native assembler or GNU assembler. You can use
1296 GNU assembler with native coff generation by providing @samp{--with-gnu-as} to
1297 the configure script or use GNU assembler with dbx-in-coff encapsulation
1298 by providing @samp{--with-gnu-as --stabs}. For any problem with native
1299 assembler or for availability of the DPX/2 port of GAS, contact
1300 @code{F.Pierresteguy@@frcl.bull.fr}.
1301
1302 @item m68k-crds-unox
1303 Use @samp{configure unos} for building on Unos.
1304
1305 The Unos assembler is named @code{casm} instead of @code{as}.  For some
1306 strange reason linking @file{/bin/as} to @file{/bin/casm} changes the
1307 behavior, and does not work.  So, when installing GNU CC, you should
1308 install the following script as @file{as} in the subdirectory where
1309 the passes of GCC are installed:
1310
1311 @example
1312 #!/bin/sh
1313 casm $*
1314 @end example
1315
1316 The default Unos library is named @file{libunos.a} instead of
1317 @file{libc.a}.  To allow GNU CC to function, either change all
1318 references to @samp{-lc} in @file{gcc.c} to @samp{-lunos} or link
1319 @file{/lib/libc.a} to @file{/lib/libunos.a}.
1320
1321 @cindex @code{alloca}, for Unos
1322 When compiling GNU CC with the standard compiler, to overcome bugs in
1323 the support of @code{alloca}, do not use @samp{-O} when making stage 2.
1324 Then use the stage 2 compiler with @samp{-O} to make the stage 3
1325 compiler.  This compiler will have the same characteristics as the usual
1326 stage 2 compiler on other systems.  Use it to make a stage 4 compiler
1327 and compare that with stage 3 to verify proper compilation.
1328
1329 (Perhaps simply defining @code{ALLOCA} in @file{x-crds} as described in
1330 the comments there will make the above paragraph superfluous.  Please
1331 inform us of whether this works.)
1332
1333 Unos uses memory segmentation instead of demand paging, so you will need
1334 a lot of memory.  5 Mb is barely enough if no other tasks are running.
1335 If linking @file{cc1} fails, try putting the object files into a library
1336 and linking from that library.
1337
1338 @item m68k-hp-hpux
1339 HP 9000 series 300 or 400 running HP-UX.  HP-UX version 8.0 has a bug in
1340 the assembler that prevents compilation of GNU CC.  To fix it, get patch
1341 PHCO_4484 from HP.
1342
1343 In addition, if you wish to use gas @samp{--with-gnu-as} you must use
1344 gas version 2.1 or later, and you must use the GNU linker version 2.1 or
1345 later.  Earlier versions of gas relied upon a program which converted the
1346 gas output into the native HP-UX format, but that program has not been
1347 kept up to date.  gdb does not understand that native HP-UX format, so
1348 you must use gas if you wish to use gdb.
1349
1350 @item m68k-sun
1351 Sun 3.  We do not provide a configuration file to use the Sun FPA by
1352 default, because programs that establish signal handlers for floating
1353 point traps inherently cannot work with the FPA.
1354
1355 See @ref{Sun Install}, for information on installing GNU CC on Sun
1356 systems.
1357
1358 @item m88k-*-svr3
1359 Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference port.
1360 These systems tend to use the Green Hills C, revision 1.8.5, as the
1361 standard C compiler.  There are apparently bugs in this compiler that
1362 result in object files differences between stage 2 and stage 3.  If this
1363 happens, make the stage 4 compiler and compare it to the stage 3
1364 compiler.  If the stage 3 and stage 4 object files are identical, this
1365 suggests you encountered a problem with the standard C compiler; the
1366 stage 3 and 4 compilers may be usable.
1367
1368 It is best, however, to use an older version of GNU CC for bootstrapping
1369 if you have one.
1370
1371 @item m88k-*-dgux
1372 Motorola m88k running DG/UX.  To build 88open BCS native or cross
1373 compilers on DG/UX, specify the configuration name as
1374 @samp{m88k-*-dguxbcs} and build in the 88open BCS software development
1375 environment.  To build ELF native or cross compilers on DG/UX, specify
1376 @samp{m88k-*-dgux} and build in the DG/UX ELF development environment.
1377 You set the software development environment by issuing
1378 @samp{sde-target} command and specifying either @samp{m88kbcs} or
1379 @samp{m88kdguxelf} as the operand.
1380
1381 If you do not specify a configuration name, @file{configure} guesses the
1382 configuration based on the current software development environment.
1383
1384 @item m88k-tektronix-sysv3
1385 Tektronix XD88 running UTekV 3.2e.  Do not turn on
1386 optimization while building stage1 if you bootstrap with
1387 the buggy Green Hills compiler.  Also, The bundled LAI
1388 System V NFS is buggy so if you build in an NFS mounted
1389 directory, start from a fresh reboot, or avoid NFS all together.
1390 Otherwise you may have trouble getting clean comparisons
1391 between stages.
1392
1393 @item mips-mips-bsd
1394 MIPS machines running the MIPS operating system in BSD mode.  It's
1395 possible that some old versions of the system lack the functions
1396 @code{memcpy}, @code{memcmp}, and @code{memset}.  If your system lacks
1397 these, you must remove or undo the definition of
1398 @code{TARGET_MEM_FUNCTIONS} in @file{mips-bsd.h}.
1399
1400 The MIPS C compiler needs to be told to increase its table size
1401 for switch statements with the @samp{-Wf,-XNg1500} option in
1402 order to compile @file{cp/parse.c}.  If you use the @samp{-O2}
1403 optimization option, you also need to use @samp{-Olimit 3000}.
1404 Both of these options are automatically generated in the
1405 @file{Makefile} that the shell script @file{configure} builds.
1406 If you override the @code{CC} make variable and use the MIPS
1407 compilers, you may need to add @samp{-Wf,-XNg1500 -Olimit 3000}.
1408
1409 @item mips-mips-riscos*
1410 The MIPS C compiler needs to be told to increase its table size
1411 for switch statements with the @samp{-Wf,-XNg1500} option in
1412 order to compile @file{cp/parse.c}.  If you use the @samp{-O2}
1413 optimization option, you also need to use @samp{-Olimit 3000}.
1414 Both of these options are automatically generated in the
1415 @file{Makefile} that the shell script @file{configure} builds.
1416 If you override the @code{CC} make variable and use the MIPS
1417 compilers, you may need to add @samp{-Wf,-XNg1500 -Olimit 3000}.
1418
1419 MIPS computers running RISC-OS can support four different
1420 personalities: default, BSD 4.3, System V.3, and System V.4
1421 (older versions of RISC-OS don't support V.4).  To configure GCC
1422 for these platforms use the following configurations:
1423
1424 @table @samp
1425 @item mips-mips-riscos@code{rev}
1426 Default configuration for RISC-OS, revision @code{rev}.
1427
1428 @item mips-mips-riscos@code{rev}bsd
1429 BSD 4.3 configuration for RISC-OS, revision @code{rev}.
1430
1431 @item mips-mips-riscos@code{rev}sysv4
1432 System V.4 configuration for RISC-OS, revision @code{rev}.
1433
1434 @item mips-mips-riscos@code{rev}sysv
1435 System V.3 configuration for RISC-OS, revision @code{rev}.
1436 @end table
1437
1438 The revision @code{rev} mentioned above is the revision of
1439 RISC-OS to use.  You must reconfigure GCC when going from a
1440 RISC-OS revision 4 to RISC-OS revision 5.  This has the effect of
1441 avoiding a linker
1442 @ifclear INSTALLONLY
1443 bug (see @ref{Installation Problems}, for more details).
1444 @end ifclear
1445 @ifset INSTALLONLY
1446 bug.
1447 @end ifset
1448
1449 @item mips-sgi-*
1450 In order to compile GCC on an SGI running IRIX 4, the "c.hdr.lib"
1451 option must be installed from the CD-ROM supplied from Silicon Graphics.
1452 This is found on the 2nd CD in release 4.0.1.
1453
1454 In order to compile GCC on an SGI running IRIX 5, the "compiler_dev.hdr"
1455 subsystem must be installed from the IDO CD-ROM supplied by Silicon
1456 Graphics.
1457
1458 @code{make compare} may fail on version 5 of IRIX unless you add
1459 @samp{-save-temps} to @code{CFLAGS}.  On these systems, the name of the
1460 assembler input file is stored in the object file, and that makes
1461 comparison fail if it differs between the @code{stage1} and
1462 @code{stage2} compilations.  The option @samp{-save-temps} forces a
1463 fixed name to be used for the assembler input file, instead of a
1464 randomly chosen name in @file{/tmp}.  Do not add @samp{-save-temps}
1465 unless the comparisons fail without that option.  If you do you
1466 @samp{-save-temps}, you will have to manually delete the @samp{.i} and
1467 @samp{.s} files after each series of compilations.
1468
1469 The MIPS C compiler needs to be told to increase its table size
1470 for switch statements with the @samp{-Wf,-XNg1500} option in
1471 order to compile @file{cp/parse.c}.  If you use the @samp{-O2}
1472 optimization option, you also need to use @samp{-Olimit 3000}.
1473 Both of these options are automatically generated in the
1474 @file{Makefile} that the shell script @file{configure} builds.
1475 If you override the @code{CC} make variable and use the MIPS
1476 compilers, you may need to add @samp{-Wf,-XNg1500 -Olimit 3000}.
1477
1478 On Irix version 4.0.5F, and perhaps on some other versions as well,
1479 there is an assembler bug that reorders instructions incorrectly.  To
1480 work around it, specify the target configuration
1481 @samp{mips-sgi-irix4loser}.  This configuration inhibits assembler
1482 optimization.
1483
1484 In a compiler configured with target @samp{mips-sgi-irix4}, you can turn
1485 off assembler optimization by using the @samp{-noasmopt} option.  This
1486 compiler option passes the option @samp{-O0} to the assembler, to
1487 inhibit reordering.
1488
1489 The @samp{-noasmopt} option can be useful for testing whether a problem
1490 is due to erroneous assembler reordering.  Even if a problem does not go
1491 away with @samp{-noasmopt}, it may still be due to assembler
1492 reordering---perhaps GNU CC itself was miscompiled as a result.
1493
1494 To enable debugging under Irix 5, you must use GNU as 2.5 or later,
1495 and use the @samp{--with-gnu-as} configure option when configuring gcc.
1496 GNU as is distributed as part of the binutils package.
1497
1498 @item mips-sony-sysv
1499 Sony MIPS NEWS.  This works in NEWSOS 5.0.1, but not in 5.0.2 (which
1500 uses ELF instead of COFF).  Support for 5.0.2 will probably be provided
1501 soon by volunteers.  In particular, the linker does not like the
1502 code generated by GCC when shared libraries are linked in.
1503
1504 @item ns32k-encore
1505 Encore ns32000 system.  Encore systems are supported only under BSD.
1506
1507 @item ns32k-*-genix
1508 National Semiconductor ns32000 system.  Genix has bugs in @code{alloca}
1509 and @code{malloc}; you must get the compiled versions of these from GNU
1510 Emacs.
1511
1512 @item ns32k-sequent
1513 Go to the Berkeley universe before compiling.
1514
1515 @item ns32k-utek
1516 UTEK ns32000 system (``merlin'').  The C compiler that comes with this
1517 system cannot compile GNU CC; contact @samp{tektronix!reed!mason} to get
1518 binaries of GNU CC for bootstrapping.
1519
1520 @item romp-*-aos
1521 @itemx romp-*-mach
1522 The only operating systems supported for the IBM RT PC are AOS and
1523 MACH.  GNU CC does not support AIX running on the RT.  We recommend you
1524 compile GNU CC with an earlier version of itself; if you compile GNU CC
1525 with @code{hc}, the Metaware compiler, it will work, but you will get
1526 mismatches between the stage 2 and stage 3 compilers in various files.
1527 These errors are minor differences in some floating-point constants and
1528 can be safely ignored; the stage 3 compiler is correct.
1529
1530 @item rs6000-*-aix
1531 @itemx powerpc-*-aix
1532 Various early versions of each release of the IBM XLC compiler will not
1533 bootstrap GNU CC.  Symptoms include differences between the stage2 and
1534 stage3 object files, and errors when compiling @file{libgcc.a} or
1535 @file{enquire}.  Known problematic releases include: xlc-1.2.1.8,
1536 xlc-1.3.0.0 (distributed with AIX 3.2.5), and xlc-1.3.0.19.  Both
1537 xlc-1.2.1.28 and xlc-1.3.0.24 (PTF 432238) are known to produce working
1538 versions of GNU CC, but most other recent releases correctly bootstrap
1539 GNU CC.
1540
1541 Release 4.3.0 of AIX and ones prior to AIX 3.2.4 include a version of
1542 the IBM assembler which does not accept debugging directives: assembler
1543 updates are available as PTFs.  Also, if you are using AIX 3.2.5 or
1544 greater and the GNU assembler, you must have a version modified after
1545 October 16th, 1995 in order for the GNU C compiler to build.  See the
1546 file @file{README.RS6000} for more details on any of these problems.
1547
1548 GNU CC does not yet support the 64-bit PowerPC instructions.
1549
1550 Objective C does not work on this architecture because it makes assumptions
1551 that are incompatible with the calling conventions.
1552
1553 AIX on the RS/6000 provides support (NLS) for environments outside of
1554 the United States.  Compilers and assemblers use NLS to support
1555 locale-specific representations of various objects including
1556 floating-point numbers ("." vs "," for separating decimal fractions).
1557 There have been problems reported where the library linked with GNU CC
1558 does not produce the same floating-point formats that the assembler
1559 accepts.  If you have this problem, set the LANG environment variable to
1560 "C" or "En_US".
1561
1562 Due to changes in the way that GNU CC invokes the binder (linker) for AIX
1563 4.1, you may now receive warnings of duplicate symbols from the link step
1564 that were not reported before.  The assembly files generated by GNU CC for
1565 AIX have always included multiple symbol definitions for certain global
1566 variable and function declarations in the original program.  The warnings
1567 should not prevent the linker from producing a correct library or runnable
1568 executable.
1569
1570 By default, AIX 4.1 produces code that can be used on either Power or
1571 PowerPC processors.
1572
1573 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1574 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1575
1576 @item powerpc-*-elf
1577 @itemx powerpc-*-sysv4
1578 PowerPC system in big endian mode, running System V.4.
1579
1580 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1581 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1582
1583 @item powerpc-*-linux-gnu
1584 PowerPC system in big endian mode, running the Linux-based GNU system.
1585
1586 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1587 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1588
1589 @item powerpc-*-eabiaix
1590 Embedded PowerPC system in big endian mode with -mcall-aix selected as
1591 the default.
1592
1593 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1594 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1595
1596 @item powerpc-*-eabisim
1597 Embedded PowerPC system in big endian mode for use in running under the
1598 PSIM simulator.
1599
1600 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1601 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1602
1603 @item powerpc-*-eabi
1604 Embedded PowerPC system in big endian mode.
1605
1606 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1607 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1608
1609 @item powerpcle-*-elf
1610 @itemx powerpcle-*-sysv4
1611 PowerPC system in little endian mode, running System V.4.
1612
1613 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1614 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1615
1616 @item powerpcle-*-solaris2*
1617 PowerPC system in little endian mode, running Solaris 2.5.1 or higher.
1618
1619 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1620 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1621 Beta versions of the Sun 4.0 compiler do not seem to be able to build
1622 GNU CC correctly.  There are also problems with the host assembler and
1623 linker that are fixed by using the GNU versions of these tools.
1624
1625 @item powerpcle-*-eabisim
1626 Embedded PowerPC system in little endian mode for use in running under
1627 the PSIM simulator.
1628
1629 @itemx powerpcle-*-eabi
1630 Embedded PowerPC system in little endian mode.
1631
1632 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1633 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1634
1635 @item powerpcle-*-winnt
1636 @itemx powerpcle-*-pe
1637 PowerPC system in little endian mode running Windows NT.
1638
1639 You can specify a default version for the @samp{-mcpu=}@var{cpu_type}
1640 switch by using the configure option @samp{--with-cpu-}@var{cpu_type}.
1641
1642 @item vax-dec-ultrix
1643 Don't try compiling with Vax C (@code{vcc}).  It produces incorrect code
1644 in some cases (for example, when @code{alloca} is used).
1645
1646 Meanwhile, compiling @file{cp/parse.c} with pcc does not work because of
1647 an internal table size limitation in that compiler.  To avoid this
1648 problem, compile just the GNU C compiler first, and use it to recompile
1649 building all the languages that you want to run.
1650
1651 @item sparc-sun-*
1652 See @ref{Sun Install}, for information on installing GNU CC on Sun
1653 systems.
1654
1655 @item vax-dec-vms
1656 See @ref{VMS Install}, for details on how to install GNU CC on VMS.
1657
1658 @item we32k-*-*
1659 These computers are also known as the 3b2, 3b5, 3b20 and other similar
1660 names.  (However, the 3b1 is actually a 68000; see
1661 @ref{Configurations}.)
1662
1663 Don't use @samp{-g} when compiling with the system's compiler.  The
1664 system's linker seems to be unable to handle such a large program with
1665 debugging information.
1666
1667 The system's compiler runs out of capacity when compiling @file{stmt.c}
1668 in GNU CC.  You can work around this by building @file{cpp} in GNU CC
1669 first, then use that instead of the system's preprocessor with the
1670 system's C compiler to compile @file{stmt.c}.  Here is how:
1671
1672 @smallexample
1673 mv /lib/cpp /lib/cpp.att
1674 cp cpp /lib/cpp.gnu
1675 echo '/lib/cpp.gnu -traditional $@{1+"$@@"@}' > /lib/cpp
1676 chmod +x /lib/cpp
1677 @end smallexample
1678
1679 The system's compiler produces bad code for some of the GNU CC
1680 optimization files.  So you must build the stage 2 compiler without
1681 optimization.  Then build a stage 3 compiler with optimization.
1682 That executable should work.  Here are the necessary commands:
1683
1684 @smallexample
1685 make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g"
1686 make stage2
1687 make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O"
1688 @end smallexample
1689
1690 You may need to raise the ULIMIT setting to build a C++ compiler,
1691 as the file @file{cc1plus} is larger than one megabyte.
1692 @end table
1693
1694 @node Other Dir
1695 @section Compilation in a Separate Directory
1696 @cindex other directory, compilation in
1697 @cindex compilation in a separate directory
1698 @cindex separate directory, compilation in
1699
1700 If you wish to build the object files and executables in a directory
1701 other than the one containing the source files, here is what you must
1702 do differently:
1703
1704 @enumerate
1705 @item
1706 Make sure you have a version of Make that supports the @code{VPATH}
1707 feature.  (GNU Make supports it, as do Make versions on most BSD
1708 systems.)
1709
1710 @item
1711 If you have ever run @file{configure} in the source directory, you must undo
1712 the configuration.  Do this by running:
1713
1714 @example
1715 make distclean
1716 @end example
1717
1718 @item
1719 Go to the directory in which you want to build the compiler before
1720 running @file{configure}:
1721
1722 @example
1723 mkdir gcc-sun3
1724 cd gcc-sun3
1725 @end example
1726
1727 On systems that do not support symbolic links, this directory must be
1728 on the same file system as the source code directory.
1729
1730 @item
1731 Specify where to find @file{configure} when you run it:
1732
1733 @example
1734 ../gcc/configure @dots{}
1735 @end example
1736
1737 This also tells @code{configure} where to find the compiler sources;
1738 @code{configure} takes the directory from the file name that was used to
1739 invoke it.  But if you want to be sure, you can specify the source
1740 directory with the @samp{--srcdir} option, like this:
1741
1742 @example
1743 ../gcc/configure --srcdir=../gcc @var{other options}
1744 @end example
1745
1746 The directory you specify with @samp{--srcdir} need not be the same
1747 as the one that @code{configure} is found in.
1748 @end enumerate
1749
1750 Now, you can run @code{make} in that directory.  You need not repeat the
1751 configuration steps shown above, when ordinary source files change.  You
1752 must, however, run @code{configure} again when the configuration files
1753 change, if your system does not support symbolic links.
1754
1755 @node Cross-Compiler
1756 @section Building and Installing a Cross-Compiler
1757 @cindex cross-compiler, installation
1758
1759 GNU CC can function as a cross-compiler for many machines, but not all.
1760
1761 @itemize @bullet
1762 @item
1763 Cross-compilers for the Mips as target using the Mips assembler
1764 currently do not work, because the auxiliary programs
1765 @file{mips-tdump.c} and @file{mips-tfile.c} can't be compiled on
1766 anything but a Mips.  It does work to cross compile for a Mips
1767 if you use the GNU assembler and linker.
1768
1769 @item
1770 Cross-compilers between machines with different floating point formats
1771 have not all been made to work.  GNU CC now has a floating point
1772 emulator with which these can work, but each target machine description
1773 needs to be updated to take advantage of it.
1774
1775 @item
1776 Cross-compilation between machines of different word sizes is
1777 somewhat problematic and sometimes does not work.
1778 @end itemize
1779
1780 Since GNU CC generates assembler code, you probably need a
1781 cross-assembler that GNU CC can run, in order to produce object files.
1782 If you want to link on other than the target machine, you need a
1783 cross-linker as well.  You also need header files and libraries suitable
1784 for the target machine that you can install on the host machine.
1785
1786 @menu
1787 * Steps of Cross::      Using a cross-compiler involves several steps
1788                           that may be carried out on different machines.
1789 * Configure Cross::     Configuring a cross-compiler.
1790 * Tools and Libraries:: Where to put the linker and assembler, and the C library.
1791 * Cross Headers::       Finding and installing header files
1792                           for a cross-compiler.
1793 * Cross Runtime::       Supplying arithmetic runtime routines (@file{libgcc1.a}).
1794 * Build Cross::         Actually compiling the cross-compiler.
1795 @end menu
1796
1797 @node Steps of Cross
1798 @subsection Steps of Cross-Compilation
1799
1800 To compile and run a program using a cross-compiler involves several
1801 steps:
1802
1803 @itemize @bullet
1804 @item
1805 Run the cross-compiler on the host machine to produce assembler files
1806 for the target machine.  This requires header files for the target
1807 machine.
1808
1809 @item
1810 Assemble the files produced by the cross-compiler.  You can do this
1811 either with an assembler on the target machine, or with a
1812 cross-assembler on the host machine.
1813
1814 @item
1815 Link those files to make an executable.  You can do this either with a
1816 linker on the target machine, or with a cross-linker on the host
1817 machine.  Whichever machine you use, you need libraries and certain
1818 startup files (typically @file{crt@dots{}.o}) for the target machine.
1819 @end itemize
1820
1821 It is most convenient to do all of these steps on the same host machine,
1822 since then you can do it all with a single invocation of GNU CC.  This
1823 requires a suitable cross-assembler and cross-linker.  For some targets,
1824 the GNU assembler and linker are available.
1825
1826 @node Configure Cross
1827 @subsection Configuring a Cross-Compiler
1828
1829 To build GNU CC as a cross-compiler, you start out by running
1830 @file{configure}.  Use the @samp{--target=@var{target}} to specify the
1831 target type.  If @file{configure} was unable to correctly identify the
1832 system you are running on, also specify the @samp{--build=@var{build}}
1833 option.  For example, here is how to configure for a cross-compiler that
1834 produces code for an HP 68030 system running BSD on a system that
1835 @file{configure} can correctly identify:
1836
1837 @smallexample
1838 ./configure --target=m68k-hp-bsd4.3
1839 @end smallexample
1840
1841 @node Tools and Libraries
1842 @subsection Tools and Libraries for a Cross-Compiler
1843
1844 If you have a cross-assembler and cross-linker available, you should
1845 install them now.  Put them in the directory
1846 @file{/usr/local/@var{target}/bin}.  Here is a table of the tools
1847 you should put in this directory:
1848
1849 @table @file
1850 @item as
1851 This should be the cross-assembler.
1852
1853 @item ld
1854 This should be the cross-linker.
1855
1856 @item ar
1857 This should be the cross-archiver: a program which can manipulate
1858 archive files (linker libraries) in the target machine's format.
1859
1860 @item ranlib
1861 This should be a program to construct a symbol table in an archive file.
1862 @end table
1863
1864 The installation of GNU CC will find these programs in that directory,
1865 and copy or link them to the proper place to for the cross-compiler to
1866 find them when run later.
1867
1868 The easiest way to provide these files is to build the Binutils package
1869 and GAS.  Configure them with the same @samp{--host} and @samp{--target}
1870 options that you use for configuring GNU CC, then build and install
1871 them.  They install their executables automatically into the proper
1872 directory.  Alas, they do not support all the targets that GNU CC
1873 supports.
1874
1875 If you want to install libraries to use with the cross-compiler, such as
1876 a standard C library, put them in the directory
1877 @file{/usr/local/@var{target}/lib}; installation of GNU CC copies
1878 all the files in that subdirectory into the proper place for GNU CC to
1879 find them and link with them.  Here's an example of copying some
1880 libraries from a target machine:
1881
1882 @example
1883 ftp @var{target-machine}
1884 lcd /usr/local/@var{target}/lib
1885 cd /lib
1886 get libc.a
1887 cd /usr/lib
1888 get libg.a
1889 get libm.a
1890 quit
1891 @end example
1892
1893 @noindent
1894 The precise set of libraries you'll need, and their locations on
1895 the target machine, vary depending on its operating system.
1896
1897 @cindex start files
1898 Many targets require ``start files'' such as @file{crt0.o} and
1899 @file{crtn.o} which are linked into each executable; these too should be
1900 placed in @file{/usr/local/@var{target}/lib}.  There may be several
1901 alternatives for @file{crt0.o}, for use with profiling or other
1902 compilation options.  Check your target's definition of
1903 @code{STARTFILE_SPEC} to find out what start files it uses.
1904 Here's an example of copying these files from a target machine:
1905
1906 @example
1907 ftp @var{target-machine}
1908 lcd /usr/local/@var{target}/lib
1909 prompt
1910 cd /lib
1911 mget *crt*.o
1912 cd /usr/lib
1913 mget *crt*.o
1914 quit
1915 @end example
1916
1917 @node Cross Runtime
1918 @subsection @file{libgcc.a} and Cross-Compilers
1919
1920 Code compiled by GNU CC uses certain runtime support functions
1921 implicitly.  Some of these functions can be compiled successfully with
1922 GNU CC itself, but a few cannot be.  These problem functions are in the
1923 source file @file{libgcc1.c}; the library made from them is called
1924 @file{libgcc1.a}.
1925
1926 When you build a native compiler, these functions are compiled with some
1927 other compiler--the one that you use for bootstrapping GNU CC.
1928 Presumably it knows how to open code these operations, or else knows how
1929 to call the run-time emulation facilities that the machine comes with.
1930 But this approach doesn't work for building a cross-compiler.  The
1931 compiler that you use for building knows about the host system, not the
1932 target system.
1933
1934 So, when you build a cross-compiler you have to supply a suitable
1935 library @file{libgcc1.a} that does the job it is expected to do.
1936
1937 To compile @file{libgcc1.c} with the cross-compiler itself does not
1938 work.  The functions in this file are supposed to implement arithmetic
1939 operations that GNU CC does not know how to open code for your target
1940 machine.  If these functions are compiled with GNU CC itself, they
1941 will compile into infinite recursion.
1942
1943 On any given target, most of these functions are not needed.  If GNU CC
1944 can open code an arithmetic operation, it will not call these functions
1945 to perform the operation.  It is possible that on your target machine,
1946 none of these functions is needed.  If so, you can supply an empty
1947 library as @file{libgcc1.a}.
1948
1949 Many targets need library support only for multiplication and division.
1950 If you are linking with a library that contains functions for
1951 multiplication and division, you can tell GNU CC to call them directly
1952 by defining the macros @code{MULSI3_LIBCALL}, and the like.  These
1953 macros need to be defined in the target description macro file.  For
1954 some targets, they are defined already.  This may be sufficient to
1955 avoid the need for libgcc1.a; if so, you can supply an empty library.
1956
1957 Some targets do not have floating point instructions; they need other
1958 functions in @file{libgcc1.a}, which do floating arithmetic.
1959 Recent versions of GNU CC have a file which emulates floating point.
1960 With a certain amount of work, you should be able to construct a
1961 floating point emulator that can be used as @file{libgcc1.a}.  Perhaps
1962 future versions will contain code to do this automatically and
1963 conveniently.  That depends on whether someone wants to implement it.
1964
1965 Some embedded targets come with all the necessary @file{libgcc1.a}
1966 routines written in C or assembler.  These targets build
1967 @file{libgcc1.a} automatically and you do not need to do anything
1968 special for them.  Other embedded targets do not need any
1969 @file{libgcc1.a} routines since all the necessary operations are
1970 supported by the hardware.
1971
1972 If your target system has another C compiler, you can configure GNU CC
1973 as a native compiler on that machine, build just @file{libgcc1.a} with
1974 @samp{make libgcc1.a} on that machine, and use the resulting file with
1975 the cross-compiler.  To do this, execute the following on the target
1976 machine:
1977
1978 @example
1979 cd @var{target-build-dir}
1980 ./configure --host=sparc --target=sun3
1981 make libgcc1.a
1982 @end example
1983
1984 @noindent
1985 And then this on the host machine:
1986
1987 @example
1988 ftp @var{target-machine}
1989 binary
1990 cd @var{target-build-dir}
1991 get libgcc1.a
1992 quit
1993 @end example
1994
1995 Another way to provide the functions you need in @file{libgcc1.a} is to
1996 define the appropriate @code{perform_@dots{}} macros for those
1997 functions.  If these definitions do not use the C arithmetic operators
1998 that they are meant to implement, you should be able to compile them
1999 with the cross-compiler you are building.  (If these definitions already
2000 exist for your target file, then you are all set.)
2001
2002 To build @file{libgcc1.a} using the perform macros, use
2003 @samp{LIBGCC1=libgcc1.a OLDCC=./xgcc} when building the compiler.
2004 Otherwise, you should place your replacement library under the name
2005 @file{libgcc1.a} in the directory in which you will build the
2006 cross-compiler, before you run @code{make}.
2007
2008 @node Cross Headers
2009 @subsection Cross-Compilers and Header Files
2010
2011 If you are cross-compiling a standalone program or a program for an
2012 embedded system, then you may not need any header files except the few
2013 that are part of GNU CC (and those of your program).  However, if you
2014 intend to link your program with a standard C library such as
2015 @file{libc.a}, then you probably need to compile with the header files
2016 that go with the library you use.
2017
2018 The GNU C compiler does not come with these files, because (1) they are
2019 system-specific, and (2) they belong in a C library, not in a compiler.
2020
2021 If the GNU C library supports your target machine, then you can get the
2022 header files from there (assuming you actually use the GNU library when
2023 you link your program).
2024
2025 If your target machine comes with a C compiler, it probably comes with
2026 suitable header files also.  If you make these files accessible from the host
2027 machine, the cross-compiler can use them also.
2028
2029 Otherwise, you're on your own in finding header files to use when
2030 cross-compiling.
2031
2032 When you have found suitable header files, put them in the directory
2033 @file{/usr/local/@var{target}/include}, before building the cross
2034 compiler.  Then installation will run fixincludes properly and install
2035 the corrected versions of the header files where the compiler will use
2036 them.
2037
2038 Provide the header files before you build the cross-compiler, because
2039 the build stage actually runs the cross-compiler to produce parts of
2040 @file{libgcc.a}.  (These are the parts that @emph{can} be compiled with
2041 GNU CC.)  Some of them need suitable header files.
2042
2043 Here's an example showing how to copy the header files from a target
2044 machine.  On the target machine, do this:
2045
2046 @example
2047 (cd /usr/include; tar cf - .) > tarfile
2048 @end example
2049
2050 Then, on the host machine, do this:
2051
2052 @example
2053 ftp @var{target-machine}
2054 lcd /usr/local/@var{target}/include
2055 get tarfile
2056 quit
2057 tar xf tarfile
2058 @end example
2059
2060 @node Build Cross
2061 @subsection Actually Building the Cross-Compiler
2062
2063 Now you can proceed just as for compiling a single-machine compiler
2064 through the step of building stage 1.  If you have not provided some
2065 sort of @file{libgcc1.a}, then compilation will give up at the point
2066 where it needs that file, printing a suitable error message.  If you
2067 do provide @file{libgcc1.a}, then building the compiler will automatically
2068 compile and link a test program called @file{libgcc1-test}; if you get
2069 errors in the linking, it means that not all of the necessary routines
2070 in @file{libgcc1.a} are available.
2071
2072 You must provide the header file @file{float.h}.  One way to do this is
2073 to compile @file{enquire} and run it on your target machine.  The job of
2074 @file{enquire} is to run on the target machine and figure out by
2075 experiment the nature of its floating point representation.
2076 @file{enquire} records its findings in the header file @file{float.h}.
2077 If you can't produce this file by running @file{enquire} on the target
2078 machine, then you will need to come up with a suitable @file{float.h} in
2079 some other way (or else, avoid using it in your programs).
2080
2081 Do not try to build stage 2 for a cross-compiler.  It doesn't work to
2082 rebuild GNU CC as a cross-compiler using the cross-compiler, because
2083 that would produce a program that runs on the target machine, not on the
2084 host.  For example, if you compile a 386-to-68030 cross-compiler with
2085 itself, the result will not be right either for the 386 (because it was
2086 compiled into 68030 code) or for the 68030 (because it was configured
2087 for a 386 as the host).  If you want to compile GNU CC into 68030 code,
2088 whether you compile it on a 68030 or with a cross-compiler on a 386, you
2089 must specify a 68030 as the host when you configure it.
2090
2091 To install the cross-compiler, use @samp{make install}, as usual.
2092
2093 @node Sun Install
2094 @section Installing GNU CC on the Sun
2095 @cindex Sun installation
2096 @cindex installing GNU CC on the Sun
2097
2098 On Solaris, do not use the linker or other tools in
2099 @file{/usr/ucb} to build GNU CC.  Use @code{/usr/ccs/bin}.
2100
2101 If the assembler reports @samp{Error: misaligned data} when bootstrapping,
2102 you are probably using an obsolete version of the GNU assembler.  Upgrade
2103 to the latest version of GNU @code{binutils}, or use the Solaris assembler.
2104
2105 Make sure the environment variable @code{FLOAT_OPTION} is not set when
2106 you compile @file{libgcc.a}.  If this option were set to @code{f68881}
2107 when @file{libgcc.a} is compiled, the resulting code would demand to be
2108 linked with a special startup file and would not link properly without
2109 special pains.
2110
2111 @cindex @code{alloca}, for SunOS
2112 There is a bug in @code{alloca} in certain versions of the Sun library.
2113 To avoid this bug, install the binaries of GNU CC that were compiled by
2114 GNU CC.  They use @code{alloca} as a built-in function and never the one
2115 in the library.
2116
2117 Some versions of the Sun compiler crash when compiling GNU CC.  The
2118 problem is a segmentation fault in cpp.  This problem seems to be due to
2119 the bulk of data in the environment variables.  You may be able to avoid
2120 it by using the following command to compile GNU CC with Sun CC:
2121
2122 @example
2123 make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
2124 @end example
2125
2126 SunOS 4.1.3 and 4.1.3_U1 have bugs that can cause intermittent core
2127 dumps when compiling GNU CC.  A common symptom is an
2128 internal compiler error which does not recur if you run it again.
2129 To fix the problem, install Sun recommended patch 100726 (for SunOS 4.1.3)
2130 or 101508 (for SunOS 4.1.3_U1), or upgrade to a later SunOS release.
2131
2132 @node VMS Install
2133 @section Installing GNU CC on VMS
2134 @cindex VMS installation
2135 @cindex installing GNU CC on VMS
2136
2137 The VMS version of GNU CC is distributed in a backup saveset containing
2138 both source code and precompiled binaries.
2139
2140 To install the @file{gcc} command so you can use the compiler easily, in
2141 the same manner as you use the VMS C compiler, you must install the VMS CLD
2142 file for GNU CC as follows:
2143
2144 @enumerate
2145 @item
2146 Define the VMS logical names @samp{GNU_CC} and @samp{GNU_CC_INCLUDE}
2147 to point to the directories where the GNU CC executables
2148 (@file{gcc-cpp.exe}, @file{gcc-cc1.exe}, etc.) and the C include files are
2149 kept respectively.  This should be done with the commands:@refill
2150
2151 @smallexample
2152 $ assign /system /translation=concealed -
2153   disk:[gcc.] gnu_cc
2154 $ assign /system /translation=concealed -
2155   disk:[gcc.include.] gnu_cc_include
2156 @end smallexample
2157
2158 @noindent
2159 with the appropriate disk and directory names.  These commands can be
2160 placed in your system startup file so they will be executed whenever
2161 the machine is rebooted.  You may, if you choose, do this via the
2162 @file{GCC_INSTALL.COM} script in the @file{[GCC]} directory.
2163
2164 @item
2165 Install the @file{GCC} command with the command line:
2166
2167 @smallexample
2168 $ set command /table=sys$common:[syslib]dcltables -
2169   /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
2170 $ install replace sys$common:[syslib]dcltables
2171 @end smallexample
2172
2173 @item
2174 To install the help file, do the following:
2175
2176 @smallexample
2177 $ library/help sys$library:helplib.hlb gcc.hlp
2178 @end smallexample
2179
2180 @noindent
2181 Now you can invoke the compiler with a command like @samp{gcc /verbose
2182 file.c}, which is equivalent to the command @samp{gcc -v -c file.c} in
2183 Unix.
2184 @end enumerate
2185
2186 If you wish to use GNU C++ you must first install GNU CC, and then
2187 perform the following steps:
2188
2189 @enumerate
2190 @item
2191 Define the VMS logical name @samp{GNU_GXX_INCLUDE} to point to the
2192 directory where the preprocessor will search for the C++ header files.
2193 This can be done with the command:@refill
2194
2195 @smallexample
2196 $ assign /system /translation=concealed -
2197   disk:[gcc.gxx_include.] gnu_gxx_include
2198 @end smallexample
2199
2200 @noindent
2201 with the appropriate disk and directory name.  If you are going to be
2202 using a C++ runtime library, this is where its install procedure will install
2203 its header files.
2204
2205 @item
2206 Obtain the file @file{gcc-cc1plus.exe}, and place this in the same
2207 directory that @file{gcc-cc1.exe} is kept.
2208
2209 The GNU C++ compiler can be invoked with a command like @samp{gcc /plus
2210 /verbose file.cc}, which is equivalent to the command @samp{g++ -v -c
2211 file.cc} in Unix.
2212 @end enumerate
2213
2214 We try to put corresponding binaries and sources on the VMS distribution
2215 tape.  But sometimes the binaries will be from an older version than the
2216 sources, because we don't always have time to update them.  (Use the
2217 @samp{/version} option to determine the version number of the binaries and
2218 compare it with the source file @file{version.c} to tell whether this is
2219 so.)  In this case, you should use the binaries you get to recompile the
2220 sources.  If you must recompile, here is how:
2221
2222 @enumerate
2223 @item
2224 Execute the command procedure @file{vmsconfig.com} to set up the files
2225 @file{tm.h}, @file{config.h}, @file{aux-output.c}, and @file{md.}, and
2226 to create files @file{tconfig.h} and @file{hconfig.h}.  This procedure
2227 also creates several linker option files used by @file{make-cc1.com} and
2228 a data file used by @file{make-l2.com}.@refill
2229
2230 @smallexample
2231 $ @@vmsconfig.com
2232 @end smallexample
2233
2234 @item
2235 Setup the logical names and command tables as defined above.  In
2236 addition, define the VMS logical name @samp{GNU_BISON} to point at the
2237 to the directories where the Bison executable is kept.  This should be
2238 done with the command:@refill
2239
2240 @smallexample
2241 $ assign /system /translation=concealed -
2242   disk:[bison.] gnu_bison
2243 @end smallexample
2244
2245 You may, if you choose, use the @file{INSTALL_BISON.COM} script in the
2246 @file{[BISON]} directory.
2247
2248 @item
2249 Install the @samp{BISON} command with the command line:@refill
2250
2251 @smallexample
2252 $ set command /table=sys$common:[syslib]dcltables -
2253   /output=sys$common:[syslib]dcltables -
2254   gnu_bison:[000000]bison
2255 $ install replace sys$common:[syslib]dcltables
2256 @end smallexample
2257
2258 @item
2259 Type @samp{@@make-gcc} to recompile everything (alternatively, submit
2260 the file @file{make-gcc.com} to a batch queue).  If you wish to build
2261 the GNU C++ compiler as well as the GNU CC compiler, you must first edit
2262 @file{make-gcc.com} and follow the instructions that appear in the
2263 comments.@refill
2264
2265 @item
2266 In order to use GCC, you need a library of functions which GCC compiled code
2267 will call to perform certain tasks, and these functions are defined in the
2268 file @file{libgcc2.c}.  To compile this you should use the command procedure
2269 @file{make-l2.com}, which will generate the library @file{libgcc2.olb}.
2270 @file{libgcc2.olb} should be built using the compiler built from
2271 the same distribution that @file{libgcc2.c} came from, and
2272 @file{make-gcc.com} will automatically do all of this for you.
2273
2274 To install the library, use the following commands:@refill
2275
2276 @smallexample
2277 $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
2278 $ library gnu_cc:[000000]gcclib/delete=L_*
2279 $ library libgcc2/extract=*/output=libgcc2.obj
2280 $ library gnu_cc:[000000]gcclib libgcc2.obj
2281 @end smallexample
2282
2283 The first command simply removes old modules that will be replaced with
2284 modules from @file{libgcc2} under different module names.  The modules
2285 @code{new} and @code{eprintf} may not actually be present in your
2286 @file{gcclib.olb}---if the VMS librarian complains about those modules
2287 not being present, simply ignore the message and continue on with the
2288 next command.  The second command removes the modules that came from the
2289 previous version of the library @file{libgcc2.c}.
2290
2291 Whenever you update the compiler on your system, you should also update the
2292 library with the above procedure.
2293
2294 @item
2295 You may wish to build GCC in such a way that no files are written to the
2296 directory where the source files reside.  An example would be the when
2297 the source files are on a read-only disk.  In these cases, execute the
2298 following DCL commands (substituting your actual path names):
2299
2300 @smallexample
2301 $ assign dua0:[gcc.build_dir.]/translation=concealed, -
2302          dua1:[gcc.source_dir.]/translation=concealed  gcc_build
2303 $ set default gcc_build:[000000]
2304 @end smallexample
2305
2306 @noindent
2307 where the directory @file{dua1:[gcc.source_dir]} contains the source
2308 code, and the directory @file{dua0:[gcc.build_dir]} is meant to contain
2309 all of the generated object files and executables.  Once you have done
2310 this, you can proceed building GCC as described above.  (Keep in mind
2311 that @file{gcc_build} is a rooted logical name, and thus the device
2312 names in each element of the search list must be an actual physical
2313 device name rather than another rooted logical name).
2314
2315 @item
2316 @strong{If you are building GNU CC with a previous version of GNU CC,
2317 you also should check to see that you have the newest version of the
2318 assembler}.  In particular, GNU CC version 2 treats global constant
2319 variables slightly differently from GNU CC version 1, and GAS version
2320 1.38.1 does not have the patches required to work with GCC version 2.
2321 If you use GAS 1.38.1, then @code{extern const} variables will not have
2322 the read-only bit set, and the linker will generate warning messages
2323 about mismatched psect attributes for these variables.  These warning
2324 messages are merely a nuisance, and can safely be ignored.
2325
2326 If you are compiling with a version of GNU CC older than 1.33, specify
2327 @samp{/DEFINE=("inline=")} as an option in all the compilations.  This
2328 requires editing all the @code{gcc} commands in @file{make-cc1.com}.
2329 (The older versions had problems supporting @code{inline}.)  Once you
2330 have a working 1.33 or newer GNU CC, you can change this file back.
2331
2332 @item
2333 If you want to build GNU CC with the VAX C compiler, you will need to
2334 make minor changes in @file{make-cccp.com} and @file{make-cc1.com}
2335 to choose alternate definitions of @code{CC}, @code{CFLAGS}, and
2336 @code{LIBS}.  See comments in those files.  However, you must
2337 also have a working version of the GNU assembler (GNU as, aka GAS) as
2338 it is used as the back-end for GNU CC to produce binary object modules
2339 and is not included in the GNU CC sources.  GAS is also needed to
2340 compile @file{libgcc2} in order to build @file{gcclib} (see above);
2341 @file{make-l2.com} expects to be able to find it operational in
2342 @file{gnu_cc:[000000]gnu-as.exe}.
2343
2344 To use GNU CC on VMS, you need the VMS driver programs
2345 @file{gcc.exe}, @file{gcc.com}, and @file{gcc.cld}.  They are
2346 distributed with the VMS binaries (@file{gcc-vms}) rather than the
2347 GNU CC sources.  GAS is also included in @file{gcc-vms}, as is Bison.
2348
2349 Once you have successfully built GNU CC with VAX C, you should use the
2350 resulting compiler to rebuild itself.  Before doing this, be sure to
2351 restore the @code{CC}, @code{CFLAGS}, and @code{LIBS} definitions in
2352 @file{make-cccp.com} and @file{make-cc1.com}.  The second generation
2353 compiler will be able to take advantage of many optimizations that must
2354 be suppressed when building with other compilers.
2355 @end enumerate
2356
2357 Under previous versions of GNU CC, the generated code would occasionally
2358 give strange results when linked with the sharable @file{VAXCRTL} library.
2359 Now this should work.
2360
2361 Even with this version, however, GNU CC itself should not be linked with
2362 the sharable @file{VAXCRTL}.  The version of @code{qsort} in
2363 @file{VAXCRTL} has a bug (known to be present in VMS versions V4.6
2364 through V5.5) which causes the compiler to fail.
2365
2366 The executables are generated by @file{make-cc1.com} and
2367 @file{make-cccp.com} use the object library version of @file{VAXCRTL} in
2368 order to make use of the @code{qsort} routine in @file{gcclib.olb}.  If
2369 you wish to link the compiler executables with the shareable image
2370 version of @file{VAXCRTL}, you should edit the file @file{tm.h} (created
2371 by @file{vmsconfig.com}) to define the macro @code{QSORT_WORKAROUND}.
2372
2373 @code{QSORT_WORKAROUND} is always defined when GNU CC is compiled with
2374 VAX C, to avoid a problem in case @file{gcclib.olb} is not yet
2375 available.
2376
2377 @node Collect2
2378 @section @code{collect2}
2379
2380 GNU CC uses a utility called @code{collect2} on nearly all systems to arrange
2381 to call various initialization functions at start time.
2382
2383 The program @code{collect2} works by linking the program once and
2384 looking through the linker output file for symbols with particular names
2385 indicating they are constructor functions.  If it finds any, it
2386 creates a new temporary @samp{.c} file containing a table of them,
2387 compiles it, and links the program a second time including that file.
2388
2389 @findex __main
2390 @cindex constructors, automatic calls
2391 The actual calls to the constructors are carried out by a subroutine
2392 called @code{__main}, which is called (automatically) at the beginning
2393 of the body of @code{main} (provided @code{main} was compiled with GNU
2394 CC).  Calling @code{__main} is necessary, even when compiling C code, to
2395 allow linking C and C++ object code together.  (If you use
2396 @samp{-nostdlib}, you get an unresolved reference to @code{__main},
2397 since it's defined in the standard GCC library.  Include @samp{-lgcc} at
2398 the end of your compiler command line to resolve this reference.)
2399
2400 The program @code{collect2} is installed as @code{ld} in the directory
2401 where the passes of the compiler are installed.  When @code{collect2}
2402 needs to find the @emph{real} @code{ld}, it tries the following file
2403 names:
2404
2405 @itemize @bullet
2406 @item
2407 @file{real-ld} in the directories listed in the compiler's search
2408 directories.
2409
2410 @item
2411 @file{real-ld} in the directories listed in the environment variable
2412 @code{PATH}.
2413
2414 @item
2415 The file specified in the @code{REAL_LD_FILE_NAME} configuration macro,
2416 if specified.
2417
2418 @item
2419 @file{ld} in the compiler's search directories, except that
2420 @code{collect2} will not execute itself recursively.
2421
2422 @item
2423 @file{ld} in @code{PATH}.
2424 @end itemize
2425
2426 ``The compiler's search directories'' means all the directories where
2427 @code{gcc} searches for passes of the compiler.  This includes
2428 directories that you specify with @samp{-B}.
2429
2430 Cross-compilers search a little differently:
2431
2432 @itemize @bullet
2433 @item
2434 @file{real-ld} in the compiler's search directories.
2435
2436 @item
2437 @file{@var{target}-real-ld} in @code{PATH}.
2438
2439 @item
2440 The file specified in the @code{REAL_LD_FILE_NAME} configuration macro,
2441 if specified.
2442
2443 @item
2444 @file{ld} in the compiler's search directories.
2445
2446 @item
2447 @file{@var{target}-ld} in @code{PATH}.
2448 @end itemize
2449
2450 @code{collect2} explicitly avoids running @code{ld} using the file name
2451 under which @code{collect2} itself was invoked.  In fact, it remembers
2452 up a list of such names---in case one copy of @code{collect2} finds
2453 another copy (or version) of @code{collect2} installed as @code{ld} in a
2454 second place in the search path.
2455
2456 @code{collect2} searches for the utilities @code{nm} and @code{strip}
2457 using the same algorithm as above for @code{ld}.
2458
2459 @node Header Dirs
2460 @section Standard Header File Directories
2461
2462 @code{GCC_INCLUDE_DIR} means the same thing for native and cross.  It is
2463 where GNU CC stores its private include files, and also where GNU CC
2464 stores the fixed include files.  A cross compiled GNU CC runs
2465 @code{fixincludes} on the header files in @file{$(tooldir)/include}.
2466 (If the cross compilation header files need to be fixed, they must be
2467 installed before GNU CC is built.  If the cross compilation header files
2468 are already suitable for ANSI C and GNU CC, nothing special need be
2469 done).
2470
2471 @code{GPLUSPLUS_INCLUDE_DIR} means the same thing for native and cross.  It
2472 is where @code{g++} looks first for header files.  The C++ library
2473 installs only target independent header files in that directory.
2474
2475 @code{LOCAL_INCLUDE_DIR} is used only for a native compiler.  It is
2476 normally @file{/usr/local/include}.  GNU CC searches this directory so
2477 that users can install header files in @file{/usr/local/include}.
2478
2479 @code{CROSS_INCLUDE_DIR} is used only for a cross compiler.  GNU CC
2480 doesn't install anything there.
2481
2482 @code{TOOL_INCLUDE_DIR} is used for both native and cross compilers.  It
2483 is the place for other packages to install header files that GNU CC will
2484 use.  For a cross-compiler, this is the equivalent of
2485 @file{/usr/include}.  When you build a cross-compiler,
2486 @code{fixincludes} processes any header files in this directory.