source: trunk/third/gcc/install.texi @ 8834

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