This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Add -static-libquadmath option

FX wrote:
> Patch needs:
>   - C/driver options maintainer, or global reviewer, to OK the C changes (outside darwin). They are really simple
>   - Fortran maintainer to OK the Fortran part
> >> We have a -static-libgfortran option, but on targets where we support quad-prec math through libquadmath, we didnât have an equivalent -static-libquadmath so far. This patch adds it, in what I think is a rather straightforward manner.
> >> 
> >> The only minor complication comes from the fact that previously, linking libquadmath was conditionally through libgfortran.spec. So the spec was modified: when we use -static-libquadmath, the driver itself includes the -lquadmath (surrounded by the necessary static linking directives), so that libgfortran.spec shouldnât do it again.

That unfortunately looses the -as-needed functionality, not that it currently works as hoped for.

> >> Bootstrapped and regtested on x86_64 linux. OK to commit?

--- gcc/fortran/gfortranspec.c	(revision 216036)
+++ gcc/fortran/gfortranspec.c	(working copy)
+add_arg_libgfortran (bool force_static ATTRIBUTE_UNUSED,
+		     bool force_static_libquadmath ATTRIBUTE_UNUSED)

First, you don't need ATTRIBUTE_UNUSED for force_static_libquadmath as
it is always used.

But my actual problem is that your patch does't seem to work if -static-gfortran
is not in force. You then get:

   append_option (OPT_l, FORTRAN_LIBRARY, 1);
   append_option (OPT_l, QUADMATH_LIBRARY, 1);

instead of:

  append_option (OPT_l, FORTRAN_LIBRARY, 1);

  append_option (OPT_Wl_, LD_STATIC_OPTION, 1);
  append_option (OPT_l, QUADMATH_LIBRARY, 1);
  append_option (OPT_Wl_, LD_DYNAMIC_OPTION, 1);

Additionally, I wonder whether you need the
+  if (force_static_libquadmath)
+    append_option (OPT_l, QUADMATH_LIBRARY, 1);

at all, given that you have in:

Index: gcc/fortran/options.c
+    case OPT_static_libquadmath:
+      gfc_fatal_error ("-static-libquadmath is not supported in this "
+		       "configuration");
+      break;

and that without -static-lquadmath, the -lquadmath is added - with as-needed -
in libgfortran's .spec file. (Mentioning this in gfortranspec.c wouldn't harm,
I'd presume.)

(NB: If you remove the #else, you do need the ATTRIBUTE_UNUSED, again.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]