Annotation of GNUtools/cc/install.texi, revision 1.1.1.1

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