Patchwork RFA: PATCH to invoke lto-wrapper with -v if -debug was passed to collect2

login
register
mail settings
Submitter Jason Merrill
Date June 15, 2010, 7:19 p.m.
Message ID <4C17D258.3070302@redhat.com>
Download mbox | patch
Permalink /patch/55782/
State New
Headers show

Comments

Jason Merrill - June 15, 2010, 7:19 p.m.
I couldn't figure out any flag to give GCC to make it run lto-wrapper 
with -v, so I hacked up collect2 a bit: with this patch, gcc -Wl,-debug 
will end up calling lto-wrapper -v.

OK for trunk?
Richard Guenther - June 16, 2010, 7:09 a.m.
On Tue, Jun 15, 2010 at 9:19 PM, Jason Merrill <jason@redhat.com> wrote:
> I couldn't figure out any flag to give GCC to make it run lto-wrapper with
> -v, so I hacked up collect2 a bit: with this patch, gcc -Wl,-debug will end
> up calling lto-wrapper -v.

Simply passing -v to GCC should work as lto-wrapper honours
COLLECT2_GCC_OPTIONS.  And lto-wrapper doesn't inspect its
arguments for -v, so your patch will not make a difference but
simply causes it to pass -v to the LTO/WPA stages.

> OK for trunk?

Am I missing something?

Richard.

Patch

commit 5f1e09f7fc9572c77ebdfa31eb187683eaf15d74
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Jun 14 01:42:16 2010 -0400

    	* collect2.c (maybe_run_lto_and_relink): If -debug, pass -v down.

diff --git a/gcc/collect2.c b/gcc/collect2.c
index 42db3cb..1931ea7 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -962,6 +962,9 @@  maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
 
       *lto_c_ptr++ = lto_wrapper;
 
+      if (debug)
+	*lto_c_ptr++ = "-v";
+
       /* Add LTO objects to the wrapper command line.  */
       for (list = lto_objects.first; list; list = list->next)
 	*lto_c_ptr++ = list->name;