%:replace-outfile(-lobjc libobjc-gnu.a%s); \
:%:replace-outfile(-lobjc -lobjc-gnu )}}\
%{static|static-libgcc|static-libgfortran:%:replace-outfile(-lgfortran libgfortran.a%s)}\
+ %{static|static-libgcc|static-libphobos:%:replace-outfile(-lgphobos libgphobos.a%s)}\
%{static|static-libgcc|static-libstdc++|static-libgfortran:%:replace-outfile(-lgomp libgomp.a%s)}\
%{static|static-libgcc|static-libstdc++:%:replace-outfile(-lstdc++ libstdc++.a%s)}\
%{force_cpusubtype_ALL:-arch %(darwin_arch)} \
case OPT_static_libstdc__:
saw_static_libcxx = true;
+#ifdef HAVE_LD_STATIC_DYNAMIC
+ /* Remove -static-libstdc++ from the command only if target supports
+ LD_STATIC_DYNAMIC. When not supported, it is left in so that a
+ back-end target can use outfile substitution. */
args[i] |= SKIPOPT;
+#endif
break;
case OPT_static_libphobos:
if (phobos_library != PHOBOS_NOLINK)
phobos_library = PHOBOS_STATIC;
+#ifdef HAVE_LD_STATIC_DYNAMIC
+ /* Remove -static-libphobos from the command only if target supports
+ LD_STATIC_DYNAMIC. When not supported, it is left in so that a
+ back-end target can use outfile substitution. */
args[i] |= SKIPOPT;
+#endif
break;
case OPT_shared_libphobos:
#endif
}
- if (saw_libcxx || need_stdcxx)
+ if (saw_libcxx || saw_static_libcxx || need_stdcxx)
{
#ifdef HAVE_LD_STATIC_DYNAMIC
if (saw_static_libcxx && !static_link)
generate_option (OPT_Wl_, LD_STATIC_OPTION, 1, CL_DRIVER,
&new_decoded_options[j++]);
}
-#else
- /* Push the -static-libstdc++ option back onto the command so that
- a target without LD_STATIC_DYNAMIC can use outfile substitution. */
- if (saw_static_libcxx && !static_link)
- generate_option (OPT_static_libstdc__, NULL, 1, CL_DRIVER,
- &new_decoded_options[j++]);
#endif
if (saw_libcxx)
new_decoded_options[j++] = *saw_libcxx;
case OPT_static_libgcc:
case OPT_shared_libgcc:
case OPT_static_libgfortran:
+ case OPT_static_libphobos:
case OPT_static_libstdc__:
/* These are always valid, since gcc.c itself understands the
- first two, gfortranspec.c understands -static-libgfortran and
- g++spec.c understands -static-libstdc++ */
+ first two, gfortranspec.c understands -static-libgfortran,
+ d-spec.cc understands -static-libphobos, and g++spec.c
+ understands -static-libstdc++ */
validated = true;
break;