One difference between uClibc and glibc

Jie Zhang jzhang918 at gmail.com
Wed Mar 22 05:16:40 UTC 2006


When I tested blackfin port gcc 4.1 on uclinux with uclibc as the
libc, the following case fails:

gcc.c-torture/execute/builtins/pr23484-chk.c execution,  -O1

After I played with it for a while, I found out why:

In gcc.c-torture/execute/builtins/lib/chk.c, vsnprintf () is defined
using vsprintf (). While vsprintf () in uClibc is defined using
vsnprintf (). When testing on uClinux with uClibc, pr23484-chk.c
failed because these two functions will call each other recursively
and finally overflow the stack.

This test works on both i386 pc with glibc as the libc and blackfin
simulator with newlib as the libc. glibc defines vsprintf () using
_IO_vfprintf (), and newlib using _vfprintf_r ().

Currently I'm using the attached patch to make the test pass. But it's
a patch for rather old uclibc used at http://blackfin.uclinux.org.
It's not applicable to latest uclibc in uclibc.org. And I'm not sure
if I do the right thing or there are better way to fix it.

What do you think?

Thanks,
Jie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uclibc.diff
Type: text/x-patch
Size: 3225 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20060322/bd0ce27e/attachment.bin 


More information about the uClibc mailing list