summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/alpha/Makefile.arch7
-rw-r--r--libc/sysdeps/linux/alpha/__syscall_rt_sigaction.S81
-rw-r--r--libc/sysdeps/linux/alpha/bits/atomic.h6
-rw-r--r--libc/sysdeps/linux/alpha/bits/fcntl.h38
-rw-r--r--libc/sysdeps/linux/alpha/bits/ioctls.h37
-rw-r--r--libc/sysdeps/linux/alpha/bits/kernel_sigaction.h7
-rw-r--r--libc/sysdeps/linux/alpha/bits/mathinline.h10
-rw-r--r--libc/sysdeps/linux/alpha/bits/setjmp.h6
-rw-r--r--libc/sysdeps/linux/alpha/bits/sigcontextinfo.h12
-rw-r--r--libc/sysdeps/linux/alpha/bits/typesizes.h66
-rw-r--r--libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h5
-rw-r--r--libc/sysdeps/linux/alpha/clone.S2
-rw-r--r--libc/sysdeps/linux/alpha/crt1.S71
-rw-r--r--libc/sysdeps/linux/alpha/divrem.h44
-rw-r--r--libc/sysdeps/linux/alpha/pipe.S48
-rw-r--r--libc/sysdeps/linux/alpha/sigprocmask.c61
-rw-r--r--libc/sysdeps/linux/alpha/sys/acct.h66
-rw-r--r--libc/sysdeps/linux/alpha/sys/regdef.h47
-rw-r--r--libc/sysdeps/linux/alpha/syscall.S2
-rw-r--r--libc/sysdeps/linux/arm/Makefile.arch3
-rw-r--r--libc/sysdeps/linux/arm/__longjmp.S33
-rw-r--r--libc/sysdeps/linux/arm/aeabi_memclr.c2
-rw-r--r--libc/sysdeps/linux/arm/aeabi_memcpy.c2
-rw-r--r--libc/sysdeps/linux/arm/aeabi_memmove.c2
-rw-r--r--libc/sysdeps/linux/arm/aeabi_memset.c2
-rw-r--r--libc/sysdeps/linux/arm/bits/arm_asm.h28
-rw-r--r--libc/sysdeps/linux/arm/bits/fcntl.h31
-rw-r--r--libc/sysdeps/linux/arm/bits/kernel_stat.h9
-rw-r--r--libc/sysdeps/linux/arm/bits/shm.h103
-rw-r--r--libc/sysdeps/linux/arm/bits/syscalls.h133
-rw-r--r--libc/sysdeps/linux/arm/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/arm/bsd-_setjmp.S28
-rw-r--r--libc/sysdeps/linux/arm/bsd-setjmp.S26
-rw-r--r--libc/sysdeps/linux/arm/clone.S53
-rw-r--r--libc/sysdeps/linux/arm/crt1.S76
-rw-r--r--libc/sysdeps/linux/arm/crti.S1
-rw-r--r--libc/sysdeps/linux/arm/crtn.S1
-rw-r--r--libc/sysdeps/linux/arm/ioperm.c5
-rw-r--r--libc/sysdeps/linux/arm/mmap.c56
-rw-r--r--libc/sysdeps/linux/arm/mmap64.S46
-rw-r--r--libc/sysdeps/linux/arm/posix_fadvise.c36
-rw-r--r--libc/sysdeps/linux/arm/posix_fadvise64.c46
-rw-r--r--libc/sysdeps/linux/arm/setjmp.S27
-rw-r--r--libc/sysdeps/linux/arm/sigaction.c2
-rw-r--r--libc/sysdeps/linux/arm/sigrestorer.S20
-rw-r--r--libc/sysdeps/linux/arm/syscall-eabi.S26
-rw-r--r--libc/sysdeps/linux/arm/vfork.S40
-rw-r--r--libc/sysdeps/linux/e1/bits/fcntl.h58
-rw-r--r--libc/sysdeps/linux/e1/bits/fenvinline.h36
-rw-r--r--libc/sysdeps/linux/e1/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/e1/longjmp.c4
-rw-r--r--libc/sysdeps/linux/e1/setjmp.c8
-rw-r--r--libc/sysdeps/linux/i960/README5
-rw-r--r--libc/sysdeps/linux/i960/bits/fcntl.h58
-rw-r--r--libc/sysdeps/linux/i960/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/m68k/__syscall_error.c2
-rw-r--r--libc/sysdeps/linux/m68k/bits/fcntl.h32
-rw-r--r--libc/sysdeps/linux/m68k/bits/mathinline.h16
-rw-r--r--libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/m68k/brk.c2
-rw-r--r--libc/sysdeps/linux/m68k/fpu_control.h2
-rw-r--r--libc/sysdeps/linux/microblaze/bits/fcntl.h58
-rw-r--r--libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/microblaze/clone.c12
-rw-r--r--libc/sysdeps/linux/microblaze/syscall.c18
-rw-r--r--libc/sysdeps/linux/powerpc/Makefile.arch6
-rw-r--r--libc/sysdeps/linux/powerpc/__longjmp.S90
-rw-r--r--libc/sysdeps/linux/powerpc/bits/atomic.h8
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fcntl.h38
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fenv.h29
-rw-r--r--libc/sysdeps/linux/powerpc/bits/fenvinline.h3
-rw-r--r--libc/sysdeps/linux/powerpc/bits/mathdef.h6
-rw-r--r--libc/sysdeps/linux/powerpc/bits/mathinline.h3
-rw-r--r--libc/sysdeps/linux/powerpc/bits/syscalls.h211
-rw-r--r--libc/sysdeps/linux/powerpc/bits/sysdep.h301
-rw-r--r--libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/powerpc/crt1.S14
-rw-r--r--libc/sysdeps/linux/powerpc/crti.S9
-rw-r--r--libc/sysdeps/linux/powerpc/crtn.S11
-rw-r--r--libc/sysdeps/linux/powerpc/fenv.h136
-rw-r--r--libc/sysdeps/linux/powerpc/fpu_control.h35
-rw-r--r--libc/sysdeps/linux/powerpc/setjmp.S90
-rw-r--r--libc/sysdeps/linux/sh64/Makefile61
-rw-r--r--libc/sysdeps/linux/sh64/Makefile.arch12
-rw-r--r--libc/sysdeps/linux/sh64/__longjmp.S141
-rw-r--r--libc/sysdeps/linux/sh64/bits/fcntl.h64
-rw-r--r--libc/sysdeps/linux/sh64/bits/stackinfo.h28
-rw-r--r--libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h3
-rw-r--r--libc/sysdeps/linux/sh64/crt1.S83
-rw-r--r--libc/sysdeps/linux/sh64/sys/procfs.h126
-rw-r--r--libc/sysdeps/linux/vax/bits/fcntl.h38
-rw-r--r--libc/sysdeps/linux/vax/bits/uClibc_arch_features.h3
92 files changed, 2790 insertions, 541 deletions
diff --git a/libc/sysdeps/linux/alpha/Makefile.arch b/libc/sysdeps/linux/alpha/Makefile.arch
index 2a66bc1a4..5097008ab 100644
--- a/libc/sysdeps/linux/alpha/Makefile.arch
+++ b/libc/sysdeps/linux/alpha/Makefile.arch
@@ -1,14 +1,15 @@
# Makefile for uClibc
#
-# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := __syscall_error.c
+CSRC := __syscall_error.c sigprocmask.c
SSRC := \
__longjmp.S brk.S bsd-_setjmp.S bsd-setjmp.S clone.S \
- divl.S divq.S reml.S remq.S setjmp.S syscall.S
+ divl.S divq.S pipe.S reml.S remq.S __syscall_rt_sigaction.S setjmp.S \
+ syscall.S
include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/alpha/__syscall_rt_sigaction.S b/libc/sysdeps/linux/alpha/__syscall_rt_sigaction.S
new file mode 100644
index 000000000..f7e9e44a6
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/__syscall_rt_sigaction.S
@@ -0,0 +1,81 @@
+/* Copyright (C) 1998, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson <rth@cygnus.com>, 1998
+
+ 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 <features.h>
+#include <sys/syscall.h>
+#include <sys/regdef.h>
+
+/* On Alpha we desparately want to avoid having to issue an imb. Ordinarily
+ the kernel would have to issue one after setting up the signal return
+ stack, but the Linux rt_sigaction syscall is prepared to accept a pointer
+ to the sigreturn syscall, instead of inlining it on the stack.
+
+ This just about halves signal delivery time. */
+
+ .text
+
+.globl __syscall_rt_sigaction
+.align 4
+.ent __syscall_rt_sigaction, 0
+__syscall_rt_sigaction:
+ .frame sp,0,ra,0
+ ldgp gp,0(pv)
+ .prologue 1
+
+ beq a1, 0f
+ ldl t0, 8(a1) # sa_flags
+
+ /* The unwinder will subtract one from the return address when
+ attempting to find the call instruction that led us here.
+ Since we didn't get here via a normal call, if we do nothing
+ we would pick up the wrong symbol and the wrong FDE. Account
+ for this by adding a nop to the start of the function and
+ then skipping it here by adding 4. */
+ ldah a4, __syscall_sigreturn+4(gp) !gprelhigh
+ ldah t1, __syscall_rt_sigreturn+4(gp) !gprelhigh
+ lda a4, __syscall_sigreturn+4(a4) !gprellow
+ lda t1, __syscall_rt_sigreturn+4(t1) !gprellow
+ and t0, 0x40, t0 # SA_SIGINFO
+ cmovne t0, t1, a4
+
+0: ldi v0, __NR_rt_sigaction
+ callsys
+ bne a3, $error
+ ret
+
+$error:
+ jmp zero,__syscall_error
+
+.end __syscall_rt_sigaction
+
+__syscall_sigreturn:
+ nop
+ mov sp, a0
+ ldi v0, __NR_sigreturn
+ callsys
+ .size __syscall_sigreturn, .-__syscall_sigreturn
+ .type __syscall_sigreturn, @function
+
+__syscall_rt_sigreturn:
+ nop
+ mov sp,a0
+ ldi v0,__NR_rt_sigreturn
+ callsys
+ .size __syscall_rt_sigreturn, .-__syscall_rt_sigreturn
+ .type __syscall_rt_sigreturn, @function
diff --git a/libc/sysdeps/linux/alpha/bits/atomic.h b/libc/sysdeps/linux/alpha/bits/atomic.h
index 36a740c75..bbfd201b5 100644
--- a/libc/sysdeps/linux/alpha/bits/atomic.h
+++ b/libc/sysdeps/linux/alpha/bits/atomic.h
@@ -363,7 +363,7 @@ typedef uintmax_t uatomic_max_t;
*/
#ifndef UP
-# define atomic_full_barrier() __asm ("mb" : : : "memory");
-# define atomic_read_barrier() __asm ("mb" : : : "memory");
-# define atomic_write_barrier() __asm ("wmb" : : : "memory");
+# define atomic_full_barrier() __asm__ ("mb" : : : "memory");
+# define atomic_read_barrier() __asm__ ("mb" : : : "memory");
+# define atomic_write_barrier() __asm__ ("wmb" : : : "memory");
#endif
diff --git a/libc/sysdeps/linux/alpha/bits/fcntl.h b/libc/sysdeps/linux/alpha/bits/fcntl.h
index 9fa9c5a0b..5dfd6729f 100644
--- a/libc/sysdeps/linux/alpha/bits/fcntl.h
+++ b/libc/sysdeps/linux/alpha/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-2000, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-2000,2004,2005,2006,2007 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
@@ -50,6 +50,9 @@
# define O_NOFOLLOW 0200000 /* Do not follow links. */
# define O_DIRECT 02000000 /* Direct disk access. */
# define O_NOATIME 04000000 /* Do not set atime. */
+# if 0
+# define O_CLOEXEC 010000000 /* Set close_on_exec. */
+# endif
#endif
#ifdef __USE_LARGEFILE64
@@ -92,9 +95,11 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
#endif
-/* for F_[GET|SET]FL */
+/* for F_[GET|SET]FD */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf() */
@@ -177,6 +182,8 @@ struct flock64
#ifdef __USE_GNU
+#if 0
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -188,6 +195,15 @@ struct flock64
write. */
#endif
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+#endif
+
__BEGIN_DECLS
#ifdef __USE_GNU
@@ -201,21 +217,21 @@ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
/* Selective file content synch'ing. */
extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
unsigned int __flags);
-
+#endif
/* Splice address range into a pipe. */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
- unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
/* Splice two files together. */
-extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
/* In-kernel implementation of tee for pipe buffers. */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
-#endif
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
#endif
-
__END_DECLS
+
diff --git a/libc/sysdeps/linux/alpha/bits/ioctls.h b/libc/sysdeps/linux/alpha/bits/ioctls.h
new file mode 100644
index 000000000..c525046e5
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/bits/ioctls.h
@@ -0,0 +1,37 @@
+/* Copyright (C) 1996, 1997 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. */
+
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
+
+/* Use the definitions from the kernel header files. */
+#include <asm/ioctls.h>
+
+/* Oh well, this is necessary since the kernel data structure is
+ different from the user-level version. */
+#undef TCGETS
+#undef TCSETS
+#undef TCSETSW
+#undef TCSETSF
+#define TCGETS _IOR ('t', 19, char[44])
+#define TCSETS _IOW ('t', 20, char[44])
+#define TCSETSW _IOW ('t', 21, char[44])
+#define TCSETSF _IOW ('t', 22, char[44])
+
+#include <linux/sockios.h>
diff --git a/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h b/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h
index 66b420087..d111a5f3d 100644
--- a/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h
+++ b/libc/sysdeps/linux/alpha/bits/kernel_sigaction.h
@@ -1,3 +1,6 @@
+#ifndef _BITS_SIGACTION_STRUCT_H
+#define _BITS_SIGACTION_STRUCT_H
+
/* This is the sigaction struction from the Linux 2.1.20 kernel. */
struct old_kernel_sigaction {
@@ -15,4 +18,6 @@ struct kernel_sigaction {
};
extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded,
- struct kernel_sigaction *__unbounded, size_t);
+ struct kernel_sigaction *__unbounded, size_t) attribute_hidden;
+
+#endif
diff --git a/libc/sysdeps/linux/alpha/bits/mathinline.h b/libc/sysdeps/linux/alpha/bits/mathinline.h
index 87d40058c..3dd38e89f 100644
--- a/libc/sysdeps/linux/alpha/bits/mathinline.h
+++ b/libc/sysdeps/linux/alpha/bits/mathinline.h
@@ -38,7 +38,7 @@
# define isunordered(u, v) \
(__extension__ \
({ double __r, __u = (u), __v = (v); \
- __asm ("cmptun/su %1,%2,%0\n\ttrapb" \
+ __asm__ ("cmptun/su %1,%2,%0\n\ttrapb" \
: "=&f" (__r) : "f" (__u), "f"(__v)); \
__r != 0; }))
#endif /* ISO C99 */
@@ -52,7 +52,7 @@ __MATH_INLINE TYPE \
__NTH (NAME (TYPE __x, TYPE __y)) \
{ \
TYPE __z; \
- __asm ("cpys %1, %2, %0" : "=f" (__z) : "f" (__y), "f" (__x)); \
+ __asm__ ("cpys %1, %2, %0" : "=f" (__z) : "f" (__y), "f" (__x)); \
return __z; \
}
@@ -71,7 +71,7 @@ __MATH_INLINE TYPE \
__NTH (NAME (TYPE __x)) \
{ \
TYPE __z; \
- __asm ("cpys $f31, %1, %0" : "=f" (__z) : "f" (__x)); \
+ __asm__ ("cpys $f31, %1, %0" : "=f" (__z) : "f" (__x)); \
return __z; \
}
@@ -101,7 +101,7 @@ __NTH (__floorf (float __x))
float __tmp1, __tmp2;
- __asm ("cvtst/s %3,%2\n\t"
+ __asm__ ("cvtst/s %3,%2\n\t"
#ifdef _IEEE_FP_INEXACT
"cvttq/svim %2,%1\n\t"
#else
@@ -120,7 +120,7 @@ __NTH (__floor (double __x))
if (__x != 0 && fabs (__x) < 9007199254740992.0) /* 1 << DBL_MANT_DIG */
{
double __tmp1;
- __asm (
+ __asm__ (
#ifdef _IEEE_FP_INEXACT
"cvttq/svim %2,%1\n\t"
#else
diff --git a/libc/sysdeps/linux/alpha/bits/setjmp.h b/libc/sysdeps/linux/alpha/bits/setjmp.h
index 441313cba..4471ba975 100644
--- a/libc/sysdeps/linux/alpha/bits/setjmp.h
+++ b/libc/sysdeps/linux/alpha/bits/setjmp.h
@@ -1,5 +1,5 @@
/* Define the machine-dependent type `jmp_buf'. Alpha version.
- Copyright (C) 1992, 1997, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1992,1997,2003,2005,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
@@ -18,7 +18,7 @@
02111-1307 USA. */
#ifndef _BITS_SETJMP_H
-#define _BITS_SETJMP_H 1
+#define _BITS_SETJMP_H 1
#if !defined _SETJMP_H && !defined _PTHREAD_H
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
@@ -84,4 +84,4 @@ typedef long int __jmp_buf[17];
((void *)(_address) < (void *)((_jmpbuf)[JB_SP]))
#endif
-#endif /* bits/setjmp.h */
+#endif /* bits/setjmp.h */
diff --git a/libc/sysdeps/linux/alpha/bits/sigcontextinfo.h b/libc/sysdeps/linux/alpha/bits/sigcontextinfo.h
index eb6f4f075..16c5dcbc5 100644
--- a/libc/sysdeps/linux/alpha/bits/sigcontextinfo.h
+++ b/libc/sysdeps/linux/alpha/bits/sigcontextinfo.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2004 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
@@ -16,10 +16,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define SIGCONTEXT struct sigcontext
-#define SIGCONTEXT_EXTRA_ARGS
-#define GET_PC(ctx) ((void *) (ctx).sc_pc)
-#define GET_FRAME(ctx) ((void *) (ctx).sc_regs[15])
-#define GET_STACK(ctx) ((void *) (ctx).sc_regs[30])
+#define SIGCONTEXT int _code, struct sigcontext *
+#define SIGCONTEXT_EXTRA_ARGS _code,
+#define GET_PC(ctx) ((void *) (ctx)->sc_pc)
+#define GET_FRAME(ctx) ((void *) (ctx)->sc_regs[15])
+#define GET_STACK(ctx) ((void *) (ctx)->sc_regs[30])
#define CALL_SIGHANDLER(handler, signo, ctx) \
(handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/libc/sysdeps/linux/alpha/bits/typesizes.h b/libc/sysdeps/linux/alpha/bits/typesizes.h
new file mode 100644
index 000000000..201585af1
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/bits/typesizes.h
@@ -0,0 +1,66 @@
+/* bits/typesizes.h -- underlying types for *_t. Linux/Alpha version.
+ Copyright (C) 2002, 2003 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. */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef _BITS_TYPESIZES_H
+#define _BITS_TYPESIZES_H 1
+
+/* See <bits/types.h> for the meaning of these macros. This file exists so
+ that <bits/types.h> need not vary across different GNU platforms. */
+
+#define __DEV_T_TYPE __U64_TYPE
+#define __UID_T_TYPE __U32_TYPE
+#define __GID_T_TYPE __U32_TYPE
+#define __INO_T_TYPE __U32_TYPE
+#define __INO64_T_TYPE __U64_TYPE
+#define __MODE_T_TYPE __U32_TYPE
+#define __NLINK_T_TYPE __U32_TYPE
+#define __OFF_T_TYPE __SLONGWORD_TYPE
+#define __OFF64_T_TYPE __S64_TYPE
+#define __PID_T_TYPE __S32_TYPE
+#define __RLIM_T_TYPE __ULONGWORD_TYPE
+#define __RLIM64_T_TYPE __U64_TYPE
+#define __BLKCNT_T_TYPE __U32_TYPE
+#define __BLKCNT64_T_TYPE __U64_TYPE
+#define __FSBLKCNT_T_TYPE __S32_TYPE
+#define __FSBLKCNT64_T_TYPE __S64_TYPE
+#define __FSFILCNT_T_TYPE __U32_TYPE
+#define __FSFILCNT64_T_TYPE __U64_TYPE
+#define __ID_T_TYPE __U32_TYPE
+#define __CLOCK_T_TYPE __SLONGWORD_TYPE
+#define __TIME_T_TYPE __SLONGWORD_TYPE
+#define __USECONDS_T_TYPE __U32_TYPE
+#define __SUSECONDS_T_TYPE __S64_TYPE
+#define __DADDR_T_TYPE __S32_TYPE
+#define __SWBLK_T_TYPE __SLONGWORD_TYPE
+#define __KEY_T_TYPE __S32_TYPE
+#define __CLOCKID_T_TYPE __S32_TYPE
+#define __TIMER_T_TYPE void *
+#define __BLKSIZE_T_TYPE __U32_TYPE
+#define __FSID_T_TYPE struct { int __val[2]; }
+#define __SSIZE_T_TYPE __SWORD_TYPE
+
+/* Number of descriptors that can fit in an `fd_set'. */
+#define __FD_SETSIZE 1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h b/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h
index c48bd574d..e62375caa 100644
--- a/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h
@@ -9,7 +9,7 @@
#define __UCLIBC_ABORT_INSTRUCTION__ "call_pal 0"
/* can your target use syscall6() for mmap ? */
-#undef __UCLIBC_MMAP_HAS_6_ARGS__
+#define __UCLIBC_MMAP_HAS_6_ARGS__
/* does your target use syscall4() for truncate64 ? (32bit arches only) */
#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
@@ -17,9 +17,6 @@
/* does your target have a broken create_module() ? */
#define __UCLIBC_SLIGHTLY_BROKEN_CREATE_MODULE__
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#undef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/alpha/clone.S b/libc/sysdeps/linux/alpha/clone.S
index 9db118afd..79d4511fb 100644
--- a/libc/sysdeps/linux/alpha/clone.S
+++ b/libc/sysdeps/linux/alpha/clone.S
@@ -24,7 +24,7 @@
#define _ERRNO_H 1
#include <bits/errno.h>
#include <sys/syscall.h>
-#include <asm/regdef.h>
+#include <sys/regdef.h>
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
diff --git a/libc/sysdeps/linux/alpha/crt1.S b/libc/sysdeps/linux/alpha/crt1.S
index 0831ecf6f..0bf71248c 100644
--- a/libc/sysdeps/linux/alpha/crt1.S
+++ b/libc/sysdeps/linux/alpha/crt1.S
@@ -1,5 +1,6 @@
/* Startup code for Alpha/ELF.
- Copyright (C) 1993,1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>
@@ -8,6 +9,23 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
+ In addition to the permissions in the GNU Lesser General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file with other
+ programs, and to distribute those programs without any restriction
+ coming from the use of this file. (The GNU Lesser General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked
+ into another program.)
+
+ Note that people who make modified versions of this file are not
+ obligated to grant this special exception for their modified
+ versions; it is their choice whether to do so. The GNU Lesser
+ General Public License gives permission to release a modified
+ version without this exception; this exception also makes it
+ possible to release a modified version which carries forward this
+ exception.
+
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
@@ -19,24 +37,21 @@
02111-1307 USA. */
#include <features.h>
-#include <asm/regdef.h>
+#include <sys/regdef.h>
-.text
-.global _start
-.ent _start,0
-.type _start,%function
+ .text
+ .align 3
+ .globl _start
+ .ent _start, 0
+ .type _start,@function
#if defined(__UCLIBC_CTOR_DTOR__)
-.type _init,%function
-.type _fini,%function
+ .type _init,%function
+ .type _fini,%function
#else
-.weak _init
-.weak _fini
+ .weak _init
+ .weak _fini
#endif
-.type __uClibc_main,%function
-/* Stick in a dummy reference to main(), so that if an application
- * is linking when the main() function is in a static library (.a)
- * we can be sure that main() actually gets linked in */
-.type main,%function
+ .type __uClibc_main,%function
_start:
.frame $15, 0, $15
@@ -46,35 +61,37 @@ _start:
mov 0, $15
.prologue 0
- /* Load address of the user's main function. */
+ /* Load address of the user's main function. */
lda a0, main
ldl a1, 16(sp) /* get argc */
lda a2, 24(sp) /* get argv */
- /* Load address of our own entry points to .fini and .init. */
+ /* Load address of our own entry points to .fini and .init. */
lda a3, _init
lda a4, _fini
- /* Store address of the shared library termination function. */
+ /* Store address of the shared library termination function. */
mov v0, a5
- /* Provide the highest stack address to the user code. */
+ /* Provide the highest stack address to the user code. */
stq sp, 0(sp)
- /* Call the user's main function, and exit with its value.
- * But let the libc call main. */
+ /* Call the user's main function, and exit with its value.
+ But let the libc call main. */
jsr ra, __uClibc_main
- /* Die very horribly if exit returns. Call_pal hlt is callable from
- * kernel mode only; this will result in an illegal instruction trap. */
+ /* Die very horribly if exit returns. Call_pal hlt is callable from
+ kernel mode only; this will result in an illegal instruction trap. */
call_pal 0
.end _start
+/* For ECOFF backwards compatibility. */
+/*weak_alias (_start, __start)*/
+
/* Define a symbol for the first piece of initialized data. */
-.data
-.global __data_start
+ .data
+ .globl __data_start
__data_start:
-.long 0
-.weak data_start
+ .weak data_start
data_start = __data_start
diff --git a/libc/sysdeps/linux/alpha/divrem.h b/libc/sysdeps/linux/alpha/divrem.h
index 3a0ca1ca0..bd4e2d1be 100644
--- a/libc/sysdeps/linux/alpha/divrem.h
+++ b/libc/sysdeps/linux/alpha/divrem.h
@@ -33,6 +33,7 @@
#include <features.h>
+#include <sys/regdef.h>
#ifdef __linux__
# include <asm/gentrap.h>
# include <asm/pal.h>
@@ -50,47 +51,6 @@
#define arg2 t11
#define result t12
-#define v0 $0 /* function return value */
-
-#define t0 $1 /* temporary registers (caller-saved) */
-#define t1 $2
-#define t2 $3
-#define t3 $4
-#define t4 $5
-#define t5 $6
-#define t6 $7
-#define t7 $8
-
-#define s0 $9 /* saved-registers (callee-saved registers) */
-#define s1 $10
-#define s2 $11
-#define s3 $12
-#define s4 $13
-#define s5 $14
-#define s6 $15
-#define fp s6 /* frame-pointer (s6 in frame-less procedures) */
-
-#define a0 $16 /* argument registers (caller-saved) */
-#define a1 $17
-#define a2 $18
-#define a3 $19
-#define a4 $20
-#define a5 $21
-
-#define t8 $22 /* more temps (caller-saved) */
-#define t9 $23
-#define t10 $24
-#define t11 $25
-#define ra $26 /* return address register */
-#define t12 $27
-
-#define pv t12 /* procedure-variable register */
-#define AT $at /* assembler temporary */
-#define gp $29 /* global pointer */
-#define sp $30 /* stack pointer */
-#define zero $31 /* reads as zero, writes are noops */
-
-
#if IS_REM
# define DIV_ONLY(x,y...)
@@ -125,7 +85,9 @@
.ent UFUNC_NAME
.globl UFUNC_NAME
+#ifndef IS_IN_rtld
.hidden UFUNC_NAME
+#endif
.align 3
UFUNC_NAME:
diff --git a/libc/sysdeps/linux/alpha/pipe.S b/libc/sysdeps/linux/alpha/pipe.S
new file mode 100644
index 000000000..8a9236bc5
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/pipe.S
@@ -0,0 +1,48 @@
+/* Copyright (C) 1993, 1995, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Mosberger (davidm@cs.arizona.edu).
+
+ 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 <features.h>
+#include <sys/syscall.h>
+#include <sys/regdef.h>
+#include <asm/pal.h>
+
+/* __pipe is a special syscall since it returns two values. */
+
+.globl pipe
+.align 4
+.ent pipe, 0
+pipe:
+ .frame sp, 0, ra
+ ldgp gp,0(pv)
+ .prologue 1
+ lda v0, __NR_pipe
+ call_pal PAL_callsys
+ bne a3, $syscall_error
+
+ stl r0, 0(a0)
+ stl r1, 4(a0)
+ mov zero, v0
+ ret
+
+$syscall_error:
+ jmp zero,__syscall_error
+
+.end pipe
+
+libc_hidden_def (pipe)
diff --git a/libc/sysdeps/linux/alpha/sigprocmask.c b/libc/sysdeps/linux/alpha/sigprocmask.c
new file mode 100644
index 000000000..1da6f7baf
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/sigprocmask.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 1993, 1995, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Mosberger (davidm@azstarnet.com).
+
+ 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 <features.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#include <signal.h>
+
+/* When there is kernel support for more than 64 signals, we'll have to
+ switch to a new system call convention here. */
+
+static inline _syscall2(int, osf_sigprocmask, int, how, unsigned long int, setval);
+
+libc_hidden_proto(sigprocmask)
+int
+sigprocmask (int how, const sigset_t *set, sigset_t *oset)
+{
+ unsigned long int setval;
+ long result;
+
+ if (set)
+ setval = set->__val[0];
+ else
+ {
+ setval = 0;
+ how = SIG_BLOCK; /* ensure blocked mask doesn't get changed */
+ }
+
+ result = osf_sigprocmask(how, setval);
+ if (result == -1)
+ /* If there are ever more than 63 signals, we need to recode this
+ in assembler since we wouldn't be able to distinguish a mask of
+ all 1s from -1, but for now, we're doing just fine... */
+ return result;
+
+ if (oset)
+ {
+ oset->__val[0] = result;
+ result = _SIGSET_NWORDS;
+ while (--result > 0)
+ oset->__val[result] = 0;
+ }
+ return 0;
+}
+libc_hidden_def(sigprocmask)
diff --git a/libc/sysdeps/linux/alpha/sys/acct.h b/libc/sysdeps/linux/alpha/sys/acct.h
new file mode 100644
index 000000000..1e00006ef
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/sys/acct.h
@@ -0,0 +1,66 @@
+/* Copyright (C) 1996, 1997, 2000 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. */
+
+#ifndef _SYS_ACCT_H
+
+#define _SYS_ACCT_H 1
+#include <features.h>
+
+#define __need_time_t
+#include <time.h>
+
+
+__BEGIN_DECLS
+
+#define ACCT_COMM 16
+
+struct acct
+ {
+ char ac_comm[ACCT_COMM]; /* Accounting command name. */
+ time_t ac_utime; /* Accounting user time. */
+ time_t ac_stime; /* Accounting system time. */
+ time_t ac_etime; /* Accounting elapsed time. */
+ time_t ac_btime; /* Beginning time. */
+ unsigned int ac_uid; /* Accounting user ID. */
+ unsigned int ac_gid; /* Accounting group ID. */
+ unsigned int ac_tty; /* Controlling tty. */
+ /* Please note that the value of the `ac_tty' field, a device number,
+ is encoded differently in the kernel and for the libc dev_t type. */
+ char ac_flag; /* Accounting flag. */
+ long int ac_minflt; /* Accounting minor pagefaults. */
+ long int ac_majflt; /* Accounting major pagefaults. */
+ long int ac_exitcode; /* Accounting process exitcode. */
+ };
+
+enum
+ {
+ AFORK = 0001, /* Has executed fork, but no exec. */
+ ASU = 0002, /* Used super-user privileges. */
+ ACORE = 0004, /* Dumped core. */
+ AXSIG = 0010 /* Killed by a signal. */
+ };
+
+#define AHZ 100
+
+
+/* Switch process accounting on and off. */
+extern int acct (__const char *__filename) __THROW;
+
+__END_DECLS
+
+#endif /* sys/acct.h */
diff --git a/libc/sysdeps/linux/alpha/sys/regdef.h b/libc/sysdeps/linux/alpha/sys/regdef.h
new file mode 100644
index 000000000..18fb0d5d9
--- /dev/null
+++ b/libc/sysdeps/linux/alpha/sys/regdef.h
@@ -0,0 +1,47 @@
+#ifndef __alpha_regdef_h__
+#define __alpha_regdef_h__
+
+#define v0 $0 /* function return value */
+
+#define t0 $1 /* temporary registers (caller-saved) */
+#define t1 $2
+#define t2 $3
+#define t3 $4
+#define t4 $5
+#define t5 $6
+#define t6 $7
+#define t7 $8
+
+#define s0 $9 /* saved-registers (callee-saved registers) */
+#define s1 $10
+#define s2 $11
+#define s3 $12
+#define s4 $13
+#define s5 $14
+#define s6 $15
+#define fp s6 /* frame-pointer (s6 in frame-less procedures) */
+
+#define a0 $16 /* argument registers (caller-saved) */
+#define a1 $17
+#define a2 $18
+#define a3 $19
+#define a4 $20
+#define a5 $21
+
+#define t8 $22 /* more temps (caller-saved) */
+#define t9 $23
+#define t10 $24
+#define t11 $25
+#define ra $26 /* return address register */
+#define t12 $27
+
+#define pv t12 /* procedure-variable register */
+#define AT $at /* assembler temporary */
+#define gp $29 /* global pointer */
+#define sp $30 /* stack pointer */
+#define zero $31 /* reads as zero, writes are noops */
+
+#define r0 v0
+#define r1 a4
+
+#endif /* __alpha_regdef_h__ */
diff --git a/libc/sysdeps/linux/alpha/syscall.S b/libc/sysdeps/linux/alpha/syscall.S
index 1ccb5815f..89901d547 100644
--- a/libc/sysdeps/linux/alpha/syscall.S
+++ b/libc/sysdeps/linux/alpha/syscall.S
@@ -18,7 +18,7 @@
02111-1307 USA. */
#include <features.h>
-#include <asm/regdef.h>
+#include <sys/regdef.h>
#include <asm/pal.h>
/*
diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
index c599a22d0..a3b6fc4d8 100644
--- a/libc/sysdeps/linux/arm/Makefile.arch
+++ b/libc/sysdeps/linux/arm/Makefile.arch
@@ -5,7 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := brk.c ioperm.c iopl.c mmap.c sigaction.c __syscall_error.c
+CSRC := brk.c ioperm.c iopl.c mmap.c posix_fadvise.c posix_fadvise64.c \
+ sigaction.c __syscall_error.c
SSRC := \
__longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \
diff --git a/libc/sysdeps/linux/arm/__longjmp.S b/libc/sysdeps/linux/arm/__longjmp.S
index 4261797f8..5faf4ece9 100644
--- a/libc/sysdeps/linux/arm/__longjmp.S
+++ b/libc/sysdeps/linux/arm/__longjmp.S
@@ -18,6 +18,7 @@
02111-1307 USA. */
#include <features.h>
+#include <bits/arm_asm.h>
#define _SETJMP_H
#define _ASM
#include <bits/setjmp.h>
@@ -26,13 +27,44 @@
.global __longjmp
.type __longjmp,%function
.align 2
+#if defined(THUMB1_ONLY)
+.thumb_func
+__longjmp:
+ mov r2, r0
+ movs r0, r1
+ /* can't let setjmp() return zero! */
+ bne 1f
+ mov r0, #1
+1:
+ mov r1, r2
+ /* Restore registers, shuffling them through low regs. */
+ add r2, #(4 * 4)
+ ldmia r2!, {r4, r5, r6, r7}
+ mov r8, r4
+ mov r9, r5
+ mov sl, r6
+ mov fp, r7
+ ldmia r2!, {r4, r5}
+ mov sp, r4
+ mov lr, r5
+ ldmia r1!, {r4, r5, r6, r7}
+ bx lr
+#else
__longjmp:
mov ip, r0 /* save jmp_buf pointer */
movs r0, r1 /* get the return value in place */
+ IT(t, eq)
moveq r0, #1 /* can't let setjmp() return zero! */
+#if defined(__thumb2__)
+ /* Thumb-2 does not allow loading sp with ldm. */
+ ldmia ip!, {v1-v6, sl, fp}
+ ldr sp, [ip], #4
+ ldr lr, [ip], #4
+#else
ldmia ip!, {v1-v6, sl, fp, sp, lr}
+#endif
#if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
#ifdef __VFP_FP__
@@ -76,6 +108,7 @@ __longjmp:
#else
mov pc, lr
#endif
+#endif
.size __longjmp,.-__longjmp
libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/arm/aeabi_memclr.c b/libc/sysdeps/linux/arm/aeabi_memclr.c
index ed335c0ac..c0f90216c 100644
--- a/libc/sysdeps/linux/arm/aeabi_memclr.c
+++ b/libc/sysdeps/linux/arm/aeabi_memclr.c
@@ -18,7 +18,7 @@
#include <string.h>
-libc_hidden_proto(memset)
+/* Experimentally off - libc_hidden_proto(memset) */
/* Clear memory. Can't alias to bzero because it's not defined in the
same translation unit. */
diff --git a/libc/sysdeps/linux/arm/aeabi_memcpy.c b/libc/sysdeps/linux/arm/aeabi_memcpy.c
index 18c7a38ea..83eac0b67 100644
--- a/libc/sysdeps/linux/arm/aeabi_memcpy.c
+++ b/libc/sysdeps/linux/arm/aeabi_memcpy.c
@@ -18,7 +18,7 @@
#include <string.h>
-libc_hidden_proto(memcpy)
+/* Experimentally off - libc_hidden_proto(memcpy) */
/* Copy memory like memcpy, but no return value required. Can't alias
to memcpy because it's not defined in the same translation
diff --git a/libc/sysdeps/linux/arm/aeabi_memmove.c b/libc/sysdeps/linux/arm/aeabi_memmove.c
index 70746ece4..164d72bc9 100644
--- a/libc/sysdeps/linux/arm/aeabi_memmove.c
+++ b/libc/sysdeps/linux/arm/aeabi_memmove.c
@@ -18,7 +18,7 @@
#include <string.h>
-libc_hidden_proto(memmove)
+/* Experimentally off - libc_hidden_proto(memmove) */
/* Copy memory like memmove, but no return value required. Can't
alias to memmove because it's not defined in the same translation
diff --git a/libc/sysdeps/linux/arm/aeabi_memset.c b/libc/sysdeps/linux/arm/aeabi_memset.c
index 8bf980b8b..f1c366f27 100644
--- a/libc/sysdeps/linux/arm/aeabi_memset.c
+++ b/libc/sysdeps/linux/arm/aeabi_memset.c
@@ -18,7 +18,7 @@
#include <string.h>
-libc_hidden_proto(memset)
+/* Experimentally off - libc_hidden_proto(memset) */
/* Set memory like memset, but different argument order and no return
value required. */
diff --git a/libc/sysdeps/linux/arm/bits/arm_asm.h b/libc/sysdeps/linux/arm/bits/arm_asm.h
new file mode 100644
index 000000000..1d87df6eb
--- /dev/null
+++ b/libc/sysdeps/linux/arm/bits/arm_asm.h
@@ -0,0 +1,28 @@
+/* Various definitons used the the ARM uClibc assembly code. */
+#ifndef _ARM_ASM_H
+#define _ARM_ASM_H
+
+#ifdef __thumb2__
+.thumb
+.syntax unified
+#define IT(t, cond) i##t cond
+#else
+/* XXX: This can be removed if/when we require an assembler that supports
+ unified assembly syntax. */
+#define IT(t, cond)
+/* Code to return from a thumb function stub. */
+#ifdef __ARM_ARCH_4T__
+#define POP_RET pop {r2, pc}
+#else
+#define POP_RET pop {r2, r3}; bx r3
+#endif
+#endif
+
+#if defined(__ARM_ARCH_6M__)
+/* Force arm mode to flush out errors on M profile cores. */
+#undef IT
+#define THUMB1_ONLY 1
+#endif
+
+#endif /* _ARM_ASM_H */
+
diff --git a/libc/sysdeps/linux/arm/bits/fcntl.h b/libc/sysdeps/linux/arm/bits/fcntl.h
index 1153d2760..f566fe4f8 100644
--- a/libc/sysdeps/linux/arm/bits/fcntl.h
+++ b/libc/sysdeps/linux/arm/bits/fcntl.h
@@ -1,5 +1,6 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-1998, 2000, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998, 2000, 2004, 2006, 2007, 2008
+ 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
@@ -49,6 +50,9 @@
# define O_NOFOLLOW 0100000 /* Do not follow links. */
# define O_DIRECT 0200000 /* Direct disk access. */
# define O_NOATIME 01000000 /* Do not set atime. */
+# if 0
+# define O_CLOEXEC 02000000 /* Set close_on_exec. */
+# endif
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -96,9 +100,11 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
#endif
-/* For F_[GET|SET]FL. */
+/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
@@ -184,6 +190,7 @@ struct flock64
#ifdef __USE_GNU
+#if 0
/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
@@ -194,6 +201,7 @@ struct flock64
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+#endif
/* Flags for SPLICE and VMSPLICE. */
# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
@@ -212,26 +220,25 @@ __BEGIN_DECLS
extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
__THROW;
-
#if 0
/* Selective file content synch'ing. */
extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
unsigned int __flags);
-
+#endif
/* Splice address range into a pipe. */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
- unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
/* Splice two files together. */
-extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
/* In-kernel implementation of tee for pipe buffers. */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
-#endif
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
#endif
-
__END_DECLS
+
diff --git a/libc/sysdeps/linux/arm/bits/kernel_stat.h b/libc/sysdeps/linux/arm/bits/kernel_stat.h
index b3f8c37d0..b686c479a 100644
--- a/libc/sysdeps/linux/arm/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/arm/bits/kernel_stat.h
@@ -58,13 +58,8 @@ struct kernel_stat64 {
long long st_size;
unsigned long st_blksize;
-#if defined(__ARMEB__)
- unsigned long __pad4; /* future possible st_blocks high bits */
- unsigned long st_blocks; /* Number 512-byte blocks allocated. */
-#else
- unsigned long st_blocks; /* Number 512-byte blocks allocated. */
- unsigned long __pad4; /* future possible st_blocks high bits */
-#endif
+ unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
+
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
diff --git a/libc/sysdeps/linux/arm/bits/shm.h b/libc/sysdeps/linux/arm/bits/shm.h
new file mode 100644
index 000000000..c89c00a17
--- /dev/null
+++ b/libc/sysdeps/linux/arm/bits/shm.h
@@ -0,0 +1,103 @@
+/* Copyright (C) 1995,1996,1997,2000,2002,2004 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. */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Permission flag for shmget. */
+#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
+#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
+
+/* Flags for `shmat'. */
+#define SHM_RDONLY 010000 /* attach read-only else read-write */
+#define SHM_RND 020000 /* round attach address to SHMLBA */
+#define SHM_REMAP 040000 /* take-over region on attach */
+
+/* Commands for `shmctl'. */
+#define SHM_LOCK 11 /* lock segment (root only) */
+#define SHM_UNLOCK 12 /* unlock segment (root only) */
+
+__BEGIN_DECLS
+
+/* Segment low boundary address multiple. */
+#define SHMLBA (__getpagesize () << 2)
+extern int __getpagesize (void) __THROW __attribute__ ((__const__));
+
+
+/* Type to count number of attaches. */
+typedef unsigned long int shmatt_t;
+
+/* Data structure describing a set of semaphores. */
+struct shmid_ds
+ {
+ struct ipc_perm shm_perm; /* operation permission struct */
+ size_t shm_segsz; /* size of segment in bytes */
+ __time_t shm_atime; /* time of last shmat() */
+ unsigned long int __unused1;
+ __time_t shm_dtime; /* time of last shmdt() */
+ unsigned long int __unused2;
+ __time_t shm_ctime; /* time of last change by shmctl() */
+ unsigned long int __unused3;
+ __pid_t shm_cpid; /* pid of creator */
+ __pid_t shm_lpid; /* pid of last shmop */
+ shmatt_t shm_nattch; /* number of current attaches */
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+ };
+
+#ifdef __USE_MISC
+
+/* ipcs ctl commands */
+# define SHM_STAT 13
+# define SHM_INFO 14
+
+/* shm_mode upper byte flags */
+# define SHM_DEST 01000 /* segment will be destroyed on last detach */
+# define SHM_LOCKED 02000 /* segment will not be swapped */
+# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
+# define SHM_NORESERVE 010000 /* don't check for reservations */
+
+struct shminfo
+ {
+ unsigned long int shmmax;
+ unsigned long int shmmin;
+ unsigned long int shmmni;
+ unsigned long int shmseg;
+ unsigned long int shmall;
+ unsigned long int __unused1;
+ unsigned long int __unused2;
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ };
+
+struct shm_info
+ {
+ int used_ids;
+ unsigned long int shm_tot; /* total allocated shm */
+ unsigned long int shm_rss; /* total resident shm */
+ unsigned long int shm_swp; /* total swapped shm */
+ unsigned long int swap_attempts;
+ unsigned long int swap_successes;
+ };
+
+#endif /* __USE_MISC */
+
+__END_DECLS
diff --git a/libc/sysdeps/linux/arm/bits/syscalls.h b/libc/sysdeps/linux/arm/bits/syscalls.h
index 2da150624..af6cf843d 100644
--- a/libc/sysdeps/linux/arm/bits/syscalls.h
+++ b/libc/sysdeps/linux/arm/bits/syscalls.h
@@ -94,112 +94,67 @@ return (type) (INLINE_SYSCALL(name, 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
#undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \
- ({ unsigned int __sys_result = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (__sys_result, ), 0)) \
+ ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ), 0)) \
{ \
- __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_result, )); \
- __sys_result = (unsigned int) -1; \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (_inline_sys_result, )); \
+ _inline_sys_result = (unsigned int) -1; \
} \
- (int) __sys_result; })
+ (int) _inline_sys_result; })
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL
-#if defined(__ARM_EABI__)
#if !defined(__thumb__)
+#if defined(__ARM_EABI__)
#define INTERNAL_SYSCALL(name, err, nr, args...) \
- ({unsigned int _sys_result; \
+ ({unsigned int __sys_result; \
{ \
- register int _a1 __asm__ ("r0"), _nr __asm__ ("r7"); \
+ register int _a1 __asm__ ("r0"), _nr __asm__ ("r7"); \
LOAD_ARGS_##nr (args) \
_nr = SYS_ify(name); \
- __asm__ volatile ("swi 0x0 @ syscall " #name \
+ __asm__ __volatile__ ("swi 0x0 @ syscall " #name \
+ : "=r" (_a1) \
+ : "r" (_nr) ASM_ARGS_##nr \
+ : "memory"); \
+ __sys_result = _a1; \
+ } \
+ (int) __sys_result; })
+#else /* defined(__ARM_EABI__) */
+
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ unsigned int __sys_result; \
+ { \
+ register int _a1 __asm__ ("a1"); \
+ LOAD_ARGS_##nr (args) \
+ __asm__ __volatile__ ("swi %1 @ syscall " #name \
: "=r" (_a1) \
- : "r" (_nr) ASM_ARGS_##nr \
+ : "i" (SYS_ify(name)) ASM_ARGS_##nr \
: "memory"); \
- _sys_result = _a1; \
+ __sys_result = _a1; \
} \
- (int) _sys_result; })
+ (int) __sys_result; })
+#endif
#else /* !defined(__thumb__) */
-/* So hide the use of r7 from the compiler, this would be a lot
- * easier but for the fact that the syscalls can exceed 255.
- * For the moment the LOAD_ARG_7 is sacrificed.
- */
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- ({ unsigned int _sys_result; \
- { \
- register int _a1 asm ("a1"); \
- LOAD_ARGS_##nr (args) \
- register int _v3 asm ("v3") = (int) (SYS_ify(name)); \
- asm volatile ("push {r7}\n" \
- "\tmov r7, v3\n" \
- "\tswi 0 @ syscall " #name "\n" \
- "\tpop {r7}" \
- : "=r" (_a1) \
- : "r" (_v3) ASM_ARGS_##nr \
- : "memory"); \
- _sys_result = _a1; \
- } \
- (int) _sys_result; })
+
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ unsigned int __sys_result; \
+ { \
+ register int _a1 __asm__ ("a1"); \
+ LOAD_ARGS_##nr (args) \
+ register int _v3 __asm__ ("v3") = (int) (SYS_ify(name)); \
+ __asm__ __volatile__ ("push {r7}\n" \
+ "\tmov r7, v3\n" \
+ "\tswi 0 @ syscall " #name "\n" \
+ "\tpop {r7}" \
+ : "=r" (_a1) \
+ : "r" (_v3) ASM_ARGS_##nr \
+ : "memory"); \
+ __sys_result = _a1; \
+ } \
+ (int) __sys_result; })
#endif /*!defined(__thumb__)*/
-#else /* !defined(__ARM_EABI__) */
-#if !defined(__thumb__)
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- ({ unsigned int _sys_result; \
- { \
- register int _a1 __asm__ ("a1"); \
- LOAD_ARGS_##nr (args) \
- __asm__ volatile ("swi %1 @ syscall " #name \
- : "=r" (_a1) \
- : "i" (SYS_ify(name)) ASM_ARGS_##nr \
- : "memory"); \
- _sys_result = _a1; \
- } \
- (int) _sys_result; })
-#else
-#if 0
-/* This doesn't work because GCC uses r7 as a frame pointer in
- * some cases and doesn't notice that the _r7 value changes
- * it, resulting in mysterious crashes after the SWI.
- */
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- ({ unsigned int _sys_result; \
- { \
- register int _a1 __asm__ ("a1"); \
- LOAD_ARGS_##nr (args) \
- register int _r7 __asm__ ("r7") = (int) (SYS_ify(name)); \
- __asm__ volatile ("swi 0 @ syscall " #name \
- : "=r" (_a1) \
- : "r" (_r7) ASM_ARGS_##nr \
- : "memory"); \
- _sys_result = _a1; \
- } \
- (int) _sys_result; })
-#else
-/* So hide the use of r7 from the compiler, this would be a lot
- * easier but for the fact that the syscalls can exceed 255.
- * For the moment the LOAD_ARG_7 is sacrificed.
- */
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- ({ unsigned int _sys_result; \
- { \
- register int _a1 __asm__ ("a1"); \
- LOAD_ARGS_##nr (args) \
- register int _v3 __asm__ ("v3") = (int) (SYS_ify(name)); \
- __asm__ volatile ("push {r7}\n" \
- "\tmov r7, v3\n" \
- "\tswi 0 @ syscall " #name "\n" \
- "\tpop {r7}" \
- : "=r" (_a1) \
- : "r" (_v3) ASM_ARGS_##nr \
- : "memory"); \
- _sys_result = _a1; \
- } \
- (int) _sys_result; })
-#endif
-#endif
-#endif /* !defined(__ARM_EABI__) */
#undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
diff --git a/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
index 93b523f0d..85c9adb8a 100644
--- a/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
@@ -17,9 +17,6 @@
/* does your target have a broken create_module() ? */
#define __UCLIBC_BROKEN_CREATE_MODULE__
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/arm/bsd-_setjmp.S b/libc/sysdeps/linux/arm/bsd-_setjmp.S
index f70073266..a05570df7 100644
--- a/libc/sysdeps/linux/arm/bsd-_setjmp.S
+++ b/libc/sysdeps/linux/arm/bsd-_setjmp.S
@@ -17,13 +17,38 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+#include <bits/arm_asm.h>
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
We cannot do it in C because it must be a tail-call, so frame-unwinding
in setjmp doesn't clobber the state restored by longjmp. */
.global _setjmp
.type _setjmp,%function
.align 2
+#if defined(THUMB1_ONLY)
+.thumb_func
+_setjmp:
+ mov r1, #0
+#ifdef __PIC__
+ ldr r3, .L_GOT
+ adr r2, .L_GOT
+ add r3, r2, r3
+
+ ldr r2, .L_GOT+4 /* __sigsetjmp */
+ ldr r2, [r2, r3]
+ bx r2
+
+ .align 2
+.L_GOT:
+ .word _GLOBAL_OFFSET_TABLE_-.L_GOT
+ .word __sigsetjmp(GOT)
+#else
+ ldr r2, =__sigsetjmp
+ bx r2
+.pool
+#endif
+#else
_setjmp:
mov r1, #0
#ifdef __PIC__
@@ -31,5 +56,6 @@ _setjmp:
#else
b __sigsetjmp
#endif
+#endif
.size _setjmp,.-_setjmp
diff --git a/libc/sysdeps/linux/arm/bsd-setjmp.S b/libc/sysdeps/linux/arm/bsd-setjmp.S
index 6253c6675..d7ca72ad5 100644
--- a/libc/sysdeps/linux/arm/bsd-setjmp.S
+++ b/libc/sysdeps/linux/arm/bsd-setjmp.S
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <bits/arm_asm.h>
+
/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
We cannot do it in C because it must be a tail-call, so frame-unwinding
in setjmp doesn't clobber the state restored by longjmp. */
@@ -24,6 +26,29 @@
.global setjmp
.type setjmp,%function
.align 2
+#if defined(THUMB1_ONLY)
+.thumb_func
+setjmp:
+ mov r1, #1
+#ifdef __PIC__
+ ldr r3, .L_GOT
+ adr r2, .L_GOT
+ add r3, r2, r3
+
+ ldr r2, .L_GOT+4 /* __sigsetjmp */
+ ldr r2, [r2, r3]
+ bx r2
+
+ .align 2
+.L_GOT:
+ .word _GLOBAL_OFFSET_TABLE_-.L_GOT
+ .word __sigsetjmp(GOT)
+#else
+ ldr r2, =__sigsetjmp
+ bx r2
+.pool
+#endif
+#else
setjmp:
mov r1, #1
#ifdef __PIC__
@@ -31,5 +56,6 @@ setjmp:
#else
b __sigsetjmp
#endif
+#endif
.size setjmp,.-setjmp
diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
index a5a847d1e..d9483735d 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -24,17 +24,66 @@
#include <features.h>
#include <bits/errno.h>
#include <sys/syscall.h>
+#include <bits/arm_asm.h>
-#ifdef __NR_clone
+#if defined(__NR_clone)
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
.text
.global clone
.type clone,%function
.align 2
+#if defined(THUMB1_ONLY)
+.thumb_func
clone:
@ sanity check args
cmp r0, #0
+ beq __einval
+ cmp r1, #0
+ beq __einval
+
+ @ insert the args onto the new stack
+ sub r1, r1, #8
+ str r3, [r1, #4]
+ @ save the function pointer as the 0th element
+ str r0, [r1]
+
+ @ do the system call
+ @ get flags
+ mov r0, r2
+ @ new sp is already in r1
+ DO_CALL (clone)
+ movs a1, a1
+ blt __error
+ beq 1f
+ bx lr
+1:
+
+ @ pick the function arg and call address off the stack and execute
+ ldr r0, [sp, #4]
+ ldr r1, [sp]
+ bl 2f @ blx r1
+
+ @ and we are done, passing the return value through r0
+ bl HIDDEN_JUMPTARGET(_exit)
+ @ Should never return
+ b .
+
+2:
+ bx r1
+
+__einval:
+ ldr r0, =-EINVAL
+__error:
+ push {r3, lr}
+ bl __syscall_error
+ POP_RET
+.pool
+#else
+clone:
+ @ sanity check args
+ cmp r0, #0
+ IT(te, ne)
cmpne r1, #0
moveq r0, #-EINVAL
beq __error
@@ -52,6 +101,7 @@ clone:
DO_CALL (clone)
movs a1, a1
blt __error
+ IT(t, ne)
#if defined(__USE_BX__)
bxne lr
#else
@@ -68,6 +118,7 @@ clone:
__error:
b __syscall_error
+#endif
.size clone,.-clone
diff --git a/libc/sysdeps/linux/arm/crt1.S b/libc/sysdeps/linux/arm/crt1.S
index 02c2f8de9..082348e39 100644
--- a/libc/sysdeps/linux/arm/crt1.S
+++ b/libc/sysdeps/linux/arm/crt1.S
@@ -94,6 +94,7 @@ ARM register quick reference:
*/
#include <features.h>
+#include <bits/arm_asm.h>
.text
.globl _start
@@ -105,6 +106,73 @@ ARM register quick reference:
.weak _fini
#endif
+#if defined(THUMB1_ONLY)
+.thumb_func
+_start:
+ /* Clear the frame pointer since this is the outermost frame. */
+ mov r3, #0
+ mov fp, r3
+
+#ifdef __ARCH_USE_MMU__
+ /* Pop argc off the stack and save a pointer to argv */
+ pop {a2}
+ mov a3, sp
+#else
+ /*
+ * uClinux/arm stacks look a little different from normal
+ * MMU-full Linux/arm stacks (for no good reason)
+ */
+ /* pull argc and argv off the stack. We are going to push 3
+ * arguments, so pop one here to maintain doubleword alignment. */
+ pop {a2}
+ ldr a3, [sp]
+#endif
+
+ /* Push stack limit and rtld_fini */
+ push {a1, a3}
+
+#ifdef __PIC__
+ ldr r4, .L_GOT
+.L_GOT_OFF:
+ adr r5, .L_GOT
+ add r4, r5, r4
+
+ ldr r5, .L_GOT+4 /* _fini */
+ ldr a1, [r4, r5]
+ push {a1} /* Push _fini */
+
+ ldr r5, .L_GOT+8 /* _init */
+ ldr a4, [r4, r5]
+
+ ldr r5, .L_GOT+12 /* main */
+ ldr a1, [r4, r5]
+
+#else
+ /* Fetch address of fini */
+ ldr r4, =_fini
+ /* Push fini */
+ push {r4}
+
+ /* Set up the other arguments in registers */
+ ldr a1, =main
+ ldr a4, =_init
+#endif
+ /* __uClibc_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
+ /* Let the libc call main and exit with its return code. */
+ bl __uClibc_main
+
+ /* should never get here....*/
+ bl abort
+.pool
+
+#ifdef __PIC__
+.L_GOT:
+ .word _GLOBAL_OFFSET_TABLE_-.L_GOT
+ .word _fini(GOT)
+ .word _init(GOT)
+ .word main(GOT)
+#endif
+#else /* !THUMB1_ONLY */
_start:
/* Clear the frame pointer and link register since this is the outermost frame. */
mov fp, #0
@@ -119,9 +187,10 @@ _start:
* uClinux/arm stacks look a little different from normal
* MMU-full Linux/arm stacks (for no good reason)
*/
- /* pull argc and argv off the stack */
- ldr a2, [sp, #0]
- ldr a3, [sp, #4]
+ /* pull argc and argv off the stack. We are going to push 3
+ * arguments, so pop one here to maintain doubleword alignment. */
+ ldr a2, [sp], #4
+ ldr a3, [sp]
#endif
/* Push stack limit */
@@ -174,6 +243,7 @@ _start:
.word _init(GOT)
.word main(GOT)
#endif
+#endif
/* Define a symbol for the first piece of initialized data. */
.data
diff --git a/libc/sysdeps/linux/arm/crti.S b/libc/sysdeps/linux/arm/crti.S
index 4835b8331..e335b7140 100644
--- a/libc/sysdeps/linux/arm/crti.S
+++ b/libc/sysdeps/linux/arm/crti.S
@@ -1,5 +1,6 @@
.file "initfini.c"
+#include <bits/arm_asm.h>
.section .init
.global _init
.type _init, %function
diff --git a/libc/sysdeps/linux/arm/crtn.S b/libc/sysdeps/linux/arm/crtn.S
index 7a1ca1ab1..de01b38dc 100644
--- a/libc/sysdeps/linux/arm/crtn.S
+++ b/libc/sysdeps/linux/arm/crtn.S
@@ -1,5 +1,6 @@
.file "initfini.c"
+#include <bits/arm_asm.h>
.section .init
.global _init
.type _init, %function
diff --git a/libc/sysdeps/linux/arm/ioperm.c b/libc/sysdeps/linux/arm/ioperm.c
index 1ae2297cb..0229f871d 100644
--- a/libc/sysdeps/linux/arm/ioperm.c
+++ b/libc/sysdeps/linux/arm/ioperm.c
@@ -43,10 +43,7 @@
#include <sys/types.h>
#include <sys/mman.h>
-
-#include <asm/page.h>
#include <sys/sysctl.h>
-
#include <sys/io.h>
libc_hidden_proto(ioperm)
@@ -59,7 +56,7 @@ libc_hidden_proto(fprintf)
libc_hidden_proto(fgets)
libc_hidden_proto(fopen)
libc_hidden_proto(fclose)
-libc_hidden_proto(strcmp)
+/* Experimentally off - libc_hidden_proto(strcmp) */
libc_hidden_proto(open)
libc_hidden_proto(close)
diff --git a/libc/sysdeps/linux/arm/mmap.c b/libc/sysdeps/linux/arm/mmap.c
index 4d01caadb..440cb17b1 100644
--- a/libc/sysdeps/linux/arm/mmap.c
+++ b/libc/sysdeps/linux/arm/mmap.c
@@ -11,20 +11,64 @@
#include <sys/mman.h>
#include <sys/syscall.h>
+#if defined (__NR_mmap) || defined (__NR_mmap2)
+
libc_hidden_proto (mmap)
+#if defined (__UCLIBC_MMAP_HAS_6_ARGS__) && defined (__NR_mmap)
+#define __NR__mmap __NR_mmap
+static inline _syscall6 (__ptr_t, _mmap, __ptr_t, addr, size_t, len,
+ int, prot, int, flags, int, fd, __off_t, offset);
+__ptr_t mmap(__ptr_t addr, size_t len, int prot,
+ int flags, int fd, __off_t offset)
+{
+ return (__ptr_t) _mmap (addr, len, prot, flags,
+ fd, offset);
+}
-#if defined __ARM_EABI__
+#elif defined (__NR_mmap2)
#define __NR__mmap __NR_mmap2
-#else
-#define __NR__mmap __NR_mmap
+
+#ifndef MMAP2_PAGE_SHIFT
+# define MMAP2_PAGE_SHIFT 12
#endif
+
static inline _syscall6 (__ptr_t, _mmap, __ptr_t, addr, size_t, len,
int, prot, int, flags, int, fd, __off_t, offset);
-
__ptr_t mmap(__ptr_t addr, size_t len, int prot,
- int flags, int fd, __off_t offset)
+ int flags, int fd, __off_t offset)
{
- return (__ptr_t) _mmap (addr, len, prot, flags, fd, offset);
+ /* check if offset is page aligned */
+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
+ {
+ __set_errno(EINVAL);
+ return MAP_FAILED;
+ }
+#ifdef __USE_FILE_OFFSET64
+ return (__ptr_t) _mmap (addr, len, prot, flags,
+ fd, ((__u_quad_t) offset >> MMAP2_PAGE_SHIFT));
+#else
+ return (__ptr_t) _mmap (addr, len, prot, flags,
+ fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT));
+#endif
}
+#elif defined (__NR_mmap)
+# define __NR__mmap __NR_mmap
+static inline _syscall1(__ptr_t, _mmap, unsigned long *, buffer);
+__ptr_t mmap(__ptr_t addr, size_t len, int prot,
+ int flags, int fd, __off_t offset)
+{
+ unsigned long buffer[6];
+ buffer[0] = (unsigned long) addr;
+ buffer[1] = (unsigned long) len;
+ buffer[2] = (unsigned long) prot;
+ buffer[3] = (unsigned long) flags;
+ buffer[4] = (unsigned long) fd;
+ buffer[5] = (unsigned long) offset;
+ return (__ptr_t) _mmap(buffer);
+}
+#endif
libc_hidden_def (mmap)
+#else
+# error "Your architecture doesn't seem to provide mmap() !?"
+#endif
diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S
index ba8cb2fca..707154124 100644
--- a/libc/sysdeps/linux/arm/mmap64.S
+++ b/libc/sysdeps/linux/arm/mmap64.S
@@ -20,6 +20,7 @@
#define _ERRNO_H
#include <bits/errno.h>
#include <sys/syscall.h>
+#include <bits/arm_asm.h>
#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2
@@ -28,9 +29,46 @@
.global mmap64
.type mmap64,%function
.align 2
-mmap64:
#ifdef __ARM_EABI__
+#if defined(THUMB1_ONLY)
+.thumb_func
+mmap64:
+#ifdef __ARMEB__
+/* Offsets are after pushing 3 words. */
+# define LOW_OFFSET 12 + 8 + 4
+# define HIGH_OFFSET 12 + 8 + 0
+#else
+# define LOW_OFFSET 12 + 8 + 0
+# define HIGH_OFFSET 12 + 8 + 4
+#endif
+ push {r4, r5, r6}
+ ldr r6, [sp, $LOW_OFFSET]
+ ldr r5, [sp, $HIGH_OFFSET]
+ lsl r4, r6, #20 @ check that offset is page-aligned
+ bne .Linval
+ lsr r4, r5, #12 @ check for overflow
+ bne .Linval
+ @ compose page offset
+ lsr r6, r6, #12
+ lsl r5, r5, #20
+ orr r5, r5, r6
+ ldr r4, [sp, #8] @ load fd
+ DO_CALL (mmap2)
+ ldr r1, =0xfffff000
+ cmp r0, r1
+ bcs .Lerror
+ bx lr
+.Linval:
+ ldr r0, =-EINVAL
+ pop {r4, r5, r6}
+.Lerror:
+ push {r3, lr}
+ bl __syscall_error
+ POP_RET
+.pool
+#else /* !THUMB1_ONLY */
+mmap64:
#ifdef __ARMEB__
# define LOW_OFFSET 8 + 4
/* The initial + 4 is for the stack postdecrement. */
@@ -45,6 +83,7 @@ mmap64:
str r4, [sp, #-4]!
movs r4, ip, lsl $20 @ check that offset is page-aligned
mov ip, ip, lsr $12
+ IT(t, eq)
moveqs r4, r5, lsr $12 @ check for overflow
bne .Linval
ldr r4, [sp, $8] @ load fd
@@ -52,6 +91,7 @@ mmap64:
DO_CALL (mmap2)
cmn r0, $4096
ldmfd sp!, {r4, r5}
+ IT(t, cc)
#if defined(__USE_BX__)
bxcc lr
#else
@@ -62,7 +102,9 @@ mmap64:
mov r0, $-EINVAL
ldmfd sp!, {r4, r5}
b __syscall_error
-#else
+#endif
+#else /* !__ARM_EABI__ */
+mmap64:
stmfd sp!, {r4, r5, lr}
ldr r5, [sp, $16]
ldr r4, [sp, $12]
diff --git a/libc/sysdeps/linux/arm/posix_fadvise.c b/libc/sysdeps/linux/arm/posix_fadvise.c
new file mode 100644
index 000000000..bb4ac7b0c
--- /dev/null
+++ b/libc/sysdeps/linux/arm/posix_fadvise.c
@@ -0,0 +1,36 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * posix_fadvise() for ARM uClibc
+ * http://www.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+#include <sys/syscall.h>
+#include <fcntl.h>
+#if defined __NR_arm_fadvise64_64
+/* This is for the ARM version of fadvise64_64 which swaps the params
+ * * about to avoid having ABI compat issues
+ * */
+#define __NR___syscall_arm_fadvise64_64 __NR_arm_fadvise64_64
+int __libc_posix_fadvise(int fd, off_t offset, off_t len, int advise)
+{
+ INTERNAL_SYSCALL_DECL (err);
+ int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise,
+ __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
+ __LONG_LONG_PAIR ((long)(len >> 32), (long)len));
+
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+
+}
+weak_alias(__libc_posix_fadvise, posix_fadvise);
+#else
+int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused)
+{
+ return ENOSYS;
+}
+#endif
+
diff --git a/libc/sysdeps/linux/arm/posix_fadvise64.c b/libc/sysdeps/linux/arm/posix_fadvise64.c
new file mode 100644
index 000000000..479b0c5a2
--- /dev/null
+++ b/libc/sysdeps/linux/arm/posix_fadvise64.c
@@ -0,0 +1,46 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * posix_fadvise64() for ARM uClibc
+ * http://www.opengroup.org/onlinepubs/009695399/functions/posix_fadvise.html
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+#include <unistd.h>
+#include <errno.h>
+#include <endian.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <fcntl.h>
+
+#ifdef __UCLIBC_HAS_LFS__
+
+#if defined __NR_arm_fadvise64_64
+/* This is for the ARM version of fadvise64_64 which swaps the params
+ * about to avoid having ABI compat issues
+ */
+#define __NR___syscall_arm_fadvise64_64 __NR_arm_fadvise64_64
+int __libc_posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise)
+{
+ INTERNAL_SYSCALL_DECL (err);
+ int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise,
+ __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
+ __LONG_LONG_PAIR ((long)(len >> 32), (long)len));
+ if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return 0;
+ if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+}
+weak_alias(__libc_posix_fadvise64, posix_fadvise64);
+#else
+int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise)
+{
+ return ENOSYS;
+}
+#endif
+#endif
diff --git a/libc/sysdeps/linux/arm/setjmp.S b/libc/sysdeps/linux/arm/setjmp.S
index 8d15b8324..2df7d551a 100644
--- a/libc/sysdeps/linux/arm/setjmp.S
+++ b/libc/sysdeps/linux/arm/setjmp.S
@@ -18,15 +18,41 @@
02111-1307 USA. */
#include <features.h>
+#include <bits/arm_asm.h>
.global __sigsetjmp
.type __sigsetjmp,%function
.align 2
+#if defined(THUMB1_ONLY)
+.thumb_func
__sigsetjmp:
+ push {r3, r4, r5, r6, r7, lr}
mov ip, r0
+ stmia r0!, {r4, r5, r6, r7}
+ mov r2, r8
+ mov r3, r9
+ mov r4, sl
+ mov r5, fp
+ add r6, sp, #(6 * 4)
+ mov r7, lr
+ stmia r0!, {r2, r3, r4, r5, r6, r7}
+ mov r0, ip
+ bl __sigjmp_save
+ pop {r3, r4, r5, r6, r7, pc}
+
+#else
+__sigsetjmp:
+ /* Save registers */
+ mov ip, r0
+#if defined(__thumb2__)
+ stmia ip!, {v1-v6, sl, fp}
+ movs r2, sp
+ stmia ip!, {r2, lr}
+#else
/* Save registers */
stmia ip!, {v1-v6, sl, fp, sp, lr}
+#endif
#if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
# ifdef __VFP_FP__
/* Store the VFP registers. */
@@ -70,5 +96,6 @@ __sigsetjmp:
#else
B __sigjmp_save
#endif
+#endif
.size __sigsetjmp,.-__sigsetjmp
diff --git a/libc/sysdeps/linux/arm/sigaction.c b/libc/sysdeps/linux/arm/sigaction.c
index 8ab2be797..552ac17bf 100644
--- a/libc/sysdeps/linux/arm/sigaction.c
+++ b/libc/sysdeps/linux/arm/sigaction.c
@@ -43,7 +43,7 @@ extern __typeof(sigaction) __libc_sigaction;
#ifdef __NR_rt_sigaction
-libc_hidden_proto(memcpy)
+/* Experimentally off - libc_hidden_proto(memcpy) */
/* If ACT is not NULL, change the action for SIG to *ACT.
If OACT is not NULL, put the old action for SIG in *OACT. */
diff --git a/libc/sysdeps/linux/arm/sigrestorer.S b/libc/sysdeps/linux/arm/sigrestorer.S
index 5b996ea83..79728fd40 100644
--- a/libc/sysdeps/linux/arm/sigrestorer.S
+++ b/libc/sysdeps/linux/arm/sigrestorer.S
@@ -16,7 +16,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <bits/arm_asm.h>
#include <sys/syscall.h>
+#include <linux/version.h>
/* If no SA_RESTORER function was specified by the application we use
one of these. This avoids the need for the kernel to synthesise a return
@@ -29,15 +31,24 @@
Start the unwind tables at least one instruction before the signal
trampoline, because the unwinder will assume we are returning after
- a call site. */
+ a call site.
+
+ The signal frame layout changed in 2.6.18. */
.global __default_sa_restorer
.type __default_sa_restorer,%function
.align 2
#ifdef __ARM_EABI__
+#ifdef __thumb__
+.thumb_func
+#endif
.fnstart
.save {r0-r15}
+#if LINUX_VERSION_CODE >= 0x020612
+ .pad #32
+#else
.pad #12
+#endif
nop
__default_sa_restorer:
mov r7, $SYS_ify(sigreturn)
@@ -55,9 +66,16 @@ __default_sa_restorer:
.type __default_rt_sa_restorer,%function
.align 2
#ifdef __ARM_EABI__
+#ifdef __thumb__
+.thumb_func
+#endif
.fnstart
.save {r0-r15}
+#if LINUX_VERSION_CODE >= 0x020612
+ .pad #160
+#else
.pad #168
+#endif
nop
__default_rt_sa_restorer:
mov r7, $SYS_ify(rt_sigreturn)
diff --git a/libc/sysdeps/linux/arm/syscall-eabi.S b/libc/sysdeps/linux/arm/syscall-eabi.S
index efc30690c..b9318821b 100644
--- a/libc/sysdeps/linux/arm/syscall-eabi.S
+++ b/libc/sysdeps/linux/arm/syscall-eabi.S
@@ -17,6 +17,7 @@
02111-1307 USA. */
#include <sys/syscall.h>
+#include <bits/arm_asm.h>
/* In the EABI syscall interface, we don't need a special syscall to
implement syscall(). It won't work reliably with 64-bit arguments
@@ -26,6 +27,29 @@
.global syscall
.type syscall,%function
.align 4
+#if defined(THUMB1_ONLY)
+.thumb_func
+syscall:
+ push {r4, r5, r6, r7}
+ mov ip, r0
+ mov r0, r1
+ mov r1, r2
+ mov r2, r3
+ add r7, sp, #(4 * 4)
+ ldmia r7!, {r3, r4, r5, r6}
+ mov r7, ip
+ swi 0x0
+ pop {r4, r5, r6, r7}
+ ldr r1, =0xfffff000
+ cmp r0, r1
+ bcs 1f
+ bx lr
+1:
+ push {r3, lr}
+ bl __syscall_error
+ POP_RET
+.pool
+#else
syscall:
mov ip, sp
stmfd sp!, {r4, r5, r6, r7}
@@ -37,11 +61,13 @@ syscall:
swi 0x0
ldmfd sp!, {r4, r5, r6, r7}
cmn r0, #4096
+ IT(t, cc)
#if defined(__USE_BX__)
bxcc lr
#else
movcc pc, lr
#endif
b __syscall_error
+#endif
.size syscall,.-syscall
diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S
index e9f63d46e..42595b026 100644
--- a/libc/sysdeps/linux/arm/vfork.S
+++ b/libc/sysdeps/linux/arm/vfork.S
@@ -6,6 +6,7 @@
*/
#include <features.h>
+#include <bits/arm_asm.h>
#define _ERRNO_H
#include <bits/errno.h>
@@ -18,11 +19,47 @@
.type __vfork,%function
.align 4
+#if defined(__thumb__) && !defined(__thumb2__)
+.thumb_func
+__vfork:
+#ifdef __NR_vfork
+ DO_CALL (vfork)
+ ldr r1, =0xfffff000
+ cmp r0, r1
+ bcs 1f
+ bx lr
+1:
+
+ /* Check if vfork even exists. */
+ ldr r1, =-ENOSYS
+ cmp r0, r1
+ bne __error
+
+ /* If we don't have vfork, use fork. */
+ DO_CALL (fork)
+ ldr r1, =0xfffff000
+ cmp r0, r1
+
+ /* Syscall worked. Return to child/parent */
+ bcs 1f
+ bx lr
+1:
+
+__error:
+ push {r3, lr}
+ bl __syscall_error
+ POP_RET
+.pool
+
+#endif
+
+#else
__vfork:
#ifdef __NR_vfork
DO_CALL (vfork)
cmn r0, #4096
+ IT(t, cc)
#if defined(__USE_BX__)
bxcc lr
#else
@@ -40,6 +77,7 @@ __vfork:
cmn r0, #4096
/* Syscall worked. Return to child/parent */
+ IT(t, cc)
#if defined(__USE_BX__)
bxcc lr
#else
@@ -48,8 +86,10 @@ __vfork:
__error:
b __syscall_error
+#endif
.size __vfork,.-__vfork
+
weak_alias(__vfork,vfork)
libc_hidden_weak(vfork)
#endif
diff --git a/libc/sysdeps/linux/e1/bits/fcntl.h b/libc/sysdeps/linux/e1/bits/fcntl.h
index 4b41b4715..97aa632c9 100644
--- a/libc/sysdeps/linux/e1/bits/fcntl.h
+++ b/libc/sysdeps/linux/e1/bits/fcntl.h
@@ -93,6 +93,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
#endif
/* For F_[GET|SET]FL. */
@@ -178,3 +180,59 @@ struct flock64
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
+
+
+#ifdef __USE_GNU
+#if 0
+/* Flags for SYNC_FILE_RANGE. */
+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
+ in the range before performing the
+ write. */
+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
+ dirty pages in the range which are
+ not presently under writeback. */
+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
+ the range after performing the
+ write. */
+#endif
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+#endif
+
+__BEGIN_DECLS
+
+#ifdef __USE_GNU
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __THROW;
+
+
+#if 0
+/* Selective file content synch'ing. */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+ unsigned int __flags);
+#endif
+
+/* Splice address range into a pipe. */
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
+
+/* Splice two files together. */
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
+
+/* In-kernel implementation of tee for pipe buffers. */
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
+
+#endif
+__END_DECLS
+
diff --git a/libc/sysdeps/linux/e1/bits/fenvinline.h b/libc/sysdeps/linux/e1/bits/fenvinline.h
index 27ee172a5..cce266131 100644
--- a/libc/sysdeps/linux/e1/bits/fenvinline.h
+++ b/libc/sysdeps/linux/e1/bits/fenvinline.h
@@ -57,7 +57,7 @@
#define fegetround() \
({ \
unsigned int tmp; \
- asm volatile("mov %0, SR" \
+ __asm__ __volatile__("mov %0, SR" \
:"=l"(tmp) \
:/*no input*/); \
tmp &= (3<<13); \
@@ -70,7 +70,7 @@
unsigned int tmp = (3 << 13); \
while(1) { \
/* Clear SR.FRM field */ \
- asm volatile("andn SR, %0" \
+ __asm__ __volatile__("andn SR, %0" \
:/*no output*/ \
:"l"(tmp) ); \
tmp &= round; \
@@ -80,7 +80,7 @@
break; \
} \
\
- asm volatile("or SR, %0" \
+ __asm__ __volatile__("or SR, %0" \
:/*no input*/ \
:"l"(round) ); \
tmp = 0; \
@@ -100,7 +100,7 @@ static inline feclearexcept(int __excepts)
if( __excepts & (~0x1F00) )
return -1;
- asm volatile("mov %0, SR"
+ __asm__ __volatile__("mov %0, SR"
:"=l"(enabled_excepts)
:/*no input*/ );
@@ -112,7 +112,7 @@ static inline feclearexcept(int __excepts)
disabled_excepts &= __excepts;
/* Clear accrued exceptions */
- asm volatile("andn G2, %0\n\t"
+ __asm__ __volatile__("andn G2, %0\n\t"
"andn G2, %1\n\t"
:/*no output*/
:"l"(enabled_excepts),
@@ -133,7 +133,7 @@ inline int fetestexcept(int __excepts)
if( __excepts & (~0x1F00) )
return -1;
- asm volatile("mov %0, SR"
+ __asm__ __volatile__("mov %0, SR"
:"=l"(enabled_excepts)
:/*no input*/ );
@@ -141,7 +141,7 @@ inline int fetestexcept(int __excepts)
disabled_excepts = ~enabled_excepts;
disabled_excepts &= 0x1F00;
- asm volatile("mov %0, G2"
+ __asm__ __volatile__("mov %0, G2"
:"=l"(G2)
:/*no input*/ );
@@ -154,7 +154,7 @@ inline int fetestexcept(int __excepts)
static inline int feraiseexcept(int __excepts)
{
- asm volatile("or G2, %0"
+ __asm__ __volatile__("or G2, %0"
:/*no output*/
:"l"( __excepts >> 8 ) );
return 0;
@@ -169,7 +169,7 @@ static inline int feraiseexcept(int __excepts)
int __tmpexcepts = __excepts; \
\
while(1) { \
- asm volatile("mov %0, SR" \
+ __asm__ __volatile__("mov %0, SR" \
:"=l"(__pexcepts) \
:/*no input*/ ); \
__pexcepts &= 0x1F00; \
@@ -181,7 +181,7 @@ static inline int feraiseexcept(int __excepts)
break; \
} \
\
- asm volatile("or SR, %0" \
+ __asm__ __volatile__("or SR, %0" \
:/*no output*/ \
:"l"(__tmpexcepts) ); \
__retval = __pexcepts; \
@@ -197,7 +197,7 @@ static inline int feraiseexcept(int __excepts)
int __tmpexcepts = __excepts; \
\
while(1) { \
- asm volatile("mov %0, SR" \
+ __asm__ __volatile__("mov %0, SR" \
:"=l"(__pexcepts) \
:/*no input*/ ); \
__pexcepts &= 0x1F00; \
@@ -209,7 +209,7 @@ static inline int feraiseexcept(int __excepts)
break; \
} \
\
- asm volatile("andn SR, %0" \
+ __asm__ __volatile__("andn SR, %0" \
:/*no output*/ \
:"l"(__tmpexcepts) ); \
__retval = __pexcepts; \
@@ -221,7 +221,7 @@ static inline int feraiseexcept(int __excepts)
static inline int fegetexcept(int excepts)
{
unsigned int tmp;
- asm volatile("mov %0, SR"
+ __asm__ __volatile__("mov %0, SR"
:"=l"(tmp)
:/*no input*/ );
tmp &= 0x1F00;
@@ -230,7 +230,7 @@ static inline int fegetexcept(int excepts)
static inline int fegetenv(fenv_t *envp)
{
- asm volatile("mov %0, SR\n\t
+ __asm__ __volatile__("mov %0, SR\n\t
mov %1, SR\n\t
mov %2, G2\n\t
mov %3, G2\n\t"
@@ -258,14 +258,14 @@ static inline int fegetenv(fenv_t *envp)
({ \
/* Clear FRM & FTE field of SR */ \
unsigned long clearSR = ( 127<<8 ); \
- asm volatile("andn SR, %0\n\t" \
+ __asm__ __volatile__("andn SR, %0\n\t" \
"or SR, %1\n\t" \
"or SR, %2\n\t" \
:/*no output*/ \
:"l"(clearSR), \
"l"(envp->round_mode), \
"l"(envp->trap_enabled) ); \
- asm volatile("andn G2, 0x1F1F\n\t" \
+ __asm__ __volatile__("andn G2, 0x1F1F\n\t" \
"or G2, %0\n\t" \
"or G2, %1\n\t" \
:/*no output*/ \
@@ -277,14 +277,14 @@ static inline int fegetenv(fenv_t *envp)
#define feupdateenv(envp) \
({ \
/* Clear FRM & FTE field of SR */ \
- asm volatile(/* We dont clear the prev SR*/ \
+ __asm__ __volatile__(/* We dont clear the prev SR*/ \
"or SR, %1\n\t" \
"or SR, %2\n\t" \
:/*no output*/ \
:"l"(clearSR), \
"l"(envp->round_mode), \
"l"(envp->accrued_except) ); \
- asm volatile(/* We dont clear the prev SR*/ \
+ __asm__ __volatile__(/* We dont clear the prev SR*/ \
"or G2, %0\n\t" \
"or G2, %1\n\t" \
:/*no output*/ \
diff --git a/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h b/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h
index ff0e20fad..f4adaf5ad 100644
--- a/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/e1/bits/uClibc_arch_features.h
@@ -18,9 +18,6 @@
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/e1/longjmp.c b/libc/sysdeps/linux/e1/longjmp.c
index e628bd7e0..fbd5103a4 100644
--- a/libc/sysdeps/linux/e1/longjmp.c
+++ b/libc/sysdeps/linux/e1/longjmp.c
@@ -27,7 +27,7 @@ void longjmp(jmp_buf state, int value )
e1newSP(state->__jmpbuf->SavedSP);
#define _state_ ((struct __jmp_buf_tag*)jmpbuf_ptr)
- asm volatile("mov L0, %0\n\t"
+ __asm__ __volatile__("mov L0, %0\n\t"
"mov L1, %1\n\t"
"mov L2, %2\n\t"
"mov G3, %3\n\t"
@@ -60,7 +60,7 @@ void siglongjmp(sigjmp_buf state, int value )
#define _state_ ((struct __jmp_buf_tag*)jmpbuf_ptr)
- asm volatile("mov L0, %0\n\t"
+ __asm__ __volatile__("mov L0, %0\n\t"
"mov L1, %1\n\t"
"mov L2, %2\n\t"
"mov G3, %3\n\t"
diff --git a/libc/sysdeps/linux/e1/setjmp.c b/libc/sysdeps/linux/e1/setjmp.c
index 750c4e08e..3a3f3b7e8 100644
--- a/libc/sysdeps/linux/e1/setjmp.c
+++ b/libc/sysdeps/linux/e1/setjmp.c
@@ -11,14 +11,14 @@ libc_hidden_proto(sigprocmask)
int setjmp( jmp_buf state)
{
- asm volatile( "mov %0, G3\n\t"
+ __asm__ __volatile__( "mov %0, G3\n\t"
"mov %1, G4\n\t"
:"=l"(state->__jmpbuf->G3),
"=l"(state->__jmpbuf->G4)
:/*no input*/
:"%G3", "%G4" );
- asm volatile( "setadr %0\n\t"
+ __asm__ __volatile__( "setadr %0\n\t"
"mov %1, L1\n\t"
"mov %2, L2\n\t"
:"=l"(state->__jmpbuf->SavedSP),
@@ -38,14 +38,14 @@ int sigsetjmp( sigjmp_buf state , int savesigs)
} else
state->__mask_was_saved = 0;
- asm volatile( "mov %0, G3\n\t"
+ __asm__ __volatile__( "mov %0, G3\n\t"
"mov %1, G4\n\t"
:"=l"(state->__jmpbuf->G3),
"=l"(state->__jmpbuf->G4)
:/*no input*/
:"%G3", "%G4" );
- asm volatile( "setadr %0\n\t"
+ __asm__ __volatile__( "setadr %0\n\t"
"mov %1, L2\n\t"
"mov %2, L3\n\t"
:"=l"(state->__jmpbuf->SavedSP),
diff --git a/libc/sysdeps/linux/i960/README b/libc/sysdeps/linux/i960/README
index 185fe2572..751673508 100644
--- a/libc/sysdeps/linux/i960/README
+++ b/libc/sysdeps/linux/i960/README
@@ -16,8 +16,9 @@ prepended underscore
--------------------
As the i960 compiler prepends an underscore to symbols, it is critical that
-bits/uClibc_arch_features.h undefines __UCLIBC_NO_UNDERSCORES__
-to make sure that underscores are applied to symbol names when needed.
+Rules.mak defines SYMBOL_PREFIX as _, such that -D__UCLIBC_UNDERSCORES__
+is added to CFLAGS to make sure that underscores are applied to symbol
+names when needed.
__va_copy in va-i960.h
diff --git a/libc/sysdeps/linux/i960/bits/fcntl.h b/libc/sysdeps/linux/i960/bits/fcntl.h
index 7cce16904..15bfc266f 100644
--- a/libc/sysdeps/linux/i960/bits/fcntl.h
+++ b/libc/sysdeps/linux/i960/bits/fcntl.h
@@ -93,6 +93,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
#endif
/* For F_[GET|SET]FL. */
@@ -178,3 +180,59 @@ struct flock64
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
+
+
+#ifdef __USE_GNU
+#if 0
+/* Flags for SYNC_FILE_RANGE. */
+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
+ in the range before performing the
+ write. */
+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
+ dirty pages in the range which are
+ not presently under writeback. */
+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
+ the range after performing the
+ write. */
+#endif
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+#endif
+
+__BEGIN_DECLS
+
+#ifdef __USE_GNU
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __THROW;
+
+
+#if 0
+/* Selective file content synch'ing. */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+ unsigned int __flags);
+#endif
+
+/* Splice address range into a pipe. */
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
+
+/* Splice two files together. */
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
+
+/* In-kernel implementation of tee for pipe buffers. */
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
+
+#endif
+__END_DECLS
+
diff --git a/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h b/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h
index eef651eeb..cd6bcd9d0 100644
--- a/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/i960/bits/uClibc_arch_features.h
@@ -18,9 +18,6 @@
/* does your target have a broken create_module() ? */
#define __UCLIBC_BROKEN_CREATE_MODULE__
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/m68k/__syscall_error.c b/libc/sysdeps/linux/m68k/__syscall_error.c
index 5cfdead8b..a29f6ffd6 100644
--- a/libc/sysdeps/linux/m68k/__syscall_error.c
+++ b/libc/sysdeps/linux/m68k/__syscall_error.c
@@ -13,7 +13,7 @@
int __syscall_error(void) attribute_hidden;
int __syscall_error(void)
{
- register int err_no asm("%d0");
+ register int err_no __asm__("%d0");
__set_errno(-err_no);
return -1;
}
diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h
index 85cc59188..7c947856a 100644
--- a/libc/sysdeps/linux/m68k/bits/fcntl.h
+++ b/libc/sysdeps/linux/m68k/bits/fcntl.h
@@ -96,6 +96,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
#endif
/* For F_[GET|SET]FL. */
@@ -182,7 +184,10 @@ struct flock64
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
+
#ifdef __USE_GNU
+#if 0
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -194,6 +199,15 @@ struct flock64
write. */
#endif
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+#endif
+
__BEGIN_DECLS
#ifdef __USE_GNU
@@ -207,21 +221,21 @@ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
/* Selective file content synch'ing. */
extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
unsigned int __flags);
-
+#endif
/* Splice address range into a pipe. */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
- unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
/* Splice two files together. */
-extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
/* In-kernel implementation of tee for pipe buffers. */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
-#endif
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
#endif
-
__END_DECLS
+
diff --git a/libc/sysdeps/linux/m68k/bits/mathinline.h b/libc/sysdeps/linux/m68k/bits/mathinline.h
index acbac47aa..8cc21694b 100644
--- a/libc/sysdeps/linux/m68k/bits/mathinline.h
+++ b/libc/sysdeps/linux/m68k/bits/mathinline.h
@@ -121,7 +121,7 @@
__m81_defun (float_type, func, (float_type __mathop_x)) \
{ \
float_type __result; \
- __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
+ __asm__("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
return __result; \
}
@@ -222,7 +222,7 @@ __m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \
/* There is no branch-condition for infinity, \
so we must extract and examine the condition codes manually. */ \
unsigned long int __fpsr; \
- __asm("ftst%.x %1\n" \
+ __asm__("ftst%.x %1\n" \
"fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \
return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \
} \
@@ -232,7 +232,7 @@ __m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \
/* There is no branch-condition for infinity, so we must extract and \
examine the condition codes manually. */ \
unsigned long int __fpsr; \
- __asm ("ftst%.x %1\n" \
+ __asm__ ("ftst%.x %1\n" \
"fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \
return (__fpsr & (3 << 24)) == 0; \
} \
@@ -241,7 +241,7 @@ __m81_defun (float_type, __CONCAT(__scalbn,s), \
(float_type __x, int __n)) \
{ \
float_type __result; \
- __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x)); \
+ __asm__ ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x)); \
return __result; \
}
@@ -258,7 +258,7 @@ __inline_functions(long double,l)
__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \
{ \
char __result; \
- __asm("ftst%.x %1\n" \
+ __asm__("ftst%.x %1\n" \
"fsun %0" : "=dm" (__result) : "f" (__value)); \
return __result; \
}
@@ -280,7 +280,7 @@ __m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \
/* There is no branch-condition for the sign bit, so we must extract \
and examine the condition codes manually. */ \
unsigned long int __fpsr; \
- __asm ("ftst%.x %1\n" \
+ __asm__ ("ftst%.x %1\n" \
"fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \
return (__fpsr >> 27) & 1; \
} \
@@ -308,7 +308,7 @@ __m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) \
__m81_defun (long int, __CONCAT(__lrint,s), (float_type __x)) \
{ \
long int __result; \
- __asm ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x)); \
+ __asm__ ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x)); \
return __result; \
} \
\
@@ -333,7 +333,7 @@ __m81_inline void \
__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \
float_type *__cosx) \
{ \
- __asm ("fsincos%.x %2,%1:%0" \
+ __asm__ ("fsincos%.x %2,%1:%0" \
: "=f" (*__sinx), "=f" (*__cosx) : "f" (__x)); \
}
diff --git a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
index a94803749..b5ef48f4b 100644
--- a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
@@ -24,9 +24,6 @@
/* does your target have to worry about older [gs]etrlimit() ? */
#define __UCLIBC_HANDLE_OLDER_RLIMIT__
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/m68k/brk.c b/libc/sysdeps/linux/m68k/brk.c
index cad5976de..7daf1bd76 100644
--- a/libc/sysdeps/linux/m68k/brk.c
+++ b/libc/sysdeps/linux/m68k/brk.c
@@ -18,7 +18,7 @@ int brk (void *addr)
{
void *newbrk;
- __asm__ volatile ("movel %2,%/d1\n\t"
+ __asm__ __volatile__ ("movel %2,%/d1\n\t"
"moveq %1,%/d0\n\t"
"trap #0\n\t"
"movel %/d0,%0"
diff --git a/libc/sysdeps/linux/m68k/fpu_control.h b/libc/sysdeps/linux/m68k/fpu_control.h
index 484bad3b9..040e62c94 100644
--- a/libc/sysdeps/linux/m68k/fpu_control.h
+++ b/libc/sysdeps/linux/m68k/fpu_control.h
@@ -93,7 +93,7 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
/* Macros for accessing the hardware control word. */
#define _FPU_GETCW(cw) __asm__ ("fmove%.l %!, %0" : "=dm" (cw))
-#define _FPU_SETCW(cw) __asm__ volatile ("fmove%.l %0, %!" : : "dm" (cw))
+#define _FPU_SETCW(cw) __asm__ __volatile__ ("fmove%.l %0, %!" : : "dm" (cw))
#if 0
/* Default control word set at startup. */
diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h
index 4b41b4715..97aa632c9 100644
--- a/libc/sysdeps/linux/microblaze/bits/fcntl.h
+++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h
@@ -93,6 +93,8 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
#endif
/* For F_[GET|SET]FL. */
@@ -178,3 +180,59 @@ struct flock64
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
+
+
+#ifdef __USE_GNU
+#if 0
+/* Flags for SYNC_FILE_RANGE. */
+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
+ in the range before performing the
+ write. */
+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
+ dirty pages in the range which are
+ not presently under writeback. */
+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
+ the range after performing the
+ write. */
+#endif
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+#endif
+
+__BEGIN_DECLS
+
+#ifdef __USE_GNU
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __THROW;
+
+
+#if 0
+/* Selective file content synch'ing. */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+ unsigned int __flags);
+#endif
+
+/* Splice address range into a pipe. */
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
+
+/* Splice two files together. */
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
+
+/* In-kernel implementation of tee for pipe buffers. */
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
+
+#endif
+__END_DECLS
+
diff --git a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h
index 1b40e32a2..f4adaf5ad 100644
--- a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h
@@ -18,9 +18,6 @@
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/microblaze/clone.c b/libc/sysdeps/linux/microblaze/clone.c
index f82cd9dc0..887e2c8ac 100644
--- a/libc/sysdeps/linux/microblaze/clone.c
+++ b/libc/sysdeps/linux/microblaze/clone.c
@@ -19,19 +19,19 @@
int
clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg)
{
- register unsigned long rval asm (SYSCALL_RET) = -EINVAL;
+ register unsigned long rval __asm__ (SYSCALL_RET) = -EINVAL;
if (fn && child_stack)
{
- register unsigned long syscall asm (SYSCALL_NUM);
- register unsigned long arg0 asm (SYSCALL_ARG0);
- register unsigned long arg1 asm (SYSCALL_ARG1);
+ register unsigned long syscall __asm__ (SYSCALL_NUM);
+ register unsigned long arg0 __asm__ (SYSCALL_ARG0);
+ register unsigned long arg1 __asm__ (SYSCALL_ARG1);
/* Clone this thread. */
arg0 = flags;
arg1 = (unsigned long)child_stack;
syscall = __NR_clone;
- asm volatile ("bralid r17, trap;nop;"
+ __asm__ __volatile__ ("bralid r17, trap;nop;"
: "=r" (rval), "=r" (syscall)
: "1" (syscall), "r" (arg0), "r" (arg1)
: SYSCALL_CLOBBERS);
@@ -41,7 +41,7 @@ clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg)
{
arg0 = (*fn) (arg);
syscall = __NR_exit;
- asm volatile ("bralid r17, trap;nop;"
+ __asm__ __volatile__ ("bralid r17, trap;nop;"
: "=r" (rval), "=r" (syscall)
: "1" (syscall), "r" (arg0)
: SYSCALL_CLOBBERS);
diff --git a/libc/sysdeps/linux/microblaze/syscall.c b/libc/sysdeps/linux/microblaze/syscall.c
index be628a878..a7fd3ae7b 100644
--- a/libc/sysdeps/linux/microblaze/syscall.c
+++ b/libc/sysdeps/linux/microblaze/syscall.c
@@ -26,18 +26,18 @@ syscall (long num, arg_t a1, arg_t a2, arg_t a3, arg_t a4, arg_t a5, arg_t a6)
off the stack even for (the majority of) system calls with fewer
arguments; hopefully this won't cause any problems. A1-A4 are in
registers, so they're OK. */
- register arg_t a asm (SYSCALL_ARG0) = a1;
- register arg_t b asm (SYSCALL_ARG1) = a2;
- register arg_t c asm (SYSCALL_ARG2) = a3;
- register arg_t d asm (SYSCALL_ARG3) = a4;
- register arg_t e asm (SYSCALL_ARG4) = a5;
- register arg_t f asm (SYSCALL_ARG5) = a6;
- register unsigned long syscall asm (SYSCALL_NUM) = num;
- register unsigned long ret asm (SYSCALL_RET);
+ register arg_t a __asm__ (SYSCALL_ARG0) = a1;
+ register arg_t b __asm__ (SYSCALL_ARG1) = a2;
+ register arg_t c __asm__ (SYSCALL_ARG2) = a3;
+ register arg_t d __asm__ (SYSCALL_ARG3) = a4;
+ register arg_t e __asm__ (SYSCALL_ARG4) = a5;
+ register arg_t f __asm__ (SYSCALL_ARG5) = a6;
+ register unsigned long syscall __asm__ (SYSCALL_NUM) = num;
+ register unsigned long ret __asm__ (SYSCALL_RET);
unsigned long ret_sav;
*((unsigned long *)0xFFFF4004) = (unsigned int)('+');
- asm ("brlid r17, 08x; nop;"
+ __asm__ ("brlid r17, 08x; nop;"
: "=r" (ret)
: "r" (syscall), "r" (a), "r" (b), "r" (c), "r" (d), "r" (e), "r" (f)
: SYSCALL_CLOBBERS);
diff --git a/libc/sysdeps/linux/powerpc/Makefile.arch b/libc/sysdeps/linux/powerpc/Makefile.arch
index eaa1cb7f8..85c2cd3c6 100644
--- a/libc/sysdeps/linux/powerpc/Makefile.arch
+++ b/libc/sysdeps/linux/powerpc/Makefile.arch
@@ -5,10 +5,14 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := mmap.c __syscall_error.c pread_write.c ioctl.c
+CSRC := __syscall_error.c pread_write.c ioctl.c
SSRC := \
__longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \
clone.S __uClibc_syscall.S syscall.S vfork.S
+ifeq ($(CONFIG_E500),y)
+ARCH_HEADERS := fenv.h
+endif
+
include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/powerpc/__longjmp.S b/libc/sysdeps/linux/powerpc/__longjmp.S
index 83f094c15..765a87315 100644
--- a/libc/sysdeps/linux/powerpc/__longjmp.S
+++ b/libc/sysdeps/linux/powerpc/__longjmp.S
@@ -1,5 +1,7 @@
-/* longjmp for PowerPC.
- Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* longjmp for PowerPC and PowerPC e500.
+ Copyright (C) 1995, 1996, 1997, 1999, 2000, 2004
+ Free Software Foundation, Inc.
+ e500 contributed by Aldy Hernandez <aldyh@redhat.com>.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -30,6 +32,14 @@
#define FP(x...)
#endif
+#if defined __CONFIG_E500__
+#define LFD(reg) evldd r##reg
+#define STFD(reg) evstdd r##reg
+#else
+#define LFD(reg) lfd fp##reg
+#define STFD(reg) stfd fp##reg
+#endif /* __CONFIG_E500__ */
+
.globl __longjmp;
.type __longjmp, @function;
.align 2;
@@ -39,44 +49,44 @@ __longjmp:
lwz r2,(JB_GPR2*4)(r3)
lwz r0,(JB_LR*4)(r3)
lwz r14,((JB_GPRS+0)*4)(r3)
-FP( lfd fp14,((JB_FPRS+0*2)*4)(r3))
- lwz r15,((JB_GPRS+1)*4)(r3)
-FP( lfd fp15,((JB_FPRS+1*2)*4)(r3))
- lwz r16,((JB_GPRS+2)*4)(r3)
-FP( lfd fp16,((JB_FPRS+2*2)*4)(r3))
- lwz r17,((JB_GPRS+3)*4)(r3)
-FP( lfd fp17,((JB_FPRS+3*2)*4)(r3))
- lwz r18,((JB_GPRS+4)*4)(r3)
-FP( lfd fp18,((JB_FPRS+4*2)*4)(r3))
- lwz r19,((JB_GPRS+5)*4)(r3)
-FP( lfd fp19,((JB_FPRS+5*2)*4)(r3))
- lwz r20,((JB_GPRS+6)*4)(r3)
-FP( lfd fp20,((JB_FPRS+6*2)*4)(r3))
- mtlr r0
- lwz r21,((JB_GPRS+7)*4)(r3)
-FP( lfd fp21,((JB_FPRS+7*2)*4)(r3))
- lwz r22,((JB_GPRS+8)*4)(r3)
-FP( lfd fp22,((JB_FPRS+8*2)*4)(r3))
- lwz r0,(JB_CR*4)(r3)
- lwz r23,((JB_GPRS+9)*4)(r3)
-FP( lfd fp23,((JB_FPRS+9*2)*4)(r3))
- lwz r24,((JB_GPRS+10)*4)(r3)
-FP( lfd fp24,((JB_FPRS+10*2)*4)(r3))
- lwz r25,((JB_GPRS+11)*4)(r3)
-FP( lfd fp25,((JB_FPRS+11*2)*4)(r3))
- mtcrf 0xFF,r0
- lwz r26,((JB_GPRS+12)*4)(r3)
-FP( lfd fp26,((JB_FPRS+12*2)*4)(r3))
- lwz r27,((JB_GPRS+13)*4)(r3)
-FP( lfd fp27,((JB_FPRS+13*2)*4)(r3))
- lwz r28,((JB_GPRS+14)*4)(r3)
-FP( lfd fp28,((JB_FPRS+14*2)*4)(r3))
- lwz r29,((JB_GPRS+15)*4)(r3)
-FP( lfd fp29,((JB_FPRS+15*2)*4)(r3))
- lwz r30,((JB_GPRS+16)*4)(r3)
-FP( lfd fp30,((JB_FPRS+16*2)*4)(r3))
- lwz r31,((JB_GPRS+17)*4)(r3)
-FP( lfd fp31,((JB_FPRS+17*2)*4)(r3))
+FP( LFD (14),((JB_FPRS+0*2)*4)(r3))
+ lwz r15,((JB_GPRS+1)*4)(r3)
+FP( LFD (15),((JB_FPRS+1*2)*4)(r3))
+ lwz r16,((JB_GPRS+2)*4)(r3)
+FP( LFD (16),((JB_FPRS+2*2)*4)(r3))
+ lwz r17,((JB_GPRS+3)*4)(r3)
+FP( LFD (17),((JB_FPRS+3*2)*4)(r3))
+ lwz r18,((JB_GPRS+4)*4)(r3)
+FP( LFD (18),((JB_FPRS+4*2)*4)(r3))
+ lwz r19,((JB_GPRS+5)*4)(r3)
+FP( LFD (19),((JB_FPRS+5*2)*4)(r3))
+ lwz r20,((JB_GPRS+6)*4)(r3)
+FP( LFD (20),((JB_FPRS+6*2)*4)(r3))
+ mtlr r0
+ lwz r21,((JB_GPRS+7)*4)(r3)
+FP( LFD (21),((JB_FPRS+7*2)*4)(r3))
+ lwz r22,((JB_GPRS+8)*4)(r3)
+FP( LFD (22),((JB_FPRS+8*2)*4)(r3))
+ lwz r0,(JB_CR*4)(r3)
+ lwz r23,((JB_GPRS+9)*4)(r3)
+FP( LFD (23),((JB_FPRS+9*2)*4)(r3))
+ lwz r24,((JB_GPRS+10)*4)(r3)
+FP( LFD (24),((JB_FPRS+10*2)*4)(r3))
+ lwz r25,((JB_GPRS+11)*4)(r3)
+FP( LFD (25),((JB_FPRS+11*2)*4)(r3))
+ mtcrf 0xFF,r0
+ lwz r26,((JB_GPRS+12)*4)(r3)
+FP( LFD (26),((JB_FPRS+12*2)*4)(r3))
+ lwz r27,((JB_GPRS+13)*4)(r3)
+FP( LFD (27),((JB_FPRS+13*2)*4)(r3))
+ lwz r28,((JB_GPRS+14)*4)(r3)
+FP( LFD (28),((JB_FPRS+14*2)*4)(r3))
+ lwz r29,((JB_GPRS+15)*4)(r3)
+FP( LFD (29),((JB_FPRS+15*2)*4)(r3))
+ lwz r30,((JB_GPRS+16)*4)(r3)
+FP( LFD (30),((JB_FPRS+16*2)*4)(r3))
+ lwz r31,((JB_GPRS+17)*4)(r3)
+FP( LFD (31),((JB_FPRS+17*2)*4)(r3))
mr r3,r4
blr
.size __longjmp,.-__longjmp
diff --git a/libc/sysdeps/linux/powerpc/bits/atomic.h b/libc/sysdeps/linux/powerpc/bits/atomic.h
index 447195538..977bda72f 100644
--- a/libc/sysdeps/linux/powerpc/bits/atomic.h
+++ b/libc/sysdeps/linux/powerpc/bits/atomic.h
@@ -235,7 +235,7 @@
/*
* All powerpc64 processors support the new "light weight" sync (lwsync).
*/
-# define atomic_read_barrier() __asm ("lwsync" ::: "memory")
+# define atomic_read_barrier() __asm__ ("lwsync" ::: "memory")
/*
* "light weight" sync can also be used for the release barrier.
*/
@@ -340,7 +340,7 @@
* sync (lwsync). So the only safe option is to use normal sync
* for all powerpc32 applications.
*/
-# define atomic_read_barrier() __asm ("sync" ::: "memory")
+# define atomic_read_barrier() __asm__ ("sync" ::: "memory")
#endif
@@ -387,8 +387,8 @@ typedef uintmax_t uatomic_max_t;
# endif
#endif
-#define atomic_full_barrier() __asm ("sync" ::: "memory")
-#define atomic_write_barrier() __asm ("eieio" ::: "memory")
+#define atomic_full_barrier() __asm__ ("sync" ::: "memory")
+#define atomic_write_barrier() __asm__ ("eieio" ::: "memory")
#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
({ \
diff --git a/libc/sysdeps/linux/powerpc/bits/fcntl.h b/libc/sysdeps/linux/powerpc/bits/fcntl.h
index 3dec6923c..a96abc974 100644
--- a/libc/sysdeps/linux/powerpc/bits/fcntl.h
+++ b/libc/sysdeps/linux/powerpc/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/PowerPC.
- Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006
+ Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -50,6 +50,9 @@
# define O_DIRECTORY 040000 /* Must be a directory. */
# define O_NOFOLLOW 0100000 /* Do not follow links. */
# define O_NOATIME 01000000 /* Do not set atime. */
+# if 0
+# define O_CLOEXEC 02000000 /* Set close_on_exec. */
+# endif
#endif
#ifdef __USE_LARGEFILE64
@@ -97,9 +100,11 @@
# define F_SETLEASE 1024 /* Set a lease. */
# define F_GETLEASE 1025 /* Enquire what lease is active. */
# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
#endif
-/* For F_[GET|SET]FL. */
+/* For F_[GET|SET]FD. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
@@ -185,6 +190,8 @@ struct flock64
#ifdef __USE_GNU
+#if 0
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -196,6 +203,15 @@ struct flock64
write. */
#endif
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+#endif
+
__BEGIN_DECLS
#ifdef __USE_GNU
@@ -209,21 +225,21 @@ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
/* Selective file content synch'ing. */
extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
unsigned int __flags);
-
+#endif
/* Splice address range into a pipe. */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
- unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
/* Splice two files together. */
-extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
/* In-kernel implementation of tee for pipe buffers. */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
-#endif
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
#endif
-
__END_DECLS
+
diff --git a/libc/sysdeps/linux/powerpc/bits/fenv.h b/libc/sysdeps/linux/powerpc/bits/fenv.h
index 8509b4b0c..b674965fa 100644
--- a/libc/sysdeps/linux/powerpc/bits/fenv.h
+++ b/libc/sysdeps/linux/powerpc/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2004, 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
@@ -20,6 +20,27 @@
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
#endif
+#include <features.h>
+
+#ifdef __CONFIG_E500__
+
+/* Define bits representing the exception. We use the bit positions of
+ the appropriate bits in the SPEFSCR... */
+enum
+ {
+ FE_INEXACT = 1 << (63 - 42),
+#define FE_INEXACT FE_INEXACT
+ FE_INVALID = 1 << (63 - 43),
+#define FE_INVALID FE_INVALID
+ FE_DIVBYZERO = 1 << (63 - 44),
+#define FE_DIVBYZERO FE_DIVBYZERO
+ FE_UNDERFLOW = 1 << (63 - 45),
+#define FE_UNDERFLOW FE_UNDERFLOW
+ FE_OVERFLOW = 1 << (63 - 46)
+#define FE_OVERFLOW FE_OVERFLOW
+ };
+
+#else /* PowerPC 6xx floating-point. */
/* Define bits representing the exception. We use the bit positions of
the appropriate bits in the FPSCR... */
@@ -93,9 +114,11 @@ enum
(FE_INVALID_SNAN | FE_INVALID_ISI | FE_INVALID_IDI | FE_INVALID_ZDZ \
| FE_INVALID_IMZ | FE_INVALID_COMPARE | FE_INVALID_SOFTWARE \
| FE_INVALID_SQRT | FE_INVALID_INTEGER_CONVERSION)
-#endif
+#endif /* __USE_GNU */
};
+#endif /* __CONFIG_E500__ */
+
#define FE_ALL_EXCEPT \
(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
@@ -142,4 +165,4 @@ extern const fenv_t __fe_nonieee_env;
performance penalty (but have no other visible effect). */
extern const fenv_t *__fe_nomask_env (void);
# define FE_NOMASK_ENV (__fe_nomask_env ())
-#endif
+#endif /* __USE_GNU */
diff --git a/libc/sysdeps/linux/powerpc/bits/fenvinline.h b/libc/sysdeps/linux/powerpc/bits/fenvinline.h
index f7700a49e..8146479d8 100644
--- a/libc/sysdeps/linux/powerpc/bits/fenvinline.h
+++ b/libc/sysdeps/linux/powerpc/bits/fenvinline.h
@@ -18,6 +18,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <features.h>
+
#if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_MATH_INLINES
/* Inline definition for fegetround. */
@@ -59,3 +61,4 @@
: (feclearexcept) (__excepts))
#endif /* __GNUC__ && !_SOFT_FLOAT */
+
diff --git a/libc/sysdeps/linux/powerpc/bits/mathdef.h b/libc/sysdeps/linux/powerpc/bits/mathdef.h
index a076fb6d7..f28bacece 100644
--- a/libc/sysdeps/linux/powerpc/bits/mathdef.h
+++ b/libc/sysdeps/linux/powerpc/bits/mathdef.h
@@ -17,6 +17,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <features.h>
+
#if !defined _MATH_H && !defined _COMPLEX_H
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
#endif
@@ -71,5 +73,5 @@ typedef double double_t;
# define __NO_LONG_DOUBLE_MATH 1
# elif !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
# define __NO_LONG_DOUBLE_MATH 1
-# endif
-#endif
+# endif /* __WORDSIZE == 32 */
+#endif /* __NO_LONG_DOUBLE_MATH */
diff --git a/libc/sysdeps/linux/powerpc/bits/mathinline.h b/libc/sysdeps/linux/powerpc/bits/mathinline.h
index 87985a744..e2536a3cc 100644
--- a/libc/sysdeps/linux/powerpc/bits/mathinline.h
+++ b/libc/sysdeps/linux/powerpc/bits/mathinline.h
@@ -18,6 +18,8 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <features.h>
+
#ifndef _MATH_H
# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
#endif
@@ -180,3 +182,4 @@ __NTH (__ieee754_sqrtf (float __x))
}
#endif /* __LIBC_INTERNAL_MATH_INLINES */
#endif /* __GNUC__ && !_SOFT_FLOAT */
+
diff --git a/libc/sysdeps/linux/powerpc/bits/syscalls.h b/libc/sysdeps/linux/powerpc/bits/syscalls.h
index e469f1723..d233cc7d6 100644
--- a/libc/sysdeps/linux/powerpc/bits/syscalls.h
+++ b/libc/sysdeps/linux/powerpc/bits/syscalls.h
@@ -1,26 +1,142 @@
+/* Copyright (C) 1992,1997-2003,2004,2005,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. */
+
#ifndef _BITS_SYSCALLS_H
#define _BITS_SYSCALLS_H
#ifndef _SYSCALL_H
# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
#endif
+/* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
+ of the kernel. But these symbols do not follow the SYS_* syntax
+ so we have to redefine the `SYS_ify' macro here. */
+#undef SYS_ify
+#define SYS_ify(syscall_name) __NR_##syscall_name
#ifndef __ASSEMBLER__
-/* Define a macro which expands inline into the wrapper code for a system
+# include <errno.h>
+
+# ifdef SHARED
+# define INLINE_VSYSCALL(name, nr, args...) \
+ ({ \
+ __label__ out; \
+ __label__ iserr; \
+ INTERNAL_SYSCALL_DECL (sc_err); \
+ long int sc_ret; \
+ \
+ if (__vdso_##name != NULL) \
+ { \
+ sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \
+ if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ goto out; \
+ if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
+ goto iserr; \
+ } \
+ \
+ sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
+ if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ { \
+ iserr: \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
+ sc_ret = -1L; \
+ } \
+ out: \
+ sc_ret; \
+ })
+# else
+# define INLINE_VSYSCALL(name, nr, args...) \
+ INLINE_SYSCALL (name, nr, ##args)
+# endif
+
+# ifdef SHARED
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ ({ \
+ __label__ out; \
+ long int v_ret; \
+ \
+ if (__vdso_##name != NULL) \
+ { \
+ v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
+ || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
+ goto out; \
+ } \
+ v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
+ out: \
+ v_ret; \
+ })
+# else
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ INTERNAL_SYSCALL (name, err, nr, ##args)
+# endif
+
+# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \
+ ({ \
+ long int sc_ret = ENOSYS; \
+ \
+ if (__vdso_##name != NULL) \
+ sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ else \
+ err = 1 << 28; \
+ sc_ret; \
+ })
+
+/* List of system calls which are supported as vsyscalls. */
+# define HAVE_CLOCK_GETRES_VSYSCALL 1
+# define HAVE_CLOCK_GETTIME_VSYSCALL 1
+
+/* Define a macro which expands inline into the wrapper code for a VDSO
call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno.
On powerpc a system call basically clobbers the same registers like a
function call, with the exception of LR (which is needed for the
"sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
an error return status). */
-
-#include <errno.h>
-
-#define SYS_ify(syscall_name) (__NR_##syscall_name)
+# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+ ({ \
+ register void *r0 __asm__ ("r0"); \
+ register long int r3 __asm__ ("r3"); \
+ register long int r4 __asm__ ("r4"); \
+ register long int r5 __asm__ ("r5"); \
+ register long int r6 __asm__ ("r6"); \
+ register long int r7 __asm__ ("r7"); \
+ register long int r8 __asm__ ("r8"); \
+ register long int r9 __asm__ ("r9"); \
+ register long int r10 __asm__ ("r10"); \
+ register long int r11 __asm__ ("r11"); \
+ register long int r12 __asm__ ("r12"); \
+ LOADARGS_##nr (funcptr, args); \
+ __asm__ __volatile__ \
+ ("mtctr %0\n\t" \
+ "bctrl\n\t" \
+ "mfcr %0" \
+ : "=&r" (r0), \
+ "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
+ "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
+ : ASM_INPUT_##nr \
+ : "cr0", "ctr", "lr", "memory"); \
+ err = (long int) r0; \
+ (int) r3; \
+ })
# undef INLINE_SYSCALL
-#if 1
# define INLINE_SYSCALL(name, nr, args...) \
({ \
INTERNAL_SYSCALL_DECL (sc_err); \
@@ -32,18 +148,6 @@
} \
sc_ret; \
})
-#else
-# define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- INTERNAL_SYSCALL_DECL (sc_err); \
- long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- sc_ret = __syscall_error(INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));\
- } \
- sc_ret; \
- })
-#endif
/* Define a macro which expands inline into the wrapper code for a system
call. This use is for internal calls that do not need to handle errors
@@ -70,7 +174,7 @@
register long int r10 __asm__ ("r10"); \
register long int r11 __asm__ ("r11"); \
register long int r12 __asm__ ("r12"); \
- LOADARGS_##nr(name, args); \
+ LOADARGS_##nr(name, args); \
__asm__ __volatile__ \
("sc \n\t" \
"mfcr %0" \
@@ -92,26 +196,50 @@
# undef INTERNAL_SYSCALL_ERRNO
# define INTERNAL_SYSCALL_ERRNO(val, err) (val)
-# define LOADARGS_0(name, dummy) \
- r0 = (long int)name
+# define LOADARGS_0(name, dummy) \
+ r0 = name
# define LOADARGS_1(name, __arg1) \
- LOADARGS_0(name, 0); \
- r3 = (long int)__arg1
+ long int arg1 = (long int) (__arg1); \
+ LOADARGS_0(name, 0); \
+ extern void __illegally_sized_syscall_arg1 (void); \
+ if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \
+ __illegally_sized_syscall_arg1 (); \
+ r3 = arg1
# define LOADARGS_2(name, __arg1, __arg2) \
+ long int arg2 = (long int) (__arg2); \
LOADARGS_1(name, __arg1); \
- r4 = (long int)__arg2
+ extern void __illegally_sized_syscall_arg2 (void); \
+ if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \
+ __illegally_sized_syscall_arg2 (); \
+ r4 = arg2
# define LOADARGS_3(name, __arg1, __arg2, __arg3) \
+ long int arg3 = (long int) (__arg3); \
LOADARGS_2(name, __arg1, __arg2); \
- r5 = (long int)__arg3
+ extern void __illegally_sized_syscall_arg3 (void); \
+ if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \
+ __illegally_sized_syscall_arg3 (); \
+ r5 = arg3
# define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \
+ long int arg4 = (long int) (__arg4); \
LOADARGS_3(name, __arg1, __arg2, __arg3); \
- r6 = (long int)__arg4
+ extern void __illegally_sized_syscall_arg4 (void); \
+ if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \
+ __illegally_sized_syscall_arg4 (); \
+ r6 = arg4
# define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \
+ long int arg5 = (long int) (__arg5); \
LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \
- r7 = (long int)__arg5
+ extern void __illegally_sized_syscall_arg5 (void); \
+ if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \
+ __illegally_sized_syscall_arg5 (); \
+ r7 = arg5
# define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \
+ long int arg6 = (long int) (__arg6); \
LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \
- r8 = (long int)__arg6
+ extern void __illegally_sized_syscall_arg6 (void); \
+ if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \
+ __illegally_sized_syscall_arg6 (); \
+ r8 = arg6
# define ASM_INPUT_0 "0" (r0)
# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3)
@@ -121,6 +249,7 @@
# define ASM_INPUT_5 ASM_INPUT_4, "5" (r7)
# define ASM_INPUT_6 ASM_INPUT_5, "6" (r8)
+
#undef _syscall0
#define _syscall0(type,name) \
type name(void){ \
@@ -164,4 +293,30 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
}
#endif /* __ASSEMBLER__ */
+
+
+/* Pointer mangling support. */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+ earlier than the descriptor is initialized. */
+#else
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(reg, tmpreg) \
+ lwz tmpreg,POINTER_GUARD(r2); \
+ xor reg,tmpreg,reg
+# define PTR_MANGLE2(reg, tmpreg) \
+ xor reg,tmpreg,reg
+# define PTR_MANGLE3(destreg, reg, tmpreg) \
+ lwz tmpreg,POINTER_GUARD(r2); \
+ xor destreg,tmpreg,reg
+# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
+# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
+# else
+# define PTR_MANGLE(var) \
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+# define PTR_DEMANGLE(var) PTR_MANGLE (var)
+# endif
+#endif
+
#endif /* _BITS_SYSCALLS_H */
diff --git a/libc/sysdeps/linux/powerpc/bits/sysdep.h b/libc/sysdeps/linux/powerpc/bits/sysdep.h
new file mode 100644
index 000000000..c42efbabd
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/bits/sysdep.h
@@ -0,0 +1,301 @@
+/* Copyright (C) 1992,1997-2003,2004,2005,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. */
+
+#ifndef _LINUX_POWERPC_SYSDEP_H
+#define _LINUX_POWERPC_SYSDEP_H 1
+
+#include <sysdeps/unix/powerpc/sysdep.h>
+#include <tls.h>
+
+/* Some systen calls got renamed over time, but retained the same semantics.
+ Handle them here so they can be catched by both C and assembler stubs in
+ glibc. */
+
+#ifdef __NR_pread64
+# ifdef __NR_pread
+# error "__NR_pread and __NR_pread64 both defined???"
+# endif
+# define __NR_pread __NR_pread64
+#endif
+
+#ifdef __NR_pwrite64
+# ifdef __NR_pwrite
+# error "__NR_pwrite and __NR_pwrite64 both defined???"
+# endif
+# define __NR_pwrite __NR_pwrite64
+#endif
+
+/* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
+ of the kernel. But these symbols do not follow the SYS_* syntax
+ so we have to redefine the `SYS_ify' macro here. */
+#undef SYS_ify
+#ifdef __STDC__
+# define SYS_ify(syscall_name) __NR_##syscall_name
+#else
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
+#endif
+
+#ifndef __ASSEMBLER__
+
+# include <errno.h>
+
+# ifdef SHARED
+# define INLINE_VSYSCALL(name, nr, args...) \
+ ({ \
+ __label__ out; \
+ __label__ iserr; \
+ INTERNAL_SYSCALL_DECL (sc_err); \
+ long int sc_ret; \
+ \
+ if (__vdso_##name != NULL) \
+ { \
+ sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \
+ if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ goto out; \
+ if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
+ goto iserr; \
+ } \
+ \
+ sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
+ if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ { \
+ iserr: \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
+ sc_ret = -1L; \
+ } \
+ out: \
+ sc_ret; \
+ })
+# else
+# define INLINE_VSYSCALL(name, nr, args...) \
+ INLINE_SYSCALL (name, nr, ##args)
+# endif
+
+# ifdef SHARED
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ ({ \
+ __label__ out; \
+ long int v_ret; \
+ \
+ if (__vdso_##name != NULL) \
+ { \
+ v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
+ || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
+ goto out; \
+ } \
+ v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
+ out: \
+ v_ret; \
+ })
+# else
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ INTERNAL_SYSCALL (name, err, nr, ##args)
+# endif
+
+# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \
+ ({ \
+ long int sc_ret = ENOSYS; \
+ \
+ if (__vdso_##name != NULL) \
+ sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ else \
+ err = 1 << 28; \
+ sc_ret; \
+ })
+
+/* List of system calls which are supported as vsyscalls. */
+# define HAVE_CLOCK_GETRES_VSYSCALL 1
+# define HAVE_CLOCK_GETTIME_VSYSCALL 1
+
+/* Define a macro which expands inline into the wrapper code for a VDSO
+ call. This use is for internal calls that do not need to handle errors
+ normally. It will never touch errno.
+ On powerpc a system call basically clobbers the same registers like a
+ function call, with the exception of LR (which is needed for the
+ "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
+ an error return status). */
+# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+ ({ \
+ register void *r0 __asm__ ("r0"); \
+ register long int r3 __asm__ ("r3"); \
+ register long int r4 __asm__ ("r4"); \
+ register long int r5 __asm__ ("r5"); \
+ register long int r6 __asm__ ("r6"); \
+ register long int r7 __asm__ ("r7"); \
+ register long int r8 __asm__ ("r8"); \
+ register long int r9 __asm__ ("r9"); \
+ register long int r10 __asm__ ("r10"); \
+ register long int r11 __asm__ ("r11"); \
+ register long int r12 __asm__ ("r12"); \
+ LOADARGS_##nr (funcptr, args); \
+ __asm__ __volatile__ \
+ ("mtctr %0\n\t" \
+ "bctrl\n\t" \
+ "mfcr %0" \
+ : "=&r" (r0), \
+ "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
+ "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
+ : ASM_INPUT_##nr \
+ : "cr0", "ctr", "lr", "memory"); \
+ err = (long int) r0; \
+ (int) r3; \
+ })
+
+# undef INLINE_SYSCALL
+# define INLINE_SYSCALL(name, nr, args...) \
+ ({ \
+ INTERNAL_SYSCALL_DECL (sc_err); \
+ long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \
+ if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ { \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
+ sc_ret = -1L; \
+ } \
+ sc_ret; \
+ })
+
+/* Define a macro which expands inline into the wrapper code for a system
+ call. This use is for internal calls that do not need to handle errors
+ normally. It will never touch errno.
+ On powerpc a system call basically clobbers the same registers like a
+ function call, with the exception of LR (which is needed for the
+ "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
+ an error return status). */
+
+# undef INTERNAL_SYSCALL_DECL
+# define INTERNAL_SYSCALL_DECL(err) long int err
+
+# undef INTERNAL_SYSCALL
+# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+ ({ \
+ register long int r0 __asm__ ("r0"); \
+ register long int r3 __asm__ ("r3"); \
+ register long int r4 __asm__ ("r4"); \
+ register long int r5 __asm__ ("r5"); \
+ register long int r6 __asm__ ("r6"); \
+ register long int r7 __asm__ ("r7"); \
+ register long int r8 __asm__ ("r8"); \
+ register long int r9 __asm__ ("r9"); \
+ register long int r10 __asm__ ("r10"); \
+ register long int r11 __asm__ ("r11"); \
+ register long int r12 __asm__ ("r12"); \
+ LOADARGS_##nr(name, args); \
+ __asm__ __volatile__ \
+ ("sc \n\t" \
+ "mfcr %0" \
+ : "=&r" (r0), \
+ "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
+ "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
+ : ASM_INPUT_##nr \
+ : "cr0", "ctr", "memory"); \
+ err = r0; \
+ (int) r3; \
+ })
+# define INTERNAL_SYSCALL(name, err, nr, args...) \
+ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
+
+# undef INTERNAL_SYSCALL_ERROR_P
+# define INTERNAL_SYSCALL_ERROR_P(val, err) \
+ ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
+
+# undef INTERNAL_SYSCALL_ERRNO
+# define INTERNAL_SYSCALL_ERRNO(val, err) (val)
+
+# define LOADARGS_0(name, dummy) \
+ r0 = name
+# define LOADARGS_1(name, __arg1) \
+ long int arg1 = (long int) (__arg1); \
+ LOADARGS_0(name, 0); \
+ extern void __illegally_sized_syscall_arg1 (void); \
+ if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \
+ __illegally_sized_syscall_arg1 (); \
+ r3 = arg1
+# define LOADARGS_2(name, __arg1, __arg2) \
+ long int arg2 = (long int) (__arg2); \
+ LOADARGS_1(name, __arg1); \
+ extern void __illegally_sized_syscall_arg2 (void); \
+ if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \
+ __illegally_sized_syscall_arg2 (); \
+ r4 = arg2
+# define LOADARGS_3(name, __arg1, __arg2, __arg3) \
+ long int arg3 = (long int) (__arg3); \
+ LOADARGS_2(name, __arg1, __arg2); \
+ extern void __illegally_sized_syscall_arg3 (void); \
+ if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \
+ __illegally_sized_syscall_arg3 (); \
+ r5 = arg3
+# define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \
+ long int arg4 = (long int) (__arg4); \
+ LOADARGS_3(name, __arg1, __arg2, __arg3); \
+ extern void __illegally_sized_syscall_arg4 (void); \
+ if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \
+ __illegally_sized_syscall_arg4 (); \
+ r6 = arg4
+# define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \
+ long int arg5 = (long int) (__arg5); \
+ LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \
+ extern void __illegally_sized_syscall_arg5 (void); \
+ if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \
+ __illegally_sized_syscall_arg5 (); \
+ r7 = arg5
+# define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \
+ long int arg6 = (long int) (__arg6); \
+ LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \
+ extern void __illegally_sized_syscall_arg6 (void); \
+ if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \
+ __illegally_sized_syscall_arg6 (); \
+ r8 = arg6
+
+# define ASM_INPUT_0 "0" (r0)
+# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3)
+# define ASM_INPUT_2 ASM_INPUT_1, "2" (r4)
+# define ASM_INPUT_3 ASM_INPUT_2, "3" (r5)
+# define ASM_INPUT_4 ASM_INPUT_3, "4" (r6)
+# define ASM_INPUT_5 ASM_INPUT_4, "5" (r7)
+# define ASM_INPUT_6 ASM_INPUT_5, "6" (r8)
+
+#endif /* __ASSEMBLER__ */
+
+
+/* Pointer mangling support. */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+ earlier than the descriptor is initialized. */
+#else
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(reg, tmpreg) \
+ lwz tmpreg,POINTER_GUARD(r2); \
+ xor reg,tmpreg,reg
+# define PTR_MANGLE2(reg, tmpreg) \
+ xor reg,tmpreg,reg
+# define PTR_MANGLE3(destreg, reg, tmpreg) \
+ lwz tmpreg,POINTER_GUARD(r2); \
+ xor destreg,tmpreg,reg
+# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
+# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
+# else
+# define PTR_MANGLE(var) \
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+# define PTR_DEMANGLE(var) PTR_MANGLE (var)
+# endif
+#endif
+
+#endif /* linux/powerpc/powerpc32/sysdep.h */
diff --git a/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h b/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h
index 7efa8c40f..a3f11df31 100644
--- a/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h
@@ -21,9 +21,6 @@
/* this is only an issue on i386 where linux < 2.3.35, so we just assume it works ... */
#undef __UCLIBC_HANDLE_OLDER_RLIMIT__
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/powerpc/crt1.S b/libc/sysdeps/linux/powerpc/crt1.S
index 7928a7ed3..4f1494a8f 100644
--- a/libc/sysdeps/linux/powerpc/crt1.S
+++ b/libc/sysdeps/linux/powerpc/crt1.S
@@ -58,6 +58,13 @@ _start:
mflr r31
# endif
#endif
+ /* Set up the small data pointer in r13. */
+#ifdef __PIC__
+ lwz r13,_SDA_BASE_@got(r31)
+#else
+ lis r13,_SDA_BASE_@ha
+ addi r13,r13,_SDA_BASE_@l
+#endif
/* Set up an initial stack frame, and clear the LR. */
li r0,0
stwu r1,-16(r1)
@@ -67,8 +74,11 @@ _start:
lwz r4,0(r9)
/* find argv one word offset from the stack pointer */
addi r5,r9,4
- mr r8,r3 /* Pass _dl_fini from ldso or NULL if statically linked
- Note: using r3 instead of r7, since linux 2.6 clobbers r7 */
+ mr r8,r3 /* Pass _dl_fini from ldso or NULL if statically linked */
+ /* Note: PPC depends on the kernel to zero r3 before */
+ /* handing over to user space, otherwise static apps */
+ /* will SEGV during exit() */
+
/* Ok, now run uClibc's main() -- shouldn't return */
#ifdef __PIC__
lwz r6,_init@got(r31)
diff --git a/libc/sysdeps/linux/powerpc/crti.S b/libc/sysdeps/linux/powerpc/crti.S
index 491642496..09589ba8b 100644
--- a/libc/sysdeps/linux/powerpc/crti.S
+++ b/libc/sysdeps/linux/powerpc/crti.S
@@ -1,8 +1,6 @@
.file "initfini.c"
-#APP
.section .init
-#NO_APP
.align 2
.globl _init
.type _init, @function
@@ -10,13 +8,11 @@ _init:
stwu 1,-32(1)
mflr 0
stw 0,36(1)
-#APP
.align 2
.section .fini
-#NO_APP
.align 2
.globl _fini
.type _fini, @function
@@ -24,8 +20,5 @@ _fini:
stwu 1,-32(1)
mflr 0
stw 0,36(1)
-#APP
+
.align 2
-
-
- .ident "GCC: (GNU) 3.3.1 20030626 (Debian prerelease)"
diff --git a/libc/sysdeps/linux/powerpc/crtn.S b/libc/sysdeps/linux/powerpc/crtn.S
index 5de93ea8a..ba6d0e0c8 100644
--- a/libc/sysdeps/linux/powerpc/crtn.S
+++ b/libc/sysdeps/linux/powerpc/crtn.S
@@ -1,30 +1,23 @@
.file "initfini.c"
-#APP
.section .init
-#NO_APP
.align 2
.globl _init
.type _init, @function
-#NO_APP
+
lwz 0,36(1)
addi 1,1,32
mtlr 0
blr
.size _init, .-_init
-#APP
.section .fini
-#NO_APP
.align 2
.globl _fini
.type _fini, @function
-#NO_APP
+
lwz 0,36(1)
addi 1,1,32
mtlr 0
blr
.size _fini, .-_fini
-#APP
-
- .ident "GCC: (GNU) 3.3.1 20030626 (Debian prerelease)"
diff --git a/libc/sysdeps/linux/powerpc/fenv.h b/libc/sysdeps/linux/powerpc/fenv.h
new file mode 100644
index 000000000..8a06f024e
--- /dev/null
+++ b/libc/sysdeps/linux/powerpc/fenv.h
@@ -0,0 +1,136 @@
+/* Copyright (C) 1997, 1999, 2000 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. */
+
+/*
+ * ISO C99 7.6: Floating-point environment <fenv.h>
+ */
+
+#ifndef _FENV_H
+#define _FENV_H 1
+
+#include <features.h>
+
+/* Get the architecture dependend definitions. The following definitions
+ are expected to be done:
+
+ fenv_t type for object representing an entire floating-point
+ environment
+
+ FE_DFL_ENV macro of type pointer to fenv_t to be used as the argument
+ to functions taking an argument of type fenv_t; in this
+ case the default environment will be used
+
+ fexcept_t type for object representing the floating-point exception
+ flags including status associated with the flags
+
+ The following macros are defined iff the implementation supports this
+ kind of exception.
+ FE_INEXACT inexact result
+ FE_DIVBYZERO division by zero
+ FE_UNDERFLOW result not representable due to underflow
+ FE_OVERFLOW result not representable due to overflow
+ FE_INVALID invalid operation
+
+ FE_ALL_EXCEPT bitwise OR of all supported exceptions
+
+ The next macros are defined iff the appropriate rounding mode is
+ supported by the implementation.
+ FE_TONEAREST round to nearest
+ FE_UPWARD round toward +Inf
+ FE_DOWNWARD round toward -Inf
+ FE_TOWARDZERO round toward 0
+*/
+#include <bits/fenv.h>
+
+__BEGIN_DECLS
+
+/* Floating-point exception handling. */
+
+/* Clear the supported exceptions represented by EXCEPTS. */
+extern int feclearexcept (int __excepts) __THROW;
+
+/* Store implementation-defined representation of the exception flags
+ indicated by EXCEPTS in the object pointed to by FLAGP. */
+extern int fegetexceptflag (fexcept_t *__flagp, int __excepts) __THROW;
+
+/* Raise the supported exceptions represented by EXCEPTS. */
+extern int feraiseexcept (int __excepts) __THROW;
+
+/* Set complete status for exceptions indicated by EXCEPTS according to
+ the representation in the object pointed to by FLAGP. */
+extern int fesetexceptflag (__const fexcept_t *__flagp, int __excepts) __THROW;
+
+/* Determine which of subset of the exceptions specified by EXCEPTS are
+ currently set. */
+extern int fetestexcept (int __excepts) __THROW;
+
+
+/* Rounding control. */
+
+/* Get current rounding direction. */
+extern int fegetround (void) __THROW;
+
+/* Establish the rounding direction represented by ROUND. */
+extern int fesetround (int __rounding_direction) __THROW;
+
+
+/* Floating-point environment. */
+
+/* Store the current floating-point environment in the object pointed
+ to by ENVP. */
+extern int fegetenv (fenv_t *__envp) __THROW;
+
+/* Save the current environment in the object pointed to by ENVP, clear
+ exception flags and install a non-stop mode (if available) for all
+ exceptions. */
+extern int feholdexcept (fenv_t *__envp) __THROW;
+
+/* Establish the floating-point environment represented by the object
+ pointed to by ENVP. */
+extern int fesetenv (__const fenv_t *__envp) __THROW;
+
+/* Save current exceptions in temporary storage, install environment
+ represented by object pointed to by ENVP and raise exceptions
+ according to saved exceptions. */
+extern int feupdateenv (__const fenv_t *__envp) __THROW;
+
+
+/* Include optimization. */
+#ifdef __OPTIMIZE__
+# include <bits/fenvinline.h>
+#endif
+
+#ifdef __USE_GNU
+
+/* Enable individual exceptions. Will not enable more exceptions than
+ EXCEPTS specifies. Returns the previous enabled exceptions if all
+ exceptions are successfully set, otherwise returns -1. */
+extern int feenableexcept (int __excepts) __THROW;
+
+/* Disable individual exceptions. Will not disable more exceptions than
+ EXCEPTS specifies. Returns the previous enabled exceptions if all
+ exceptions are successfully disabled, otherwise returns -1. */
+extern int fedisableexcept (int __excepts) __THROW;
+
+/* Return enabled exceptions. */
+extern int fegetexcept (void) __THROW;
+#endif
+
+__END_DECLS
+
+#endif /* fenv.h */
diff --git a/libc/sysdeps/linux/powerpc/fpu_control.h b/libc/sysdeps/linux/powerpc/fpu_control.h
index 2df9ba0e7..442da4721 100644
--- a/libc/sysdeps/linux/powerpc/fpu_control.h
+++ b/libc/sysdeps/linux/powerpc/fpu_control.h
@@ -1,6 +1,7 @@
-/* FPU control word definitions. PowerPC version.
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* FPU control word definitions. PowerPC and PowerPC e500 versions.
+ Copyright (C) 1996, 1997, 1998, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
+ e500 parts contributed by Aldy Hernandez <aldy@redhat.com>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -20,6 +21,8 @@
#ifndef _FPU_CONTROL_H
#define _FPU_CONTROL_H
+#include <features.h>
+
/* rounding control */
#define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */
#define _FPU_RC_DOWN 0x03
@@ -35,18 +38,36 @@
#define _FPU_MASK_XM 0x08 /* inexact */
#define _FPU_MASK_IM 0x80 /* invalid operation */
-#define _FPU_RESERVED 0xffffff00 /* These bits are reserved are not changed. */
/* The fdlibm code requires no interrupts for exceptions. */
#define _FPU_DEFAULT 0x00000000 /* Default value. */
+
+/* Type of the control word. */
+typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
+
+
+#ifdef __CONFIG_E500__
+#define _FPU_RESERVED 0xff3fff7f /* These bits are reserved are not changed. */
/* IEEE: same as above, but (some) exceptions;
we leave the 'inexact' exception off.
*/
-#define _FPU_IEEE 0x000000f0
+#define _FPU_IEEE 0x000003c0
-/* Type of the control word. */
-typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
+/* Macros for accessing the hardware control word. */
+#define _FPU_GETCW(__cw) ({ \
+ unsigned int env; \
+ __asm__ __volatile__ ("mfspefscr %0" : "=r" (env)); \
+ (__cw) = env; })
+#define _FPU_SETCW(__cw) ({ \
+ unsigned int env = __cw; \
+ __asm__ __volatile__ ("mtspefscr %0" : : "r" (env)); })
+#else
+#define _FPU_RESERVED 0xffffff00 /* These bits are reserved are not changed. */
+/* IEEE: same as above, but (some) exceptions;
+ we leave the 'inexact' exception off.
+ */
+#define _FPU_IEEE 0x000000f0
/* Macros for accessing the hardware control word. */
#define _FPU_GETCW(__cw) ( { \
@@ -63,6 +84,8 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
__asm__ ("lfd%U0 0,%0; mtfsf 255,0" : : "m" (tmp.d) : "fr0"); \
}
+#endif /* __CONFIG_E500__ */
+
#if 0
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
diff --git a/libc/sysdeps/linux/powerpc/setjmp.S b/libc/sysdeps/linux/powerpc/setjmp.S
index 3bdf6cbfe..04b06d689 100644
--- a/libc/sysdeps/linux/powerpc/setjmp.S
+++ b/libc/sysdeps/linux/powerpc/setjmp.S
@@ -1,5 +1,7 @@
-/* setjmp for PowerPC.
- Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* setjmp for PowerPC and PowerPC e500.
+ Copyright (C) 1995, 1996, 1997, 1999, 2000, 2004
+ Free Software Foundation, Inc.
+ e500 contributed by Aldy Hernandez <aldyh@redhat.com>.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -29,6 +31,14 @@
#define FP(x...)
#endif
+#if defined __CONFIG_E500__
+#define LFD(reg) evldd r##reg
+#define STFD(reg) evstdd r##reg
+#else
+#define LFD(reg) lfd fp##reg
+#define STFD(reg) stfd fp##reg
+#endif /* __CONFIG_E500__ */
+
.globl __sigsetjmp;
.type __sigsetjmp, @function;
.align 2;
@@ -38,44 +48,44 @@ __sigsetjmp:
mflr r0
stw r2,(JB_GPR2*4)(3)
stw r14,((JB_GPRS+0)*4)(3)
-FP( stfd fp14,((JB_FPRS+0*2)*4)(3))
- stw r0,(JB_LR*4)(3)
- stw r15,((JB_GPRS+1)*4)(3)
-FP( stfd fp15,((JB_FPRS+1*2)*4)(3))
- mfcr r0
- stw r16,((JB_GPRS+2)*4)(3)
-FP( stfd fp16,((JB_FPRS+2*2)*4)(3))
- stw r0,(JB_CR*4)(3)
- stw r17,((JB_GPRS+3)*4)(3)
-FP( stfd fp17,((JB_FPRS+3*2)*4)(3))
- stw r18,((JB_GPRS+4)*4)(3)
-FP( stfd fp18,((JB_FPRS+4*2)*4)(3))
- stw r19,((JB_GPRS+5)*4)(3)
-FP( stfd fp19,((JB_FPRS+5*2)*4)(3))
- stw r20,((JB_GPRS+6)*4)(3)
-FP( stfd fp20,((JB_FPRS+6*2)*4)(3))
- stw r21,((JB_GPRS+7)*4)(3)
-FP( stfd fp21,((JB_FPRS+7*2)*4)(3))
- stw r22,((JB_GPRS+8)*4)(3)
-FP( stfd fp22,((JB_FPRS+8*2)*4)(3))
- stw r23,((JB_GPRS+9)*4)(3)
-FP( stfd fp23,((JB_FPRS+9*2)*4)(3))
- stw r24,((JB_GPRS+10)*4)(3)
-FP( stfd fp24,((JB_FPRS+10*2)*4)(3))
- stw r25,((JB_GPRS+11)*4)(3)
-FP( stfd fp25,((JB_FPRS+11*2)*4)(3))
- stw r26,((JB_GPRS+12)*4)(3)
-FP( stfd fp26,((JB_FPRS+12*2)*4)(3))
- stw r27,((JB_GPRS+13)*4)(3)
-FP( stfd fp27,((JB_FPRS+13*2)*4)(3))
- stw r28,((JB_GPRS+14)*4)(3)
-FP( stfd fp28,((JB_FPRS+14*2)*4)(3))
- stw r29,((JB_GPRS+15)*4)(3)
-FP( stfd fp29,((JB_FPRS+15*2)*4)(3))
- stw r30,((JB_GPRS+16)*4)(3)
-FP( stfd fp30,((JB_FPRS+16*2)*4)(3))
- stw r31,((JB_GPRS+17)*4)(3)
-FP( stfd fp31,((JB_FPRS+17*2)*4)(3))
+FP( STFD (14),((JB_FPRS+0*2)*4)(3))
+ stw r0,(JB_LR*4)(3)
+ stw r15,((JB_GPRS+1)*4)(3)
+FP( STFD (15),((JB_FPRS+1*2)*4)(3))
+ mfcr r0
+ stw r16,((JB_GPRS+2)*4)(3)
+FP( STFD (16),((JB_FPRS+2*2)*4)(3))
+ stw r0,(JB_CR*4)(3)
+ stw r17,((JB_GPRS+3)*4)(3)
+FP( STFD (17),((JB_FPRS+3*2)*4)(3))
+ stw r18,((JB_GPRS+4)*4)(3)
+FP( STFD (18),((JB_FPRS+4*2)*4)(3))
+ stw r19,((JB_GPRS+5)*4)(3)
+FP( STFD (19),((JB_FPRS+5*2)*4)(3))
+ stw r20,((JB_GPRS+6)*4)(3)
+FP( STFD (20),((JB_FPRS+6*2)*4)(3))
+ stw r21,((JB_GPRS+7)*4)(3)
+FP( STFD (21),((JB_FPRS+7*2)*4)(3))
+ stw r22,((JB_GPRS+8)*4)(3)
+FP( STFD (22),((JB_FPRS+8*2)*4)(3))
+ stw r23,((JB_GPRS+9)*4)(3)
+FP( STFD (23),((JB_FPRS+9*2)*4)(3))
+ stw r24,((JB_GPRS+10)*4)(3)
+FP( STFD (24),((JB_FPRS+10*2)*4)(3))
+ stw r25,((JB_GPRS+11)*4)(3)
+FP( STFD (25),((JB_FPRS+11*2)*4)(3))
+ stw r26,((JB_GPRS+12)*4)(3)
+FP( STFD (26),((JB_FPRS+12*2)*4)(3))
+ stw r27,((JB_GPRS+13)*4)(3)
+FP( STFD (27),((JB_FPRS+13*2)*4)(3))
+ stw r28,((JB_GPRS+14)*4)(3)
+FP( STFD (28),((JB_FPRS+14*2)*4)(3))
+ stw r29,((JB_GPRS+15)*4)(3)
+FP( STFD (29),((JB_FPRS+15*2)*4)(3))
+ stw r30,((JB_GPRS+16)*4)(3)
+FP( STFD (30),((JB_FPRS+16*2)*4)(3))
+ stw r31,((JB_GPRS+17)*4)(3)
+FP( STFD (31),((JB_FPRS+17*2)*4)(3))
b __sigjmp_save@local
diff --git a/libc/sysdeps/linux/sh64/Makefile b/libc/sysdeps/linux/sh64/Makefile
index 020cc76c8..ecbf14228 100644
--- a/libc/sysdeps/linux/sh64/Makefile
+++ b/libc/sysdeps/linux/sh64/Makefile
@@ -5,60 +5,11 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_srcdir=../../../../
+top_builddir=../../../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.arch
+include $(top_srcdir)Makerules
TOPDIR=../../../../
include $(TOPDIR)Rules.mak
-
-CFLAGS += -I..
-ASFLAGS += -I.. -D__ASSEMBLER__ -DASM_GLOBAL_DIRECTIVE=.globl
-
-TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine)
-
-CRT_SRC := crt0.S
-CRT_OBJ := crt0.o crt1.o
-CTOR_TARGETS := $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
-
-SSRC := setjmp.S longjmp.S
-SOBJ := $(patsubst %.S,%.o, $(SSRC))
-
-CSRC := __init_brk.c brk.c sbrk.c syscall.c
-COBJ := $(patsubst %.c,%.o, $(CSRC))
-
-OBJS := $(SOBJ) $(COBJ)
-
-OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH)
-
-all: $(OBJ_LIST) $(CTOR_TARGETS)
-
-$(OBJ_LIST): $(OBJS) $(CRT_OBJ)
- $(STRIPTOOL) -x -R .note -R .comment $^
- $(INSTALL) -d $(TOPDIR)lib/
- cp $(CRT_OBJ) $(TOPDIR)lib/
- echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $@
-
-$(CRT_OBJ): $(CRT_SRC)
- $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
-
-$(SOBJ): %.o : %.S
- $(CC) $(ASFLAGS) -c $< -o $@
-
-$(COBJ): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
-
-ifeq ($(UCLIBC_CTOR_DTOR),y)
-$(TOPDIR)lib/crti.o: crti.S
- $(INSTALL) -d $(TOPDIR)lib/
- $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@
-
-$(TOPDIR)lib/crtn.o: crtn.S
- $(INSTALL) -d $(TOPDIR)lib/
- $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@
-else
-$(CTOR_TARGETS):
- $(INSTALL) -d $(TOPDIR)lib/
- $(AR) $(ARFLAGS) $@
-endif
-
-headers:
-
-clean:
- $(RM) *.o *~ core
diff --git a/libc/sysdeps/linux/sh64/Makefile.arch b/libc/sysdeps/linux/sh64/Makefile.arch
new file mode 100644
index 000000000..d49540ebe
--- /dev/null
+++ b/libc/sysdeps/linux/sh64/Makefile.arch
@@ -0,0 +1,12 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2008 Paul Mundt <lethal@linux-sh.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+CSRC := __init_brk.c brk.c sbrk.c syscall.c
+
+SSRC := setjmp.S __longjmp.S
+
+include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/sh64/__longjmp.S b/libc/sysdeps/linux/sh64/__longjmp.S
new file mode 100644
index 000000000..ca7925f76
--- /dev/null
+++ b/libc/sysdeps/linux/sh64/__longjmp.S
@@ -0,0 +1,141 @@
+/* __longjmp for SH-5.
+ Copyright (C) 1999, 2000 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+
+#define _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+
+#define INTEGER(reg,offset) ld.q r2, offset*8, reg
+#define DOUBLE(reg,offset) fld.d r2, offset*8, reg
+
+
+ .file "__longjmp.S"
+
+ .section .text64,"xa"
+ .align 2
+
+ .global __longjmp
+ .type __longjmp,@function
+
+__longjmp:
+ /*
+ * extern void __longjmp(jmp_buf env, int val);
+ *
+ * r2 == env
+ * r3 == val
+ * r4 == temporary
+ */
+
+ /* callee-save registers R10-R16 */
+ INTEGER(r10, __SETJMP_INT(0))
+ INTEGER(r11, __SETJMP_INT(1))
+ INTEGER(r12, __SETJMP_INT(2))
+ INTEGER(r13, __SETJMP_INT(3))
+ INTEGER(r14, __SETJMP_INT(4))
+ INTEGER(r15, __SETJMP_INT(5))
+ INTEGER(r16, __SETJMP_INT(6))
+
+ /* callee-save registers R28-R35 */
+ INTEGER(r28, __SETJMP_INT(7))
+ INTEGER(r29, __SETJMP_INT(8))
+ INTEGER(r30, __SETJMP_INT(9))
+ INTEGER(r31, __SETJMP_INT(10))
+ INTEGER(r32, __SETJMP_INT(11))
+ INTEGER(r33, __SETJMP_INT(12))
+ INTEGER(r34, __SETJMP_INT(13))
+ INTEGER(r35, __SETJMP_INT(14))
+
+ /* callee-save registers R44-R59 */
+ INTEGER(r44, __SETJMP_INT(15))
+ INTEGER(r45, __SETJMP_INT(16))
+ INTEGER(r46, __SETJMP_INT(17))
+ INTEGER(r47, __SETJMP_INT(18))
+ INTEGER(r48, __SETJMP_INT(19))
+ INTEGER(r49, __SETJMP_INT(20))
+ INTEGER(r50, __SETJMP_INT(21))
+ INTEGER(r51, __SETJMP_INT(22))
+ INTEGER(r52, __SETJMP_INT(23))
+ INTEGER(r53, __SETJMP_INT(24))
+ INTEGER(r54, __SETJMP_INT(25))
+ INTEGER(r55, __SETJMP_INT(26))
+ INTEGER(r56, __SETJMP_INT(27))
+ INTEGER(r57, __SETJMP_INT(28))
+ INTEGER(r58, __SETJMP_INT(29))
+ INTEGER(r59, __SETJMP_INT(30))
+
+ #if __SETJMP_NUM_INT != 31
+ #error __SETJMP_NUM_INT does agree with expected value
+ #endif
+
+#if __SETJMP_NUM_DBL > 0
+ /* callee-save registers FR12-FR15 */
+ DOUBLE(d12, __SETJMP_DBL(0))
+ DOUBLE(d14, __SETJMP_DBL(1))
+
+ /* callee-save registers FR36-FR63 */
+ DOUBLE(d36, __SETJMP_DBL(2))
+ DOUBLE(d38, __SETJMP_DBL(3))
+ DOUBLE(d40, __SETJMP_DBL(4))
+ DOUBLE(d42, __SETJMP_DBL(5))
+ DOUBLE(d44, __SETJMP_DBL(6))
+ DOUBLE(d46, __SETJMP_DBL(7))
+ DOUBLE(d48, __SETJMP_DBL(8))
+ DOUBLE(d50, __SETJMP_DBL(9))
+ DOUBLE(d52, __SETJMP_DBL(10))
+ DOUBLE(d54, __SETJMP_DBL(11))
+ DOUBLE(d56, __SETJMP_DBL(12))
+ DOUBLE(d58, __SETJMP_DBL(13))
+ DOUBLE(d60, __SETJMP_DBL(14))
+ DOUBLE(d62, __SETJMP_DBL(15))
+
+ #if __SETJMP_NUM_DBL != 16
+ #error __SETJMP_NUM_DBL does agree with expected value
+ #endif
+
+#endif /* __SETJMP_NUM_DBL > 0 */
+
+ /* callee-save registers TR5-TR7 */
+ INTEGER(r4, __SETJMP_TRG(0))
+ ptabs r4, tr5
+ INTEGER(r4, __SETJMP_TRG(1))
+ ptabs r4, tr6
+ INTEGER(r4, __SETJMP_TRG(2))
+ ptabs r4, tr7
+
+ #if __SETJMP_NUM_TRG != 3
+ #error __SETJMP_NUM_TRG does agree with expected value
+ #endif
+
+ /* restore Linkage Register (LR) for __longjmp return */
+ INTEGER(r18, __SETJMP_LR)
+ ptabs/l r18, tr0
+
+ /*
+ * must ensure __longjmp() never returns 0.
+ * if 'val' == 0, then return 1.
+ */
+ cmpeq r3, r63, r2 /* r2 = (r3==0) ? 1 : 0; */
+ add.l r3, r2, r2 /* return value */
+
+ /* return to caller */
+ blink tr0, r63
+
+libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/sh64/bits/fcntl.h b/libc/sysdeps/linux/sh64/bits/fcntl.h
index 69a20966d..a53830ca8 100644
--- a/libc/sysdeps/linux/sh64/bits/fcntl.h
+++ b/libc/sysdeps/linux/sh64/bits/fcntl.h
@@ -89,6 +89,14 @@
# define F_GETSIG 11 /* Get number of signal to be sent. */
#endif
+#ifdef __USE_GNU
+# define F_SETLEASE 1024 /* Set a lease. */
+# define F_GETLEASE 1025 /* Enquire what lease is active. */
+# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
+
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
@@ -154,3 +162,59 @@ struct flock64
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
+
+
+#ifdef __USE_GNU
+#if 0
+/* Flags for SYNC_FILE_RANGE. */
+# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
+ in the range before performing the
+ write. */
+# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
+ dirty pages in the range which are
+ not presently under writeback. */
+# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
+ the range after performing the
+ write. */
+#endif
+
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+#endif
+
+__BEGIN_DECLS
+
+#ifdef __USE_GNU
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __THROW;
+
+
+#if 0
+/* Selective file content synch'ing. */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+ unsigned int __flags);
+#endif
+
+/* Splice address range into a pipe. */
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
+
+/* Splice two files together. */
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
+
+/* In-kernel implementation of tee for pipe buffers. */
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
+
+#endif
+__END_DECLS
+
diff --git a/libc/sysdeps/linux/sh64/bits/stackinfo.h b/libc/sysdeps/linux/sh64/bits/stackinfo.h
new file mode 100644
index 000000000..e65338f25
--- /dev/null
+++ b/libc/sysdeps/linux/sh64/bits/stackinfo.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2001 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. */
+
+/* This file contains a bit of information about the stack allocation
+ of the processor. */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H 1
+
+/* On SH the stack grows down. */
+#define _STACK_GROWS_DOWN 1
+
+#endif /* stackinfo.h */
diff --git a/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h b/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h
index 55cd44c1f..1e8aa593f 100644
--- a/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h
@@ -17,9 +17,6 @@
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/libc/sysdeps/linux/sh64/crt1.S b/libc/sysdeps/linux/sh64/crt1.S
new file mode 100644
index 000000000..1822e2dc3
--- /dev/null
+++ b/libc/sysdeps/linux/sh64/crt1.S
@@ -0,0 +1,83 @@
+/* Startup code for SH5 & ELF.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 2001 Hewlett-Packard Australia
+
+ 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment.
+
+ At this entry point, most registers' values are unspecified, except:
+
+ sp The stack contains the arguments and environment:
+ 0(sp) argc
+ 4(sp) argv[0]
+ ...
+ (4*argc)(sp) NULL
+ (4*(argc+1))(sp) envp[0]
+ ...
+ NULL
+*/
+
+ .file "crt1.S"
+
+ .globl _start
+ .type _start,%function
+ .type main,%function
+
+ .section .text64,"xa"
+ .align 2 /* 2^2 = 4 */
+
+_start:
+ /* __uClibc_main (main, argc, argv, init, fini) */
+ movi __main, r18
+ or r2, r63, r18
+
+ /* Pop argc off the stack and save a pointer to argv */
+ ld.l r15, 0, r3 /* argc */
+ addi r15, 4, r4 /* argv */
+
+ movi _init, r5
+ movi _fini, r6
+
+ /* call main() */
+ movi __uClibc_main, r17
+ ptabs/l r17, tr0
+ blink tr0, r18
+
+ /* should never get here....*/
+ movi abort, r17
+ ptabs/l r17, tr0
+ blink tr0, r63 /* call abort() => (r63) do not come back ... */
+
+/*
+ * The following is a stub to stop the GNU toolchain
+ * from calling its C-RTL initialization routines.
+ */
+__main:
+ movi main, r18
+ ptabs/l r18, tr0
+ blink tr0, r63
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
diff --git a/libc/sysdeps/linux/sh64/sys/procfs.h b/libc/sysdeps/linux/sh64/sys/procfs.h
new file mode 100644
index 000000000..aad21e5f8
--- /dev/null
+++ b/libc/sysdeps/linux/sh64/sys/procfs.h
@@ -0,0 +1,126 @@
+/* Copyright (C) 1996, 1997, 1999, 2000 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. */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H 1
+
+/* This is somehow modelled after the file of the same name on SysVr4
+ systems. It provides a definition of the core file format for ELF
+ used on Linux. */
+
+#include <features.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <sys/user.h>
+
+__BEGIN_DECLS
+
+/*
+ * ELF register definitions...
+ */
+typedef unsigned long elf_greg_t;
+
+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+typedef struct user_fpu_struct elf_fpregset_t;
+
+struct elf_siginfo
+ {
+ int si_signo; /* Signal number. */
+ int si_code; /* Extra code. */
+ int si_errno; /* Errno. */
+ };
+
+
+/* Definitions to generate Intel SVR4-like core files. These mostly
+ have the same names as the SVR4 types with "elf_" tacked on the
+ front to prevent clashes with linux definitions, and the typedef
+ forms have been avoided. This is mostly like the SVR4 structure,
+ but more Linuxy, with things that Linux does not support and which
+ gdb doesn't really use excluded. Fields present but not used are
+ marked with "XXX". */
+struct elf_prstatus
+ {
+#if 0
+ long int pr_flags; /* XXX Process flags. */
+ short int pr_why; /* XXX Reason for process halt. */
+ short int pr_what; /* XXX More detailed reason. */
+#endif
+ struct elf_siginfo pr_info; /* Info associated with signal. */
+ short int pr_cursig; /* Current signal. */
+ unsigned long int pr_sigpend; /* Set of pending signals. */
+ unsigned long int pr_sighold; /* Set of held signals. */
+#if 0
+ struct sigaltstack pr_altstack; /* Alternate stack info. */
+ struct sigaction pr_action; /* Signal action for current sig. */
+#endif
+ __pid_t pr_pid;
+ __pid_t pr_ppid;
+ __pid_t pr_pgrp;
+ __pid_t pr_sid;
+ struct timeval pr_utime; /* User time. */
+ struct timeval pr_stime; /* System time. */
+ struct timeval pr_cutime; /* Cumulative user time. */
+ struct timeval pr_cstime; /* Cumulative system time. */
+#if 0
+ long int pr_instr; /* Current instruction. */
+#endif
+ elf_gregset_t pr_reg; /* GP registers. */
+ int pr_fpvalid; /* True if math copro being used. */
+ };
+
+
+#define ELF_PRARGSZ (80) /* Number of chars for args */
+
+struct elf_prpsinfo
+ {
+ char pr_state; /* Numeric process state. */
+ char pr_sname; /* Char for pr_state. */
+ char pr_zomb; /* Zombie. */
+ char pr_nice; /* Nice val. */
+ unsigned long int pr_flag; /* Flags. */
+ long pr_uid;
+ long pr_gid;
+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+ /* Lots missing */
+ char pr_fname[16]; /* Filename of executable. */
+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
+ };
+
+
+/* Addresses. */
+typedef void *psaddr_t;
+
+/* Register sets. Linux has different names. */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+ therefore habe only ine PID type. */
+typedef __pid_t lwpid_t;
+
+
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif /* sys/procfs.h */
diff --git a/libc/sysdeps/linux/vax/bits/fcntl.h b/libc/sysdeps/linux/vax/bits/fcntl.h
index fb72b21fa..a38bf52ad 100644
--- a/libc/sysdeps/linux/vax/bits/fcntl.h
+++ b/libc/sysdeps/linux/vax/bits/fcntl.h
@@ -87,6 +87,14 @@
# define F_GETSIG 11 /* Get number of signal to be sent. */
#endif
+#ifdef __USE_GNU
+# define F_SETLEASE 1024 /* Set a lease. */
+# define F_GETLEASE 1025 /* Enquire what lease is active. */
+# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
+ close-on-exit set on new fd. */
+#endif
+
/* For F_[GET|SET]FL. */
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
@@ -153,7 +161,10 @@ struct flock64
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
+
#ifdef __USE_GNU
+#if 0
+/* Flags for SYNC_FILE_RANGE. */
# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
in the range before performing the
write. */
@@ -165,6 +176,15 @@ struct flock64
write. */
#endif
+/* Flags for SPLICE and VMSPLICE. */
+# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
+# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
+ (but we may still block on the fd
+ we splice from/to). */
+# define SPLICE_F_MORE 4 /* Expect more data. */
+# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
+#endif
+
__BEGIN_DECLS
#ifdef __USE_GNU
@@ -178,21 +198,21 @@ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
/* Selective file content synch'ing. */
extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
unsigned int __flags);
-
+#endif
/* Splice address range into a pipe. */
-extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
- unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
/* Splice two files together. */
-extern int splice (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
/* In-kernel implementation of tee for pipe buffers. */
-extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
- __THROW;
-#endif
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
#endif
-
__END_DECLS
+
diff --git a/libc/sysdeps/linux/vax/bits/uClibc_arch_features.h b/libc/sysdeps/linux/vax/bits/uClibc_arch_features.h
index 0099b24d6..eda49b81c 100644
--- a/libc/sysdeps/linux/vax/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/vax/bits/uClibc_arch_features.h
@@ -17,9 +17,6 @@
/* does your target have a broken create_module() ? */
#undef __UCLIBC_BROKEN_CREATE_MODULE__
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_NO_UNDERSCORES__
-
/* does your target have an asm .set ? */
#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__