The above will print something like
/tmp/ccwbQ8B2.lto.o
- If -fwhopr is used instead, more than one file might be produced
+ If WHOPR is used instead, more than one file might be produced
./ccXj2DTk.lto.ltrans.o
./ccCJuXGv.lto.ltrans.o
*/
#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. */
bool seen_o = false;
int parallel = 0;
int jobserver = 0;
+ bool no_partition = false;
/* Get the driver and options. */
collect_gcc = getenv ("COLLECT_GCC");
if (strcmp (option, "-v") == 0)
verbose = 1;
+ if (strcmp (option, "-flto-partition=none") == 0)
+ no_partition = true;
/* We've handled these LTO options, do not pass them on. */
- if (strcmp (option, "-flto") == 0)
- lto_mode = LTO_MODE_LTO;
- else if (strncmp (option, "-fwhopr", 7) == 0)
+ if (strncmp (option, "-flto=", 6) == 0
+ || !strcmp (option, "-flto"))
{
lto_mode = LTO_MODE_WHOPR;
- if (option[7] == '=')
+ if (option[5] == '=')
{
- if (!strcmp (option + 8, "jobserver"))
+ if (!strcmp (option + 6, "jobserver"))
{
jobserver = 1;
parallel = 1;
}
else
{
- parallel = atoi (option+8);
+ parallel = atoi (option + 6);
if (parallel <= 1)
parallel = 0;
}
else
*argv_ptr++ = option;
}
+ if (no_partition)
+ {
+ lto_mode = LTO_MODE_LTO;
+ jobserver = 0;
+ parallel = 0;
+ }
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[0] = linker_output;
argv_ptr[1] = "-o";
argv_ptr[2] = flto_out;
- argv_ptr[3] = "-combine";
}
- else if (lto_mode == LTO_MODE_WHOPR)
+ else
{
const char *list_option = "-fltrans-output-list=";
size_t list_option_len = strlen (list_option);
strcpy (tmp, ltrans_output_file);
argv_ptr[2] = "-fwpa";
- argv_ptr[3] = "-combine";
}
- else
- fatal ("invalid LTO mode");
/* Append the input objects and possible preceeding arguments. */
for (i = 1; i < argc; ++i)
- argv_ptr[3 + i] = argv[i];
- argv_ptr[3 + i] = NULL;
+ argv_ptr[2 + i] = argv[i];
+ argv_ptr[2 + i] = NULL;
fork_execute (CONST_CAST (char **, new_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;
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