ERRNO handling in linuxthreads.old (broken build)

Sergei Poselenov sposelenov at emcraft.com
Sun Mar 17 08:34:58 UTC 2013


Hello all,

Update, see below.

On Пт., 2013-03-15 at 20:51 +0400, Sergei Poselenov wrote:
> Hello all,
> 
> I was hit by a nasty bug in the 0.9.33.2. It shows itself as that in the thread context,
> any syscall ended with error always sets errno as zero. For the main() context, errno is set correctly.
> 
> Configuration details:
>  - Target is ARM Cortex-M3, uClibc builds as "make ARCH_CFLAGS= 'CPU_CFLAGS=-mthumb -march=armv7 -mfix-cortex-m3-ldrd'"
>  - Toolchain - CodeSourcery arm-2010q1, arm-uclinuxeabi.
>  - uClibc-0.9.33.2 with the following main configuration options defined:
> TARGET_arm
> TARGET_ARCH="arm"
> FORCE_OPTIONS_FOR_ARCH=y
> CONFIG_ARM_EABI=y
> COMPILE_IN_THUMB_MODE=y
> USE_BX=y
> LINUXTHREADS_OLD=y                                            
> UCLIBC_HAS_THREADS=y
> PTHREADS_DEBUG_SUPPORT=y
> # ARCH_HAS_MMU is not set
The key factor is turned to be this:
ARCH_HAS_NO_SHARED=y

It adds -DSTATIC=1 to CFLAGS.

> 
> It took me a while to notice that among (a lot of) others, compiler throwed out the warning:
> 
> arm-uclinuxeabi-gcc -c libpthread/linuxthreads.old/libc_pthread_init.c ...
> 
> In file included from ./include/errno.h:36,
>                  from ./include/bits/syscalls.h:31,
>                  from ./include/sys/syscall.h:34,
>                  from ./libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h:26,
>                  from libpthread/linuxthreads.old/internals.h:30,
>                  from libpthread/linuxthreads.old/libc_pthread_init.c:35:
> ./include/bits/errno.h:46: warning: asm declaration ignored due to conflict with previous rename
> 
> It all boiled down to the following commit which breaks my uClibc:
> 
> commit 6e97c25777a5da804fa5989c3ef8bebb1734b969
> Author: Mike Frysinger <vapier at gentoo.org>
> Date:   Mon Jun 19 03:43:20 2006 +0000
> 
>     use internal aliases for static objects as well
> 
> diff --git a/include/libc-symbols.h b/include/libc-symbols.h
> index ef1e217..ec3696b 100644
> --- a/include/libc-symbols.h
> +++ b/include/libc-symbols.h
> @@ -420,7 +420,7 @@
>  # define __hidden_proto_hiddenattr(attrs...)
>  #endif
>  
> -#if !defined STATIC && !defined __BCC__
> +#if /*!defined STATIC &&*/ !defined __BCC__
>  # ifndef __ASSEMBLER__
>  #  define hidden_proto(name, attrs...) __hidden_proto (name, __GI_##name, ##attrs)
>  #  define __hidden_proto(name, internal, attrs...) \
> 
> That was pretty long time ago for the bug to come unnoticed, so I guess something
> wrong on my side.
> 
Well, now I think otherwise. The above hack broke off the linuxthreads
(linuxthreads.old at least) for ARCH_HAS_NO_SHARED.

> Could someone please comment what could it be?
Yes, please.

Regards,
Sergei

> Thanks in advance.
> 
> Regards,
> Sergei Poselenov




More information about the uClibc mailing list