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