1 This patch modifies the syscall code for the powerpc, and leaves it like it was previosly
2 (older version of the uclibc repository). It uses the syscall code from the kernel.
4 This way it compiles properly with gcc-4. The problem was that the previous code defined the
5 functions in assembly code, so that the compiler didn't think the functions had a definition
6 so that the next weak aliases to those functions didn't work because they were not defined.
7 (Previous version of gcc compilers work when definin weak aliases to undefined functions).
9 Maybe the syscall code could be reworked again, but meanwhile I left with the kernel
10 default syscall code, that was the original aproach of uclibc.
13 diff -urP uClibc-0.9.28/libc/sysdeps/linux/powerpc/bits/syscalls.h uClibc-0.9.28-syscall/libc/sysdeps/linux/powerpc/bits/syscalls.h
14 --- uClibc-0.9.28/libc/sysdeps/linux/powerpc/bits/syscalls.h 2005-08-18 00:49:41.000000000 +0200
15 +++ uClibc-0.9.28-syscall/libc/sysdeps/linux/powerpc/bits/syscalls.h 2005-08-23 10:14:53.000000000 +0200
17 # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
20 +#include <features.h>
22 +/* Do something very evil for now. Until we create our own syscall
23 + * macros, short circuit bits/sysnum.h and use asm/unistd.h instead */
24 +#include <asm/unistd.h>
26 /* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel
27 * header files. It also defines the traditional `SYS_<name>' macros for older
29 #include <bits/sysnum.h>
32 -#define __STRINGIFY(s) __STRINGIFY2 (s)
33 -#define __STRINGIFY2(s) #s
37 -#define __MAKE_SYSCALL __STRINGIFY(__uClibc_syscall@plt)
39 -#define __MAKE_SYSCALL __STRINGIFY(__uClibc_syscall)
42 -#define unified_syscall_body(name) \
44 - ".section \".text\"\n\t" \
46 - ".globl " __STRINGIFY(name) "\n\t" \
47 - ".type " __STRINGIFY(name) ",@function\n\t" \
48 - #name":\tli 0," __STRINGIFY(__NR_##name) "\n\t" \
49 - "b " __MAKE_SYSCALL "\n\t" \
50 - ".size\t" __STRINGIFY(name) ",.""-" __STRINGIFY(name) "\n" \
54 -#define _syscall0(type,name) \
56 -unified_syscall_body(name)
59 -#define _syscall1(type,name,type1,arg1) \
60 -type name(type1 arg1); \
61 -unified_syscall_body(name)
64 -#define _syscall2(type,name,type1,arg1,type2,arg2) \
65 -type name(type1 arg1, type2 arg2); \
66 -unified_syscall_body(name)
69 -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
70 -type name(type1 arg1, type2 arg2, type3 arg3); \
71 -unified_syscall_body(name)
74 -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
75 -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4); \
76 -unified_syscall_body(name)
79 -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
80 -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5); \
81 -unified_syscall_body(name)
83 +/* The kernel includes don't provide _syscall6, so provide our own */
85 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
86 -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6); \
87 -unified_syscall_body(name)
88 +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
90 + unsigned long __sc_ret, __sc_err; \
92 + register unsigned long __sc_0 __asm__ ("r0"); \
93 + register unsigned long __sc_3 __asm__ ("r3"); \
94 + register unsigned long __sc_4 __asm__ ("r4"); \
95 + register unsigned long __sc_5 __asm__ ("r5"); \
96 + register unsigned long __sc_6 __asm__ ("r6"); \
97 + register unsigned long __sc_7 __asm__ ("r7"); \
98 + register unsigned long __sc_8 __asm__ ("r8"); \
100 + __sc_3 = (unsigned long) (arg1); \
101 + __sc_4 = (unsigned long) (arg2); \
102 + __sc_5 = (unsigned long) (arg3); \
103 + __sc_6 = (unsigned long) (arg4); \
104 + __sc_7 = (unsigned long) (arg5); \
105 + __sc_8 = (unsigned long) (arg6); \
106 + __sc_0 = __NR_##name; \
107 + __asm__ __volatile__ \
110 + : "=&r" (__sc_3), "=&r" (__sc_0) \
111 + : "0" (__sc_3), "1" (__sc_0), \
117 + : "r9", "r10", "r11", "r12"); \
118 + __sc_ret = __sc_3; \
119 + __sc_err = __sc_0; \
121 + return (__sc_err & 0x10000000 ? __set_errno(__sc_ret), __sc_ret = -1 : 0), (type)__sc_ret; \
124 #endif /* _BITS_SYSCALLS_H */