This fixes one very annoying thing collect2 does when trying to debug LTO WPA issues. Even with -v you need to wait until all LTRANS stages completed to see the lto1 -fwpa invocation which is because collect2 buffers and replays stdout/stderr of ld (to avoid duplicating that in some cases). But I really want to see the output immediately but there is no way to do that. The easiest is to disable the buffering with -debug (that is, -Wl,-debug to the -flto driver command line).
Tested with/without -debug. Ok for trunk? Thanks, Richard. 2013-06-10 Richard Biener <rguent...@suse.de> * collect2.c (main): Do not redirect ld stdout/stderr when debugging. Index: gcc/collect2.c =================================================================== --- gcc/collect2.c (revision 199732) +++ gcc/collect2.c (working copy) @@ -1189,8 +1189,11 @@ main (int argc, char **argv) #ifdef COLLECT_EXPORT_LIST export_file = make_temp_file (".x"); #endif - ldout = make_temp_file (".ld"); - lderrout = make_temp_file (".le"); + if (!debug) + { + ldout = make_temp_file (".ld"); + lderrout = make_temp_file (".le"); + } *c_ptr++ = c_file_name; *c_ptr++ = "-x"; *c_ptr++ = "c";