Annotation of gcc/install.texi, revision 1.1.1.9

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.