Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 8 Apr 2013 22:05:35 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: vfprintf.c:(.text+0xc6c): undefined reference to
 `__signbitl'

* meres5@...ha.tmit.bme.hu <meres5@...ha.tmit.bme.hu> [2013-04-08 21:39:19 +0200]:
> 
> meres5@...ha:~/tmp$ uname -a
> Linux alpha 2.6.32-5-powerpc64 #1 SMP Mon Oct 3 07:59:38 UTC 2011 ppc64
> GNU/Linux

what is the long double on your platform? i assume it's 128bit

gcc -dM -E - </dev/null |grep LDBL_

> meres5@...ha:~/tmp$ ld -o stdhello.static lib/crt1.o lib/crti.o stdhello.o
> lib/libc.a lib/libgcc.a lib/crtn.o
> lib/libc.a(vfprintf.o): In function `printf_core':
> vfprintf.c:(.text+0xc6c): undefined reference to `__signbitl'
> vfprintf.c:(.text+0xccc): undefined reference to `__fpclassifyl'
> 
> by linking static against musl a Hello sample.
> I think this is not good. . .

the problem is that various functions use the signbit macro
from math.h

it gets the sign bit with bithacks for float and double and
calls __signbitl for long double

but the __signbitl call should only be generated by the compiler
if sizeof(long double) != sizeof(double)

in that case we only support the 80bit long double of x86

(powerpc long double can be 64bit, 128bit ieee or 128bit ibm
and we only support 64bit at this point, the others are
soft-float emulations anyway so not very useful, but that's
the standard abi so many toolchains use that..)

> I push on gcc with theese:
> 
> int __signbitl( long double x ) { return 0;}
> int __fpclassifyl( long double x ) { return 0;}
> 
> then it worked fine - for this simple Hello :-)

it might make sense to add these so code will
"happen to work" if it does not use long double

(note that printf uses long double internally
to print floats but it may even work with
float and doubles but it will definitly fail to
print long doubles)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.