Patchwork Fix -fPIC issue with GNU LD and LTO

login
register
mail settings
Submitter Joseph S. Myers
Date Jan. 8, 2011, 2:01 a.m.
Message ID <Pine.LNX.4.64.1101080159520.11944@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/77936/
State New
Headers show

Comments

Joseph S. Myers - Jan. 8, 2011, 2:01 a.m.
On Fri, 7 Jan 2011, Jan Hubicka wrote:

> Hmm, I didn't do that since finish_options seems to contain guard against
> repeated execution
>   if (!opts->x_flag_opts_finished)
>     {
>       if (opts->x_flag_pie)
>         opts->x_flag_pic = opts->x_flag_pie;
>       if (opts->x_flag_pic && !opts->x_flag_pie)
>         opts->x_flag_shlib = 1;
>       opts->x_flag_opts_finished = false;
>     }

> only now I noticed that opts_finished is set to false that it is 
> already. This looks like typo.

I have now committed this fix as obvious.  The bug was introduced by my 
patch <http://gcc.gnu.org/ml/gcc-patches/2010-11/msg02407.html>, where I 
replaced a static variable first_time_p with opts->x_flag_opts_finished, 
reversing the sense of the setting, but failed to fix the assignment.

Patch

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 168593)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,8 @@ 
+2011-01-07  Joseph Myers  <joseph@codesourcery.com>
+
+	* opts.c (finish_options): Set opts->x_flag_opts_finished to true,
+	not false.
+
 2011-01-07  Jan Hubicka  <jh@suse.cz>
 
 	* doc/invoke.texi: (-flto, -fuse-linker-plugin): Update defaults
Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 168593)
+++ gcc/opts.c	(working copy)
@@ -693,7 +693,7 @@  finish_options (struct gcc_options *opts
 	opts->x_flag_pic = opts->x_flag_pie;
       if (opts->x_flag_pic && !opts->x_flag_pie)
 	opts->x_flag_shlib = 1;
-      opts->x_flag_opts_finished = false;
+      opts->x_flag_opts_finished = true;
     }
 
   if (opts->x_optimize == 0)