OSDN Git Service

Refine previous change.
[pf3gnuchains/gcc-fork.git] / gcc / lto-wrapper.c
index d0a80ad..f26b3ac 100644 (file)
@@ -40,19 +40,10 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include <errno.h>
-#include <signal.h>
-#if ! defined( SIGCHLD ) && defined( SIGCLD )
-#  define SIGCHLD SIGCLD
-#endif
 #include "intl.h"
-#include "libiberty.h"
+#include "diagnostic.h"
 #include "obstack.h"
 
-#ifndef HAVE_KILL
-#define kill(p,s) raise(s)
-#endif
-
 int debug;                             /* true if -save-temps.  */
 int verbose;                           /* true if -v.  */
 
@@ -402,6 +393,7 @@ run_gcc (unsigned argc, char *argv[])
   if (linker_output)
     {
       char *output_dir, *base, *name;
+      bool bit_bucket = strcmp (linker_output, HOST_BIT_BUCKET) == 0;
 
       output_dir = xstrdup (linker_output);
       base = output_dir;
@@ -416,8 +408,11 @@ run_gcc (unsigned argc, char *argv[])
          static char current_dir[] = { '.', DIR_SEPARATOR, '\0' };
          output_dir = current_dir;
        }
-      *argv_ptr++ = "-dumpdir";
-      *argv_ptr++ = output_dir;
+      if (!bit_bucket)
+       {
+         *argv_ptr++ = "-dumpdir";
+         *argv_ptr++ = output_dir;
+       }
 
       *argv_ptr++ = "-dumpbase";
     }
@@ -432,7 +427,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);
@@ -467,8 +462,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)
@@ -483,7 +476,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;
@@ -625,8 +618,6 @@ cont:
       free (input_names);
       free (list_option_full);
     }
-  else
-    fatal ("invalid LTO mode");
 
   obstack_free (&env_obstack, NULL);
 }
@@ -637,8 +628,19 @@ cont:
 int
 main (int argc, char *argv[])
 {
+  const char *p;
+
+  p = argv[0] + strlen (argv[0]);
+  while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
+    --p;
+  progname = p;
+
+  xmalloc_set_program_name (progname);
+
   gcc_init_libintl ();
 
+  diagnostic_initialize (global_dc, 0);
+
   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
     signal (SIGINT, fatal_signal);
 #ifdef SIGHUP