From aj@suse.de Tue Jul 3 01:08:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 03 Jul 2001 01:08:00 -0000 Subject: Remove crypt add-on check for solaris Message-ID: We do not support solaris2 but we should get rid of this extra check just in case. Ok to commit? Andreas 2001-07-03 Andreas Jaeger * sysdeps/unix/sysv/sysv4/solaris2/configure.in: Remove check for crypt add-on. ============================================================ Index: sysdeps/unix/sysv/sysv4/solaris2/configure.in --- sysdeps/unix/sysv/sysv4/solaris2/configure.in 1999/01/28 17:34:45 1.1 +++ sysdeps/unix/sysv/sysv4/solaris2/configure.in 2001/07/03 08:07:28 @@ -4,30 +4,3 @@ # Concensus on stdio is that it's broken. test $stdio = default && stdio=libio - -# Crypt is your friend. -case $add_ons in - *crypt*) - message= - ;; - *) - message="\ -*** WARNING: -*** Are you sure you do not want to use the \`crypt' add-on?" - ;; -esac - -if test "$message"; then - if test $enable_sanity = yes; then - echo "\ -*** You should not compile the GNU libc without the \`crypt' add-on. -*** Not using them risks to be incompatible with the libraries of -*** other systems. Consider getting the add-on and restart the -*** configuration. -*** If you reall mean to avoid this add-on run configure again, now -*** using the extra parameter \`--disable-sanity-checks'." - exit 1 - else - echo "$message" - fi -fi -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Tue Jul 3 09:35:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 03 Jul 2001 09:35:00 -0000 Subject: Remove crypt add-on check for solaris References: Message-ID: Andreas Jaeger writes: > Ok to commit? Yes. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jes@trained-monkey.org Wed Jul 4 10:09:00 2001 From: jes@trained-monkey.org (Jes Sorensen) Date: Wed, 04 Jul 2001 10:09:00 -0000 Subject: [patch] ia64 sigcontext Message-ID: <200107041713.NAA25716@trained-monkey.org> Hi A small patch to bring the Linux/ia64 sigcontext structure in sync with the kernel definition. Jes 2001-04-16 Jes Sorensen * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h (struct sigcontext): Add 16 longwords reserved for future use to match changes in the kernel. --- /home/jes/cygnus/libc-2.2/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h Thu May 31 14:26:15 2001 +++ sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h Thu May 31 17:39:59 2001 @@ -48,6 +48,7 @@ unsigned long int sc_br[8]; /* branch registers */ unsigned long int sc_gr[32]; /* general registers (static partition) */ struct ia64_fpreg sc_fr[128]; /* floating-point registers */ + unsigned long int sc_rsvd[16];/* reserved for future use */ /* sc_mask is actually an sigset_t but we don't want to * include the kernel headers here. */ From aj@suse.de Thu Jul 5 01:46:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 05 Jul 2001 01:46:00 -0000 Subject: Synch headers with Linux 2.4.5 Message-ID: I'll commit now the appended patch to update some constants from Linux 2.4.5. Andreas 2001-07-05 Andreas Jaeger Synch with Linux 2.4.5: * sysdeps/unix/sysv/linux/sparc/bits/socket.h (PF_BLUETOOTH): New. (AF_BLUETOOTH): New. * sysdeps/unix/sysv/linux/s390/s390-64/bits/socket.h (PF_BLUETOOTH): New. (AF_BLUETOOTH): New. * sysdeps/unix/sysv/linux/mips/bits/socket.h (AF_BLUETOOTH): New. (PF_BLUETOOTH): New. * sysdeps/unix/sysv/linux/ia64/bits/socket.h (AF_BLUETOOTH): New. (PF_BLUETOOTH): New. * sysdeps/unix/sysv/linux/alpha/bits/socket.h (PF_BLUETOOTH): New. (AF_BLUETOOTH): New. * sysdeps/unix/sysv/linux/bits/socket.h (PF_BLUETOOTH): New. (AF_BLUETOOTH): New. * sysdeps/unix/sysv/linux/net/if_arp.h (ARPHRD_IEEE80211): New. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h (N_HCI): New. * sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h (N_HCI): New. * sysdeps/unix/sysv/linux/bits/ioctl-types.h (N_HCI): New. ============================================================ Index: sysdeps/unix/sysv/linux/sparc/bits/socket.h --- sysdeps/unix/sysv/linux/sparc/bits/socket.h 2001/04/29 12:30:59 1.2 +++ sysdeps/unix/sysv/linux/sparc/bits/socket.h 2001/07/05 08:45:40 @@ -88,6 +88,7 @@ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_BLUETOOTH 31 /* Bluetooth sockets. */ #define PF_MAX 32 /* For now.. */ /* Address families. */ @@ -119,6 +120,7 @@ #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_BLUETOOTH PF_BLUETOOTH #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. ============================================================ Index: sysdeps/unix/sysv/linux/s390/s390-64/bits/socket.h --- sysdeps/unix/sysv/linux/s390/s390-64/bits/socket.h 2001/04/29 18:42:22 1.2 +++ sysdeps/unix/sysv/linux/s390/s390-64/bits/socket.h 2001/07/05 08:45:40 @@ -88,6 +88,7 @@ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_BLUETOOTH 31 /* Bluetooth sockets. */ #define PF_MAX 32 /* For now.. */ /* Address families. */ @@ -119,6 +120,7 @@ #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_BLUETOOTH PF_BLUETOOTH #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. ============================================================ Index: sysdeps/unix/sysv/linux/mips/bits/socket.h --- sysdeps/unix/sysv/linux/mips/bits/socket.h 2001/04/29 12:30:59 1.19 +++ sysdeps/unix/sysv/linux/mips/bits/socket.h 2001/07/05 08:45:40 @@ -88,6 +88,7 @@ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_BLUETOOTH 31 /* Bluetooth sockets. */ #define PF_MAX 32 /* For now.. */ /* Address families. */ @@ -119,6 +120,7 @@ #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_BLUETOOTH PF_BLUETOOTH #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. ============================================================ Index: sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h --- sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h 2000/01/10 11:44:24 1.4 +++ sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h 2001/07/05 08:45:40 @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux/MIPS version. - Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2000, 2001 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 @@ -73,3 +73,4 @@ #define N_SMSBLOCK 12 /* SMS block mode */ #define N_HDLC 13 /* synchronous HDLC */ #define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ ============================================================ Index: sysdeps/unix/sysv/linux/ia64/bits/socket.h --- sysdeps/unix/sysv/linux/ia64/bits/socket.h 2001/04/29 12:30:59 1.2 +++ sysdeps/unix/sysv/linux/ia64/bits/socket.h 2001/07/05 08:45:40 @@ -88,6 +88,7 @@ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_BLUETOOTH 31 /* Bluetooth sockets. */ #define PF_MAX 32 /* For now.. */ /* Address families. */ @@ -119,6 +120,7 @@ #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_BLUETOOTH PF_BLUETOOTH #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. ============================================================ Index: sysdeps/unix/sysv/linux/alpha/bits/socket.h --- sysdeps/unix/sysv/linux/alpha/bits/socket.h 2001/04/29 12:30:59 1.2 +++ sysdeps/unix/sysv/linux/alpha/bits/socket.h 2001/07/05 08:45:40 @@ -88,6 +88,7 @@ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_BLUETOOTH 31 /* Bluetooth sockets. */ #define PF_MAX 32 /* For now.. */ /* Address families. */ @@ -119,6 +120,7 @@ #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_BLUETOOTH PF_BLUETOOTH #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. ============================================================ Index: sysdeps/unix/sysv/linux/bits/socket.h --- sysdeps/unix/sysv/linux/bits/socket.h 2001/04/29 12:30:59 1.45 +++ sysdeps/unix/sysv/linux/bits/socket.h 2001/07/05 08:45:40 @@ -88,6 +88,7 @@ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_BLUETOOTH 31 /* Bluetooth sockets. */ #define PF_MAX 32 /* For now.. */ /* Address families. */ @@ -119,6 +120,7 @@ #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_BLUETOOTH PF_BLUETOOTH #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. ============================================================ Index: sysdeps/unix/sysv/linux/bits/ioctl-types.h --- sysdeps/unix/sysv/linux/bits/ioctl-types.h 1999/10/29 20:23:29 1.4 +++ sysdeps/unix/sysv/linux/bits/ioctl-types.h 2001/07/05 08:45:40 @@ -1,5 +1,5 @@ /* Structure types for pre-termios terminal ioctls. Linux version. - Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 2001 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 @@ -75,3 +75,4 @@ #define N_SMSBLOCK 12 /* SMS block mode */ #define N_HDLC 13 /* synchronous HDLC */ #define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ ============================================================ Index: sysdeps/unix/sysv/linux/net/if_arp.h --- sysdeps/unix/sysv/linux/net/if_arp.h 2001/03/31 19:57:19 1.15 +++ sysdeps/unix/sysv/linux/net/if_arp.h 2001/07/05 08:45:40 @@ -122,7 +122,7 @@ #define ARPHRD_FCPL 786 /* Fibrechanel public loop. */ #define ARPHRD_FCPFABRIC 787 /* Fibrechanel fabric. */ #define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR. */ - +#define ARPHRD_IEEE80211 801 /* IEEE 802.11. */ /* ARP ioctl request. */ struct arpreq ============================================================ Index: sysdeps/unix/sysv/linux/powerpc/bits/termios.h --- sysdeps/unix/sysv/linux/powerpc/bits/termios.h 2001/06/14 00:21:02 1.7 +++ sysdeps/unix/sysv/linux/powerpc/bits/termios.h 2001/07/05 08:45:40 @@ -43,9 +43,9 @@ }; /* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 #define VKILL 3 #define VEOF 4 #define VMIN 5 @@ -54,9 +54,9 @@ #define VEOL2 8 #define VSWTC 9 -#define VWERASE 10 +#define VWERASE 10 #define VREPRINT 11 -#define VSUSP 12 +#define VSUSP 12 #define VSTART 13 #define VSTOP 14 #define VLNEXT 15 @@ -297,3 +297,4 @@ #define N_SMSBLOCK 12 /* SMS block mode */ #define N_HDLC 13 /* synchronous HDLC */ #define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From roland@gnu.org Thu Jul 5 03:22:00 2001 From: roland@gnu.org (Roland McGrath) Date: Thu, 05 Jul 2001 03:22:00 -0000 Subject: PATCH: Add __frame_state_for for gcc 3.0.1 References: <20010704233217.A22588@lucon.org> Message-ID: <20010705102153.7EBF899309@perdition.linnaean.org> > * sysdeps/unix/sysv/linux/alpha/Makefile (sysdep_routines): Add > frame-dwarf2 for elf if $(build-shared) and $(need-frame-dwarf2) > are both yes. > (shared-only-routines): Likewise. > * sysdeps/unix/sysv/linux/arm/Makefile: Likewise. > * sysdeps/unix/sysv/linux/i386/Makefile: Likewise. > * sysdeps/unix/sysv/linux/m68k/Makefile: Likewise. > * sysdeps/unix/sysv/linux/mips/Makefile: Likewise. > * sysdeps/unix/sysv/linux/powerpc/Makefile: Likewise. > * sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Likewise. > * sysdeps/unix/sysv/linux/sparc/Makefile: Likewise. Are these changes in fact linux-specific? Shouldn't the support be included any time elf && build-shared && need-frame-dwarf2, perhaps controlled (for future platforms) by something like SHLIB_COMPAT? From jakub@redhat.com Thu Jul 5 03:29:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 05 Jul 2001 03:29:00 -0000 Subject: PATCH: Add __frame_state_for for gcc 3.0.1 References: <20010704233217.A22588@lucon.org> <20010705102153.7EBF899309@perdition.linnaean.org> Message-ID: <20010705124309.P737@sunsite.ms.mff.cuni.cz> On Thu, Jul 05, 2001 at 06:21:53AM -0400, Roland McGrath wrote: > > * sysdeps/unix/sysv/linux/alpha/Makefile (sysdep_routines): Add > > frame-dwarf2 for elf if $(build-shared) and $(need-frame-dwarf2) > > are both yes. > > (shared-only-routines): Likewise. > > * sysdeps/unix/sysv/linux/arm/Makefile: Likewise. > > * sysdeps/unix/sysv/linux/i386/Makefile: Likewise. > > * sysdeps/unix/sysv/linux/m68k/Makefile: Likewise. > > * sysdeps/unix/sysv/linux/mips/Makefile: Likewise. > > * sysdeps/unix/sysv/linux/powerpc/Makefile: Likewise. > > * sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Likewise. > > * sysdeps/unix/sysv/linux/sparc/Makefile: Likewise. > > Are these changes in fact linux-specific? Shouldn't the support be > included any time elf && build-shared && need-frame-dwarf2, > perhaps controlled (for future platforms) by something like SHLIB_COMPAT? It is specific to the few platforms which are exporting __frame_state_for, which is not all glibc platforms: $ find /usr/src/libc -name Versions | xargs grep -l __frame_state_for /usr/src/libc/sysdeps/mach/hurd/i386/Versions /usr/src/libc/sysdeps/unix/sysv/linux/alpha/Versions /usr/src/libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions /usr/src/libc/sysdeps/unix/sysv/linux/arm/Versions /usr/src/libc/sysdeps/unix/sysv/linux/i386/Versions /usr/src/libc/sysdeps/unix/sysv/linux/m68k/Versions /usr/src/libc/sysdeps/unix/sysv/linux/mips/Versions /usr/src/libc/sysdeps/unix/sysv/linux/powerpc/Versions /usr/src/libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions /usr/src/libc/sysdeps/unix/sysv/linux/sparc/sparc64/Versions ie. hurd/i386 should include it too, but no other platforms should. Jakub From aj@suse.de Thu Jul 5 04:35:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 05 Jul 2001 04:35:00 -0000 Subject: configure patches Message-ID: I've went further through our configure files and managed to remove the Linux/alpha file. I've also changed --disable-sanity-checks which was formerly used for crypt and linuxthreads add-ons to --disable-linuxthreads-check. Ok to commit? Andreas 2001-07-05 Andreas Jaeger * sysdeps/unix/sysv/linux/alpha/configure.in: Removed, it's no longer needed. * sysdeps/unix/sysv/linux/configure.in (libc_cv_linuxVER): Add case for alpha. Rework handling of missing linuxthreads add-on. * configure.in: Rename --disable-sanity-checks to --disable-linuxthreads-check. ============================================================ Index: configure.in --- configure.in 2001/06/16 04:31:44 1.318 +++ configure.in 2001/07/05 11:35:06 @@ -91,10 +91,10 @@ fi], stdio=default) -AC_ARG_ENABLE(sanity-checks, dnl -[ --disable-sanity-checks really do not use threads (should not be used +AC_ARG_ENABLE(linuxthreads-check,dnl +[ --disable-linuxthreads-check really do not use threads (should not be used except in special situations) [default=yes]], - enable_sanity=$enableval, enable_sanity=yes) + enable_linuxthreads_check=$enableval, enable_linuxthreads_check=yes) dnl Arguments to enable or disable building the static, shared, profiled, dnl and -fomit-frame-pointer libraries. ============================================================ Index: sysdeps/unix/sysv/linux/configure.in --- sysdeps/unix/sysv/linux/configure.in 2001/05/11 16:48:37 1.39 +++ sysdeps/unix/sysv/linux/configure.in 2001/07/05 11:35:06 @@ -39,6 +39,9 @@ # kernel headers are young enough. Additionally we have minimal # kernel versions for some architectures. case "$machine" in + alpha*) + arch_minimum_kernel=2.1.100 + ;; mips*) arch_minimum_kernel=2.2.15 ;; @@ -122,27 +125,26 @@ case $add_ons in # It is available. Good. *linuxthreads*) - message= + linuxthreads_missing= ;; *) - message="\ -*** WARNING: Are you sure you do not want to use the \`linuxthreads' -*** add-on?" + linuxthreads_missing=yes ;; esac -if test "$message"; then - if test $enable_sanity = yes; then +if test "$linuxthreads_missing"; then + if test $enable_linuxthreads_check = yes; then echo "\ -*** You should not compile the GNU libc without the \`linuxthreads' -*** add-on. Not using them risks being incompatible with the -*** libraries of other systems. Consider getting the add-on and restarting -*** the configuration. +*** On GNU/Linux systems it is normal to compile GNU libc with the +*** \`linuxthreads' add-on. Without that, the library will be +*** incompatible with normal GNU/Linux systems. *** If you really mean to not use this add-on, run configure again -*** using the extra parameter \`--disable-sanity-checks'." +*** using the extra parameter \`--disable-linuxthreads-check'." exit 1 else - echo "$message" + echo "\ +*** WARNING: Are you sure you do not want to use the \`linuxthreads' +*** add-on?" fi fi ============================================================ Index: sysdeps/unix/sysv/linux/alpha/configure.in --- sysdeps/unix/sysv/linux/alpha/configure.in Sat Aug 22 00:29:33 1998 1.1 +++ sysdeps/unix/sysv/linux/alpha/configure.in removed @@ -1,36 +0,0 @@ -sinclude(./aclocal.m4)dnl Autoconf lossage -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/unix/sysv/linux/alpha. - -# Don't bother trying to generate any glue code to be compatible with the -# existing system library, because we are the only system library. -inhibit_glue=yes - -define([LIBC_LINUX_VERSION],[2.1.100])dnl -if test -n "$sysheaders"; then - OLD_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $SYSINCLUDES" -fi -define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl -AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl -AC_TRY_COMPILE([#include ], -[#if LINUX_VERSION_CODE < ]dnl -patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl -[ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[ -eat flaming death -#endif], - libc_cv_linuxVER='LIBC_LINUX_VERSION or later', - libc_cv_linuxVER='TOO OLD!')]) -if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then - AC_MSG_ERROR([GNU libc requires kernel header files from -Linux LIBC_LINUX_VERSION or later to be installed before configuring. -The kernel header files are found usually in /usr/include/asm and -/usr/include/linux; make sure these directories use files from -Linux LIBC_LINUX_VERSION or later. This check uses , so -make sure that file was built correctly when installing the kernel header -files. To use kernel headers not from /usr/include/linux, use the -configure option --with-headers.]) -fi -if test -n "$sysheaders"; then - CFLAGS=$OLD_CFLAGS -fi -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From aj@suse.de Thu Jul 5 04:43:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 05 Jul 2001 04:43:00 -0000 Subject: configure patches References: Message-ID: Here's an updated patch which fixes also PR libc/2369, Andreas 2001-07-05 Andreas Jaeger * config.make.in (sysconfdir): Replace correctly. Closes PR libc/2369, reported by Peter Simons . * sysdeps/unix/sysv/linux/alpha/configure.in: Removed, it's no longer needed. * sysdeps/unix/sysv/linux/configure.in (libc_cv_linuxVER): Add case for alpha. Rework handling of missing linuxthreads add-on. * configure.in: Rename --disable-sanity-checks to --disable-linuxthreads-check. Remove unused sysconfdir substitution. ============================================================ Index: configure.in --- configure.in 2001/06/16 04:31:44 1.318 +++ configure.in 2001/07/05 11:43:13 @@ -91,10 +91,10 @@ fi], stdio=default) -AC_ARG_ENABLE(sanity-checks, dnl -[ --disable-sanity-checks really do not use threads (should not be used +AC_ARG_ENABLE(linuxthreads-check,dnl +[ --disable-linuxthreads-check really do not use threads (should not be used except in special situations) [default=yes]], - enable_sanity=$enableval, enable_sanity=yes) + enable_linuxthreads_check=$enableval, enable_linuxthreads_check=yes) dnl Arguments to enable or disable building the static, shared, profiled, dnl and -fomit-frame-pointer libraries. ============================================================ Index: config.make.in --- config.make.in 2001/03/18 21:27:28 1.76 +++ config.make.in 2001/07/05 11:43:13 @@ -13,7 +13,7 @@ libdir = @libdir@ slibdir = @libc_cv_slibdir@ localedir = @libc_cv_localedir@ -sysconfdir = @libc_cv_sysconfdir@ +sysconfdir = @sysconfdir@ libexecdir = @libexecdir@ rootsbindir = @libc_cv_rootsbindir@ infodir = @infodir@ @@ -45,6 +45,8 @@ need-nopic-initfini = @nopic_initfini@ with-cvs = @with_cvs@ old-glibc-headers = @old_glibc_headers@ + +need-frame-dwarf2 = @libc_cv_frame_dwarf2@ versioning = @VERSIONING@ oldest-abi = @oldest_abi@ ============================================================ Index: sysdeps/unix/sysv/linux/configure.in --- sysdeps/unix/sysv/linux/configure.in 2001/05/11 16:48:37 1.39 +++ sysdeps/unix/sysv/linux/configure.in 2001/07/05 11:43:13 @@ -39,6 +39,9 @@ # kernel headers are young enough. Additionally we have minimal # kernel versions for some architectures. case "$machine" in + alpha*) + arch_minimum_kernel=2.1.100 + ;; mips*) arch_minimum_kernel=2.2.15 ;; @@ -122,27 +125,26 @@ case $add_ons in # It is available. Good. *linuxthreads*) - message= + linuxthreads_missing= ;; *) - message="\ -*** WARNING: Are you sure you do not want to use the \`linuxthreads' -*** add-on?" + linuxthreads_missing=yes ;; esac -if test "$message"; then - if test $enable_sanity = yes; then +if test "$linuxthreads_missing"; then + if test $enable_linuxthreads_check = yes; then echo "\ -*** You should not compile the GNU libc without the \`linuxthreads' -*** add-on. Not using them risks being incompatible with the -*** libraries of other systems. Consider getting the add-on and restarting -*** the configuration. +*** On GNU/Linux systems it is normal to compile GNU libc with the +*** \`linuxthreads' add-on. Without that, the library will be +*** incompatible with normal GNU/Linux systems. *** If you really mean to not use this add-on, run configure again -*** using the extra parameter \`--disable-sanity-checks'." +*** using the extra parameter \`--disable-linuxthreads-check'." exit 1 else - echo "$message" + echo "\ +*** WARNING: Are you sure you do not want to use the \`linuxthreads' +*** add-on?" fi fi ============================================================ Index: sysdeps/unix/sysv/linux/alpha/configure.in --- sysdeps/unix/sysv/linux/alpha/configure.in Sat Aug 22 00:29:33 1998 1.1 +++ sysdeps/unix/sysv/linux/alpha/configure.in removed @@ -1,36 +0,0 @@ -sinclude(./aclocal.m4)dnl Autoconf lossage -GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. -# Local configure fragment for sysdeps/unix/sysv/linux/alpha. - -# Don't bother trying to generate any glue code to be compatible with the -# existing system library, because we are the only system library. -inhibit_glue=yes - -define([LIBC_LINUX_VERSION],[2.1.100])dnl -if test -n "$sysheaders"; then - OLD_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $SYSINCLUDES" -fi -define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl -AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl -AC_TRY_COMPILE([#include ], -[#if LINUX_VERSION_CODE < ]dnl -patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl -[ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[ -eat flaming death -#endif], - libc_cv_linuxVER='LIBC_LINUX_VERSION or later', - libc_cv_linuxVER='TOO OLD!')]) -if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then - AC_MSG_ERROR([GNU libc requires kernel header files from -Linux LIBC_LINUX_VERSION or later to be installed before configuring. -The kernel header files are found usually in /usr/include/asm and -/usr/include/linux; make sure these directories use files from -Linux LIBC_LINUX_VERSION or later. This check uses , so -make sure that file was built correctly when installing the kernel header -files. To use kernel headers not from /usr/include/linux, use the -configure option --with-headers.]) -fi -if test -n "$sysheaders"; then - CFLAGS=$OLD_CFLAGS -fi -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Thu Jul 5 10:23:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 05 Jul 2001 10:23:00 -0000 Subject: configure patches References: Message-ID: Andreas Jaeger writes: > I've went further through our configure files and managed to remove > the Linux/alpha file. That's fine. > I've also changed --disable-sanity-checks which > was formerly used for crypt and linuxthreads add-ons to > --disable-linuxthreads-check. I don't like this. What if we in future need this flag again for something else? Do you want to rename it again or add another one? You can leave the name, it doesn't hurt anybody. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Thu Jul 5 10:53:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 05 Jul 2001 10:53:00 -0000 Subject: configure patches References: Message-ID: Ulrich Drepper writes: > Andreas Jaeger writes: > >> I've went further through our configure files and managed to remove >> the Linux/alpha file. > > That's fine. > >> I've also changed --disable-sanity-checks which >> was formerly used for crypt and linuxthreads add-ons to >> --disable-linuxthreads-check. > > I don't like this. What if we in future need this flag again for > something else? Do you want to rename it again or add another one? > You can leave the name, it doesn't hurt anybody. Shall I leave the name and add all the rest? Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Thu Jul 5 11:08:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 05 Jul 2001 11:08:00 -0000 Subject: configure patches References: Message-ID: Andreas Jaeger writes: > Shall I leave the name and add all the rest? Yes. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Thu Jul 5 22:01:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 05 Jul 2001 22:01:00 -0000 Subject: LGPL diff Message-ID: I'll start now with adding the LGPL v2.1 to the files. This might take some time and I'll tell you when I'm finished. I've tagged the current sources with the tag pre-lgpgv2_1, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Fri Jul 6 02:46:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 06 Jul 2001 02:46:00 -0000 Subject: [PATCH] Fix i386-*-linux sigaction Message-ID: <20010706115956.V737@sunsite.ms.mff.cuni.cz> Hi! While building glibc with -gdwarf-2 I've noticed that these two asms lack explicit section specification (and as gcc does not say which section it will be in at that time, both gcc-2.96-RH and gcc 3.0 would put __restore_rt and __restore into .debug_line section, which is probably not what we want). 2001-07-06 Jakub Jelinek * sysdeps/unix/sysv/linux/i386/sigaction.c (RESTORE2): Put asm explicitely into .text section. --- libc/sysdeps/unix/sysv/linux/i386/sigaction.c.jj Mon Jun 25 10:35:00 2001 +++ libc/sysdeps/unix/sysv/linux/i386/sigaction.c Fri Jul 6 11:42:04 2001 @@ -163,7 +163,8 @@ weak_alias (__libc_sigaction, sigaction) #define RESTORE2(name, syscall) \ asm \ ( \ - ".align 16\n" \ + ".text\n" \ + " .align 16\n" \ "__" #name ":\n" \ " movl $" #syscall ", %eax\n" \ " int $0x80" \ @@ -179,7 +180,8 @@ RESTORE (restore_rt, __NR_rt_sigreturn) # define RESTORE2(name, syscall) \ asm \ ( \ - ".align 8\n" \ + ".text\n" \ + " .align 8\n" \ "__" #name ":\n" \ " popl %eax\n" \ " movl $" #syscall ", %eax\n" \ Jakub From drepper@redhat.com Sat Jul 7 15:55:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sat, 07 Jul 2001 15:55:00 -0000 Subject: [patch] ia64 sigcontext References: <200107041713.NAA25716@trained-monkey.org> Message-ID: Jes Sorensen writes: > A small patch to bring the Linux/ia64 sigcontext structure in sync with > the kernel definition. Applied. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Sat Jul 7 15:56:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sat, 07 Jul 2001 15:56:00 -0000 Subject: [PATCH] Fix i386-*-linux sigaction References: <20010706115956.V737@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > While building glibc with -gdwarf-2 I've noticed that these two asms lack > explicit section specification (and as gcc does not say which section it > will be in at that time, both gcc-2.96-RH and gcc 3.0 would put __restore_rt > and __restore into .debug_line section, which is probably not what we want). Thanks, I've applied it. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From bmark@us.ibm.com Mon Jul 9 07:38:00 2001 From: bmark@us.ibm.com (Mark Brown) Date: Mon, 09 Jul 2001 07:38:00 -0000 Subject: glibc and gcc SCs are working to resolve libgcc issues Message-ID: glibc hackers & users; The glibc and gcc steering committees, in a long-overdue move, are going to be working together to resolve the issues raised by the introduction of gcc3. We are already talking to several glibc developers to get their views and ideas. While we think that technical efforts to resolve compatibility problems should continue (of course) , I personally hope that patches which directly set long-term direction can be put off a little longer until a consensus is reached on proper direction and long-term correctness. -- Mark S. Brown bmark@us.ibm.com From jes@trained-monkey.org Mon Jul 9 15:15:00 2001 From: jes@trained-monkey.org (Jes Sorensen) Date: Mon, 09 Jul 2001 15:15:00 -0000 Subject: LGPL diff References: Message-ID: >>>>> "Andreas" == Andreas Jaeger writes: Andreas> I'll start now with adding the LGPL v2.1 to the files. This Andreas> might take some time and I'll tell you when I'm finished. Andreas> I've tagged the current sources with the tag pre-lgpgv2_1, Looking at the patch that's been committed I noticed that every single file has been upgraded to refer to LGPL v2.1 as a minimum requirement. While the old reference said "v2.0 or later" I'd claim it should cover 2.0 as well. Was it really necessary to force 2.1 upon people with it's idiotic name change? Jes From drepper@redhat.com Mon Jul 9 16:23:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 09 Jul 2001 16:23:00 -0000 Subject: LGPL diff References: Message-ID: Jes Sorensen writes: > Was it really necessary to force 2.1 upon people with it's idiotic > name change? Not only name change. Read the license itself. The insulting wordings RMS put in their must appall any decent person. I'm 100% against this change which is supported only to make businesses happy. I haven't written a single line of code with this goal and so this change is counter all I ever intended. I'll write more when I have time. I hope that all who enforced this stupid change on us will walk with brown paper bags on their heads. I'm disgusted and can assure you that each of you dropped significantly in my opinion of you. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Tue Jul 10 01:38:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 10 Jul 2001 01:38:00 -0000 Subject: ldouble tests on sparc64 Message-ID: Running the testsuite on sparc64, I get lots of serious failures while testing the long double functions (see below). Are these known problems or might this be a compiler bug in the handling of long doubles (I've tried gcc 2.96 RH)? Jakub, what are your results on sparc64? Andreas phex:/usr/src/packages/BUILD/glibc-2.2/cc # cat math/test-ldouble.out testing long double (without inline functions) Failure: Test: acos (1) == 0 Result: is: 3.14159265358979323846e+00 0x1.921fb54442d18469898dp+1 should be: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 difference: 3.14159265358979323846e+00 0x1.921fb54442d18469898dp+1 ulp : 16312081666030376401667486162748272.0000 max.ulp : 0.0000 Failure: Test: acos (-1) == pi Result: is: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 should be: 3.14159265358979323846e+00 0x1.921fb54442d18469898dp+1 difference: 3.14159265358979323846e+00 0x1.921fb54442d18469898dp+1 ulp : 8156040833015188200833743081374136.0000 max.ulp : 0.0000 Failure: Test: acos (0.7) == 0.79539883018414355549096833892476432 Result: is: 7.95398830184143555491e-01 0x1.973e83f5d5c9aaf84fcap-1 should be: 7.95398830184143555491e-01 0x1.973e83f5d5c9aaf84fcap-1 difference: 9.62964972193617926528e-35 0x1.00000000000000000000p-113 ulp : 1.0000 max.ulp : 0.0000 Maximal error of `acos' is : 16312081666030376401667486162748272.0000 ulp accepted: 0.0000 ulp Failure: Test: asinh (0.7) == 0.652666566082355786 Result: is: 6.52666566082355786809e-01 0x1.4e2a4fe9085dd731ba02p-1 should be: 6.52666566082355786000e-01 0x1.4e2a4fe9085dd713e42ep-1 difference: 8.08686344109675845571e-19 0x1.dd5d39a4c60190000000p-61 ulp : 8397879128121369.0000 max.ulp : 0.0000 Maximal error of `asinh' is : 8397879128121369.0000 ulp accepted: 0.0000 ulp Failure: Test: cosh (0.7) == 1.255169005630943018 Result: is: 1.25516900563094301816e+00 0x1.4152c1862342ef8e074bp+0 should be: 1.25516900563094301800e+00 0x1.4152c1862342ef8afda4p+0 difference: 1.64674740990296899314e-19 0x1.84d3c5ea963980000000p-63 ulp : 855040140323955.0000 max.ulp : 0.0000 Maximal error of `cosh' is : 855040140323955.0000 ulp accepted: 0.0000 ulp Failure: Test: sinh (0.7) == 0.75858370183953350346 Result: is: 7.58583701839533503460e-01 0x1.8465153d5bdbd0df16f9p-1 should be: 7.58583701839533503460e-01 0x1.8465153d5bdbd0df1828p-1 difference: 1.25352407231905242755e-22 0x1.2f1561c8900000000000p-73 ulp : 1301733820560.0000 max.ulp : 0.0000 Maximal error of `sinh' is : 1301733820560.0000 ulp accepted: 0.0000 ulp Failure: Test: tanh (0.7) == 0.60436777711716349631 Result: is: 6.04367777117163496309e-01 0x1.356fb17af2e9100a0837p-1 should be: 6.04367777117163496310e-01 0x1.356fb17af2e9100a149dp-1 difference: 1.31281689617357568517e-21 0x1.8cc64999b26000000000p-70 ulp : 13633070091667.0000 max.ulp : 0.0000 Failure: Test: tanh (-0.7) == -0.60436777711716349631 Result: is: -6.04367777117163496309e-01 -0x1.356fb17af2e9100a0837p-1 should be: -6.04367777117163496310e-01 -0x1.356fb17af2e9100a149dp-1 difference: 1.31281689617357568517e-21 0x1.8cc64999b26000000000p-70 ulp : 13633070091667.0000 max.ulp : 0.0000 Failure: Test: tanh (1.0) == 0.7615941559557648881194582826047935904 Result: is: 7.61594155955764888119e-01 0x1.85efab514f394558632cp-1 should be: 7.61594155955764888119e-01 0x1.85efab514f394558632cp-1 difference: 9.62964972193617926528e-35 0x1.00000000000000000000p-113 ulp : 1.0000 max.ulp : 0.0000 Failure: Test: tanh (-1.0) == -0.7615941559557648881194582826047935904 Result: is: -7.61594155955764888119e-01 -0x1.85efab514f394558632cp-1 should be: -7.61594155955764888119e-01 -0x1.85efab514f394558632cp-1 difference: 9.62964972193617926528e-35 0x1.00000000000000000000p-113 ulp : 1.0000 max.ulp : 0.0000 Maximal error of `tanh' is : 13633070091667.0000 ulp accepted: 0.0000 ulp Failure: Test: expm1 (-0) == -0 Result: is: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 should be: -0.00000000000000000000e+00 -0x0.00000000000000000000p+0 difference: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 ulp : 0.0000 max.ulp : 0.0000 Failure: expm1 (NaN) == NaN: Exception "Invalid operation" set Failure: Test: expm1 (1) == M_El - 1.0 Result: is: 1.71828182845904523536e+00 0x1.b7e151628aed2a6abf71p+0 should be: 1.71828182845904523536e+00 0x1.b7e151628aed2a6abf71p+0 difference: 1.92592994438723585306e-34 0x1.00000000000000000000p-112 ulp : 1.0000 max.ulp : 0.0000 Failure: Test: expm1 (0.7) == 1.0137527074704765216 Result: is: 1.01375270747047652162e+00 0x1.03854c24d130d7fd92c8p+0 should be: 1.01375270747047652160e+00 0x1.03854c24d130d7fd1edap+0 difference: 2.45493885830653538343e-20 0x1.cfb98f1123c400000000p-66 ulp : 127467713218801.0000 max.ulp : 0.0000 Maximal error of `expm1' is : 127467713218801.0000 ulp accepted: 0.0000 ulp Failure: Test: log1p (-0) == -0 Result: is: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 should be: -0.00000000000000000000e+00 -0x0.00000000000000000000p+0 difference: 0.00000000000000000000e+00 0x0.00000000000000000000p+0 ulp : 0.0000 max.ulp : 0.0000 Failure: log1p (-1) == -inf plus division by zero exception: Exception "Divide by zero" not set Failure: log1p (NaN) == NaN: Exception "Invalid operation" set Failure: Test: log1p (M_El - 1.0) == 1 Result: is: 1.00000000000000000000e-00 0x2.00000000000000000000p-1 should be: 1.00000000000000000000e+00 0x1.00000000000000000000p+0 difference: 9.62964972193617926528e-35 0x1.00000000000000000000p-113 ulp : 0.5000 max.ulp : 0.0000 Failure: Test: log1p (-0.3) == -0.35667494393873237891263871124118447 Result: is: -3.56674943938732378913e-01 -0x1.6d3c324e13f4ec52cb1bp-2 should be: -3.56674943938732378913e-01 -0x1.6d3c324e13f4ec52cb1bp-2 difference: 4.81482486096808963264e-35 0x1.00000000000000000000p-114 ulp : 1.0000 max.ulp : 0.0000 Maximal error of `log1p' is : 1.0000 ulp accepted: 0.0000 ulp Failure: Test: Real part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i Result: is: 1.38486576453121110799e+00 0x1.6286901002f7766f09ffp+0 should be: 1.38486576453121110800e+00 0x1.6286901002f7766f2d4dp+0 difference: 7.47636787767084019408e-21 0x1.1a72fe49d40800000000p-67 ulp : 38819521444481.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i Result: is: -9.72421703358300286193e-01 -0x1.f1e141ebb064055d790ap-1 should be: -9.72421703358300286190e-01 -0x1.f1e141ebb064055d5ca4p-1 difference: 3.00683508283153742657e-21 0x1.c6614c5313d000000000p-69 ulp : 31224760709437.0000 max.ulp : 0.0000 Failure: Test: Real part of: ccos (-2 - 3 i) == -4.1896256909688072301 - 9.1092278937553365979 i Result: is: -4.18962569096880723013e+00 -0x1.0c22d3cb4c50c447f284p+2 should be: -4.18962569096880723010e+00 -0x1.0c22d3cb4c50c447cc15p+2 difference: 3.25550196159744832644e-20 0x1.33793521943800000000p-65 ulp : 42258831520391.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: ccos (-2 - 3 i) == -4.1896256909688072301 - 9.1092278937553365979 i Result: is: -9.10922789375533659798e+00 -0x1.237ecb7eefaf2c0f2d69p+3 should be: -9.10922789375533659790e+00 -0x1.237ecb7eefaf2c0efea9p+3 difference: 7.91972627788630793578e-20 0x1.75ff9da620f000000000p-64 ulp : 51401962341406.0000 max.ulp : 0.0000 Maximal error of real part of: ccos is : 42258831520391.0000 ulp accepted: 0.0000 ulp Maximal error of imaginary part of: ccos is : 51401962341406.0000 ulp accepted: 0.0000 ulp Failure: Test: Real part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i Result: is: 4.54820222369147765419e-01 0x1.d1bc64728a2d005e4e19p-2 should be: 4.54820222369147765400e-01 0x1.d1bc64728a2d005ce68ep-2 difference: 1.90339416362119856540e-20 0x1.678a7e74f69b00000000p-66 ulp : 395319501452955.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i Result: is: 7.07029660092153768241e-01 0x1.69ffcaa6cbac0507f7fep-1 should be: 7.07029660092153768200e-01 0x1.69ffcaa6cbac050673dcp-1 difference: 4.10955359795455808950e-20 0x1.8422e8b6657f00000000p-65 ulp : 426760444732799.0000 max.ulp : 0.0000 Failure: Test: Real part of: ccosh (-2 - 3 i) == -3.7245455049153225654 + 0.5118225699873846088 i Result: is: -3.72454550491532256547e+00 -0x1.dcbde838099d74abb58cp+1 should be: -3.72454550491532256540e+00 -0x1.dcbde838099d74ab06e3p+1 difference: 7.39707032559728934121e-20 0x1.5d5117d2dbd000000000p-64 ulp : 192038925069800.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: ccosh (-2 - 3 i) == -3.7245455049153225654 + 0.5118225699873846088 i Result: is: 5.11822569987384608834e-01 0x1.060d9b9ee6a65de2db56p-1 should be: 5.11822569987384608800e-01 0x1.060d9b9ee6a65de195d6p-1 difference: 3.44638498018757310698e-20 0x1.458079c9f0bf00000000p-65 ulp : 357893078118591.0000 max.ulp : 0.0000 Maximal error of real part of: ccosh is : 395319501452955.0000 ulp accepted: 0.0000 ulp Maximal error of imaginary part of: ccosh is : 426760444732799.0000 ulp accepted: 0.0000 ulp Failure: Test: Real part of: csin (0.7 + 1.2 i) == 1.1664563419657581376 + 1.1544997246948547371 i Result: is: 1.16645634196575813756e+00 0x1.2a9ce200f468c3436a7cp+0 should be: 1.16645634196575813760e+00 0x1.2a9ce200f468c34428dap+0 difference: 4.03112213244929697153e-20 0x1.7cba8d747da600000000p-65 ulp : 209307827846867.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: csin (0.7 + 1.2 i) == 1.1664563419657581376 + 1.1544997246948547371 i Result: is: 1.15449972469485473706e+00 0x1.278d4b40ce2f0033ddafp+0 should be: 1.15449972469485473710e+00 0x1.278d4b40ce2f00348631p+0 difference: 3.56827762193615058161e-20 0x1.5103a8b2891000000000p-65 ulp : 185275566867592.0000 max.ulp : 0.0000 Failure: Test: Real part of: csin (-2 - 3 i) == -9.1544991469114295734 + 4.1689069599665643507 i Result: is: -9.15449914691142957347e+00 -0x1.24f1a831e7d2db7d75a5p+3 should be: -9.15449914691142957340e+00 -0x1.24f1a831e7d2db7d4debp+3 difference: 6.72995446098336976393e-20 0x1.3dd028397be000000000p-64 ulp : 43679901757308.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: csin (-2 - 3 i) == -9.1544991469114295734 + 4.1689069599665643507 i Result: is: 4.16890695996656435075e+00 0x1.0acf5f2347e219fb76dfp+2 should be: 4.16890695996656435070e+00 0x1.0acf5f2347e219fb3629p+2 difference: 5.48130588537556343472e-20 0x1.02d8ec0ec4f000000000p-64 ulp : 71151418323260.0000 max.ulp : 0.0000 Maximal error of real part of: csin is : 209307827846867.0000 ulp accepted: 0.0000 ulp Maximal error of imaginary part of: csin is : 185275566867592.0000 ulp accepted: 0.0000 ulp Failure: Test: Real part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i Result: is: 2.74878686781175835815e-01 0x1.1979cc685eccb1d6d6a7p-2 should be: 2.74878686781175835820e-01 0x1.1979cc685eccb1d72bfap-2 difference: 4.51705520690466925452e-21 0x1.554c8e004bf800000000p-68 ulp : 93815566242558.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i Result: is: 1.16986657274265651387e+00 0x1.2b7c602e9d02320ec0b7p+0 should be: 1.16986657274265651390e+00 0x1.2b7c602e9d02320f40ecp+0 difference: 2.71487451592385631293e-20 0x1.0069a35311aa00000000p-65 ulp : 140964344203477.0000 max.ulp : 0.0000 Failure: Test: Real part of: csinh (-2 - 3 i) == 3.5905645899857799520 - 0.5309210862485198052 i Result: is: 3.59056458998577995201e+00 0x1.cb979ed81510c2c39f97p+1 should be: 3.59056458998577995200e+00 0x1.cb979ed81510c2c381ecp+1 difference: 1.25654477948170603913e-20 0x1.dab58ddf9e4000000000p-67 ulp : 32621767555556.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: csinh (-2 - 3 i) == 3.5905645899857799520 - 0.5309210862485198052 i Result: is: -5.30921086248519805267e-01 -0x1.0fd4e37c636c986b1916p-1 should be: -5.30921086248519805200e-01 -0x1.0fd4e37c636c98689fe9p-1 difference: 6.70400906606765716814e-20 0x1.3c967f1dd5c900000000p-64 ulp : 696184104266642.0000 max.ulp : 0.0000 Maximal error of real part of: csinh is : 93815566242558.0000 ulp accepted: 0.0000 ulp Maximal error of imaginary part of: csinh is : 696184104266642.0000 ulp accepted: 0.0000 ulp Failure: Test: Real part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i Result: is: 1.72073419763034900130e-01 0x1.606807732519758c3801p-3 should be: 1.72073419763034900100e-01 0x1.6068077325197587cd7ap-3 difference: 2.99248446332855293596e-20 0x1.1aa1d5aba3de80000000p-65 ulp : 1243029414252410.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i Result: is: 9.54480705998940553818e-01 0x1.e8b1b1f1db5c93f997f7p-1 should be: 9.54480705998940553800e-01 0x1.e8b1b1f1db5c93f8f197p-1 difference: 1.76153916578609461805e-20 0x1.4cbecea415f000000000p-66 ulp : 182928685533944.0000 max.ulp : 0.0000 Failure: Test: Real part of: ctan (-2 - 3 i) == 0.0037640256415042482 - 1.0032386273536098014 i Result: is: 3.76402564150424829275e-03 0x1.ed5bbe102970caf35086p-9 should be: 3.76402564150424820000e-03 0x1.ed5bbe102970c7874dd5p-9 difference: 9.27512211303226914083e-20 0x1.b60158951c13a2800000p-64 ulp : 246575039539324741.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: ctan (-2 - 3 i) == 0.0037640256415042482 - 1.0032386273536098014 i Result: is: -1.00323862735360980145e+00 -0x1.00d43f269153cff541f8p+0 should be: -1.00323862735360980140e+00 -0x1.00d43f269153cff4670cp+0 difference: 4.63585978219273727559e-20 0x1.b5d83634569200000000p-65 ulp : 240707601836873.0000 max.ulp : 0.0000 Maximal error of real part of: ctan is : 246575039539324741.0000 ulp accepted: 0.0000 ulp Maximal error of imaginary part of: ctan is : 240707601836873.0000 ulp accepted: 0.0000 ulp Failure: Test: Real part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i Result: is: 1.34721973990611916300e+00 0x1.58e364936c22ecd622f7p+0 should be: 1.34721973990611916300e+00 0x1.58e364936c22ecd60f39p+0 difference: 4.18064448364791006814e-21 0x1.3be16cc9098000000000p-68 ulp : 21707147219096.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i Result: is: 4.77864103832636554031e-01 0x1.e955352792f77fa0888ep-2 should be: 4.77864103832636554000e-01 0x1.e955352792f77f9e430ep-2 difference: 3.07843344242600000865e-20 0x1.22bff415514580000000p-65 ulp : 639365611692683.0000 max.ulp : 0.0000 Failure: Test: Real part of: ctanh (-2 - 3 i) == -0.9653858790221331242 + 0.0098843750383224937 i Result: is: -9.65385879022133124278e-01 -0x1.ee470ed4d72e2f093fe1p-1 should be: -9.65385879022133124200e-01 -0x1.ee470ed4d72e2f065aa7p-1 difference: 7.84802693945607960525e-20 0x1.729cd2f1c16900000000p-64 ulp : 814985712468690.0000 max.ulp : 0.0000 Failure: Test: Imaginary part of: ctanh (-2 - 3 i) == -0.9653858790221331242 + 0.0098843750383224937 i Result: is: 9.88437503832249372031e-03 0x1.43e425c3f79b5196f5bep-7 should be: 9.88437503832249370000e-03 0x1.43e425c3f79b5166fea9p-7 difference: 2.03140343035012093862e-20 0x1.7fb8a46c78f838000000p-66 ulp : 13500991551774471.0000 max.ulp : 0.0000 Maximal error of real part of: ctanh is : 814985712468690.0000 ulp accepted: 0.0000 ulp Maximal error of imaginary part of: ctanh is : 13500991551774471.0000 ulp accepted: 0.0000 ulp Test suite completed: 2052 test cases plus 1869 tests for exception flags executed. 56 errors occurred. -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Wed Jul 11 05:08:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Wed, 11 Jul 2001 05:08:00 -0000 Subject: [PATCH] Fix comment typo Message-ID: <20010711141101.C899@sunsite.ms.mff.cuni.cz> Hi! Just came over this. 2001-07-11 Jakub Jelinek * iconv/gconv_int.h: Fix comment typo. --- libc/iconv/gconv_int.h.jj Mon Nov 20 13:47:59 2000 +++ libc/iconv/gconv_int.h Wed Jul 11 14:17:39 2001 @@ -38,7 +38,7 @@ extern struct path_elem *__gconv_path_el extern size_t __gconv_max_path_elem_len; -/* Structure for alias definition. Simply to strings. */ +/* Structure for alias definition. Simply two strings. */ struct gconv_alias { char *fromname; Jakub From jakub@redhat.com Wed Jul 11 11:05:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Wed, 11 Jul 2001 11:05:00 -0000 Subject: [PATCH] dl_next_phdr (was Re: fde-glibc.c bug) References: <200107020854.f628sOS01676@jeswick.caldera.de> <20010702055546.I32061@devserv.devel.redhat.com> <20010702175906.O32061@devserv.devel.redhat.com> <20010703052922.Q32061@devserv.devel.redhat.com> <20010703094940.A25128@redhat.com> Message-ID: <20010711200753.G899@sunsite.ms.mff.cuni.cz> On Tue, Jul 03, 2001 at 09:49:40AM -0700, Richard Henderson wrote: > On Tue, Jul 03, 2001 at 05:29:22AM -0400, Jakub Jelinek wrote: > > > I haven't looked at the problem and won't do it. Not my job. I'll > > > not accept any additional exposure of existing data structures and no > > > new global variables. > > > > Ok, in that case I guess the only remaining solution is to do what > > fde-glibc.c does inside of glibc, so that glibc internals don't have to be > > exposed, because I don't think fde-glibc.c can find the ELF headers of > > shared libraries just from the link_map exported portion. > > This is unfortunate. It's not like libgcc is the only application > that wants to iterate over the set of mapped DSOs. > > I'd be disapointed if the preferred solution was just to take > _Unwind_FindTableEntry (or _Unwind_Find_FDE) and drop it into glibc. > That would mean that the next time someone wanted to do something > similar, they'd not be able. > > How about a for_each_dso type function that took a callback, takes > care of the locking, passes the link_map and mapping bounds? The > callback returns 0 to keep searching, non-zero is passed back to > the caller. How about this? This one does not have callback, but of course can be easily changed into one if that is desired. It does not do any locking (yet), but AFAIC dlsym and other functions don't do any locking either. There is another problem too: we don't compute l_phdr nor l_phnum for the dynamic linker at all. On IA-64 it would be easy to get that using the segrel trick in the dynamic linker, but as generic solution I can think just of: ehdr = (ElfW(Ehdr) *)(_dl_rtld_map.l_addr + (_dl_rtld_map.l_info[DT_HASH]->d_un.d_ptr & ~(ElfW(Addr))1023)); and go from there on. 2001-07-11 Jakub Jelinek * elf/Makefile (routines): Add dl-nextphdr and dl-nextphdrs. (elide-routines.os): Add dl-nextphdrs. * elf/dl-nextphdr.c: New. * elf/link.h (struct dl_phdr_info, dl_next_phdr): New. * elf/Versions (dl_next_phdr): Add at GLIBC_2.2.4. * include/link.h (struct dl_phdr_info): New. (dl_next_phdr, __dl_next_phdr): New. * sysdeps/generic/dl-nextphdrs.c: New. * sysdeps/unix/sysv/linux/ia64/dl-nextphdrs.c: New. --- libc/elf/Makefile.jj Mon Jun 25 10:50:33 2001 +++ libc/elf/Makefile Wed Jul 11 19:11:01 2001 @@ -21,8 +21,9 @@ subdir := elf headers = elf.h bits/elfclass.h link.h -routines = $(dl-routines) dl-open dl-close dl-support \ - dl-addr enbl-secure dl-profstub dl-origin dl-libc dl-sym +routines = $(dl-routines) dl-open dl-close dl-support dl-nextphdr \ + dl-nextphdrs dl-addr enbl-secure dl-profstub dl-origin \ + dl-libc dl-sym # The core dynamic linking functions are in libc for the static and # profiled libraries. @@ -31,7 +32,7 @@ dl-routines = $(addprefix dl-,load cache version profile) all-dl-routines = $(dl-routines) $(sysdep-dl-routines) # But they are absent from the shared libc, because that code is in ld.so. -elide-routines.os = $(all-dl-routines) dl-support enbl-secure +elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-nextphdrs # ld.so uses those routines, plus some special stuff for being the program # interpreter and operating independent of libc. --- libc/elf/dl-nextphdr.c.jj Wed Jul 11 17:19:29 2001 +++ libc/elf/dl-nextphdr.c Wed Jul 11 19:53:37 2001 @@ -0,0 +1,48 @@ +/* Get shared library's program headers. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +#ifdef SHARED + +const struct link_map * +__dl_next_phdr (struct dl_phdr_info *info, const struct link_map *l) +{ + if (l == NULL) + l = _dl_loaded; + else + l = l->l_next; + + if (l == NULL) + { + __set_errno (0); + return NULL; + } + + info->dlpi_phdr = l->l_phdr; + info->dlpi_phnum = l->l_phnum; + return l; +} + +weak_alias (__dl_next_phdr, dl_next_phdr); + +#endif --- libc/elf/link.h.jj Wed May 23 09:21:40 2001 +++ libc/elf/link.h Wed Jul 11 19:27:18 2001 @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2001 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 @@ -91,5 +91,31 @@ struct link_map ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ }; + +#ifdef __USE_GNU + +struct dl_phdr_info + { + const ElfW(Phdr) *dlpi_phdr; + ElfW(Half) dlpi_phnum; + }; + +__BEGIN_DECLS + +/* This function lets a program step through the loaded object list, + returning pointers to link map structure and program headers. + If map argument is NULL, it returns the first loaded object's link map + and program headers, otherwise map should be a value returned by + some other dl_next_phdr call and dl_next_phdr returns the next loaded + object's after the specified one. + If there are no loaded objects after given one or if there was an error, + it returns NULL, setting errno appropriately. */ + +const struct link_map * dl_next_phdr (struct dl_phdr_info *info, + const struct link_map * map) __THROW; + +__END_DECLS + +#endif #endif /* link.h */ --- libc/elf/Versions.jj Wed May 23 09:21:37 2001 +++ libc/elf/Versions Wed Jul 11 19:02:06 2001 @@ -14,6 +14,9 @@ libc { # functions used in other libraries _dl_sym; _dl_vsym; } + GLIBC_2.2.4 { + dl_next_phdr; + } } ld { --- libc/include/link.h.jj Mon Jun 25 10:50:33 2001 +++ libc/include/link.h Wed Jul 11 19:52:08 2001 @@ -239,4 +239,15 @@ struct link_map ElfW(Word) l_machine_specific[2]; }; +struct dl_phdr_info + { + const ElfW(Phdr) *dlpi_phdr; + ElfW(Half) dlpi_phnum; + }; + +const struct link_map * dl_next_phdr (struct dl_phdr_info *info, + const struct link_map * map); +const struct link_map * __dl_next_phdr (struct dl_phdr_info *info, + const struct link_map * map); + #endif /* link.h */ --- libc/sysdeps/generic/dl-nextphdrs.c.jj Wed Jul 11 17:52:27 2001 +++ libc/sysdeps/generic/dl-nextphdrs.c Wed Jul 11 19:15:28 2001 @@ -0,0 +1,30 @@ +/* Get static program's program headers. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +const struct link_map * +dl_next_phdr (struct dl_phdr_info *info, const struct link_map *l) +{ + __set_errno (ENOSYS); + return NULL; +} --- libc/sysdeps/unix/sysv/linux/ia64/dl-nextphdrs.c.jj Wed Jul 11 17:52:27 2001 +++ libc/sysdeps/unix/sysv/linux/ia64/dl-nextphdrs.c Wed Jul 11 18:50:39 2001 @@ -0,0 +1,59 @@ +/* Get static program's program headers. IA-64 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +static struct link_map fake_map; +extern unsigned long ip_segrel; + +asm (".section .rodata; ip_segrel: data8 @segrel(ip#); .previous"); + +const struct link_map * +dl_next_phdr (struct dl_phdr_info *info, const struct link_map *l) +{ + char *ip; + ElfW(Ehdr) *ehdr; + + if (l != NULL) + { + __set_errno (0); + return NULL; + } + + asm ("ip: mov %0 = ip" : "=r" (ip)); + ehdr = (ElfW(Ehdr) *) (ip - ip_segrel); + + assert (ehdr->e_ident[0] == 0x7f + && ehdr->e_ident[1] == 'E' + && ehdr->e_ident[2] == 'L' + && ehdr->e_ident[3] == 'F' + && ehdr->e_ident[EI_CLASS] == ELFCLASS64 + && ehdr->e_ident[EI_DATA] == ELFDATA2LSB + && ehdr->e_machine == EM_IA_64 + && ehdr->e_type == ET_EXEC); + + info->dlpi_phdr = (ElfW(Phdr) *) ((char *) ehdr + ehdr->e_phoff); + info->dlpi_phnum = ehdr->e_phnum; + + return &fake_map; +} Jakub From drepper@redhat.com Wed Jul 11 11:12:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 11 Jul 2001 11:12:00 -0000 Subject: [PATCH] dl_next_phdr (was Re: fde-glibc.c bug) References: <200107020854.f628sOS01676@jeswick.caldera.de> <20010702055546.I32061@devserv.devel.redhat.com> <20010702175906.O32061@devserv.devel.redhat.com> <20010703052922.Q32061@devserv.devel.redhat.com> <20010703094940.A25128@redhat.com> <20010711200753.G899@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > How about this? > This one does not have callback, but of course can be easily changed into > one if that is desired. This is not good. The reason to use a callback function is for the caller (i.e., this new function) to allocate the memory for the data structure which is passed. This way the implementation can extend the data structure without having compatibility problems. The callback should take a pointer to a data structure and a parameter with the size. > It does not do any locking (yet), but AFAIC dlsym and other > functions don't do any locking either. dlopen does locking. dlsym doesn't have to. If you call dlsym while unloading the object it's your own fault. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Wed Jul 11 11:53:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Wed, 11 Jul 2001 11:53:00 -0000 Subject: [PATCH] dl_iterate_phdr References: <200107020854.f628sOS01676@jeswick.caldera.de> <20010702055546.I32061@devserv.devel.redhat.com> <20010702175906.O32061@devserv.devel.redhat.com> <20010703052922.Q32061@devserv.devel.redhat.com> <20010703094940.A25128@redhat.com> <20010711200753.G899@sunsite.ms.mff.cuni.cz> Message-ID: <20010711205356.H899@sunsite.ms.mff.cuni.cz> On Wed, Jul 11, 2001 at 11:08:56AM -0700, Ulrich Drepper wrote: > Jakub Jelinek writes: > > > How about this? > > This one does not have callback, but of course can be easily changed into > > one if that is desired. > > This is not good. The reason to use a callback function is for the > caller (i.e., this new function) to allocate the memory for the data > structure which is passed. This way the implementation can extend the > data structure without having compatibility problems. The callback > should take a pointer to a data structure and a parameter with the > size. > > > It does not do any locking (yet), but AFAIC dlsym and other > > functions don't do any locking either. > > dlopen does locking. dlsym doesn't have to. If you call dlsym while > unloading the object it's your own fault. Ok, is this what you meant? Users of dl_iterate_phdr will just need to be careful not to do anything which would result in dlopen or dlclose, because that would be a deadlock. BTW: It is not just gcc/ia-64 fde-glibc.c which will need to use this interface, apparently boehm-gc has the same issues and I've run into them on i686 today. This still does nothing about dynamic linker's phdr/phnum, what's your opinion about it? 2001-07-11 Jakub Jelinek * elf/Makefile (routines): Add dl-iteratephdr and dl-iteratephdrs. (elide-routines.os): Add dl-iteratephdrs. * elf/dl-iteratephdr.c: New. * elf/link.h (struct dl_phdr_info, dl_iterate_phdr): New. * elf/Versions (dl_iterate_phdr): Add at GLIBC_2.2.4. * include/link.h (struct dl_phdr_info): New. (dl_iterate_phdr, __dl_iterate_phdr): New. * sysdeps/generic/dl-iteratephdrs.c: New. * sysdeps/unix/sysv/linux/ia64/dl-iteratephdrs.c: New. --- libc/elf/Makefile.jj Mon Jun 25 10:50:33 2001 +++ libc/elf/Makefile Wed Jul 11 20:35:30 2001 @@ -21,8 +21,9 @@ subdir := elf headers = elf.h bits/elfclass.h link.h -routines = $(dl-routines) dl-open dl-close dl-support \ - dl-addr enbl-secure dl-profstub dl-origin dl-libc dl-sym +routines = $(dl-routines) dl-open dl-close dl-support dl-iteratephdr \ + dl-iteratephdrs dl-addr enbl-secure dl-profstub dl-origin \ + dl-libc dl-sym # The core dynamic linking functions are in libc for the static and # profiled libraries. @@ -31,7 +32,7 @@ dl-routines = $(addprefix dl-,load cache version profile) all-dl-routines = $(dl-routines) $(sysdep-dl-routines) # But they are absent from the shared libc, because that code is in ld.so. -elide-routines.os = $(all-dl-routines) dl-support enbl-secure +elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-iteratephdrs # ld.so uses those routines, plus some special stuff for being the program # interpreter and operating independent of libc. --- libc/elf/link.h.jj Wed May 23 09:21:40 2001 +++ libc/elf/link.h Wed Jul 11 20:53:15 2001 @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2001 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 @@ -91,5 +91,24 @@ struct link_map ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ struct link_map *l_next, *l_prev; /* Chain of loaded objects. */ }; + +#ifdef __USE_GNU + +struct dl_phdr_info + { + ElfW(Addr) dlpi_addr; + const char *dlpi_name; + const ElfW(Phdr) *dlpi_phdr; + ElfW(Half) dlpi_phnum; + }; + +__BEGIN_DECLS + +int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size)) __THROW; + +__END_DECLS + +#endif #endif /* link.h */ --- libc/elf/Versions.jj Wed May 23 09:21:37 2001 +++ libc/elf/Versions Wed Jul 11 20:20:20 2001 @@ -14,6 +14,9 @@ libc { # functions used in other libraries _dl_sym; _dl_vsym; } + GLIBC_2.2.4 { + dl_iterate_phdr; + } } ld { --- libc/elf/dl-iteratephdr.c.jj Wed Jul 11 17:19:29 2001 +++ libc/elf/dl-iteratephdr.c Wed Jul 11 20:53:51 2001 @@ -0,0 +1,60 @@ +/* Get loaded objects program headers. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +#ifdef SHARED + +__libc_lock_define (extern, _dl_load_lock) + +int +__dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size)) +{ + struct link_map *l; + struct dl_phdr_info info; + int ret = 0; + + /* Make sure we are alone. */ + __libc_lock_lock (_dl_load_lock); + + for (l = _dl_loaded; l != NULL; l = l->l_next) + { + info.dlpi_addr = l->l_addr; + info.dlpi_name = l->l_name; + info.dlpi_phdr = l->l_phdr; + info.dlpi_phnum = l->l_phnum; + ret = callback (&info, sizeof (struct dl_phdr_info)); + if (ret) + break; + } + + /* Release the lock. */ + __libc_lock_unlock (_dl_load_lock); + + return ret; +} + +weak_alias (__dl_iterate_phdr, dl_iterate_phdr); + +#endif --- libc/include/link.h.jj Mon Jun 25 10:50:33 2001 +++ libc/include/link.h Wed Jul 11 20:52:46 2001 @@ -239,4 +239,17 @@ struct link_map ElfW(Word) l_machine_specific[2]; }; +struct dl_phdr_info + { + ElfW(Addr) dlpi_addr; + const char *dlpi_name; + const ElfW(Phdr) *dlpi_phdr; + ElfW(Half) dlpi_phnum; + }; + +int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size)); +int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size)); + #endif /* link.h */ --- libc/sysdeps/generic/dl-iteratephdrs.c.jj Wed Jul 11 17:52:27 2001 +++ libc/sysdeps/generic/dl-iteratephdrs.c Wed Jul 11 20:54:17 2001 @@ -0,0 +1,31 @@ +/* Get static program's program headers. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +int +dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size)) +{ + __set_errno (ENOSYS); + return -1; +} --- libc/sysdeps/unix/sysv/linux/ia64/dl-iteratephdrs.c.jj Wed Jul 11 17:52:27 2001 +++ libc/sysdeps/unix/sysv/linux/ia64/dl-iteratephdrs.c Wed Jul 11 20:55:02 2001 @@ -0,0 +1,56 @@ +/* Get static program's program headers. IA-64 version. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +extern unsigned long ip_segrel; + +asm (".section .rodata; ip_segrel: data8 @segrel(ip#); .previous"); + +int +dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size)) +{ + char *ip; + ElfW(Ehdr) *ehdr; + struct dl_phdr_info info; + + asm ("ip: mov %0 = ip" : "=r" (ip)); + ehdr = (ElfW(Ehdr) *) (ip - ip_segrel); + + assert (ehdr->e_ident[0] == 0x7f + && ehdr->e_ident[1] == 'E' + && ehdr->e_ident[2] == 'L' + && ehdr->e_ident[3] == 'F' + && ehdr->e_ident[EI_CLASS] == ELFCLASS64 + && ehdr->e_ident[EI_DATA] == ELFDATA2LSB + && ehdr->e_machine == EM_IA_64 + && ehdr->e_type == ET_EXEC); + + info.dlpi_addr = 0; + info.dlpi_name = NULL; + info.dlpi_phdr = (ElfW(Phdr) *) ((char *) ehdr + ehdr->e_phoff); + info.dlpi_phnum = ehdr->e_phnum; + + return callback (&info, sizeof (struct dl_phdr_info)); +} Jakub From schwidefsky@de.ibm.com Thu Jul 12 04:19:00 2001 From: schwidefsky@de.ibm.com (Martin Schwidefsky) Date: Thu, 12 Jul 2001 04:19:00 -0000 Subject: Four more s390 patches. Message-ID: Hi, here are four more patches for the s390 backend: 1) Performance tests have showed that the current mvc loop is good for small block but the old mvcle implementation has been better for large blocks. 2001-07-12 Martin Schwidefsky * sysdeps/s390/s390-32/bcopy.S: Use mvcle for big blocks (> 64K) and a mvc loop for small blocks. * sysdeps/s390/s390-32/memcpy.S: Likewise. * sysdeps/s390/s390-64/bcopy.S: Likewise. * sysdeps/s390/s390-64/memcpy.S: Likewise. (See attached file: bcopy-s390.diff) 2) A POSIX test complained about the names in the __jmp_buf structure. 2001-07-12 Martin Schwidefsky * sysdeps/s390/s390-32/bits/setjmp.h: Add leading underscores to the entries in the __jmp_buf structure. * sysdeps/s390/s390-64/bits/setjmp.h: Likewise. (See attached file: jmpbuf-s390.diff) 3) The fallback to the old style mmap is broken because the compare for ENOSYS is gone against the wrong register. 2001-07-12 Martin Schwidefsky * sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S: Correct the test for ENOSYS. (See attached file: mmap64-s390.diff) 4) There is a mismatch between the kernel definition of struct sigaction and the glibc definition. 2001-07-12 Martin Schwidefsky * sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h: Reorder fields in the sigaction struct to match the definition in the kernel. (See attached file: sigaction-s390.diff) blue skies, Martin Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH Sch????naicherstr. 220, D-71032 B????blingen, Telefon: 49 - (0)7031 - 16-2247 E-Mail: schwidefsky@de.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: bcopy-s390.diff Type: text/x-diff Size: 5898 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: jmpbuf-s390.diff Type: text/x-diff Size: 1265 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mmap64-s390.diff Type: text/x-diff Size: 442 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: sigaction-s390.diff Type: text/x-diff Size: 693 bytes Desc: not available URL: From schwidefsky@de.ibm.com Thu Jul 12 05:36:00 2001 From: schwidefsky@de.ibm.com (Martin Schwidefsky) Date: Thu, 12 Jul 2001 05:36:00 -0000 Subject: Four more s390 patches. Message-ID: >Hi, >here are four more patches for the s390 backend: > >4) There is a mismatch between the kernel definition of struct sigaction >and the glibc definition. Hmpf, sent the wrong one. Please ignore the last sigaction-s390.diff and use this one instead: 2001-07-12 Martin Schwidefsky * sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h: Reorder fields in the sigaction struct to match the definition in the kernel. (See attached file: s390-64.sigaction.diff) blue skies, Martin Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH Sch????naicherstr. 220, D-71032 B????blingen, Telefon: 49 - (0)7031 - 16-2247 E-Mail: schwidefsky@de.ibm.com =?iso-8859-1?Q?s390-64.sigaction.diff?= -------------- next part -------------- A non-text attachment was scrubbed... Name: s390-64.sigaction.diff Type: text/x-diff Size: 637 bytes Desc: not available URL: From schwab@suse.de Sun Jul 15 08:21:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Sun, 15 Jul 2001 08:21:00 -0000 Subject: iconv/loop.c Message-ID: I have checked in this patch which should help sparc. :-) 2001-07-15 Andreas Schwab * iconv/loop.c (put16) [!_STRING_ARCH_unaligned && BIG_ENDIAN]: Fix index. Index: iconv/loop.c =================================================================== RCS file: /cvs/glibc/libc/iconv/loop.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -a -u -r1.27 -r1.28 --- iconv/loop.c 2001/07/06 04:54:47 1.27 +++ iconv/loop.c 2001/07/15 15:18:22 1.28 @@ -111,7 +111,7 @@ # define put16(addr, val) \ ({ uint16_t __val = (val); \ ((unsigned char *) (addr))[1] = __val; \ - ((unsigned char *) (addr))[2] = __val >> 8; \ + ((unsigned char *) (addr))[0] = __val >> 8; \ (void) 0; }) # define put32(addr, val) \ ({ uint32_t __val = (val); \ -- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From drepper@redhat.com Sun Jul 15 23:34:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 15 Jul 2001 23:34:00 -0000 Subject: Four more s390 patches. References: Message-ID: "Martin Schwidefsky" writes: > here are four more patches for the s390 backend: Thanks, I've applied the patches. Please use the correct format for the ChangeLog entries the next time. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Mon Jul 16 03:22:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Mon, 16 Jul 2001 03:22:00 -0000 Subject: [PATCH] Fix i386 e_expl Message-ID: <20010716122414.B821@sunsite.ms.mff.cuni.cz> Hi! I've noticed that recently i386 libm.so has DT_TEXTREL dynamic tag. This patch fixes it. 2001-07-16 Jakub Jelinek * sysdeps/i386/fpu/e_expl.c (__ieee754_expl): Make it PIC friendly. --- libc/sysdeps/i386/fpu/e_expl.c.jj Mon Jun 25 10:34:46 2001 +++ libc/sysdeps/i386/fpu/e_expl.c Mon Jul 16 12:21:13 2001 @@ -24,8 +24,8 @@ #include -static long double __attribute__ ((unused)) c0 = 1.44268798828125L; -static long double __attribute__ ((unused)) c1 = 7.05260771340735992468e-6L; +static long double c0 = 1.44268798828125L; +static long double c1 = 7.05260771340735992468e-6L; long double __ieee754_expl (long double x) @@ -48,7 +48,7 @@ __ieee754_expl (long double x) "fld %%st(1)\n\t" /* 2 x */ "frndint\n\t" /* 2 xi */ "fld %%st(1)\n\t" /* 3 i */ - "fldt c0\n\t" /* 4 c0 */ + "fldt %2\n\t" /* 4 c0 */ "fld %%st(2)\n\t" /* 5 xi */ "fmul %%st(1),%%st\n\t" /* 5 c0 xi */ "fsubp %%st,%%st(2)\n\t" /* 4 f = c0 xi - i */ @@ -56,7 +56,7 @@ __ieee754_expl (long double x) "fsub %%st(3),%%st\n\t" /* 5 xf = x - xi */ "fmulp %%st,%%st(1)\n\t" /* 4 c0 xf */ "faddp %%st,%%st(1)\n\t" /* 3 f = f + c0 xf */ - "fldt c1\n\t" /* 4 */ + "fldt %3\n\t" /* 4 */ "fmul %%st(4),%%st\n\t" /* 4 c1 * x */ "faddp %%st,%%st(1)\n\t" /* 3 f = f + c1 * x */ "f2xm1\n\t" /* 3 2^(fract(x * log2(e))) - 1 */ @@ -72,6 +72,6 @@ __ieee754_expl (long double x) "fstp %%st\n\t" "fldz\n\t" /* Set result to 0. */ "2:\t\n" - : "=t" (res) : "0" (x) : "ax", "dx"); + : "=t" (res) : "0" (x), "m" (c0), "m" (c1) : "ax", "dx"); return res; } Jakub From schwab@suse.de Mon Jul 16 12:10:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Mon, 16 Jul 2001 12:10:00 -0000 Subject: linuxthreads/Makefile Message-ID: This patch makes sure that libpthread.so depends on the right crti.o file, which makes before-compile for crti.o unnecessary. 2001-07-16 Andreas Schwab * Makefile (before-compile): Don't add $(objpfx)crti.o. (omit-deps): Add crti. ($(objpfx)libpthread.so): Depend on $(objpfx)crti.o, but make sure it is filtered out of the link command. Index: Makefile =================================================================== RCS file: /cvs/glibc/libc/linuxthreads/Makefile,v retrieving revision 1.44 diff -u -a -u -r1.44 Makefile --- Makefile 2001/07/06 04:55:32 1.44 +++ Makefile 2001/07/16 19:08:52 @@ -51,8 +51,8 @@ include ../Makeconfig ifeq ($(build-shared),yes) -before-compile := $(objpfx)crti.o -extra-objs = crti.o +extra-objs += crti.o +omit-deps += crti CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions endif @@ -69,6 +69,8 @@ include ../Rules extra-B-pthread.so = -B$(common-objpfx)linuxthreads/ +$(objpfx)libpthread.so: $(objpfx)crti.o +$(objpfx)libpthread.so: +preinit += $(objpfx)crti.o znodelete-yes = -DHAVE_Z_NODELETE CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES -- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From schwab@suse.de Mon Jul 16 12:12:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Mon, 16 Jul 2001 12:12:00 -0000 Subject: math/libm-test.inc Message-ID: 2001-07-16 Andreas Schwab * math/libm-test.inc (check_float_internal): Fix sign bit test of infinities. Index: math/libm-test.inc =================================================================== RCS file: /cvs/glibc/libc/math/libm-test.inc,v retrieving revision 1.39 diff -u -a -u -r1.39 math/libm-test.inc --- math/libm-test.inc 2001/07/06 04:55:35 1.39 +++ math/libm-test.inc 2001/07/16 19:11:00 @@ -460,8 +460,8 @@ else if (isinf (computed) && isinf (expected)) { /* Test for sign of infinities. */ - if (((exceptions & IGNORE_ZERO_INF_SIGN) == 0) - && (isinf (computed) != isinf (expected))) + if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0 + && signbit (computed) != signbit (expected)) { ok = 0; printf ("infinity has wrong sign.\n"); @@ -482,9 +482,9 @@ ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG); set_max_error (ulp, curr_max_error); print_diff = 1; - if (((exceptions & IGNORE_ZERO_INF_SIGN) == 0) - && (computed == 0.0 && expected == 0.0 - && signbit(computed) != signbit (expected))) + if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0 + && computed == 0.0 && expected == 0.0 + && signbit(computed) != signbit (expected)) ok = 0; else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp)) ok = 1; -- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From schwab@suse.de Mon Jul 16 12:15:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Mon, 16 Jul 2001 12:15:00 -0000 Subject: sysdeps/posix/spawni.c Message-ID: 2001-07-16 Andreas Schwab * sysdeps/posix/spawni.c: Fix typo when iterating over signal numbers. Index: sysdeps/posix/spawni.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/posix/spawni.c,v retrieving revision 1.2 diff -u -a -u -r1.2 sysdeps/posix/spawni.c --- sysdeps/posix/spawni.c 2001/07/06 04:56:01 1.2 +++ sysdeps/posix/spawni.c 2001/07/16 19:14:23 @@ -112,7 +112,7 @@ memset (&sa, '\0', sizeof (sa)); sa.sa_handler = SIG_DFL; - for (sig = 1; sig >= _NSIG; ++sig) + for (sig = 1; sig <= _NSIG; ++sig) if (sigismember (&attrp->__sd, sig) != 0 && __sigaction (sig, &sa, NULL) != 0) _exit (SPAWN_ERROR); -- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From drepper@redhat.com Mon Jul 16 14:28:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 16 Jul 2001 14:28:00 -0000 Subject: [PATCH] Fix i386 e_expl References: <20010716122414.B821@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > I've noticed that recently i386 libm.so has DT_TEXTREL dynamic tag. > This patch fixes it. I wonder when this slipped in. The patch is applied. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Mon Jul 16 14:29:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 16 Jul 2001 14:29:00 -0000 Subject: math/libm-test.inc References: Message-ID: Andreas Schwab writes: > 2001-07-16 Andreas Schwab > > * math/libm-test.inc (check_float_internal): Fix sign bit test of > infinities. Thanks, I've applied it. We'll see whether this finds any problems so far uncovered. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Mon Jul 16 14:32:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 16 Jul 2001 14:32:00 -0000 Subject: sysdeps/posix/spawni.c References: Message-ID: Andreas Schwab writes: > 2001-07-16 Andreas Schwab > > * sysdeps/posix/spawni.c: Fix typo when iterating over signal > numbers. Thanks, I've applied this. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Mon Jul 16 15:24:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 16 Jul 2001 15:24:00 -0000 Subject: linuxthreads/Makefile References: Message-ID: Andreas Schwab writes: > This patch makes sure that libpthread.so depends on the right crti.o file, > which makes before-compile for crti.o unnecessary. I've added this patch now, too. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Mon Jul 16 18:00:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 16 Jul 2001 18:00:00 -0000 Subject: nscd messages Message-ID: nscd seems to be a bit to noisy. It spits too many messages into the syslog file. The amount can be determined by anybody contacting the nscd. This could probably be used for some kind of DoS attack. I'll check in soon a patch to make these messages go away. Please look at the patch and complain if you think this is wrong. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Tue Jul 17 01:45:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 17 Jul 2001 01:45:00 -0000 Subject: Honour LD_HWCAP_MASK in ldconfig Message-ID: Uli, following your suggestions, here is a patch for ldconfig. Now ldconfig looks into directories specified by LD_HWCAP_MASK. The only question I have is whether LD_HWCAP_MASK should override HWCAP_IMPORTANT (as it does currently) or if we should 'or' them. Ok to commit? Andreas 2001-07-17 Andreas Jaeger * elf/ldconfig.c: Add new variable hwcap_mask to honour LD_HWCAP_MASK. (is_hwcap_platform): Use it. (set_hwcap): New function to set hwcap_mask. (main): Call set_hwcap. ============================================================ Index: elf/ldconfig.c --- elf/ldconfig.c 2001/07/06 04:54:46 1.23 +++ elf/ldconfig.c 2001/07/17 07:59:55 @@ -107,6 +107,9 @@ static char *cache_file; /* Configuration file. */ static const char *config_file; +/* Mask to use for important hardware capabilities. */ +static unsigned long int hwcap_mask = HWCAP_IMPORTANT; + /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); void (*argp_program_version_hook) (FILE *, struct argp_state *) @@ -147,7 +150,7 @@ is_hwcap_platform (const char *name) { int hwcap_idx = _dl_string_hwcap (name); - if (hwcap_idx != -1 && ((1 << hwcap_idx) & HWCAP_IMPORTANT)) + if (hwcap_idx != -1 && ((1 << hwcap_idx) & hwcap_mask)) return 1; hwcap_idx = _dl_string_platform (name); @@ -934,7 +937,17 @@ parse_conf (const char *filename) fclose (file); } +/* Honour LD_HWCAP_MASK. */ +static void +set_hwcap (void) +{ + char *mask = getenv ("LD_HWCAP_MASK"); + if (mask) + hwcap_mask = strtoul (mask, NULL, 0); +} + + int main (int argc, char **argv) { @@ -951,6 +964,8 @@ main (int argc, char **argv) for (i = remaining; i < argc; ++i) add_dir (argv[i]); } + + set_hwcap (); if (opt_chroot) { -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From kukuk@suse.de Tue Jul 17 01:54:00 2001 From: kukuk@suse.de (Thorsten Kukuk) Date: Tue, 17 Jul 2001 01:54:00 -0000 Subject: nscd messages References: Message-ID: <20010717105426.A17603@suse.de> On Mon, Jul 16, Ulrich Drepper wrote: > nscd seems to be a bit to noisy. It spits too many messages into the > syslog file. The amount can be determined by anybody contacting the All I can see is that you don't print messages now where I would say this are all real error messages where the sysadmin should look from where it comes. I cannot find any messages in our log files here from nscd. > nscd. This could probably be used for some kind of DoS attack. Everybody can send messages to syslog, I don't see this as problem. > I'll check in soon a patch to make these messages go away. Please > look at the patch and complain if you think this is wrong. Looks ok for me. Thorsten -- Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de SuSE GmbH Deutschherrenstr. 15-19 D-90429 Nuernberg -------------------------------------------------------------------- Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B From drepper@redhat.com Tue Jul 17 11:12:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 17 Jul 2001 11:12:00 -0000 Subject: Honour LD_HWCAP_MASK in ldconfig References: Message-ID: Andreas Jaeger writes: > following your suggestions, here is a patch for ldconfig. Now > ldconfig looks into directories specified by LD_HWCAP_MASK. Good. > The only question I have is whether LD_HWCAP_MASK should override > HWCAP_IMPORTANT (as it does currently) or if we should 'or' them. It should IMO behave just like ld.so. And there LD_HWCAP_MASK overwrites HWCAP_IMPORTANT. This gives the user all the flexibility. > Ok to commit? I'll do it now. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Tue Jul 17 11:18:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 17 Jul 2001 11:18:00 -0000 Subject: nscd messages References: <20010717105426.A17603@suse.de> Message-ID: Thorsten Kukuk writes: > All I can see is that you don't print messages now where I would > say this are all real error messages where the sysadmin should > look from where it comes. Where? As the ChangeLog comment mentions, all these are problems caused by the user application. For instance, if the version number doesn't match this is a deliberate attempt to disturb the program. With debugging all is still visible. > I cannot find any messages in our log files here from nscd. I get tons of messages. Whenever you have a program with is stop in the middle of a transfer nscd will complain. > Everybody can send messages to syslog, I don't see this as problem. That's something which can and should be handled separately. I don't know why there are no ACLs or so. Maybe newer, more secure versions have it. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From schwab@suse.de Wed Jul 18 03:11:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Wed, 18 Jul 2001 03:11:00 -0000 Subject: Fix \w in regex Message-ID: This patch restores the previous behaviour of \w and related patterns in regex matching: it should match not only letters and numbers, but also '_'. 2001-07-18 Andreas Schwab * posix/regex.c (WORDCHAR_P) [WCHAR]: Also return true for the underscore character. --- posix/regex.c.~1.103.~ Mon Jul 16 10:43:43 2001 +++ posix/regex.c Tue Jul 17 23:54:17 2001 @@ -5347,7 +5347,9 @@ /* Use internationalized API instead of SYNTAX. */ # define WORDCHAR_P(d) \ (iswalnum ((wint_t)((d) == end1 ? *string2 \ - : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0) + : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0 \ + || ((d) == end1 ? *string2 \ + : (d) == string2 - 1 ? *(end1 - 1) : *(d)) == L'_') #else /* BYTE */ # define WORDCHAR_P(d) \ (SYNTAX ((d) == end1 ? *string2 \ -- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From jakub@redhat.com Wed Jul 18 13:14:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Wed, 18 Jul 2001 13:14:00 -0000 Subject: [PATCH] Avoid munmap(x, 0) in malloc Message-ID: <20010718221745.M821@sunsite.ms.mff.cuni.cz> Hi! For second and following new_heap unless mmap is used in the mean time mmap(, HEAP_MAX_SIZE << 1, ...) will be very likely aligned to HEAP_MAX_SIZE, so I think it is worth avoiding an useless munmap(x, 0) syscall at the cost of a conditional branch. Do you agree? Below is how a typicall new_heap looks in strace. 2001-07-18 Jakub Jelinek * malloc/malloc (new_heap): Don't call munmap for zero length. --- libc/malloc/malloc.c.jj Sat May 5 15:47:23 2001 +++ libc/malloc/malloc.c Wed Jul 18 22:18:15 2001 @@ -2031,7 +2031,8 @@ new_heap(size) size_t size; if(p1 != MAP_FAILED) { p2 = (char *)(((unsigned long)p1 + (HEAP_MAX_SIZE-1)) & ~(HEAP_MAX_SIZE-1)); ul = p2 - p1; - munmap(p1, ul); + if (ul) + munmap(p1, ul); munmap(p2 + HEAP_MAX_SIZE, HEAP_MAX_SIZE - ul); } else { /* Try to take the chance that an allocation of only HEAP_MAX_SIZE mprotect(0x402fd000, 4096, PROT_READ|PROT_WRITE) = 0 mprotect(0x402fe000, 4096, PROT_READ|PROT_WRITE) = 0 mprotect(0x402ff000, 4096, PROT_READ|PROT_WRITE) = 0 mmap2(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x40300000 munmap(0x40300000, 0) = -1 EINVAL (Invalid argument) munmap(0x40400000, 1048576) = 0 mprotect(0x40300000, 32768, PROT_READ|PROT_WRITE) = 0 mprotect(0x40308000, 4096, PROT_READ|PROT_WRITE) = 0 mprotect(0x40309000, 4096, PROT_READ|PROT_WRITE) = 0 ... mprotect(0x403fd000, 4096, PROT_READ|PROT_WRITE) = 0 mprotect(0x403fe000, 4096, PROT_READ|PROT_WRITE) = 0 mprotect(0x403ff000, 4096, PROT_READ|PROT_WRITE) = 0 mmap2(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x40400000 munmap(0x40400000, 0) = -1 EINVAL (Invalid argument) munmap(0x40500000, 1048576) = 0 mprotect(0x40400000, 32768, PROT_READ|PROT_WRITE) = 0 mprotect(0x40408000, 4096, PROT_READ|PROT_WRITE) = 0 Jakub From drepper@redhat.com Wed Jul 18 13:34:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 18 Jul 2001 13:34:00 -0000 Subject: [PATCH] Avoid munmap(x, 0) in malloc References: <20010718221745.M821@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > 2001-07-18 Jakub Jelinek > > * malloc/malloc (new_heap): Don't call munmap for zero length. Looks OK. Even if this condition wouldn't happen often it's worthwhile adding the patch since it shouldn't be relied on the kernel catching invalid requests. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Wed Jul 18 13:35:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 18 Jul 2001 13:35:00 -0000 Subject: Fix \w in regex References: Message-ID: Andreas Schwab writes: > This patch restores the previous behaviour of \w and related patterns in > regex matching: it should match not only letters and numbers, but also > '_'. Thanks, I've applied the patch. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Wed Jul 18 13:37:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 18 Jul 2001 13:37:00 -0000 Subject: filedoalloc change Message-ID: In case you wonder about this filedoalloc change. I just had to look at some trace of a program starting up and somehow it striked me as if something is redundant. It was the ioctl() syscall (via isatty). The info was already included in the fstat done before. So we hardcode a bit more device number information and safe one syscall and at least 3 relocations :-). -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Thu Jul 19 03:20:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 19 Jul 2001 03:20:00 -0000 Subject: [PATCH] Fix LC_PAPER in some locales Message-ID: <20010719122337.N821@sunsite.ms.mff.cuni.cz> Hi! Canada reportedly uses Letter paper, es_US being US locale should similarly (and US measurement too) and I think Puerto Rico probably too (Aldy, please correct me about es_PR if I'm wrong). 2001-07-19 Jakub Jelinek * locales/en_CA (LC_PAPER): Change to Letter. * locales/fr_CA (LC_PAPER): Likewise. * locales/es_PR (LC_PAPER): Likewise. (LC_MEASUREMENT): Change to 2. * locales/es_US (LC_PAPER): Change to Letter. (LC_MEASUREMENT): Change to 2. --- libc/localedata/locales/es_PR.jj Thu Nov 2 08:52:00 2000 +++ libc/localedata/locales/es_PR Thu Jul 19 12:25:13 2001 @@ -116,10 +116,8 @@ date_fmt "" END LC_TELEPHONE LC_MEASUREMENT -% FIXME -measurement 1 +measurement 2 END LC_MEASUREMENT LC_NAME --- libc/localedata/locales/en_CA.jj Thu Nov 2 08:52:00 2000 +++ libc/localedata/locales/en_CA Thu Jul 19 12:26:05 2001 @@ -2187,10 +2187,8 @@ noexpr " Message-ID: <995538597.7999.30.camel@culebra.cygnus.com> On 19 Jul 2001 12:23:37 +0200, Jakub Jelinek wrote: > Hi! > > Canada reportedly uses Letter paper, es_US being US locale should similarly > (and US measurement too) and I think Puerto Rico probably too (Aldy, please > correct me about es_PR if I'm wrong). > Jakub yup, pr uses whatever the us does and we use US measurements -- Aldy Hernandez E-mail: aldyh@redhat.com Professional Gypsy Red Hat, Inc. From drepper@redhat.com Thu Jul 19 07:34:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 19 Jul 2001 07:34:00 -0000 Subject: [PATCH] Fix LC_PAPER in some locales References: <20010719122337.N821@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > * locales/en_CA (LC_PAPER): Change to Letter. > * locales/fr_CA (LC_PAPER): Likewise. Wrong. Canada uses the metric system. > * locales/es_PR (LC_PAPER): Likewise. > (LC_MEASUREMENT): Change to 2. This must be wrong, too. > * locales/es_US (LC_PAPER): Change to Letter. > (LC_MEASUREMENT): Change to 2. This is OK. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Thu Jul 19 07:38:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 19 Jul 2001 07:38:00 -0000 Subject: [PATCH] Fix LC_PAPER in some locales References: <20010719122337.N821@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > * locales/es_PR (LC_PAPER): Likewise. > (LC_MEASUREMENT): Change to 2. Sorry, I read this as es_PT. Of course Puerto Rico has no own choice if they want to become the 53rd state at some point... -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Thu Jul 19 07:48:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 19 Jul 2001 07:48:00 -0000 Subject: [PATCH] Fix LC_PAPER in some locales References: <20010719122337.N821@sunsite.ms.mff.cuni.cz> Message-ID: <20010719165020.O821@sunsite.ms.mff.cuni.cz> On Thu, Jul 19, 2001 at 07:29:40AM -0700, Ulrich Drepper wrote: > Jakub Jelinek writes: > > > * locales/en_CA (LC_PAPER): Change to Letter. > > * locales/fr_CA (LC_PAPER): Likewise. > > Wrong. Canada uses the metric system. That's why I kept LC_MEASUREMENT 1 for *_CA. But 2 Canadians reported that Letter is the common paper format and it is very hard if not impossible to order A4 paper there. Jakub From drepper@redhat.com Thu Jul 19 08:08:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 19 Jul 2001 08:08:00 -0000 Subject: [PATCH] Fix LC_PAPER in some locales References: <20010719122337.N821@sunsite.ms.mff.cuni.cz> <20010719165020.O821@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > That's why I kept LC_MEASUREMENT 1 for *_CA. But 2 Canadians reported that > Letter is the common paper format and it is very hard if not impossible to > order A4 paper there. OK. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Thu Jul 19 09:04:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 19 Jul 2001 09:04:00 -0000 Subject: [PATCH] Use FLOATING_STACKS on IA-64 Message-ID: <20010719180735.P821@sunsite.ms.mff.cuni.cz> Hi! This patch changes IA-64 to use FLOATING_STACKS. I had to tweak pthread_allocate_stack a little bit for this. Glibc builds with this just fine on IA-64 and passes make check too (on 07-09 checkout, so test-gencat fails but that has been fixed since then and is unrelated). I think Alpha/Sparc32/Sparc64 could turn FLOATING_STACKS too, it will just need testing (but IMHO it should just work there). 2001-07-19 Jakub Jelinek * sysdeps/i386/useldt.h: Fix typo in ARCH_STACK_MAX_SIZE comment. * sysdeps/ia64/pt-machine.h (FLOATING_STACKS): New. (ARCH_STACK_MAX_SIZE): New. * manager.c (pthread_allocate_stack): Handle FLOATING_STACKS with NEED_SEPARATE_REGISTER_STACK. --- libc/linuxthreads/sysdeps/i386/useldt.h.jj Wed Apr 25 06:07:51 2001 +++ libc/linuxthreads/sysdeps/i386/useldt.h Thu Jul 19 09:00:17 2001 @@ -201,5 +201,5 @@ extern int __modify_ldt (int, struct mod /* We want the OS to assign stack addresses. */ #define FLOATING_STACKS 1 -/* Maximum size o fthe stack if the rlimit is unlimited. */ +/* Maximum size of the stack if the rlimit is unlimited. */ #define ARCH_STACK_MAX_SIZE 8*1024*1024 --- libc/linuxthreads/sysdeps/ia64/pt-machine.h.jj Mon Jan 8 12:58:35 2001 +++ libc/linuxthreads/sysdeps/ia64/pt-machine.h Thu Jul 19 09:01:18 2001 @@ -31,6 +31,12 @@ #define NEED_SEPARATE_REGISTER_STACK +/* We want the OS to assign stack addresses. */ +#define FLOATING_STACKS 1 + +/* Maximum size of the stack if the rlimit is unlimited. */ +#define ARCH_STACK_MAX_SIZE 32*1024*1024 + /* Get some notion of the current stack. Need not be exactly the top of the stack, just something somewhere in the current frame. r12 (sp) is the stack pointer. */ --- libc/linuxthreads/manager.c.jj Mon Jun 25 07:31:17 2001 +++ libc/linuxthreads/manager.c Thu Jul 19 11:12:38 2001 @@ -353,7 +353,53 @@ static int pthread_allocate_stack(const void *map_addr; /* Allocate space for stack and thread descriptor at default address */ -#ifdef NEED_SEPARATE_REGISTER_STACK +#if FLOATING_STACKS + if (attr != NULL) + { + guardsize = page_roundup (attr->__guardsize, granularity); + stacksize = __pthread_max_stacksize - guardsize; + stacksize = MIN (stacksize, + page_roundup (attr->__stacksize, granularity)); + } + else + { + guardsize = granularity; + stacksize = __pthread_max_stacksize - guardsize; + } + + map_addr = mmap(NULL, stacksize + guardsize, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (map_addr == MAP_FAILED) + /* No more memory available. */ + return -1; + +# ifdef NEED_SEPARATE_REGISTER_STACK + guardaddr = map_addr + stacksize / 2; + if (guardsize > 0) + mprotect (guardaddr, guardsize, PROT_NONE); + + new_thread_bottom = (char *) map_addr; + new_thread = ((pthread_descr) (new_thread_bottom + stacksize + + guardsize)) - 1; +# elif _STACK_GROWS_DOWN + guardaddr = map_addr; + if (guardsize > 0) + mprotect (guardaddr, guardsize, PROT_NONE); + + new_thread_bottom = (char *) map_addr + guardsize; + new_thread = ((pthread_descr) (new_thread_bottom + stacksize)) - 1; +# elif _STACK_GROWS_UP + guardaddr = map_addr + stacksize; + if (guardsize > 0) + mprotect (guardaddr, guardsize, PROT_NONE); + + new_thread = (pthread_descr) map_addr; + new_thread_bottom = (char *) (new_thread + 1); +# else +# error You must define a stack direction +# endif /* Stack direction */ +#else /* !FLOATING_STACKS */ void *res_addr; if (attr != NULL) @@ -369,6 +415,7 @@ static int pthread_allocate_stack(const stacksize = STACK_SIZE - granularity; } +# ifdef NEED_SEPARATE_REGISTER_STACK new_thread = default_new_thread; new_thread_bottom = (char *) (new_thread + 1) - stacksize - guardsize; /* Includes guard area, unlike the normal case. Use the bottom @@ -379,8 +426,6 @@ static int pthread_allocate_stack(const in the same region. The cost is that we might be able to map slightly fewer stacks. */ - /* XXX Fix for floating stacks with variable sizes. */ - /* First the main stack: */ map_addr = (caddr_t)((char *)(new_thread + 1) - stacksize / 2); res_addr = mmap(map_addr, stacksize / 2, @@ -409,61 +454,7 @@ static int pthread_allocate_stack(const guardaddr = new_thread_bottom + stacksize/2; /* We leave the guard area in the middle unmapped. */ -#else /* !NEED_SEPARATE_REGISTER_STACK */ -# if FLOATING_STACKS - if (attr != NULL) - { - guardsize = page_roundup (attr->__guardsize, granularity); - stacksize = __pthread_max_stacksize - guardsize; - stacksize = MIN (stacksize, - page_roundup (attr->__stacksize, granularity)); - } - else - { - guardsize = granularity; - stacksize = __pthread_max_stacksize - guardsize; - } - - map_addr = mmap(NULL, stacksize + guardsize, - PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (map_addr == MAP_FAILED) - /* No more memory available. */ - return -1; - -# ifdef _STACK_GROWS_DOWN - guardaddr = map_addr; - if (guardsize > 0) - mprotect (guardaddr, guardsize, PROT_NONE); - - new_thread_bottom = (char *) map_addr + guardsize; - new_thread = ((pthread_descr) (new_thread_bottom + stacksize)) - 1; -# elif _STACK_GROWS_UP - guardaddr = map_addr + stacksize; - if (guardsize > 0) - mprotect (guardaddr, guardsize, PROT_NONE); - - new_thread = (pthread_descr) map_addr; - new_thread_bottom = (char *) (new_thread + 1); -# else -# error You must define a stack direction -# endif /* Stack direction */ -# else /* !FLOATING_STACKS */ - void *res_addr; - - if (attr != NULL) - { - guardsize = page_roundup (attr->__guardsize, granularity); - stacksize = STACK_SIZE - guardsize; - stacksize = MIN (stacksize, - page_roundup (attr->__stacksize, granularity)); - } - else - { - guardsize = granularity; - stacksize = STACK_SIZE - granularity; - } - +# else /* !NEED_SEPARATE_REGISTER_STACK */ # ifdef _STACK_GROWS_DOWN new_thread = default_new_thread; new_thread_bottom = (char *) (new_thread + 1) - stacksize; @@ -501,8 +492,8 @@ static int pthread_allocate_stack(const mprotect (guardaddr, guardsize, PROT_NONE); # endif /* stack direction */ -# endif -#endif /* !NEED_SEPARATE_REGISTER_STACK */ +# endif /* !NEED_SEPARATE_REGISTER_STACK */ +#endif /* !FLOATING_STACKS */ } *out_new_thread = new_thread; *out_new_thread_bottom = new_thread_bottom; Jakub From jakub@redhat.com Thu Jul 19 13:22:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 19 Jul 2001 13:22:00 -0000 Subject: [PATCH] GLIBC prelinking part Message-ID: <20010719222509.R821@sunsite.ms.mff.cuni.cz> Hi! First of all, I don't want this for glibc 2.2.4. What I'm looking for is: a) whether something like this could be acceptable for glibc 2.3 (with l_machine_specific replaced with what David Mosberger suggested, ie. architecture specific sub-structure of link_map) Note that non-REL architectures will probably need far less sysdep changes than IA-32 (well, aside from mips) b) if my choice of new SHT_ constant and new DT_ constants is right, or whether that should be coordinated with Sun somehow, or whether I should choose constants far from the numbers used by Sun c) whether you agree on: the format of .gnu.conflict (ie. ElfW(Rela) with ELFW(R_SYM) zero) the format of .gnu.liblist (ie. ElfW(Lib)) conversion of REL to RELA on REL arches if necessary (on IA-32 this is if there are any R_386_32 or R_386_PC32 relocs) the choice/usage of dynamic tags (DT_CHECKSUM, DT_GNU_PRELINKED plus address/size pairs for .gnu.conflict and .gnu.liblist for binaries) I believe the rest are just implementation details. More details in http://sources.redhat.com/ml/binutils/2001-07/msg00057.html I know you're very busy but I'd very appreciate your feedback (and feedback from others too). Thanks. --- libc/elf/dl-deps.c.jj Mon Jun 25 10:33:47 2001 +++ libc/elf/dl-deps.c Mon Jun 25 10:50:33 2001 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +71,21 @@ openaux (void *a) args->trace_mode, 0); } +static ptrdiff_t +internal_function +_dl_build_local_scope (struct link_map **list, struct link_map *map) +{ + struct link_map **p = list; + struct link_map **q; + + *p++ = map; + map->l_reserved = 1; + if (map->l_initfini) + for (q = map->l_initfini; *q; q++) + if (! (*q)->l_reserved) + p += _dl_build_local_scope (p, *q); + return p - list; +} /* We use a very special kind of list to track the path @@ -488,6 +504,47 @@ out: /* Now clear all the mark bits we set in the objects on the search list to avoid duplicates, so the next call starts fresh. */ runp->map->l_reserved = 0; + } + + if (__builtin_expect(_dl_debug_mask & DL_DEBUG_PRELINK, 0) != 0 + && map == _dl_loaded) + { + /* If we are to compute conflicts, we have to build local scope + for each library, not just the ultimate loader. */ + for (i = 1; i < nlist; ++i) + { + struct link_map *l = map->l_searchlist.r_list[i]; + unsigned int j, cnt; + + /* The local scope has been already computed. */ + if (l->l_local_scope[0] + && l->l_local_scope[0]->r_nlist != 0) + continue; + + if (l->l_info[AUXTAG] || l->l_info[FILTERTAG]) + { + /* FIXME: This code does not handle filters yet. */ + _dl_signal_error (EINVAL, l->l_name, + N_("Filters not supported with LD_TRACE_PRELINKING")); + } + + cnt = _dl_build_local_scope (map->l_initfini, l); + assert (cnt <= nlist); + for (j = 0; j < cnt; j++) + map->l_initfini[j]->l_reserved = 0; + + l->l_local_scope[0] = + (struct r_scope_elem *) malloc (sizeof (struct r_scope_elem) + + cnt * sizeof (struct link_map *)); + if (l->l_local_scope[0] == NULL) + _dl_signal_error (ENOMEM, map->l_name, + N_("cannot allocate symbol search list")); + l->l_local_scope[0]->r_nlist = cnt; + l->l_local_scope[0]->r_list = + (struct link_map **) (l->l_local_scope[0] + 1); + memcpy (l->l_local_scope[0]->r_list, map->l_initfini, + cnt * sizeof (struct link_map *)); + } } /* Now determine the order in which the initialization has to happen. */ --- libc/elf/rtld.c.jj Wed May 23 09:21:41 2001 +++ libc/elf/rtld.c Mon Jun 25 10:50:33 2001 @@ -66,6 +66,8 @@ struct r_search_path *_dl_search_paths; const char *_dl_profile; const char *_dl_profile_output; struct link_map *_dl_profile_map; +const char *_dl_trace_prelink; +struct link_map *_dl_trace_prelink_map; int _dl_lazy = 1; /* XXX I know about at least one case where we depend on the old weak behavior (it has to do with librt). Until we get DSO groups implemented @@ -137,6 +139,13 @@ RTLD_START #error "sysdeps/MACHINE/dl-machine.h fails to define RTLD_START" #endif +#ifndef VALIDX +# define VALIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \ + + DT_EXTRANUM + DT_VALTAGIDX (tag)) +# define ADDRIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \ + + DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag)) +#endif + static ElfW(Addr) _dl_start (void *arg) { @@ -175,10 +184,14 @@ _dl_start (void *arg) ELF_MACHINE_BEFORE_RTLD_RELOC (bootstrap_map.l_info); #endif - /* Relocate ourselves so we can do normal function calls and - data access using the global offset table. */ + if (bootstrap_map.l_addr || ! bootstrap_map.l_info[VALIDX(DT_GNU_PRELINKED)]) + { + /* Relocate ourselves so we can do normal function calls and + data access using the global offset table. */ + + ELF_DYNAMIC_RELOCATE (&bootstrap_map, 0, 0); + } - ELF_DYNAMIC_RELOCATE (&bootstrap_map, 0, 0); /* Please note that we don't allow profiling of this object and therefore need not test whether we have to allocate the array for the relocation results (as done in dl-reloc.c). */ @@ -374,6 +387,7 @@ dl_main (const ElfW(Phdr) *phdr, char *file; int has_interp = 0; unsigned int i; + int prelinked = 0; int rtld_is_main = 0; #ifndef HP_TIMING_NONAVAIL hp_timing_t start; @@ -873,14 +887,81 @@ of this helper program; chances are you else { struct link_map *l; + ElfW(Addr) l_addr; + + /* Try to figure dynamic linker's real map start (which may be + different than _dl_rtld_map.l_addr). + Assuming no target has page size less than 1024 bytes + and .hash being the first real section. */ + if (_dl_rtld_map.l_info[DT_HASH] + && (l_addr = _dl_rtld_map.l_addr + + (_dl_rtld_map.l_info[DT_HASH]->d_un.d_ptr + & ~(ElfW(Addr))1023)), + memcmp ((char *) l_addr, ELFMAG, SELFMAG) == 0) + { + ElfW(Ehdr) *ehdr = (ElfW(Ehdr) *) l_addr; + ElfW(Phdr) *ph, *phdr = + (ElfW(Phdr) *)(l_addr + ehdr->e_phoff); + ElfW(Half) phnum = ehdr->e_phnum; - for (l = _dl_loaded->l_next; l; l = l->l_next) - if (l->l_faked) - /* The library was not found. */ - _dl_printf ("\t%s => not found\n", l->l_libname->name); - else - _dl_printf ("\t%s => %s (0x%0*Zx)\n", l->l_libname->name, - l->l_name, (int) sizeof l->l_addr * 2, l->l_addr); + if (((ElfW(Addr)) &phdr[phnum]) - l_addr + <= (_dl_rtld_map.l_info[DT_HASH]->d_un.d_ptr & 1023)) + { + _dl_rtld_map.l_map_end = 0; + for (ph = phdr; ph < &phdr[phnum]; ++ph) + if (ph->p_type == PT_LOAD) + { + ElfW(Addr) mapstart, allocend; + mapstart = _dl_rtld_map.l_addr + + (ph->p_vaddr & ~(ph->p_align - 1)); + allocend = _dl_rtld_map.l_addr + + ph->p_vaddr + ph->p_memsz; + if (_dl_rtld_map.l_map_start > mapstart) + _dl_rtld_map.l_map_start = mapstart; + if (_dl_rtld_map.l_map_end < allocend) + _dl_rtld_map.l_map_end = allocend; + } + if (_dl_rtld_map.l_map_end == 0) + _dl_rtld_map.l_map_end = ~0; + } + } + + if (_dl_debug_mask & DL_DEBUG_PRELINK) + { + struct r_scope_elem *scope = &_dl_loaded->l_searchlist; + + for (i = 0; i < scope->r_nlist; i++) + { + l = scope->r_list [i]; + if (l->l_faked) + { + _dl_printf ("\t%s => not found\n", l->l_libname->name); + continue; + } + if (_dl_name_match_p (_dl_trace_prelink, l)) + _dl_trace_prelink_map = l; + _dl_printf ("\t%s => %s (0x%0*Zx, 0x%0*Zx)\n", + l->l_libname->name[0] ? l->l_libname->name + : _dl_argv[0] ?: "
", + l->l_name[0] ? l->l_name + : _dl_argv[0] ?: "
", + (int) sizeof l->l_map_start * 2, + l->l_map_start, + (int) sizeof l->l_addr * 2, + l->l_addr); + } + } + else + { + for (l = _dl_loaded->l_next; l; l = l->l_next) + if (l->l_faked) + /* The library was not found. */ + _dl_printf ("\t%s => not found\n", l->l_libname->name); + else + _dl_printf ("\t%s => %s (0x%0*Zx)\n", l->l_libname->name, + l->l_name, (int) sizeof l->l_map_start * 2, + l->l_map_start); + } } if (__builtin_expect (mode, trace) != trace) @@ -925,6 +1006,10 @@ of this helper program; chances are you } l = l->l_prev; } while (l); + + if ((_dl_debug_mask & DL_DEBUG_PRELINK) + && _dl_rtld_map.l_opencount > 1) + _dl_relocate_object (&_dl_rtld_map, _dl_loaded->l_scope, 0, 0); } #define VERNEEDTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (DT_VERNEED)) @@ -1003,6 +1088,84 @@ of this helper program; chances are you _exit (0); } + if (_dl_loaded->l_info [ADDRIDX (DT_GNU_LIBLIST)] + && ! __builtin_expect (_dl_profile != NULL, 0)) + { + ElfW(Lib) *liblist, *liblistend; + struct link_map **r_list, **r_listend, *l; + const char *strtab = (const void *) + D_PTR (_dl_loaded, l_info[DT_STRTAB]); + + assert (_dl_loaded->l_info [VALIDX (DT_GNU_LIBLISTSZ)] != NULL); + liblist = (ElfW(Lib) *) + _dl_loaded->l_info [ADDRIDX (DT_GNU_LIBLIST)]->d_un.d_ptr; + liblistend = (ElfW(Lib) *) + ((char *) liblist + + _dl_loaded->l_info [VALIDX (DT_GNU_LIBLISTSZ)]->d_un.d_val); + r_list = _dl_loaded->l_searchlist.r_list; + r_listend = r_list + _dl_loaded->l_searchlist.r_nlist; + + for (; r_list < r_listend && liblist < liblistend; r_list++) + { + l = *r_list; + + if (l == _dl_loaded) + continue; + + /* If the library is not mapped where it should, fail. */ + if (l->l_addr) + break; + + /* Next, check if checksum matches. */ + if (l->l_info [VALIDX(DT_CHECKSUM)] == NULL + || l->l_info [VALIDX(DT_CHECKSUM)]->d_un.d_val + != liblist->l_checksum) + break; + + if (l->l_info [VALIDX(DT_GNU_PRELINKED)] == NULL + || l->l_info [VALIDX(DT_GNU_PRELINKED)]->d_un.d_val + != liblist->l_time_stamp) + break; + + if (! _dl_name_match_p (strtab + liblist->l_name, l)) + break; + + ++liblist; + } + + + if (r_list == r_listend && liblist == liblistend) + prelinked = 1; + + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) + _dl_printf ("\nprelink checking: %s\n", prelinked ? "ok" : "failed"); + } + + if (prelinked) + { + if (_dl_loaded->l_info [ADDRIDX (DT_GNU_CONFLICT)] != NULL) + { + ElfW(Rela) *conflict, *conflictend; +#ifndef HP_TIMING_NONAVAIL + hp_timing_t start; + hp_timing_t stop; +#endif + + HP_TIMING_NOW (start); + assert (_dl_loaded->l_info [VALIDX (DT_GNU_CONFLICTSZ)] != NULL); + conflict = (ElfW(Rela) *) + _dl_loaded->l_info [ADDRIDX (DT_GNU_CONFLICT)]->d_un.d_ptr; + conflictend = (ElfW(Rela) *) + ((char *) conflict + + _dl_loaded->l_info [VALIDX (DT_GNU_CONFLICTSZ)]->d_un.d_val); + _dl_resolve_conflicts (_dl_loaded, conflict, conflictend); + HP_TIMING_NOW (stop); + HP_TIMING_DIFF (relocate_time, start, stop); + } + + _dl_sysdep_start_cleanup (); + } + else { /* Now we have all the objects loaded. Relocate them all except for the dynamic linker itself. We do this in reverse order so that copy @@ -1083,7 +1246,7 @@ of this helper program; chances are you _dl_main_searchlist = &_dl_loaded->l_searchlist; _dl_global_scope[0] = &_dl_loaded->l_searchlist; - /* Safe the information about the original global scope list since + /* Save the information about the original global scope list since we need it in the memory handling later. */ _dl_initial_searchlist = *_dl_main_searchlist; @@ -1394,6 +1557,17 @@ process_envvars (enum mode *modep) _dl_profile_output = &envline[18]; if (*_dl_profile_output == '\0') _dl_profile_output = "/var/tmp"; + } + break; + + case 16: + /* The mode of the dynamic linker can be set. */ + if (memcmp (&envline[3], "TRACE_PRELINKING", 16) == 0) + { + mode = trace; + _dl_verbose = 1; + _dl_debug_mask |= DL_DEBUG_PRELINK; + _dl_trace_prelink = &envline[20]; } break; --- libc/elf/dynamic-link.h.jj Wed May 23 09:21:39 2001 +++ libc/elf/dynamic-link.h Mon Jun 25 10:50:33 2001 @@ -1,5 +1,5 @@ /* Inline functions for dynamic linking. - Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,98,99,2000,2001 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 @@ -58,31 +58,39 @@ elf_get_dynamic_info (struct link_map *l else if ((Elf32_Word) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM) info[DT_EXTRATAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM] = dyn; + else if ((Elf32_Word) DT_VALTAGIDX (dyn->d_tag) < DT_VALNUM) + info[DT_VALTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM + + DT_VERSIONTAGNUM + DT_EXTRANUM] = dyn; + else if ((Elf32_Word) DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM) + info[DT_ADDRTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM + + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn; else assert (! "bad dynamic tag"); ++dyn; } #ifndef DL_RO_DYN_SECTION - if (info[DT_PLTGOT] != NULL) - info[DT_PLTGOT]->d_un.d_ptr += l_addr; - if (info[DT_STRTAB] != NULL) - info[DT_STRTAB]->d_un.d_ptr += l_addr; - if (info[DT_SYMTAB] != NULL) - info[DT_SYMTAB]->d_un.d_ptr += l_addr; -# if ! ELF_MACHINE_NO_RELA - if (info[DT_RELA] != NULL) + /* Don't adjust .dynamic unnecessarily. */ + if (l_addr) { - assert (info[DT_RELAENT]->d_un.d_val == sizeof (ElfW(Rela))); - info[DT_RELA]->d_un.d_ptr += l_addr; - } + if (info[DT_PLTGOT] != NULL) + info[DT_PLTGOT]->d_un.d_ptr += l_addr; + if (info[DT_STRTAB] != NULL) + info[DT_STRTAB]->d_un.d_ptr += l_addr; + if (info[DT_SYMTAB] != NULL) + info[DT_SYMTAB]->d_un.d_ptr += l_addr; +# if ! ELF_MACHINE_NO_RELA + if (info[DT_RELA] != NULL) + info[DT_RELA]->d_un.d_ptr += l_addr; # endif # if ! ELF_MACHINE_NO_REL - if (info[DT_REL] != NULL) - { - assert (info[DT_RELENT]->d_un.d_val == sizeof (ElfW(Rel))); - info[DT_REL]->d_un.d_ptr += l_addr; - } + if (info[DT_REL] != NULL) + info[DT_REL]->d_un.d_ptr += l_addr; # endif + if (info[DT_JMPREL] != NULL) + info[DT_JMPREL]->d_un.d_ptr += l_addr; + if (info[VERSYMIDX (DT_VERSYM)] != NULL) + info[VERSYMIDX (DT_VERSYM)]->d_un.d_ptr += l_addr; + } #endif if (info[DT_PLTREL] != NULL) { @@ -95,12 +103,14 @@ elf_get_dynamic_info (struct link_map *l || info[DT_PLTREL]->d_un.d_val == DT_RELA); # endif } -#ifndef DL_RO_DYN_SECTION - if (info[DT_JMPREL] != NULL) - info[DT_JMPREL]->d_un.d_ptr += l_addr; - if (info[VERSYMIDX (DT_VERSYM)] != NULL) - info[VERSYMIDX (DT_VERSYM)]->d_un.d_ptr += l_addr; -#endif +# if ! ELF_MACHINE_NO_RELA + if (info[DT_RELA] != NULL) + assert (info[DT_RELAENT]->d_un.d_val == sizeof (ElfW(Rela))); +# endif +# if ! ELF_MACHINE_NO_REL + if (info[DT_REL] != NULL) + assert (info[DT_RELENT]->d_un.d_val == sizeof (ElfW(Rel))); +# endif if (info[DT_FLAGS] != NULL) { /* Flags are used. Translate to the old form where available. @@ -177,8 +187,8 @@ elf_get_dynamic_info (struct link_map *l \ if ((map)->l_info[DT_##RELOC]) \ { \ - ranges[0].start = D_PTR ((map), l_info[DT_##RELOC]); \ - ranges[0].size = (map)->l_info[DT_##RELOC##SZ]->d_un.d_val; \ + ranges[0].start = D_PTR ((map), l_info[DT_##RELOC]); \ + ranges[0].size = (map)->l_info[DT_##RELOC##SZ]->d_un.d_val; \ } \ if ((map)->l_info[DT_PLTREL] \ && (!test_rel || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC)) \ --- libc/elf/elf.h.jj Mon Jun 25 10:33:47 2001 +++ libc/elf/elf.h Mon Jun 25 10:50:33 2001 @@ -316,6 +316,7 @@ typedef struct #define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ #define SHT_NUM 19 /* Number of defined types. */ #define SHT_LOOS 0x60000000 /* Start OS-specific */ +#define SHT_GNU_LIBLIST 0x6ffffff1 /* Prelink library list */ #define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */ #define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */ #define SHT_SUNW_move 0x6ffffffa @@ -649,6 +650,9 @@ typedef struct Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's approach. */ #define DT_VALRNGLO 0x6ffffd00 +#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */ +#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */ +#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */ #define DT_CHECKSUM 0x6ffffdf8 #define DT_PLTPADSZ 0x6ffffdf9 #define DT_MOVEENT 0x6ffffdfa @@ -659,6 +663,8 @@ typedef struct #define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */ #define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */ #define DT_VALRNGHI 0x6ffffdff +#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */ +#define DT_VALNUM 12 /* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the Dyn.d_un.d_ptr field of the Elf*_Dyn structure. @@ -666,8 +672,17 @@ typedef struct If any adjustment is made to the ELF object after it has been built these entries will need to be adjusted. */ #define DT_ADDRRNGLO 0x6ffffe00 -#define DT_SYMINFO 0x6ffffeff /* syminfo table */ +#define DT_GNU_CONFLICT 0x6ffffef6 /* Start of conflict section */ +#define DT_GNU_LIBLIST 0x6ffffef7 /* Library list */ +#define DT_CONFIG 0x6ffffefa /* Configuration info */ +#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing */ +#define DT_AUDIT 0x6ffffefc /* Object auditing */ +#define DT_PLTPAD 0x6ffffefd /* PLT padding */ +#define DT_MOVETAB 0x6ffffefe /* Move table */ +#define DT_SYMINFO 0x6ffffeff /* Syminfo table */ #define DT_ADDRRNGHI 0x6ffffeff +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ +#define DT_ADDRNUM 10 /* The versioning entry types. The next are defined as part of the GNU extension. */ --- libc/elf/dl-lookup.c.jj Wed May 23 09:21:38 2001 +++ libc/elf/dl-lookup.c Mon Jun 25 15:33:39 2001 @@ -193,6 +193,15 @@ _dl_do_lookup_versioned (const char *und const struct r_found_version *const version, struct link_map *skip, int noexec, int noplt); +static void +internal_function +_dl_debug_bindings (const char *undef_name, struct link_map *undef_map, + const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[], + struct sym_val *value, const struct r_found_version *version, + int reloc_type, int protected); + +struct lookup_cache lookup_cache; + /* Search loaded objects' symbol tables for a definition of the symbol UNDEF_NAME. */ @@ -202,7 +211,7 @@ _dl_lookup_symbol (const char *undef_nam const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[], int reloc_type, int explicit) { - const char *reference_name = undef_map ? undef_map->l_name : NULL; + const char *reference_name = undef_map->l_name; const unsigned long int hash = _dl_elf_hash (undef_name); struct sym_val current_value = { NULL, NULL }; struct r_scope_elem **scope; @@ -212,6 +221,17 @@ _dl_lookup_symbol (const char *undef_nam ++_dl_num_relocations; + /* First check if we can find it in the cache. */ + if (__builtin_expect (*ref == lookup_cache.sym, 0) + && lookup_cache.map == undef_map + && lookup_cache.noexec == noexec + && lookup_cache.noplt == noplt + && lookup_cache.version == NULL) + { + *ref = lookup_cache.ret; + return lookup_cache.value; + } + /* Search the relevant loaded objects for a definition. */ for (scope = symbol_scope; *scope; ++scope) if (do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, NULL, @@ -238,35 +258,29 @@ _dl_lookup_symbol (const char *undef_nam break; } + lookup_cache.sym = *ref; + lookup_cache.noexec = noexec; + lookup_cache.noplt = noplt; + lookup_cache.version = NULL; + if (__builtin_expect (current_value.s == NULL, 0)) { if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) /* We could find no value for a strong reference. */ /* XXX We cannot translate the messages. */ - _dl_signal_cerror (0, (reference_name && reference_name[0] + _dl_signal_cerror (0, (reference_name[0] ? reference_name : (_dl_argv[0] ?: "
")), make_string (undefined_msg, undef_name)); + lookup_cache.ret = NULL; + lookup_cache.value = 0; *ref = NULL; return 0; } protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0)) - _dl_debug_printf ("binding file %s to %s: %s symbol `%s'\n", - (reference_name && reference_name[0] - ? reference_name : (_dl_argv[0] ?: "
")), - current_value.m->l_name[0] - ? current_value.m->l_name : _dl_argv[0], - protected ? "protected" : "normal", undef_name); - - if (__builtin_expect (protected == 0, 1)) - { - *ref = current_value.s; - return LOOKUP_VALUE (current_value.m); - } - else + if (__builtin_expect (protected != 0, 0)) { /* It is very tricky. We need to figure out what value to return for the protected symbol */ @@ -277,14 +291,22 @@ _dl_lookup_symbol (const char *undef_nam 0, NULL, 0, 1)) break; - if (protected_value.s == NULL || protected_value.m == undef_map) + if (protected_value.s != NULL && protected_value.m != undef_map) { - *ref = current_value.s; - return LOOKUP_VALUE (current_value.m); + current_value.s = *ref; + current_value.m = undef_map; } - - return LOOKUP_VALUE (undef_map); } + + if (__builtin_expect (_dl_debug_mask + & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0)) + _dl_debug_bindings (undef_name, undef_map, ref, symbol_scope, + ¤t_value, NULL, reloc_type, protected); + + lookup_cache.ret = current_value.s; + lookup_cache.value = LOOKUP_VALUE (current_value.m); + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); } @@ -300,7 +322,7 @@ _dl_lookup_symbol_skip (const char *unde struct r_scope_elem *symbol_scope[], struct link_map *skip_map) { - const char *reference_name = undef_map ? undef_map->l_name : NULL; +/* const char *reference_name = undef_map->l_name; */ const unsigned long int hash = _dl_elf_hash (undef_name); struct sym_val current_value = { NULL, NULL }; struct r_scope_elem **scope; @@ -329,20 +351,7 @@ _dl_lookup_symbol_skip (const char *unde protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0)) - _dl_debug_printf ("binding file %s to %s: %s symbol `%s'\n", - (reference_name && reference_name[0] - ? reference_name : (_dl_argv[0] ?: "
")), - current_value.m->l_name[0] - ? current_value.m->l_name : _dl_argv[0], - protected ? "protected" : "normal", undef_name); - - if (__builtin_expect (protected == 0, 1)) - { - *ref = current_value.s; - return LOOKUP_VALUE (current_value.m); - } - else + if (__builtin_expect (protected != 0, 0)) { /* It is very tricky. We need to figure out what value to return for the protected symbol. */ @@ -356,14 +365,20 @@ _dl_lookup_symbol_skip (const char *unde 0, skip_map, 0, 1)) break; - if (protected_value.s == NULL || protected_value.m == undef_map) + if (protected_value.s != NULL && protected_value.m != undef_map) { - *ref = current_value.s; - return LOOKUP_VALUE (current_value.m); + current_value.s = *ref; + current_value.m = undef_map; } - - return LOOKUP_VALUE (undef_map); } + + if (__builtin_expect (_dl_debug_mask + & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0)) + _dl_debug_bindings (undef_name, undef_map, ref, symbol_scope, + ¤t_value, NULL, 0, protected); + + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); } @@ -380,7 +395,7 @@ _dl_lookup_versioned_symbol (const char const struct r_found_version *version, int reloc_type, int explicit) { - const char *reference_name = undef_map ? undef_map->l_name : NULL; + const char *reference_name = undef_map->l_name; const unsigned long int hash = _dl_elf_hash (undef_name); struct sym_val current_value = { NULL, NULL }; struct r_scope_elem **scope; @@ -390,6 +405,17 @@ _dl_lookup_versioned_symbol (const char ++_dl_num_relocations; + /* First check if we can find it in the cache. */ + if (__builtin_expect (*ref == lookup_cache.sym, 0) + && lookup_cache.map == undef_map + && lookup_cache.noexec == noexec + && lookup_cache.noplt == noplt + && lookup_cache.version == version) + { + *ref = lookup_cache.ret; + return lookup_cache.value; + } + /* Search the relevant loaded objects for a definition. */ for (scope = symbol_scope; *scope; ++scope) { @@ -424,7 +450,7 @@ _dl_lookup_versioned_symbol (const char /* Oh, oh. The file named in the relocation entry does not contain the needed symbol. */ /* XXX We cannot translate the message. */ - _dl_signal_cerror (0, (reference_name && reference_name[0] + _dl_signal_cerror (0, (reference_name[0] ? reference_name : (_dl_argv[0] ?: "
")), make_string ("symbol ", undef_name, ", version ", @@ -439,37 +465,30 @@ _dl_lookup_versioned_symbol (const char } } + lookup_cache.sym = *ref; + lookup_cache.noexec = noexec; + lookup_cache.noplt = noplt; + lookup_cache.version = version; + if (__builtin_expect (current_value.s == NULL, 0)) { if (*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) /* We could find no value for a strong reference. */ /* XXX We cannot translate the message. */ - _dl_signal_cerror (0, (reference_name && reference_name[0] + _dl_signal_cerror (0, (reference_name[0] ? reference_name : (_dl_argv[0] ?: "
")), make_string (undefined_msg, undef_name, ", version ", version->name ?: NULL)); + lookup_cache.ret = NULL; + lookup_cache.value = 0; *ref = NULL; return 0; } protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0)) - _dl_debug_printf ("binding file %s to %s: %s symbol `%s' [%s]\n", - (reference_name && reference_name[0] - ? reference_name : (_dl_argv[0] ?: "
")), - current_value.m->l_name[0] - ? current_value.m->l_name : _dl_argv[0], - protected ? "protected" : "normal", - undef_name, version->name); - - if (__builtin_expect (protected == 0, 1)) - { - *ref = current_value.s; - return LOOKUP_VALUE (current_value.m); - } - else + if (__builtin_expect (protected != 0, 0)) { /* It is very tricky. We need to figure out what value to return for the protected symbol */ @@ -480,14 +499,22 @@ _dl_lookup_versioned_symbol (const char *scope, 0, version, NULL, 0, 1)) break; - if (protected_value.s == NULL || protected_value.m == undef_map) + if (protected_value.s != NULL && protected_value.m != undef_map) { - *ref = current_value.s; - return LOOKUP_VALUE (current_value.m); + current_value.s = *ref; + current_value.m = undef_map; } - - return LOOKUP_VALUE (undef_map); } + + if (__builtin_expect (_dl_debug_mask + & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0)) + _dl_debug_bindings (undef_name, undef_map, ref, symbol_scope, + ¤t_value, version, reloc_type, protected); + + lookup_cache.ret = current_value.s; + lookup_cache.value = LOOKUP_VALUE (current_value.m); + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); } @@ -502,7 +529,7 @@ _dl_lookup_versioned_symbol_skip (const const struct r_found_version *version, struct link_map *skip_map) { - const char *reference_name = undef_map ? undef_map->l_name : NULL; + const char *reference_name = undef_map->l_name; const unsigned long int hash = _dl_elf_hash (undef_name); struct sym_val current_value = { NULL, NULL }; struct r_scope_elem **scope; @@ -533,7 +560,7 @@ _dl_lookup_versioned_symbol_skip (const __mempcpy (__mempcpy (buf, undefined_msg, sizeof undefined_msg - 1), undef_name, len + 1); /* XXX We cannot translate the messages. */ - _dl_signal_cerror (0, (reference_name && reference_name[0] + _dl_signal_cerror (0, (reference_name[0] ? reference_name : (_dl_argv[0] ?: "
")), buf); } @@ -543,21 +570,7 @@ _dl_lookup_versioned_symbol_skip (const protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0)) - _dl_debug_printf ("binding file %s to %s: %s symbol `%s' [%s]\n", - (reference_name && reference_name[0] - ? reference_name : (_dl_argv[0] ?: "
")), - current_value.m->l_name[0] - ? current_value.m->l_name : _dl_argv[0], - protected ? "protected" : "normal", - undef_name, version->name); - - if (__builtin_expect (protected == 0, 1)) - { - *ref = current_value.s; - return LOOKUP_VALUE (current_value.m); - } - else + if (__builtin_expect (protected != 0, 0)) { /* It is very tricky. We need to figure out what value to return for the protected symbol */ @@ -573,14 +586,20 @@ _dl_lookup_versioned_symbol_skip (const skip_map, 0, 1)) break; - if (protected_value.s == NULL || protected_value.m == undef_map) + if (protected_value.s != NULL && protected_value.m != undef_map) { - *ref = current_value.s; - return LOOKUP_VALUE (current_value.m); + current_value.s = *ref; + current_value.m = undef_map; } - - return LOOKUP_VALUE (undef_map); } + + if (__builtin_expect (_dl_debug_mask + & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0)) + _dl_debug_bindings (undef_name, undef_map, ref, symbol_scope, + ¤t_value, version, 0, protected); + + *ref = current_value.s; + return LOOKUP_VALUE (current_value.m); } @@ -602,6 +621,82 @@ _dl_setup_hash (struct link_map *map) map->l_buckets = hash; hash += map->l_nbuckets; map->l_chain = hash; +} + +static void +internal_function +_dl_debug_bindings (const char *undef_name, struct link_map *undef_map, + const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[], + struct sym_val *value, const struct r_found_version *version, + int reloc_type, int protected) +{ + const char *reference_name = undef_map->l_name; + + if (_dl_debug_mask & DL_DEBUG_BINDINGS) + { + _dl_debug_printf ("binding file %s to %s: %s symbol `%s'", + (reference_name[0] + ? reference_name : (_dl_argv[0] ?: "
")), + value->m->l_name[0] ? value->m->l_name : _dl_argv[0], + protected ? "protected" : "normal", + undef_name); + if (version) + _dl_debug_printf_c (" [%s]\n", version->name); + else + _dl_debug_printf_c ("\n"); + } +#ifdef SHARED + if (_dl_debug_mask & DL_DEBUG_PRELINK) + { + int conflict = 0; + struct sym_val val = { NULL, NULL }; + + if ((_dl_trace_prelink_map == NULL + || _dl_trace_prelink_map == _dl_loaded) + && undef_map != _dl_loaded) + { + const unsigned long int hash = _dl_elf_hash (undef_name); + int noexec = elf_machine_lookup_noexec_p (reloc_type); + int noplt = elf_machine_lookup_noplt_p (reloc_type); + + if (version == 0) + _dl_do_lookup (undef_name, hash, *ref, &val, + undef_map->l_local_scope[0], 0, NULL, noexec, + noplt); + else + _dl_do_lookup_versioned (undef_name, hash, *ref, &val, + undef_map->l_local_scope[0], 0, version, + NULL, noexec, noplt); + + if (val.s != value->s || val.m != value->m) + conflict = 1; + } + + if (conflict + || _dl_trace_prelink_map == undef_map + || _dl_trace_prelink_map == NULL) + { + _dl_printf ("%s 0x%0*Zx 0x%0*Zx -> 0x%0*Zx 0x%0*Zx ", + conflict ? "conflict" : "lookup", + (int) sizeof (ElfW(Addr)) * 2, undef_map->l_map_start, + (int) sizeof (ElfW(Addr)) * 2, + ((ElfW(Addr)) *ref) - undef_map->l_map_start, + (int) sizeof (ElfW(Addr)) * 2, + (ElfW(Addr)) (value->s ? value->m->l_map_start : 0), + (int) sizeof (ElfW(Addr)) * 2, + (ElfW(Addr)) (value->s ? value->s->st_value : 0)); + + if (conflict) + _dl_printf ("x 0x%0*Zx 0x%0*Zx ", + (int) sizeof (ElfW(Addr)) * 2, + (ElfW(Addr)) (val.s ? val.m->l_map_start : 0), + (int) sizeof (ElfW(Addr)) * 2, + (ElfW(Addr)) (val.s ? val.s->st_value : 0)); + + _dl_printf ("%x %s\n", reloc_type, undef_name); + } + } +#endif } /* These are here so that we only inline do_lookup{,_versioned} in the common --- libc/elf/do-rel.h.jj Wed May 23 09:21:39 2001 +++ libc/elf/do-rel.h Mon Jun 25 10:50:33 2001 @@ -43,6 +43,7 @@ elf_dynamic_do_rel (struct link_map *map const ElfW(Rel) *r = (const void *) reladdr; const ElfW(Rel) *end = (const void *) (reladdr + relsize); +#if !defined DO_RELA || !defined ELF_MACHINE_PLT_REL if (lazy) { /* Doing lazy PLT relocations; they need very little info. */ @@ -51,6 +52,7 @@ elf_dynamic_do_rel (struct link_map *map elf_machine_lazy_rel (map, l_addr, r); } else +#endif { const ElfW(Sym) *const symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]); --- libc/elf/dl-runtime.c.jj Wed May 23 09:21:38 2001 +++ libc/elf/dl-runtime.c Mon Jun 25 10:50:33 2001 @@ -23,7 +23,8 @@ #include #include "dynamic-link.h" -#if !defined ELF_MACHINE_NO_RELA || ELF_MACHINE_NO_REL +#if (!defined ELF_MACHINE_NO_RELA && !defined ELF_MACHINE_PLT_REL) \ + || ELF_MACHINE_NO_REL # define PLTREL ElfW(Rela) #else # define PLTREL ElfW(Rel) --- libc/elf/dl-conflict.c.jj Mon Jun 25 10:50:33 2001 +++ libc/elf/dl-conflict.c Mon Jun 25 21:02:45 2001 @@ -0,0 +1,55 @@ +/* Resolve conflicts against already prelinked libraries. + Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include "dynamic-link.h" + +extern unsigned long int _dl_num_relocations; /* in dl-lookup.c */ + +void +_dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict, + ElfW(Rela) *conflictend) +{ + if (__builtin_expect (_dl_debug_mask & DL_DEBUG_RELOC, 0)) + _dl_printf ("\nconflict processing: %s\n", + l->l_name[0] ? l->l_name : _dl_argv[0]); + + { + /* Do the conflict relocation of the object and library GOT and other + data. */ + + /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */ +#define RESOLVE_MAP(ref, version, flags) (*ref = NULL, 0) +#define RESOLVE(ref, version, flags) (*ref = NULL, 0) + +#include "dynamic-link.h" + + _dl_num_relocations += conflictend - conflict; + + for (; conflict < conflictend; ++conflict) + elf_machine_rela (l, conflict, NULL, NULL, (void *) conflict->r_offset); + } +} --- libc/elf/Makefile.jj Wed May 23 09:21:37 2001 +++ libc/elf/Makefile Mon Jun 25 10:50:33 2001 @@ -28,7 +28,7 @@ routines = $(dl-routines) dl-open dl-clo # profiled libraries. dl-routines = $(addprefix dl-,load cache lookup object reloc deps \ runtime error init fini debug misc \ - version profile) + version profile conflict) all-dl-routines = $(dl-routines) $(sysdep-dl-routines) # But they are absent from the shared libc, because that code is in ld.so. elide-routines.os = $(all-dl-routines) dl-support enbl-secure --- libc/elf/dl-reloc.c.jj Wed May 23 09:21:38 2001 +++ libc/elf/dl-reloc.c Mon Jun 25 20:48:01 2001 @@ -89,7 +89,13 @@ cannot make segment writable for relocat : l->l_addr) #include "dynamic-link.h" + + /* Start symbol lookup caching for this object. */ + lookup_cache.map = (_dl_debug_mask & DL_DEBUG_PRELINK) ? NULL : l; + ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling); + + lookup_cache.map = NULL; if (__builtin_expect (_dl_profile != NULL, 0)) { --- libc/include/link.h.jj Wed May 23 09:21:43 2001 +++ libc/include/link.h Mon Jun 25 10:50:33 2001 @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2001 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 @@ -130,14 +130,20 @@ struct link_map /* Indexed pointers to dynamic section. [0,DT_NUM) are indexed by the processor-independent tags. [DT_NUM,DT_NUM+DT_THISPROCNUM) are indexed by the tag minus DT_LOPROC. - [DT_NUM+DT_THISPROCNUM,DT_NUM+DT_THISPROCNUM+DT_EXTRANUM) are indexed - by DT_EXTRATAGIDX(tagvalue) and + [DT_NUM+DT_THISPROCNUM,DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM) are + indexed by DT_VERSIONTAGIDX(tagvalue). [DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM, - DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM) - are indexed by DT_EXTRATAGIDX(tagvalue) (see ). */ + DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM) are indexed by + DT_EXTRATAGIDX(tagvalue). + [DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM, + DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM+DT_VALNUM) are + indexed by DT_VALTAGIDX(tagvalue) and + [DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM+DT_VALNUM, + DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM+DT_VALNUM+DT_ADDRNUM) + are indexed by DT_ADDRTAGIDX(tagvalue), see . */ ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM - + DT_EXTRANUM]; + + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM]; const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */ ElfW(Addr) l_entry; /* Entry point location. */ ElfW(Half) l_phnum; /* Number of program header entries. */ @@ -228,6 +234,9 @@ struct link_map /* Temporarily used in `dl_close'. */ unsigned int l_idx; + + /* Ugly. */ + ElfW(Word) l_machine_specific[2]; }; #endif /* link.h */ --- libc/sysdeps/generic/ldsodefs.h.jj Fri Mar 16 10:01:25 2001 +++ libc/sysdeps/generic/ldsodefs.h Mon Jun 25 15:01:11 2001 @@ -185,6 +185,8 @@ extern const char *_dl_profile; extern struct link_map *_dl_profile_map; /* Filename of the output file. */ extern const char *_dl_profile_output; +/* Map of shared object to be prelink traced. */ +extern struct link_map *_dl_trace_prelink_map; /* If nonzero the appropriate debug information is printed. */ extern int _dl_debug_mask; @@ -196,6 +198,7 @@ extern int _dl_debug_mask; #define DL_DEBUG_RELOC (1 << 5) #define DL_DEBUG_FILES (1 << 6) #define DL_DEBUG_STATISTICS (1 << 7) +#define DL_DEBUG_PRELINK (1 << 8) /* Expect cache ID. */ extern int _dl_correct_cache_id; @@ -316,6 +319,19 @@ extern void _dl_map_object_deps (struct /* Cache the locations of MAP's hash table. */ extern void _dl_setup_hash (struct link_map *map) internal_function; +/* This holds symbol lookup cache. */ +struct lookup_cache + { + const ElfW(Sym) *sym; + struct link_map *map; + const struct r_found_version *version; + int noexec; + int noplt; + lookup_t value; + const ElfW(Sym) *ret; + }; + +extern struct lookup_cache lookup_cache; /* Search loaded objects' symbol tables for a definition of the symbol referred to by UNDEF. *SYM is the symbol table entry containing the @@ -404,6 +420,11 @@ extern void _dl_reloc_bad_type (struct l uint_fast8_t type, int plt) internal_function __attribute__ ((__noreturn__)); + +/* Resolve conflicts if prelinking. */ +extern void _dl_resolve_conflicts (struct link_map *l, + ElfW(Rela) *conflict, + ElfW(Rela) *conflictend); /* Check the version dependencies of all objects available through MAP. If VERBOSE print some more diagnostics. */ --- libc/sysdeps/i386/dl-machine.h.jj Tue Apr 17 23:58:46 2001 +++ libc/sysdeps/i386/dl-machine.h Mon Jun 25 10:50:33 2001 @@ -87,6 +87,14 @@ elf_machine_runtime_setup (struct link_m offset into the .rel.plt section, push _GLOBAL_OFFSET_TABLE_[1], and then jump to _GLOBAL_OFFSET_TABLE[2]. */ got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]); + /* If a library is prelinked but we have to relocate anyway, + we have to be able to undo the prelinking of .got.plt. + The prelinker saved us here address of .plt + 0x16. */ + if (got[1]) + { + l->l_machine_specific [0] = got[1] + l->l_addr; + l->l_machine_specific [1] = (Elf32_Word) &got[3]; + } got[1] = (Elf32_Addr) l; /* Identify this shared object. */ /* The got[2] entry contains the address of a function which gets @@ -258,8 +266,9 @@ _dl_start_user:\n\ /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ #define ELF_MACHINE_JMP_SLOT R_386_JMP_SLOT -/* The i386 never uses Elf32_Rela relocations. */ -#define ELF_MACHINE_NO_RELA 1 +/* The i386 never uses Elf32_Rela relocations for the dynamic linker. + Prelinked libraries may use Elf32_Rela though. */ +#define ELF_MACHINE_PLT_REL 1 /* We define an initialization functions. This is called very early in _dl_sysdep_start. */ @@ -295,6 +304,12 @@ elf_machine_plt_value (struct link_map * #ifdef RESOLVE +/* The i386 never uses Elf32_Rela relocations for the dynamic linker. + Prelinked libraries may use Elf32_Rela though. */ +#ifdef RTLD_BOOTSTRAP +#define ELF_MACHINE_NO_RELA 1 +#endif + /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ @@ -371,6 +386,41 @@ elf_machine_rel (struct link_map *map, c } } +#ifndef RTLD_BOOTSTRAP +static inline void +elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, + const Elf32_Sym *sym, const struct r_found_version *version, + Elf32_Addr *const reloc_addr) +{ + if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE) + *reloc_addr = map->l_addr + reloc->r_addend; + else if (ELF32_R_TYPE (reloc->r_info) != R_386_NONE) + { +/* const Elf32_Sym *const refsym = sym; */ + Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info)); + if (sym) + value += sym->st_value; + + switch (ELF32_R_TYPE (reloc->r_info)) + { + case R_386_GLOB_DAT: + case R_386_JMP_SLOT: + case R_386_32: + *reloc_addr = value + reloc->r_addend; + break; + case R_386_PC32: + *reloc_addr = (value + reloc->r_addend - (Elf32_Addr) reloc_addr); + break; + default: + /* We add these checks in the version to relocate ld.so only + if we are still debugging. */ + _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 0); + break; + } + } +} +#endif + static inline void elf_machine_lazy_rel (struct link_map *map, Elf32_Addr l_addr, const Elf32_Rel *reloc) @@ -379,9 +429,26 @@ elf_machine_lazy_rel (struct link_map *m /* Check for unexpected PLT reloc type. */ if (__builtin_expect (ELF32_R_TYPE (reloc->r_info), R_386_JMP_SLOT) == R_386_JMP_SLOT) - *reloc_addr += l_addr; + { + if (__builtin_expect (map->l_machine_specific [0], 0) == 0) + *reloc_addr += l_addr; + else + *reloc_addr = + map->l_machine_specific [0] + + (((Elf32_Word) reloc_addr) - map->l_machine_specific [1]) * 4; + } else _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 1); } + +#ifndef RTLD_BOOTSTRAP + +static inline void +elf_machine_lazy_rela (struct link_map *map, + Elf32_Addr l_addr, const Elf32_Rela *reloc) +{ +} + +#endif #endif /* RESOLVE */ Jakub From jes@trained-monkey.org Thu Jul 19 13:23:00 2001 From: jes@trained-monkey.org (Jes Sorensen) Date: Thu, 19 Jul 2001 13:23:00 -0000 Subject: [PATCH] Fix LC_PAPER in some locales References: <20010719122337.N821@sunsite.ms.mff.cuni.cz> <20010719165020.O821@sunsite.ms.mff.cuni.cz> Message-ID: >>>>> "Jakub" == Jakub Jelinek writes: Jakub> On Thu, Jul 19, 2001 at 07:29:40AM -0700, Ulrich Drepper wrote: >> Jakub Jelinek writes: >> >> > * locales/en_CA (LC_PAPER): Change to Letter. > * locales/fr_CA >> (LC_PAPER): Likewise. >> >> Wrong. Canada uses the metric system. Jakub> That's why I kept LC_MEASUREMENT 1 for *_CA. But 2 Canadians Jakub> reported that Letter is the common paper format and it is very Jakub> hard if not impossible to order A4 paper there. Ayup, they use the metric system most official places but the paper is still letter, legal etc. I have never seen standard paper sizes here (A[1-6]/B[1-6] etc). Jes From roland@frob.com Thu Jul 19 15:37:00 2001 From: roland@frob.com (Roland McGrath) Date: Thu, 19 Jul 2001 15:37:00 -0000 Subject: DEV_TTY_P Message-ID: <20010719223530.84017994AE@perdition.linnaean.org> Is there any objection to making the DEV_TTY_P macro (and any similar things that get added) take a struct stat * argument instead of dev_t? We might want to add the optimized isatty check for the Hurd, but the test would be on different st_* fields, not just on st_rdev. From drepper@redhat.com Thu Jul 19 16:20:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 19 Jul 2001 16:20:00 -0000 Subject: DEV_TTY_P References: <20010719223530.84017994AE@perdition.linnaean.org> Message-ID: Roland McGrath writes: > Is there any objection to making the DEV_TTY_P macro (and any similar > things that get added) take a struct stat * argument instead of dev_t? > We might want to add the optimized isatty check for the Hurd, but > the test would be on different st_* fields, not just on st_rdev. No problem, go ahead and change it. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Sun Jul 22 11:22:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 22 Jul 2001 11:22:00 -0000 Subject: iconv chache Message-ID: I've been working on this for quite some time and finally took the time to finish it. It was item 22 in the PROJECTS file, namely, a pre-computed cache for the iconv module database. A few numbers for the motivation. I've a little program which fork()s 1000 times in a loop and exec()s "/bin/echo -n". This is one of the simplest programs which still uses locales. Here are the numbers without the cache: $ LC_ALL=C LD_LIBRARY_PATH=$PWD:$PWD/linuxthreads:$PWD/rt ./t 1000 runs of "/bin/echo": 2.318899061 secs $ LD_LIBRARY_PATH=$PWD:$PWD/linuxthreads:$PWD/rt ./t 1000 runs of "/bin/echo": 15.541000713 secs Pretty bad. If you look at the sprof output you'll see that a majority of the time is spend in the routines to parse and organize gconv-modules. With the changes I checked in and after running iconvconfig the result is $ LD_LIBRARY_PATH=$PWD:$PWD/linuxthreads:$PWD/rt ./t 1000 runs of "/bin/echo": 4.222061300 secs I.e., the startup performance (and the initial setlocale call is certainly startup meanwhile) improves by >300% and this even though the remaining time includes loading the echo binary, relocate it, load all the locale objects and the iconv module. The difference of 1.9msec to the LC_ALL=C version is attributed to this. I plan to do more work on this but for now this is fine. The iconvconfig program is easy to use. Just run it, optionally with additional directories containing iconv modules in the parameter list. All the given directories are then considered all the time, no GCONV_PATH setting necessary anymore. The cache file is ignored in case GCONV_PATH is set at runtime to preserve existing semantics. The changes are quite big but only because of new code. Modifications to existing code is minimal and if no cache is present the code doesn't change. This is why I put the code in at this late time. The risk is minimal. [There are a few more unrelated changes to the code which also cannot cause disturbances.] The iconvconfig program currently has enough functionality to support all the modules currently provided in glibc. It does not yet have the full functionality the old gconv-modules handler has. This is intentional, to keep the possibility of errors down. The file format and the gconv_cache implementation should be final and for glibc 2.3 the iconvconfig program will be beefed up to support all the features. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Sun Jul 22 11:34:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 22 Jul 2001 11:34:00 -0000 Subject: iconvconfig encore Message-ID: I forgot to mention one more thing you should know. If you look at the iconvconfig.h file you'll see a data type gidx_t defined to uint16_t. I originally used everywhere uint32_t but found that the cache file gets reduced so well that no offset using more than 15 bits. Switching to uint16_t reduced the file size by another 25%. So we stick with it. The file size is about 21k now and since I don't expect many more modules to be added tis should be sufficient for all times. I case I'm wrong all that has to be done is to change the one type definition and bump the magic number. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Sun Jul 22 16:41:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 22 Jul 2001 16:41:00 -0000 Subject: [PATCH] Use FLOATING_STACKS on IA-64 References: <20010719180735.P821@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > This patch changes IA-64 to use FLOATING_STACKS. Thanks, I've applied it. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Sun Jul 22 19:06:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 22 Jul 2001 19:06:00 -0000 Subject: [PATCH] GLIBC prelinking part References: <20010719222509.R821@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > a) whether something like this could be acceptable for glibc 2.3 > (with l_machine_specific replaced with what David Mosberger suggested, > ie. architecture specific sub-structure of link_map) > Note that non-REL architectures will probably need far less sysdep > changes than IA-32 (well, aside from mips) I think this is fine. Don't know about the machine specific definitions, yet, since I haven't seen it. > b) if my choice of new SHT_ constant and new DT_ constants is right, or > whether that should be coordinated with Sun somehow, or whether I should > choose constants far from the numbers used by Sun When it's time to add the patch I'll ask the people at Sun what they have allocated and reserve some numbers close by. I don't want to use a new range since this means additional tests when accessing the data. This is why I'm not suggesting to reuse the DT_MIPS_ and SHT_MIPS_ numbers. > c) whether you agree on: > the format of .gnu.conflict (ie. ElfW(Rela) with ELFW(R_SYM) zero) > the format of .gnu.liblist (ie. ElfW(Lib)) In general, yes. But I want to check what SGI did. Two problems: - all uses of _dl_debug_mask should be protected with __builtin_expect - the patch definitely should be split. The caching stuff should be independent from the rest. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Mon Jul 23 00:07:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 23 Jul 2001 00:07:00 -0000 Subject: tst-regex Message-ID: tst-regex should work again. I've changed the memory handling of the WCHAR version to not use too much stack. Please give it a try on your favorite non-floating-stack-using platform. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Mon Jul 23 01:24:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Mon, 23 Jul 2001 01:24:00 -0000 Subject: [PATCH] Floating stacks for Alpha and Sparc References: Message-ID: <20010723102808.V821@sunsite.ms.mff.cuni.cz> On Mon, Jul 23, 2001 at 12:02:56AM -0700, Ulrich Drepper wrote: > tst-regex should work again. I've changed the memory handling of the > WCHAR version to not use too much stack. Please give it a try on your > favorite non-floating-stack-using platform. Since I don't want to test this on Alpha nor Sparc ( ;) ), here is a patch so that none of my favourite platforms are non-floating-stack-using. Seems to work fine. 2001-07-23 Jakub Jelinek * sysdeps/alpha/pt-machine.h (FLOATING_STACKS): Define. (ARCH_STACK_MAX_SIZE): Define. * sysdeps/sparc/sparc32/pt-machine.h: Likewise. * sysdeps/sparc/sparc64/pt-machine.h: Likewise. --- libc/linuxthreads/sysdeps/alpha/pt-machine.h 2000/04/18 09:23:41 +++ libc/linuxthreads/sysdeps/alpha/pt-machine.h 2001/07/20 11:02:57 @@ -108,3 +108,9 @@ __compare_and_swap (long int *p, long in return ret; } + +/* We want the OS to assign stack addresses. */ +#define FLOATING_STACKS 1 + +/* Maximum size of the stack if the rlimit is unlimited. */ +#define ARCH_STACK_MAX_SIZE 32*1024*1024 --- libc/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h 2001/04/18 07:59:40 +++ libc/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h 2001/07/20 11:02:57 @@ -63,3 +63,9 @@ register struct _pthread_descr_struct *_ #define THREAD_GETMEM_NC(descr, member) __thread_self->member #define THREAD_SETMEM(descr, member, value) __thread_self->member = (value) #define THREAD_SETMEM_NC(descr, member, value) __thread_self->member = (value) + +/* We want the OS to assign stack addresses. */ +#define FLOATING_STACKS 1 + +/* Maximum size of the stack if the rlimit is unlimited. */ +#define ARCH_STACK_MAX_SIZE 8*1024*1024 --- libc/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h 2001/04/18 07:59:40 +++ libc/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h 2001/07/20 11:02:57 @@ -86,3 +86,9 @@ __compare_and_swap (long int *p, long in #define THREAD_GETMEM_NC(descr, member) __thread_self->member #define THREAD_SETMEM(descr, member, value) __thread_self->member = (value) #define THREAD_SETMEM_NC(descr, member, value) __thread_self->member = (value) + +/* We want the OS to assign stack addresses. */ +#define FLOATING_STACKS 1 + +/* Maximum size of the stack if the rlimit is unlimited. */ +#define ARCH_STACK_MAX_SIZE 32*1024*1024 Jakub From schwab@suse.de Mon Jul 23 01:50:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Mon, 23 Jul 2001 01:50:00 -0000 Subject: CPPFLAGS in math/Makefile Message-ID: This patch makes sure that the -D/-U options come out in the right order. Otherwise -U__LIBC_INTERNAL_MATH_INLINES occurs before -D__LIBC_INTERNAL_MATH_INLINES, and the latter wins. This happened to work with older versions of gcc where -U always wins regardless of its position on the command line. Andreas. 2001-07-23 Andreas Schwab * math/Makefile (CPPFLAGS-test-ifloat.c, CPPFLAGS-test-idouble.c, CPPFLAGS-test-ildoubl.c): Renamed from CFLAGS-*. (math-CPPFLAGS): Set this instead of CPPFLAGS. Index: Makefile =================================================================== RCS file: /cvs/glibc/libc/math/Makefile,v retrieving revision 1.107 diff -u -a -u -r1.107 Makefile --- Makefile 2001/07/06 04:55:35 1.107 +++ Makefile 2001/07/23 08:45:03 @@ -121,10 +121,10 @@ CFLAGS-test-float.c = -fno-inline -ffloat-store CFLAGS-test-double.c = -fno-inline -ffloat-store CFLAGS-test-ldouble.c = -fno-inline -ffloat-store -CFLAGS-test-ifloat.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ -CFLAGS-test-idouble.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ -CFLAGS-test-ildoubl.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ CFLAGS-test-tgmath.c = -fno-builtin +CPPFLAGS-test-ifloat.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ +CPPFLAGS-test-idouble.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ +CPPFLAGS-test-ildoubl.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ distribute += libm-test.inc gen-libm-test.pl README.libm-test @@ -145,7 +145,7 @@ # We don't want the fdlibm code to use the inline math functions, # only the fdlibm code. -CPPFLAGS += -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES +math-CPPFLAGS += -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES ifneq ($(long-double-fcts),yes) # The `double' and `long double' types are the same on this machine. @@ -153,7 +153,7 @@ # to define aliases for the `FUNCl' names. To avoid type conflicts in # defining those aliases, tell to declare the `FUNCl' names with # `double' instead of `long double'. -CPPFLAGS += -DNO_LONG_DOUBLE -D_Mlong_double_=double +math-CPPFLAGS += -DNO_LONG_DOUBLE -D_Mlong_double_=double endif # The fdlibm code generates a lot of these warnings but is otherwise clean. -- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From jakub@redhat.com Mon Jul 23 04:28:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Mon, 23 Jul 2001 04:28:00 -0000 Subject: [PATCH] Make sunrpc more lazy binding (or prelinking) friendly Message-ID: <20010723133236.Y821@sunsite.ms.mff.cuni.cz> Hi! sunrpc puts abort into its xp_ops. This results in 6 more non-relative relocations than necessary (and usually 6 conflicts with prelinking, since it is pretty common that main binary calls abort() somewhere and thus has a PLT entry for abort which those function pointers in sunrpc need to resolve to). Glibc already calls abort () in many other places, so wrapping that into small static wrapper functions IMHO helps to lazy binding too - they will be just R_*_RELATIVE relocated at startup and if ever someone calls that, who cares about speed. 2001-07-23 Jakub Jelinek * sunrpc/svc_tcp.c (svctcp_rendezvous_abort): New. (svctcp_rendezvous_op): Use it. * sunrpc/svc_unix.c (svcunix_rendezvous_abort): New. (svcunix_rendezvous_op): Use it. --- libc/sunrpc/svc_tcp.c.jj Mon Mar 26 10:02:34 2001 +++ libc/sunrpc/svc_tcp.c Mon Jul 23 13:04:50 2001 @@ -81,14 +81,23 @@ static const struct xp_ops svctcp_op = */ static bool_t rendezvous_request (SVCXPRT *, struct rpc_msg *); static enum xprt_stat rendezvous_stat (SVCXPRT *); +static void svctcp_rendezvous_abort (void); + +/* This function makes sure abort() relocation goes through PLT + and thus can be lazy bound. */ +static void +svctcp_rendezvous_abort (void) +{ + abort (); +}; static const struct xp_ops svctcp_rendezvous_op = { rendezvous_request, rendezvous_stat, - (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) abort, - (bool_t (*) (SVCXPRT *, struct rpc_msg *)) abort, - (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) abort, + (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svctcp_rendezvous_abort, + (bool_t (*) (SVCXPRT *, struct rpc_msg *)) svctcp_rendezvous_abort, + (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svctcp_rendezvous_abort, svctcp_destroy }; --- libc/sunrpc/svc_unix.c.jj Mon Mar 26 10:02:34 2001 +++ libc/sunrpc/svc_unix.c Mon Jul 23 13:05:49 2001 @@ -74,14 +74,23 @@ static const struct xp_ops svcunix_op = */ static bool_t rendezvous_request (SVCXPRT *, struct rpc_msg *); static enum xprt_stat rendezvous_stat (SVCXPRT *); +static void svcunix_rendezvous_abort (void); + +/* This function makes sure abort() relocation goes through PLT + and thus can be lazy bound. */ +static void +svcunix_rendezvous_abort (void) +{ + abort (); +}; static const struct xp_ops svcunix_rendezvous_op = { rendezvous_request, rendezvous_stat, - (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) abort, - (bool_t (*) (SVCXPRT *, struct rpc_msg *)) abort, - (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) abort, + (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svcunix_rendezvous_abort, + (bool_t (*) (SVCXPRT *, struct rpc_msg *)) svcunix_rendezvous_abort, + (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svcunix_rendezvous_abort, svcunix_destroy }; Jakub From jakub@redhat.com Mon Jul 23 10:18:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Mon, 23 Jul 2001 10:18:00 -0000 Subject: Locking in flush(0) and other flushall ops Message-ID: <20010723192011.C629@sunsite.ms.mff.cuni.cz> Hi! fflush(0) nor _flushlbf() does not do any locking which means fflush(0) cannot be used in multi-threaded programs etc. This has two problems: a) the _IO_list_all chain may shrink or grow while we're walking over it (growing should not cause problems, shrinking will) b) the calls to _OVERFLOW() are not done with the file descriptor lock held To complicate things even more, _IO_new_file_underflow calls _IO_flush_all_linebuffered from its underflow routine, perhaps with that file's lock already held. It is clear that it needs some kind of locking, the question is which to avoid deadlocks. E.g. can overflow handler (which may be user provided) do an fopen/fclose for some or something else that will result in _IO_link_in or _IO_un_link? If not, _IO_flush_all/_IO_flush_all_linebuffered could acquire list_all_lock at start and release it at end (together with a cleanup handler installation/removal). But still those routines should probably try to acquire individual file mutices (which means _IO_new_file_underflow will need to set some special flag which will cause _IO_flush_all_linebuffered to ignore acquiring that mutex). There is the possibility that _IO_new_file_underflow happens several times at once, so it is possible _IO_flush_all_linebuffered will skip several files. If overflow is allowed to do something which will in turn do _IO_link_in or _IO_un_link, things will be even more complicated. Ideas? Jakub From drepper@redhat.com Mon Jul 23 10:56:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 23 Jul 2001 10:56:00 -0000 Subject: [PATCH] Floating stacks for Alpha and Sparc References: <20010723102808.V821@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > Since I don't want to test this on Alpha nor Sparc ( ;) ), here is a patch > so that none of my favourite platforms are non-floating-stack-using. > Seems to work fine. I've applied the patch and will try to test Alpha later. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Mon Jul 23 11:13:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 23 Jul 2001 11:13:00 -0000 Subject: CPPFLAGS in math/Makefile References: Message-ID: Andreas Schwab writes: > This patch makes sure that the -D/-U options come out in the right order. > Otherwise -U__LIBC_INTERNAL_MATH_INLINES occurs before > -D__LIBC_INTERNAL_MATH_INLINES, and the latter wins. This happened to > work with older versions of gcc where -U always wins regardless of its > position on the command line. Thanks, I've applied the patch. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Mon Jul 23 11:14:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 23 Jul 2001 11:14:00 -0000 Subject: [PATCH] Make sunrpc more lazy binding (or prelinking) friendly References: <20010723133236.Y821@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > sunrpc puts abort into its xp_ops. This results in 6 more > non-relative relocations than necessary (and usually 6 conflicts > with prelinking, since it is pretty common that main binary calls > abort() somewhere and thus has a PLT entry for abort which those > function pointers in sunrpc need to resolve to). Makes sense. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Mon Jul 23 18:41:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 23 Jul 2001 18:41:00 -0000 Subject: Locking in flush(0) and other flushall ops References: <20010723192011.C629@sunsite.ms.mff.cuni.cz> Message-ID: Take a look at the changes I checked in. They should do the right thing while not putting any restrictions on the user. Remember, all mutexes involved in libio are recursive. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From kkojima@rr.iij4u.or.jp Wed Jul 25 17:59:00 2001 From: kkojima@rr.iij4u.or.jp (kaz Kojima) Date: Wed, 25 Jul 2001 17:59:00 -0000 Subject: A few SH specific patches Message-ID: <200107260059.JAA07009@rr.iij4u.or.jp> Hi, There are a few patches for SH which were done in the other architectures already. kaz -- 2001-07-26 kaz Kojima * sysdeps/sh/dl-machine.h (elf_machine_load_address): Don't use multi-line strings. (FUN_ADDR, FGR_SAVE, ELF_MACHINE_RUNTIME_TRAMPOLINE): Likewise. (elf_machine_rela): Handle unaligned relocation. * linuxthreads/sysdeps/sh/pt-machine.h (THREAD_SELF, INIT_THREAD_SELF): Defined. Index: sysdeps/sh/dl-machine.h =================================================================== RCS file: /cvs/glibc/libc/sysdeps/sh/dl-machine.h,v retrieving revision 1.8 diff -u -r1.8 dl-machine.h --- dl-machine.h 2001/07/06 04:56:03 1.8 +++ dl-machine.h 2001/07/22 00:31:14 @@ -53,15 +53,15 @@ elf_machine_load_address (void) { Elf32_Addr addr; - asm ("mov.l .L1,r0 - mov.l .L3,r2 - add r12,r2 - mov.l @(r0,r12),r0 - bra .L2 - sub r0,r2 - .align 2 - .L1: .long _dl_start@GOT - .L3: .long _dl_start@GOTOFF + asm ("mov.l .L1,r0\n\ + mov.l .L3,r2\n\ + add r12,r2\n\ + mov.l @(r0,r12),r0\n\ + bra .L2\n\ + sub r0,r2\n\ + .align 2\n\ + .L1: .long _dl_start@GOT\n\ + .L3: .long _dl_start@GOTOFF\n\ .L2: mov r2,%0" : "=r" (addr) : : "r0", "r1", "r2"); return addr; @@ -114,13 +114,13 @@ #ifdef SHARED #define FUN_ADDR "\ - mov.l 1f,r2 - mova 1f,r0 - bra 2f - add r0,r2 ! Get GOT address in r2 -0: .align 2 -1: .long _GLOBAL_OFFSET_TABLE_ -2: mov.l 3f,r0 + mov.l 1f,r2\n\ + mova 1f,r0\n\ + bra 2f\n\ + add r0,r2 ! Get GOT address in r2\n\ +0: .align 2\n\ +1: .long _GLOBAL_OFFSET_TABLE_\n\ +2: mov.l 3f,r0\n\ add r2,r0" #define GOTJMP(x) #x "@GOTOFF" #else @@ -131,27 +131,27 @@ #ifdef HAVE_FPU #define FGR_SAVE "\ - sts.l fpscr, @-r15 - mov #8,r3 - swap.w r3, r3 - lds r3, fpscr - fmov.s fr11, @-r15 - fmov.s fr10, @-r15 - fmov.s fr9, @-r15 - fmov.s fr8, @-r15 - fmov.s fr7, @-r15 - fmov.s fr6, @-r15 - fmov.s fr5, @-r15 + sts.l fpscr, @-r15\n\ + mov #8,r3\n\ + swap.w r3, r3\n\ + lds r3, fpscr\n\ + fmov.s fr11, @-r15\n\ + fmov.s fr10, @-r15\n\ + fmov.s fr9, @-r15\n\ + fmov.s fr8, @-r15\n\ + fmov.s fr7, @-r15\n\ + fmov.s fr6, @-r15\n\ + fmov.s fr5, @-r15\n\ fmov.s fr4, @-r15" #define FGR_LOAD "\ - fmov.s @r15+, fr4 - fmov.s @r15+, fr5 - fmov.s @r15+, fr6 - fmov.s @r15+, fr7 - fmov.s @r15+, fr8 - fmov.s @r15+, fr9 - fmov.s @r15+, fr10 - fmov.s @r15+, fr11 + fmov.s @r15+, fr4\n\ + fmov.s @r15+, fr5\n\ + fmov.s @r15+, fr6\n\ + fmov.s @r15+, fr7\n\ + fmov.s @r15+, fr8\n\ + fmov.s @r15+, fr9\n\ + fmov.s @r15+, fr10\n\ + fmov.s @r15+, fr11\n\ lds.l @r15+, fpscr" #else #define FGR_SAVE "" @@ -160,140 +160,140 @@ #ifndef PROF # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ - .text - .globl _dl_runtime_resolve - .type _dl_runtime_resolve, @function - .align 5 -_dl_runtime_resolve: - mov.l r2,@-r15 - mov.l r3,@-r15 - mov.l r4,@-r15 - mov.l r5,@-r15 - mov.l r6,@-r15 - mov.l r7,@-r15 - mov.l r12,@-r15 - movt r3 ! Save T flag. - mov.l r3,@-r15 - " FGR_SAVE " - sts.l pr,@-r15 - tst r0,r0 - bt 1f - mov r0,r2 -1: - mov r0,r4 ! PLT type - mov r2,r5 ! link map address - " FUN_ADDR " - jsr @r0 ! Call resolver. - mov r1,r6 ! reloc offset - lds.l @r15+,pr ! Get register content back. - " FGR_LOAD " - mov.l @r15+,r3 - shal r3 ! Lode T flag. - mov.l @r15+,r12 - mov.l @r15+,r7 - mov.l @r15+,r6 - mov.l @r15+,r5 - mov.l @r15+,r4 - mov.l @r15+,r3 - jmp @r0 ! Jump to function address. - mov.l @r15+,r2 - .align 2 -3: - .long " GOTJMP (fixup) " - .size _dl_runtime_resolve, .-_dl_runtime_resolve - - .globl _dl_runtime_profile - .type _dl_runtime_profile, @function - .align 5 -_dl_runtime_profile: - mov.l r2,@-r15 - mov.l r3,@-r15 - mov.l r4,@-r15 - mov.l r5,@-r15 - mov.l r6,@-r15 - mov.l r7,@-r15 - mov.l r12,@-r15 - movt r3 ! Save T flag. - mov.l r3,@-r15 - " FGR_SAVE " - sts.l pr,@-r15 - tst r0,r0 - bt 1f - mov r0,r2 -1: - mov r0,r4 ! PLT type - mov r2,r5 ! link map address - sts pr,r7 ! return address - " FUN_ADDR " - jsr @r0 ! Call resolver. - mov r1,r6 ! reloc offset - lds.l @r15+,pr ! Get register content back. - " FGR_LOAD " - mov.l @r15+,r3 - shal r3 ! Lode T flag. - mov.l @r15+,r12 - mov.l @r15+,r7 - mov.l @r15+,r6 - mov.l @r15+,r5 - mov.l @r15+,r4 - mov.l @r15+,r3 - jmp @r0 ! Jump to function address. - mov.l @r15+,r2 - .align 2 -3: - .long " GOTJMP (profile_fixup) " - .size _dl_runtime_profile, .-_dl_runtime_profile - .previous + .text\n\ + .globl _dl_runtime_resolve\n\ + .type _dl_runtime_resolve, @function\n\ + .align 5\n\ +_dl_runtime_resolve:\n\ + mov.l r2,@-r15\n\ + mov.l r3,@-r15\n\ + mov.l r4,@-r15\n\ + mov.l r5,@-r15\n\ + mov.l r6,@-r15\n\ + mov.l r7,@-r15\n\ + mov.l r12,@-r15\n\ + movt r3 ! Save T flag.\n\ + mov.l r3,@-r15\n\ + " FGR_SAVE "\n\ + sts.l pr,@-r15\n\ + tst r0,r0\n\ + bt 1f\n\ + mov r0,r2\n\ +1:\n\ + mov r0,r4 ! PLT type\n\ + mov r2,r5 ! link map address\n\ + " FUN_ADDR "\n\ + jsr @r0 ! Call resolver.\n\ + mov r1,r6 ! reloc offset\n\ + lds.l @r15+,pr ! Get register content back.\n\ + " FGR_LOAD "\n\ + mov.l @r15+,r3\n\ + shal r3 ! Lode T flag.\n\ + mov.l @r15+,r12\n\ + mov.l @r15+,r7\n\ + mov.l @r15+,r6\n\ + mov.l @r15+,r5\n\ + mov.l @r15+,r4\n\ + mov.l @r15+,r3\n\ + jmp @r0 ! Jump to function address.\n\ + mov.l @r15+,r2\n\ + .align 2\n\ +3:\n\ + .long " GOTJMP (fixup) "\n\ + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ +\n\ + .globl _dl_runtime_profile\n\ + .type _dl_runtime_profile, @function\n\ + .align 5\n\ +_dl_runtime_profile:\n\ + mov.l r2,@-r15\n\ + mov.l r3,@-r15\n\ + mov.l r4,@-r15\n\ + mov.l r5,@-r15\n\ + mov.l r6,@-r15\n\ + mov.l r7,@-r15\n\ + mov.l r12,@-r15\n\ + movt r3 ! Save T flag.\n\ + mov.l r3,@-r15\n\ + " FGR_SAVE "\n\ + sts.l pr,@-r15\n\ + tst r0,r0\n\ + bt 1f\n\ + mov r0,r2\n\ +1:\n\ + mov r0,r4 ! PLT type\n\ + mov r2,r5 ! link map address\n\ + sts pr,r7 ! return address\n\ + " FUN_ADDR "\n\ + jsr @r0 ! Call resolver.\n\ + mov r1,r6 ! reloc offset\n\ + lds.l @r15+,pr ! Get register content back.\n\ + " FGR_LOAD "\n\ + mov.l @r15+,r3\n\ + shal r3 ! Lode T flag.\n\ + mov.l @r15+,r12\n\ + mov.l @r15+,r7\n\ + mov.l @r15+,r6\n\ + mov.l @r15+,r5\n\ + mov.l @r15+,r4\n\ + mov.l @r15+,r3\n\ + jmp @r0 ! Jump to function address.\n\ + mov.l @r15+,r2\n\ + .align 2\n\ +3:\n\ + .long " GOTJMP (profile_fixup) "\n\ + .size _dl_runtime_profile, .-_dl_runtime_profile\n\ + .previous\n\ "); #else # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\ - .text - .globl _dl_runtime_resolve - .globl _dl_runtime_profile - .type _dl_runtime_resolve, @function - .type _dl_runtime_profile, @function - .align 5 -_dl_runtime_resolve: -_dl_runtime_profile: - mov.l r2,@-r15 - mov.l r3,@-r15 - mov.l r4,@-r15 - mov.l r5,@-r15 - mov.l r6,@-r15 - mov.l r7,@-r15 - mov.l r12,@-r15 - movt r3 ! Save T flag. - mov.l r3,@-r15 - " FGR_SAVE " - sts.l pr,@-r15 - tst r0,r0 - bt 1f - mov r0,r2 -1: - mov r0,r4 ! PLT type - mov r2,r5 ! link map address - sts pr,r7 ! return address - " FUN_ADDR " - jsr @r0 ! Call resolver. - mov r1,r6 ! reloc offset - lds.l @r15+,pr ! Get register content back. - " FGR_LOAD " - mov.l @r15+,r3 - shal r3 ! Lode T flag. - mov.l @r15+,r12 - mov.l @r15+,r7 - mov.l @r15+,r6 - mov.l @r15+,r5 - mov.l @r15+,r4 - mov.l @r15+,r3 - jmp @r0 ! Jump to function address. - mov.l @r15+,r2 - .align 2 -3: - .long " GOTJMP (fixup) " - .size _dl_runtime_resolve, .-_dl_runtime_resolve - .size _dl_runtime_profile, .-_dl_runtime_profile - .previous + .text\n\ + .globl _dl_runtime_resolve\n\ + .globl _dl_runtime_profile\n\ + .type _dl_runtime_resolve, @function\n\ + .type _dl_runtime_profile, @function\n\ + .align 5\n\ +_dl_runtime_resolve:\n\ +_dl_runtime_profile:\n\ + mov.l r2,@-r15\n\ + mov.l r3,@-r15\n\ + mov.l r4,@-r15\n\ + mov.l r5,@-r15\n\ + mov.l r6,@-r15\n\ + mov.l r7,@-r15\n\ + mov.l r12,@-r15\n\ + movt r3 ! Save T flag.\n\ + mov.l r3,@-r15\n\ + " FGR_SAVE "\n\ + sts.l pr,@-r15\n\ + tst r0,r0\n\ + bt 1f\n\ + mov r0,r2\n\ +1:\n\ + mov r0,r4 ! PLT type\n\ + mov r2,r5 ! link map address\n\ + sts pr,r7 ! return address\n\ + " FUN_ADDR "\n\ + jsr @r0 ! Call resolver.\n\ + mov r1,r6 ! reloc offset\n\ + lds.l @r15+,pr ! Get register content back.\n\ + " FGR_LOAD "\n\ + mov.l @r15+,r3\n\ + shal r3 ! Lode T flag.\n\ + mov.l @r15+,r12\n\ + mov.l @r15+,r7\n\ + mov.l @r15+,r6\n\ + mov.l @r15+,r5\n\ + mov.l @r15+,r4\n\ + mov.l @r15+,r3\n\ + jmp @r0 ! Jump to function address.\n\ + mov.l @r15+,r2\n\ + .align 2\n\ +3:\n\ + .long " GOTJMP (fixup) "\n\ + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\ + .size _dl_runtime_profile, .-_dl_runtime_profile\n\ + .previous\n\ "); #endif @@ -446,6 +446,29 @@ const Elf32_Sym *sym, const struct r_found_version *version, Elf32_Addr *const reloc_addr) { + Elf32_Addr value; + +#define COPY_UNALIGNED_WORD(sw, tw, align) \ + { \ + void *__s = &(sw), *__t = &(tw); \ + switch ((align)) \ + { \ + case 0: \ + *(unsigned long *) __t = *(unsigned long *) __s; \ + break; \ + case 2: \ + *((unsigned short *) __t)++ = *((unsigned short *) __s)++; \ + *((unsigned short *) __t) = *((unsigned short *) __s); \ + break; \ + default: \ + *((unsigned char *) __t)++ = *((unsigned char *) __s)++; \ + *((unsigned char *) __t)++ = *((unsigned char *) __s)++; \ + *((unsigned char *) __t)++ = *((unsigned char *) __s)++; \ + *((unsigned char *) __t) = *((unsigned char *) __s); \ + break; \ + } \ + } + if (ELF32_R_TYPE (reloc->r_info) == R_SH_RELATIVE) { #ifndef RTLD_BOOTSTRAP @@ -453,15 +476,20 @@ #endif { if (reloc->r_addend) - *reloc_addr = map->l_addr + reloc->r_addend; + value = map->l_addr + reloc->r_addend; else - *reloc_addr += map->l_addr; + { + COPY_UNALIGNED_WORD (*reloc_addr, value, (int) reloc_addr & 3); + value += map->l_addr; + } + COPY_UNALIGNED_WORD (value, *reloc_addr, (int) reloc_addr & 3); } } else if (ELF32_R_TYPE (reloc->r_info) != R_SH_NONE) { const Elf32_Sym *const refsym = sym; - Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info)); + + value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info)); if (sym) value += sym->st_value; value += reloc->r_addend; @@ -489,6 +517,7 @@ break; case R_SH_GLOB_DAT: case R_SH_JMP_SLOT: + /* These addresses are always aligned. */ *reloc_addr = value; break; case R_SH_DIR32: @@ -509,17 +538,20 @@ used while loading those libraries. */ value -= map->l_addr + refsym->st_value + reloc->r_addend; #endif - *reloc_addr = value; + COPY_UNALIGNED_WORD (value, *reloc_addr, (int) reloc_addr & 3); break; } case R_SH_REL32: - *reloc_addr = (value - (Elf32_Addr) reloc_addr); + value = (value - (Elf32_Addr) reloc_addr); + COPY_UNALIGNED_WORD (value, *reloc_addr, (int) reloc_addr & 3); break; default: _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 0); break; } } + +#undef COPY_UNALIGNED_WORD } static inline void Index: linuxthreads/sysdeps/sh/pt-machine.h =================================================================== RCS file: /cvs/glibc/libc/linuxthreads/sysdeps/sh/pt-machine.h,v retrieving revision 1.4 diff -u -r1.4 pt-machine.h --- pt-machine.h 2001/04/11 02:57:01 1.4 +++ pt-machine.h 2001/07/22 00:30:19 @@ -44,3 +44,13 @@ of the stack, just something somewhere in the current frame. */ #define CURRENT_STACK_FRAME stack_pointer register char * stack_pointer __asm__ ("r15"); + +/* Return the thread descriptor for the current thread. */ +struct _pthread_descr_struct; +#define THREAD_SELF \ + ({ struct _pthread_descr_struct *self; \ + __asm__("stc gbr,%0" : "=r" (self)); self;}) + +/* Initialize the thread-unique value. */ +#define INIT_THREAD_SELF(descr, nr) \ + ({ __asm__("ldc %0,gbr" : : "r" (descr));}) From drepper@redhat.com Wed Jul 25 18:33:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 25 Jul 2001 18:33:00 -0000 Subject: A few SH specific patches References: <200107260059.JAA07009@rr.iij4u.or.jp> Message-ID: kaz Kojima writes: > There are a few patches for SH which were done in the other > architectures already. Thanks, I've applied the patch. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Wed Jul 25 19:03:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 25 Jul 2001 19:03:00 -0000 Subject: toward 2.2.4 Message-ID: I've compiled x86, alpha yesterday, IA-64 today. IA-64 has a problem with makecontext etc (David will hopefully look at it), alpha had no problems. Beside some thread issues which I hope are kernel problems, and Jakub's comments about the fflush() patches (which I hope are also unfounded) I don't know about any open issues. So, please tell me about the status of the other ports and whatever you think has to be done. I'd like to make 2.2.4-pre1 Friday or so. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Wed Jul 25 23:32:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Wed, 25 Jul 2001 23:32:00 -0000 Subject: toward 2.2.4 References: Message-ID: Ulrich Drepper writes: > I've compiled x86, alpha yesterday, IA-64 today. IA-64 has a problem > with makecontext etc (David will hopefully look at it), alpha had no > problems. Beside some thread issues which I hope are kernel problems, > and Jakub's comments about the fflush() patches (which I hope are also > unfounded) I don't know about any open issues. > > So, please tell me about the status of the other ports and whatever > you think has to be done. I'd like to make 2.2.4-pre1 Friday or so. I tested last week's version on PowerPC, S390, SPARC and Alpha and encountered no new problems besides the PowerPC problem that I've fixed already. Go ahead, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Fri Jul 27 01:31:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Fri, 27 Jul 2001 01:31:00 -0000 Subject: last minute changes Message-ID: I've checked in some changes to fix a problems caused by the iconv cache code when using the wchar_t functions. While doing this I found and fixed a few other problems (fopen (.., "ccs=..." now actually works) and memory leaks, and while doing that I fixed a problem in mcheck and improved mtrace (significantly!). While I get some ZZZs please give it a try so that it's not a complete disaster if I make a release tomorrow (it builds and tests fine for me on x86). -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Mon Jul 30 00:00:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Mon, 30 Jul 2001 00:00:00 -0000 Subject: Fix warnings in posix/regex.c Message-ID: regex.c is used by other projects and compiled there without MBS_SUPPORT and sometimes even with K&R compilers. The following patch removes warnings that the wcs* functions are declared static but not defined and remove one #elif. Ok to commit? 2001-07-30 Andreas Jaeger * posix/regex.c: Declare wcs functions only if compiling with MBS_SUPPORT. Don't use #elif for traditional C. ============================================================ Index: posix/regex.c --- posix/regex.c 2001/07/23 07:05:37 1.105 +++ posix/regex.c 2001/07/30 06:50:50 @@ -406,9 +406,6 @@ typedef char boolean; static reg_errcode_t byte_regex_compile _RE_ARGS ((const char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp)); -static reg_errcode_t wcs_regex_compile _RE_ARGS ((const char *pattern, size_t size, - reg_syntax_t syntax, - struct re_pattern_buffer *bufp)); static int byte_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp, const char *string1, int size1, @@ -416,6 +413,19 @@ static int byte_re_match_2_internal PARA int pos, struct re_registers *regs, int stop)); +static int byte_re_search_2 PARAMS ((struct re_pattern_buffer *bufp, + const char *string1, int size1, + const char *string2, int size2, + int startpos, int range, + struct re_registers *regs, int stop)); +static int byte_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp)); + +#ifdef MBS_SUPPORT +static reg_errcode_t wcs_regex_compile _RE_ARGS ((const char *pattern, size_t size, + reg_syntax_t syntax, + struct re_pattern_buffer *bufp)); + + static int wcs_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp, const char *cstring1, int csize1, const char *cstring2, int csize2, @@ -425,19 +435,13 @@ static int wcs_re_match_2_internal PARAM wchar_t *string1, int size1, wchar_t *string2, int size2, int *mbs_offset1, int *mbs_offset2)); -static int byte_re_search_2 PARAMS ((struct re_pattern_buffer *bufp, - const char *string1, int size1, - const char *string2, int size2, - int startpos, int range, - struct re_registers *regs, int stop)); static int wcs_re_search_2 PARAMS ((struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int startpos, int range, struct re_registers *regs, int stop)); -static int byte_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp)); static int wcs_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp)); - +#endif /* These are the command codes that appear in compiled regular expressions. Some opcodes are followed by argument bytes. A @@ -607,29 +611,31 @@ typedef enum # define PREFIX(name) byte_##name # define ARG_PREFIX(name) name # define PUT_CHAR(c) putchar (c) -#elif defined WCHAR -# define CHAR_T wchar_t -# define UCHAR_T wchar_t -# define COMPILED_BUFFER_VAR wc_buffer -# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */ -# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1) -# define PREFIX(name) wcs_##name -# define ARG_PREFIX(name) c##name -/* Should we use wide stream?? */ -# define PUT_CHAR(c) printf ("%C", c); -# define TRUE 1 -# define FALSE 0 #else -# ifdef MBS_SUPPORT -# define WCHAR +# ifdef WCHAR +# define CHAR_T wchar_t +# define UCHAR_T wchar_t +# define COMPILED_BUFFER_VAR wc_buffer +# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */ +# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1) +# define PREFIX(name) wcs_##name +# define ARG_PREFIX(name) c##name +/* Should we use wide stream?? */ +# define PUT_CHAR(c) printf ("%C", c); +# define TRUE 1 +# define FALSE 0 +# else +# ifdef MBS_SUPPORT +# define WCHAR +# define INSIDE_RECURSION +# include "regex.c" +# undef INSIDE_RECURSION +# endif +# define BYTE # define INSIDE_RECURSION # include "regex.c" # undef INSIDE_RECURSION # endif -# define BYTE -# define INSIDE_RECURSION -# include "regex.c" -# undef INSIDE_RECURSION #endif #ifdef INSIDE_RECURSION -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Mon Jul 30 00:43:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 30 Jul 2001 00:43:00 -0000 Subject: Fix warnings in posix/regex.c References: Message-ID: Andreas Jaeger writes: > Ok to commit? Yes. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Tue Jul 31 07:53:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 31 Jul 2001 07:53:00 -0000 Subject: RFC: Caching of lookup results during startup Message-ID: To improve the start up time of the dynamic linker, I followed an idea the BSD folks implemented (my view is i386 centric but everything can be generalized): Large applications, especially C++ ones, have a number of PC32 relocations against symbols. The lookup of these symbols is quite expensive. I'm caching these lookups during the initial relocation of an object (in dl-relocate) now and have decreased the relocation time by 45 % in one large application (konqueror). For comparison, here's the normal linker: gee:/builds/glibc/cross:[254]$ LD_DEBUG=statistics elf/ld-linux.so.2 --library-path :math:linuxthreads:login:/usr/lib:/lib /opt/kde2/bin/konqueror -/ 16634: 16634: runtime linker statistics: 16634: total startup time in dynamic loader: 699430072 clock cycles 16634: time needed for relocation: 694116497 clock cycles (99.2) 16634: number of relocations: 54130 16634: time needed to load objects: 4958742 clock cycles (.7) konqueror: Unknown option '-/'. konqueror: Use --help to get a list of available command line options. And this is my version, note that number of relocations from cache is a subset of the other relocations): gee:/builds/glibc/main-gcc-2.95:[254]$ LD_DEBUG=statistics elf/ld-linux.so.2 --library-path :math:linuxthreads:login:/usr/lib:/lib /opt/kde2/bin/konqueror -/ 22277: 22277: runtime linker statistics: 22277: total startup time in dynamic loader: 392157353 clock cycles 22277: time needed for relocation: 386720405 clock cycles (98.6) 22277: number of relocations: 54130 22277: number of relocations from cache: 33770 22277: time needed to load objects: 5044967 clock cycles (1.2) konqueror: Unknown option '-/'. konqueror: Use --help to get a list of available command line options. For smaller applications the cache overhead is too expensive and the application startup time is unfortunatly increased (here 7 %): Normal: gee:/builds/glibc/cross:[0]$ LD_DEBUG=statistics elf/ld-linux.so.2 --library-path :math:linuxthreads:login:/usr/lib:/lib /bin/ls / 22298: 22298: runtime linker statistics: 22298: total startup time in dynamic loader: 1280514 clock cycles 22298: time needed for relocation: 892054 clock cycles (69.6) 22298: number of relocations: 362 22298: time needed to load objects: 245332 clock cycles (19.1) With cache: gee:/builds/glibc/main-gcc-2.95:[0]$ LD_DEBUG=statistics elf/ld-linux.so.2 --library-path :math:linuxthreads:login:/usr/lib:/lib /bin/ls / 22299: 22299: runtime linker statistics: 22299: total startup time in dynamic loader: 1399818 clock cycles 22299: time needed for relocation: 960693 clock cycles (68.6) 22299: number of relocations: 362 22299: number of relocations from cache: 100 22299: time needed to load objects: 232376 clock cycles (16.6) I'm appending a first version as proof of concept to get your comments. I do have the following open questions/things to do: - Provide patches for platforms beside i386 - _dl_symcache and _dl_maxchain should be passed as parameters to _dl_lookup_symbol/_dl_lookup_versioned_symbol instead of making them global. - The code needs reindentation. - Do I need the version number in the cache? I don't think so (and it works without) but I'm not sure whether I'm missing something. - Any other ideas to improve this? - Is this a post 2.2.4 project? I do think so. How shall I continue with this? Btw. I do get at the moment segvs in dlfcn/errmsg1 and elf/loadfail that I need to investigate, any help/hints would be appreciated. This work was influenced by Waldo's paper (discussed on libc-alpha) and I got already some good advice from Andreas Schwab. Andreas 2001-07-31 Andreas Jaeger * sysdeps/i386/dl-machine.h (elf_machine_rel): Pass r_info to RESOLVE. * sysdeps/generic/ldsodefs.h (Elf_r_info): New. Adjust declarations of _dl_lookup_symbol and _dl_lookup_versioned_symbol. * elf/rtld.c (print_statistics): Print cache relocations. * elf/dl-reloc.c (_dl_relocate_object): Set up cache. * elf/dl-lookup.c: New variable _dl_num_cache_relocations. (_dl_setup_hash): Set l_nchain. (_dl_lookup_symbol): Change parameter to use r_info. Use symbol cache. (_dl_lookup_versioned_symbol_skip): Likewise. ============================================================ Index: elf/dl-lookup.c --- elf/dl-lookup.c 2001/07/06 04:54:46 1.78 +++ elf/dl-lookup.c 2001/07/31 14:18:46 @@ -60,6 +60,7 @@ struct sym_val /* Statistics function. */ unsigned long int _dl_num_relocations; +unsigned long int _dl_num_cache_relocations; /* During the program run we must not modify the global data of loaded shared object simultanously in two threads. Therefore we @@ -80,6 +81,8 @@ __libc_lock_define (extern, _dl_load_loc #define VERSIONED 1 #include "do-lookup.h" +extern struct symcache *_dl_symcache; +extern int _dl_maxchain; /* Add extra dependency on MAP to UNDEF_MAP. */ static int @@ -200,18 +203,30 @@ lookup_t internal_function _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map, const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[], - int reloc_type, int explicit) + Elf_r_info r_info, int explicit) { const char *reference_name = undef_map ? undef_map->l_name : NULL; const unsigned long int hash = _dl_elf_hash (undef_name); struct sym_val current_value = { NULL, NULL }; struct r_scope_elem **scope; int protected; + int reloc_type = ELFW(R_TYPE) (r_info); int noexec = elf_machine_lookup_noexec_p (reloc_type); int noplt = elf_machine_lookup_noplt_p (reloc_type); + int symbol_num = ELFW(R_SYM) (r_info); ++_dl_num_relocations; + assert (symbol_num < _dl_maxchain); + if (_dl_symcache != NULL && _dl_symcache[symbol_num].symbol != NULL) + { + current_value.s = _dl_symcache[symbol_num].symbol; + current_value.m = _dl_symcache[symbol_num].object; + ++_dl_num_cache_relocations; + } + else + { + /* Search the relevant loaded objects for a definition. */ for (scope = symbol_scope; *scope; ++scope) if (do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, NULL, @@ -233,7 +248,7 @@ _dl_lookup_symbol (const char *undef_nam /* Something went wrong. Perhaps the object we tried to reference was just removed. Try finding another definition. */ return _dl_lookup_symbol (undef_name, undef_map, ref, symbol_scope, - reloc_type, 0); + r_info, 0); break; } @@ -250,7 +265,8 @@ _dl_lookup_symbol (const char *undef_nam *ref = NULL; return 0; } - + } + protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED; if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0)) @@ -261,6 +277,13 @@ _dl_lookup_symbol (const char *undef_nam ? current_value.m->l_name : _dl_argv[0], protected ? "protected" : "normal", undef_name); + + if (_dl_symcache != NULL && _dl_symcache[symbol_num].symbol == NULL) + { + _dl_symcache[symbol_num].symbol = current_value.s; + _dl_symcache[symbol_num].object = current_value.m; + } + if (__builtin_expect (protected == 0, 1)) { *ref = current_value.s; @@ -378,18 +401,30 @@ _dl_lookup_versioned_symbol (const char struct link_map *undef_map, const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[], const struct r_found_version *version, - int reloc_type, int explicit) + Elf_r_info r_info, int explicit) { const char *reference_name = undef_map ? undef_map->l_name : NULL; const unsigned long int hash = _dl_elf_hash (undef_name); struct sym_val current_value = { NULL, NULL }; struct r_scope_elem **scope; int protected; + int reloc_type = ELFW(R_TYPE) (r_info); int noexec = elf_machine_lookup_noexec_p (reloc_type); int noplt = elf_machine_lookup_noplt_p (reloc_type); + int symbol_num = ELFW(R_SYM) (r_info); ++_dl_num_relocations; + assert (symbol_num < _dl_maxchain); + if (_dl_symcache != NULL && _dl_symcache[symbol_num].symbol != NULL) + { + current_value.s = _dl_symcache[symbol_num].symbol; + current_value.m = _dl_symcache[symbol_num].object; + ++_dl_num_cache_relocations; + } + else + + { /* Search the relevant loaded objects for a definition. */ for (scope = symbol_scope; *scope; ++scope) { @@ -414,7 +449,7 @@ _dl_lookup_versioned_symbol (const char was just removed. Try finding another definition. */ return _dl_lookup_versioned_symbol (undef_name, undef_map, ref, symbol_scope, version, - reloc_type, 0); + r_info, 0); break; } @@ -438,6 +473,8 @@ _dl_lookup_versioned_symbol (const char return 0; } } + } + if (__builtin_expect (current_value.s == NULL, 0)) { @@ -464,6 +501,12 @@ _dl_lookup_versioned_symbol (const char protected ? "protected" : "normal", undef_name, version->name); + if (_dl_symcache != NULL && _dl_symcache[symbol_num].symbol == NULL) + { + _dl_symcache[symbol_num].symbol = current_value.s; + _dl_symcache[symbol_num].object = current_value.m; + } + if (__builtin_expect (protected == 0, 1)) { *ref = current_value.s; @@ -591,14 +634,13 @@ internal_function _dl_setup_hash (struct link_map *map) { Elf_Symndx *hash; - Elf_Symndx nchain; if (!map->l_info[DT_HASH]) return; hash = (void *)(map->l_addr + map->l_info[DT_HASH]->d_un.d_ptr); map->l_nbuckets = *hash++; - nchain = *hash++; + map->l_nchain = *hash++; map->l_buckets = hash; hash += map->l_nbuckets; map->l_chain = hash; @@ -614,7 +656,7 @@ _dl_do_lookup (const char *undef_name, u struct link_map *skip, int noexec, int noplt) { return do_lookup (undef_name, hash, ref, result, scope, i, skip, noexec, - noplt); + noplt); } static int ============================================================ Index: elf/dl-reloc.c --- elf/dl-reloc.c 2001/07/06 04:54:46 1.54 +++ elf/dl-reloc.c 2001/07/31 14:18:46 @@ -27,6 +27,9 @@ #include "dynamic-link.h" +struct symcache *_dl_symcache; +int _dl_maxchain; + void _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], int lazy, int consider_profiling) @@ -64,12 +67,15 @@ cannot make segment writable for relocat } } + _dl_symcache = alloca ((l->l_nchain+1) * sizeof (struct symcache)); + memset (_dl_symcache, 0, (l->l_nchain+1) * sizeof (struct symcache)); + _dl_maxchain = l->l_nchain; { /* Do the actual relocation of the object's GOT and other data. */ /* String table object symbols. */ const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]); - + /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */ #define RESOLVE_MAP(ref, version, flags) \ (ELFW(ST_BIND) ((*ref)->st_info) != STB_LOCAL \ @@ -91,6 +97,8 @@ cannot make segment writable for relocat #include "dynamic-link.h" ELF_DYNAMIC_RELOCATE (l, lazy, consider_profiling); + _dl_symcache = NULL; + if (__builtin_expect (_dl_profile != NULL, 0)) { /* Allocate the array which will contain the already found ============================================================ Index: elf/rtld.c --- elf/rtld.c 2001/07/26 00:25:54 1.200 +++ elf/rtld.c 2001/07/31 14:18:46 @@ -127,6 +127,7 @@ static hp_timing_t relocate_time; static hp_timing_t load_time; #endif extern unsigned long int _dl_num_relocations; /* in dl-lookup.c */ +extern unsigned long int _dl_num_cache_relocations; /* in dl-lookup.c */ static ElfW(Addr) _dl_start_final (void *arg, struct link_map *bootstrap_map_p, hp_timing_t start_time); @@ -1522,6 +1523,8 @@ print_statistics (void) #endif _dl_debug_printf (" number of relocations: %lu\n", _dl_num_relocations); + _dl_debug_printf (" number of relocations from cache: %lu\n", + _dl_num_cache_relocations); #ifndef HP_TIMING_NONAVAIL /* Time spend while loading the object and the dependencies. */ ============================================================ Index: include/link.h --- include/link.h 2001/07/26 00:24:13 1.13 +++ include/link.h 2001/07/31 14:18:47 @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2001 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 @@ -158,7 +158,7 @@ struct link_map struct link_map *l_loader; /* Symbol hash table. */ - Elf_Symndx l_nbuckets; + Elf_Symndx l_nbuckets, l_nchain; const Elf_Symndx *l_buckets, *l_chain; unsigned int l_opencount; /* Reference count for dlopen/dlclose. */ ============================================================ Index: sysdeps/generic/ldsodefs.h --- sysdeps/generic/ldsodefs.h 2001/07/06 04:55:49 1.27 +++ sysdeps/generic/ldsodefs.h 2001/07/31 14:18:47 @@ -38,6 +38,14 @@ __BEGIN_DECLS `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ #define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type) +#if __ELF_NATIVE_CLASS == 32 +# define Elf_r_info Elf32_Word +#elif __ELF_NATIVE_CLASS == 32 +# define Elf_r_info Elf64_Xword +#else +# error "__ELF_NATIVE_CLASS unknown." +#endif + /* All references to the value of l_info[DT_PLTGOT], l_info[DT_STRTAB], l_info[DT_SYMTAB], l_info[DT_RELA], l_info[DT_REL], l_info[DT_JMPREL], and l_info[VERSYMIDX (DT_VERSYM)] @@ -136,6 +144,14 @@ struct libname_list }; +/* Data structure to cache symbol lookups. */ +struct symcache + { + const ElfW (Sym) *symbol; /* Symbol table entry. */ + struct link_map *object; /* Object defining symbol. */ + }; + + /* Test whether given NAME matches any of the names of the given object. */ static __inline int __attribute__ ((unused)) @@ -332,7 +348,7 @@ extern lookup_t _dl_lookup_symbol (const struct link_map *undef_map, const ElfW(Sym) **sym, struct r_scope_elem *symbol_scope[], - int reloc_type, int explicit) + Elf_r_info r_info, int explicit) internal_function; /* Lookup versioned symbol. */ @@ -341,7 +357,7 @@ extern lookup_t _dl_lookup_versioned_sym const ElfW(Sym) **sym, struct r_scope_elem *symbol_scope[], const struct r_found_version *version, - int reloc_type, int explicit) + Elf_r_info r_info, int explicit) internal_function; /* For handling RTLD_NEXT we must be able to skip shared objects. */ ============================================================ Index: sysdeps/i386/dl-machine.h --- sysdeps/i386/dl-machine.h 2001/07/06 04:55:52 1.84 +++ sysdeps/i386/dl-machine.h 2001/07/31 14:18:47 @@ -322,7 +322,7 @@ elf_machine_rel (struct link_map *map, c #ifndef RTLD_BOOTSTRAP const Elf32_Sym *const refsym = sym; #endif - Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info)); + Elf32_Addr value = RESOLVE (&sym, version, reloc->r_info); if (sym) value += sym->st_value; -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Tue Jul 31 10:57:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 31 Jul 2001 10:57:00 -0000 Subject: RFC: Caching of lookup results during startup References: Message-ID: Andreas Jaeger writes: > To improve the start up time of the dynamic linker, I followed an idea > the BSD folks implemented (my view is i386 centric but everything can > be generalized): [...] While this can certainly help a bit it is by far not enough. Jakub's patch includes a cache as well but more importantly he also has linker patches to generate appropriately optimized binaries. It is necessary to combine and sort the relocation sections. Only then can the cache be really effective. So, instead of dealing with this patch only to later rework it I'm waiting for the linker changes to materialize and then add an appropriate patch. Jakub AFAIK has one but he's on vacation this week. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------