The following two patches are necessary to get a working ARM EABI 2.6.16 kernel that can run under QEMU (or on the Integrator/CP board that it emulates) The following patch of patches creates: * patches/glibc-ports-2.4 by jacobwitz: Configure glibc not to use system calls removed in 2.6.16-ARM-EABI. * patches/linux-2.6.16 by mg: Recognise ARM 1022 and 1026 processors You also need patches/glibc-2.4/make-install-lib-all.patch (which u can copy from patches/glibc-2.3.6/), included in my -mg2 patches. Martin Guy , 21 May 2006 diff -ruN crosstool-0.42-mg2/patches/glibc-ports-2.4/jacobowitz-glibc-2.4-ports-armeabi-20060321.patch crosstool-0.42-mg3/patches/glibc-ports-2.4/jacobowitz-glibc-2.4-ports-armeabi-20060321.patch --- crosstool-0.42-mg2/patches/glibc-ports-2.4/jacobowitz-glibc-2.4-ports-armeabi-20060321.patch 1970-01-01 01:00:00.000000000 +0100 +++ crosstool-0.42-mg3/patches/glibc-ports-2.4/jacobowitz-glibc-2.4-ports-armeabi-20060321.patch 2006-04-25 16:10:42.000000000 +0200 @@ -0,0 +1,379 @@ +From libc-ports-return-216-listarch-libc-ports=sources dot redhat dot com at sourceware dot org Tue Mar 21 21:01:01 2006 +Return-Path: +Delivered-To: listarch-libc-ports at sources dot redhat dot com +Received: (qmail 13706 invoked by alias); 21 Mar 2006 21:01:01 -0000 +Received: (qmail 13696 invoked by uid 22791); 21 Mar 2006 21:00:59 -0000 +X-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 +X-Spam-Check-By: sourceware.org +Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 21 Mar 2006 21:00:57 +0000 +Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FLnyI-0004L1-UK for libc-ports@sourceware.org; Tue, 21 Mar 2006 16:00:55 -0500 +Date: Tue, 21 Mar 2006 16:00:54 -0500 +From: Daniel Jacobowitz +To: libc-ports at sourceware dot org +Subject: Fix up ARM EABI for removed syscalls +Message-ID: <20060321210054.GA16470@nevyn.them.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.5.8i +X-IsSubscribed: yes +Mailing-List: contact libc-ports-help at sourceware dot org; run by ezmlm +Precedence: bulk +List-Subscribe: +List-Post: +List-Help: , +Sender: libc-ports-owner at sourceware dot org +Delivered-To: mailing list libc-ports at sourceware dot org + +Between the near-final version of the ARM EABI kernel patches that I used +for testing, and the final version that went into 2.6.16, the ARM kernel +developers removed a lot of obsolete syscalls. Glibc can do without all +of them, but it has to be configured appropriately - otherwise e.g. all +socket calls and uses of alarm() will fail. + +With this glibc now behaves on an unpatched kernel.org 2.6.16 kernel. + +-- +Daniel Jacobowitz +CodeSourcery + +2006-03-21 Daniel Jacobowitz + + * sysdeps/unix/sysv/linux/arm/eabi/socket.S: Delete. + * sysdeps/unix/sysv/linux/arm/eabi/syscalls.list, + sysdeps/unix/sysv/linux/arm/kernel-features.h, + sysdeps/unix/sysv/linux/arm/eabi/umount.c: New files. + * sysdeps/unix/sysv/linux/arm/eabi/linuxthreads/sysdep-cancel.h + (DOCARGS_6, UNDOCARGS_6, RESTORE_LR_6): Define. + * sysdeps/unix/sysv/linux/arm/eabi/nptl/sysdep-cancel.h + (DOCARGS_6, UNDOCARGS_6, RESTORE_LR_6): Define. + * sysdeps/unix/sysv/linux/arm/eabi/sysdep.h: Undefine + __NR_stime and __NR_alarm. + +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 +-#include +- +-#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 , 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 + diff -ruN crosstool-0.42-mg2/patches/linux-2.6.16/linux-2.6.16-arm1022-arm1026.patch crosstool-0.42-mg3/patches/linux-2.6.16/linux-2.6.16-arm1022-arm1026.patch --- crosstool-0.42-mg2/patches/linux-2.6.16/linux-2.6.16-arm1022-arm1026.patch 1970-01-01 01:00:00.000000000 +0100 +++ crosstool-0.42-mg3/patches/linux-2.6.16/linux-2.6.16-arm1022-arm1026.patch 2006-04-20 15:02:14.000000000 +0200 @@ -0,0 +1,12 @@ +--- linux-2.6.16/include/asm-arm/cacheflush.h.old 2006-03-20 05:53:29.000000000 +0000 ++++ linux-2.6.16/include/asm-arm/cacheflush.h 2006-04-20 13:29:11.000000000 +0100 +@@ -43,7 +43,8 @@ + #endif + + #if defined(CONFIG_CPU_ARM920T) || defined(CONFIG_CPU_ARM922T) || \ +- defined(CONFIG_CPU_ARM925T) || defined(CONFIG_CPU_ARM1020) ++ defined(CONFIG_CPU_ARM925T) || defined(CONFIG_CPU_ARM1020) || \ ++ defined(CONFIG_CPU_ARM1022) || defined(CONFIG_CPU_ARM1026) + # define MULTI_CACHE 1 + #endif +