[LTO][PATCH] Fix lto input clobbering bug.

Doug Kwan (關振德) dougkwan@google.com
Tue Oct 28 13:26:00 GMT 2008


Hi,

   This patch fixes a problem where an input object file to LTO can be
overwritten if -fwhopr is used.  The problem is that we ran the
assembler when lto1 does not produce any meaningful output and the
assember uses the same name of one of the input objects as output
filename.  Tested on i686-unknown-linux-gnu

-Doug

2008-10-28  Doug Kwan  <dougkwan@google.com>

	* gcc.c (invoke_as): Do not invoke assembler if -fwpa is given
	in command line.

Index: gcc/gcc/gcc.c
===================================================================
--- gcc/gcc/gcc.c	(revision 141406)
+++ gcc/gcc/gcc.c	(working copy)
@@ -886,9 +886,9 @@ static const char *asm_options =

 static const char *invoke_as =
 #ifdef AS_NEEDS_DASH_FOR_PIPED_INPUT
-"%{!S:-o %|.s |\n as %(asm_options) %|.s %A }";
+"%{!fwpa:%{!S:-o %|.s |\n as %(asm_options) %|.s %A }}";
 #else
-"%{!S:-o %|.s |\n as %(asm_options) %m.s %A }";
+"%{!fwpa:%{!S:-o %|.s |\n as %(asm_options) %m.s %A }}";
 #endif

 /* Some compilers have limits on line lengths, and the multilib_select



More information about the Gcc-patches mailing list