Joerg Schilling wrote:
Joerg Schilling wrote:
It is currently impossible to create a 100% Sun compatible libm.
Keith M Wesolowski <[EMAIL PROTECTED]> wrote:
Why?
Joerg Schilling wrote:
libm not only depends on ANSI C-99 but on undocumented hidden
behavior of Studio 10.
Can you report them to us (via some wiki page, a blog, or an email
by decreasing order of preference) ?
If you have a list of issues that you've seen,
at least we can try to get an informal documentation on what
Studio 10 expects from libm.
Unfortunately, I don't think there's an existing document
that lists all such dependences,
and it's possible that there are dependences that
we're not even aware of.
OTOH, I just hope we'll opensource libm as soon as possible..
It seems that there are two basic "reasons":
- Sun CC as well as GNU CC heavily use built in functions
for floating point support. Of course these builtins are
incompatible :-(
- Sun cc calls sin() if you use "normal" optimization but
if you use the optimization that is used by e.g. X11,
it calls __sin() from the same source.
__ versions of functions shouldn't be a problem,
since non __ versions are simply weak aliases for __ versions.
You should be able to just name everything __ and
have weak aliases for them.
As a result, my first libm could not be used to create
X11 binaries.
See above. __names are only used to make sure
that the user does not override those routines.
The builtin function problem opens a can of worms because you need to
take some precautions to allow programs to call printf() without
forcing them to link against libm regardless of whether they contain
floating point code or not.
I don't think this is a problem - Sun's compiler has most,
if not all, builtins implemented either in the compiler itself
or in .il file (especially /opt/SUNWspro/prod/lib/libm.il).
For this reason, the float -> string functions don't use floatingpoint
math to do the conversion. But as the printf code needs to call something
like isinf() and isnan(), to know whther it makes sense to call the
float -> string functions at all.
BSD uses gcc and FreeBSD's libc contains isinf() and isnan(). Sun's libc does
not and compiling your own printf only works on OpenSolaris in case you
have a math.h that knows about the secret builtin functions of the Sun
C-compiler.
There's no secret. isnan() or isinf() are either in the library
(libm.so) or in the inline template (libm.il).
Depending on the option,
you may get libm.il version inlined or a call.
I hope this helps to understand the problem with libm a bit....
Jörg
Seongbae
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org