PATCH: PR lto/42613: -save-temps doesn't work completely for -fwhopr
H.J. Lu
hongjiu.lu@intel.com
Mon Jan 4 17:37:00 GMT 2010
Hi,
This patch sets WPA_SAVE_LTRANS if -save-temps is passed to gcc with
LTO. OK for trunk?
Thanks.
H.J.
---
2010-01-04 H.J. Lu <hongjiu.lu@intel.com>
PR lto/42613
* collect2.c (maybe_run_lto_and_relink): Set WPA_SAVE_LTRANS if
-save-temps is passed to gcc.
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 6e25b1e..332a062 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -934,6 +934,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
char *lto_wrapper = getenv ("COLLECT_LTO_WRAPPER");
struct pex_obj *pex;
const char *prog = "lto-wrapper";
+ bool save_temps = false;
if (!lto_wrapper)
fatal ("COLLECT_LTO_WRAPPER must be set.");
@@ -977,6 +978,9 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
{
const char *s = extract_string (&cp);
+ if (strncmp (s, "-save-temps", 11) == 0)
+ save_temps = true;
+
/* Pass the option or argument to the wrapper. */
*lto_c_ptr++ = xstrdup (s);
}
@@ -992,7 +996,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
*lto_c_ptr = NULL;
/* Save intermediate WPA files in lto1 if debug. */
- if (debug)
+ if (debug || save_temps)
putenv (xstrdup ("WPA_SAVE_LTRANS=1"));
/* Run the LTO back end. */
More information about the Gcc-patches
mailing list