summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhem Raj <kraj@mvista.com>2008-12-31 00:31:38 +0000
committerKhem Raj <kraj@mvista.com>2008-12-31 00:31:38 +0000
commit15a971616c3e2f373264d0a2e4cd87aa11042737 (patch)
treede7759a5bfcc0548b63e7d289fd1829aba6dad48
parente422845f587db4139bd72fd3ae827ae91420855a (diff)
Merge some pre-work from branch, needed by NPTL.
-rw-r--r--extra/Configs/Config.in31
-rw-r--r--extra/scripts/gen-as-const.awk33
-rw-r--r--include/elf.h11
-rw-r--r--include/fcntl.h5
-rw-r--r--include/sched.h6
-rw-r--r--include/time.h2
-rw-r--r--include/tls.h19
-rw-r--r--include/unistd.h2
8 files changed, 108 insertions, 1 deletions
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index ca716e106..e6ea80a42 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -403,9 +403,30 @@ config LINUXTHREADS_OLD
the latest code from glibc, so it may be the only choice for the
newer ports (like alpha/amd64/64bit arches and hppa).
+config UCLIBC_HAS_THREADS_NATIVE
+ bool "Native POSIX Threading (NPTL) Support"
+ depends on UCLIBC_HAS_THREADS
+ default n
+ help
+ If you want to compile uClibc with NPTL support, then answer Y.
+
+ IMPORTANT NOTE! NPTL requires a Linux 2.6 kernel, binutils
+ at least version 2.16 and GCC with at least version 4.1.0. NPTL
+ will not work with older versions of any above sources. If you
+ ignore any of these guidelines, you do so at your own risk. Do
+ not ask for help on any of the development mailing lists.
+
+ !!!! WARNING !!!! BIG FAT WARNING !!!! REALLY BIG FAT WARNING !!!!
+
+ This is experimental code and at times it may not even build and
+ even if it does it might decide to do random damage. This code is
+ potentially hazardous to your health and sanity. It will remain
+ that way until further notice at which point this notice will
+ disappear. Thank you for your support and for not smoking.
+
config LINUXTHREADS_NEW
def_bool y
- depends on UCLIBC_HAS_THREADS && !LINUXTHREADS_OLD
+ depends on UCLIBC_HAS_THREADS && !LINUXTHREADS_OLD && !UCLIBC_HAS_THREADS_NATIVE
config UCLIBC_HAS_SYSLOG
bool "Syslog support"
@@ -1602,6 +1623,14 @@ config UCLIBC_HAS_GNU_GETOPT
Most people will answer Y.
+config UCLIBC_HAS_STDIO_FUTEXES
+ bool "Use futexes for multithreaded I/O locking"
+ default n
+ depends on UCLIBC_HAS_THREADS_NATIVE
+ help
+ If you want to compile uClibc to use futexes for low-level
+ I/O locking, answer Y. Otherwise, answer N.
+
config UCLIBC_HAS_GETOPT_LONG
bool "Support getopt_long/getopt_long_only"
depends on !UCLIBC_HAS_GNU_GETOPT
diff --git a/extra/scripts/gen-as-const.awk b/extra/scripts/gen-as-const.awk
new file mode 100644
index 000000000..f9ec31672
--- /dev/null
+++ b/extra/scripts/gen-as-const.awk
@@ -0,0 +1,33 @@
+# Script used in producing headers of assembly constants from C expressions.
+# The input to this script looks like:
+# #cpp-directive ...
+# NAME1
+# NAME2 expression ...
+# The output of this script is C code to be run through gcc -S and then
+# massaged to extract the integer constant values of the given C expressions.
+# A line giving just a name implies an expression consisting of just that name.
+
+BEGIN { started = 0 }
+
+# cpp directives go straight through.
+/^#/ { print; next }
+
+NF >= 1 && !started {
+ printf "void dummy(void);\n";
+ print "void dummy(void) {";
+ started = 1;
+}
+
+# Separator.
+$1 == "--" { next }
+
+NF == 1 { sub(/^.*$/, "& &"); }
+
+NF > 1 {
+ name = $1;
+ sub(/^[^ ]+[ ]+/, "");
+ printf "__asm__ (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
+ name, $0;
+}
+
+END { if (started) print "}" }
diff --git a/include/elf.h b/include/elf.h
index 53fda0140..4ebe15c23 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -2367,6 +2367,9 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_ARM_THM_SWI8 14
#define R_ARM_XPC25 15
#define R_ARM_THM_XPC22 16
+#define R_ARM_TLS_DTPMOD32 17
+#define R_ARM_TLS_DTPOFF32 18
+#define R_ARM_TLS_TPOFF32 19
#define R_ARM_COPY 20 /* Copy symbol at runtime */
#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
@@ -2385,6 +2388,14 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_ARM_GNU_VTINHERIT 101
#define R_ARM_THM_PC11 102 /* thumb unconditional branch */
#define R_ARM_THM_PC9 103 /* thumb conditional branch */
+#define R_ARM_TLS_GD32 104
+#define R_ARM_TLS_LDM32 105
+#define R_ARM_TLS_LDO32 106
+#define R_ARM_TLS_IE32 107
+#define R_ARM_TLS_LE32 108
+#define R_ARM_TLS_LDO12 109
+#define R_ARM_TLS_LE12 110
+#define R_ARM_TLS_IE12GP 111
#define R_ARM_RXPC25 249
#define R_ARM_RSBREL32 250
#define R_ARM_THM_RPC22 251
diff --git a/include/fcntl.h b/include/fcntl.h
index 4356dad60..8c3768216 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -224,6 +224,11 @@ extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
# define posix_fallocate posix_fallocate64
# endif
# endif
+
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+extern int __fcntl_nocancel (int fd, int cmd, ...);
+#endif
+
# ifdef __USE_LARGEFILE64
extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
# endif
diff --git a/include/sched.h b/include/sched.h
index 5f3bd8fc1..0d110c303 100644
--- a/include/sched.h
+++ b/include/sched.h
@@ -79,6 +79,12 @@ extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
/* Get the CPU affinity for a task */
extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize,
cpu_set_t *__cpuset) __THROW;
+
+extern int __clone (int (*__fn) (void *__arg), void *__child_stack,
+ int __flags, void *__arg, ...);
+extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
+ size_t __child_stack_size, int __flags, void *__arg, ...);
+
#endif
__END_DECLS
diff --git a/include/time.h b/include/time.h
index a96fcae04..4f060be03 100644
--- a/include/time.h
+++ b/include/time.h
@@ -195,6 +195,8 @@ extern double difftime (time_t __time1, time_t __time0)
__THROW __attribute__ ((__const__));
#endif /* __UCLIBC_HAS_FLOATS__ */
+#define CLOCK_IDFIELD_SIZE 3
+
/* Return the `time_t' representation of TP and normalize TP. */
extern time_t mktime (struct tm *__tp) __THROW;
diff --git a/include/tls.h b/include/tls.h
new file mode 100644
index 000000000..a1da3827b
--- /dev/null
+++ b/include/tls.h
@@ -0,0 +1,19 @@
+/* This file defines USE___THREAD to 1 or 0 to cut down on the #if mess. */
+
+#ifndef _include_tls_h
+#define _include_tls_h 1
+
+#include_next <tls.h>
+
+#if USE_TLS && HAVE___THREAD \
+ && (!defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt)
+
+# define USE___THREAD 1
+
+#else
+
+# define USE___THREAD 0
+
+#endif
+
+#endif
diff --git a/include/unistd.h b/include/unistd.h
index 613fc9d8f..eb0d94595 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -770,6 +770,8 @@ extern __pid_t vfork (void) __THROW;
libc_hidden_proto(vfork)
#endif /* Use BSD. */
+/* Special exit function which only terminates the current thread. */
+extern void __exit_thread (int val) __attribute__ ((noreturn));
/* Return the pathname of the terminal FD is open on, or NULL on errors.
The returned storage is good only until the next call to this function. */