[uClibc] arm-uclibc toolchain

David Muse dmuse at 4accesscommunications.com
Fri Dec 12 17:38:00 UTC 2003


> > > There were some other problems in 0.9.21 re the time code, which I fixed
> > > after finding them with valgrind.  Most of those changes were in 0.9.22.
> > > The only other change made (in cvs) is the move of a thread lock which
> > > was in the wrong place.
> > 
> > So, are there no differences in the timezone-related code among 0.9.21, 0.9.22, 0.9.23 and the upcoming 0.9.24?
> 
> No.  0.9.21 has some uninitialized variable refs where were fixed
> in 0.9.22.  The .22 and .23 code is the same, and had a thread lock
> in the wrong place.  See
> http://uclibc.org/cgi-bin/cvsweb/uClibc/libc/misc/time/time.c
> for detailed info on the changes.
> 
> Manuel
> 

I took a look at the changes and it occurred to me that since I can build the 0.9.21 toolchain, maybe I could just replace include/time.h and libc/misc/time/time.c in uclibc 0.9.21.  I downloaded the files, modified the toolchain Makefile to copy them over top of the old ones after untarring uclibc 0.9.21 and built a toolchain.  It appears to work, but I still get the same problem that I had with the unmodified toolchain.

Here is my test code:

timetest.c:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

main() {

	// 00:00:00 1/1/2003
	struct tm	tmstr;
	tmstr.tm_mon=1-1;
	tmstr.tm_mday=1;
	tmstr.tm_year=2003-1900;
	tmstr.tm_hour=0;
	tmstr.tm_min=0;
	tmstr.tm_sec=0;

#ifdef UCLIBC
	setenv("TZ","EST5EDT",1);
#else
	setenv("TZ","EST",1);
#endif
	time_t	epoch=mktime(&tmstr);

	printf("%02d:%02d:%02d %02d/%02d/%04d (%d/7) (%d/365) %d %s %d\n",
		tmstr.tm_hour,tmstr.tm_min,tmstr.tm_sec,
		tmstr.tm_mon+1,tmstr.tm_mday,tmstr.tm_year+1900,
		tmstr.tm_wday,tmstr.tm_yday,tmstr.tm_isdst,
		tmstr.tm_zone,tmstr.tm_gmtoff);
}


And here are the commands I use to compile it:

gcc -o timetest timetest.c
arm-uclibc-gcc -DUCLIBC -static -s -o timetest-uclibc timetest.c

When using gcc/glibc and running on x86, it works as expected.
When using arm-uclibc-gcc/uclibc and running on arm, it segfaults.

Maybe there is something wrong with my code.  Am I doing something silly?

Dave



More information about the uClibc mailing list