This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix bootstrap/PR63632


r216566 (r216568 for 4.9 branch) added %{fno-lto} to LINK_COMMAND_SPEC.
However the linker doesn't understand -fno-lto and errors out.
This causes LTO/PGO bootstrap to fail, because -fno-lto is used during
STAGEprofile.
Fixed by filtering out -fno-lto in collect2.c.

LTO/PGO bootstrapped and tested on powerpc64-unknown-linux-gnu.
Preapproved by Jakub on IRC.
Applied to trunk and 4.9 branch.

2014-10-24  Markus Trippelsdorf  <markus@trippelsdorf.de>

	PR bootstrap/63632
	* collect2.c (main): Filter out -fno-lto.

	PR bootstrap/63632
	* g++.dg/torture/pr63632.C: New test.

diff --git a/gcc/collect2.c b/gcc/collect2.c
index c54e6fb51578..7c067ffcafbb 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1311,6 +1311,12 @@ main (int argc, char **argv)
 		  ld1--;
 		  ld2--;
 		}
+	      else if (strncmp (arg, "-fno-lto", 8) == 0)
+		{
+		  /* Do not pass -fno-lto to the linker. */
+		  ld1--;
+		  ld2--;
+		}
 #ifdef TARGET_AIX_VERSION
 	      else
 		{
diff --git a/gcc/testsuite/g++.dg/torture/pr63632.C b/gcc/testsuite/g++.dg/torture/pr63632.C
new file mode 100644
index 000000000000..48cd8692412a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr63632.C
@@ -0,0 +1,5 @@
+// PR bootstrap/63632
+// { dg-do link }
+// { dg-options "-fno-lto" }
+
+int main () {}
-- 
Markus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]