dietlibc on armel architecture

Jakob Lell <[email protected]>
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
Hi,

I'm trying to get dietlibc work with the armel architecture. I am using 
a Sheevaplug device with debian squeeze. The first problem is that 
bin-arm/diet segfaults in the following line of diet.c:

strcat(platform,"/bin-");

The actual code seems to be ok and so I think it is probably related to 
alloca (which does no error checking and may silently fail according to 
the manual). I've tried to replace alloca with malloc but it fails to 
compile then:
/usr/lib/gcc/arm-linux-gnueabi/4.4.3/libgcc.a(_dvmd_lnx.o): In function 
`__div0':
(.text+0x8): undefined reference to `raise'
collect2: ld returned 1 exit status
make: *** [bin-arm/diet] Error 1

I'm not a gcc expert and so I didn't understand why it isn't possible to 
use malloc here. As a workaround, I've found out that this problem 
doesn't occur any more when replacing the -Os in arm/Makefile.add with 
-O0 (but there is certainly a better way to fix it).

Another issue is that the program bin-arm/diet adds the gcc option 
"-meabi=4" but my gcc doesn't recognize this option. I'm using gcc 
version 4.4.3 20100108 (prerelease) (Debian 4.4.2-9). For me it seems to 
work when removing this option from diet.c.

After doing this few modifications, dietlibc is basically working on 
armel. I've compiled a static e2fsck with it and it works fine.

However, the function time() is not available with dietlibc. This is due 
to the following code block in arm/syscalls.h:

/*
 * The following syscalls are obsolete and no longer available for EABI.
 */
#if defined(__ARM_EABI__) && !defined(__KERNEL__)
#undef __NR_time
#undef __NR_umount
#undef __NR_stime
#undef __NR_alarm
#undef __NR_utime
#undef __NR_getrlimit
#undef __NR_select
#undef __NR_readdir
#undef __NR_mmap
#undef __NR_socketcall
#undef __NR_syscall
#undef __NR_ipc
#endif

Commenting out this stuff doesn't help since the time() system call 
isn't implemented any more in the kernel. Since time() is a standard C 
function which is used in many programs, it would IMHO be a good idea to 
emulate it using gettimeofday (that's what glibc is doing).

Regards
Jakob Lell

PS: Why is there no publicly accessible archive of this mailing list? I 
have no Idea whether anyone else is already working on this as well.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.