summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/c6x/bits
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2011-04-06 15:13:59 +0200
committerCarmelo Amoroso <carmelo.amoroso@st.com>2011-04-06 15:13:59 +0200
commit3b3285b1b7c02d36c74a6ae265fdb02ca991c96b (patch)
tree0f3bf060794323ff690f6f4a86dc903c4570f540 /libc/sysdeps/linux/c6x/bits
parent289d19f45d7f8af9a4079938a3426aafdd2674ba (diff)
parent85f4b028d767fc390a7b866d2f58d58be489242d (diff)
Merge remote-tracking branch 'origin/master' into prelink
* origin/master: (137 commits) utils/ldd: Check for returned pointer from strrchr not the value it holds cris: add provide arch-specific vfork implementation lutimes.c, stubs.c: fix compiling lutimes, if __NR_utimensat is not defined bump version to 0.9.32-rc3-git release 0.9.32-rc3 memalign: include sys/param.h for MAX arm/bits/atomic.h: Include common/bit/atomic.h for thumb1 wctype.h: fix libc_hidden_proto for iswupper and add it for iswspace add libc_hidden_proto for wcs[n]casecmp_l really fix missing __libc_drand48_data Revert "missing prototype of __libc_drand48_data fixed" missing prototype of __libc_drand48_data fixed time.c, time.h: remove unused hidden strftime/strptime nanosleep.c: remove duplicated libc_hidden_proto ctype.c, ctype.h: remove commented parts that were banned for removal after 0.9.31 _wctype.c, wctype.h: remove unused isw* and wctype_l hidden functions time.c, wchar.h: remove unused hidden wcsftime str[n]casecmp.c: fix hidden usage remove unused hidden functions frv/memset.S: add missing libc_hidden_def ... Conflicts: ldso/ldso/ldso.c Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/sysdeps/linux/c6x/bits')
-rw-r--r--libc/sysdeps/linux/c6x/bits/byteswap.h35
-rw-r--r--libc/sysdeps/linux/c6x/bits/elf-dsbt.h123
-rw-r--r--libc/sysdeps/linux/c6x/bits/endian.h11
-rw-r--r--libc/sysdeps/linux/c6x/bits/fcntl.h235
-rw-r--r--libc/sysdeps/linux/c6x/bits/kernel_stat.h49
-rw-r--r--libc/sysdeps/linux/c6x/bits/kernel_types.h46
-rw-r--r--libc/sysdeps/linux/c6x/bits/mathdef.h39
-rw-r--r--libc/sysdeps/linux/c6x/bits/nan.h57
-rw-r--r--libc/sysdeps/linux/c6x/bits/poll.h43
-rw-r--r--libc/sysdeps/linux/c6x/bits/resource.h209
-rw-r--r--libc/sysdeps/linux/c6x/bits/setjmp.h39
-rw-r--r--libc/sysdeps/linux/c6x/bits/sigcontextinfo.h26
-rw-r--r--libc/sysdeps/linux/c6x/bits/stackinfo.h28
-rw-r--r--libc/sysdeps/linux/c6x/bits/syscalls.h183
-rw-r--r--libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h48
-rw-r--r--libc/sysdeps/linux/c6x/bits/wordsize.h19
16 files changed, 1190 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/c6x/bits/byteswap.h b/libc/sysdeps/linux/c6x/bits/byteswap.h
new file mode 100644
index 000000000..eff26d54e
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/byteswap.h
@@ -0,0 +1,35 @@
+/*
+ * Port of uClibc for TMS320C6000 DSP architecture
+ * Copyright (C) 2004 Texas Instruments Incorporated
+ * Author of TMS320C6000 port: Aurelien Jacquiot
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef _ASM_BITS_BYTESWAP_H
+#define _ASM_BITS_BYTESWAP_H 1
+
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+#endif
+
+#ifdef __GNUC__
+#define __bswap_non_constant_32(x) __builtin_bswap32(x)
+#endif
+
+#include <bits/byteswap-common.h>
+
+#endif
diff --git a/libc/sysdeps/linux/c6x/bits/elf-dsbt.h b/libc/sysdeps/linux/c6x/bits/elf-dsbt.h
new file mode 100644
index 000000000..ff8b24bd7
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/elf-dsbt.h
@@ -0,0 +1,123 @@
+/* Copyright (C) 2010 Texas Instruments Incorporated
+
+Borrowed heavily from frv arch:
+Copyright 2003, 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.
+
+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.)
+
+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 Lesser General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifndef _BITS_ELF_DSBT_H
+#define _BITS_ELF_DSBT_H
+
+/* These data structures are described in the DSBT ABI.
+ The kernel passes a process a memory map of logical
+ load segments. For PIC code to work, all code segments
+ must be combined into a single mapping while maintaining
+ their relationship to one another. The same is true for
+ RW data segments.
+
+ Furthermore,
+ segment there is an elf32_dsbt_loadseg entry. A pointer to an
+ elf32_dsbt_loadmap is passed in GR8 at start-up, and a pointer to
+ an additional such map is passed in GR9 for the interpreter, when
+ there is one. */
+
+#include <elf.h>
+
+/* This data structure represents a PT_LOAD segment. */
+struct elf32_dsbt_loadseg
+{
+ /* Core address to which the segment is mapped. */
+ Elf32_Addr addr;
+ /* VMA recorded in the program header. */
+ Elf32_Addr p_vaddr;
+ /* Size of this segment in memory. */
+ Elf32_Word p_memsz;
+};
+
+struct elf32_dsbt_loadmap {
+ /* Protocol version number, must be zero. */
+ Elf32_Word version;
+
+ /* Pointer to DSBT */
+ unsigned *dsbt_table;
+ unsigned dsbt_size;
+ unsigned dsbt_index;
+
+ /* number of segments */
+ Elf32_Word nsegs;
+
+ /* The actual memory map. */
+ struct elf32_dsbt_loadseg segs[0];
+};
+
+struct elf32_dsbt_loadaddr {
+ struct elf32_dsbt_loadmap *map;
+};
+
+
+/* Map a pointer's VMA to its corresponding address according to the
+ load map. */
+static __always_inline void *
+__reloc_pointer (void *p,
+ const struct elf32_dsbt_loadmap *map)
+{
+ int c;
+
+#if 0
+ if (map->version != 0)
+ /* Crash. */
+ ((void(*)())0)();
+#endif
+
+ /* No special provision is made for NULL. We don't want NULL
+ addresses to go through relocation, so they shouldn't be in
+ .rofixup sections, and, if they're present in dynamic
+ relocations, they shall be mapped to the NULL address without
+ undergoing relocations. */
+
+ for (c = 0; c < map->nsegs; c++)
+ {
+ unsigned long offset = p - (void*)map->segs[c].p_vaddr;
+ /* We only check for one-past-the-end for the second segment,
+ assumed to be the data segment, because other cases are
+ ambiguous in the absence of padding between segments, and
+ rofixup already serves as padding between text and data.
+ Unfortunately, unless we special-case the second segment,
+ we fail to relocate the _end symbol. */
+ if (offset < map->segs[c].p_memsz
+ || (offset == map->segs[c].p_memsz && c == 1))
+ return (char*)map->segs[c].addr + offset;
+ }
+
+ /* We might want to crash instead. */
+ return (void*)-1;
+}
+
+# define __RELOC_POINTER(ptr, loadaddr) \
+ (__reloc_pointer ((void*)(ptr), \
+ (loadaddr).map))
+
+#endif /* _BITS_ELF_DSBT_H */
diff --git a/libc/sysdeps/linux/c6x/bits/endian.h b/libc/sysdeps/linux/c6x/bits/endian.h
new file mode 100644
index 000000000..7297f9e2e
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/endian.h
@@ -0,0 +1,11 @@
+/* c6x is little-endian by default. */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#ifdef _BIG_ENDIAN
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/libc/sysdeps/linux/c6x/bits/fcntl.h b/libc/sysdeps/linux/c6x/bits/fcntl.h
new file mode 100644
index 000000000..6c0d5647f
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/fcntl.h
@@ -0,0 +1,235 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ Copyright (C) 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 _FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+
+#include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#define O_CREAT 0100 /* not fcntl */
+#define O_EXCL 0200 /* not fcntl */
+#define O_NOCTTY 0400 /* not fcntl */
+#define O_TRUNC 01000 /* not fcntl */
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_NDELAY O_NONBLOCK
+#define O_SYNC 010000
+#define O_FSYNC O_SYNC
+#define O_ASYNC 020000
+#define O_DIRECT 040000
+
+#ifdef __USE_GNU
+# define O_LARGEFILE 0100000
+# define O_DIRECTORY 0200000 /* Must be a directory. */
+# define O_NOFOLLOW 0400000 /* don't follow links */
+# define O_NOATIME 01000000
+# define O_CLOEXEC 02000000/* set close on exec */
+#endif
+
+/* For now Linux has synchronisity options for data and read operations.
+ We define the symbols here but let them do the same as O_SYNC since
+ this is a superset. */
+#if defined __USE_POSIX199309 || defined __USE_UNIX98
+# define O_DSYNC O_SYNC /* Synchronize data. */
+# define O_RSYNC O_SYNC /* Synchronize read operations. */
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE 0100000
+#endif
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#ifndef __USE_FILE_OFFSET64
+# define F_GETLK 5 /* Get record locking info. */
+# define F_SETLK 6 /* Set record locking info (non-blocking). */
+# define F_SETLKW 7 /* Set record locking info (blocking). */
+#else
+# define F_GETLK F_GETLK64 /* Get record locking info. */
+# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
+# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
+#endif
+#define F_GETLK64 12 /* Get record locking info. */
+#define F_SETLK64 13 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 14 /* Set record locking info (blocking). */
+
+#if defined __USE_BSD || defined __USE_XOPEN2K
+# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
+# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETSIG 10 /* Set number of signal to be sent. */
+# 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. */
+#endif
+
+/* For F_[GET|SET]FL. */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
+#define F_RDLCK 0 /* Read lock. */
+#define F_WRLCK 1 /* Write lock. */
+#define F_UNLCK 2 /* Remove lock. */
+
+/* For old implementation of bsd flock(). */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+#ifdef __USE_BSD
+/* Operations for bsd flock(), also used by the kernel implementation. */
+# define LOCK_SH 1 /* shared lock */
+# define LOCK_EX 2 /* exclusive lock */
+# define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+# define LOCK_UN 8 /* remove lock */
+#endif
+
+#ifdef __USE_GNU
+# define LOCK_MAND 32 /* This is a mandatory flock: */
+# define LOCK_READ 64 /* ... which allows concurrent read operations. */
+# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
+# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
+#endif
+
+#ifdef __USE_GNU
+/* Types of directory notifications that may be requested with F_NOTIFY. */
+# define DN_ACCESS 0x00000001 /* File accessed. */
+# define DN_MODIFY 0x00000002 /* File modified. */
+# define DN_CREATE 0x00000004 /* File created. */
+# define DN_DELETE 0x00000008 /* File removed. */
+# define DN_RENAME 0x00000010 /* File renamed. */
+# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
+# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
+#endif
+
+struct flock
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+#ifndef __USE_FILE_OFFSET64
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+#endif
+
+/* Define some more compatibility macros to be backward compatible with
+ BSD systems which did not managed to hide these kernel macros. */
+#ifdef __USE_BSD
+# define FAPPEND O_APPEND
+# define FFSYNC O_FSYNC
+# define FASYNC O_ASYNC
+# define FNONBLOCK O_NONBLOCK
+# define FNDELAY O_NDELAY
+#endif /* Use BSD. */
+
+/* Advise to `posix_fadvise'. */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
+# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
+#endif
+
+#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
+/* 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. */
+
+/* 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
+
+#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __THROW;
+
+
+/* Selective file content synch'ing. */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+ unsigned int __flags);
+
+/* 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/c6x/bits/kernel_stat.h b/libc/sysdeps/linux/c6x/bits/kernel_stat.h
new file mode 100644
index 000000000..f8381c703
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/kernel_stat.h
@@ -0,0 +1,49 @@
+#ifndef _BITS_STAT_STRUCT_H
+#define _BITS_STAT_STRUCT_H
+
+/* This file provides whatever this particular arch's kernel thinks
+ * struct kernel_stat should look like... It turns out each arch has a
+ * different opinion on the subject... */
+
+struct kernel_stat {
+ unsigned long st_dev; /* Device. */
+ unsigned long st_ino; /* File serial number. */
+ unsigned int st_mode; /* File mode. */
+ unsigned int st_nlink; /* Link count. */
+ unsigned int st_uid; /* User ID of the file's owner. */
+ unsigned int st_gid; /* Group ID of the file's group. */
+ unsigned long st_rdev; /* Device number, if device. */
+ unsigned long __pad1;
+ long st_size; /* Size of file, in bytes. */
+ int st_blksize; /* Optimal block size for I/O. */
+ int __pad2;
+ long st_blocks; /* Number 512-byte blocks allocated. */
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ unsigned int __unused4;
+ unsigned int __unused5;
+};
+
+struct kernel_stat64 {
+ unsigned long long st_dev; /* Device. */
+ unsigned long long st_ino; /* File serial number. */
+ unsigned int st_mode; /* File mode. */
+ unsigned int st_nlink; /* Link count. */
+ unsigned int st_uid; /* User ID of the file's owner. */
+ unsigned int st_gid; /* Group ID of the file's group. */
+ unsigned long long st_rdev; /* Device number, if device. */
+ unsigned long long __pad1;
+ long long st_size; /* Size of file, in bytes. */
+ int st_blksize; /* Optimal block size for I/O. */
+ int __pad2;
+ long long st_blocks; /* Number 512-byte blocks allocated. */
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ unsigned int __unused4;
+ unsigned int __unused5;
+};
+
+#endif /* _BITS_STAT_STRUCT_H */
+
diff --git a/libc/sysdeps/linux/c6x/bits/kernel_types.h b/libc/sysdeps/linux/c6x/bits/kernel_types.h
new file mode 100644
index 000000000..755730959
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/kernel_types.h
@@ -0,0 +1,46 @@
+/* Note that we use the exact same include guard #define names
+ * as asm/posix_types.h. This will avoid gratuitous conflicts
+ * with the posix_types.h kernel header, and will ensure that
+ * our private content, and not the kernel header, will win.
+ * -Erik
+ */
+#ifndef __ASM_GENERIC_POSIX_TYPES_H
+#define __ASM_GENERIC_POSIX_TYPES_H
+
+typedef unsigned int __kernel_dev_t;
+typedef unsigned long __kernel_ino_t;
+typedef unsigned int __kernel_mode_t;
+typedef unsigned long __kernel_nlink_t;
+typedef int __kernel_pid_t;
+typedef int __kernel_ipc_pid_t;
+typedef unsigned int __kernel_uid_t;
+typedef unsigned int __kernel_gid_t;
+typedef long __kernel_suseconds_t;
+typedef int __kernel_daddr_t;
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+typedef unsigned int __kernel_old_uid_t;
+typedef unsigned int __kernel_old_gid_t;
+typedef unsigned int __kernel_old_dev_t;
+typedef unsigned int __kernel_size_t;
+typedef int __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+typedef long __kernel_off_t;
+typedef long long __kernel_loff_t;
+typedef long __kernel_time_t;
+typedef long __kernel_clock_t;
+typedef int __kernel_timer_t;
+typedef int __kernel_clockid_t;
+typedef char * __kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+
+typedef struct {
+#ifdef __USE_ALL
+ int val[2];
+#else
+ int __val[2];
+#endif
+} __kernel_fsid_t;
+
+#endif /* __ASM_GENERIC_POSIX_TYPES_H */
diff --git a/libc/sysdeps/linux/c6x/bits/mathdef.h b/libc/sysdeps/linux/c6x/bits/mathdef.h
new file mode 100644
index 000000000..df12adf03
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/mathdef.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 1997, 1998, 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. */
+
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF 1
+
+typedef float float_t;
+typedef double double_t;
+
+/* The values returned by `ilogb' for 0 and NaN respectively. */
+# define FP_ILOGB0 (-2147483647 - 1)
+# define FP_ILOGBNAN (2147483647)
+
+#endif /* ISO C99 */
+
+#ifndef __NO_LONG_DOUBLE_MATH
+/* Signal that we do not really have a `long double'. This disables the
+ declaration of all the `long double' function variants. */
+# define __NO_LONG_DOUBLE_MATH 1
+#endif
diff --git a/libc/sysdeps/linux/c6x/bits/nan.h b/libc/sysdeps/linux/c6x/bits/nan.h
new file mode 100644
index 000000000..85225da9f
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/nan.h
@@ -0,0 +1,57 @@
+/* `NAN' constant for IEEE 754 machines.
+ Copyright (C) 1992,1996,1997,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
+ 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 _MATH_H
+# error "Never use <bits/nan.h> directly; include <math.h> instead."
+#endif
+
+/* IEEE Not A Number. */
+
+/*
+ * Copied from the common code and modified for TI tool wrapper.
+ * Copyright (C) 2010 Texas Instruments Incorporated
+ */
+
+#if __GNUC_PREREQ(3,3)
+
+# define NAN (__builtin_nanf (""))
+
+#elif defined __GNUC__ && ! defined __TI_TOOL_WRAPPER__
+
+# define NAN \
+ (__extension__ \
+ ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \
+ { __l: 0x7fc00000UL }).__d)
+
+#else
+
+# include <endian.h>
+
+# if __BYTE_ORDER == __BIG_ENDIAN
+# define __nan_bytes { 0x7f, 0xc0, 0, 0 }
+# endif
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define __nan_bytes { 0, 0, 0xc0, 0x7f }
+# endif
+
+static union { unsigned char __c[4]; float __d; } __nan_union
+ = { __nan_bytes };
+# define NAN (__nan_union.__d)
+
+#endif /* GCC. */
diff --git a/libc/sysdeps/linux/c6x/bits/poll.h b/libc/sysdeps/linux/c6x/bits/poll.h
new file mode 100644
index 000000000..f7a739315
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/poll.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 1997, 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. */
+
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
+
+/* Event types that can be polled for. These bits may be set in `events'
+ to indicate the interesting event types; they will appear in `revents'
+ to indicate the status of the file descriptor. */
+#define POLLIN 0x001 /* There is data to read. */
+#define POLLPRI 0x002 /* There is urgent data to read. */
+#define POLLOUT 0x004 /* Writing now will not block. */
+
+#ifdef __USE_XOPEN
+/* These values are defined in XPG4.2. */
+# define POLLRDNORM 0x040 /* Normal data may be read. */
+# define POLLRDBAND 0x080 /* Priority data may be read. */
+# define POLLWRNORM POLLOUT /* Writing now will not block. */
+# define POLLWRBAND 0x100 /* Priority data may be written. */
+#endif
+
+/* Event types always implicitly polled for. These bits need not be set in
+ `events', but they will appear in `revents' to indicate the status of
+ the file descriptor. */
+#define POLLERR 0x008 /* Error condition. */
+#define POLLHUP 0x010 /* Hung up. */
+#define POLLNVAL 0x020 /* Invalid polling request. */
diff --git a/libc/sysdeps/linux/c6x/bits/resource.h b/libc/sysdeps/linux/c6x/bits/resource.h
new file mode 100644
index 000000000..57d17821e
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/resource.h
@@ -0,0 +1,209 @@
+/* Bit values & structures for resource limits. Linux/m68k version.
+ Copyright (C) 1994,1996,1997,1998,1999,2000,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. */
+
+#ifndef _SYS_RESOURCE_H
+# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Transmute defines to enumerations. The macro re-definitions are
+ necessary because some programs want to test for operating system
+ features with #ifdef RUSAGE_SELF. In ISO C the reflexive
+ definition is a no-op. */
+
+/* Kinds of resource limit. */
+enum __rlimit_resource
+{
+ /* Per-process CPU limit, in seconds. */
+ RLIMIT_CPU = 0,
+#define RLIMIT_CPU RLIMIT_CPU
+
+ /* Largest file that can be created, in bytes. */
+ RLIMIT_FSIZE = 1,
+#define RLIMIT_FSIZE RLIMIT_FSIZE
+
+ /* Maximum size of data segment, in bytes. */
+ RLIMIT_DATA = 2,
+#define RLIMIT_DATA RLIMIT_DATA
+
+ /* Maximum size of stack segment, in bytes. */
+ RLIMIT_STACK = 3,
+#define RLIMIT_STACK RLIMIT_STACK
+
+ /* Largest core file that can be created, in bytes. */
+ RLIMIT_CORE = 4,
+#define RLIMIT_CORE RLIMIT_CORE
+
+ /* Largest resident set size, in bytes.
+ This affects swapping; processes that are exceeding their
+ resident set size will be more likely to have physical memory
+ taken from them. */
+ RLIMIT_RSS = 5,
+#define RLIMIT_RSS RLIMIT_RSS
+
+ /* Number of open files. */
+ RLIMIT_NOFILE = 7,
+ RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */
+#define RLIMIT_NOFILE RLIMIT_NOFILE
+#define RLIMIT_OFILE RLIMIT_OFILE
+
+ /* Address space limit. */
+ RLIMIT_AS = 9,
+#define RLIMIT_AS RLIMIT_AS
+
+ /* Number of processes. */
+ RLIMIT_NPROC = 6,
+#define RLIMIT_NPROC RLIMIT_NPROC
+
+ /* Locked-in-memory address space. */
+ RLIMIT_MEMLOCK = 8,
+#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK
+
+ /* Maximum number of file locks. */
+ RLIMIT_LOCKS = 10,
+#define RLIMIT_LOCKS RLIMIT_LOCKS
+
+ RLIMIT_NLIMITS = 11,
+ RLIM_NLIMITS = RLIMIT_NLIMITS
+#define RLIMIT_NLIMITS RLIMIT_NLIMITS
+#define RLIM_NLIMITS RLIM_NLIMITS
+};
+
+/* Value to indicate that there is no limit. */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY ((unsigned long)(~0UL))
+#else
+# define RLIM_INFINITY 0xffffffffffffffffuLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0xffffffffffffffffuLL
+#endif
+
+/* We can represent all limits. */
+#define RLIM_SAVED_MAX RLIM_INFINITY
+#define RLIM_SAVED_CUR RLIM_INFINITY
+
+
+/* Type for resource quantity measurement. */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+#endif
+
+struct rlimit
+ {
+ /* The current (soft) limit. */
+ rlim_t rlim_cur;
+ /* The hard limit. */
+ rlim_t rlim_max;
+ };
+
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+ {
+ /* The current (soft) limit. */
+ rlim64_t rlim_cur;
+ /* The hard limit. */
+ rlim64_t rlim_max;
+ };
+#endif
+
+/* Whose usage statistics do you want? */
+enum __rusage_who
+{
+ /* The calling process. */
+ RUSAGE_SELF = 0,
+#define RUSAGE_SELF RUSAGE_SELF
+
+ /* All of its terminated child processes. */
+ RUSAGE_CHILDREN = -1,
+#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+
+ /* Both. */
+ RUSAGE_BOTH = -2
+#define RUSAGE_BOTH RUSAGE_BOTH
+};
+
+#define __need_timeval
+#include <bits/time.h> /* For `struct timeval'. */
+
+/* Structure which says how much of each resource has been used. */
+struct rusage
+ {
+ /* Total amount of user time used. */
+ struct timeval ru_utime;
+ /* Total amount of system time used. */
+ struct timeval ru_stime;
+ /* Maximum resident set size (in kilobytes). */
+ long ru_maxrss;
+ /* Amount of sharing of text segment memory
+ with other processes (kilobyte-seconds). */
+ long ru_ixrss;
+ /* Amount of data segment memory used (kilobyte-seconds). */
+ long ru_idrss;
+ /* Amount of stack memory used (kilobyte-seconds). */
+ long ru_isrss;
+ /* Number of soft page faults (i.e. those serviced by reclaiming
+ a page from the list of pages awaiting reallocation. */
+ long ru_minflt;
+ /* Number of hard page faults (i.e. those that required I/O). */
+ long ru_majflt;
+ /* Number of times a process was swapped out of physical memory. */
+ long ru_nswap;
+ /* Number of input operations via the file system. Note: This
+ and `ru_oublock' do not include operations with the cache. */
+ long ru_inblock;
+ /* Number of output operations via the file system. */
+ long ru_oublock;
+ /* Number of IPC messages sent. */
+ long ru_msgsnd;
+ /* Number of IPC messages received. */
+ long ru_msgrcv;
+ /* Number of signals delivered. */
+ long ru_nsignals;
+ /* Number of voluntary context switches, i.e. because the process
+ gave up the process before it had to (usually to wait for some
+ resource to be available). */
+ long ru_nvcsw;
+ /* Number of involuntary context switches, i.e. a higher priority process
+ became runnable or the current process used up its time slice. */
+ long ru_nivcsw;
+ };
+
+/* Priority limits. */
+#define PRIO_MIN -20 /* Minimum priority a process can have. */
+#define PRIO_MAX 20 /* Maximum priority a process can have. */
+
+/* The type of the WHICH argument to `getpriority' and `setpriority',
+ indicating what flavor of entity the WHO argument specifies. */
+enum __priority_which
+{
+ PRIO_PROCESS = 0, /* WHO is a process ID. */
+#define PRIO_PROCESS PRIO_PROCESS
+ PRIO_PGRP = 1, /* WHO is a process group ID. */
+#define PRIO_PGRP PRIO_PGRP
+ PRIO_USER = 2 /* WHO is a user ID. */
+#define PRIO_USER PRIO_USER
+};
diff --git a/libc/sysdeps/linux/c6x/bits/setjmp.h b/libc/sysdeps/linux/c6x/bits/setjmp.h
new file mode 100644
index 000000000..259e23b34
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/setjmp.h
@@ -0,0 +1,39 @@
+/*
+ * Port of uClibc for TMS320C6000 DSP architecture
+ * Copyright (C) 2004 Texas Instruments Incorporated
+ * Author of TMS320C6000 port: Aurelien Jacquiot
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+typedef struct {
+ unsigned long __regs[12]; /* save A10,B10... A15,B15*/
+ unsigned long __pc; /* the return address */
+} __jmp_buf[1];
+
+/* the stack pointer (B15) */
+#define JP_SP 11
+
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+ ((void *) (address) < (void *) (jmpbuf)->__regs[JP_SP])
+
+
diff --git a/libc/sysdeps/linux/c6x/bits/sigcontextinfo.h b/libc/sysdeps/linux/c6x/bits/sigcontextinfo.h
new file mode 100644
index 000000000..b7e08cfc9
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/sigcontextinfo.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>, 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. */
+
+#define SIGCONTEXT int _code, struct sigcontext *
+#define SIGCONTEXT_EXTRA_ARGS _code,
+#define GET_PC(ctx) ((void *) (ctx)->sc_pc)
+#define GET_FRAME(ctx) ((void *) __builtin_frame_address (1))
+#define GET_STACK(ctx) ((void *) (ctx)->sc_usp)
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/libc/sysdeps/linux/c6x/bits/stackinfo.h b/libc/sysdeps/linux/c6x/bits/stackinfo.h
new file mode 100644
index 000000000..9dbf06ae6
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/stackinfo.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999 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 c6x the stack grows down. */
+#define _STACK_GROWS_DOWN 1
+
+#endif /* stackinfo.h */
diff --git a/libc/sysdeps/linux/c6x/bits/syscalls.h b/libc/sysdeps/linux/c6x/bits/syscalls.h
new file mode 100644
index 000000000..56a1667c3
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/syscalls.h
@@ -0,0 +1,183 @@
+#ifndef _BITS_SYSCALLS_H
+#define _BITS_SYSCALLS_H
+#ifndef _SYSCALL_H
+# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
+#endif
+
+#ifndef __ASSEMBLER__
+
+#include <errno.h>
+
+#define SYS_ify(syscall_name) (__NR_##syscall_name)
+
+#undef __SYSCALL_STRING
+# define __SYSCALL_STRING \
+ "swe\n\t" \
+ "nop\n\t"
+
+# define __SYSCALL_RES_CHECK (__res < -255 || __res >= 0)
+
+#define __SYSCALL_CLOBBERS "cc", "memory"
+
+#define __SYSCALL_RETURN(type) \
+ if (__SYSCALL_RES_CHECK) \
+ return (type) __res; \
+ __set_errno (-__res); \
+ return (type) -1;
+
+#ifndef NOT_IN_libc
+#define DEBUG_SYSCALL(name) { \
+ char d[64];\
+ write( 2, d, snprintf( d, 64, "syscall %d error %d\n", __NR_##name, _inline_sys_result)); \
+}
+#else
+#define DEBUG_SYSCALL(name) do{} while(0)
+#endif
+
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+ ({ 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 (_inline_sys_result, )); \
+ _inline_sys_result = (unsigned int) -1; \
+ } \
+ (int) _inline_sys_result; })
+
+#undef INLINE_SYSCALL_NOERR
+#define INLINE_SYSCALL_NOERR(name, nr, args...) \
+ ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \
+ (int) _inline_sys_result; })
+
+#undef INTERNAL_SYSCALL_DECL
+#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
+
+
+#define INTERNAL_SYSCALL( name, err, nr, args...) \
+ INTERNAL_SYSCALL_NCS( __NR_##name, err, nr, args )
+
+
+#define INTERNAL_SYSCALL_NCS(sys_num, err, nr, args...) \
+ ({ \
+ register long __A4 __asm__("A4"); \
+ register long __b0 __asm__("B0") = sys_num; \
+ LOAD_ARGS_##nr(args) \
+ __asm__ __volatile__(__SYSCALL_STRING \
+ : "=a" (__A4) \
+ : "b" (__b0) ASM_ARGS_##nr \
+ : __SYSCALL_CLOBBERS ); \
+ (int)__A4; \
+ })
+
+#undef INTERNAL_SYSCALL_ERROR_P
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+ ((unsigned int) (val) >= 0xfffff001u)
+
+#undef INTERNAL_SYSCALL_ERRNO
+#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+
+#if 0
+# define CALL_ERRNO_LOCATION "call __errno_location;"
+#define __CLONE_SYSCALL_STRING \
+ "ta 0x10;" \
+ "bcs 2f;" \
+ " sub %%o1, 1, %%o1;" \
+ "and %%A4, %%o1, %%A4;" \
+ "1:" \
+ ".subsection 2;" \
+ "2:" \
+ "save %%sp, -192, %%sp;" \
+ CALL_ERRNO_LOCATION \
+ " nop;" \
+ "st %%i0, [%%A4];" \
+ "ba 1b;" \
+ " restore %%g0, -1, %%A4;" \
+ ".previous;"
+
+#define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \
+({ \
+ register long __A4 __asm__ ("A4") = (long)(arg1); \
+ register long __B4 __asm__ ("B4") = (long)(arg2); \
+ register long __A6 __asm__ ("A6") = (long)(arg3); \
+ register long __B6 __asm__ ("B6") = (long)(arg4); \
+ register long __A8 __asm__ ("A8") = (long)(arg5); \
+ register long __g1 __asm__ ("g1") = __NR_clone; \
+ __asm __volatile (__CLONE_SYSCALL_STRING : \
+ "=r" (__g1), "=r" (__A4), "=r" (__B4) : \
+ "0" (__g1), "1" (__A4), "2" (__B4), \
+ "r" (__A6), "r" (__B6), "r" (__A8) : \
+ __SYSCALL_CLOBBERS); \
+ __A4; \
+})
+#endif
+
+#define LOAD_ARGS_0()
+#define ASM_ARGS_0
+#define LOAD_ARGS_1(A4) \
+ __A4 = (int)A4; \
+ LOAD_ARGS_0()
+#define ASM_ARGS_1 ASM_ARGS_0, "a" (__A4)
+#define LOAD_ARGS_2(A4, B4) \
+ register int __B4 __asm__ ("B4") = (int) (B4); \
+ LOAD_ARGS_1 (A4)
+#define ASM_ARGS_2 ASM_ARGS_1, "b" (__B4)
+#define LOAD_ARGS_3(A4, B4, A6) \
+ register int __A6 __asm__ ("A6") = (int) (A6); \
+ LOAD_ARGS_2 (A4, B4)
+#define ASM_ARGS_3 ASM_ARGS_2, "a" (__A6)
+#define LOAD_ARGS_4(A4, B4, A6, B6) \
+ register int __B6 __asm__ ("B6") = (int) (B6); \
+ LOAD_ARGS_3 (A4, B4, A6)
+#define ASM_ARGS_4 ASM_ARGS_3, "b" (__B6)
+#define LOAD_ARGS_5(A4, B4, A6, B6, A8) \
+ register int __A8 __asm__ ("A8") = (int) (A8); \
+ LOAD_ARGS_4 (A4, B4, A6, B6)
+#define ASM_ARGS_5 ASM_ARGS_4, "a" (__A8)
+#define LOAD_ARGS_6(A4, B4, A6, B6, A8, B8) \
+ register int __B8 __asm__ ("B8") = (int) (B8); \
+ LOAD_ARGS_5 (A4, B4, A6, B6, A8)
+#define ASM_ARGS_6 ASM_ARGS_5, "b" (__B8)
+
+#ifndef _syscall0
+
+#define C_DECL_ARGS_0() void
+#define C_DECL_ARGS_1(t, v) t v
+#define C_DECL_ARGS_2(t, v, args...) t v, C_DECL_ARGS_1(args)
+#define C_DECL_ARGS_3(t, v, args...) t v, C_DECL_ARGS_2(args)
+#define C_DECL_ARGS_4(t, v, args...) t v, C_DECL_ARGS_3(args)
+#define C_DECL_ARGS_5(t, v, args...) t v, C_DECL_ARGS_4(args)
+#define C_DECL_ARGS_6(t, v, args...) t v, C_DECL_ARGS_5(args)
+
+#define C_ARGS_0()
+#define C_ARGS_1(t, v) v
+#define C_ARGS_2(t, v, args...) v, C_ARGS_1(args)
+#define C_ARGS_3(t, v, args...) v, C_ARGS_2(args)
+#define C_ARGS_4(t, v, args...) v, C_ARGS_3(args)
+#define C_ARGS_5(t, v, args...) v, C_ARGS_4(args)
+#define C_ARGS_6(t, v, args...) v, C_ARGS_5(args)
+
+#define SYSCALL_FUNC(nargs, type, name, args...) \
+type name(C_DECL_ARGS_##nargs(args)) { \
+ return (type)INLINE_SYSCALL(name, nargs, C_ARGS_##nargs(args)); \
+}
+
+#define SYSCALL_NOERR_FUNC(nargs, type, name, args...) \
+type name(C_DECL_ARGS_##nargs(args)) { \
+ return (type)INLINE_SYSCALL_NOERR(name, nargs, C_ARGS_##nargs(args)); \
+}
+
+#define _syscall0(args...) SYSCALL_FUNC(0, args)
+#define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args)
+#define _syscall1(args...) SYSCALL_FUNC(1, args)
+#define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args)
+#define _syscall2(args...) SYSCALL_FUNC(2, args)
+#define _syscall3(args...) SYSCALL_FUNC(3, args)
+#define _syscall4(args...) SYSCALL_FUNC(4, args)
+#define _syscall5(args...) SYSCALL_FUNC(5, args)
+#define _syscall6(args...) SYSCALL_FUNC(6, args)
+
+#endif /* _syscall0 */
+
+#endif /* __ASSEMBLER__ */
+#endif /* _BITS_SYSCALLS_H */
+
diff --git a/libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h b/libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h
new file mode 100644
index 000000000..59e7de987
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h
@@ -0,0 +1,48 @@
+/*
+ * Track misc arch-specific features that aren't config options
+ */
+
+#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
+#define _BITS_UCLIBC_ARCH_FEATURES_H
+
+/* instruction used when calling abort() to kill yourself */
+/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/
+#undef __UCLIBC_ABORT_INSTRUCTION__
+
+/* can your target use syscall6() for mmap ? */
+#define __UCLIBC_MMAP_HAS_6_ARGS__
+
+/* does your target use syscall4() for truncate64 ? (32bit arches only) */
+#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
+
+/* does your target have a broken create_module() ? */
+#undef __UCLIBC_BROKEN_CREATE_MODULE__
+
+/* does your target have to worry about older [gs]etrlimit() ? */
+#undef __UCLIBC_HANDLE_OLDER_RLIMIT__
+
+/* does your target have an asm .set ? */
+#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
+
+/* define if target doesn't like .global */
+#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
+
+/* define if target supports .weak */
+#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
+
+/* define if target supports .weakext */
+#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
+
+/* needed probably only for ppc64 */
+#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
+
+/* define if target supports CFI pseudo ops */
+#undef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__
+
+/* define if target supports IEEE signed zero floats */
+#define __UCLIBC_HAVE_SIGNED_ZERO__
+
+/* only weird assemblers generally need this */
+#define __UCLIBC_ASM_LINE_SEP__ @
+
+#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/libc/sysdeps/linux/c6x/bits/wordsize.h b/libc/sysdeps/linux/c6x/bits/wordsize.h
new file mode 100644
index 000000000..ba643b60a
--- /dev/null
+++ b/libc/sysdeps/linux/c6x/bits/wordsize.h
@@ -0,0 +1,19 @@
+/* Copyright (C) 1999 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. */
+
+#define __WORDSIZE 32