aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-wrapper.c
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-wrapper.c
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-wrapper.c')
-rw-r--r--gcc/lto-wrapper.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 5f24f59..ec0a96e 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -1,5 +1,5 @@
/* Wrapper to call lto. Used by collect2 and the linker plugin.
- Copyright (C) 2009 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Factored out of collect2 by Rafael Espindola <espindola@google.com>
@@ -258,7 +258,7 @@ run_gcc (unsigned argc, char *argv[])
const char **argv_ptr;
char *list_option_full = NULL;
- new_argc += 8;
+ new_argc += 12;
new_argv = (const char **) xcalloc (sizeof (char *), new_argc);
argv_ptr = new_argv;
@@ -316,7 +316,31 @@ run_gcc (unsigned argc, char *argv[])
temporary file for the LTO output. The `-o' option
will be interpreted by the linker. */
if (s[2] == '\0')
- i++;
+ {
+ char *output_dir, *base, *name;
+
+ i++;
+ output_dir = xstrdup (argv[i]);
+ base = output_dir;
+ for (name = base; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ *base = '\0';
+
+ *argv_ptr++ = "-dumpbase";
+ if (*output_dir == '\0')
+ {
+ static char current_dir[] =
+ { '.', DIR_SEPARATOR, '\0' };
+ output_dir = current_dir;
+ *argv_ptr++ = argv[i];
+ }
+ else
+ *argv_ptr++ = &argv[i][base - output_dir];
+
+ *argv_ptr++ = "-dumpdir";
+ *argv_ptr++ = output_dir;
+ }
}
else
/* Pass the option or argument to LTO. */