Compile bug in libm with busybox (patch included)
Denys Vlasenko
vda.linux at googlemail.com
Wed Feb 18 18:21:24 UTC 2009
On Wed, Feb 18, 2009 at 4:34 PM, rhabarber1848 <rhabarber1848 at web.de> wrote:
> Hi,
>
> Denys Vlasenko wrote:
>
>> Please go to uclibc build directory, cd test,
>> deleta ll directories except "math" (saves time),
>> then run "make compile".
>
> did so using SVN rev 25359.
>
>> Does that successfully compile "compile_test.c"?
>
> No.
>
>> If not, what messages do you see?
>
>> TEST_LINK malloc/ tst-valloc_glibc
>> TEST_LINK math/ basic-test
>> basic-test.c: In function `ldouble_test':
>> basic-test.c:111: warning: implicit declaration of function `nanl'
Well, this is not compile_test.c, but anyway, interesting.
>> basic-test.o: In function `main':
>> basic-test.c:(.text+0xa08): undefined reference to `nanl'
>> basic-test.c:(.text+0xa24): undefined reference to `nanl'
>> basic-test.c:(.text+0xa44): undefined reference to `nanl'
>> basic-test.c:(.text+0xa64): undefined reference to `nanl'
>> basic-test.c:(.text+0xa88): undefined reference to `nanl'
I just did "make libm/nan.i" and on inspection, this file definitely has nanl:
extern __typeof (nanl) nanl __asm__ ("" "__GI_nanl") __attribute__
((visibility ("hidden")));
long double nanl (const char *tagp)
{
if (tagp[0] != '\0') {
char buf[6 + strlen (tagp)];
sprintf (buf, "NAN(%s)", tagp);
return strtold (buf, ((void *)0));
}
return (__builtin_nanf (""));
}
extern __typeof (nanl) __EI_nanl __asm__("" "nanl"); extern __typeof
(nanl) __EI_nanl __attribute__((alias ("" "__GI_nanl")));
In nan.c it is in this #if:
#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
libm_hidden_proto(nanl)
long double nanl (const char *tagp)
but you do have UCLIBC_HAS_LONG_DOUBLE_MATH=y in your .config.
"objdump -drsx libm/nan.os" shows:
...
SYMBOL TABLE:
...
00000000 g F .text.__GI_nanl 00000067 .hidden __GI_nanl
...
00000000 g F .text.__GI_nanf 00000067 nanf
00000000 g F .text.__GI_nanl 00000067 nanl
...
Do you see similar things on your system?
>> basic-test.o:basic-test.c:(.text+0xa94): more undefined references to
> `nanl' follow
>> ../../lib/libm.so: undefined reference to `__GI___finitel'
>> ../../lib/libm.so: undefined reference to `__GI___isnanl'
>> ../../lib/libm.so: undefined reference to `__GI___signbitl'
>> ../../lib/libm.so: undefined reference to `__GI___fpclassifyl'
>> ../../lib/libm.so: undefined reference to `__GI___isinfl'
>> collect2: ld returned 1 exit status
>> make[1]: *** [basic-test] Error 1
I grepped through objdump of your libm.so. nanl is indeed missing (!).
If you will see it in "objdump -drsx libm/nan.os" output, then
your libm.so is linked incorrectly, it did not include libm/nan.os.
Please check that - delete lib/*, run "make V=1" and note what command
line is used to link libm.so.
Regarding "undefined reference to `__GI___finitel'", there are no
actual calls to _GI___finitel in objdump of libm.so, but readelf
shows that references are entered into .dynsym:
Symbol table '.dynsym' contains 238 entries:
Num: Value Size Type Bind Vis Ndx Name
...
24: 00000000 0 NOTYPE GLOBAL DEFAULT UND __GI___finitel
...
234: 0001157c 12 FUNC GLOBAL DEFAULT 6 __finitel
This should not happen. If symbol is not referenced from code,
why is it here?
What are your versions of gcc and ld?
--
vda
More information about the uClibc
mailing list