diff mbox

[1/2] Fix LTO bootstrap documentation

Message ID 1283250838-13800-1-git-send-email-andi@firstfloor.org
State New
Headers show

Commit Message

Andi Kleen Aug. 31, 2010, 10:33 a.m. UTC
From: Andi Kleen <ak@linux.intel.com>

BUILD_CONFIG=bootstrap-lto does not work currently and causes build
failures.  Remove a reference to that in the install documentation and instead
document a working method using BOOT_CFLAGS.

Bootstrapped on x86-64 together with the -fwhopr=jobserver patchkit

v2: Fix grammar/texinfo based on feedback

Ok to commit?

2010-08-17  Andi Kleen	<ak@linux.intel.com>

	* doc/install.texi (Building a native compiler): Remove
	reference to broken BUILD_CONFIG=bootstrap-lto.
	Document working method instead.
---
 gcc/doc/install.texi |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

Comments

Diego Novillo Aug. 31, 2010, 12:24 p.m. UTC | #1
On 10-08-31 06:33 , Andi Kleen wrote:

> @@ -2108,6 +2108,13 @@ to work around this, by choosing @code{BOOT_CFLAGS} to avoid the parts
>   of the stage1 compiler that were miscompiled, or by using @samp{make
>   bootstrap4} to increase the number of stages of bootstrap.
>
> +You can also use @code{BOOT_CFLAGS} to force an LTO bootstrap with
> +@samp{BOOT_CFLAGS='-O2 -fwhopr=jobserver -fuse-linker-plugin -frandom-seed=1'}.
> +Configure the compiler with @samp{--enable-stage1-languages=c,lto}. This
> +will only work with the @command{gold} linker and if linker plugins are
> +correctly configured.  The @option{-frandom-seed=1} is needed to avoid
> +bootstrap comparison failures.

Could you add an explanation on why frandom-seed avoids the comparison 
failures?  It's not immediately obvious.

OK with that change.


Diego.
Paolo Bonzini Aug. 31, 2010, 12:44 p.m. UTC | #2
On 08/31/2010 02:24 PM, Diego Novillo wrote:
> On 10-08-31 06:33 , Andi Kleen wrote:
>
>> @@ -2108,6 +2108,13 @@ to work around this, by choosing
>> @code{BOOT_CFLAGS} to avoid the parts
>> of the stage1 compiler that were miscompiled, or by using @samp{make
>> bootstrap4} to increase the number of stages of bootstrap.
>>
>> +You can also use @code{BOOT_CFLAGS} to force an LTO bootstrap with
>> +@samp{BOOT_CFLAGS='-O2 -fwhopr=jobserver -fuse-linker-plugin
>> -frandom-seed=1'}.
>> +Configure the compiler with @samp{--enable-stage1-languages=c,lto}. This
>> +will only work with the @command{gold} linker and if linker plugins are
>> +correctly configured. The @option{-frandom-seed=1} is needed to avoid
>> +bootstrap comparison failures.
>
> Could you add an explanation on why frandom-seed avoids the comparison
> failures? It's not immediately obvious.
>
> OK with that change.

No, config/bootstrap-lto.mk should be adjusted instead to use the 
options that Andi specifies.  The doc change should be limited to the 
--enable-stage1-languages=c,lto part.

Paolo
Andi Kleen Aug. 31, 2010, 1:14 p.m. UTC | #3
> No, config/bootstrap-lto.mk should be adjusted instead to use the 
> options that Andi specifies.  The doc change should be limited to the 
> --enable-stage1-languages=c,lto part.

The problem is that config/bootstrap-lto.mk doesn't work in the first place
(and I don't know how to fix it). It never built for me.
That is why I documented an alternative method.

-Andi
Paolo Bonzini Aug. 31, 2010, 1:17 p.m. UTC | #4
On 08/31/2010 03:14 PM, Andi Kleen wrote:
>
>> No, config/bootstrap-lto.mk should be adjusted instead to use the
>> options that Andi specifies. The doc change should be limited to the
>> --enable-stage1-languages=c,lto part.
>
> The problem is that config/bootstrap-lto.mk doesn't work in the first place
> (and I don't know how to fix it). It never built for me.
> That is why I documented an alternative method.

Have you tried s/-flto/flags-you-proposed-to-use-instead/ in that file?

Paolo
Alexandre Oliva Sept. 1, 2010, 5:54 a.m. UTC | #5
On Aug 31, 2010, Andi Kleen <ak@linux.intel.com> wrote:

>> No, config/bootstrap-lto.mk should be adjusted instead to use the
>> options that Andi specifies.  The doc change should be limited to
>> the --enable-stage1-languages=c,lto part.

> The problem is that config/bootstrap-lto.mk doesn't work in the first place
> (and I don't know how to fix it). It never built for me.

Somehow it worked for me.  That said, I had lto in
--enable-stage1-languages, but that was a mistake: it caused me to
forget to adjust bootstrap-lto.mk to add lto to stage1 languages itself,
which it should.
diff mbox

Patch

diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index fc9b988..e98675d 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2108,6 +2108,13 @@  to work around this, by choosing @code{BOOT_CFLAGS} to avoid the parts
 of the stage1 compiler that were miscompiled, or by using @samp{make
 bootstrap4} to increase the number of stages of bootstrap.
 
+You can also use @code{BOOT_CFLAGS} to force an LTO bootstrap with
+@samp{BOOT_CFLAGS='-O2 -fwhopr=jobserver -fuse-linker-plugin -frandom-seed=1'}. 
+Configure the compiler with @samp{--enable-stage1-languages=c,lto}. This 
+will only work with the @command{gold} linker and if linker plugins are
+correctly configured.  The @option{-frandom-seed=1} is needed to avoid 
+bootstrap comparison failures.
+
 @code{BOOT_CFLAGS} does not apply to bootstrapped target libraries.
 Since these are always compiled with the compiler currently being
 bootstrapped, you can use @code{CFLAGS_FOR_TARGET} to modify their
@@ -2155,11 +2162,6 @@  Removes any @option{-O}-started option from @code{BOOT_CFLAGS}, and adds
 @item @samp{bootstrap-O3}
 Analogous to @code{bootstrap-O1}.
 
-@item @samp{bootstrap-lto}
-Enables Link-Time Optimization for host tools during bootstrapping.
-@samp{BUILD_CONFIG=bootstrap-lto} is equivalent to adding
-@option{-flto} to @samp{BOOT_CFLAGS}.
-
 @item @samp{bootstrap-debug}
 Verifies that the compiler generates the same executable code, whether
 or not it is asked to emit debug information.  To this end, this