This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Full float128, third iteration
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: FX <fxcoudert at gmail dot com>
- Cc: Angelo Graziosi <angelo dot graziosi at alice dot it>, Fortran List <fortran at gcc dot gnu dot org>, gcc at gcc dot gnu dot org
- Date: Fri, 10 Sep 2010 10:31:12 -0700
- Subject: Re: [RFC] Full float128, third iteration
- References: <7400DFC8-DD7A-4AEF-B787-5D34693D98C8@gmail.com> <4C8A45DA.6060103@alice.it> <00431C64-D1E2-445C-A78F-4C9148D0C46F@gmail.com> <20100910162530.GA28759@troutmask.apl.washington.edu> <4FACF497-A4DA-4ACA-A099-D60A0B7BD701@gmail.com>
On Fri, Sep 10, 2010 at 07:08:10PM +0200, FX wrote:
> I'm CC'ing the gcc list so I can get insight from people who understand correctly how static libraries should be handled by the driver...
>
> > I'm seeing a similar issue with -static linkage.
> >
> > % gfc4x -o z norm2_3.f90 -L/usr/home/sgk/work/lib -lquad -static
>
> OK, I see the same thing. It's due to the fact that when you call:
>
> gfortran mycode.f90 -lquad -static
>
> the linker is called with the following order for the libraries:
>
> -lquad -lgfortran -lm --start-group -lgcc -lgcc_eh -lc --end-group
>
> while libgfortran depends on libquad, so it should be "-lgfortran -lquad".
>
> I'm not very knowledgeable about that, but I think what we can
> have the driver recognized "-lquad" and move it after "-lgfortran".
> That won't handle all cases (what if libquad is called something
> else on your computer? what if you link to a specific version,
> -lquad1.0? what if you link directly by specifying the archive file,
> /path/to/libquad.a?)
>
The ideal solution would be incorporating libquad into libgfortran,
which may option depending on the outcome of Toon's discussion with
the SC. Barring this solution, I think we may need to use the
--with-quad=some_path to define a WITH_QUAD for the fortran frontend.
Then, we modify gfortranspec.c to include -lquad in the proper
order. Don't know if this is doable or not; maybe something like
troutmask:sgk[210] svn diff gfortranspec.c
Index: gfortranspec.c
===================================================================
--- gfortranspec.c (revision 164190)
+++ gfortranspec.c (working copy)
@@ -63,6 +63,10 @@ along with GCC; see the file COPYING3.
#define FORTRAN_LIBRARY "gfortran"
#endif
+#ifndef QUAD_LIBRARY
+#define QUAD_LIBRARY "quad"
+#endif
+
/* The original argument list and related info is copied here. */
static unsigned int g77_xargc;
static const struct cl_decoded_option *g77_x_decoded_options;
@@ -168,6 +172,11 @@ add_arg_libgfortran (bool force_static A
append_option (OPT_Wl_, "-Bstatic", 1);
#endif
append_option (OPT_l, FORTRAN_LIBRARY, 1);
+#if WITH_QUAD
+ /* Need path to libquad, too? */
+ append_option (OPT_l, QUAD_LIBRARY, 1);
+#endif
+
#ifdef HAVE_LD_STATIC_DYNAMIC
if (force_static)
append_option (OPT_Wl_, "-Bdynamic", 1);
--
Steve