http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48245
Iain Sandoe <iains at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2011.03.23 17:07:04 Ever Confirmed|0 |1 --- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> 2011-03-23 17:07:04 UTC --- I'll try this on *-darwin9 and a darwin9-X-cris-elf (I assume we need to clone all the logic to cater for cross compiler cases... ) maybe this is getting complex enough to warrant a spec of its own? (and then we could avoid cloning it) === Index: gcc/config/darwin.h =================================================================== --- gcc/config/darwin.h (revision 171353) +++ gcc/config/darwin.h (working copy) @@ -174,6 +174,38 @@ extern GTY(()) int darwin_ms_struct; #define CPP_SPEC "%{static:%{!dynamic:-D__STATIC__}}%{!static:-D__DYNAMIC__}" \ " %{pthread:-D_REENTRANT}" +/* Conditional to test whether the LTO 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 if the linker used understands -plugin. */ + +/* The linker has some plugin support. */ +#if HAVE_LTO_PLUGIN > 0 +/* The linker used has full plugin support, use LTO plugin by default. */ +#if HAVE_LTO_PLUGIN == 2 +#define PLUGIN_COND "!fno-use-linker-plugin:%{flto|flto=*|fuse-linker-plugin" +#define PLUGIN_COND_CLOSE "}" +#else +/* The linker used has limited plugin support, use LTO plugin with explicit + -fuse-linker-plugin. */ +#define PLUGIN_COND "fuse-linker-plugin" +#define PLUGIN_COND_CLOSE "" +#endif +#define LINK_PLUGIN_SPEC \ + "%{"PLUGIN_COND": \ + -plugin %(linker_plugin_file) \ + -plugin-opt=%(lto_wrapper) \ + -plugin-opt=-fresolution=%u.res \ + %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} \ + }"PLUGIN_COND_CLOSE +#else +/* The linker used doesn't support -plugin, reject -fuse-linker-plugin. */ +#define LINK_PLUGIN_SPEC "%{fuse-linker-plugin:\ + %e-fuse-linker-plugin is not supported in this configuration}" +#endif + /* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus precomp, libtool, and fat build additions. @@ -185,6 +217,7 @@ extern GTY(()) int darwin_ms_struct; #define LINK_COMMAND_SPEC_A \ "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %(linker) \ + " LINK_PLUGIN_SPEC " \ %{flto*:%<fcompare-debug*} \ %{flto*} \ %l %X %{s} %{t} %{Z} %{u*} \