re PR driver/47244 (plugin linker is used unconditionally)
authorJan Hubicka <jh@suse.cz>
Wed, 12 Jan 2011 15:47:29 +0000 (16:47 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 12 Jan 2011 15:47:29 +0000 (15:47 +0000)
PR driver/47244
* gcc.c (PLUGIN_COND): Update to disable plugin unless -flto is used.
(PLUGIN_COND_CLOSE): New macro.
(LINK_COMMAND_SPEC): Update to use PLUGIN_COND_CLOSE.

From-SVN: r168717

gcc/ChangeLog
gcc/gcc.c

index 4724df2f7b71276dff89d03b34b24cd9a813b226..db57dfd81adb5ae699b5b8c8a9a45ed6552ffdf6 100644 (file)
@@ -1,3 +1,10 @@
+2011-01-12  Jan Hubicka  <jh@suse.cz>
+
+       PR driver/47244
+       * gcc.c (PLUGIN_COND): Update to disable plugin unless -flto is used.
+       (PLUGIN_COND_CLOSE): New macro.
+       (LINK_COMMAND_SPEC): Update to use PLUGIN_COND_CLOSE.
+
 2011-01-12  Richard Guenther  <rguenther@suse.de>
 
        PR lto/47259
index 9532d7efd8bbd488a8b5320220d5d93a8161cce7..ea3403b5ca96fac0f2d355470ba2d45705aad124 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -621,11 +621,18 @@ proper position among the other output files.  */
 # endif
 #endif
 
-/* Conditional to test whether plugin is used or not.  */
+/* Conditional to test whether plugin is used or not.
+   FIXME: For slim LTO we will need to enable plugin unconditionally.  This
+   still cause problems with PLUGIN_LD != LD and when plugin is built but
+   not useable.  For GCC 4.6 we don't support slim LTO and thus we can enable
+   plugin only when LTO is enabled.  We still honor explicit
+   -fuse-linker-plugin.  */
 #ifdef HAVE_LTO_PLUGIN
-#define PLUGIN_COND "!fno-use-linker-plugin"
+#define PLUGIN_COND "!fno-use-linker-plugin:%{flto|flto=*|fuse-linker-plugin"
+#define PLUGIN_COND_CLOSE "}"
 #else
 #define PLUGIN_COND "fuse-linker-plugin"
+#define PLUGIN_COND_CLOSE ""
 #endif
 
 
@@ -646,9 +653,9 @@ proper position among the other output files.  */
     -plugin-opt=%(lto_wrapper) \
     -plugin-opt=-fresolution=%u.res \
     %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} \
-    } \
-    %{flto*:%<fcompare-debug*} \
-    %{flto*} %l " LINK_PIE_SPEC \
+    }"PLUGIN_COND_CLOSE" \
+    %{flto|flto=*:%<fcompare-debug*} \
+    %{flto} %{flto=*} %l " LINK_PIE_SPEC \
    "%X %{o*} %{e*} %{N} %{n} %{r}\
     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
     %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\