Retro68/gcc/INSTALL/build.html

488 lines
21 KiB
HTML
Raw Normal View History

2018-12-28 15:30:48 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
2019-06-02 15:48:37 +00:00
<!-- Copyright (C) 1988-2019 Free Software Foundation, Inc.
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
Permission is granted to copy, distribute and/or modify this document
2012-03-27 23:13:14 +00:00
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, the Front-Cover texts being (a) (see below), and
with the Back-Cover Texts being (b) (see below). A copy of the
2018-12-28 15:30:48 +00:00
license is included in the section entitled "GNU
Free Documentation License".
2012-03-27 23:13:14 +00:00
(a) The FSF's Front-Cover Text is:
2018-12-28 15:30:48 +00:00
A GNU Manual
2012-03-27 23:13:14 +00:00
(b) The FSF's Back-Cover Text is:
2018-12-28 15:30:48 +00:00
You have freedom to copy and modify this GNU Manual, like GNU
2012-03-27 23:13:14 +00:00
software. Copies published by the Free Software Foundation raise
2018-12-28 15:30:48 +00:00
funds for GNU development. -->
2019-06-02 15:48:37 +00:00
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
2018-12-28 15:30:48 +00:00
<head>
2019-06-02 15:48:37 +00:00
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2018-12-28 15:30:48 +00:00
<title>Installing GCC</title>
<meta name="description" content="Installing GCC">
<meta name="keywords" content="Installing GCC">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
2012-03-27 23:13:14 +00:00
</head>
2018-12-28 15:30:48 +00:00
<body lang="en">
<h1 class="settitle" align="center">Installing GCC</h1>
<a name="index-Installing-GCC_003a-Building"></a>
<p>Now that GCC is configured, you are ready to build the compiler and
runtime libraries.
</p>
<p>Some commands executed when making the compiler may fail (return a
nonzero status) and be ignored by <code>make</code>. These failures, which
2012-03-27 23:13:14 +00:00
are often due to files that were not found, are expected, and can safely
be ignored.
2018-12-28 15:30:48 +00:00
</p>
<p>It is normal to have compiler warnings when compiling certain files.
2012-03-27 23:13:14 +00:00
Unless you are a GCC developer, you can generally ignore these warnings
unless they cause compilation to fail. Developers should attempt to fix
any warnings encountered, however they can temporarily continue past
warnings-as-errors by specifying the configure flag
2018-12-28 15:30:48 +00:00
<samp>--disable-werror</samp>.
</p>
<p>On certain old systems, defining certain environment variables such as
<code>CC</code> can interfere with the functioning of <code>make</code>.
</p>
<p>If you encounter seemingly strange errors when trying to build the
2012-03-27 23:13:14 +00:00
compiler in a directory other than the source directory, it could be
because you have previously configured the compiler in the source
directory. Make sure you have done all the necessary preparations.
2018-12-28 15:30:48 +00:00
</p>
<p>If you build GCC on a BSD system using a directory stored in an old System
V file system, problems may occur in running <code>fixincludes</code> if the
System V file system doesn&rsquo;t support symbolic links. These problems
2012-03-27 23:13:14 +00:00
result in a failure to fix the declaration of <code>size_t</code> in
2018-12-28 15:30:48 +00:00
<samp>sys/types.h</samp>. If you find that <code>size_t</code> is a signed type and
2012-03-27 23:13:14 +00:00
that type mismatches occur, this could be the cause.
2018-12-28 15:30:48 +00:00
</p>
<p>The solution is not to use such a directory for building GCC.
</p>
<p>Similarly, when building from SVN or snapshots, or if you modify
<samp>*.l</samp> files, you need the Flex lexical analyzer generator
installed. If you do not modify <samp>*.l</samp> files, releases contain
2012-03-27 23:13:14 +00:00
the Flex-generated files and you do not need Flex installed to build
them. There is still one Flex-based lexical analyzer (part of the
build machinery, not of GCC itself) that is used even if you only
build the C front end.
2018-12-28 15:30:48 +00:00
</p>
<p>When building from SVN or snapshots, or if you modify Texinfo
2012-03-27 23:13:14 +00:00
documentation, you need version 4.7 or later of Texinfo installed if you
want Info documentation to be regenerated. Releases contain Info
documentation pre-built for the unmodified documentation in the release.
2018-12-28 15:30:48 +00:00
</p>
<a name="Building-a-native-compiler"></a>
<h3 class="section">Building a native compiler</h3>
2012-03-27 23:13:14 +00:00
<p>For a native build, the default configuration is to perform
2018-12-28 15:30:48 +00:00
a 3-stage bootstrap of the compiler when &lsquo;<samp>make</samp>&rsquo; is invoked.
2012-03-27 23:13:14 +00:00
This will build the entire GCC system and ensure that it compiles
2018-12-28 15:30:48 +00:00
itself correctly. It can be disabled with the <samp>--disable-bootstrap</samp>
parameter to &lsquo;<samp>configure</samp>&rsquo;, but bootstrapping is suggested because
2012-03-27 23:13:14 +00:00
the compiler will be tested more completely and could also have
better performance.
2018-12-28 15:30:48 +00:00
</p>
<p>The bootstrapping process will complete the following steps:
</p>
<ul>
<li> Build tools necessary to build the compiler.
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
</li><li> Perform a 3-stage bootstrap of the compiler. This includes building
2012-03-27 23:13:14 +00:00
three times the target tools for use by the compiler such as binutils
(bfd, binutils, gas, gprof, ld, and opcodes) if they have been
individually linked or moved into the top level GCC source tree before
configuring.
2018-12-28 15:30:48 +00:00
</li><li> Perform a comparison test of the stage2 and stage3 compilers.
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
</li><li> Build runtime libraries using the stage3 compiler from the previous step.
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
</li></ul>
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
<p>If you are short on disk space you might consider &lsquo;<samp>make
bootstrap-lean</samp>&rsquo; instead. The sequence of compilation is the
2012-03-27 23:13:14 +00:00
same described above, but object files from the stage1 and
stage2 of the 3-stage bootstrap of the compiler are deleted as
soon as they are no longer needed.
2018-12-28 15:30:48 +00:00
</p>
<p>If you wish to use non-default GCC flags when compiling the stage2
2012-03-27 23:13:14 +00:00
and stage3 compilers, set <code>BOOT_CFLAGS</code> on the command line when
2018-12-28 15:30:48 +00:00
doing &lsquo;<samp>make</samp>&rsquo;. For example, if you want to save additional space
2012-03-27 23:13:14 +00:00
during the bootstrap and in the final installation as well, you can
build the compiler binaries without debugging information as in the
following example. This will save roughly 40% of disk space both for
the bootstrap and the final installation. (Libraries will still contain
debugging information.)
2018-12-28 15:30:48 +00:00
</p>
<div class="smallexample">
<pre class="smallexample">make BOOT_CFLAGS='-O' bootstrap
</pre></div>
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
<p>You can place non-default optimization flags into <code>BOOT_CFLAGS</code>; they
are less well tested here than the default of &lsquo;<samp>-g -O2</samp>&rsquo;, but should
2012-03-27 23:13:14 +00:00
still work. In a few cases, you may find that you need to specify special
2018-12-28 15:30:48 +00:00
flags such as <samp>-msoft-float</samp> here to complete the bootstrap; or,
2012-03-27 23:13:14 +00:00
if the native compiler miscompiles the stage1 compiler, you may need
to work around this, by choosing <code>BOOT_CFLAGS</code> to avoid the parts
2018-12-28 15:30:48 +00:00
of the stage1 compiler that were miscompiled, or by using &lsquo;<samp>make
bootstrap4</samp>&rsquo; to increase the number of stages of bootstrap.
</p>
<p><code>BOOT_CFLAGS</code> does not apply to bootstrapped target libraries.
2012-03-27 23:13:14 +00:00
Since these are always compiled with the compiler currently being
bootstrapped, you can use <code>CFLAGS_FOR_TARGET</code> to modify their
2018-12-28 15:30:48 +00:00
compilation flags, as for non-bootstrapped target libraries.
2012-03-27 23:13:14 +00:00
Again, if the native compiler miscompiles the stage1 compiler, you may
need to work around this by avoiding non-working parts of the stage1
compiler. Use <code>STAGE1_TFLAGS</code> to this end.
2018-12-28 15:30:48 +00:00
</p>
<p>If you used the flag <samp>--enable-languages=&hellip;</samp> to restrict
the compilers to be built, only those you&rsquo;ve actually enabled will be
2012-03-27 23:13:14 +00:00
built. This will of course only build those runtime libraries, for
which the particular compiler has been built. Please note,
2018-12-28 15:30:48 +00:00
that re-defining <code>LANGUAGES</code> when calling &lsquo;<samp>make</samp>&rsquo;
2012-03-27 23:13:14 +00:00
<strong>does not</strong> work anymore!
2018-12-28 15:30:48 +00:00
</p>
<p>If the comparison of stage2 and stage3 fails, this normally indicates
2012-03-27 23:13:14 +00:00
that the stage2 compiler has compiled GCC incorrectly, and is therefore
a potentially serious bug which you should investigate and report. (On
a few systems, meaningful comparison of object files is impossible; they
always appear &ldquo;different&rdquo;. If you encounter this problem, you will
2018-12-28 15:30:48 +00:00
need to disable comparison in the <samp>Makefile</samp>.)
</p>
<p>If you do not want to bootstrap your compiler, you can configure with
<samp>--disable-bootstrap</samp>. In particular cases, you may want to
2012-03-27 23:13:14 +00:00
bootstrap your compiler even if the target system is not the same as
the one you are building on: for example, you could build a
<code>powerpc-unknown-linux-gnu</code> toolchain on a
<code>powerpc64-unknown-linux-gnu</code> host. In this case, pass
2018-12-28 15:30:48 +00:00
<samp>--enable-bootstrap</samp> to the configure script.
</p>
<p><code>BUILD_CONFIG</code> can be used to bring in additional customization
to the build. It can be set to a whitespace-separated list of names.
For each such <code>NAME</code>, top-level <samp>config/<code>NAME</code>.mk</samp> will
be included by the top-level <samp>Makefile</samp>, bringing in any settings
2012-03-27 23:13:14 +00:00
it contains. The default <code>BUILD_CONFIG</code> can be set using the
2018-12-28 15:30:48 +00:00
configure option <samp>--with-build-config=<code>NAME</code>...</samp>. Some
2012-03-27 23:13:14 +00:00
examples of supported build configurations are:
2018-12-28 15:30:48 +00:00
</p>
<dl compact="compact">
<dt>&lsquo;<samp>bootstrap-O1</samp>&rsquo;</dt>
<dd><p>Removes any <samp>-O</samp>-started option from <code>BOOT_CFLAGS</code>, and adds
<samp>-O1</samp> to it. &lsquo;<samp>BUILD_CONFIG=bootstrap-O1</samp>&rsquo; is equivalent to
&lsquo;<samp>BOOT_CFLAGS='-g -O1'</samp>&rsquo;.
</p>
</dd>
<dt>&lsquo;<samp>bootstrap-O3</samp>&rsquo;</dt>
<dd><p>Analogous to <code>bootstrap-O1</code>.
</p>
</dd>
<dt>&lsquo;<samp>bootstrap-lto</samp>&rsquo;</dt>
<dd><p>Enables Link-Time Optimization for host tools during bootstrapping.
&lsquo;<samp>BUILD_CONFIG=bootstrap-lto</samp>&rsquo; is equivalent to adding
<samp>-flto</samp> to &lsquo;<samp>BOOT_CFLAGS</samp>&rsquo;. This option assumes that the host
2015-08-28 15:33:40 +00:00
supports the linker plugin (e.g. GNU ld version 2.21 or later or GNU gold
version 2.21 or later).
2018-12-28 15:30:48 +00:00
</p>
</dd>
<dt>&lsquo;<samp>bootstrap-lto-noplugin</samp>&rsquo;</dt>
<dd><p>This option is similar to <code>bootstrap-lto</code>, but is intended for
hosts that do not support the linker plugin. Without the linker plugin
static libraries are not compiled with link-time optimizations. Since
the GCC middle end and back end are in <samp>libbackend.a</samp> this means
2015-08-28 15:33:40 +00:00
that only the front end is actually LTO optimized.
2018-12-28 15:30:48 +00:00
</p>
</dd>
2019-06-02 15:48:37 +00:00
<dt>&lsquo;<samp>bootstrap-lto-lean</samp>&rsquo;</dt>
<dd><p>This option is similar to <code>bootstrap-lto</code>, but is intended for
faster build by only using LTO in the final bootstrap stage.
With &lsquo;<samp>make profiledbootstrap</samp>&rsquo; the LTO frontend
is trained only on generator files.
</p>
</dd>
2018-12-28 15:30:48 +00:00
<dt>&lsquo;<samp>bootstrap-debug</samp>&rsquo;</dt>
<dd><p>Verifies that the compiler generates the same executable code, whether
2012-03-27 23:13:14 +00:00
or not it is asked to emit debug information. To this end, this
option builds stage2 host programs without debug information, and uses
2018-12-28 15:30:48 +00:00
<samp>contrib/compare-debug</samp> to compare them with the stripped stage3
2012-03-27 23:13:14 +00:00
object files. If <code>BOOT_CFLAGS</code> is overridden so as to not enable
2018-12-28 15:30:48 +00:00
debug information, stage2 will have it, and stage3 won&rsquo;t. This option
2012-03-27 23:13:14 +00:00
is enabled by default when GCC bootstrapping is enabled, if
<code>strip</code> can turn object files compiled with and without debug
info into identical object files. In addition to better test
coverage, this option makes default bootstraps faster and leaner.
2018-12-28 15:30:48 +00:00
</p>
</dd>
<dt>&lsquo;<samp>bootstrap-debug-big</samp>&rsquo;</dt>
<dd><p>Rather than comparing stripped object files, as in
2012-03-27 23:13:14 +00:00
<code>bootstrap-debug</code>, this option saves internal compiler dumps
during stage2 and stage3 and compares them as well, which helps catch
additional potential problems, but at a great cost in terms of disk
2018-12-28 15:30:48 +00:00
space. It can be specified in addition to &lsquo;<samp>bootstrap-debug</samp>&rsquo;.
</p>
</dd>
<dt>&lsquo;<samp>bootstrap-debug-lean</samp>&rsquo;</dt>
<dd><p>This option saves disk space compared with <code>bootstrap-debug-big</code>,
2012-03-27 23:13:14 +00:00
but at the expense of some recompilation. Instead of saving the dumps
of stage2 and stage3 until the final compare, it uses
2018-12-28 15:30:48 +00:00
<samp>-fcompare-debug</samp> to generate, compare and remove the dumps
2012-03-27 23:13:14 +00:00
during stage3, repeating the compilation that already took place in
stage2, whose dumps were not saved.
2018-12-28 15:30:48 +00:00
</p>
</dd>
<dt>&lsquo;<samp>bootstrap-debug-lib</samp>&rsquo;</dt>
<dd><p>This option tests executable code invariance over debug information
2012-03-27 23:13:14 +00:00
generation on target libraries, just like <code>bootstrap-debug-lean</code>
tests it on host programs. It builds stage3 libraries with
2018-12-28 15:30:48 +00:00
<samp>-fcompare-debug</samp>, and it can be used along with any of the
2012-03-27 23:13:14 +00:00
<code>bootstrap-debug</code> options above.
2018-12-28 15:30:48 +00:00
</p>
<p>There aren&rsquo;t <code>-lean</code> or <code>-big</code> counterparts to this option
2012-03-27 23:13:14 +00:00
because most libraries are only build in stage3, so bootstrap compares
would not get significant coverage. Moreover, the few libraries built
2018-12-28 15:30:48 +00:00
in stage2 are used in stage3 host programs, so we wouldn&rsquo;t want to
2012-03-27 23:13:14 +00:00
compile stage2 libraries with different options for comparison purposes.
2018-12-28 15:30:48 +00:00
</p>
</dd>
<dt>&lsquo;<samp>bootstrap-debug-ckovw</samp>&rsquo;</dt>
<dd><p>Arranges for error messages to be issued if the compiler built on any
stage is run without the option <samp>-fcompare-debug</samp>. This is
useful to verify the full <samp>-fcompare-debug</samp> testing coverage. It
2012-03-27 23:13:14 +00:00
must be used along with <code>bootstrap-debug-lean</code> and
<code>bootstrap-debug-lib</code>.
2018-12-28 15:30:48 +00:00
</p>
</dd>
<dt>&lsquo;<samp>bootstrap-cet</samp>&rsquo;</dt>
<dd><p>This option enables Intel CET for host tools during bootstrapping.
&lsquo;<samp>BUILD_CONFIG=bootstrap-cet</samp>&rsquo; is equivalent to adding
<samp>-fcf-protection</samp> to &lsquo;<samp>BOOT_CFLAGS</samp>&rsquo;. This option
assumes that the host supports Intel CET (e.g. GNU assembler version
2.30 or later).
</p>
</dd>
<dt>&lsquo;<samp>bootstrap-time</samp>&rsquo;</dt>
<dd><p>Arranges for the run time of each program started by the GCC driver,
built in any stage, to be logged to <samp>time.log</samp>, in the top level of
2012-03-27 23:13:14 +00:00
the build tree.
2018-12-28 15:30:48 +00:00
</p>
</dd>
</dl>
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
<a name="Building-a-cross-compiler"></a>
<h3 class="section">Building a cross compiler</h3>
2012-03-27 23:13:14 +00:00
<p>When building a cross compiler, it is not generally possible to do a
3-stage bootstrap of the compiler. This makes for an interesting problem
as parts of GCC can only be built with GCC.
2018-12-28 15:30:48 +00:00
</p>
<p>To build a cross compiler, we recommend first building and installing a
2012-03-27 23:13:14 +00:00
native compiler. You can then use the native GCC compiler to build the
cross compiler. The installed native compiler needs to be GCC version
2.95 or later.
2018-12-28 15:30:48 +00:00
</p>
<p>Assuming you have already installed a native copy of GCC and configured
your cross compiler, issue the command <code>make</code>, which performs the
2012-03-27 23:13:14 +00:00
following steps:
2018-12-28 15:30:48 +00:00
</p>
<ul>
<li> Build host tools necessary to build the compiler.
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
</li><li> Build target tools for use by the compiler such as binutils (bfd,
2012-03-27 23:13:14 +00:00
binutils, gas, gprof, ld, and opcodes)
if they have been individually linked or moved into the top level GCC source
tree before configuring.
2018-12-28 15:30:48 +00:00
</li><li> Build the compiler (single stage only).
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
</li><li> Build runtime libraries using the compiler from the previous step.
</li></ul>
2012-03-27 23:13:14 +00:00
2018-12-28 15:30:48 +00:00
<p>Note that if an error occurs in any step the make process will exit.
</p>
<p>If you are not building GNU binutils in the same source tree as GCC,
2012-03-27 23:13:14 +00:00
you will need a cross-assembler and cross-linker installed before
configuring GCC. Put them in the directory
2018-12-28 15:30:48 +00:00
<samp><var>prefix</var>/<var>target</var>/bin</samp>. Here is a table of the tools
2012-03-27 23:13:14 +00:00
you should put in this directory:
2018-12-28 15:30:48 +00:00
</p>
<dl compact="compact">
<dt><samp>as</samp></dt>
<dd><p>This should be the cross-assembler.
</p>
</dd>
<dt><samp>ld</samp></dt>
<dd><p>This should be the cross-linker.
</p>
</dd>
<dt><samp>ar</samp></dt>
<dd><p>This should be the cross-archiver: a program which can manipulate
archive files (linker libraries) in the target machine&rsquo;s format.
</p>
</dd>
<dt><samp>ranlib</samp></dt>
<dd><p>This should be a program to construct a symbol table in an archive file.
</p></dd>
2012-03-27 23:13:14 +00:00
</dl>
2018-12-28 15:30:48 +00:00
<p>The installation of GCC will find these programs in that directory,
2012-03-27 23:13:14 +00:00
and copy or link them to the proper place to for the cross-compiler to
find them when run later.
2018-12-28 15:30:48 +00:00
</p>
<p>The easiest way to provide these files is to build the Binutils package.
Configure it with the same <samp>--host</samp> and <samp>--target</samp>
2012-03-27 23:13:14 +00:00
options that you use for configuring GCC, then build and install
them. They install their executables automatically into the proper
directory. Alas, they do not support all the targets that GCC
supports.
2018-12-28 15:30:48 +00:00
</p>
<p>If you are not building a C library in the same source tree as GCC,
2012-03-27 23:13:14 +00:00
you should also provide the target libraries and headers before
configuring GCC, specifying the directories with
2018-12-28 15:30:48 +00:00
<samp>--with-sysroot</samp> or <samp>--with-headers</samp> and
<samp>--with-libs</samp>. Many targets also require &ldquo;start files&rdquo; such
as <samp>crt0.o</samp> and
<samp>crtn.o</samp> which are linked into each executable. There may be several
alternatives for <samp>crt0.o</samp>, for use with profiling or other
compilation options. Check your target&rsquo;s definition of
2012-03-27 23:13:14 +00:00
<code>STARTFILE_SPEC</code> to find out what start files it uses.
2018-12-28 15:30:48 +00:00
</p>
<a name="Building-in-parallel"></a>
<h3 class="section">Building in parallel</h3>
2012-03-27 23:13:14 +00:00
<p>GNU Make 3.80 and above, which is necessary to build GCC, support
2018-12-28 15:30:48 +00:00
building in parallel. To activate this, you can use &lsquo;<samp>make -j 2</samp>&rsquo;
instead of &lsquo;<samp>make</samp>&rsquo;. You can also specify a bigger number, and
2012-03-27 23:13:14 +00:00
in most cases using a value greater than the number of processors in
your machine will result in fewer and shorter I/O latency hits, thus
improving overall throughput; this is especially true for slow drives
and network filesystems.
2018-12-28 15:30:48 +00:00
</p>
<a name="Building-the-Ada-compiler"></a>
<h3 class="section">Building the Ada compiler</h3>
2012-03-27 23:13:14 +00:00
<p>In order to build GNAT, the Ada compiler, you need a working GNAT
2018-12-28 15:30:48 +00:00
compiler (GCC version 4.0 or later).
This includes GNAT tools such as <code>gnatmake</code> and
<code>gnatlink</code>, since the Ada front end is written in Ada and
2012-03-27 23:13:14 +00:00
uses some GNAT-specific extensions.
2018-12-28 15:30:48 +00:00
</p>
<p>In order to build a cross compiler, it is suggested to install
2012-03-27 23:13:14 +00:00
the new compiler as native first, and then use it to build the cross
compiler.
2018-12-28 15:30:48 +00:00
</p>
<p><code>configure</code> does not test whether the GNAT installation works
2012-03-27 23:13:14 +00:00
and has a sufficiently recent version; if too old a GNAT version is
2018-12-28 15:30:48 +00:00
installed, the build will fail unless <samp>--enable-languages</samp> is
2012-03-27 23:13:14 +00:00
used to disable building the Ada front end.
2018-12-28 15:30:48 +00:00
</p>
<p><code>ADA_INCLUDE_PATH</code> and <code>ADA_OBJECT_PATH</code> environment variables
2012-03-27 23:13:14 +00:00
must not be set when building the Ada compiler, the Ada tools, or the
Ada runtime libraries. You can check that your build environment is clean
2018-12-28 15:30:48 +00:00
by verifying that &lsquo;<samp>gnatls -v</samp>&rsquo; lists only one explicit path in each
2012-03-27 23:13:14 +00:00
section.
2018-12-28 15:30:48 +00:00
</p>
<a name="Building-with-profile-feedback"></a>
<h3 class="section">Building with profile feedback</h3>
2012-03-27 23:13:14 +00:00
<p>It is possible to use profile feedback to optimize the compiler itself. This
should result in a faster compiler binary. Experiments done on x86 using gcc
3.3 showed approximately 7 percent speedup on compiling C programs. To
bootstrap the compiler with profile feedback, use <code>make profiledbootstrap</code>.
2018-12-28 15:30:48 +00:00
</p>
<p>When &lsquo;<samp>make profiledbootstrap</samp>&rsquo; is run, it will first build a <code>stage1</code>
2012-03-27 23:13:14 +00:00
compiler. This compiler is used to build a <code>stageprofile</code> compiler
instrumented to collect execution counts of instruction and branch
2018-12-28 15:30:48 +00:00
probabilities. Training run is done by building <code>stagetrain</code>
compiler. Finally a <code>stagefeedback</code> compiler is built
using the information collected.
</p>
<p>Unlike standard bootstrap, several additional restrictions apply. The
compiler used to build <code>stage1</code> needs to support a 64-bit integral type.
It is recommended to only use GCC for this.
2018-12-28 15:30:48 +00:00
</p>
<p>On Linux/x86_64 hosts with some restrictions (no virtualization) it is
also possible to do autofdo build with &lsquo;<samp>make
autoprofiledback</samp>&rsquo;. This uses Linux perf to sample branches in the
binary and then rebuild it with feedback derived from the profile.
Linux perf and the <code>autofdo</code> toolkit needs to be installed for
this.
2018-12-28 15:30:48 +00:00
</p>
<p>Only the profile from the current build is used, so when an error
occurs it is recommended to clean before restarting. Otherwise
the code quality may be much worse.
2018-12-28 15:30:48 +00:00
</p>
<hr />
<p>
<p><a href="./index.html">Return to the GCC Installation page</a>
2018-12-28 15:30:48 +00:00
</p>
<hr>
2014-09-21 17:33:12 +00:00
2018-12-28 15:30:48 +00:00
</body>
</html>