Function of puts/fputs seems not working after migrating from an old version uClibc to the latest 0.9.29

Mo Jackson jacksonm88 at gmail.com
Thu Dec 20 17:15:10 UTC 2007


Hi everyone,

This is my first mail sending to this mail list. The problem I encountered
was that recently I rebuilt my toolchain with gcc 4.2.1 and uClibc 0.9.29 to
build a hello world program that runs on a MIPSel machine, just for a test.
Previously I was using an old-toolchain with gcc 3.x and uClibc 0.9.15, and
the same hello world program it built ran perfectly on the machine. However,
after using the new toolchain, the hello world program didn't work any more.
It looks like it didn't encounter any error, but there is no output at all.
Later I discovered that gcc 4.2.1 can covertly turn function call of *printf(
"Hello, world\n" ); *into *puts( "Hello, world\n" );,* which could have been
some sort of optimization effort. But the real problem is, printf() works
just fine while puts() doesn't. For example, if I wrote *printf( "%d %s\n",
1234, "Hello, world\n" ); *to bypass the optimization so that printf() would
be actually invoked instead of puts(), the Hello World string shows up
normally on the screen. But if I change it back to *puts( "Hello, world\n"
);, *nothing shows up despite that puts() returns 1 for success and the
program terminates normally without any other anomaly. Also, fputs( ...,
stdout ) didn't work either even if fflush was called afterwards ('cos
initially I thought there might be some buffering scheme delaying the
output).

I was using buildroot to reconstruct the toolchain and was using the default
config for uClibc except that MMU support was opted out from the build.
After failing the first time, I also tried to switch off the "using macro
for getc/putc" option, but neither did that make any difference. I must not
be doing something right for getting this weird issue, but what could have
been the cause? Is there any other feature newly introduced into this
version of uClibc that I can turn off to try to see if it works?

Many thanks,

Jackson Mo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/uclibc/attachments/20071221/fe1d513e/attachment-0002.htm 


More information about the uClibc mailing list