This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix -fPIC issue with GNU LD and LTO


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.

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)

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]