Cross compile uClibc encountered error with linuxthreads lib

Khem Raj raj.khem at gmail.com
Sat Oct 11 18:41:07 UTC 2008


On (10/10/08 15:46), Robert Hoo wrote:
> Hi,
> 
> I'm trying to compile uClibc with mipsel toolchain.
> 
> The attached is my menuconfig result.
> 
> I observed that it by default uses linuxthreads.old directory.
> However, it encounters following errors:
> 
> 
> libc/sysdeps/linux/mips/crt1.S: Assembler messages:
> libc/sysdeps/linux/mips/crt1.S:134: Warning: No .cprestore pseudo-op
> used in PIC code
>   AS lib/crti.o
>   AS lib/crtn.o
>   STRIP -x -R .note -R .comment lib/libc.a
>   AR cr lib/libc.a
>   STRIP -x -R .note -R .comment lib/uclibc_nonshared.a
>   AR cr lib/uclibc_nonshared.a
>   AR cr libc/libc_so.a
>   LD libuClibc-0.9.29.so
> libc/libc_so.a(libc_pthread_init.oS): In function `testandset':
> libc_pthread_init.c:(.text+0x0): multiple definition of `testandset'
> libc/libc_so.a(forward.oS):forward.c:(.text+0x0): first defined here
> libc/libc_so.a(libc_pthread_init.oS): In function `__compare_and_swap':
> libc_pthread_init.c:(.text+0x24): multiple definition of `__compare_and_swap'
> libc/libc_so.a(forward.oS):forward.c:(.text+0x24): first defined here
> make[1]: *** [lib/libc.so] Error 1
> 
> 
> Anyone has ideas about this?

I tried your .config on latest SVN sources and it compiled file for
mipsel on gcc 4.2. On gcc 4.3 I got warnings which can be fixed by this
patch. Could you try this patch out and run the tests on mipsel?
I do not have mips hardware to try it out.

-Khem
-------------- next part --------------
--- ./libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h.kk	2008-10-11 09:23:29.000000000 -0700
+++ ./libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h	2008-10-11 09:27:38.000000000 -0700
@@ -24,41 +24,12 @@
 #ifndef _PT_MACHINE_H
 #define _PT_MACHINE_H   1
 
-#include <features.h>
+#include <sys/tas.h>
 
 #ifndef PT_EI
 # define PT_EI __extern_always_inline
 #endif
 
-/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Maciej W. Rozycki <macro at ds2.pg.gda.pl>, 2000.  */
-static __inline__ int
-__NTH (_test_and_set (int *p, int v))
-{
-  int r, t;
-
-  __asm__ __volatile__
-    ("/* Inline test and set */\n"
-     "1:\n\t"
-     ".set	push\n\t"
-     ".set	mips2\n\t"
-     "ll	%0,%3\n\t"
-     "move	%1,%4\n\t"
-     "beq	%0,%4,2f\n\t"
-     "sc	%1,%2\n\t"
-     ".set	pop\n\t"
-     "beqz	%1,1b\n"
-     "2:\n\t"
-     "/* End test and set */"
-     : "=&r" (r), "=&r" (t), "=m" (*p)
-     : "m" (*p), "r" (v)
-     : "memory");
-
-  return r;
-}
-
-
 /* Spinlock implementation; required.  */
 
 PT_EI long int


More information about the uClibc mailing list