summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/ntop.c2
-rw-r--r--libc/misc/regex/regex_internal.c7
-rw-r--r--libc/stdio/__fpending.c7
-rw-r--r--libc/stdio/_scanf.c7
-rw-r--r--libc/stdio/_stdio.c1
-rw-r--r--libc/stdio/fflush.c2
-rw-r--r--libc/stdio/popen.c2
-rw-r--r--libc/stdlib/system.c7
-rw-r--r--libc/sysdeps/linux/arm/clone.S61
-rw-r--r--libc/sysdeps/linux/arm/sysdep.h36
-rw-r--r--libc/sysdeps/linux/common/Makefile.in2
-rw-r--r--libc/sysdeps/linux/common/bits/mathcalls.h18
-rw-r--r--libc/sysdeps/linux/common/bits/uClibc_fpmax.h4
-rw-r--r--libc/sysdeps/linux/common/eventfd_read.c27
-rw-r--r--libc/sysdeps/linux/common/eventfd_write.c28
-rw-r--r--libc/sysdeps/linux/common/fstatat64.c8
-rw-r--r--libc/sysdeps/linux/common/sys/eventfd.h4
-rw-r--r--libc/sysdeps/linux/cris/sys/procfs.h6
-rw-r--r--libc/sysdeps/linux/cris/sysdep.S2
-rw-r--r--libc/sysdeps/linux/m68k/sys/reg.h88
-rw-r--r--libc/sysdeps/linux/microblaze/bits/uClibc_page.h2
-rw-r--r--libc/sysdeps/linux/xtensa/Makefile.arch5
-rw-r--r--libc/sysdeps/linux/xtensa/clone.S101
-rw-r--r--libc/sysdeps/linux/xtensa/fork.c8
-rw-r--r--libc/sysdeps/linux/xtensa/jmpbuf-unwind.h38
-rw-r--r--libc/sysdeps/linux/xtensa/sys/ptrace.h155
-rw-r--r--libc/sysdeps/linux/xtensa/sysdep.h39
-rw-r--r--libc/sysdeps/linux/xtensa/vfork.S104
-rw-r--r--libc/unistd/daemon.c1
29 files changed, 487 insertions, 285 deletions
diff --git a/libc/inet/ntop.c b/libc/inet/ntop.c
index 0181a415c..30dde6f9c 100644
--- a/libc/inet/ntop.c
+++ b/libc/inet/ntop.c
@@ -105,7 +105,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size)
* to use pointer overlays. All the world's not a VAX.
*/
char tmp[sizeof ("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")], *tp;
- struct { int base, len; } best, cur;
+ struct { int base, len; } best = { 0, 0 }, cur = { 0, 0 };
u_int words[8];
int i;
diff --git a/libc/misc/regex/regex_internal.c b/libc/misc/regex/regex_internal.c
index f9412d663..c74c6a0c3 100644
--- a/libc/misc/regex/regex_internal.c
+++ b/libc/misc/regex/regex_internal.c
@@ -650,15 +650,8 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
mbstate_t cur_state;
wchar_t wc2;
int mlen = raw + pstr->len - p;
- unsigned char buf[6];
size_t mbclen;
- if (BE (pstr->trans != NULL, 0))
- {
- int i = mlen < 6 ? mlen : 6;
- while (--i >= 0)
- buf[i] = pstr->trans[p[i]];
- }
/* XXX Don't use mbrtowc, we know which conversion
to use (UTF-8 -> UCS4). */
memset (&cur_state, 0, sizeof (cur_state));
diff --git a/libc/stdio/__fpending.c b/libc/stdio/__fpending.c
index a7fe05463..e7e33e80a 100644
--- a/libc/stdio/__fpending.c
+++ b/libc/stdio/__fpending.c
@@ -18,13 +18,6 @@
* convert wide chars to their multibyte encodings and buffer _those_.
*/
-#ifdef __UCLIBC_HAS_WCHAR__
-#warning Note: Unlike the glibc version, this __fpending returns bytes in buffer for wide streams too!
-
-link_warning(__fpending, "This version of __fpending returns bytes remaining in buffer for both narrow and wide streams. glibc's version returns wide chars in buffer for the wide stream case.")
-
-#endif
-
size_t __fpending(register FILE * __restrict stream)
{
__STDIO_STREAM_VALIDATE(stream);
diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c
index 6ecb3cb1e..d48fd1267 100644
--- a/libc/stdio/_scanf.c
+++ b/libc/stdio/_scanf.c
@@ -553,9 +553,8 @@ enum {
/**********************************************************************/
#ifdef L_vfwscanf
-/* FIXME: "warning: the right operand of ">" changes sign when promoted" */
-#if WINT_MIN > EOF
-#error Unfortunately, we currently need wint_t to be able to store EOF. Sorry.
+#if WINT_MIN > WEOF
+#error Unfortunately, we currently need wint_t to be able to store WEOF. Sorry.
#endif
#define W_EOF WEOF
#define Wint wint_t
@@ -1144,7 +1143,7 @@ int VFSCANF (FILE *__restrict fp, const Wchar *__restrict format, va_list arg)
unsigned char buf[MAX_DIGITS+2];
#ifdef L_vfscanf
unsigned char scanset[UCHAR_MAX + 1];
- unsigned char invert; /* Careful! Meaning changes. */
+ unsigned char invert = 0; /* Careful! Meaning changes. */
#endif /* L_vfscanf */
unsigned char fail;
unsigned char zero_conversions = 1;
diff --git a/libc/stdio/_stdio.c b/libc/stdio/_stdio.c
index 388a2117c..ee247a5fd 100644
--- a/libc/stdio/_stdio.c
+++ b/libc/stdio/_stdio.c
@@ -195,7 +195,6 @@ void _stdio_term(void)
* chain might be corrupt due to a partial store.
*/
STDIO_INIT_MUTEX(_stdio_openlist_add_lock);
-#warning check
#ifdef __STDIO_BUFFERS
STDIO_INIT_MUTEX(_stdio_openlist_del_lock);
#endif
diff --git a/libc/stdio/fflush.c b/libc/stdio/fflush.c
index d9104a42f..cf0356a38 100644
--- a/libc/stdio/fflush.c
+++ b/libc/stdio/fflush.c
@@ -97,8 +97,6 @@ int fflush_unlocked(register FILE *stream)
while(stream) {
/* We only care about currently writing streams and do not want to
* block trying to obtain mutexes on non-writing streams. */
-#warning fix for nonatomic
-#warning unnecessary check if no threads
if (__STDIO_STREAM_IS_WRITING(stream)) { /* ONLY IF ATOMIC!!! */
__MY_STDIO_THREADLOCK(stream);
/* Need to check again once we have the lock. */
diff --git a/libc/stdio/popen.c b/libc/stdio/popen.c
index 40a6ddac1..e1b1d4038 100644
--- a/libc/stdio/popen.c
+++ b/libc/stdio/popen.c
@@ -124,8 +124,6 @@ FILE *popen(const char *command, const char *modes)
return NULL;
}
-#warning is pclose correct wrt the new mutex semantics?
-
int pclose(FILE *stream)
{
struct popen_list_item *p;
diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c
index 3ef9a8b1c..8a6734db7 100644
--- a/libc/stdlib/system.c
+++ b/libc/stdlib/system.c
@@ -20,11 +20,7 @@
extern __typeof(system) __libc_system;
#if !defined __UCLIBC_HAS_THREADS_NATIVE__
-/* uClinux-2.0 has vfork, but Linux 2.0 doesn't */
#include <sys/syscall.h>
-#ifndef __NR_vfork
-# define vfork fork
-#endif
int __libc_system(const char *command)
{
@@ -91,9 +87,6 @@ libc_hidden_proto(waitpid)
#elif defined __sparc__
# define FORK() \
INLINE_CLONE_SYSCALL (CLONE_PARENT_SETTID | SIGCHLD, 0, &pid, NULL, NULL)
-#elif defined __s390__
-# define FORK() \
- INLINE_SYSCALL (clone, 3, 0, CLONE_PARENT_SETTID | SIGCHLD, &pid)
#else
# define FORK() \
INLINE_SYSCALL (clone, 3, CLONE_PARENT_SETTID | SIGCHLD, 0, &pid)
diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
index 03cd10e62..29045ef7b 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -19,12 +19,17 @@
/* clone() is even more special than fork() as it mucks with stacks
and invokes a function in the right context after its all over. */
+#include <sysdep.h>
#define _ERRNO_H
#include <features.h>
#include <bits/errno.h>
#include <sys/syscall.h>
#include <bits/arm_asm.h>
#include <bits/arm_bx.h>
+#include <sysdep-cancel.h>
+
+#define CLONE_VM 0x00000100
+#define CLONE_THREAD 0x00010000
#if defined(__NR_clone)
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
@@ -87,6 +92,8 @@ __error:
.pool
#else
__clone:
+.fnstart
+.cantunwind
@ sanity check args
cmp r0, #0
IT(te, ne)
@@ -95,32 +102,58 @@ __clone:
beq __error
@ 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]
+ str r3, [r1, #-4]!
+ str r0, [r1, #-4]!
@ do the system call
@ get flags
mov r0, r2
+#ifdef RESET_PID
+ mov ip, r2
+#endif
@ new sp is already in r1
- @ load remaining arguments off the stack
- stmfd sp!, {r4}
- ldr r2, [sp, #4]
- ldr r3, [sp, #8]
- ldr r4, [sp, #12]
- DO_CALL (clone)
- movs a1, a1
- IT(t, ne)
- ldmnefd sp!, {r4}
+ push {r4, r7}
+ cfi_adjust_cfa_offset (8)
+ cfi_rel_offset (r4, 0)
+ cfi_rel_offset (r7, 4)
+ ldr r2, [sp, #8]
+ ldr r3, [sp, #12]
+ ldr r4, [sp, #16]
+ ldr r7, =SYS_ify(clone)
+ swi 0x0
+ cfi_endproc
+ cmp r0, #0
+ beq 1f
+ pop {r4, r7}
blt __error
- IT(t, ne)
#if defined(__USE_BX__)
bxne lr
#else
movne pc, lr
#endif
+ cfi_startproc
+.fnend
+PSEUDO_END (__clone)
+
+1:
+ .fnstart
+ .cantunwind
+#ifdef RESET_PID
+ tst ip, #CLONE_THREAD
+ bne 3f
+ GET_TLS (lr)
+ mov r1, r0
+ tst ip, #CLONE_VM
+ ldr r7, =SYS_ify(getpid)
+ ite ne
+ movne r0, #-1
+ swieq 0x0
+ NEGOFF_ADJ_BASE (r1, TID_OFFSET)
+ str r0, NEGOFF_OFF1 (r1, TID_OFFSET)
+ str r0, NEGOFF_OFF2 (r1, PID_OFFSET, TID_OFFSET)
+3:
+#endif
@ pick the function arg and call address off the stack and execute
ldr r0, [sp, #4]
mov lr, pc
diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
index 64f40407e..2d0a9cc41 100644
--- a/libc/sysdeps/linux/arm/sysdep.h
+++ b/libc/sysdeps/linux/arm/sysdep.h
@@ -213,6 +213,42 @@ __local_syscall_error: \
sees the right arguments.
*/
+#if __ARM_ARCH > 6 || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
+# define ARCH_HAS_HARD_TP
+#endif
+
+# ifdef __thumb2__
+# define NEGOFF_ADJ_BASE(R, OFF) add R, R, $OFF
+# define NEGOFF_ADJ_BASE2(D, S, OFF) add D, S, $OFF
+# define NEGOFF_OFF1(R, OFF) [R]
+# define NEGOFF_OFF2(R, OFFA, OFFB) [R, $((OFFA) - (OFFB))]
+# else
+# define NEGOFF_ADJ_BASE(R, OFF)
+# define NEGOFF_ADJ_BASE2(D, S, OFF) mov D, S
+# define NEGOFF_OFF1(R, OFF) [R, $OFF]
+# define NEGOFF_OFF2(R, OFFA, OFFB) [R, $OFFA]
+# endif
+
+# ifdef ARCH_HAS_HARD_TP
+/* If the cpu has cp15 available, use it. */
+# define GET_TLS(TMP) mrc p15, 0, r0, c13, c0, 3
+# else
+/* At this generic level we have no tricks to pull. Call the ABI routine. */
+# define GET_TLS(TMP) \
+ push { r1, r2, r3, lr }; \
+ cfi_remember_state; \
+ cfi_adjust_cfa_offset (16); \
+ cfi_rel_offset (r1, 0); \
+ cfi_rel_offset (r2, 4); \
+ cfi_rel_offset (r3, 8); \
+ cfi_rel_offset (lr, 12); \
+ bl __aeabi_read_tp; \
+ pop { r1, r2, r3, lr }; \
+ cfi_restore_state
+# endif /* ARCH_HAS_HARD_TP */
+
+
+
#undef DO_CALL
#if defined(__ARM_EABI__)
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index a175ab64c..9d41771e2 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -25,6 +25,8 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
capset.c \
dup3.c \
eventfd.c \
+ eventfd_read.c \
+ eventfd_write.c \
inotify.c \
ioperm.c \
iopl.c \
diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h b/libc/sysdeps/linux/common/bits/mathcalls.h
index 84b793c96..427027355 100644
--- a/libc/sysdeps/linux/common/bits/mathcalls.h
+++ b/libc/sysdeps/linux/common/bits/mathcalls.h
@@ -271,7 +271,9 @@ __END_NAMESPACE_C99
#ifdef __USE_ISOC99
__BEGIN_NAMESPACE_C99
/* True gamma function. */
+# ifndef _Mdouble_is_float_
__MATHCALLI (tgamma,, (_Mdouble_))
+# endif
__END_NAMESPACE_C99
#endif
@@ -299,7 +301,9 @@ __MATHCALLI (rint,, (_Mdouble_ __x))
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__))
# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
+# ifndef _Mdouble_is_float_
__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__))
+# endif
# endif
/* Return the remainder of integer divison X / Y with infinite precision. */
@@ -316,11 +320,15 @@ __MATHDECLI (int,ilogb,, (_Mdouble_ __x))
#ifdef __USE_ISOC99
/* Return X times (2 to the Nth power). */
+# ifndef _Mdouble_is_float_
__MATHCALLI (scalbln,, (_Mdouble_ __x, long int __n))
+# endif
/* Round X to integral value in floating-point format using current
rounding direction, but do not raise inexact exception. */
+# ifndef _Mdouble_is_float_
__MATHCALLI (nearbyint,, (_Mdouble_ __x))
+# endif
/* Round X to nearest integral value, rounding halfway cases away from
zero. */
@@ -333,7 +341,9 @@ __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__))
/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
and magnitude congruent `mod 2^n' to the magnitude of the integral
quotient x/y, with n >= 3. */
+# ifndef _Mdouble_is_float_
__MATHCALLI (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo))
+# endif
/* Conversion functions. */
@@ -350,13 +360,19 @@ __MATHDECLI (long long int,llround,, (_Mdouble_ __x))
/* Return positive difference between X and Y. */
+# ifndef _Mdouble_is_float_
__MATHCALLI (fdim,, (_Mdouble_ __x, _Mdouble_ __y))
+# endif
/* Return maximum numeric value from X and Y. */
+# ifndef _Mdouble_is_float_
__MATHCALLI (fmax,, (_Mdouble_ __x, _Mdouble_ __y))
+# endif
/* Return minimum numeric value from X and Y. */
+# ifndef _Mdouble_is_float_
__MATHCALLI (fmin,, (_Mdouble_ __x, _Mdouble_ __y))
+# endif
/* Classify given number. */
@@ -367,7 +383,9 @@ __MATHDECL_PRIV (int, signbit,, (_Mdouble_ __value), (__const__))
/* Multiply-add function computed as a ternary operation. */
+# ifndef _Mdouble_is_float_
__MATHCALLI (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z))
+# endif
#endif /* Use ISO C99. */
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
diff --git a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h
index bbea1ae9d..b7dcee1d3 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_fpmax.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_fpmax.h
@@ -68,10 +68,6 @@ typedef float __fpmax_t;
#ifndef DECIMAL_DIG
-#ifdef L___strtofpmax
-/* Emit warning only once. */
-#warning DECIMAL_DIG is not defined! If you are using gcc, it may not be defining __STDC_VERSION__ as it should.
-#endif
#if !defined(FLT_RADIX) || (FLT_RADIX != 2)
#error unable to compensate for missing DECIMAL_DIG!
#endif
diff --git a/libc/sysdeps/linux/common/eventfd_read.c b/libc/sysdeps/linux/common/eventfd_read.c
new file mode 100644
index 000000000..75f2aaa11
--- /dev/null
+++ b/libc/sysdeps/linux/common/eventfd_read.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 2007-2014 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/eventfd.h>
+
+
+int
+eventfd_read (int fd, eventfd_t *value)
+{
+ return read (fd, value, sizeof (eventfd_t)) != sizeof (eventfd_t) ? -1 : 0;
+}
diff --git a/libc/sysdeps/linux/common/eventfd_write.c b/libc/sysdeps/linux/common/eventfd_write.c
new file mode 100644
index 000000000..e1509cf5c
--- /dev/null
+++ b/libc/sysdeps/linux/common/eventfd_write.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2007-2014 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/eventfd.h>
+
+
+int
+eventfd_write (int fd, eventfd_t value)
+{
+ return write (fd, &value,
+ sizeof (eventfd_t)) != sizeof (eventfd_t) ? -1 : 0;
+}
diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c
index 015f57d13..711521a6a 100644
--- a/libc/sysdeps/linux/common/fstatat64.c
+++ b/libc/sysdeps/linux/common/fstatat64.c
@@ -10,10 +10,18 @@
#include <bits/wordsize.h>
#include <sys/syscall.h>
+#if defined __mips__
+# include <sgidefs.h>
+#endif
+
/* 64bit ports tend to favor newfstatat() */
#if __WORDSIZE == 64 && defined __NR_newfstatat
# define __NR_fstatat64 __NR_newfstatat
#endif
+/* mips N32 ABI use newfstatat(), too */
+#if defined __mips__ && _MIPS_SIM == _ABIN32
+# define __NR_fstatat64 __NR_newfstatat
+#endif
#ifdef __NR_fstatat64
# include <sys/stat.h>
diff --git a/libc/sysdeps/linux/common/sys/eventfd.h b/libc/sysdeps/linux/common/sys/eventfd.h
index 1bf785f32..91b265b2c 100644
--- a/libc/sysdeps/linux/common/sys/eventfd.h
+++ b/libc/sysdeps/linux/common/sys/eventfd.h
@@ -33,16 +33,12 @@ __BEGIN_DECLS
value to COUNT. */
extern int eventfd (int __count, int __flags) __THROW;
-#if 0 /* not (yet) implemented in uClibc */
-
/* Read event counter and possibly wait for events. */
extern int eventfd_read (int __fd, eventfd_t *__value);
/* Increment event counter. */
extern int eventfd_write (int __fd, eventfd_t __value);
-#endif
-
__END_DECLS
#endif /* sys/eventfd.h */
diff --git a/libc/sysdeps/linux/cris/sys/procfs.h b/libc/sysdeps/linux/cris/sys/procfs.h
index d4ee05134..65b57ba4e 100644
--- a/libc/sysdeps/linux/cris/sys/procfs.h
+++ b/libc/sysdeps/linux/cris/sys/procfs.h
@@ -28,10 +28,14 @@
#include <sys/types.h>
#include <sys/ucontext.h>
#include <sys/user.h>
-#include <asm/elf.h>
__BEGIN_DECLS
+typedef unsigned long elf_greg_t;
+
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
struct elf_siginfo
{
int si_signo; /* Signal number. */
diff --git a/libc/sysdeps/linux/cris/sysdep.S b/libc/sysdeps/linux/cris/sysdep.S
index 8f25fb722..a23bb260f 100644
--- a/libc/sysdeps/linux/cris/sysdep.S
+++ b/libc/sysdeps/linux/cris/sysdep.S
@@ -35,7 +35,7 @@ ENTRY (__syscall_error)
/* Note that __syscall_error is only visible within this library,
and no-one passes it on as a pointer, so can assume that R0 (GOT
pointer) is correctly set up. */
- PLTCALL (HIDDEN_JUMPTARGET(__errno_location))
+ PLTCALL (__errno_location)
move [sp+],srp
move.d [sp+],r11
diff --git a/libc/sysdeps/linux/m68k/sys/reg.h b/libc/sysdeps/linux/m68k/sys/reg.h
deleted file mode 100644
index 984898100..000000000
--- a/libc/sysdeps/linux/m68k/sys/reg.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright (C) 1998 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, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _SYS_REG_H
-#define _SYS_REG_H 1
-
-/* Index into an array of 4 byte integers returned from ptrace for
- location of the users' stored general purpose registers. */
-
-enum
-{
- PT_D1 = 0,
-#define PT_D1 PT_D1
- PT_D2 = 1,
-#define PT_D2 PT_D2
- PT_D3 = 2,
-#define PT_D3 PT_D3
- PT_D4 = 3,
-#define PT_D4 PT_D4
- PT_D5 = 4,
-#define PT_D5 PT_D5
- PT_D6 = 5,
-#define PT_D6 PT_D6
- PT_D7 = 6,
-#define PT_D7 PT_D7
- PT_A0 = 7,
-#define PT_A0 PT_A0
- PT_A1 = 8,
-#define PT_A1 PT_A1
- PT_A2 = 9,
-#define PT_A2 PT_A2
- PT_A3 = 10,
-#define PT_A3 PT_A3
- PT_A4 = 11,
-#define PT_A4 PT_A4
- PT_A5 = 12,
-#define PT_A5 PT_A5
- PT_A6 = 13,
-#define PT_A6 PT_A6
- PT_D0 = 14,
-#define PT_D0 PT_D0
- PT_USP = 15,
-#define PT_USP PT_USP
- PT_ORIG_D0 = 16,
-#define PT_ORIG_D0 PT_ORIG_D0
- PT_SR = 17,
-#define PT_SR PT_SR
- PT_PC = 18,
-#define PT_PC PT_PC
- PT_FP0 = 21,
-#define PT_FP0 PT_FP0
- PT_FP1 = 24,
-#define PT_FP1 PT_FP1
- PT_FP2 = 27,
-#define PT_FP2 PT_FP2
- PT_FP3 = 30,
-#define PT_FP3 PT_FP3
- PT_FP4 = 33,
-#define PT_FP4 PT_FP4
- PT_FP5 = 36,
-#define PT_FP5 PT_FP5
- PT_FP6 = 39,
-#define PT_FP6 PT_FP6
- PT_FP7 = 42,
-#define PT_FP7 PT_FP7
- PT_FPCR = 45,
-#define PT_FPCR PT_FPCR
- PT_FPSR = 46,
-#define PT_FPSR PT_FPSR
- PT_FPIAR = 47
-#define PT_FPIAR PT_FPIAR
-};
-
-#endif /* _SYS_REG_H */
diff --git a/libc/sysdeps/linux/microblaze/bits/uClibc_page.h b/libc/sysdeps/linux/microblaze/bits/uClibc_page.h
index 8069e6afb..9335d8eb7 100644
--- a/libc/sysdeps/linux/microblaze/bits/uClibc_page.h
+++ b/libc/sysdeps/linux/microblaze/bits/uClibc_page.h
@@ -20,7 +20,7 @@
#ifndef _UCLIBC_PAGE_H
#define _UCLIBC_PAGE_H
-#include <linux/autoconf.h>
+#include <generated/autoconf.h>
#if defined(CONFIG_MICROBLAZE_32K_PAGES)
#define PAGE_SHIFT 15
diff --git a/libc/sysdeps/linux/xtensa/Makefile.arch b/libc/sysdeps/linux/xtensa/Makefile.arch
index 277a1e325..b9b6b87d5 100644
--- a/libc/sysdeps/linux/xtensa/Makefile.arch
+++ b/libc/sysdeps/linux/xtensa/Makefile.arch
@@ -5,7 +5,10 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC-y := brk.c fork.c sigaction.c __syscall_error.c
+CSRC-y := brk.c sigaction.c __syscall_error.c
SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S \
sigrestorer.S syscall.S mmap.S windowspill.S __longjmp.S vfork.S
+
+CSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += fork.c
+SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S
diff --git a/libc/sysdeps/linux/xtensa/clone.S b/libc/sysdeps/linux/xtensa/clone.S
index aa79aa736..34d68a875 100644
--- a/libc/sysdeps/linux/xtensa/clone.S
+++ b/libc/sysdeps/linux/xtensa/clone.S
@@ -1,34 +1,38 @@
-/* Copyright (C) 2001, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2005 Free Software Foundation, Inc.
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.
+ 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
- Lesser General Public License for more details.
+ Library 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, see
- <http://www.gnu.org/licenses/>. */
+ 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. */
/* clone is even more special than fork as it mucks with stacks
- and invokes a function in the right context after it's all over. */
+ and invokes a function in the right context after its all over. */
-#include "sysdep.h"
-#include <sys/syscall.h>
+#include <features.h>
+#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
+#ifdef RESET_PID
+#include <tls.h>
+#endif
+#define __ASSEMBLY__
+#include <linux/sched.h>
-/* int clone (a2 = int (*fn)(void *arg),
- a3 = void *child_stack,
- a4 = int flags,
- a5 = void *arg,
- a6 = pid_t *ptid,
- a7 = struct user_desc *tls,
- 16(sp) = pid_t *ctid) */
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
+ a2 a3 a4 a5
+ pid_t *ptid, struct user_desc *tls, pid_t *ctid)
+ a6 a7 16(sp)
+*/
.text
ENTRY (__clone)
@@ -39,7 +43,7 @@ ENTRY (__clone)
/* a2 and a3 are candidates for destruction by system-call return
parameters. We don't need the stack pointer after the system
- call. We trust that the kernel will preserve a7, a9, and a6. */
+ call. We trust that the kernel will preserve a6, a7 and a9. */
mov a9, a5 /* save function argument */
mov a5, a7
@@ -48,19 +52,18 @@ ENTRY (__clone)
mov a6, a4
mov a4, a8
l32i a8, a1, 16 /* child_tid */
- movi a2, SYS_ify (clone)
-
- /* syscall (a2 = NR_clone,
- a6 = clone_flags,
- a3 = usp,
- a4 = parent_tid,
- a5 = child_tls,
- a8 = child_tid) */
+ movi a2, SYS_ify(clone)
+
+ /* syscall(NR_clone,clone_flags, usp, parent_tid, child_tls, child_tid)
+ a2 a6 a3 a4 a5 a8
+ */
+
syscall
bltz a2, SYSCALL_ERROR_LABEL
beqz a2, .Lthread_start
- /* Fall through for parent. */
+ /* fall through for parent */
+
.Lpseudo_end:
retw
@@ -69,32 +72,38 @@ ENTRY (__clone)
j SYSCALL_ERROR_LABEL
.Lthread_start: