[PATCH v2] Fix weak/strong attribute of __errno_location and it's __GI alias

Baruch Siach baruch at tkos.co.il
Sun Oct 6 03:58:44 UTC 2013


Hi Vineet,

On Fri, Oct 04, 2013 at 03:35:01PM +0530, Vineet Gupta wrote:

[snip]

>   arm-linux-gcc -static -pthread -o tst tst.o
> 
>   arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__errno_location.os):
>   In function `__errno_location':  __errno_location.c:(.text+0x0):
>                            multiple definition of `__errno_location'
>   arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libpthread.a
>             (errno_location.os):errno_location.c:(.text+0x0): first defined here
> 
> Signed-off-by: Vineet Gupta <vgupta at synopsys.com>
> Cc: Baruch Siach <baruch at tkos.co.il>

For xtensa NPTL target:

Tested-by: Baruch Siach <baruch at tkos.co.il>

Thanks,
baruch

> ---
>  include/netdb.h                          | 2 +-
>  libc/misc/internals/__errno_location.c   | 2 +-
>  libc/misc/internals/__h_errno_location.c | 2 +-
>  libc/sysdeps/linux/common/bits/errno.h   | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/netdb.h b/include/netdb.h
> index 14cf3d24dae0..8fdfa0fccc7d 100644
> --- a/include/netdb.h
> +++ b/include/netdb.h
> @@ -59,7 +59,7 @@ __BEGIN_DECLS
>  /* Function to get address of global `h_errno' variable.  */
>  extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
>  #ifdef _LIBC
> -# ifndef __UCLIBC_HAS_TLS__
> +# if !defined(__UCLIBC_HAS_TLS__) && !defined(__UCLIBC_HAS_THREADS__)
>  extern int weak_const_function *__h_errno_location(void);
>  # endif
>  #endif
> diff --git a/libc/misc/internals/__errno_location.c b/libc/misc/internals/__errno_location.c
> index dec913f3031d..be7a9093efa3 100644
> --- a/libc/misc/internals/__errno_location.c
> +++ b/libc/misc/internals/__errno_location.c
> @@ -16,4 +16,4 @@ int *__errno_location(void)
>  {
>      return &errno;
>  }
> -libc_hidden_def(__errno_location)
> +libc_hidden_weak(__errno_location)
> diff --git a/libc/misc/internals/__h_errno_location.c b/libc/misc/internals/__h_errno_location.c
> index 41353d74a648..6653681cbf09 100644
> --- a/libc/misc/internals/__h_errno_location.c
> +++ b/libc/misc/internals/__h_errno_location.c
> @@ -16,4 +16,4 @@ int *__h_errno_location(void)
>  {
>      return &h_errno;
>  }
> -libc_hidden_def(__h_errno_location)
> +libc_hidden_weak(__h_errno_location)
> diff --git a/libc/sysdeps/linux/common/bits/errno.h b/libc/sysdeps/linux/common/bits/errno.h
> index 7ef1b9440a34..777338fb1e0a 100644
> --- a/libc/sysdeps/linux/common/bits/errno.h
> +++ b/libc/sysdeps/linux/common/bits/errno.h
> @@ -43,7 +43,7 @@
>  /* Function to get address of global `errno' variable.  */
>  extern int *__errno_location (void) __THROW __attribute__ ((__const__));
>  #  ifdef _LIBC
> -#   ifndef __UCLIBC_HAS_TLS__
> +#   if !defined(__UCLIBC_HAS_TLS__) && !defined(__UCLIBC_HAS_THREADS__)
>  extern int weak_const_function *__errno_location(void);
>  #   endif
>  #  endif
> -- 
> 1.8.1.2
> 

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


More information about the uClibc mailing list