OSDN Git Service

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