Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
2002-07-19  Ulrich Drepper  <drepper@redhat.com>

	* configure.in: Add test for __thread support in compiler.
	* config.h.in: Add HAVE___THREAD.
	* Makefile (headers): Remove errno.h, sys/errno.h, and bits/errno.h.
	* include/sys/errno.h: Moved to...
	* stdlib/sys/errno.h: ...here.  New file.
	* stdlib/errno.h: New file.  Moved from...
	* include/errno.h: ...here.  Changed into an internal header defining
	libc-local things like __set_errno.
	* stdlib/Makefile (headers): Add errno.h, sys/errno.h, and
	bits/errno.h.
	* elf/dl-minimal.c: Include <tls.h>.  Define errno as thread-local
	variable if USE_TLS && HAVE___THREAD.  Don't define __errno_location
	either.
	* elf/rtld.c (_dl_start): Add code to initialize TLS for ld.so
	from...
	(_dl_start_final): ...here.  Add code to initialize tls elements from
	bootstrap_map.
	* sysdeps/generic/errno-loc.c: Define errno as thread-local variable
	if USE_TLS && HAVE___THREAD.
	* sysdeps/generic/bits/errno.h: Remove __set_errno definition.
	* sysdeps/mach/hurd/bits/errno.h: Likewise.
	* sysdeps/standalone/arm/bits/errno.h: Likewise.
	* sysdeps/standalone/bits/errno.h: Likewise.
	* sysdeps/unix/bsd/bsd4.4/bits/errno.h: Likewise.
	* sysdeps/unix/sysv/aix/bits/errno.h: Likewise.
	* sysdeps/unix/sysv/hpux/bits/errno.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/errno.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/errno.h: Likewise.
	* sysdeps/unix/sysv/sysv4/solaris2/bits/errno.h: Likewise.
	* sysdeps/i386/dl-machine.c (elf_machine_rel) [RTLD_BOOTSTRAP]: Don't
	use GL(dl_rtld_map), use map parameter.
	* sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep.S: Define errno in .tbss if
	USE_TLS && HAVE___THREAD.
	* sysdeps/unix/sysv/linux/i386/sysdep.h: Unify SETUP_PIC_REG
	definitions.  If USE_TLS && HAVE___THREAD store errooor value using
	TLS code sequence.
	* sysdeps/unix/sysv/linux/i386/i686/sysdep.h: Likewise.

	* sysdeps/unix/sysv/linux/getcwd.c: No real need to restore errno.
	* sysdeps/unix/sysv/linux/grantpt.c: Likewise.
	* sysdeps/unix/sysv/linux/internal_statvfs.c: Likewise.
	* sysdeps/unix/sysv/linux/msgctl.c: Likewise.
	* sysdeps/unix/sysv/linux/readv.c: Likewise.
	* sysdeps/unix/sysv/linux/writev.c: Likewise.
  • Loading branch information
Ulrich Drepper committed Jul 20, 2002
1 parent 9df6376 commit 739d440
Show file tree
Hide file tree
Showing 41 changed files with 447 additions and 350 deletions.
49 changes: 49 additions & 0 deletions ChangeLog
@@ -1,3 +1,52 @@
2002-07-19 Ulrich Drepper <drepper@redhat.com>

* configure.in: Add test for __thread support in compiler.
* config.h.in: Add HAVE___THREAD.
* Makefile (headers): Remove errno.h, sys/errno.h, and bits/errno.h.
* include/sys/errno.h: Moved to...
* stdlib/sys/errno.h: ...here. New file.
* stdlib/errno.h: New file. Moved from...
* include/errno.h: ...here. Changed into an internal header defining
libc-local things like __set_errno.
* stdlib/Makefile (headers): Add errno.h, sys/errno.h, and
bits/errno.h.
* elf/dl-minimal.c: Include <tls.h>. Define errno as thread-local
variable if USE_TLS && HAVE___THREAD. Don't define __errno_location
either.
* elf/rtld.c (_dl_start): Add code to initialize TLS for ld.so
from...
(_dl_start_final): ...here. Add code to initialize tls elements from
bootstrap_map.
* sysdeps/generic/errno-loc.c: Define errno as thread-local variable
if USE_TLS && HAVE___THREAD.
* sysdeps/generic/bits/errno.h: Remove __set_errno definition.
* sysdeps/mach/hurd/bits/errno.h: Likewise.
* sysdeps/standalone/arm/bits/errno.h: Likewise.
* sysdeps/standalone/bits/errno.h: Likewise.
* sysdeps/unix/bsd/bsd4.4/bits/errno.h: Likewise.
* sysdeps/unix/sysv/aix/bits/errno.h: Likewise.
* sysdeps/unix/sysv/hpux/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/errno.h: Likewise.
* sysdeps/unix/sysv/sysv4/solaris2/bits/errno.h: Likewise.
* sysdeps/i386/dl-machine.c (elf_machine_rel) [RTLD_BOOTSTRAP]: Don't
use GL(dl_rtld_map), use map parameter.
* sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.S: Define errno in .tbss if
USE_TLS && HAVE___THREAD.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Unify SETUP_PIC_REG
definitions. If USE_TLS && HAVE___THREAD store errooor value using
TLS code sequence.
* sysdeps/unix/sysv/linux/i386/i686/sysdep.h: Likewise.

* sysdeps/unix/sysv/linux/getcwd.c: No real need to restore errno.
* sysdeps/unix/sysv/linux/grantpt.c: Likewise.
* sysdeps/unix/sysv/linux/internal_statvfs.c: Likewise.
* sysdeps/unix/sysv/linux/msgctl.c: Likewise.
* sysdeps/unix/sysv/linux/readv.c: Likewise.
* sysdeps/unix/sysv/linux/writev.c: Likewise.

2002-07-17 Ulrich Drepper <drepper@redhat.com>

* sysdeps/unix/sysv/linux/ia64/bits/mman.h: Fix MS_SYNC and
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Expand Up @@ -63,9 +63,8 @@ configure: configure.in aclocal.m4; $(autoconf-it)
subdir_testclean \
$(addprefix install-, no-libc.a bin lib data headers others)

headers := errno.h sys/errno.h bits/errno.h limits.h values.h \
features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h \
gnu/libc-version.h
headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
bits/xopen_lim.h gnu/libc-version.h

echo-headers: subdir_echo-headers

Expand Down
2 changes: 0 additions & 2 deletions bits/errno.h
Expand Up @@ -33,5 +33,3 @@
# define Exxxx XXX
...
#endif

#define __set_errno(val) errno = (val)
3 changes: 3 additions & 0 deletions config.h.in
Expand Up @@ -94,6 +94,9 @@
/* Define if the compiler supports __builtin_memset. */
#undef HAVE_BUILTIN_MEMSET

/* Define if the __thread keyword is supported. */
#undef HAVE___THREAD

/* Define if the regparm attribute shall be used for local functions
(gcc on ix86 only). */
#undef USE_REGPARMS
Expand Down
45 changes: 35 additions & 10 deletions configure
Expand Up @@ -3540,8 +3540,33 @@ EOF

fi

echo $ac_n "checking for __thread""... $ac_c" 1>&6
echo "configure:3545: checking for __thread" >&5
if eval "test \"`echo '$''{'libc_cv_gcc___thread'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.c <<EOF
__thread int a = 42;
EOF
if { ac_try='${CC-cc} $CFLAGS -c conftest.c >&5'; { (eval echo configure:3552: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
libc_cv_gcc___thread=yes
else
libc_cv_gcc___thread=no
fi
rm -f conftest*
fi

echo "$ac_t""$libc_cv_gcc___thread" 1>&6
if test "$libc_cv_gcc___thread" = yes; then
cat >> confdefs.h <<\EOF
#define HAVE___THREAD 1
EOF

fi


echo $ac_n "checking for libgd""... $ac_c" 1>&6
echo "configure:3545: checking for libgd" >&5
echo "configure:3570: checking for libgd" >&5
if test "$with_gd" != "no"; then
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $libgd_include"
Expand All @@ -3550,14 +3575,14 @@ if test "$with_gd" != "no"; then
old_LIBS="$LIBS"
LIBS="$LIBS -lgd -lpng -lz -lm"
cat > conftest.$ac_ext <<EOF
#line 3554 "configure"
#line 3579 "configure"
#include "confdefs.h"
#include <gd.h>
int main() {
gdImagePng (0, 0)
; return 0; }
EOF
if { (eval echo configure:3561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBGD=yes
else
Expand All @@ -3577,15 +3602,15 @@ echo "$ac_t""$LIBGD" 1>&6


echo $ac_n "checking size of long double""... $ac_c" 1>&6
echo "configure:3581: checking size of long double" >&5
echo "configure:3606: checking size of long double" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
ac_cv_sizeof_long_double=0
else
cat > conftest.$ac_ext <<EOF
#line 3589 "configure"
#line 3614 "configure"
#include "confdefs.h"
#include <stdio.h>
int main()
Expand All @@ -3596,7 +3621,7 @@ int main()
return(0);
}
EOF
if { (eval echo configure:3600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:3625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_double=`cat conftestval`
else
Expand Down Expand Up @@ -3674,7 +3699,7 @@ if test "$uname" = "sysdeps/generic"; then
fi

echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
echo "configure:3678: checking OS release for uname" >&5
echo "configure:3703: checking OS release for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
Expand All @@ -3696,7 +3721,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
uname_release="$libc_cv_uname_release"

echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
echo "configure:3700: checking OS version for uname" >&5
echo "configure:3725: checking OS version for uname" >&5
if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
Expand Down Expand Up @@ -3725,7 +3750,7 @@ EOF
# Test for old glibc 2.0.x headers so that they can be removed properly
# Search only in includedir.
echo $ac_n "checking for old glibc 2.0.x headers""... $ac_c" 1>&6
echo "configure:3729: checking for old glibc 2.0.x headers" >&5
echo "configure:3754: checking for old glibc 2.0.x headers" >&5
if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
then
old_glibc_headers=yes
Expand Down Expand Up @@ -3786,7 +3811,7 @@ if test $shared = default; then
fi

echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6
echo "configure:3790: checking whether -fPIC is default" >&5
echo "configure:3815: checking whether -fPIC is default" >&5
if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
Expand Down
16 changes: 16 additions & 0 deletions configure.in
Expand Up @@ -1513,6 +1513,22 @@ if test "$libc_cv_gcc_subtract_local_labels" = yes; then
AC_DEFINE(HAVE_SUBTRACT_LOCAL_LABELS)
fi

dnl Check whether the compiler supports the __thread keyword.
AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
[cat > conftest.c <<EOF
__thread int a = 42;
EOF
if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AC_FD_CC]); then
libc_cv_gcc___thread=yes
else
libc_cv_gcc___thread=no
fi
rm -f conftest*])
if test "$libc_cv_gcc___thread" = yes; then
AC_DEFINE(HAVE___THREAD)
fi


dnl Check whether we have the gd library available.
AC_MSG_CHECKING(for libgd)
if test "$with_gd" != "no"; then
Expand Down
6 changes: 6 additions & 0 deletions elf/dl-minimal.c
Expand Up @@ -20,6 +20,7 @@
#include <errno.h>
#include <limits.h>
#include <string.h>
#include <tls.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/param.h>
Expand Down Expand Up @@ -354,12 +355,17 @@ const char INTUSE(_itoa_lower_digits)[16] attribute_hidden
= "0123456789abcdef";



#undef errno
/* The 'errno' in ld.so is not exported. */
#if USE_TLS && HAVE___THREAD
extern __thread int errno attribute_hidden;
#else
extern int errno attribute_hidden;

int *
__errno_location (void)
{
return &errno;
}
#endif

0 comments on commit 739d440

Please sign in to comment.