diff --git a/libc/bionic/pthread-timers.c b/libc/bionic/pthread-timers.c
index a53d04b..b8f7488 100644
--- a/libc/bionic/pthread-timers.c
+++ b/libc/bionic/pthread-timers.c
@@ -144,6 +144,9 @@
 {
     thr_timer_t*  timer;
 
+    if (t == NULL)
+        return NULL;
+
     pthread_mutex_lock(&t->lock);
     timer = t->free_timer;
     if (timer != NULL) {
@@ -201,7 +204,7 @@
     unsigned      index;
     thr_timer_t*  timer;
 
-    if (!TIMER_ID_IS_WRAPPED(id))
+    if (t == NULL || !TIMER_ID_IS_WRAPPED(id))
         return NULL;
 
     index = (unsigned) TIMER_ID_UNWRAP(id);
@@ -226,15 +229,21 @@
     return timer;
 }
 
-/* the static timer table */
+/* the static timer table - we only create it if the process
+ * really wants to use SIGEV_THREAD timers, which should be
+ * pretty infrequent
+ */
 
 static pthread_once_t      __timer_table_once = PTHREAD_ONCE_INIT;
-static thr_timer_table_t   __timer_table[1];
+static thr_timer_table_t*  __timer_table;
 
 static void
 __timer_table_init( void )
 {
-    thr_timer_table_init( __timer_table );
+    __timer_table = calloc(1,sizeof(*__timer_table));
+
+    if (__timer_table != NULL)
+        thr_timer_table_init( __timer_table );
 }
 
 static thr_timer_table_t*
@@ -254,8 +263,10 @@
 void
 __timer_table_start_stop( int  stop )
 {
-    thr_timer_table_t*  table = __timer_table_get();
-    thr_timer_table_start_stop(table, stop);
+    if (__timer_table != NULL) {
+        thr_timer_table_t*  table = __timer_table_get();
+        thr_timer_table_start_stop(table, stop);
+    }
 }
 
 static thr_timer_t*
diff --git a/libc/bionic/semaphore.c b/libc/bionic/semaphore.c
index fa9de0e..0c94600 100644
--- a/libc/bionic/semaphore.c
+++ b/libc/bionic/semaphore.c
@@ -29,6 +29,7 @@
 #include <errno.h>
 #include <sys/time.h>
 #include <sys/atomics.h>
+#include <time.h>
 
 int sem_init(sem_t *sem, int pshared, unsigned int value)
 {
@@ -118,6 +119,62 @@
     return 0;
 }
 
+int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout)
+{
+    int  ret;
+
+    if (sem == NULL) {
+        errno = EINVAL;
+        return -1;
+    }
+
+    /* POSIX says we need to try to decrement the semaphore
+     * before checking the timeout value */
+    if (__atomic_dec_if_positive(&sem->count))
+        return 0;
+
+    /* check it as per Posix */
+    if (abs_timeout == NULL    ||
+        abs_timeout->tv_sec < 0 ||
+        abs_timeout->tv_nsec < 0 ||
+        abs_timeout->tv_nsec >= 1000000000)
+    {
+        errno = EINVAL;
+        return -1;
+    }
+
+    for (;;) {
+        struct timespec ts;
+        int             ret;
+
+        /* Posix mandates CLOCK_REALTIME here */
+        clock_gettime( CLOCK_REALTIME, &ts );
+        ts.tv_sec  = abs_timeout->tv_sec - ts.tv_sec;
+        ts.tv_nsec = abs_timeout->tv_nsec - ts.tv_nsec;
+        if (ts.tv_nsec < 0) {
+            ts.tv_nsec += 1000000000;
+            ts.tv_sec  -= 1;
+        }
+
+        if (ts.tv_sec < 0 || ts.tv_nsec < 0) {
+            errno = ETIMEDOUT;
+            return -1;
+        }
+
+        ret = __futex_wait(&sem->count, 0, &ts);
+
+        /* return in case of timeout or interrupt */
+        if (ret == -ETIMEDOUT || ret == -EINTR) {
+            errno = -ret;
+            return -1;
+        }
+
+        if (__atomic_dec_if_positive(&sem->count))
+            break;
+    }
+    return 0;
+}
+
 int sem_post(sem_t *sem)
 {
     if (sem == NULL)
