[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: [PATCH] Provide __errno_location and friends like LinuxThreads



This is great. Does it mean the bug I encountered while testing
nptl's binary compatibility with Linuxthreads is fixed?

# under /path/to/glibc
cp -d libc*so* /lib/nptl
cp -d elf/ld*so* /lib/nptl
cp -d nptl/libpthread*so* /lib/nptl
/lib/nptl/ld.so --library-path /lib/nptl /usr/bin/python
  ***  /usr/bin/python: relocation error: /usr/bin/python: symbol
__errno_location, 
     version GLIBC_2.0 not defined in file libpthread.so.0 with link time
reference  ***

Bingwei

> -----Original Message-----
> From: Luca Barbieri [mailto:ldb ldb ods org]
> Sent: 2002年11月1日 9:34
> To: NPTL ML
> Subject: [PATCH] Provide __errno_location and friends like 
> LinuxThreads
> 
> 
> This patch allows to run programs linked against LinuxThreads that
> expect to find __errno_location and friends in libpthread.
> 
> diff -urNdp nptl/Versions nptl/Versions
> --- nptl/Versions	2002-10-10 09:28:35.000000000 +0200
> +++ nptl/Versions	2002-10-31 21:51:46.000000000 +0100
> @@ -71,6 +105,10 @@ libpthread {
>  
>      # Functions which previously have been overwritten.
>      sigwait; sigaction; __sigaction; _exit; _Exit; longjmp; 
> siglongjmp;
> +
> +    # These are provided for compatibility with programs 
> explicitly linking to
> +    # the LinuxThreads1 version of them: the code is the 
> same as the libc ones
> +    __errno_location; __h_errno_location; __res_state;
>    }
>  
>    GLIBC_2.1 {
> diff -urNdp nptl/errno.c nptl/errno.c
> --- nptl/errno.c	1970-01-01 01:00:00.000000000 +0100
> +++ nptl/errno.c	2002-10-31 21:48:21.000000000 +0100
> @@ -0,0 +1,53 @@
> +/* MT support function to get address of `errno' variable, 
> non-threaded
> +   version.
> +   Copyright (C) 1996, 1998, 2002 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will 
> be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, write to the Free
> +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> +   02111-1307 USA.  */
> +
> +#include <errno.h>
> +#include <tls.h>
> +#include <resolv.h>
> +#undef errno
> +#undef _res
> +
> +#if USE_TLS && HAVE___THREAD
> +extern __thread int errno;
> +extern __thread int h_errno;
> +extern __thread struct __res_state _res;
> +#else
> +extern int errno;
> +extern int h_errno;
> +extern struct __res_state _res;
> +#endif
> +
> +int *
> +__errno_location (void)
> +{
> +  return &errno;
> +}
> +
> +int *
> +__h_errno_location (void)
> +{
> +  return &h_errno;
> +}
> +
> +struct __res_state *
> +__res_state (void)
> +{
> +  return &_res;
> +}
> 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]