aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2010-01-03 17:03:38 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2010-01-03 09:03:38 -0800
commitd7fb0a6db193bc525447791b2881ecdc17d7cb07 (patch)
tree12c1666e709c28de90b30106f5254dc8d2850417 /gcc/lto
parenteb07a8f567dbb31885c23dbceb43db4489ca1884 (diff)
downloadgcc-d7fb0a6db193bc525447791b2881ecdc17d7cb07.zip
gcc-d7fb0a6db193bc525447791b2881ecdc17d7cb07.tar.gz
gcc-d7fb0a6db193bc525447791b2881ecdc17d7cb07.tar.bz2
Pass -dumpbase and -dumpdir to gcc for LTO
gcc/ 2010-01-03 H.J. Lu <hongjiu.lu@intel.com> PR lto/41564 * common.opt: Add dumpdir. * gcc.c (cc1_options): Add "-dumpbase %B" only if -dumpbase isn't specified. (option_map): Add --dumpdir. * gcc.h (DEFAULT_WORD_SWITCH_TAKES_ARG): Add dumpdir. * lto-wrapper.c (run_gcc): Add -dumpbase and -dumpdir for -o. * opts.c (decode_options): Try dump_dir_name first if dump_base_name isn't an absolute path. (common_handle_option): Handle OPT_dumpdir. * toplev.c (dump_dir_name): New. (print_switch_values): Also ignore -dumpdir. * toplev.h (dump_dir_name): New. gcc/lto/ 2010-01-03 H.J. Lu <hongjiu.lu@intel.com> PR lto/41564 * lto.c (DUMPBASE_SUFFIX): New. (lto_execute_ltrans): Append a sequence number to -dumpbase for LTRANS. From-SVN: r155591
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog7
-rw-r--r--gcc/lto/lto.c28
2 files changed, 32 insertions, 3 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 2aa86db..92e595f 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR lto/41564
+ * lto.c (DUMPBASE_SUFFIX): New.
+ (lto_execute_ltrans): Append a sequence number to -dumpbase
+ for LTRANS.
+
2010-01-02 H.J. Lu <hongjiu.lu@intel.com>
PR lto/42580
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index e62bc02..1608e56 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -1,5 +1,5 @@
/* Top-level LTO routines.
- Copyright 2009 Free Software Foundation, Inc.
+ Copyright 2009, 2010 Free Software Foundation, Inc.
Contributed by CodeSourcery, Inc.
This file is part of GCC.
@@ -1069,6 +1069,8 @@ lto_wpa_write_files (void)
return output_files;
}
+/* Template of LTRANS dumpbase suffix. */
+#define DUMPBASE_SUFFIX ".ltrans18446744073709551615"
/* Perform local transformations (LTRANS) on the files in the NULL-terminated
FILES array. These should have been written previously by
@@ -1088,6 +1090,8 @@ lto_execute_ltrans (char *const *files)
int err;
int status;
FILE *ltrans_output_list_stream = NULL;
+ bool seen_dumpbase = false;
+ char *dumpbase_suffix = NULL;
timevar_push (TV_WHOPR_WPA_LTRANS_EXEC);
@@ -1126,13 +1130,26 @@ lto_execute_ltrans (char *const *files)
++j;
obstack_init (&env_obstack);
obstack_grow (&env_obstack, &collect_gcc_options[i], j - i);
- obstack_1grow (&env_obstack, 0);
+ if (seen_dumpbase)
+ obstack_grow (&env_obstack, DUMPBASE_SUFFIX,
+ sizeof (DUMPBASE_SUFFIX));
+ else
+ obstack_1grow (&env_obstack, 0);
option = XOBFINISH (&env_obstack, char *);
+ if (seen_dumpbase)
+ {
+ dumpbase_suffix = option + 7 + j - i;
+ seen_dumpbase = false;
+ }
/* LTRANS does not need -fwpa nor -fltrans-*. */
if (strncmp (option, "-fwpa", 5) != 0
&& strncmp (option, "-fltrans-", 9) != 0)
- *argv_ptr++ = option;
+ {
+ if (strncmp (option, "-dumpbase", 9) == 0)
+ seen_dumpbase = true;
+ *argv_ptr++ = option;
+ }
}
*argv_ptr++ = "-fltrans";
@@ -1190,6 +1207,11 @@ lto_execute_ltrans (char *const *files)
argv_ptr[2] = files[i];
argv_ptr[3] = NULL;
+ /* Append a sequence number to -dumpbase for LTRANS. */
+ if (dumpbase_suffix)
+ snprintf (dumpbase_suffix, sizeof (DUMPBASE_SUFFIX) - 7,
+ "%lu", (unsigned long) i);
+
/* Execute the driver. */
pex = pex_init (0, "lto1", NULL);
if (pex == NULL)