Patchwork Fix PCH writing (PR pch/47430)

login
register
mail settings
Submitter Jakub Jelinek
Date Jan. 25, 2011, 7:59 p.m.
Message ID <20110125195954.GH2724@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/80400/
State New
Headers show

Comments

Jakub Jelinek - Jan. 25, 2011, 7:59 p.m.
Hi!

I'm getting occassional bootstrap failures on powerpc64-linux, caused
by interaction between PCH and address space randomization on RHEL6.
The randomization is quite big (up to 1GB variations) and stdtr1c++.h.gch
unfortunately is written after reading stdc++.h.gch, thus the carefully
chosen address space slot isn't used and the further guesses just don't work
with the big randomization.

The following patch fixes it by disabling PCH reading when writing PCH.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2011-01-25  Jakub Jelinek  <jakub@redhat.com>

	PR pch/47430
	* c-opts.c (c_common_post_options): Call c_common_no_more_pch
	after init_c_lex if pch_file is set.


	Jakub
Joseph S. Myers - Jan. 26, 2011, 1:07 a.m.
On Tue, 25 Jan 2011, Jakub Jelinek wrote:

> 2011-01-25  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR pch/47430
> 	* c-opts.c (c_common_post_options): Call c_common_no_more_pch
> 	after init_c_lex if pch_file is set.

OK.

Patch

--- gcc/c-family/c-opts.c.jj	2010-12-02 11:51:14.000000000 +0100
+++ gcc/c-family/c-opts.c	2011-01-25 18:07:41.000000000 +0100
@@ -995,6 +995,12 @@  c_common_post_options (const char **pfil
     {
       init_c_lex ();
 
+      /* When writing a PCH file, avoid reading some other PCH file,
+	 because the default address space slot then can't be used
+	 for the output PCH file.  */
+      if (pch_file)
+	c_common_no_more_pch ();
+
       /* Yuk.  WTF is this?  I do know ObjC relies on it somewhere.  */
       input_location = UNKNOWN_LOCATION;
     }