diff mbox

Enale -fno-fat-lto-objects by default

Message ID 20131120131205.GA5535@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Nov. 20, 2013, 1:12 p.m. UTC
Hi,
this is version I commited - we need to intrdocue var for -fuse-linker-plugin
to be able to check it.

I apologize for the breakage.
Honza

	* opts.c (finish_options): Imply -ffat-lto-objects with -fno-use-linker-plugin.
	* common.opt (fuse-linker-plugin): Add var.

Comments

Richard Biener Nov. 20, 2013, 2:04 p.m. UTC | #1
On Wed, Nov 20, 2013 at 2:12 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> this is version I commited - we need to intrdocue var for -fuse-linker-plugin
> to be able to check it.
>
> I apologize for the breakage.
> Honza
>
>         * opts.c (finish_options): Imply -ffat-lto-objects with -fno-use-linker-plugin.
>         * common.opt (fuse-linker-plugin): Add var.
> Index: opts.c

Hmm, but that won't help for

gcc -c t.c -flto
gcc t.o -flto -fno-use-linker-plugin

Isn't that the style how we invoke LTO tests?  (ok we put in useless
-fno-use-linker-plugin in compile stage, too)

So in the end it'll be too fragile for users IMHO.  I think we should
disallow -fno-use-linker-plugin (if we decided to enable it by default
then it won't fall back to no linker plugin but errors if we replace ld
with something too old or remove plugin, right?).

Richard.

>===================================================================
> --- opts.c      (revision 205108)
> +++ opts.c      (working copy)
> @@ -809,10 +809,13 @@ finish_options (struct gcc_options *opts
>  #else
>        error_at (loc, "LTO support has not been enabled in this configuration");
>  #endif
> -      if (!opts->x_flag_fat_lto_objects && !HAVE_LTO_PLUGIN)
> +      if (!opts->x_flag_fat_lto_objects
> +         && (!HAVE_LTO_PLUGIN
> +             || (opts_set->x_flag_use_linker_plugin
> +                 && !opts->x_flag_use_linker_plugin)))
>         {
>           if (opts_set->x_flag_fat_lto_objects)
> -            error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin.");
> +            error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin");
>           opts->x_flag_fat_lto_objects = 1;
>         }
>      }
> Index: common.opt
> ===================================================================
> --- common.opt  (revision 205108)
> +++ common.opt  (working copy)
> @@ -2247,7 +2247,7 @@ Common Negative(fuse-ld=bfd)
>  Use the gold linker instead of the default linker
>
>  fuse-linker-plugin
> -Common Undocumented
> +Common Undocumented Var(flag_use_linker_plugin)
>
>  ; Positive if we should track variables, negative if we should run
>  ; the var-tracking pass only to discard debug annotations, zero if
Jan Hubicka Nov. 20, 2013, 2:23 p.m. UTC | #2
> On Wed, Nov 20, 2013 at 2:12 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> > Hi,
> > this is version I commited - we need to intrdocue var for -fuse-linker-plugin
> > to be able to check it.
> >
> > I apologize for the breakage.
> > Honza
> >
> >         * opts.c (finish_options): Imply -ffat-lto-objects with -fno-use-linker-plugin.
> >         * common.opt (fuse-linker-plugin): Add var.
> > Index: opts.c
> 
> Hmm, but that won't help for
> 
> gcc -c t.c -flto
> gcc t.o -flto -fno-use-linker-plugin
> 
> Isn't that the style how we invoke LTO tests?  (ok we put in useless
> -fno-use-linker-plugin in compile stage, too)

We put -fno-use-linker-plugin everywhere and I think it is what I would expect
people would do, too - just drop -flto -fno-use-linker-plugin as new optimization
option.

> 
> So in the end it'll be too fragile for users IMHO.  I think we should
> disallow -fno-use-linker-plugin (if we decided to enable it by default
> then it won't fall back to no linker plugin but errors if we replace ld
> with something too old or remove plugin, right?).

On plugin enabled setups, I think only value of -fno-use-linker-plugin
is to allow us to test the other code path.
Perhaps we can declare it undocumented and for internal use only?

Honza
> 
> Richard.
> 
> >===================================================================
> > --- opts.c      (revision 205108)
> > +++ opts.c      (working copy)
> > @@ -809,10 +809,13 @@ finish_options (struct gcc_options *opts
> >  #else
> >        error_at (loc, "LTO support has not been enabled in this configuration");
> >  #endif
> > -      if (!opts->x_flag_fat_lto_objects && !HAVE_LTO_PLUGIN)
> > +      if (!opts->x_flag_fat_lto_objects
> > +         && (!HAVE_LTO_PLUGIN
> > +             || (opts_set->x_flag_use_linker_plugin
> > +                 && !opts->x_flag_use_linker_plugin)))
> >         {
> >           if (opts_set->x_flag_fat_lto_objects)
> > -            error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin.");
> > +            error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin");
> >           opts->x_flag_fat_lto_objects = 1;
> >         }
> >      }
> > Index: common.opt
> > ===================================================================
> > --- common.opt  (revision 205108)
> > +++ common.opt  (working copy)
> > @@ -2247,7 +2247,7 @@ Common Negative(fuse-ld=bfd)
> >  Use the gold linker instead of the default linker
> >
> >  fuse-linker-plugin
> > -Common Undocumented
> > +Common Undocumented Var(flag_use_linker_plugin)
> >
> >  ; Positive if we should track variables, negative if we should run
> >  ; the var-tracking pass only to discard debug annotations, zero if
diff mbox

Patch

Index: opts.c
===================================================================
--- opts.c	(revision 205108)
+++ opts.c	(working copy)
@@ -809,10 +809,13 @@  finish_options (struct gcc_options *opts
 #else
       error_at (loc, "LTO support has not been enabled in this configuration");
 #endif
-      if (!opts->x_flag_fat_lto_objects && !HAVE_LTO_PLUGIN)
+      if (!opts->x_flag_fat_lto_objects
+	  && (!HAVE_LTO_PLUGIN
+	      || (opts_set->x_flag_use_linker_plugin
+		  && !opts->x_flag_use_linker_plugin)))
 	{
 	  if (opts_set->x_flag_fat_lto_objects)
-            error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin.");
+            error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin");
 	  opts->x_flag_fat_lto_objects = 1;
 	}
     }
Index: common.opt
===================================================================
--- common.opt	(revision 205108)
+++ common.opt	(working copy)
@@ -2247,7 +2247,7 @@  Common Negative(fuse-ld=bfd)
 Use the gold linker instead of the default linker
 
 fuse-linker-plugin
-Common Undocumented
+Common Undocumented Var(flag_use_linker_plugin)
 
 ; Positive if we should track variables, negative if we should run
 ; the var-tracking pass only to discard debug annotations, zero if