Avoid invalid LTO mode errors

Submitted by Jan Hubicka on Dec. 5, 2010, 1:30 p.m.

Details

Message ID 20101205133042.GD19019@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Dec. 5, 2010, 1:30 p.m.
Hi,
compiling object produced with -flto with -fuse-linker-plugin only currently leads to 
invalid LTO mode fatal error. This is because linker claims the files, but no LTO mode
is specified.
While for fat objects (i.e. all we support at the moment) we probably should modify linker
plugin to not claim anything (I will do that incrementally), we really want to default
to WHOPR in lto-wraper: it is executed only when LTO is needed. This will be needed once we
support slim files.

Bootstrapped/regtested x86_64, linux, OK?

	* lto-wrapper.c (run_gcc): Default to WHOPR mode when none is specified
	at the command line.

Comments

Diego Novillo Dec. 8, 2010, 2:08 p.m.
On Sun, Dec 5, 2010 at 08:30, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> compiling object produced with -flto with -fuse-linker-plugin only currently leads to
> invalid LTO mode fatal error. This is because linker claims the files, but no LTO mode
> is specified.
> While for fat objects (i.e. all we support at the moment) we probably should modify linker
> plugin to not claim anything (I will do that incrementally), we really want to default
> to WHOPR in lto-wraper: it is executed only when LTO is needed. This will be needed once we
> support slim files.
>
> Bootstrapped/regtested x86_64, linux, OK?
>
>        * lto-wrapper.c (run_gcc): Default to WHOPR mode when none is specified
>        at the command line.

OK.


Diego.

Patch hide | download patch | download mbox

Index: lto-wrapper.c
===================================================================
--- lto-wrapper.c	(revision 167472)
+++ lto-wrapper.c	(working copy)
@@ -422,7 +422,7 @@  run_gcc (unsigned argc, char *argv[])
       argv_ptr[1] = "-o";
       argv_ptr[2] = flto_out;
     }
-  else if (lto_mode == LTO_MODE_WHOPR)
+  else 
     {
       const char *list_option = "-fltrans-output-list=";
       size_t list_option_len = strlen (list_option);
@@ -457,8 +457,6 @@  run_gcc (unsigned argc, char *argv[])
 
       argv_ptr[2] = "-fwpa";
     }
-  else
-    fatal ("invalid LTO mode");
 
   /* Append the input objects and possible preceeding arguments.  */
   for (i = 1; i < argc; ++i)
@@ -473,7 +471,7 @@  run_gcc (unsigned argc, char *argv[])
       free (flto_out);
       flto_out = NULL;
     }
-  else if (lto_mode == LTO_MODE_WHOPR)
+  else
     {
       FILE *stream = fopen (ltrans_output_file, "r");
       FILE *mstream = NULL;
@@ -615,8 +613,6 @@  cont:
       free (input_names);
       free (list_option_full);
     }
-  else
-    fatal ("invalid LTO mode");
 
   obstack_free (&env_obstack, NULL);
 }