PATCH: PR lto/42581: "gcc -v" doesn't work with lto
H.J. Lu
hongjiu.lu@intel.com
Mon Jan 4 04:23:00 GMT 2010
On Sun, Jan 03, 2010 at 11:13:52AM -0800, H.J. Lu wrote:
> Hi,
>
> Here are 2 patches for PR lto/42581.
>
> Since collect2 is the part of gcc, we should turn trace in collect2 if
> -v is passed to gcc.
>
> Also lto1 should save all temp files if -save-temps is passed to gcc. We
> can do that by settting WPA_SAVE_LTRANS if -save-temps is passed to gcc.
>
> OK for trunk?
>
> Thanks.
>
>
> H.J.
> ---
> 2010-01-03 H.J. Lu <hongjiu.lu@intel.com>
>
> PR lto/42581
> * collect2.c (main): Turn on trace in collect2 if -v is passed
> to gcc.
>
It turns out that I can't turn on trace in collect2 whenever -v is
passed to gcc. Libtool use "gcc -v" to scan output for linker command
line. When "gcc -v" outputs both collect2 and collect-ld command lines,
libtool gets really confused.
This patch turns on trace in collect2 if -v is passed. Tested on
Linux/x86-64. OK for trunk?
Thanks.
H.J.
---
2010-01-03 H.J. Lu <hongjiu.lu@intel.com>
PR lto/42581
* collect2.c (main): Turn on trace in collect2 if -v is passed
to gcc with LTO.
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 64af28c..b2aa747 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1178,6 +1178,8 @@ main (int argc, char **argv)
int num_c_args;
char **old_argv;
+ bool use_verbose = false;
+
old_argv = argv;
expandargv (&argc, &argv);
if (argv != old_argv)
@@ -1232,12 +1234,19 @@ main (int argc, char **argv)
if (! strcmp (argv[i], "-debug"))
debug = 1;
else if (! strcmp (argv[i], "-flto") && ! use_plugin)
- lto_mode = LTO_MODE_LTO;
+ {
+ use_verbose = true;
+ lto_mode = LTO_MODE_LTO;
+ }
else if (! strcmp (argv[i], "-fwhopr") && ! use_plugin)
- lto_mode = LTO_MODE_WHOPR;
+ {
+ use_verbose = true;
+ lto_mode = LTO_MODE_WHOPR;
+ }
else if (! strcmp (argv[i], "-plugin"))
{
use_plugin = true;
+ use_verbose = true;
lto_mode = LTO_MODE_NONE;
}
#ifdef COLLECT_EXPORT_LIST
@@ -1450,6 +1459,11 @@ main (int argc, char **argv)
*c_ptr++ = xstrdup (q);
}
}
+ if (use_verbose && *q == '-' && q[1] == 'v' && q[2] == 0)
+ {
+ /* Turn on trace in collect2 if needed. */
+ vflag = 1;
+ }
}
obstack_free (&temporary_obstack, temporary_firstobj);
*c_ptr++ = "-fno-profile-arcs";
More information about the Gcc-patches
mailing list