#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. */
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;
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";
}
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);
argv_ptr[2] = "-fwpa";
}
- else
- fatal ("invalid LTO mode");
/* Append the input objects and possible preceeding arguments. */
for (i = 1; i < argc; ++i)
free (flto_out);
flto_out = NULL;
}
- else if (lto_mode == LTO_MODE_WHOPR)
+ else
{
FILE *stream = fopen (ltrans_output_file, "r");
FILE *mstream = NULL;
free (input_names);
free (list_option_full);
}
- else
- fatal ("invalid LTO mode");
obstack_free (&env_obstack, NULL);
}
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