From: Stan Shebs <shebs@apple.com>
To: Norman Gray <norman@astro.gla.ac.uk>
Cc: fortran-dev@lists.apple.com
Subject: Re: Link problems: restFP/saveFP and -lcc_dynamic -- why?
Date: Tue, 27 Jul 2004 12:04:25 -0700
Message-ID: <4106A739.1070808@apple.com>
References: <Pine.LNX.4.58.0407271319070.26008@ptolemy>
In-Reply-To: <Pine.LNX.4.58.0407271319070.26008@ptolemy>

Norman Gray wrote:

>Greetings,
>
>Can anyone explain to me what the story is with the restFP/saveFP
>symbols, which cause such inexplicable link problems with (some? all?)
>combinations of g77 and gcc code?  [I posted this query on
>macosx-dev@omnigroup.com a few days ago, but nobody wanted to bite].
>
The underlying situation is that saveFP/restFP are entry points to
special assembly language routines that some versions of the compiler
will call instead of issuing a long string of floating-point register
loads and stores when calling a function; saves a little space in
code. Normally the definitions get compiled into GCC's own library
libgcc, aka libcc_dynamic, and normally the compiler adds the library
to the link line automagically.

Problems come up because not every version of GCC issues the
saveFP/restFP calls in preference to issuing the loads/stores directly,
so if you mix-n-match compilers and don't link a libgcc that defines
these, you get undefines.  Another thing to watch out for is random
libraries that were compiled by a GCC that assumes these, but linking
with a libgcc that doesn't.

In particular, restFP/saveFP has been one of the differences
between FSF GCC and Apple GCC.

Stan


