This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR lto/42613: -save-temps doesn't work completely for -fwhopr
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 4 Jan 2010 09:37:45 -0800
- Subject: PATCH: PR lto/42613: -save-temps doesn't work completely for -fwhopr
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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. */