summaryrefslogtreecommitdiffstats
path: root/recipes/glibc/glibc-2.4/fixup-aeabi-syscalls.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/glibc/glibc-2.4/fixup-aeabi-syscalls.patch')
-rw-r--r--recipes/glibc/glibc-2.4/fixup-aeabi-syscalls.patch329
1 files changed, 329 insertions, 0 deletions
diff --git a/recipes/glibc/glibc-2.4/fixup-aeabi-syscalls.patch b/recipes/glibc/glibc-2.4/fixup-aeabi-syscalls.patch
new file mode 100644
index 0000000000..fb733b9194
--- /dev/null
+++ b/recipes/glibc/glibc-2.4/fixup-aeabi-syscalls.patch
@@ -0,0 +1,329 @@
+Fix up ARM EABI for removed syscalls
+http://sourceware.org/ml/libc-ports/2006-03/msg00029.html
+
+Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/socket.S
+===================================================================
+--- glibc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/socket.S 2006-03-21 15:58:10.000000000 -0500
++++ /dev/null 1970-01-01 00:00:00.000000000 +0000
+@@ -1,131 +0,0 @@
+-/* Copyright (C) 1995, 1996, 1997, 1998, 2003, 2005
+- Free Software Foundation, Inc.
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Lesser General Public
+- License as published by the Free Software Foundation; either
+- version 2.1 of the License, or (at your option) any later version.
+-
+- The GNU C Library is distributed in the hope that it will be useful,
+- but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- Lesser General Public License for more details.
+-
+- You should have received a copy of the GNU Lesser General Public
+- License along with the GNU C Library; if not, write to the Free
+- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+- 02111-1307 USA. */
+-
+-#include <sysdep-cancel.h>
+-#include <socketcall.h>
+-
+-#define P(a, b) P2(a, b)
+-#define P2(a, b) a##b
+-
+- .text
+-/* The socket-oriented system calls are handled unusally in Linux.
+- They are all gated through the single `socketcall' system call number.
+- `socketcall' takes two arguments: the first is the subcode, specifying
+- which socket function is being called; and the second is a pointer to
+- the arguments to the specific function.
+-
+- The .S files for the other calls just #define socket and #include this. */
+-
+-#ifndef __socket
+-# ifndef NO_WEAK_ALIAS
+-# define __socket P(__,socket)
+-# else
+-# define __socket socket
+-# endif
+-#endif
+-
+-#define PUSHARGS_1 str a1, [sp, $-8]!; .pad #8
+-#define PUSHARGS_2 stmfd sp!, {a1, a2}; .pad #8
+-#define PUSHARGS_3 stmfd sp!, {a1, a2, a3, a4}; .pad #16 /* a4 pushed for padding */
+-#define PUSHARGS_4 stmfd sp!, {a1, a2, a3, a4}; .pad #16
+-#define PUSHARGS_5 stmfd sp!, {a1, a2, a3, a4}; .pad #16 /* Caller has already pushed arg 5 */
+-#define PUSHARGS_6 stmfd sp!, {a1, a2, a3, a4}; .pad #16
+-
+-#define POPARGS_1 add sp, sp, #8
+-#define POPARGS_2 add sp, sp, #8
+-#define POPARGS_3 add sp, sp, #16
+-#define POPARGS_4 add sp, sp, #16
+-#define POPARGS_5 add sp, sp, #16
+-#define POPARGS_6 add sp, sp, #16
+-
+-#ifndef NARGS
+-#define NARGS 3 /* If we were called with no wrapper, this is really socket() */
+-#endif
+-
+-#if defined NEED_CANCELLATION && defined CENABLE
+- PSEUDO_PROLOGUE
+-#endif
+-
+-.globl __socket
+-ENTRY (__socket)
+- .fnstart
+-
+- /* This code previously moved sp into ip and stored the args using
+- stmdb ip!, {a1-a4}. It did not modify sp, so the stack never had
+- to be restored after the syscall completed. It saved an
+- instruction and meant no stack cleanup work was required.
+-
+- This will not work in the case of a socket call being interrupted
+- by a signal. If the signal handler uses any stack the arguments
+- to socket will be trashed. The results of a restart of any
+- socket call are then unpredictable. */
+-
+- /* Push args onto the stack. */
+- P(PUSHARGS_,NARGS)
+-
+-#if defined NEED_CANCELLATION && defined CENABLE
+- SINGLE_THREAD_P
+- bne 1f
+-#endif
+-
+- /* Do the system call trap. */
+- mov a1, $P(SOCKOP_,socket)
+- mov a2, sp
+- DO_CALL (socketcall, 0)
+-
+- /* Pop args off the stack */
+- P(POPARGS_,NARGS)
+-
+- /* r0 is < 0 if there was an error. */
+- cmn r0, $124
+- RETINSTR(cc, r14)
+- b PLTJMP(SYSCALL_ERROR)
+-
+-#if defined NEED_CANCELLATION && defined CENABLE
+-1:
+- stmfd sp!, {r7, lr}
+- .save {r7, lr}
+- CENABLE
+- mov ip, r0
+-
+- mov r0, #P(SOCKOP_,socket)
+- add r1, sp, #8
+- mov r7, #SYS_ify(socketcall)
+- swi 0x0
+-
+- mov r7, r0
+- mov r0, ip
+- CDISABLE
+- mov r0, r7
+- ldmfd sp!, {r7, lr}
+-
+- P(POPARGS_,NARGS)
+-
+- /* r0 is < 0 if there was an error. */
+- cmn r0, $124
+- RETINSTR(cc, r14)
+- b PLTJMP(SYSCALL_ERROR)
+-#endif
+-
+- .fnend
+-PSEUDO_END (__socket)
+-
+-#ifndef NO_WEAK_ALIAS
+-weak_alias (__socket, socket)
+-#endif
+Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/syscalls.list
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/syscalls.list 2006-03-21 15:58:46.000000000 -0500
+@@ -0,0 +1,34 @@
++# File name Caller Syscall name # args Strong name Weak names
++
++# semaphore and shm system calls
++msgctl - msgctl i:iip __msgctl msgctl
++msgget - msgget i:ii __msgget msgget
++msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv
++msgsnd - msgsnd Ci:ibni __msgsnd msgsnd
++shmat - shmat i:ipi __shmat shmat
++shmctl - shmctl i:iip __shmctl shmctl
++shmdt - shmdt i:s __shmdt shmdt
++shmget - shmget i:iii __shmget shmget
++semop - semop i:ipi __semop semop
++semtimedop - semtimedop i:ipip semtimedop
++semget - semget i:iii __semget semget
++semctl - semctl i:iiii __semctl semctl
++
++# proper socket implementations:
++accept - accept Ci:iBN __libc_accept __accept accept
++bind - bind i:ipi __bind bind
++connect - connect Ci:ipi __libc_connect __connect_internal __connect connect
++getpeername - getpeername i:ipp __getpeername getpeername
++getsockname - getsockname i:ipp __getsockname getsockname
++getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
++listen - listen i:ii __listen listen
++recv - recv Ci:ibni __libc_recv __recv recv
++recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
++recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg
++send - send Ci:ibni __libc_send __send send
++sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg
++sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
++setsockopt - setsockopt i:iiibn __setsockopt setsockopt
++shutdown - shutdown i:ii __shutdown shutdown
++socket - socket i:iii __socket socket
++socketpair - socketpair i:iiif __socketpair socketpair
+Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h
+===================================================================
+--- glibc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h 2006-03-21 15:58:10.000000000 -0500
++++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h 2006-03-21 15:58:46.000000000 -0500
+@@ -53,9 +53,9 @@
+ UNDOARGS_##args; \
+ cmn r0, $4096;
+
+-/* DOARGS pushes four bytes on the stack for five arguments, and nothing
+- otherwise. In order to preserve doubleword alignment, sometimes we must
+- save an extra register. */
++/* DOARGS pushes four bytes on the stack for five arguments, eight bytes for
++ six arguments, and nothing for fewer. In order to preserve doubleword
++ alignment, sometimes we must save an extra register. */
+
+ # define DOCARGS_0 stmfd sp!, {r7, lr}
+ # define UNDOCARGS_0
+@@ -81,6 +81,10 @@
+ # define UNDOCARGS_5 ldmfd sp!, {r0, r1, r2, r3}
+ # define RESTORE_LR_5 ldmfd sp!, {r4, r7, lr}
+
++# define DOCARGS_6 stmfd sp!, {r0, r1, r2, r3, r7, lr}
++# define UNDOCARGS_6 ldmfd sp!, {r0, r1, r2, r3}
++# define RESTORE_LR_6 RESTORE_LR_0
++
+ # ifdef IS_IN_libpthread
+ # define CENABLE bl PLTJMP(__pthread_enable_asynccancel)
+ # define CDISABLE bl PLTJMP(__pthread_disable_asynccancel)
+Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h
+===================================================================
+--- glibc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h 2006-03-21 15:58:10.000000000 -0500
++++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h 2006-03-21 15:58:46.000000000 -0500
+@@ -64,9 +64,9 @@
+ UNDOARGS_##args; \
+ cmn r0, $4096;
+
+-/* DOARGS pushes four bytes on the stack for five arguments, and nothing
+- otherwise. In order to preserve doubleword alignment, sometimes we must
+- save an extra register. */
++/* DOARGS pushes four bytes on the stack for five arguments, eight bytes for
++ six arguments, and nothing for fewer. In order to preserve doubleword
++ alignment, sometimes we must save an extra register. */
+
+ # define RESTART_UNWIND .fnend; .fnstart; .save {r7, lr}
+
+@@ -94,6 +94,10 @@
+ # define UNDOCARGS_5 ldmfd sp!, {r0, r1, r2, r3}; .fnend; .fnstart; .save {r4}; .save {r7, lr}; .pad #4
+ # define RESTORE_LR_5 ldmfd sp!, {r4, r7, lr}
+
++# define DOCARGS_6 .save {r4, r5}; stmfd sp!, {r0, r1, r2, r3, r7, lr}; .save {r7, lr}; .pad #20
++# define UNDOCARGS_6 ldmfd sp!, {r0, r1, r2, r3}; .fnend; .fnstart; .save {r4, r5}; .save {r7, lr}
++# define RESTORE_LR_6 RESTORE_LR_0
++
+ # ifdef IS_IN_libpthread
+ # define CENABLE bl PLTJMP(__pthread_enable_asynccancel)
+ # define CDISABLE bl PLTJMP(__pthread_disable_asynccancel)
+Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h
+===================================================================
+--- glibc.orig/ports/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h 2006-03-21 15:58:10.000000000 -0500
++++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/sysdep.h 2006-03-21 15:58:46.000000000 -0500
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2005
++/* Copyright (C) 2005, 2006
+ Free Software Foundation, Inc.
+
+ This file is part of the GNU C Library.
+@@ -29,6 +29,12 @@
+ # error Kernel headers are too old
+ #endif
+
++/* Don't use stime, even if the kernel headers define it. We have
++ settimeofday, and some EABI kernels have removed stime. Similarly
++ use setitimer to implement alarm. */
++#undef __NR_stime
++#undef __NR_alarm
++
+ /* The ARM EABI user interface passes the syscall number in r7, instead
+ of in the swi. This is more efficient, because the kernel does not need
+ to fetch the swi from memory to find out the number; which can be painful
+Index: glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/umount.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/umount.c 2006-03-21 15:58:46.000000000 -0500
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by David Huggins-Daines <dhd@debian.org>, 2000.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++/* Since we don't have an oldumount system call, do what the kernel
++ does down here. */
++
++extern long int __umount2 (const char *name, int flags);
++
++long int
++__umount (const char *name)
++{
++ return __umount2 (name, 0);
++}
++
++weak_alias (__umount, umount);
+Index: glibc/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ glibc/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h 2006-03-20 17:26:58.000000000 -0500
+@@ -0,0 +1,31 @@
++/* Set flags signalling availability of kernel features based on given
++ kernel version number.
++ Copyright (C) 2006 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++/* The utimes syscall was added before 2.6.1. */
++#if __LINUX_KERNEL_VERSION >= 132609
++# define __ASSUME_UTIMES 1
++#endif
++
++/* The new getrlimit syscall was added sometime before 2.4.6. */
++#if __LINUX_KERNEL_VERSION >= 132102
++#define __ASSUME_NEW_GETRLIMIT_SYSCALL 1
++#endif
++
++#include_next <kernel-features.h>