diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-03-05 19:39:34 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-03-05 19:39:34 +0000 |
commit | f9a421a6b2e3ba46cc615e128091e5eacabb1dac (patch) | |
tree | 964b2c72623777783109da9c66eb3805606cd0ce | |
parent | da46ece214ac285902c4a95ca3fb2ce1bf51c47e (diff) |
Merge changes between r12752 and r13053 from /fsf/trunk.
Regenerate configure scripts as part of merge.
git-svn-id: svn://svn.eglibc.org/trunk@13054 7b3dc134-2b1b-0410-93df-9e9f96275f8d
73 files changed, 1744 insertions, 789 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog index 6b6e6ac20..c6d652d55 100644 --- a/libc/ChangeLog +++ b/libc/ChangeLog @@ -1,3 +1,175 @@ +2011-03-04 Ulrich Drepper <drepper@gmail.com> + + * libio/fmemopen.c (fmemopen): Optimize a bit. + +2011-03-03 Andreas Schwab <schwab@redhat.com> + + * libio/fmemopen.c (fmemopen): Don't read past end of buffer. + +2011-03-03 Roland McGrath <roland@redhat.com> + + * setjmp/bits/setjmp2.h: Canonicalize comment formatting. + +2011-02-28 Aurelien Jarno <aurelien@aurel32.net> + + * sysdeps/sparc/sparc64/multiarch/memset.S(__bzero): call + __bzero_ultra1 instead of __memset_ultra1. + +2011-02-23 Andreas Schwab <schwab@redhat.com> + Ulrich Drepper <drepper@gmail.com> + + [BZ #12509] + * include/link.h (struct link_map): Add l_orig_initfini. + * elf/dl-load.c (_dl_map_object_from_fd): Free realname before + returning unsuccessfully. + * elf/dl-close.c (_dl_close_worker): If this is the last explicit + close of a file loaded at startup, restore the original l_initfini + list. + * elf/dl-deps.c (_dl_map_object_deps): Don't free old l_initfini + list, store the pointer. + * elf/Makefile ($(objpfx)noload-mem): New rule. + (noload-ENV): Define. + (tests): Add $(objpfx)noload-mem. + * elf/noload.c: Include <memcheck.h>. + (main): Call mtrace. Close all opened handles. + +2011-02-17 Andreas Schwab <schwab@redhat.com> + + [BZ #12454] + * elf/dl-deps.c (_dl_map_object_deps): Signal error early when + dependencies are missing. + +2011-02-22 Samuel Thibault <samuel.thibault@ens-lyon.org> + + Fix __if_freereq crash: Unlike the generic version which uses free, + Hurd needs munmap. + * sysdeps/mach/hurd/ifreq.h: New file. + +2011-01-27 Petr Baudis <pasky@suse.cz> + Ulrich Drepper <drepper@gmail.com> + + [BZ 12445]# + * stdio-common/vfprintf.c (vfprintf): Pass correct newlen + to extend_alloca(). + * stdio-common/bug23.c: New file. + * stdio-common/Makefile (tests): Add bug23. + +2010-09-28 Andreas Schwab <schwab@redhat.com> + Ulrich Drepper <drepper@gmail.com> + + [BZ #12489] + * elf/rtld.c (dl_main): Move setting of GLRO(dl_init_all_dirs) + before performing relro protection. At old place add assertion + to make sure nothing changed. + +2011-02-17 Nathan Sidwell <nathan@codesourcery.com> + Glauber de Oliveira Costa <glommer@gmail.com> + + * elf/elf.h: Add new ARM TLS relocs. + +2011-02-16 Ryan S. Arnold <rsa@us.ibm.com> + + * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: + (INTERNAL_VSYSCALL_NCS INTERNAL_SYSCALL_NCS): Remove erroneous (int) + cast from r3. + * sysdeps/wordsize-64/Makefile: New file. Add tst-writev to + 'tests' variable. + * sysdeps/wordsize-64/tst-writev.c: New file. + +2011-02-15 Ryan S. Arnold <rsa@us.ibm.com> + + * sysdeps/powerpc/powerpc64/power7/Makefile: New file which adds + -mno-vsx to the CFLAGS-rtld.c variable to avoid using VSX registers and + insns in _dl_start to prevent a TOC reference before relocs are + resolved. + +2011-02-15 Ulrich Drepper <drepper@gmail.com> + + [BZ #12469] + * Makeconfig: Remove RANLIB definition. + * Makerules: Don't use RANLIB. + * aclocal.m4: Remove ranlib test. + * configure.in: No need to check for ranlib. + * elf/rtld-Rules: Don't use RANLIB. + +2011-02-16 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * sysdeps/mach/i386/sysdep.h: Add _MACH_I386_SYSDEP_H inclusion + protection macro. + * sysdeps/mach/i386/thread_state.h: Add _MACH_I386_THREAD_STATE_H + inclusion protection macro. + + * stdio-common/psiginfo.c (psiginfo): Check pinfo->si_signo against + SIGRTMIN and SIGRTMAX and print information in that case only when + SIGRTMIN is defined. + +2011-02-11 Jakub Jelinek <jakub@redhat.com> + + * stdio-common/printf-parsemb.c (__parse_one_specmb): Handle + arginfo fn returning -1. + + * stdio-common/_i18n_number.h (_i18n_number_rewrite): Ensure decimal + and thousands string is zero terminated. + +2011-02-03 Andreas Schwab <schwab@redhat.com> + + * sysdeps/unix/sysv/linux/sparc/bits/socket.h: Sync with + sysdeps/unix/sysv/linux/bits/socket.h. + +2011-01-30 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * bits/sched.h (__CPU_ZERO, __CPU_SET, __CPU_CLR, __CPU_ISSET) + (__CPU_COUNT): Remove old macros. + (__CPU_ZERO_S, __CPU_SET_S, __CPU_CLR_S, __CPU_ISSET_S) + (__CPU_COUNT, __CPU_EQUAL_S, __CPU_OP_S, __CPU_ALLOC_SIZE) + (__CPU_ALLOC, __CPU_FREE): Add macros. + (__sched_cpualloc, __sched_cpufree): Add declarations. + +2011-02-05 Ulrich Drepper <drepper@gmail.com> + + * nscd/nscd-client.h: Define MAX_TIMEOUT_VALUE. + (struct datahead): Reuse 32 bits of the alignment for a TTL field. + * nscd/aicache.c (addhstaiX): Return timeout of added value. + (readdhstai): Return value of addhstaiX call. + * nscd/grpcache.c (cache_addgr): Return timeout of added value. + (addgrbyX): Return value returned by cache_addgr. + (readdgrbyname): Return value returned by addgrbyX. + (readdgrbygid): Likewise. + * nscd/pwdcache.c (cache_addpw): Return timeout of added value. + (addpwbyX): Return value returned by cache_addpw. + (readdpwbyname): Return value returned by addhstbyX. + (readdpwbyuid): Likewise. + * nscd/servicescache.c (cache_addserv): Return timeout of added value. + (addservbyX): Return value returned by cache_addserv. + (readdservbyname): Return value returned by addservbyX: + (readdservbyport): Likewise. + * nscd/hstcache.c (cache_addhst): Return timeout of added value. + (addhstbyX): Return value returned by cache_addhst. + (readdhstbyname): Return value returned by addhstbyX. + (readdhstbyaddr): Likewise. + (readdhstbynamev6): Likewise. + (readdhstbyaddrv6): Likewise. + * nscd/initgrcache.c (addinitgroupsX): Return timeout of added value. + (readdinitgroups): Return value returned by addinitgroupsX. + * nscd/cache.c (readdfcts): Change return value of functions to time_t. + (prune_cache): Keep track of timeout value of re-added entries. + * nscd/connections.c (nscd_run_prune): Use MAX_TIMEOUT_VALUE. + * nscd/nscd.h: Adjust prototypes of readd* functions. + +2011-02-04 Roland McGrath <roland@redhat.com> + + * nis/nis_server.c (nis_servstate): Use the right name for 0. + (nis_stats): Likewise. + * nis/nis_modify.c (nis_modify): Likewise. + * nis/nis_remove.c (nis_remove): Likewise. + * nis/nis_add.c (nis_add): Likewise. + + * elf/dl-object.c (_dl_new_object): Remove unused variable L. + + * posix/fnmatch_loop.c: Add some consts. + + * sysdeps/x86_64/multiarch/memset-x86-64.S: Add an #undef. + 2011-02-02 H.J. Lu <hongjiu.lu@intel.com> [BZ #12460] diff --git a/libc/Makeconfig b/libc/Makeconfig index c9fe1991a..ebc15cc2b 100644 --- a/libc/Makeconfig +++ b/libc/Makeconfig @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2003,2004,2005,2006,2007,2008,2009,2010 +# Copyright (C) 1991-2003,2004,2005,2006,2007,2008,2009,2010,2011 # Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -601,10 +601,6 @@ ifndef LD LD := ld -X endif -ifndef RANLIB -RANLIB = ranlib -endif - # Extra flags to pass to GCC. ifeq ($(all-warnings),yes) +gccwarn := -Wall -Wwrite-strings -Winline -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar diff --git a/libc/Makerules b/libc/Makerules index f99abf4ff..5ab4770d6 100644 --- a/libc/Makerules +++ b/libc/Makerules @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2006,2007,2008,2009,2010 Free Software Foundation, Inc. +# Copyright (C) 1991-2010, 2011 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 @@ -836,7 +836,6 @@ endef define do-makelib cd $(common-objdir) && \ $(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)` -$(RANLIB) $@ endef subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%) subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps)) @@ -858,7 +857,6 @@ define build-extra-lib $(patsubst %/,cd % &&,$(objpfx)) \ $(AR) $(CREATE_ARFLAGS) $(@:$(objpfx)%=%) \ $(patsubst $(objpfx)%,%,$^) -$(RANLIB) $@ endef # Installation. @@ -904,9 +902,6 @@ install: $(installed-libcs) $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force) $(make-target-directory) $(INSTALL_DATA) $(common-objpfx)lib$(*:$(libc-name)%=c%) $@ -# Running ranlib after installing makes the __.SYMDEF time stamp up to -# date, which avoids messages from some linkers. - $(RANLIB) $@ define do-install-program $(make-target-directory) @@ -1156,7 +1151,6 @@ ifdef install-lib.a $(install-lib.a:lib%.a=$(inst_libdir)/lib$(libprefix)%.a): \ $(inst_libdir)/lib$(libprefix)%.a: $(objpfx)lib%.a $(+force) $(do-install) - $(patsubst %,$(RANLIB) $@,$(filter-out $(non-lib.a),$(<F))) endif endif ifdef install-data @@ -1,4 +1,4 @@ -GNU C Library NEWS -- history of user-visible changes. 2011-2-2 +GNU C Library NEWS -- history of user-visible changes. 2011-2-25 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc. See the end for copying conditions. @@ -9,7 +9,7 @@ Version 2.14 * The following bugs are resolved with this release: - 11724, 12460 + 11724, 12445, 12454, 12460, 12469, 12489, 12509 Version 2.13 diff --git a/libc/aclocal.m4 b/libc/aclocal.m4 index 8fa21e992..2252f9eaa 100644 --- a/libc/aclocal.m4 +++ b/libc/aclocal.m4 @@ -57,7 +57,7 @@ else AC_MSG_CHECKING([version of [$]$1]) changequote(<<,>>)dnl ac_prog_version=`<<$>>$1 $3 2>&1 ifelse(<<$4>>,,, - <<| sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'>>)` + <<| sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'>>)` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; <<$5>>) @@ -104,17 +104,6 @@ AC_SUBST(NM) OBJDUMP=`$CC -print-prog-name=objdump` AC_SUBST(OBJDUMP) -# ranlib has to be treated a bit differently since it might not exist at all. -ac_ranlib=`$CC -print-prog-name=ranlib` -if test "x$ac_ranlib" = xranlib; then -# This extra check has to happen since gcc simply echos the parameter in -# case it cannot find the value in its own directories. -AC_CHECK_TOOL(RANLIB, ranlib, :) -else - RANLIB=$ac_ranlib -fi -AC_SUBST(RANLIB) - # Determine whether we are using GNU binutils. AC_CACHE_CHECK(whether $AS is GNU as, libc_cv_prog_as_gnu, [LIBC_PROG_FOO_GNU($AS, libc_cv_prog_as_gnu=yes, libc_cv_prog_as_gnu=no)]) diff --git a/libc/bits/sched.h b/libc/bits/sched.h index a068e5016..9a22ae392 100644 --- a/libc/bits/sched.h +++ b/libc/bits/sched.h @@ -1,6 +1,7 @@ /* Definitions of constants and data structure for POSIX 1003.1b-1993 scheduling interface. - Copyright (C) 1996, 1997, 2001, 2003, 2007 Free Software Foundation, Inc. + Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008,2009 + 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 @@ -56,7 +57,7 @@ struct __sched_param # define __CPU_SETSIZE 1024 # define __NCPUBITS (8 * sizeof (__cpu_mask)) -/* Type for array elements in 'cpu_set'. */ +/* Type for array elements in 'cpu_set_t'. */ typedef unsigned long int __cpu_mask; /* Basic access functions. */ @@ -70,27 +71,83 @@ typedef struct } cpu_set_t; /* Access functions for CPU masks. */ -# define __CPU_ZERO(cpusetp) \ +# if __GNUC_PREREQ (2, 91) +# define __CPU_ZERO_S(setsize, cpusetp) \ + do __builtin_memset (cpusetp, '\0', setsize); while (0) +# else +# define __CPU_ZERO_S(setsize, cpusetp) \ do { \ - unsigned int __i; \ - cpu_set *__arr = (cpusetp); \ - for (__i = 0; __i < sizeof (cpu_set) / sizeof (__cpu_mask); ++__i) \ - __arr->__bits[__i] = 0; \ + size_t __i; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + __cpu_mask *__bits = (cpusetp)->__bits; \ + for (__i = 0; __i < __imax; ++__i) \ + __bits[__i] = 0; \ } while (0) -# define __CPU_SET(cpu, cpusetp) \ - ((cpusetp)->__bits[__CPUELT (cpu)] |= __CPUMASK (cpu)) -# define __CPU_CLR(cpu, cpusetp) \ - ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu)) -# define __CPU_ISSET(cpu, cpusetp) \ - (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0) +# endif +# define __CPU_SET_S(cpu, setsize, cpusetp) \ + (__extension__ \ + ({ size_t __cpu = (cpu); \ + __cpu < 8 * (setsize) \ + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + |= __CPUMASK (__cpu)) \ + : 0; })) +# define __CPU_CLR_S(cpu, setsize, cpusetp) \ + (__extension__ \ + ({ size_t __cpu = (cpu); \ + __cpu < 8 * (setsize) \ + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + &= ~__CPUMASK (__cpu)) \ + : 0; })) +# define __CPU_ISSET_S(cpu, setsize, cpusetp) \ + (__extension__ \ + ({ size_t __cpu = (cpu); \ + __cpu < 8 * (setsize) \ + ? ((((__const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + & __CPUMASK (__cpu))) != 0 \ + : 0; })) + +# define __CPU_COUNT_S(setsize, cpusetp) \ + __sched_cpucount (setsize, cpusetp) + +# if __GNUC_PREREQ (2, 91) +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ + (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0) +# else +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ + (__extension__ \ + ({ __const __cpu_mask *__arr1 = (cpusetp1)->__bits; \ + __const __cpu_mask *__arr2 = (cpusetp2)->__bits; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + size_t __i; \ + for (__i = 0; __i < __imax; ++__i) \ + if (__bits[__i] != __bits[__i]) \ + break; \ + __i == __imax; })) +# endif + +# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ + (__extension__ \ + ({ cpu_set_t *__dest = (destset); \ + __const __cpu_mask *__arr1 = (srcset1)->__bits; \ + __const __cpu_mask *__arr2 = (srcset2)->__bits; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + size_t __i; \ + for (__i = 0; __i < __imax; ++__i) \ + ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \ + __dest; })) + +# define __CPU_ALLOC_SIZE(count) \ + ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask)) +# define __CPU_ALLOC(count) __sched_cpualloc (count) +# define __CPU_FREE(cpuset) __sched_cpufree (cpuset) __BEGIN_DECLS extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp) __THROW; +extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur; +extern void __sched_cpufree (cpu_set_t *__set) __THROW; __END_DECLS -# define __CPU_COUNT(cpusetp) \ - __sched_cpucount (sizeof (cpu_set_t), cpusetp) #endif diff --git a/libc/configure b/libc/configure index 02770496d..fe51bc31b 100755 --- a/libc/configure +++ b/libc/configure @@ -713,7 +713,6 @@ PWD_P LD AS MIG -RANLIB OBJDUMP NM AR @@ -4910,108 +4909,6 @@ NM=`$CC -print-prog-name=nm` OBJDUMP=`$CC -print-prog-name=objdump` -# ranlib has to be treated a bit differently since it might not exist at all. -ac_ranlib=`$CC -print-prog-name=ranlib` -if test "x$ac_ranlib" = xranlib; then -# This extra check has to happen since gcc simply echos the parameter in -# case it cannot find the value in its own directories. -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -else - RANLIB=$ac_ranlib -fi - - # Determine whether we are using GNU binutils. { $as_echo "$as_me:$LINENO: checking whether $AS is GNU as" >&5 $as_echo_n "checking whether $AS is GNU as... " >&6; } @@ -5657,33 +5554,8 @@ fi -# check if ranlib is necessary -{ $as_echo "$as_me:$LINENO: checking whether ranlib is necessary" >&5 -$as_echo_n "checking whether ranlib is necessary... " >&6; } -if test "${libc_cv_ranlib_necessary+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat > conftest.c <<EOF -int a; -char b; -void c(void) {} -EOF -$CC $CFLAGS $CPPFLAGS -c conftest.c -$AR cr conftest.a conftest.o -cp conftest.a conftest2.a -$RANLIB conftest.a -if cmp -s conftest.a conftest2.a; then - libc_cv_ranlib_necessary=no -else - libc_cv_ranlib_necessary=yes -fi -rm -rf conftest* -fi -{ $as_echo "$as_me:$LINENO: result: $libc_cv_ranlib_necessary" >&5 -$as_echo "$libc_cv_ranlib_necessary" >&6; } -if test "$libc_cv_ranlib_necessary" = no; then - RANLIB=: -fi +# ranlib is never necessary on Linux and Hurd systems +RANLIB=: # Test if LD_LIBRARY_PATH contains the notation for the current directory # since this would lead to problems installing/building glibc. diff --git a/libc/configure.in b/libc/configure.in index d0ff587fa..9b5230cd9 100644 --- a/libc/configure.in +++ b/libc/configure.in @@ -1128,26 +1128,8 @@ fi AC_SUBST(SYSINCLUDES) AC_SUBST(CXX_SYSINCLUDES) -# check if ranlib is necessary -AC_CACHE_CHECK(whether ranlib is necessary, libc_cv_ranlib_necessary, [dnl -cat > conftest.c <<EOF -int a; -char b; -void c(void) {} -EOF -$CC $CFLAGS $CPPFLAGS -c conftest.c -$AR cr conftest.a conftest.o -cp conftest.a conftest2.a -$RANLIB conftest.a -if cmp -s conftest.a conftest2.a; then - libc_cv_ranlib_necessary=no -else - libc_cv_ranlib_necessary=yes -fi -rm -rf conftest*]) -if test "$libc_cv_ranlib_necessary" = no; then - RANLIB=: -fi +# ranlib is never necessary on Linux and Hurd systems +RANLIB=: # Test if LD_LIBRARY_PATH contains the notation for the current directory # since this would lead to problems installing/building glibc. diff --git a/libc/elf/Makefile b/libc/elf/Makefile index e97f565d9..4dc9f1c86 100644 --- a/libc/elf/Makefile +++ b/libc/elf/Makefile @@ -214,7 +214,7 @@ endif ifeq (yesyes,$(have-fpie)$(build-shared)) tests: $(objpfx)tst-pie1.out endif -tests: $(objpfx)tst-leaks1-mem +tests: $(objpfx)tst-leaks1-mem $(objpfx)noload-mem tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 tlsmod17a-modules = $(addprefix tst-tlsmod17a, $(tlsmod17a-suffixes)) @@ -686,6 +686,10 @@ $(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so LDFLAGS-noload = -rdynamic $(objpfx)noload.out: $(objpfx)testobj5.so +$(objpfx)noload-mem: $(objpfx)noload.out + $(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@ +noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace + LDFLAGS-nodelete = -rdynamic LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete diff --git a/libc/elf/dl-close.c b/libc/elf/dl-close.c index 866c0a67e..2a41722a5 100644 --- a/libc/elf/dl-close.c +++ b/libc/elf/dl-close.c @@ -1,5 +1,5 @@ /* Close a shared object opened by `_dl_open'. - Copyright (C) 1996-2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1996-2007, 2009, 2010, 2011 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 @@ -119,8 +119,17 @@ _dl_close_worker (struct link_map *map) if (map->l_direct_opencount > 0 || map->l_type != lt_loaded || dl_close_state != not_pending) { - if (map->l_direct_opencount == 0 && map->l_type == lt_loaded) - dl_close_state = rerun; + if (map->l_direct_opencount == 0) + { + if (map->l_type == lt_loaded) + dl_close_state = rerun; + else if (map->l_type == lt_library) + { + struct link_map **oldp = map->l_initfini; + map->l_initfini = map->l_orig_initfini; + _dl_scope_free (oldp); + } + } /* There are still references to this object. Do nothing more. */ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)) diff --git a/libc/elf/dl-deps.c b/libc/elf/dl-deps.c index 524d76ee1..3994e7e38 100644 --- a/libc/elf/dl-deps.c +++ b/libc/elf/dl-deps.c @@ -491,6 +491,10 @@ _dl_map_object_deps (struct link_map *map, if (errno == 0 && errno_saved != 0) __set_errno (errno_saved); + if (errno_reason) + _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname, + NULL, errstring); + struct link_map **old_l_initfini = NULL; if (map->l_initfini != NULL && map->l_type == lt_loaded) { @@ -682,9 +686,5 @@ Filters not supported with LD_TRACE_PRELINKING")); _dl_scope_free (old_l_reldeps); } if (old_l_initfini != NULL) - _dl_scope_free (old_l_initfini); - - if (errno_reason) - _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname, - NULL, errstring); + map->l_orig_initfini = old_l_initfini; } diff --git a/libc/elf/dl-load.c b/libc/elf/dl-load.c index 4fee639d7..c831fec7c 100644 --- a/libc/elf/dl-load.c +++ b/libc/elf/dl-load.c @@ -894,6 +894,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, { /* We are not supposed to load the object unless it is already loaded. So return now. */ + free (realname); __close (fd); return NULL; } @@ -912,6 +913,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, _dl_zerofd = _dl_sysdep_open_zero_fill (); if (_dl_zerofd == -1) { + free (realname); __close (fd); _dl_signal_error (errno, NULL, NULL, N_("cannot open zero fill device")); diff --git a/libc/elf/dl-object.c b/libc/elf/dl-object.c index 7a3602931..0a9103d8b 100644 --- a/libc/elf/dl-object.c +++ b/libc/elf/dl-object.c @@ -1,5 +1,6 @@ /* Storage management for the chain of loaded shared objects. - Copyright (C) 1995-2002,2004,2006-2009,2010 Free Software Foundation, Inc. + Copyright (C) 1995-2002,2004,2006,2007,2008,2009,2010,2011 + 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 @@ -60,7 +61,6 @@ internal_function _dl_new_object (char *realname, const char *libname, int type, struct link_map *loader, int mode, Lmid_t nsid) { - struct link_map *l; size_t libname_len = strlen (libname) + 1; struct link_map *new; struct libname_list *newname; diff --git a/libc/elf/elf.h b/libc/elf/elf.h index a9558a3dd..acb7762f5 100644 --- a/libc/elf/elf.h +++ b/libc/elf/elf.h @@ -2318,7 +2318,8 @@ typedef Elf32_Addr Elf32_Conflict; #define R_ARM_THM_PC22 10 #define R_ARM_THM_PC8 11 #define R_ARM_AMP_VCALL9 12 -#define R_ARM_SWI24 13 +#define R_ARM_SWI24 13 /* Obsolete static relocation. */ +#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */ #define R_ARM_THM_SWI8 14 #define R_ARM_XPC25 15 #define R_ARM_THM_XPC22 16 @@ -2339,6 +2340,10 @@ typedef Elf32_Addr Elf32_Conflict; #define R_ARM_LDR_SBREL_11_0 35 #define R_ARM_ALU_SBREL_19_12 36 #define R_ARM_ALU_SBREL_27_20 37 +#define R_ARM_TLS_GOTDESC 90 +#define R_ARM_TLS_CALL 91 +#define R_ARM_TLS_DESCSEQ 92 +#define R_ARM_THM_TLS_CALL 93 #define R_ARM_GNU_VTENTRY 100 #define R_ARM_GNU_VTINHERIT 101 #define R_ARM_THM_PC11 102 /* thumb unconditional branch */ @@ -2353,6 +2358,7 @@ typedef Elf32_Addr Elf32_Conflict; static TLS block offset */ #define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static TLS block */ +#define R_ARM_THM_TLS_DESCSEQ 129 #define R_ARM_RXPC25 249 #define R_ARM_RSBREL32 250 #define R_ARM_THM_RPC22 251 diff --git a/libc/elf/noload.c b/libc/elf/noload.c index 9281ec714..bcc85efc2 100644 --- a/libc/elf/noload.c +++ b/libc/elf/noload.c @@ -1,20 +1,28 @@ #include <dlfcn.h> #include <stdio.h> +#include <mcheck.h> int main (void) { int result = 0; + void *p; + + mtrace (); /* First try to load an object which is a dependency. This should succeed. */ - if (dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD) == NULL) + p = dlopen ("testobj1.so", RTLD_LAZY | RTLD_NOLOAD); + if (p == NULL) { printf ("cannot open \"testobj1.so\": %s\n", dlerror ()); result = 1; } else - puts ("loading \"testobj1.so\" succeeded, OK"); + { + puts ("loading \"testobj1.so\" succeeded, OK"); + dlclose (p); + } /* Now try loading an object which is not already loaded. */ if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) != NULL) @@ -25,8 +33,6 @@ main (void) else { /* Load the object and run the same test again. */ - void *p; - puts ("\"testobj5.so\" wasn't loaded and RTLD_NOLOAD prevented it, OK"); p = dlopen ("testobj5.so", RTLD_LAZY); @@ -41,13 +47,17 @@ main (void) { puts ("loading \"testobj5.so\" succeeded, OK"); - if (dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD) == NULL) + void *q = dlopen ("testobj5.so", RTLD_LAZY | RTLD_NOLOAD); + if (q == NULL) { printf ("cannot open \"testobj5.so\": %s\n", dlerror ()); result = 1; } else - puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK"); + { + puts ("loading \"testobj5.so\" with RTLD_NOLOAD succeeded, OK"); + dlclose (q); + } if (dlclose (p) != 0) { diff --git a/libc/elf/rtld-Rules b/libc/elf/rtld-Rules index 10c9452ce..cd83c8523 100644 --- a/libc/elf/rtld-Rules +++ b/libc/elf/rtld-Rules @@ -1,6 +1,7 @@ # Subroutine makefile for compiling libc modules linked into dynamic linker. -# Copyright (C) 2002,2003,2005,2006,2008,2010 Free Software Foundation, Inc. +# Copyright (C) 2002,2003,2005,2006,2008,2010,2011 +# 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 @@ -50,7 +51,6 @@ $(objpfx)rtld-libc.a: $(foreach dir,$(rtld-subdirs),\ $(rtld-$(dir)))) @-rm -f $@T $(AR) cq$(verbose) $@T $^ - $(RANLIB) $@T mv -f $@T $@ # Use the verbose option of ar and tar when not running silently. diff --git a/libc/elf/rtld.c b/libc/elf/rtld.c index 9e9ff3617..9560127b1 100644 --- a/libc/elf/rtld.c +++ b/libc/elf/rtld.c @@ -1,5 +1,5 @@ /* Run time dynamic linker. - Copyright (C) 1995-2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1995-2010, 2011 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 @@ -2179,6 +2179,10 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", we need it in the memory handling later. */ GLRO(dl_initial_searchlist) = *GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist; + /* Remember the last search directory added at startup, now that + malloc will no longer be the one from dl-minimal.c. */ + GLRO(dl_init_all_dirs) = GL(dl_all_dirs); + if (prelinked) { if (main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)] != NULL) @@ -2298,9 +2302,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", lossage); } - /* Remember the last search directory added at startup, now that - malloc will no longer be the one from dl-minimal.c. */ - GLRO(dl_init_all_dirs) = GL(dl_all_dirs); + /* Make sure no new search directories have been added. */ + assert (GLRO(dl_init_all_dirs) == GL(dl_all_dirs)); if (! prelinked && rtld_multiple_ref) { diff --git a/libc/include/link.h b/libc/include/link.h index 9d1fc1a8f..e87710464 100644 --- a/libc/include/link.h +++ b/libc/include/link.h @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1995-2006, 2007, 2009, 2010, 2011 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 @@ -240,6 +240,9 @@ struct link_map /* List of object in order of the init and fini calls. */ struct link_map **l_initfini; + /* The init and fini list generated at startup, saved when the + object is also loaded dynamically. */ + struct link_map **l_orig_initfini; /* List of the dependencies introduced through symbol binding. */ struct link_map_reldeps diff --git a/libc/libio/fmemopen.c b/libc/libio/fmemopen.c index d3750fc7d..75f9f7e5f 100644 --- a/libc/libio/fmemopen.c +++ b/libc/libio/fmemopen.c @@ -1,5 +1,5 @@ /* Fmemopen implementation. - Copyright (C) 2000, 2002, 2005, 2006, 2008, 2009 + Copyright (C) 2000, 2002, 2005, 2006, 2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Hanno Mueller, kontakt@hanno.de, 2000. @@ -226,6 +226,7 @@ fmemopen (void *buf, size_t len, const char *mode) return NULL; } c->buffer[0] = '\0'; + c->maxpos = 0; } else { @@ -236,14 +237,14 @@ fmemopen (void *buf, size_t len, const char *mode) } c->buffer = buf; - } - c->size = len; + if (mode[0] == 'w') + c->buffer[0] = '\0'; - if (mode[0] == 'w') - c->buffer[0] = '\0'; + c->maxpos = strnlen (c->buffer, len); + } - c->maxpos = strlen (c->buffer); + c->size = len; if (mode[0] == 'a') c->pos = c->maxpos; diff --git a/libc/manual/install.texi b/libc/manual/install.texi index 6744699b8..6afa94e41 100644 --- a/libc/manual/install.texi +++ b/libc/manual/install.texi @@ -228,8 +228,8 @@ important to use this same @code{CC} value when running @code{configure}, like this: @samp{CC=@var{target}-gcc configure @var{target}}. Set @code{BUILD_CC} to the compiler to use for programs run on the build system as part of compiling the library. You may need to -set @code{AR} and @code{RANLIB} to cross-compiling versions of @code{ar} -and @code{ranlib} if the native tools are not configured to work with +set @code{AR} to cross-compiling versions of @code{ar} +if the native tools are not configured to work with object files for the target you configured for. diff --git a/libc/nis/nis_add.c b/libc/nis/nis_add.c index f5e783cc2..a06999b4e 100644 --- a/libc/nis/nis_add.c +++ b/libc/nis/nis_add.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2004,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. @@ -65,7 +65,7 @@ nis_add (const_nis_name name, const nis_object *obj2) NIS_ADD, (xdrproc_t) _xdr_ns_request, (caddr_t) &req, (xdrproc_t) _xdr_nis_result, (caddr_t) res, MASTER_ONLY, NULL); - if (status != RPC_SUCCESS) + if (status != NIS_SUCCESS) NIS_RES_STATUS (res) = status; nis_destroy_object (req.ns_object.ns_object_val); diff --git a/libc/nis/nis_modify.c b/libc/nis/nis_modify.c index 0ec0ec6f4..68609fafe 100644 --- a/libc/nis/nis_modify.c +++ b/libc/nis/nis_modify.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2004,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. @@ -65,7 +65,7 @@ nis_modify (const_nis_name name, const nis_object *obj2) (caddr_t) & req, (xdrproc_t) _xdr_nis_result, (caddr_t) res, MASTER_ONLY, NULL); - if (status != RPC_SUCCESS) + if (status != NIS_SUCCESS) NIS_RES_STATUS (res) = status; nis_destroy_object (req.ns_object.ns_object_val); diff --git a/libc/nis/nis_remove.c b/libc/nis/nis_remove.c index 3aefccea4..4c9179907 100644 --- a/libc/nis/nis_remove.c +++ b/libc/nis/nis_remove.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2004,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997. @@ -49,7 +49,7 @@ nis_remove (const_nis_name name, const nis_object *obj) if ((status = __do_niscall (name, NIS_REMOVE, (xdrproc_t) _xdr_ns_request, (caddr_t) &req, (xdrproc_t) _xdr_nis_result, (caddr_t) res, MASTER_ONLY, - NULL)) != RPC_SUCCESS) + NULL)) != NIS_SUCCESS) NIS_RES_STATUS (res) = status; nis_destroy_object (req.ns_object.ns_object_val); diff --git a/libc/nis/nis_server.c b/libc/nis/nis_server.c index c11f4b032..718d7de23 100644 --- a/libc/nis/nis_server.c +++ b/libc/nis/nis_server.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (c) 1997,1998,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -41,7 +41,7 @@ nis_servstate (const nis_server *serv, const nis_tag *tags, if (__do_niscall2 (serv, 1, NIS_SERVSTATE, (xdrproc_t) _xdr_nis_taglist, (caddr_t) &taglist, (xdrproc_t) _xdr_nis_taglist, - (caddr_t) &tagres, 0, NULL) != RPC_SUCCESS) + (caddr_t) &tagres, 0, NULL) != NIS_SUCCESS) return NIS_RPCERROR; *result = tagres.tags.tags_val; @@ -67,7 +67,7 @@ nis_stats (const nis_server *serv, const nis_tag *tags, if (__do_niscall2 (serv, 1, NIS_STATUS, (xdrproc_t) _xdr_nis_taglist, (caddr_t) &taglist, (xdrproc_t) _xdr_nis_taglist, - (caddr_t) &tagres, 0, NULL) != RPC_SUCCESS) + (caddr_t) &tagres, 0, NULL) != NIS_SUCCESS) return NIS_RPCERROR; *result = tagres.tags.tags_val; diff --git a/libc/nis/nis_table.c b/libc/nis/nis_table.c index 3704b0094..aba289732 100644 --- a/libc/nis/nis_table.c +++ b/libc/nis/nis_table.c @@ -1,5 +1,5 @@ -/* Copyright (c) 1997-1999, 2003, 2004, 2005, 2006, 2007 - Free Software Foundation, Inc. +/* Copyright (c) 1997-1999, 2003, 2004, 2005, 2006, 2007, 2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997. diff --git a/libc/nscd/aicache.c b/libc/nscd/aicache.c index 3cb220803..3190a13b0 100644 --- a/libc/nscd/aicache.c +++ b/libc/nscd/aicache.c @@ -1,5 +1,5 @@ /* Cache handling for host lookup. - Copyright (C) 2004-2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2004-2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. @@ -58,7 +58,7 @@ static const ai_response_header notfound = }; -static void +static time_t addhstaiX (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid, struct hashentry *const he, struct datahead *dh) @@ -119,6 +119,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req, ssize_t total = 0; char *key_copy = NULL; bool alloca_used = false; + time_t timeout = MAX_TIMEOUT_VALUE; while (!no_more) { @@ -388,8 +389,8 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = time (NULL) + (ttl == INT32_MAX - ? db->postimeout : ttl); + dataset->head.ttl = ttl == INT32_MAX ? db->postimeout : ttl; + timeout = dataset->head.timeout = time (NULL) + dataset->head.ttl; dataset->resp.version = NSCD_VERSION; dataset->resp.found = 1; @@ -421,6 +422,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req, timeout value. Note that the new record has been allocated on the stack and need not be freed. */ dh->timeout = dataset->head.timeout; + dh->ttl = dataset->head.ttl; ++dh->nreloads; } else @@ -496,6 +498,9 @@ next_nip: if (reload_count != UINT_MAX && dh->nreloads == reload_count) /* Do not reset the value if we never not reload the record. */ dh->nreloads = reload_count - 1; + + /* Reload with the same time-to-live value. */ + timeout = dh->timeout = time (NULL) + dh->ttl; } else { @@ -517,7 +522,8 @@ next_nip: dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = time (NULL) + db->negtimeout; + timeout = dataset->head.timeout = time (NULL) + db->negtimeout; + dataset->head.ttl = db->negtimeout; /* This is the reply. */ memcpy (&dataset->resp, ¬found, total); @@ -551,6 +557,8 @@ next_nip: if (dh != NULL) dh->usable = false; } + + return timeout; } @@ -562,7 +570,7 @@ addhstai (struct database_dyn *db, int fd, request_header *req, void *key, } -void +time_t readdhstai (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { request_header req = @@ -571,5 +579,5 @@ readdhstai (struct database_dyn *db, struct hashentry *he, struct datahead *dh) .key_len = he->len }; - addhstaiX (db, -1, &req, db->data + he->key, he->owner, he, dh); + return addhstaiX (db, -1, &req, db->data + he->key, he->owner, he, dh); } diff --git a/libc/nscd/cache.c b/libc/nscd/cache.c index 3e6793df2..ebc6e4c0d 100644 --- a/libc/nscd/cache.c +++ b/libc/nscd/cache.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1998, 1999, 2003-2008, 2009 Free Software Foundation, Inc. +/* Copyright (c) 1998, 1999, 2003-2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -45,9 +45,9 @@ extern void *xcalloc (size_t n, size_t s); unsigned int reload_count = DEFAULT_RELOAD_LIMIT; -static void (*const readdfcts[LASTREQ]) (struct database_dyn *, - struct hashentry *, - struct datahead *) = +static time_t (*const readdfcts[LASTREQ]) (struct database_dyn *, + struct hashentry *, + struct datahead *) = { [GETPWBYNAME] = readdpwbyname, [GETPWBYUID] = readdpwbyuid, @@ -272,7 +272,7 @@ prune_cache (struct database_dyn *table, time_t now, int fd) { char buf[128]; /* We cannot stat() the file, disable file checking if the - file does not exist. */ + file does not exist. */ dbg_log (_("cannot stat() file `%s': %s"), table->filename, strerror_r (errno, buf, sizeof (buf))); if (errno == ENOENT) @@ -389,7 +389,8 @@ prune_cache (struct database_dyn *table, time_t now, int fd) assert (runp->type < LASTREQ && readdfcts[runp->type] != NULL); - readdfcts[runp->type] (table, runp, dh); + time_t timeout = readdfcts[runp->type] (table, runp, dh); + next_timeout = MIN (next_timeout, timeout); /* If the entry has been replaced, we might need cleanup. */ diff --git a/libc/nscd/connections.c b/libc/nscd/connections.c index 69f6533a3..d9878fa59 100644 --- a/libc/nscd/connections.c +++ b/libc/nscd/connections.c @@ -1,5 +1,5 @@ /* Inner loops of cache daemon. - Copyright (C) 1998-2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1998-2007, 2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -1533,10 +1533,7 @@ nscd_run_prune (void *p) pruning we want to know about it. Therefore set the timeout to the maximum. It will be descreased when adding new entries to the cache, if necessary. */ - if (sizeof (time_t) == sizeof (long int)) - dbs[my_number].wakeup_time = LONG_MAX; - else - dbs[my_number].wakeup_time = INT_MAX; + dbs[my_number].wakeup_time = MAX_TIMEOUT_VALUE; /* Unconditionally reset the flag. */ time_t prune_now = dbs[my_number].clear_cache ? LONG_MAX : now; diff --git a/libc/nscd/grpcache.c b/libc/nscd/grpcache.c index bd101c675..fa2192901 100644 --- a/libc/nscd/grpcache.c +++ b/libc/nscd/grpcache.c @@ -1,5 +1,5 @@ /* Cache handling for group lookup. - Copyright (C) 1998-2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -71,7 +71,7 @@ static const gr_response_header notfound = }; -static void +static time_t cache_addgr (struct database_dyn *db, int fd, request_header *req, const void *key, struct group *grp, uid_t owner, struct hashentry *const he, struct datahead *dh, int errval) @@ -91,6 +91,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, assert (offsetof (struct dataset, resp) == offsetof (struct datahead, data)); + time_t timeout = MAX_TIMEOUT_VALUE; if (grp == NULL) { if (he != NULL && errval == EAGAIN) @@ -102,6 +103,9 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, /* Do not reset the value if we never not reload the record. */ dh->nreloads = reload_count - 1; + /* Reload with the same time-to-live value. */ + timeout = dh->timeout = t + db->postimeout; + written = total = 0; } else @@ -125,7 +129,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = t + db->negtimeout; + timeout = dataset->head.timeout = t + db->negtimeout; /* This is the reply. */ memcpy (&dataset->resp, ¬found, total); @@ -217,7 +221,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = t + db->postimeout; + timeout = dataset->head.timeout = t + db->postimeout; dataset->resp.version = NSCD_VERSION; dataset->resp.found = 1; @@ -379,6 +383,8 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, dbg_log (_("short write in %s: %s"), __FUNCTION__, strerror_r (errno, buf, sizeof (buf))); } + + return timeout; } @@ -400,7 +406,7 @@ lookup (int type, union keytype key, struct group *resultbufp, char *buffer, } -static void +static time_t addgrbyX (struct database_dyn *db, int fd, request_header *req, union keytype key, const char *keystr, uid_t uid, struct hashentry *he, struct datahead *dh) @@ -456,10 +462,12 @@ addgrbyX (struct database_dyn *db, int fd, request_header *req, buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen); } - cache_addgr (db, fd, req, keystr, grp, uid, he, dh, errval); + time_t timeout = cache_addgr (db, fd, req, keystr, grp, uid, he, dh, errval); if (use_malloc) free (buffer); + + return timeout; } @@ -473,7 +481,7 @@ addgrbyname (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdgrbyname (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -484,7 +492,7 @@ readdgrbyname (struct database_dyn *db, struct hashentry *he, }; union keytype u = { .v = db->data + he->key }; - addgrbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh); + return addgrbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh); } @@ -498,7 +506,7 @@ addgrbygid (struct database_dyn *db, int fd, request_header *req, if (*(char *) key == '\0' || *ep != '\0') /* invalid numeric uid */ { if (debug_level > 0) - dbg_log (_("Invalid numeric gid \"%s\"!"), (char *) key); + dbg_log (_("Invalid numeric gid \"%s\"!"), (char *) key); errno = EINVAL; return; @@ -510,7 +518,7 @@ addgrbygid (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdgrbygid (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -527,5 +535,5 @@ readdgrbygid (struct database_dyn *db, struct hashentry *he, }; union keytype u = { .g = gid }; - addgrbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh); + return addgrbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh); } diff --git a/libc/nscd/hstcache.c b/libc/nscd/hstcache.c index a6055cf99..101ad2a77 100644 --- a/libc/nscd/hstcache.c +++ b/libc/nscd/hstcache.c @@ -91,7 +91,7 @@ static const hst_response_header tryagain = }; -static void +static time_t cache_addhst (struct database_dyn *db, int fd, request_header *req, const void *key, struct hostent *hst, uid_t owner, struct hashentry *const he, struct datahead *dh, int errval, @@ -111,6 +111,7 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, assert (offsetof (struct dataset, resp) == offsetof (struct datahead, data)); + time_t timeout = MAX_TIMEOUT_VALUE; if (hst == NULL) { if (he != NULL && errval == EAGAIN) @@ -121,6 +122,9 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, if (reload_count != UINT_MAX) /* Do not reset the value if we never not reload the record. */ dh->nreloads = reload_count - 1; + + /* Reload with the same time-to-live value. */ + timeout = dh->timeout = t + dh->ttl; } else { @@ -149,8 +153,8 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = t + (ttl == INT32_MAX - ? db->negtimeout : ttl); + dataset->head.ttl = ttl == INT32_MAX ? db->negtimeout : ttl; + timeout = dataset->head.timeout = t + dataset->head.ttl; /* This is the reply. */ memcpy (&dataset->resp, resp, total); @@ -214,7 +218,7 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, if (h_addr_list_cnt == 0) /* Invalid entry. */ - return; + return MAX_TIMEOUT_VALUE; total += (sizeof (struct dataset) + h_name_len @@ -255,7 +259,8 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = t + (ttl == INT32_MAX ? db->postimeout : ttl); + dataset->head.ttl = ttl == INT32_MAX ? db->postimeout : ttl; + timeout = dataset->head.timeout = t + dataset->head.ttl; dataset->resp.version = NSCD_VERSION; dataset->resp.found = 1; @@ -312,6 +317,7 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, timeout value. Note that the new record has been allocated on the stack and need not be freed. */ assert (h_addr_list_cnt == 1); + dh->ttl = dataset->head.ttl; dh->timeout = dataset->head.timeout; ++dh->nreloads; } @@ -433,6 +439,8 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, dbg_log (_("short write in %s: %s"), __FUNCTION__, strerror_r (errno, buf, sizeof (buf))); } + + return timeout; } @@ -454,7 +462,7 @@ lookup (int type, void *key, struct hostent *resultbufp, char *buffer, } -static void +static time_t addhstbyX (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid, struct hashentry *he, struct datahead *dh) { @@ -520,11 +528,13 @@ addhstbyX (struct database_dyn *db, int fd, request_header *req, buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen); } - cache_addhst (db, fd, req, key, hst, uid, he, dh, - h_errno == TRY_AGAIN ? errval : 0, ttl); + time_t timeout = cache_addhst (db, fd, req, key, hst, uid, he, dh, + h_errno == TRY_AGAIN ? errval : 0, ttl); if (use_malloc) free (buffer); + + return timeout; } @@ -536,7 +546,7 @@ addhstbyname (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdhstbyname (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -546,7 +556,7 @@ readdhstbyname (struct database_dyn *db, struct hashentry *he, .key_len = he->len }; - addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); + return addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); } @@ -558,7 +568,7 @@ addhstbyaddr (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdhstbyaddr (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -568,7 +578,7 @@ readdhstbyaddr (struct database_dyn *db, struct hashentry *he, .key_len = he->len }; - addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); + return addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); } @@ -580,7 +590,7 @@ addhstbynamev6 (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdhstbynamev6 (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -590,7 +600,7 @@ readdhstbynamev6 (struct database_dyn *db, struct hashentry *he, .key_len = he->len }; - addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); + return addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); } @@ -602,7 +612,7 @@ addhstbyaddrv6 (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdhstbyaddrv6 (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -612,5 +622,5 @@ readdhstbyaddrv6 (struct database_dyn *db, struct hashentry *he, .key_len = he->len }; - addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); + return addhstbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); } diff --git a/libc/nscd/initgrcache.c b/libc/nscd/initgrcache.c index 8195b6609..8cb6cf197 100644 --- a/libc/nscd/initgrcache.c +++ b/libc/nscd/initgrcache.c @@ -1,5 +1,5 @@ /* Cache handling for host lookup. - Copyright (C) 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006, 2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2004. @@ -52,7 +52,7 @@ static const initgr_response_header notfound = #include "../grp/compat-initgroups.c" -static void +static time_t addinitgroupsX (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid, struct hashentry *const he, struct datahead *dh) @@ -174,7 +174,9 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, ssize_t total; ssize_t written; + time_t timeout; out: + timeout = MAX_TIMEOUT_VALUE; if (!any_success) { /* Nothing found. Create a negative result record. */ @@ -188,6 +190,9 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, if (reload_count != UINT_MAX && dh->nreloads == reload_count) /* Do not reset the value if we never not reload the record. */ dh->nreloads = reload_count - 1; + + /* Reload with the same time-to-live value. */ + timeout = dh->timeout = time (NULL) + db->postimeout; } else { @@ -209,7 +214,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = time (NULL) + db->negtimeout; + timeout = dataset->head.timeout = time (NULL) + db->negtimeout; /* This is the reply. */ memcpy (&dataset->resp, ¬found, total); @@ -273,7 +278,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = time (NULL) + db->postimeout; + timeout = dataset->head.timeout = time (NULL) + db->postimeout; dataset->resp.version = NSCD_VERSION; dataset->resp.found = 1; @@ -401,6 +406,8 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req, dbg_log (_("short write in %s: %s"), __FUNCTION__, strerror_r (errno, buf, sizeof (buf))); } + + return timeout; } @@ -412,7 +419,7 @@ addinitgroups (struct database_dyn *db, int fd, request_header *req, void *key, } -void +time_t readdinitgroups (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -422,5 +429,5 @@ readdinitgroups (struct database_dyn *db, struct hashentry *he, .key_len = he->len }; - addinitgroupsX (db, -1, &req, db->data + he->key, he->owner, he, dh); + return addinitgroupsX (db, -1, &req, db->data + he->key, he->owner, he, dh); } diff --git a/libc/nscd/nscd-client.h b/libc/nscd/nscd-client.h index c6c09cbdd..482b052d1 100644 --- a/libc/nscd/nscd-client.h +++ b/libc/nscd/nscd-client.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1998, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 +/* Copyright (c) 1998, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998. @@ -179,6 +179,10 @@ typedef uint32_t ref_t; /* Timestamp type. */ typedef uint64_t nscd_time_t; +/* Maximum timestamp. */ +#define MAX_TIMEOUT_VALUE \ + (sizeof (time_t) == sizeof (long int) ? LONG_MAX : INT_MAX) + /* Alignment requirement of the beginning of the data region. */ #define ALIGN 16 @@ -192,7 +196,8 @@ struct datahead uint8_t notfound; /* Nonzero if data has not been found. */ uint8_t nreloads; /* Reloads without use. */ uint8_t usable; /* False if the entry must be ignored. */ - uint64_t :40; /* Alignment. */ + uint8_t unused; /* Unused. */ + uint32_t ttl; /* TTL value used. */ /* We need to have the following element aligned for the response header data types and their use in the 'struct dataset' types diff --git a/libc/nscd/nscd.h b/libc/nscd/nscd.h index 3279b8543..5e3c865a2 100644 --- a/libc/nscd/nscd.h +++ b/libc/nscd/nscd.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1998-2001, 2003-2008, 2009 Free Software Foundation, Inc. +/* Copyright (c) 1998-2001, 2003-2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998. @@ -217,20 +217,20 @@ extern void addpwbyname (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); extern void addpwbyuid (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); -extern void readdpwbyname (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); -extern void readdpwbyuid (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); +extern time_t readdpwbyname (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); +extern time_t readdpwbyuid (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); /* grpcache.c */ extern void addgrbyname (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); extern void addgrbygid (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); -extern void readdgrbyname (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); -extern void readdgrbygid (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); +extern time_t readdgrbyname (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); +extern time_t readdgrbygid (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); /* hstcache.c */ extern void addhstbyname (struct database_dyn *db, int fd, request_header *req, @@ -241,37 +241,37 @@ extern void addhstbynamev6 (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); extern void addhstbyaddrv6 (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); -extern void readdhstbyname (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); -extern void readdhstbyaddr (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); -extern void readdhstbynamev6 (struct database_dyn *db, struct hashentry *he, +extern time_t readdhstbyname (struct database_dyn *db, struct hashentry *he, struct datahead *dh); -extern void readdhstbyaddrv6 (struct database_dyn *db, struct hashentry *he, +extern time_t readdhstbyaddr (struct database_dyn *db, struct hashentry *he, struct datahead *dh); +extern time_t readdhstbynamev6 (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); +extern time_t readdhstbyaddrv6 (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); /* aicache.c */ extern void addhstai (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); -extern void readdhstai (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); +extern time_t readdhstai (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); /* initgrcache.c */ extern void addinitgroups (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); -extern void readdinitgroups (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); +extern time_t readdinitgroups (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); /* servicecache.c */ extern void addservbyname (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); -extern void readdservbyname (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); +extern time_t readdservbyname (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); extern void addservbyport (struct database_dyn *db, int fd, request_header *req, void *key, uid_t uid); -extern void readdservbyport (struct database_dyn *db, struct hashentry *he, - struct datahead *dh); +extern time_t readdservbyport (struct database_dyn *db, struct hashentry *he, + struct datahead *dh); /* mem.c */ extern void *mempool_alloc (struct database_dyn *db, size_t len, diff --git a/libc/nscd/pwdcache.c b/libc/nscd/pwdcache.c index 75f2221e8..47b80520f 100644 --- a/libc/nscd/pwdcache.c +++ b/libc/nscd/pwdcache.c @@ -1,5 +1,5 @@ /* Cache handling for passwd lookup. - Copyright (C) 1998-2008, 2009 Free Software Foundation, Inc. + Copyright (C) 1998-2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -77,7 +77,7 @@ static const pw_response_header notfound = }; -static void +static time_t cache_addpw (struct database_dyn *db, int fd, request_header *req, const void *key, struct passwd *pwd, uid_t owner, struct hashentry *const he, struct datahead *dh, int errval) @@ -97,6 +97,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, assert (offsetof (struct dataset, resp) == offsetof (struct datahead, data)); + time_t timeout = MAX_TIMEOUT_VALUE; if (pwd == NULL) { if (he != NULL && errval == EAGAIN) @@ -108,6 +109,9 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, /* Do not reset the value if we never not reload the record. */ dh->nreloads = reload_count - 1; + /* Reload with the same time-to-live value. */ + timeout = dh->timeout = t + db->postimeout; + written = total = 0; } else @@ -132,7 +136,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = t + db->negtimeout; + timeout = dataset->head.timeout = t + db->negtimeout; /* This is the reply. */ memcpy (&dataset->resp, ¬found, total); @@ -212,7 +216,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = t + db->postimeout; + timeout = dataset->head.timeout = t + db->postimeout; dataset->resp.version = NSCD_VERSION; dataset->resp.found = 1; @@ -293,8 +297,8 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, assert ((char *) dataset - (char *) db->head + total <= (sizeof (struct database_pers_head) - + db->head->module * sizeof (ref_t) - + db->head->data_size)); + + db->head->module * sizeof (ref_t) + + db->head->data_size)); written = sendfileall (fd, db->wr_fd, (char *) &dataset->resp - (char *) db->head, dataset->head.recsize ); @@ -374,6 +378,8 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, dbg_log (_("short write in %s: %s"), __FUNCTION__, strerror_r (errno, buf, sizeof (buf))); } + + return timeout; } @@ -395,7 +401,7 @@ lookup (int type, union keytype key, struct passwd *resultbufp, char *buffer, } -static void +static time_t addpwbyX (struct database_dyn *db, int fd, request_header *req, union keytype key, const char *keystr, uid_t c_uid, struct hashentry *he, struct datahead *dh) @@ -452,10 +458,13 @@ addpwbyX (struct database_dyn *db, int fd, request_header *req, } /* Add the entry to the cache. */ - cache_addpw (db, fd, req, keystr, pwd, c_uid, he, dh, errval); + time_t timeout = cache_addpw (db, fd, req, keystr, pwd, c_uid, he, dh, + errval); if (use_malloc) free (buffer); + + return timeout; } @@ -469,7 +478,7 @@ addpwbyname (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdpwbyname (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -480,7 +489,7 @@ readdpwbyname (struct database_dyn *db, struct hashentry *he, }; union keytype u = { .v = db->data + he->key }; - addpwbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh); + return addpwbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh); } @@ -494,7 +503,7 @@ addpwbyuid (struct database_dyn *db, int fd, request_header *req, if (*(char *) key == '\0' || *ep != '\0') /* invalid numeric uid */ { if (debug_level > 0) - dbg_log (_("Invalid numeric uid \"%s\"!"), (char *) key); + dbg_log (_("Invalid numeric uid \"%s\"!"), (char *) key); errno = EINVAL; return; @@ -506,7 +515,7 @@ addpwbyuid (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdpwbyuid (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -523,5 +532,5 @@ readdpwbyuid (struct database_dyn *db, struct hashentry *he, }; union keytype u = { .u = uid }; - addpwbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh); + return addpwbyX (db, -1, &req, u, db->data + he->key, he->owner, he, dh); } diff --git a/libc/nscd/servicescache.c b/libc/nscd/servicescache.c index dc98d3005..2dd1cc567 100644 --- a/libc/nscd/servicescache.c +++ b/libc/nscd/servicescache.c @@ -1,5 +1,5 @@ /* Cache handling for services lookup. - Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@drepper.com>, 2007. @@ -61,7 +61,7 @@ static const serv_response_header notfound = }; -static void +static time_t cache_addserv (struct database_dyn *db, int fd, request_header *req, const void *key, struct servent *serv, uid_t owner, struct hashentry *const he, struct datahead *dh, int errval) @@ -81,6 +81,7 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req, assert (offsetof (struct dataset, resp) == offsetof (struct datahead, data)); + time_t timeout = MAX_TIMEOUT_VALUE; if (serv == NULL) { if (he != NULL && errval == EAGAIN) @@ -92,6 +93,9 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req, /* Do not reset the value if we never not reload the record. */ dh->nreloads = reload_count - 1; + /* Reload with the same time-to-live value. */ + timeout = dh->timeout = t + db->postimeout; + written = total = 0; } else @@ -115,7 +119,7 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = t + db->negtimeout; + timeout = dataset->head.timeout = t + db->negtimeout; /* This is the reply. */ memcpy (&dataset->resp, ¬found, total); @@ -203,7 +207,7 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = true; /* Compute the timeout time. */ - dataset->head.timeout = t + db->postimeout; + timeout = dataset->head.timeout = t + db->postimeout; dataset->resp.version = NSCD_VERSION; dataset->resp.found = 1; @@ -328,6 +332,8 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req, dbg_log (_("short write in %s: %s"), __FUNCTION__, strerror_r (errno, buf, sizeof (buf))); } + + return timeout; } @@ -354,7 +360,7 @@ lookup (int type, char *key, struct servent *resultbufp, char *buffer, } -static void +static time_t addservbyX (struct database_dyn *db, int fd, request_header *req, char *key, uid_t uid, struct hashentry *he, struct datahead *dh) { @@ -409,10 +415,12 @@ addservbyX (struct database_dyn *db, int fd, request_header *req, buffer = (char *) extend_alloca (buffer, buflen, 2 * buflen); } - cache_addserv (db, fd, req, key, serv, uid, he, dh, errval); + time_t timeout = cache_addserv (db, fd, req, key, serv, uid, he, dh, errval); if (use_malloc) free (buffer); + + return timeout; } @@ -424,7 +432,7 @@ addservbyname (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdservbyname (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -434,7 +442,7 @@ readdservbyname (struct database_dyn *db, struct hashentry *he, .key_len = he->len }; - addservbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); + return addservbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); } @@ -446,7 +454,7 @@ addservbyport (struct database_dyn *db, int fd, request_header *req, } -void +time_t readdservbyport (struct database_dyn *db, struct hashentry *he, struct datahead *dh) { @@ -456,5 +464,5 @@ readdservbyport (struct database_dyn *db, struct hashentry *he, .key_len = he->len }; - addservbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); + return addservbyX (db, -1, &req, db->data + he->key, he->owner, he, dh); } diff --git a/libc/posix/fnmatch_loop.c b/libc/posix/fnmatch_loop.c index 2b87f87f0..53ced9352 100644 --- a/libc/posix/fnmatch_loop.c +++ b/libc/posix/fnmatch_loop.c @@ -242,8 +242,8 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used) case L('['): { /* Nonzero if the sense of the character class is inverted. */ - CHAR *p_init = p; - CHAR *n_init = n; + const CHAR *p_init = p; + const CHAR *n_init = n; register int not; CHAR cold; UCHAR fn; diff --git a/libc/setjmp/bits/setjmp2.h b/libc/setjmp/bits/setjmp2.h index ba900b8d0..b2f8efac4 100644 --- a/libc/setjmp/bits/setjmp2.h +++ b/libc/setjmp/bits/setjmp2.h @@ -1,21 +1,21 @@ /* Checking macros for setjmp functions. - * Copyright (C) 2009 Free Software Foundation, Inc. - * This file is part of the GNU C Library. - * - * The GNU C Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * The GNU C Library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the GNU C Library; if not, write to the Free - * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA. */ + Copyright (C) 2009 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ #ifndef _SETJMP_H # error "Never include <bits/setjmp2.h> directly; use <setjmp.h> instead." diff --git a/libc/stdio-common/Makefile b/libc/stdio-common/Makefile index d590f9965..5d9566fab 100644 --- a/libc/stdio-common/Makefile +++ b/libc/stdio-common/Makefile @@ -68,7 +68,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \ tst-fwrite bug16 bug17 tst-sprintf2 bug18 \ bug19 tst-popen2 scanf14 scanf15 bug21 bug22 scanf16 scanf17 \ - tst-setvbuf1 + tst-setvbuf1 bug23 tests-$(OPTION_EGLIBC_LOCALE_CODE) \ += tst-sscanf tst-swprintf bug15 test-vfprintf bug14 scanf13 tst-grouping tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \ diff --git a/libc/stdio-common/_i18n_number.h b/libc/stdio-common/_i18n_number.h index f4e5d8be2..6b2f840f0 100644 --- a/libc/stdio-common/_i18n_number.h +++ b/libc/stdio-common/_i18n_number.h @@ -33,8 +33,8 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end) # define decimal NULL # define thousands NULL #else - char decimal[MB_LEN_MAX]; - char thousands[MB_LEN_MAX]; + char decimal[MB_LEN_MAX + 1]; + char thousands[MB_LEN_MAX + 1]; #endif /* "to_outpunct" is a map from ASCII decimal point and thousands-sep @@ -50,13 +50,19 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end) mbstate_t state; memset (&state, '\0', sizeof (state)); - if (__wcrtomb (decimal, wdecimal, &state) == (size_t) -1) + size_t n = __wcrtomb (decimal, wdecimal, &state); + if (n == (size_t) -1) memcpy (decimal, ".", 2); + else + decimal[n] = '\0'; memset (&state, '\0', sizeof (state)); - if (__wcrtomb (thousands, wthousands, &state) == (size_t) -1) + n = __wcrtomb (thousands, wthousands, &state); + if (n == (size_t) -1) memcpy (thousands, ",", 2); + else + thousands[n] = '\0'; } #endif diff --git a/libc/stdio-common/bug23.c b/libc/stdio-common/bug23.c new file mode 100644 index 000000000..dcc542807 --- /dev/null +++ b/libc/stdio-common/bug23.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <string.h> + +static char buf[32768]; +static const char expected[] = "\ +\n\ +a\n\ +abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; + +static int +do_test (void) +{ + snprintf (buf, sizeof (buf), + "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d" + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n", + "a", "b", "c", "d", 5); + return strcmp (buf, expected) != 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/libc/stdio-common/printf-parsemb.c b/libc/stdio-common/printf-parsemb.c index efd1eca3a..a67cc1a49 100644 --- a/libc/stdio-common/printf-parsemb.c +++ b/libc/stdio-common/printf-parsemb.c @@ -295,9 +295,9 @@ __parse_one_specmb (const UCHAR_T *format, size_t posn, /* We don't try to get the types for all arguments if the format uses more than one. The normal case is covered though. If the call returns -1 we continue with the normal specifiers. */ - || (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec]) - (&spec->info, 1, &spec->data_arg_type, - &spec->size)) < 0) + || (int) (spec->ndata_args = (*__printf_arginfo_table[spec->info.spec]) + (&spec->info, 1, &spec->data_arg_type, + &spec->size)) < 0) { /* Find the data argument types of a built-in spec. */ spec->ndata_args = 1; diff --git a/libc/stdio-common/psiginfo.c b/libc/stdio-common/psiginfo.c index 627c21c64..a10780d05 100644 --- a/libc/stdio-common/psiginfo.c +++ b/libc/stdio-common/psiginfo.c @@ -86,8 +86,12 @@ psiginfo (const siginfo_t *pinfo, const char *s) const char *desc; if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG && ((desc = INTUSE(_sys_siglist)[pinfo->si_signo]) != NULL - || (pinfo->si_signo >= SIGRTMIN && pinfo->si_signo < SIGRTMAX))) +#ifdef SIGRTMIN + || (pinfo->si_signo >= SIGRTMIN && pinfo->si_signo < SIGRTMAX) +#endif + )) { +#ifdef SIGRTMIN if (desc == NULL) { if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo) @@ -106,6 +110,7 @@ psiginfo (const siginfo_t *pinfo, const char *s) } } else +#endif fprintf (fp, "%s (", _(desc)); const char *base = NULL; diff --git a/libc/stdio-common/vfprintf.c b/libc/stdio-common/vfprintf.c index 68adb26cc..db7b35e9a 100644 --- a/libc/stdio-common/vfprintf.c +++ b/libc/stdio-common/vfprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2008, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 1991-2008, 2009, 2010, 2011 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 @@ -1705,7 +1705,8 @@ do_positional: { /* Extend the array of format specifiers. */ struct printf_spec *old = specs; - specs = extend_alloca (specs, nspecs_max, 2 * nspecs_max); + specs = extend_alloca (specs, nspecs_max, + 2 * nspecs_max * sizeof (*specs)); /* Copy the old array's elements to the new space. */ memmove (specs, old, nspecs * sizeof (struct printf_spec)); diff --git a/libc/sysdeps/i386/configure b/libc/sysdeps/i386/configure index adffe3f9a..e8a7970e3 100755 --- a/libc/sysdeps/i386/configure +++ b/libc/sysdeps/i386/configure @@ -1,102 +1,3 @@ - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h> @@ -133,249 +34,14 @@ ac_includes_default="\ # include <unistd.h> #endif" - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_compile # This file is generated from configure.in by Autoconf. DO NOT EDIT! # Local configure fragment for sysdeps/i386. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -386,7 +52,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue @@ -406,7 +72,7 @@ case `"$ac_path_GREP" --version 2>&1` in $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val + ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" @@ -421,24 +87,26 @@ esac $ac_path_GREP_found && break 3 done done - done +done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if test "${ac_cv_path_EGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -452,7 +120,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue @@ -472,7 +140,7 @@ case `"$ac_path_EGREP" --version 2>&1` in $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val + ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" @@ -487,10 +155,12 @@ esac $ac_path_EGREP_found && break 3 done done - done +done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP @@ -498,17 +168,21 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <stdlib.h> #include <stdarg.h> @@ -523,23 +197,48 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else - ac_cv_header_stdc=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <string.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - + $EGREP "memchr" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -549,14 +248,18 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <stdlib.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - + $EGREP "free" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -566,10 +269,14 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then : else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <ctype.h> #include <stdlib.h> @@ -596,33 +303,118 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : else - ac_cv_header_stdc=no + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -632,18 +424,146 @@ fi done -ac_fn_c_check_header_mongrel "$LINENO" "cpuid.h" "ac_cv_header_cpuid_h" "$ac_includes_default" -if test "x$ac_cv_header_cpuid_h" = x""yes; then : +if test "${ac_cv_header_cpuid_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for cpuid.h" >&5 +$as_echo_n "checking for cpuid.h... " >&6; } +if test "${ac_cv_header_cpuid_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_cpuid_h" >&5 +$as_echo "$ac_cv_header_cpuid_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking cpuid.h usability" >&5 +$as_echo_n "checking cpuid.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <cpuid.h> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking cpuid.h presence" >&5 +$as_echo_n "checking cpuid.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <cpuid.h> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: cpuid.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: cpuid.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: cpuid.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: cpuid.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: cpuid.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: cpuid.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: cpuid.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: cpuid.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: cpuid.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: cpuid.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: cpuid.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: cpuid.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: cpuid.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: cpuid.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: cpuid.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: cpuid.h: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for cpuid.h" >&5 +$as_echo_n "checking for cpuid.h... " >&6; } +if test "${ac_cv_header_cpuid_h+set}" = set; then + $as_echo_n "(cached) " >&6 else - as_fn_error $? "gcc must provide the <cpuid.h> header" "$LINENO" 5 + ac_cv_header_cpuid_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_cpuid_h" >&5 +$as_echo "$ac_cv_header_cpuid_h" >&6; } + +fi +if test "x$ac_cv_header_cpuid_h" = x""yes; then + : +else + { { $as_echo "$as_me:$LINENO: error: gcc must provide the <cpuid.h> header" >&5 +$as_echo "$as_me: error: gcc must provide the <cpuid.h> header" >&2;} + { (exit 1); exit 1; }; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -g produces usable source locations for assembler-with-cpp" >&5 +{ $as_echo "$as_me:$LINENO: checking if -g produces usable source locations for assembler-with-cpp" >&5 $as_echo_n "checking if -g produces usable source locations for assembler-with-cpp... " >&6; } -if test "${libc_cv_cpp_asm_debuginfo+set}" = set; then : +if test "${libc_cv_cpp_asm_debuginfo+set}" = set; then $as_echo_n "(cached) " >&6 else cat > conftest.S <<EOF @@ -664,19 +584,19 @@ foo: nop EOF if { ac_try='${CC-cc} $CPPFLAGS $ASFLAGS -g -c conftest.S 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } && { + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && { ac_pattern='conftest\.S' { ac_try='readelf --debug-dump=line conftest.o | grep $ac_pattern 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } }; then libc_cv_cpp_asm_debuginfo=yes else @@ -684,93 +604,99 @@ else fi rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cpp_asm_debuginfo" >&5 +{ $as_echo "$as_me:$LINENO: result: $libc_cv_cpp_asm_debuginfo" >&5 $as_echo "$libc_cv_cpp_asm_debuginfo" >&6; } if test $libc_cv_cpp_asm_debuginfo = yes; then - $as_echo "#define HAVE_CPP_ASM_DEBUGINFO 1" >>confdefs.h + cat >>confdefs.h <<\_ACEOF +#define HAVE_CPP_ASM_DEBUGINFO 1 +_ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSE4 support" >&5 +{ $as_echo "$as_me:$LINENO: checking for SSE4 support" >&5 $as_echo_n "checking for SSE4 support... " >&6; } -if test "${libc_cv_cc_sse4+set}" = set; then : +if test "${libc_cv_cc_sse4+set}" = set; then $as_echo_n "(cached) " >&6 else if { ac_try='${CC-cc} -msse4 -xc /dev/null -S -o /dev/null' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then libc_cv_cc_sse4=yes else libc_cv_cc_sse4=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_sse4" >&5 +{ $as_echo "$as_me:$LINENO: result: $libc_cv_cc_sse4" >&5 $as_echo "$libc_cv_cc_sse4" >&6; } if test $libc_cv_cc_sse4 = yes; then - $as_echo "#define HAVE_SSE4_SUPPORT 1" >>confdefs.h + cat >>confdefs.h <<\_ACEOF +#define HAVE_SSE4_SUPPORT 1 +_ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler -mtune=i686 support" >&5 +{ $as_echo "$as_me:$LINENO: checking for assembler -mtune=i686 support" >&5 $as_echo_n "checking for assembler -mtune=i686 support... " >&6; } -if test "${libc_cv_as_i686+set}" = set; then : +if test "${libc_cv_as_i686+set}" = set; then $as_echo_n "(cached) " >&6 else if { ac_try='${CC-cc} -Wa,-mtune=i686 -xc /dev/null -S -o /dev/null' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then libc_cv_as_i686=yes else libc_cv_as_i686=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_as_i686" >&5 +{ $as_echo "$as_me:$LINENO: result: $libc_cv_as_i686" >&5 $as_echo "$libc_cv_as_i686" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX support" >&5 +{ $as_echo "$as_me:$LINENO: checking for AVX support" >&5 $as_echo_n "checking for AVX support... " >&6; } -if test "${libc_cv_cc_avx+set}" = set; then : +if test "${libc_cv_cc_avx+set}" = set; then $as_echo_n "(cached) " >&6 else if { ac_try='${CC-cc} -mavx -xc /dev/null -S -o /dev/null' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then libc_cv_cc_avx=yes else libc_cv_cc_avx=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_avx" >&5 +{ $as_echo "$as_me:$LINENO: result: $libc_cv_cc_avx" >&5 $as_echo "$libc_cv_cc_avx" >&6; } if test $libc_cv_cc_avx = yes; then - $as_echo "#define HAVE_AVX_SUPPORT 1" >>confdefs.h + cat >>confdefs.h <<\_ACEOF +#define HAVE_AVX_SUPPORT 1 +_ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mno-vzeroupper support" >&5 +{ $as_echo "$as_me:$LINENO: checking for -mno-vzeroupper support" >&5 $as_echo_n "checking for -mno-vzeroupper support... " >&6; } -if test "${libc_cv_cc_novzeroupper+set}" = set; then : +if test "${libc_cv_cc_novzeroupper+set}" = set; then $as_echo_n "(cached) " >&6 else if { ac_try='${CC-cc} -mno-vzeroupper -xc /dev/null -S -o /dev/null' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then libc_cv_cc_novzeroupper=yes else libc_cv_cc_novzeroupper=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_novzeroupper" >&5 +{ $as_echo "$as_me:$LINENO: result: $libc_cv_cc_novzeroupper" >&5 $as_echo "$libc_cv_cc_novzeroupper" >&6; } diff --git a/libc/sysdeps/mach/hurd/ifreq.h b/libc/sysdeps/mach/hurd/ifreq.h new file mode 100644 index 000000000..92cb7b98d --- /dev/null +++ b/libc/sysdeps/mach/hurd/ifreq.h @@ -0,0 +1,45 @@ +/* Copyright (C) 1999, 2002, 2003, 2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger <aj@suse.de>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <net/if.h> +#include <sys/socket.h> +#include <sys/ioctl.h> +#include <sys/mman.h> + +static inline struct ifreq * +__if_nextreq (struct ifreq *ifr) +{ +#ifdef _HAVE_SA_LEN + if (ifr->ifr_addr.sa_len > sizeof ifr->ifr_addr) + return (struct ifreq *) ((char *) &ifr->ifr_addr + ifr->ifr_addr.sa_len); +#endif + return ifr + 1; +} + +extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd); + + +static inline void +__if_freereq (struct ifreq *ifreqs, int num_ifs) +{ + munmap (ifreqs, num_ifs * sizeof (struct ifreq)); +} diff --git a/libc/sysdeps/mach/i386/sysdep.h b/libc/sysdeps/mach/i386/sysdep.h index 4fc5d50f3..fb77d4649 100644 --- a/libc/sysdeps/mach/i386/sysdep.h +++ b/libc/sysdeps/mach/i386/sysdep.h @@ -18,6 +18,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#ifndef _MACH_I386_SYSDEP_H +#define _MACH_I386_SYSDEP_H 1 + /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */ #include <dl-sysdep.h> #include <tls.h> @@ -64,3 +67,5 @@ #undef ENTRY #undef ALIGN #include <sysdeps/unix/i386/sysdep.h> + +#endif /* mach/i386/sysdep.h */ diff --git a/libc/sysdeps/mach/i386/thread_state.h b/libc/sysdeps/mach/i386/thread_state.h index cefea2cfb..e8fdef6e5 100644 --- a/libc/sysdeps/mach/i386/thread_state.h +++ b/libc/sysdeps/mach/i386/thread_state.h @@ -17,6 +17,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#ifndef _MACH_I386_THREAD_STATE_H +#define _MACH_I386_THREAD_STATE_H 1 + #include <mach/machine/thread_status.h> #define MACHINE_THREAD_STATE_FLAVOR i386_THREAD_STATE @@ -36,3 +39,5 @@ struct machine_thread_all_state }; #include <sysdeps/mach/thread_state.h> + +#endif /* mach/i386/thread_state.h */ diff --git a/libc/sysdeps/powerpc/powerpc64/power7/Makefile b/libc/sysdeps/powerpc/powerpc64/power7/Makefile new file mode 100644 index 000000000..b0f45205b --- /dev/null +++ b/libc/sysdeps/powerpc/powerpc64/power7/Makefile @@ -0,0 +1,5 @@ +ifeq ($(subdir),elf) +# Prevent the use of VSX registers and insns in _dl_start, which under -O3 +# optimization may require a TOC reference before relocations are resolved. +CFLAGS-rtld.c += -mno-vsx +endif diff --git a/libc/sysdeps/sparc/sparc64/multiarch/memset.S b/libc/sysdeps/sparc/sparc64/multiarch/memset.S index 23e513f18..befd7edc8 100644 --- a/libc/sysdeps/sparc/sparc64/multiarch/memset.S +++ b/libc/sysdeps/sparc/sparc64/multiarch/memset.S @@ -114,8 +114,8 @@ ENTRY(__bzero) nop 9: # ifdef SHARED - sethi %gdop_hix22(__memset_ultra1), %o1 - xor %o1, %gdop_lox10(__memset_ultra1), %o1 + sethi %gdop_hix22(__bzero_ultra1), %o1 + xor %o1, %gdop_lox10(__bzero_ultra1), %o1 # else set __bzero_ultra1, %o1 # endif diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index aab4b721c..e714c4c53 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -172,7 +172,7 @@ : "r9", "r10", "r11", "r12", \ "cr0", "ctr", "lr", "memory"); \ err = (long int) r0; \ - (int) r3; \ + r3; \ }) #undef INLINE_SYSCALL @@ -219,7 +219,7 @@ : "r9", "r10", "r11", "r12", \ "cr0", "ctr", "memory"); \ err = r0; \ - (int) r3; \ + r3; \ }) #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) diff --git a/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h index 141ea2786..f9538747b 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h +++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/socket.h @@ -59,7 +59,8 @@ enum __socket_type other similar things on the user level. */ #define SOCK_PACKET SOCK_PACKET - /* Flags to be ORed into the type parameter of socket and socketpair. */ + /* Flags to be ORed into the type parameter of socket and socketpair and + used for the flags parameter of paccept. */ SOCK_CLOEXEC = 0x400000, /* Atomically set close-on-exec flag for the new descriptor(s). */ @@ -235,6 +236,8 @@ enum #define MSG_NOSIGNAL MSG_NOSIGNAL MSG_MORE = 0x8000, /* Sender will send more. */ #define MSG_MORE MSG_MORE + MSG_WAITFORONE = 0x10000, /* Wait for at least one packet to return.*/ +#define MSG_WAITFORONE MSG_WAITFORONE MSG_CMSG_CLOEXEC = 0x40000000 /* Set close_on_exit for file descriptor received through @@ -262,6 +265,15 @@ struct msghdr int msg_flags; /* Flags on received message. */ }; +#ifdef __USE_GNU +/* For `recvmmsg'. */ +struct mmsghdr + { + struct msghdr msg_hdr; /* Actual message header. */ + unsigned int msg_len; /* Number of received bytes for the entry. */ + }; +#endif + /* Structure used for storage of ancillary data object information. */ struct cmsghdr { @@ -324,7 +336,7 @@ enum { SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ #define SCM_RIGHTS SCM_RIGHTS -#ifdef __USE_BSD +#ifdef __USE_GNU , SCM_CREDENTIALS = 0x02 /* Credentials passing. */ # define SCM_CREDENTIALS SCM_CREDENTIALS #endif @@ -406,4 +418,18 @@ struct linger int l_linger; /* Time to linger. */ }; + +__BEGIN_DECLS + +/* Receive a message as described by MESSAGE from socket FD. + Returns the number of bytes read or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags, + __const struct timespec *__tmo); + +__END_DECLS + #endif /* bits/socket.h */ diff --git a/libc/sysdeps/wordsize-64/Makefile b/libc/sysdeps/wordsize-64/Makefile new file mode 100644 index 000000000..9903f51f9 --- /dev/null +++ b/libc/sysdeps/wordsize-64/Makefile @@ -0,0 +1,6 @@ +ifeq ($(subdir),misc) +tests += tst-writev + +# Time enough for a large writev syscall to complete. +tst-writev-ENV = TIMEOUTFACTOR="10" +endif diff --git a/libc/sysdeps/wordsize-64/tst-writev.c b/libc/sysdeps/wordsize-64/tst-writev.c new file mode 100644 index 000000000..6e4788612 --- /dev/null +++ b/libc/sysdeps/wordsize-64/tst-writev.c @@ -0,0 +1,107 @@ +/* Copyright (C) 2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ryan S. Arnold <rsa@us.ibm.com>, 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fcntl.h> +#include <paths.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/uio.h> + + +/* The purpose of this test is to verify that the INTERNAL_[V]SYSCALL_NCS + macros on 64-bit platforms don't cast the return type to (int) which would + erroneously sign extend the return value should the high bit of the bottom + half of the word be '1'. */ + +#if 0 +/* Used to test the non power-of-2 code path. */ +#undef IOV_MAX +#define IOV_MAX 1000 +#endif + +/* writev() should report that it has written EXPECTED number of bytes. */ +#define EXPECTED ((size_t) INT32_MAX + 1) + +static int +do_test (void) +{ + struct iovec iv[IOV_MAX]; + /* POSIX doesn't guarantee that IOV_MAX is pow of 2 but we're optimistic. */ + size_t bufsz = EXPECTED / IOV_MAX; + size_t bufrem = EXPECTED % IOV_MAX; + + /* If there's a remainder then IOV_MAX probably isn't a power of 2 and we + need to make bufsz bigger so that the last iovec, iv[IOV_MAX-1], is free + for the remainder. */ + if (bufrem) + { + bufsz = bufsz + 1; + bufrem = EXPECTED - (bufsz * (IOV_MAX - 1)); + } + + /* We writev to /dev/null since we're just testing writev's return value. */ + int fd = open (_PATH_DEVNULL, O_WRONLY); + if (fd == -1) + { + printf ("Unable to open /dev/null for writing.\n"); + return -1; + } + + iv[0].iov_base = malloc (bufsz); + if (iv[0].iov_base == NULL) + { + printf ("malloc (%zu) failed.\n", bufsz); + close (fd); + return -1; + } + iv[0].iov_len = bufsz; + + /* We optimistically presume that there isn't a remainder and set all iovec + instances to the same base and len as the first instance. */ + for (int i = 1; i < IOV_MAX; i++) + { + /* We don't care what the data is so reuse the allocation from iv[0]; */ + iv[i].iov_base = iv[0].iov_base; + iv[i].iov_len = iv[0].iov_len; + } + + /* If there is a remainder then we correct the last iov_len. */ + if (bufrem) + iv[IOV_MAX - 1].iov_len = bufrem; + + /* Write junk to /dev/null with the writev syscall in order to get a return + of INT32_MAX+1 bytes to verify that the INTERNAL_SYSCALL wrappers aren't + mangling the result if the signbit of a 32-bit number is set. */ + ssize_t ret = writev (fd, iv, IOV_MAX); + + free (iv[0].iov_base); + close (fd); + + if (ret != (ssize_t) EXPECTED) + { + printf ("writev() return value: %zd != EXPECTED: %zd\n", ret, EXPECTED); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/libc/sysdeps/x86_64/elf/configure b/libc/sysdeps/x86_64/elf/configure index f722b9e60..7d02f81bc 100755 --- a/libc/sysdeps/x86_64/elf/configure +++ b/libc/sysdeps/x86_64/elf/configure @@ -46,3 +46,5 @@ fi cat >>confdefs.h <<\_ACEOF #define PI_STATIC_AND_HIDDEN 1 _ACEOF + +# work around problem with autoconf and empty lines at the end of files diff --git a/libc/sysdeps/x86_64/elf/configure.in b/libc/sysdeps/x86_64/elf/configure.in index 9cb59d009..4a41290f1 100644 --- a/libc/sysdeps/x86_64/elf/configure.in +++ b/libc/sysdeps/x86_64/elf/configure.in @@ -32,3 +32,4 @@ fi dnl It is always possible to access static and hidden symbols in an dnl position independent way. AC_DEFINE(PI_STATIC_AND_HIDDEN) +# work around problem with autoconf and empty lines at the end of files diff --git a/libc/sysdeps/x86_64/multiarch/memset-x86-64.S b/libc/sysdeps/x86_64/multiarch/memset-x86-64.S index 5e8cfb3e9..551d105d2 100644 --- a/libc/sysdeps/x86_64/multiarch/memset-x86-64.S +++ b/libc/sysdeps/x86_64/multiarch/memset-x86-64.S @@ -12,6 +12,7 @@ # define END_CHK(name) \ cfi_endproc; .size __memset_chk_x86_64, .-__memset_chk_x86_64 +# undef libc_hidden_builtin_def # define libc_hidden_builtin_def(name) # define memset __memset_x86_64 # include "../memset.S" diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha index d2030d663..82384ac7e 100644 --- a/ports/ChangeLog.alpha +++ b/ports/ChangeLog.alpha @@ -1,3 +1,22 @@ +2011-03-01 Aurelien Jarno <aurelien@aurel32.net> + + * sysdeps/alpha/fpu/feupdateenv.c (feupdateenv): Add libm_hidden_def. + * sysdeps/alpha/fpu/ftestexcept.c (fetestexcept): Likewise. + +2011-02-28 Aurelien Jarno <aurelien@aurel32.net> + + * sysdeps/unix/sysv/linux/alpha/bits/statfs.h (struct statfs, + struct statfs64): Add f_flags field. + +2011-02-28 Aurelien Jarno <aurelien@aurel32.net> + + * sysdeps/alpha/stackinfo.h: Define DEFAULT_STACK_PERMS with PF_X. + +2011-02-28 Aurelien Jarno <aurelien@aurel32.net> + + * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (F_SETPIPE_SZ, + F_GETPIPE_SZ): Define. + 2010-09-26 Michael Cree <mcree@orcon.net.nz> * sysdeps/alpha/memchr.c: Include <bp-sym.h> @@ -127,7 +146,7 @@ return type correct without warning. 2010-03-23 Matt Turner <mattst88@gmail.com> - Aurelien Jarno <aurelien@aurel32.net> + Aurelien Jarno <aurelien@aurel32.net> * sysdeps/unix/sysv/linux/alpha/bits/socket.h: New file. @@ -184,8 +203,8 @@ 2009-07-13 Aurelien Jarno <aurelien@aurel32.net> [BZ #10158] - * sysdeps/unix/sysv/linux/alpha/getsysstats.c (GET_NPROCS_PARSER): - Change parameters and use next_line. + * sysdeps/unix/sysv/linux/alpha/getsysstats.c (GET_NPROCS_PARSER): + Change parameters and use next_line. [BZ #10160] * sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h: Define diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm index 8ea3b9e34..1e05d4187 100644 --- a/ports/ChangeLog.arm +++ b/ports/ChangeLog.arm @@ -1,3 +1,30 @@ +2011-03-05 Nathan Sidwell <nathan@codesourcery.com> + Glauber de Oliveira Costa <glommer@gmail.com> + + * sysdeps/arm/dl-tlsdesc.h: New. + * sysdeps/arm/dl-tls.h (struct dl_tls_index): Make non-anonymous. + * sysdeps/arm/Makefile: Add tlsdesc, dl-tlsdesc for elf + subdirectory. + * sysdeps/arm/tlsdesc.c: New. + * sysdeps/arm/dl-machine.h: #include sysdeps and dl-tlsdesc.h. + (elf_machine_runtime_setup): Record dl_tlsdesc_lazy_resolver + address. + (elf_machine_type_class): Check R_ARM_TLS_DESC. + (elf_machine_rel): Add R_ARM_TLS_DESC case. + (elf_machine_lazy_rel): Likewise. + * sysdeps/arm/dl-tlsdesc.S: New. + * sysdeps/arm/bits/linkmap.h (struct link_map_machine): Add + tlsdesc_table field. + * sysdeps/arm/tlsdesc.sym: New. + * sysdeps/arm/dl-lookupcfg.h: New. + +2011-02-16 Manjunath Matti <manjunath81@gmail.com> + + * sysdeps/arm/sysdep.h (CALL_MCOUNT): Use __gnu_mcount_nc + interface for EABI with GCC 4.4 or later. + (mcount): Define to __gnu_mcount_nc for EABI with GCC 4.4 or + later. + 2011-01-25 Joseph Myers <joseph@codesourcery.com> * sysdeps/unix/sysv/linux/arm/bits/mman.h (MADV_HUGEPAGE, diff --git a/ports/sysdeps/alpha/fpu/feupdateenv.c b/ports/sysdeps/alpha/fpu/feupdateenv.c index c798070bb..7fc38163c 100644 --- a/ports/sysdeps/alpha/fpu/feupdateenv.c +++ b/ports/sysdeps/alpha/fpu/feupdateenv.c @@ -46,4 +46,5 @@ strong_alias (__feupdateenv, __old_feupdateenv) compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1); #endif +libm_hidden_ver (__feupdateenv, feupdateenv) versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2); diff --git a/ports/sysdeps/alpha/fpu/ftestexcept.c b/ports/sysdeps/alpha/fpu/ftestexcept.c index a4b308187..34d8113b3 100644 --- a/ports/sysdeps/alpha/fpu/ftestexcept.c +++ b/ports/sysdeps/alpha/fpu/ftestexcept.c @@ -30,3 +30,4 @@ fetestexcept (int excepts) return tmp & excepts & SWCR_STATUS_MASK; } +libm_hidden_def (fetestexcept) diff --git a/ports/sysdeps/alpha/stackinfo.h b/ports/sysdeps/alpha/stackinfo.h index 0a281bd43..d9dbc357a 100644 --- a/ports/sysdeps/alpha/stackinfo.h +++ b/ports/sysdeps/alpha/stackinfo.h @@ -22,7 +22,13 @@ #ifndef _STACKINFO_H #define _STACKINFO_H 1 +#include <elf.h> + /* On Alpha the stack grows down. */ #define _STACK_GROWS_DOWN 1 +/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is + * present, but it is presumed absent. */ +#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X) + #endif /* stackinfo.h */ diff --git a/ports/sysdeps/arm/Makefile b/ports/sysdeps/arm/Makefile new file mode 100644 index 000000000..565116151 --- /dev/null +++ b/ports/sysdeps/arm/Makefile @@ -0,0 +1,9 @@ +ifeq ($(subdir),elf) +sysdep-dl-routines += tlsdesc dl-tlsdesc +sysdep_routines += tlsdesc dl-tlsdesc +sysdep-rtld-routines += tlsdesc dl-tlsdesc +endif + +ifeq ($(subdir),csu) +gen-as-const-headers += tlsdesc.sym +endif diff --git a/ports/sysdeps/arm/bits/linkmap.h b/ports/sysdeps/arm/bits/linkmap.h index 648976d7d..7c2b4a6da 100644 --- a/ports/sysdeps/arm/bits/linkmap.h +++ b/ports/sysdeps/arm/bits/linkmap.h @@ -1,4 +1,5 @@ struct link_map_machine { Elf32_Addr plt; /* Address of .plt */ + void *tlsdesc_table; /* Address of TLS descriptor hash table. */ }; diff --git a/ports/sysdeps/arm/dl-lookupcfg.h b/ports/sysdeps/arm/dl-lookupcfg.h new file mode 100644 index 000000000..29b2587b4 --- /dev/null +++ b/ports/sysdeps/arm/dl-lookupcfg.h @@ -0,0 +1,28 @@ +/* Configuration of lookup functions. + Copyright (C) 2006, 2010 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DL_UNMAP_IS_SPECIAL + +#include_next <dl-lookupcfg.h> + +struct link_map; + +extern void internal_function _dl_unmap (struct link_map *map); + +#define DL_UNMAP(map) _dl_unmap (map) diff --git a/ports/sysdeps/arm/dl-machine.h b/ports/sysdeps/arm/dl-machine.h index c55576356..9929f76c3 100644 --- a/ports/sysdeps/arm/dl-machine.h +++ b/ports/sysdeps/arm/dl-machine.h @@ -25,6 +25,7 @@ #include <sys/param.h> #include <tls.h> +#include <dl-tlsdesc.h> #define CLEAR_CACHE(BEG,END) \ INTERNAL_SYSCALL_ARM (cacheflush, , 3, (BEG), (END), 0) @@ -127,6 +128,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) the offset on the stack, and then jump to the resolved address. */ got[2] = (Elf32_Addr) &_dl_runtime_resolve; } + + if (l->l_info[ADDRIDX (DT_TLSDESC_GOT)] && lazy) + *(Elf32_Addr*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) + l->l_addr) + = (Elf32_Addr) &_dl_tlsdesc_lazy_resolver; + return lazy; } @@ -239,7 +245,8 @@ _dl_start_user:\n\ #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) # define elf_machine_type_class(type) \ ((((type) == R_ARM_JUMP_SLOT || (type) == R_ARM_TLS_DTPMOD32 \ - || (type) == R_ARM_TLS_DTPOFF32 || (type) == R_ARM_TLS_TPOFF32) \ + || (type) == R_ARM_TLS_DTPOFF32 || (type) == R_ARM_TLS_TPOFF32 \ + || (type) == R_ARM_TLS_DESC) \ * ELF_RTYPE_CLASS_PLT) \ | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY)) #else @@ -421,6 +428,39 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, *reloc_addr += value; break; } + case R_ARM_TLS_DESC: + { + struct tlsdesc volatile *td = + (struct tlsdesc volatile *)reloc_addr; + +# ifndef RTLD_BOOTSTRAP + if (! sym) + td->entry = _dl_tlsdesc_undefweak; + else +# endif + { + value = sym->st_value + td->argument.value; + +# ifndef RTLD_BOOTSTRAP +# ifndef SHARED + CHECK_STATIC_TLS (map, sym_map); +# else + if (!TRY_STATIC_TLS (map, sym_map)) + { + td->argument.pointer + = _dl_make_tlsdesc_dynamic (sym_map, value); + td->entry = _dl_tlsdesc_dynamic; + } + else +# endif +# endif + { + td->argument.value = value + sym_map->l_tls_offset; + td->entry = _dl_tlsdesc_return; + } + } + } + break; case R_ARM_PC24: { Elf32_Sword addend; @@ -612,6 +652,20 @@ elf_machine_lazy_rel (struct link_map *map, else *reloc_addr = map->l_mach.plt; } +#ifdef USE_TLS + else if (__builtin_expect (r_type == R_ARM_TLS_DESC, 1)) + { + struct tlsdesc volatile *td = + (struct tlsdesc volatile *)reloc_addr; + + /* The linker must have given us the parameter we need in the + first GOT entry, and left the second one empty. We fill the + last with the resolver address */ + assert (td->entry == 0); + td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)]) + + map->l_addr); + } +#endif else _dl_reloc_bad_type (map, r_type, 1); } diff --git a/ports/sysdeps/arm/dl-tls.h b/ports/sysdeps/arm/dl-tls.h index e0324a7b6..02285a714 100644 --- a/ports/sysdeps/arm/dl-tls.h +++ b/ports/sysdeps/arm/dl-tls.h @@ -19,7 +19,7 @@ /* Type used for the representation of TLS information in the GOT. */ -typedef struct +typedef struct dl_tls_index { unsigned long int ti_module; unsigned long int ti_offset; diff --git a/ports/sysdeps/arm/dl-tlsdesc.S b/ports/sysdeps/arm/dl-tlsdesc.S new file mode 100644 index 000000000..19e4ed3d0 --- /dev/null +++ b/ports/sysdeps/arm/dl-tlsdesc.S @@ -0,0 +1,222 @@ +/* Thread-local storage handling in the ELF dynamic linker. ARM version. + Copyright (C) 2006, 2010 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <tls.h> +#include "tlsdesc.h" + +#ifdef __USE_BX__ + #define BX(x) bx x +#else + #define BX(x) mov pc, x +#endif + + .text + @ emit debug information with cfi + @ use arm-specific pseudos for unwinding itself + .cfi_sections .debug_frame +#ifdef USE_TLS + .hidden _dl_tlsdesc_return + .global _dl_tlsdesc_return + .type _dl_tlsdesc_return,#function + cfi_startproc + .fnstart + .align 2 +_dl_tlsdesc_return: + ldr r0, [r0] + BX (lr) + .fnend + cfi_endproc + .size _dl_tlsdesc_return, .-_dl_tlsdesc_return + + .hidden _dl_tlsdesc_undefweak + .global _dl_tlsdesc_undefweak + .type _dl_tlsdesc_undefweak,#function + cfi_startproc + .fnstart + .align 2 +_dl_tlsdesc_undefweak: + @ Are we allowed a misaligned stack pointer calling read_tp? + .save {lr} + stmdb sp!, {lr} + cfi_adjust_cfa_offset (4) + cfi_rel_offset (lr,0) + bl __aeabi_read_tp + rsb r0, r0, #0 + ldmia sp!, {lr} + cfi_adjust_cfa_offset (-4) + cfi_restore (lr) + BX (lr) + + cfi_endproc + .fnend + .size _dl_tlsdesc_undefweak, .-_dl_tlsdesc_undefweak + +#ifdef SHARED + .hidden _dl_tlsdesc_dynamic + .global _dl_tlsdesc_dynamic + .type _dl_tlsdesc_dynamic,#function + + +/* + The assembly code that follows is a rendition of the following + C code, hand-optimized a little bit. + +ptrdiff_t +_dl_tlsdesc_dynamic(struct tlsdesc *tdp) +{ + struct tlsdesc_dynamic_arg *td = tdp->argument.pointer; + dtv_t *dtv = (dtv_t *)THREAD_DTV(); + if (__builtin_expect (td->gen_count <= dtv[0].counter + && dtv[td->tlsinfo.ti_module].pointer.val + != TLS_DTV_UNALLOCATED, + 1)) + return dtv[td->tlsinfo.ti_module].pointer.val + + td->tlsinfo.ti_offset - __builtin_thread_pointer(); + + return __tls_get_addr (&td->tlsinfo) - __builtin_thread_pointer(); +} + +*/ + cfi_startproc + .fnstart + .align 2 +_dl_tlsdesc_dynamic: + /* Our calling convention is to clobber r0, r1 and the processor + flags. All others that are modified must be saved */ + .save {r2,r3,r4,lr} + stmdb sp!, {r2,r3,r4,lr} + cfi_adjust_cfa_offset (16) + cfi_rel_offset (r2,0) + cfi_rel_offset (r3,4) + cfi_rel_offset (r4,8) + cfi_rel_offset (lr,12) + ldr r1, [r0] /* td */ + bl __aeabi_read_tp + mov r4, r0 /* r4 = tp */ + ldr r0, [r0] + ldr r2, [r1, #8] /* gen_count */ + ldr r3, [r0] + cmp r2, r3 + bhi 1f + ldr r3, [r1] + ldr r2, [r0, r3, lsl #3] + cmn r2, #1 + ldrne r3, [r1, #4] + addne r3, r2, r3 + rsbne r0, r4, r3 + bne 2f +1: mov r0, r1 + bl __tls_get_addr + rsb r0, r4, r0 +2: ldmia sp!, {r2,r3,r4, lr} + cfi_adjust_cfa_offset (-16) + cfi_restore (lr) + cfi_restore (r4) + cfi_restore (r3) + cfi_restore (r2) + BX (lr) + .fnend + cfi_endproc + .size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic +#endif /* SHARED */ + +/* lazy resolved for tls descriptors. */ + .hidden _dl_tlsdesc_lazy_resolver + .global _dl_tlsdesc_lazy_resolver + .type _dl_tlsdesc_lazy_resolver,#function + cfi_startproc + .fnstart + .align 2 +_dl_tlsdesc_lazy_resolver: + /* r0 points at the tlsdesc, + r1 points at the GOT + r2 was pushed by the trampoline and used as a temp, + we need to pop it here. + We push the remaining call-clobbered registers here, and also + R1 -- to keep the stack correctly aligned. */ + /* Tell the unwinder that r2 has already been pushed. */ + .save {r2} + cfi_adjust_cfa_offset (4) + cfi_rel_offset (r2, 0) + .save {r0,r1,r3,ip,lr} + stmdb sp!, {r0, r1, r3, ip, lr} + cfi_adjust_cfa_offset (20) + cfi_rel_offset (r0, 0) + cfi_rel_offset (r1, 4) + cfi_rel_offset (r3, 8) + cfi_rel_offset (ip, 12) + cfi_rel_offset (lr, 16) + bl _dl_tlsdesc_lazy_resolver_fixup + ldmia sp!, {r0, r1, r3, ip, lr} + cfi_adjust_cfa_offset (-20) + cfi_restore (lr) + cfi_restore (ip) + cfi_restore (r3) + cfi_restore (r1) + cfi_restore (r0) + ldmia sp!, {r2} + cfi_adjust_cfa_offset (-4) + cfi_restore (r2) + ldr r1, [r0, #4] + BX (r1) + .fnend + cfi_endproc + .size _dl_tlsdesc_lazy_resolver, .-_dl_tlsdesc_lazy_resolver + +/* Holder for lazy tls descriptors being resolve in another thread. + Same ABI as the lazy resolver itself. */ + .hidden _dl_tlsdesc_resolve_hold + .global _dl_tlsdesc_resolve_hold + .type _dl_tlsdesc_resolve_hold,#function + cfi_startproc + .fnstart + .align 2 +_dl_tlsdesc_resolve_hold: + /* Tell the unwinder that r2 has already been pushed. */ + .save {r2} + cfi_adjust_cfa_offset (4) + cfi_rel_offset (r2, 0) + .save {r0,r1,r3,ip,lr} + stmdb sp!, {r0, r1, r3, ip, lr} + cfi_adjust_cfa_offset (20) + cfi_rel_offset (r0, 0) + cfi_rel_offset (r1, 4) + cfi_rel_offset (r3, 8) + cfi_rel_offset (ip, 12) + cfi_rel_offset (lr, 16) + adr r2, _dl_tlsdesc_resolve_hold + bl _dl_tlsdesc_resolve_hold_fixup + ldmia sp!, {r0, r1, r3, ip, lr} + cfi_adjust_cfa_offset (-20) + cfi_restore (lr) + cfi_restore (ip) + cfi_restore (r3) + cfi_restore (r1) + cfi_restore (r0) + ldmia sp!, {r2} + cfi_adjust_cfa_offset (-4) + cfi_restore (r2) + ldr r1, [r0, #4] + BX (r1) + .fnend + cfi_endproc + .size _dl_tlsdesc_resolve_hold, .-_dl_tlsdesc_resolve_hold + +#endif /* USE_TLS */ diff --git a/ports/sysdeps/arm/dl-tlsdesc.h b/ports/sysdeps/arm/dl-tlsdesc.h new file mode 100644 index 000000000..3817d7e5d --- /dev/null +++ b/ports/sysdeps/arm/dl-tlsdesc.h @@ -0,0 +1,69 @@ +/* Thread-local storage descriptor handling in the ELF dynamic linker. + ARM version. + Copyright (C) 2005, 2010 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; witout even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ARM_DL_TLSDESC_H +# define _ARM_DL_TLSDESC_H 1 + +/* Use this to access DT_TLSDESC_PLT and DT_TLSDESC_GOT. */ +#ifndef ADDRIDX +# define ADDRIDX(tag) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \ + + DT_EXTRANUM + DT_VALNUM + DT_ADDRTAGIDX (tag)) +#endif + +/* Type used to represent a TLS descriptor in the GOT. */ +struct tlsdesc +{ + union + { + void *pointer; + long value; + } argument; + ptrdiff_t (*entry)(struct tlsdesc *); +}; + + +typedef struct dl_tls_index +{ + unsigned long int ti_module; + unsigned long int ti_offset; +} tls_index; + +/* Type used as the argument in a TLS descriptor for a symbol that + needs dynamic TLS offsets. */ +struct tlsdesc_dynamic_arg +{ + tls_index tlsinfo; + size_t gen_count; +}; + +extern ptrdiff_t attribute_hidden + _dl_tlsdesc_return(struct tlsdesc *), + _dl_tlsdesc_undefweak(struct tlsdesc *), + _dl_tlsdesc_resolve_hold(struct tlsdesc *), + _dl_tlsdesc_lazy_resolver(struct tlsdesc *); + +# ifdef SHARED +extern void *_dl_make_tlsdesc_dynamic (struct link_map *map, size_t ti_offset); + +extern ptrdiff_t attribute_hidden + _dl_tlsdesc_dynamic(struct tlsdesc *); +# endif + +#endif diff --git a/ports/sysdeps/arm/sysdep.h b/ports/sysdeps/arm/sysdep.h index 9ffd7df2b..5c01ef0e2 100644 --- a/ports/sysdeps/arm/sysdep.h +++ b/ports/sysdeps/arm/sysdep.h @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include <sysdeps/generic/sysdep.h> +#include <features.h> #if (!defined (__ARM_ARCH_2__) && !defined (__ARM_ARCH_3__) \ && !defined (__ARM_ARCH_3M__) && !defined (__ARM_ARCH_4__)) @@ -92,6 +93,16 @@ /* If compiled for profiling, call `mcount' at the start of each function. */ #ifdef PROF +/* Call __gnu_mcount_nc if GCC >= 4.4 and abi = EABI. */ +#if __GNUC_PREREQ(4,4) && defined(__ARM_EABI__) +#define CALL_MCOUNT \ + str lr,[sp, #-4]!; \ + cfi_adjust_cfa_offset (4); \ + cfi_rel_offset (lr, 0); \ + bl PLTJMP(mcount); \ + cfi_adjust_cfa_offset (-4); \ + cfi_restore (lr) +#else /* else call _mcount */ #define CALL_MCOUNT \ str lr,[sp, #-4]!; \ cfi_adjust_cfa_offset (4); \ @@ -100,6 +111,7 @@ ldr lr, [sp], #4; \ cfi_adjust_cfa_offset (-4); \ cfi_restore (lr) +#endif #else #define CALL_MCOUNT /* Do nothing. */ #endif @@ -109,8 +121,12 @@ on this system, the asm identifier `syscall_error' intrudes on the C name space. Make sure we use an innocuous name. */ #define syscall_error __syscall_error +#if __GNUC_PREREQ(4,4) && defined(__ARM_EABI__) +#define mcount __gnu_mcount_nc +#else #define mcount _mcount #endif +#endif #if defined(__ARM_EABI__) /* Tag_ABI_align8_preserved: This code preserves 8-byte diff --git a/ports/sysdeps/arm/tlsdesc.c b/ports/sysdeps/arm/tlsdesc.c new file mode 100644 index 000000000..e0b970f00 --- /dev/null +++ b/ports/sysdeps/arm/tlsdesc.c @@ -0,0 +1,164 @@ +/* Manage TLS descriptors. ARM version. + Copyright (C) 2005, 2010 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <link.h> +#include <ldsodefs.h> +#include <elf/dynamic-link.h> +#include <tls.h> +#include <dl-tlsdesc.h> +#include <tlsdeschtab.h> + +#ifdef USE_TLS + +/* This function is used to lazily resolve TLS_DESC REL relocations + Besides the TLS descriptor itself, we get the module's got address + as the second parameter. */ + +void +attribute_hidden +_dl_tlsdesc_lazy_resolver_fixup (struct tlsdesc volatile *td, + Elf32_Addr *got) +{ + struct link_map *l = (struct link_map *)got[1]; + lookup_t result; + unsigned long value; + + if (_dl_tlsdesc_resolve_early_return_p + (td, (void*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_PLT)]) + l->l_addr))) + return; + + if (td->argument.value & 0x80000000) + { + /* A global symbol, this is the symbol index. */ + /* The code below was borrowed from _dl_fixup(). */ + const Elf_Symndx symndx = td->argument.value ^ 0x80000000; + const ElfW(Sym) *const symtab + = (const void *) D_PTR (l, l_info[DT_SYMTAB]); + const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]); + const ElfW(Sym) *sym = &symtab[symndx]; + + /* Look up the target symbol. If the normal lookup rules are not + used don't look in the global scope. */ + if (ELFW(ST_BIND) (sym->st_info) != STB_LOCAL + && __builtin_expect (ELFW(ST_VISIBILITY) (sym->st_other), 0) == 0) + { + const struct r_found_version *version = NULL; + + if (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL) + { + const ElfW(Half) *vernum = + (const void *) D_PTR (l, l_info[VERSYMIDX (DT_VERSYM)]); + ElfW(Half) ndx = vernum[symndx] & 0x7fff; + version = &l->l_versions[ndx]; + if (version->hash == 0) + version = NULL; + } + + result = _dl_lookup_symbol_x + (strtab + sym->st_name, l, &sym, + l->l_scope, version, ELF_RTYPE_CLASS_PLT, + DL_LOOKUP_ADD_DEPENDENCY, NULL); + if (sym) + value = sym->st_value; + else + { + td->entry = _dl_tlsdesc_undefweak; + goto done; + } + } + else + { + /* We already found the symbol. The module (and therefore its load + address) is also known. */ + result = l; + value = sym->st_value; + } + } + else + { + /* A local symbol, this is the offset within our tls section. + */ + value = td->argument.value; + result = l; + } + +#ifndef SHARED + CHECK_STATIC_TLS (l, result); +#else + if (!TRY_STATIC_TLS (l, result)) + { + td->argument.pointer = _dl_make_tlsdesc_dynamic (result, value); + td->entry = _dl_tlsdesc_dynamic; + } + else +#endif + { + td->argument.value = value + result->l_tls_offset; + td->entry = _dl_tlsdesc_return; + } + + done: + _dl_tlsdesc_wake_up_held_fixups (); +} + +/* This function is used to avoid busy waiting for other threads to + complete the lazy relocation. Once another thread wins the race to + relocate a TLS descriptor, it sets the descriptor up such that this + function is called to wait until the resolver releases the + lock. */ + +void +attribute_hidden +_dl_tlsdesc_resolve_hold_fixup (struct tlsdesc volatile *td, + void *caller) +{ + /* Maybe we're lucky and can return early. */ + if (caller != td->entry) + return; + + /* Locking here will stop execution until the running resolver runs + _dl_tlsdesc_wake_up_held_fixups(), releasing the lock. + + FIXME: We'd be better off waiting on a condition variable, such + that we didn't have to hold the lock throughout the relocation + processing. */ + __rtld_lock_lock_recursive (GL(dl_load_lock)); + __rtld_lock_unlock_recursive (GL(dl_load_lock)); +} + +/* Unmap the dynamic object, but also release its TLS descriptor table + if there is one. */ + +void +internal_function +_dl_unmap (struct link_map *map) +{ + __munmap ((void *) (map)->l_map_start, + (map)->l_map_end - (map)->l_map_start); + +#if SHARED + /* _dl_unmap is only called for dlopen()ed libraries, for which + calling free() is safe, or before we've completed the initial + relocation, in which case calling free() is probably pointless, + but still safe. */ + if (map->l_mach.tlsdesc_table) + htab_delete (map->l_mach.tlsdesc_table); +#endif +} +#endif diff --git a/ports/sysdeps/arm/tlsdesc.sym b/ports/sysdeps/arm/tlsdesc.sym new file mode 100644 index 000000000..a1deb2117 --- /dev/null +++ b/ports/sysdeps/arm/tlsdesc.sym @@ -0,0 +1,19 @@ +#include <stddef.h> +#include <sysdep.h> +#include <tls.h> +#include <link.h> +#include <dl-tlsdesc.h> + +-- + +-- Abuse tls.h macros to derive offsets relative to the thread register. +#if defined USE_TLS + + +TLSDESC_ARG offsetof(struct tlsdesc, argument.pointer) + +TLSDESC_GEN_COUNT offsetof(struct tlsdesc_dynamic_arg, gen_count) +TLSDESC_MODID offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module) +TLSDESC_MODOFF offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset) + +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h index 860e9ac3e..e5e726bf4 100644 --- a/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h @@ -97,6 +97,8 @@ # define F_SETLEASE 1024 /* Set a lease. */ # define F_GETLEASE 1025 /* Enquire what lease is active. */ # define F_NOTIFY 1026 /* Request notfications on a directory. */ +# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ +# define F_GETPIPE_SZ 1032 /* Set pipe page size array. */ #endif #ifdef __USE_XOPEN2K8 # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/statfs.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/statfs.h index d838e6bf4..157591d2e 100644 --- a/ports/sysdeps/unix/sysv/linux/alpha/bits/statfs.h +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/statfs.h @@ -42,7 +42,8 @@ struct statfs __fsid_t f_fsid; int f_namelen; int f_frsize; - int f_spare[5]; + int f_flags; + int f_spare[4]; }; #ifdef __USE_LARGEFILE64 @@ -58,7 +59,8 @@ struct statfs64 __fsid_t f_fsid; int f_namelen; int f_frsize; - int f_spare[5]; + int f_flags; + int f_spare[4]; }; #endif |