[prev in list] [next in list] [prev in thread] [next in thread]
List: owl-dev
Subject: Re: [owl-dev] gcc 4.6.1: glibc __sincos() issue
From: Vasiliy Kulikov <segoon () openwall ! com>
Date: 2011-10-18 9:19:57
Message-ID: 20111018091957.GA9118 () albatros
[Download RAW message or body]
On Tue, Oct 18, 2011 at 02:44 +0200, Pavel Kankovsky wrote:
> On Mon, 17 Oct 2011, Vasiliy Kulikov wrote:
>
> > After building gcc 4.6.1 and making glibc compilable there is one error.
> > Groff's "pic" built with glibc built with gcc 4.6.1 calls __sincos and
> > goes into infinite __sincos recursion:
> > [...]
> >
> > callq at _init+40 is a call to __sincos().
> >
> > In the source file (./sysdeps/ieee754/dbl-64/s_sincos.c):
> >
> > void
> > __sincos (double x, double *sinx, double *cosx)
> > {
> > [...]
> > {
> > *sinx = sin (x);
> > *cosx = cos (x);
> > }
> > }
> > weak_alias (__sincos, sincos)
> >
> >
> > So, it is an optimised call to sin() and cos(), which is optimised to
> > call to __sincos(). However, I cannot understand how it can happen as
> > sin() and cos() are defined in ./sysdeps/ieee754/dbl-64/s_sin.c as
> > following:
>
> GCC thinks the architecture provides its native sincos() and transforms
> "*sinx = sin (x); *cosx = cos (x);" to "sincos (x, *sinx, *cosx);"
> See <http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00499.html> and
> <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46926>.
>
> But Glibc is built WITHOUT native sincos()! It should be implemented
> by an FPU instructions (fsincos) (*) but what we get is generic C code--
> that calls itself when compiled with the aformentioned optimization. This
> is WRONG! The ancient version of Glibc is to blame here:
> sysdeps/x86_64/fpu/s_sincos.S was introduced in 2.5.
>
> You can either add the missing native implementation of sincos()
> or compile Glibc with -fno-native-sincos to disable the optimization.
Great! -fno-builtin is the solution (-fno-builtin-sincos doesn't work,
probably need -sin or -cos or both). Now I'll try to solve i686
cfi_endproc problem.
Thank you!
--
Vasiliy
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic