uclibc  

Compilation of syscall.c fails on ARM device

Frank Aurich
Tue, 18 Aug 2009 09:40:42 -0700

Hi,

I've been trying to compile the latest git version of uClibc for my
embedded NAS device. It's using an ARM CPU and a Linux 2.6.12 build.

$ uname -a
Linux CH3SNAS 2.6.12.6-arm1 #31 Mon Mar 23 19:39:43 CST 2009 armv5tejl GNU/Linux

$ gcc --version
gcc (GCC) 4.1.3 20080414

$ as --version
GNU assembler (GNU Binutils) 2.19.1


This is the error I'm getting:

libc/sysdeps/linux/common/syscall.c: In function 'syscall':
libc/sysdeps/linux/common/syscall.c:11: warning: asm operand 1
probably doesn't match constraints
libc/sysdeps/linux/common/syscall.c:11: error: impossible constraint in 'asm'
make: *** [libc/sysdeps/linux/common/syscall.os] Error 1

Unfortunately, line 11 of syscall.c refers to the macro
INLINE_SYSCALL_NCS, so I let gcc preprocess the file first before
compiling again:

long syscall(long sysnum, long arg1, long arg2, long arg3, long arg4,
long arg5, long arg6)
{
 return (
 {
   unsigned int _inline_sys_result = (
   {
     unsigned int __sys_result;
     {
       register int _a1 __asm__ ("a1");
       int _v2tmp = (int) (arg6);
       int _v1tmp = (int) (arg5);
       int _a4tmp = (int) (arg4);
       int _a3tmp = (int) (arg3);
       int _a2tmp = (int) (arg2);
       int _a1tmp = (int) (arg1);
       _a1 = _a1tmp;
       register int _a2 __asm__ ("a2") = _a2tmp;
       register int _a3 __asm__ ("a3") = _a3tmp;
       register int _a4 __asm__ ("a4") = _a4tmp;
       register int _v1 __asm__ ("v1") = _v1tmp;
       register int _v2 __asm__ ("v2") = _v2tmp;
       __asm__ __volatile__ ("swi      %1      @ syscall " "sysnum" : "=r"
(_a1) : "i" (sysnum) , "r" (_a1), "r" (_a2), "r" (_a3), "r" (_a4), "r"
(_v1), "r" (_v2) : "memory");   //compile error
       __sys_result = _a1;
     }
     (int) __sys_result;
   }
   );

   if (__builtin_expect (((unsigned int) (_inline_sys_result) >=
0xfffff001u), 0))
   {
     ((*__errno_location ()) = ((-(_inline_sys_result))));
     _inline_sys_result = (unsigned int) -1;
   }
   (int) _inline_sys_result;
 });
}

gcc now fails on the asm "swi" instruction.
I know next to nothing about asm, unfortunately, so I don't know where
to go from here.

Any idea what is causing the compile error?
If you need any more information regarding this issue, please let me know.

Cheers,

Frank
_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc