(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / unix / arm / sysdep.S
blob4810805d856b421bf951ea0173c4a0e4af150e3a
1 /* Copyright (C) 1991,92,93,94,95,96,97,98,2002,03 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, write to the Free
16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17    02111-1307 USA.  */
19 #include <sysdep.h>
20 #define _ERRNO_H
21 #include <bits/errno.h>
23 .globl C_SYMBOL_NAME(errno)
24 .globl syscall_error
26 #undef syscall_error
27 #ifdef NO_UNDERSCORES
28 __syscall_error:
29 #else
30 syscall_error:
31 #endif
32 #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
33         /* We translate the system's EWOULDBLOCK error into EAGAIN.
34            The GNU C library always defines EWOULDBLOCK==EAGAIN.
35            EWOULDBLOCK_sys is the original number.  */
36         cmp r0, $EWOULDBLOCK_sys /* Is it the old EWOULDBLOCK?  */
37         moveq r0, $EAGAIN       /* Yes; translate it to EAGAIN.  */
38 #endif
40 #ifdef _LIBC_REENTRANT
41         str lr, [sp, #-4]!
42         str r0, [sp, #-4]!
43         bl PLTJMP(C_SYMBOL_NAME(__errno_location))
44         ldr r1, [sp], #4
45         str r1, [r0]
46         mvn r0, $0
47         ldr pc, [sp], #4        
48 #else
49 #ifndef PIC
50         ldr r1, 1f
51         str r0, [r1]
52         mvn r0, $0
53         DO_RET (r14)
55 1:      .long C_SYMBOL_NAME(errno)
56 #else
57         @ we have to establish our PIC register
58         ldr r2, 1f
59         ldr r1, 2f
60 0:      add r2, pc, r2
61         str r0, [r1, r2]
62         mvn r0, $0
63         DO_RET (r14)
65 1:      .word _GLOBAL_OFFSET_TABLE_ - 0b - 8
66 2:      .word C_SYMBOL_NAME(errno)(GOTOFF)
67 #endif
68 #endif
70 #undef  __syscall_error
71 END (__syscall_error)