Fix bootstrap/PR63632
authorMarkus Trippelsdorf <markus@trippelsdorf.de>
Fri, 24 Oct 2014 06:39:24 +0000 (06:39 +0000)
committerMarkus Trippelsdorf <trippels@gcc.gnu.org>
Fri, 24 Oct 2014 06:39:24 +0000 (06:39 +0000)
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 an LTO/PGO bootstrap failure, because -fno-lto is used
during STAGEprofile.
Fixed by filtering out -fno-lto in collect2.c.

From-SVN: r216613

gcc/ChangeLog
gcc/collect2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr63632.C [new file with mode: 0644]

index cefe8ffab74970a7f1a92cd9bd1a5a7c7e955687..857acd07f82e0953068a97cfefbf65c154e21994 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-24  Markus Trippelsdorf  <markus@trippelsdorf.de>
+
+       PR bootstrap/63632
+       * collect2.c (main): Filter out -fno-lto.
+
 2014-10-24  Martin Liska  <mliska@suse.cz>
 
        * ipa-icf.c (sem_item_optimizer::parse_nonsingleton_classes): Guard
index c54e6fb51578185696a33f2bf3dad8c0003d7f4c..7c067ffcafbb7088e1ec2b44e3a0a660a03801be 100644 (file)
@@ -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
                {
index 88e08e0442e6d4c92b3f1ed0a640541e4f4a94be..3b7dbdca53afa0f7ff59aab41f2ac0d2bbf2e5df 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-24  Markus Trippelsdorf  <markus@trippelsdorf.de>
+
+       PR bootstrap/63632
+       * g++.dg/torture/pr63632.C: New test.
+
 2014-10-23  Jonathan Wakely  <jwakely@redhat.com>
 
        PR c++/63619
diff --git a/gcc/testsuite/g++.dg/torture/pr63632.C b/gcc/testsuite/g++.dg/torture/pr63632.C
new file mode 100644 (file)
index 0000000..48cd869
--- /dev/null
@@ -0,0 +1,5 @@
+// PR bootstrap/63632
+// { dg-do link }
+// { dg-options "-fno-lto" }
+
+int main () {}