[patch] Fixes for non-NPTL threads build

Andrew Stubbs ams at codesourcery.com
Mon Jun 14 11:34:44 UTC 2010


Here's a corrected patch. Some of it got into my other SH4AL patch by 
mistake.

This patch fixes some issues building SH uclibc with linuxthreads, that 
seem to have been introduced by the NPTL changes.

Signed-off-by: Andrew Stubbs <ams at codesourcery.com>


---
  .../libc/misc/internals/__uClibc_main.c            |    3 +++
  .../libc/sysdeps/linux/sh/Makefile.arch            |    4 ++++
  .../libc/sysdeps/linux/sh/longjmp.c                |    2 ++
  3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/libc/misc/internals/__uClibc_main.c 
b/libc/misc/internals/__uClibc_main.c
index d821268..61f821d 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -36,6 +36,9 @@
  #include <not-cancel.h>
  #include <atomic.h>
  #endif
+#ifdef __UCLIBC_HAS_THREADS__
+#include <pthread.h>
+#endif


  #ifndef SHARED
diff --git a/libc/sysdeps/linux/sh/Makefile.arch 
b/libc/sysdeps/linux/sh/Makefile.arch
index 3e32e10..727a3f4 100644
--- a/libc/sysdeps/linux/sh/Makefile.arch
+++ b/libc/sysdeps/linux/sh/Makefile.arch
@@ -10,3 +10,7 @@ CSRC := \
  	mmap.c pipe.c __init_brk.c brk.c sbrk.c pread_write.c longjmp.c 
cacheflush.c

  SSRC := setjmp.S __longjmp.S ___fpscr_values.S
+
+ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+SSRC += vfork.S clone.S
+endif
diff --git a/libc/sysdeps/linux/sh/longjmp.c 
b/libc/sysdeps/linux/sh/longjmp.c
index dd0616d..cda4575 100644
--- a/libc/sysdeps/linux/sh/longjmp.c
+++ b/libc/sysdeps/linux/sh/longjmp.c
@@ -37,9 +37,11 @@ extern void _longjmp_unwind (jmp_buf env, int val);
     call there to return VAL, or 1 if VAL is 0.  */
  void __libc_siglongjmp (sigjmp_buf env, int val)
  {
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
    /* Perform any cleanups needed by the frames being unwound.  */

    _longjmp_unwind (env, val);
+#endif

    if (env[0].__mask_was_saved)
      /* Restore the saved signal mask.  */


More information about the uClibc mailing list