This was unimplemented so far.
gcc/ChangeLog:
* common.opt: Add -static-libgm2.
* config/darwin.h (LINK_SPEC): Handle static-libgm2.
* doc/gm2.texi: Document static-libgm2.
* gcc.cc (driver_handle_option): Allow static-libgm2.
gcc/m2/ChangeLog:
* gm2spec.cc (lang_specific_driver): Handle static-libgm2.
* lang.opt: Add static-libgm2.
Driver
; Documented for Fortran, but always accepted by driver.
+static-libgm2
+Driver
+; Documented for Modula-2, but always accepted by driver.
+
static-libphobos
Driver
; Documented for D, but always accepted by driver.
%{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)} \
+ %{static|static-libgm2:%:replace-outfile(-lm2pim libm2pim.a%s)}\
+ %{static|static-libgm2:%:replace-outfile(-lm2iso libm2iso.a%s)}\
+ %{static|static-libgm2:%:replace-outfile(-lm2min libm2min.a%s)}\
+ %{static|static-libgm2:%:replace-outfile(-lm2log libm2log.a%s)}\
+ %{static|static-libgm2:%:replace-outfile(-lm2cor libm2cor.a%s)}\
+ %{force_cpusubtype_ALL:-arch %(darwin_arch)} \
%{!force_cpusubtype_ALL:-arch %(darwin_subarch)} "\
LINK_SYSROOT_SPEC \
"%{mmacosx-version-min=*:-macosx_version_min %*} \
The option @samp{-fno-libs=-} disables the @samp{gm2} driver from
modifying the search and library paths.
+@item -static-libgm2
+On systems that provide the m2 runtimes as both shared and static libraries,
+this option forces the use of the static version.
+
@c flocation=
@c Modula-2 Joined
@c set all location values to a specific value (internal switch)
case OPT_static_libgfortran:
case OPT_static_libquadmath:
case OPT_static_libphobos:
+ case OPT_static_libgm2:
case OPT_static_libstdc__:
- /* These are always valid, since gcc.cc itself understands the
- first two, gfortranspec.cc understands -static-libgfortran,
- d-spec.cc understands -static-libphobos, g++spec.cc
- understands -static-libstdc++ and libgfortran.spec handles
- -static-libquadmath. */
+ /* These are always valid; gcc.cc itself understands the first two
+ gfortranspec.cc understands -static-libgfortran,
+ libgfortran.spec handles -static-libquadmath,
+ d-spec.cc understands -static-libphobos,
+ gm2spec.cc understands -static-libgm2,
+ and g++spec.cc understands -static-libstdc++. */
validated = true;
break;
/* Should the driver perform a link? */
bool linking = true;
+ /* Should the driver link the shared gm2 libs? */
+ bool shared_libgm2 = true;
+
/* "-lm" or "-lmath" if it appears on the command line. */
const struct cl_decoded_option *saw_math = NULL;
/* By default, we throw on the math library if we have one. */
int need_math = (MATH_LIBRARY[0] != '\0');
- /* 1 if we should add -lpthread to the command-line. */
+ /* 1 if we should add -lpthread to the command-line.
+ FIXME: the default should be a configuration choice. */
int need_pthread = 1;
/* True if we saw -static. */
#endif
break;
+ case OPT_static_libgm2:
+ shared_libgm2 = false;
+#ifdef HAVE_LD_STATIC_DYNAMIC
+ /* Remove -static-libgm2 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_stdlib_:
which_library = (stdcxxlib_kind) decoded_options[i].value;
break;
if (linking)
{
+#ifdef HAVE_LD_STATIC_DYNAMIC
+ if (allow_libraries && !shared_libgm2)
+ append_option (OPT_Wl_, LD_STATIC_OPTION, 1);
+#endif
if (allow_libraries)
add_default_archives (libpath, libraries);
+#ifdef HAVE_LD_STATIC_DYNAMIC
+ if (allow_libraries && !shared_libgm2)
+ append_option (OPT_Wl_, LD_DYNAMIC_OPTION, 1);
+#endif
/* Add `-lstdc++' if we haven't already done so. */
#ifdef HAVE_LD_STATIC_DYNAMIC
if (library > 1 && !static_link)
Modula-2 Joined
specify the language from the compiler driver
+static-libgm2
+Driver
+Link the standard Modula-2 libraries statically in the compilation.
+
; This comment is to ensure we retain the blank line above.