summaryrefslogtreecommitdiffstats
path: root/libc/misc
diff options
context:
space:
mode:
authorKhem Raj <kraj@mvista.com>2008-12-23 10:16:51 +0000
committerKhem Raj <kraj@mvista.com>2008-12-23 10:16:51 +0000
commitf6fc6973e34a3c250457aed1710ee0872800acdd (patch)
tree6c7a5a33037fecf05340829155d636a5994ba7a2 /libc/misc
parent6374ca896086574af61eb37ef371e3371b10bb5c (diff)
downloaduClibc-alpine-f6fc6973e34a3c250457aed1710ee0872800acdd.tar.bz2
uClibc-alpine-f6fc6973e34a3c250457aed1710ee0872800acdd.tar.xz
Get non nptl threads compiled on x86.
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/elf/Makefile.in3
-rw-r--r--libc/misc/elf/dl-support.c13
-rw-r--r--libc/misc/internals/__uClibc_main.c8
-rw-r--r--libc/misc/internals/errno.c16
-rw-r--r--libc/misc/utmp/utent.c4
5 files changed, 25 insertions, 19 deletions
diff --git a/libc/misc/elf/Makefile.in b/libc/misc/elf/Makefile.in
index c97d29929..4c5d9c8b7 100644
--- a/libc/misc/elf/Makefile.in
+++ b/libc/misc/elf/Makefile.in
@@ -5,7 +5,8 @@
#
libc_a_CSRC = dl-support.c dl-core.c dl-iterate-phdr.c
-CFLAGS-dl-iterate-phdr.c=-D_GNU_SOURCE
+CFLAGS-dl-iterate-phdr.c=-D_GNU_SOURCE -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include
+CFLAGS-dl-core.c=-I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include
MISC_ELF_OUT:=$(top_builddir)libc/misc/elf
MISC_ELF_OBJ:=$(patsubst %.c,$(MISC_ELF_OUT)/%.o,$(libc_a_CSRC))
diff --git a/libc/misc/elf/dl-support.c b/libc/misc/elf/dl-support.c
index 2f6682706..ce05f348a 100644
--- a/libc/misc/elf/dl-support.c
+++ b/libc/misc/elf/dl-support.c
@@ -11,14 +11,21 @@
*
*/
+#if USE_TLS
#include <assert.h>
#include <tls.h>
-#include <link.h>
#include <ldsodefs.h>
#include <string.h>
+#endif
+#include <link.h>
+#include <elf.h>
+
+#if USE_TLS
void (*_dl_init_static_tls) (struct link_map *) = &_dl_nothread_init_static_tls;
+#endif
+
ElfW(Phdr) *_dl_phdr;
size_t _dl_phnum;
@@ -33,6 +40,7 @@ _dl_aux_init (ElfW(auxv_t) *av)
_dl_phnum = (size_t) av[AT_PHNUM].a_un.a_val;
}
+#if USE_TLS
/* Initialize static TLS area and DTV for current (only) thread.
libpthread implementations should provide their own hook
to handle all threads. */
@@ -57,3 +65,6 @@ _dl_nothread_init_static_tls (struct link_map *map)
memset (mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
}
+
+#endif
+
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index a1e02c4e4..ab6adb130 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -51,10 +51,6 @@ libc_hidden_proto(geteuid)
libc_hidden_proto(fstat)
/* libc_hidden_proto(abort) */
-extern __typeof(open) __libc_open;
-libc_hidden_proto(__libc_open)
-extern __typeof(fcntl) __libc_fcntl;
-libc_hidden_proto(__libc_fcntl)
#endif
#ifndef SHARED
@@ -150,10 +146,10 @@ size_t __pagesize = 0;
static void __check_one_fd(int fd, int mode)
{
/* Check if the specified fd is already open */
- if (__libc_fcntl(fd, F_GETFD) == -1)
+ if (fcntl(fd, F_GETFD) == -1)
{
/* The descriptor is probably not open, so try to use /dev/null */
- int nullfd = __libc_open(_PATH_DEVNULL, mode);
+ int nullfd = open(_PATH_DEVNULL, mode);
/* /dev/null is major=1 minor=3. Make absolutely certain
* that is in fact the device that we have opened and not
* some other wierd file... */
diff --git a/libc/misc/internals/errno.c b/libc/misc/internals/errno.c
index 23b2bb375..a89b5addf 100644
--- a/libc/misc/internals/errno.c
+++ b/libc/misc/internals/errno.c
@@ -19,18 +19,20 @@ extern __thread int __libc_h_errno __attribute__ ((alias ("h_errno")));
#define h_errno __libc_h_errno
#else
-extern int errno;
-extern int h_errno;
-
+#include "internal_errno.h"
#if 0
/* Unfortunately, this doesn't work... */
int h_errno __attribute__ ((section (".bss"))) = 0;
int errno __attribute__ ((section (".bss"))) = 0;
#else
-int _errno = 0;
-int _h_errno = 0;
+int errno = 0;
+int h_errno = 0;
#endif
-weak_alias(_errno, errno)
-weak_alias(_h_errno, h_errno)
+#ifdef __UCLIBC_HAS_THREADS__
+libc_hidden_def(errno)
+weak_alias(errno, _errno)
+libc_hidden_def(h_errno)
+weak_alias(h_errno, _h_errno)
+#endif
#endif
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index 3752a68d4..11908b667 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -210,11 +210,7 @@ struct utmp *pututline (const struct utmp *utmp_entry)
lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
else
lseek(static_fd, (off_t) 0, SEEK_END);
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
-#else
- if (write_not_cancel(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
-#endif
utmp_entry = NULL;
__UCLIBC_MUTEX_UNLOCK(utmplock);