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