Compilation of syscall.c fails on ARM device
Khem Raj
raj.khem at gmail.com
Tue Aug 18 22:42:36 UTC 2009
On (18/08/09 18:40), Frank Aurich wrote:
> 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.
>
you seem to be using Old ABI. In this case it is broken because in old
ABI syscall number was passed in as a constant argument to SWI
syscall function now passes the constant in a register which does not
work and spits the error what you see.
This should work ok for EABI case because there the syscall number is
passed in R0.
If we need to revive OABI then we might have to find a way to make it
work, right now mostly people use EABI and there it should work ok.
Is it possible for you to switch to EABI ?
Thanks
-Khem
> Cheers,
>
> Frank
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc
More information about the uClibc
mailing list