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

[commits] r8517 - in /fsf/trunk/libc: ./ csu/ elf/ include/ sysdeps/generic/ sysdeps/i386/ sysdeps/unix/sysv/linux/i386/ sysdeps/x86_6...



Author: eglibc
Date: Mon Jun  1 00:09:13 2009
New Revision: 8517

Log:
Import glibc-mainline for 2009-06-01

Added:
    fsf/trunk/libc/sysdeps/generic/dl-irel.h
    fsf/trunk/libc/sysdeps/i386/dl-irel.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/internal_accept4.S
    fsf/trunk/libc/sysdeps/x86_64/dl-irel.h
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/configure
    fsf/trunk/libc/configure.in
    fsf/trunk/libc/csu/elf-init.c
    fsf/trunk/libc/elf/elf.h
    fsf/trunk/libc/include/libc-symbols.h
    fsf/trunk/libc/sysdeps/i386/dl-machine.h
    fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c
    fsf/trunk/libc/sysdeps/x86_64/dl-machine.h
    fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.c
    fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h
    fsf/trunk/libc/sysdeps/x86_64/multiarch/sched_cpucount.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Jun  1 00:09:13 2009
@@ -1,3 +1,57 @@
+2009-05-31  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/sched_cpucount.c: Also use optimized code
+	for !SHARED.
+
+2009-05-29  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* csu/elf-init.c: Include <link.h> and <dl-irel.h> if LIBC_NONSHARED
+	is not defined.
+	(__rela_iplt_start): New declaration.
+	(__rela_iplt_end): Likewise.
+	(__rel_iplt_start): Likewise.
+	(__rel_iplt_end): Likewise.
+	(__libc_csu_init): Process __rela_iplt_start and __rel_iplt_start.
+	* elf/elf.h (R_386_IRELATIVE): New macro.
+	(R_X86_64_IRELATIVE): New macro.
+	(R_386_NUM): Updated.
+	(R_X86_64_NUM): Likewise.
+	* include/libc-symbols.h (libc_ifunc_hidden_def1): New macro.
+	(libc_ifunc_hidden_def): New macro.
+	* sysdeps/generic/dl-irel.h: New file.
+	* sysdeps/i386/dl-irel.h: New file.
+	* sysdeps/x86_64/dl-irel.h: New file.
+	* sysdeps/i386/dl-machine.h (elf_machine_rel): Handle R_386_IRELATIVE.
+	(elf_machine_rela): Check SHN_UNDEF for STT_GNU_IFUNC symbol.
+	Handle R_386_IRELATIVE.
+	(elf_machine_lazy_rel): Handle R_386_IRELATIVE.
+	(elf_machine_lazy_rela): Likewise.
+	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Handle
+	R_X86_64_IRELATIVE.
+	(elf_machine_lazy_rel): Handle R_X86_64_IRELATIVE.
+
+2009-05-31  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/init-arch.h: Define COMMON_CPUID_INDEX_1
+	instead of INTEL_CPUID_INDEX_1 and AMD_CPUID_INDEX_1.  So far there
+	are no differences.  If an architecture has bits in CPUID index 1
+	meaning different things the values for the COMMON_CPUID_INDEX_1
+	index must not be set.
+	(INTEL_HAS_POPCOUNT, AMD_HAS_POPCOUNT): Removed in favor of...
+	(HAS_POPCOUNT): ...this.  New macro.
+	* sysdeps/x86_64/multiarch/init-arch.c: Use COMMON_CPUID_INDEX_1
+	instead of INTEL_CPUID_INDEX_1 and AMD_CPUID_INDEX_1.  Unify code
+	to set the value for Intel and AMD architectures.
+	* sysdeps/x86_64/cacheinfo.c: Use COMMON_CPUID_INDEX_1 instead of
+	INTEL_CPUID_INDEX_1.
+	* sysdeps/x86_64/multiarch/sched_cpucount.c: Adjust for HAS_POPCOUNT
+	change.
+
+2009-05-30  Andreas Schwab  <schwab@xxxxxxxxxxxxxx>
+
+	* configure.in: Move AC_CANONICAL_HOST before first use of $host
+	and $build.
+
 2009-05-29  Jakub Jelinek  <jakub@xxxxxxxxxx>
 
 	* sysdeps/ieee754/ldbl-128/s_expm1l.c: Include <errno.h>.
@@ -8,8 +62,6 @@
 	(__cosl): Set errno to EDOM for ±Inf.
 	* sysdeps/ieee754/ldbl-128/s_sinl.c: Include <errno.h>.
 	(__sinl): Set errno to EDOM for ±Inf.
-
-2009-05-29  Jakub Jelinek  <jakub@xxxxxxxxxx>
 
 	* sysdeps/s390/s390-32/__longjmp.c (__longjmp): If CHECK_SP is
 	defined, use it.

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Mon Jun  1 00:09:13 2009
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2009-5-15
+GNU C Library NEWS -- history of user-visible changes.  2009-5-31
 Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -9,6 +9,9 @@
 
 * checking version of longjmp added that fails if an uninitialized stack
   frame would be created.  Implemented by Ulrich Drepper.
+
+* STT_GNU_IFUNC is now supported in static executables.
+  Implemented by H.J. Lu.
 
 
 Version 2.10

Modified: fsf/trunk/libc/configure
==============================================================================
--- fsf/trunk/libc/configure (original)
+++ fsf/trunk/libc/configure Mon Jun  1 00:09:13 2009
@@ -726,14 +726,6 @@
 add_on_subdirs
 add_ons
 subdirs
-host_os
-host_vendor
-host_cpu
-host
-build_os
-build_vendor
-build_cpu
-build
 libc_cv_nss_crypt
 experimental_malloc
 multi_arch
@@ -756,6 +748,14 @@
 LDFLAGS
 CFLAGS
 CC
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
 target_alias
 host_alias
 build_alias
@@ -2011,6 +2011,90 @@
 
 
 
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+$as_echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+$as_echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3842,90 +3926,6 @@
 else
   libc_cv_nss_crypt=no
 fi
-
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
-
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:$LINENO: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
 
 
 # The way shlib-versions is used to generate soversions.mk uses a

Modified: fsf/trunk/libc/configure.in
==============================================================================
--- fsf/trunk/libc/configure.in (original)
+++ fsf/trunk/libc/configure.in Mon Jun  1 00:09:13 2009
@@ -5,6 +5,8 @@
 AC_CONFIG_SRCDIR([include/features.h])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([scripts])
+
+AC_CANONICAL_HOST
 
 AC_PROG_CC
 if test $host != $build; then
@@ -315,8 +317,6 @@
   libc_cv_nss_crypt=no
 fi
 AC_SUBST(libc_cv_nss_crypt)
-
-AC_CANONICAL_HOST
 
 # The way shlib-versions is used to generate soversions.mk uses a
 # fairly simplistic model for name recognition that can't distinguish

Modified: fsf/trunk/libc/csu/elf-init.c
==============================================================================
--- fsf/trunk/libc/csu/elf-init.c (original)
+++ fsf/trunk/libc/csu/elf-init.c Mon Jun  1 00:09:13 2009
@@ -36,6 +36,20 @@
 
 #include <stddef.h>
 
+#ifndef LIBC_NONSHARED
+# include <link.h>
+# include <dl-irel.h>
+
+# ifdef ELF_MACHINE_IRELA
+extern const ElfW(Rela) __rela_iplt_start [];
+extern const ElfW(Rela) __rela_iplt_end [];
+# endif
+
+# ifdef ELF_MACHINE_IREL
+extern const ElfW(Rel) __rel_iplt_start [];
+extern const ElfW(Rel) __rel_iplt_end [];
+# endif
+#endif	/* LIBC_NONSHARED */
 
 /* These magic symbols are provided by the linker.  */
 extern void (*__preinit_array_start []) (int, char **, char **)
@@ -67,6 +81,22 @@
      the dynamic linker (before initializing any shared object.  */
 
 #ifndef LIBC_NONSHARED
+# ifdef ELF_MACHINE_IRELA
+  {
+    const size_t size = __rela_iplt_end - __rela_iplt_start;
+    for (size_t i = 0; i < size; i++)
+      elf_irela (&__rela_iplt_start [i]);
+  }
+# endif
+
+# ifdef ELF_MACHINE_IREL
+  {
+    const size_t size = __rel_iplt_end - __rel_iplt_start;
+    for (size_t i = 0; i < size; i++)
+      elf_irel (&__rel_iplt_start [i]);
+  }
+# endif
+
   /* For static executables, preinit happens rights before init.  */
   {
     const size_t size = __preinit_array_end - __preinit_array_start;

Modified: fsf/trunk/libc/elf/elf.h
==============================================================================
--- fsf/trunk/libc/elf/elf.h (original)
+++ fsf/trunk/libc/elf/elf.h Mon Jun  1 00:09:13 2009
@@ -1177,8 +1177,9 @@
 					   pointer to code and to
 					   argument, returning the TLS
 					   offset for the symbol.  */
+#define R_386_IRELATIVE	   42		/* Adjust indirectly by program base */
 /* Keep this the last entry.  */
-#define R_386_NUM	   42
+#define R_386_NUM	   43
 
 /* SUN SPARC specific definitions.  */
 
@@ -2625,8 +2626,9 @@
 #define R_X86_64_TLSDESC_CALL   35	/* Marker for call through TLS
 					   descriptor.  */
 #define R_X86_64_TLSDESC        36	/* TLS descriptor.  */
-
-#define R_X86_64_NUM		37
+#define R_X86_64_IRELATIVE	37	/* Adjust indirectly by program base */
+
+#define R_X86_64_NUM		38
 
 
 /* AM33 relocations.  */

Modified: fsf/trunk/libc/include/libc-symbols.h
==============================================================================
--- fsf/trunk/libc/include/libc-symbols.h (original)
+++ fsf/trunk/libc/include/libc-symbols.h Mon Jun  1 00:09:13 2009
@@ -845,4 +845,21 @@
   }									\
   __asm__ (".type " #name ", %gnu_indirect_function");
 
+#ifdef HAVE_ASM_SET_DIRECTIVE
+# define libc_ifunc_hidden_def1(local, name)				\
+    __asm__ (declare_symbol_alias_1_stringify (ASM_GLOBAL_DIRECTIVE)	\
+	     " " #local "\n\t"						\
+	     ".hidden " #local "\n\t"					\
+	     ".set " #local ", " #name);
+#else
+# define libc_ifunc_hidden_def1(local, name)				\
+    __asm__ (declare_symbol_alias_1_stringify (ASM_GLOBAL_DIRECTIVE)	\
+	     " " #local "\n\t"						\
+	     ".hidden " #local "\n\t"					\
+	     #local " = " #name);
+#endif
+
+#define libc_ifunc_hidden_def(name) \
+  libc_ifunc_hidden_def1 (__GI_##name, name)
+
 #endif /* libc-symbols.h */

Added: fsf/trunk/libc/sysdeps/generic/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/dl-irel.h (added)
+++ fsf/trunk/libc/sysdeps/generic/dl-irel.h Mon Jun  1 00:09:13 2009
@@ -1,0 +1,23 @@
+/* Machine-dependent ELF indirect relocation inline 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.  */
+
+#ifndef _DL_IREL_h
+#define _DL_IREL_H
+
+#endif /* dl-irel.h */

Added: fsf/trunk/libc/sysdeps/i386/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/dl-irel.h (added)
+++ fsf/trunk/libc/sysdeps/i386/dl-irel.h Mon Jun  1 00:09:13 2009
@@ -1,0 +1,44 @@
+/* Machine-dependent ELF indirect relocation inline functions.
+   i386 version.
+   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 _DL_IREL_H
+#define _DL_IREL_H
+
+#include <unistd.h>
+
+#define ELF_MACHINE_IREL	1
+
+static inline void
+__attribute ((always_inline))
+elf_irel (const Elf32_Rel *reloc)
+{
+  Elf32_Addr *const reloc_addr = (void *) reloc->r_offset;
+  const unsigned long int r_type = ELF32_R_TYPE (reloc->r_info);
+
+  if (__builtin_expect (r_type == R_386_IRELATIVE, 1))
+    {
+      Elf64_Addr value = ((Elf32_Addr (*) (void)) (*reloc_addr)) ();
+      *reloc_addr = value;
+    }
+  else
+    _exit (-1);
+}
+
+#endif /* dl-irel.h */

Modified: fsf/trunk/libc/sysdeps/i386/dl-machine.h
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/dl-machine.h (original)
+++ fsf/trunk/libc/sysdeps/i386/dl-machine.h Mon Jun  1 00:09:13 2009
@@ -345,6 +345,7 @@
       Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
 
       if (sym != NULL
+	  && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
 	  && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
 			       0))
 	value = ((Elf32_Addr (*) (void)) value) ();
@@ -471,6 +472,11 @@
 	  memcpy (reloc_addr_arg, (void *) value,
 		  MIN (sym->st_size, refsym->st_size));
 	  break;
+	case R_386_IRELATIVE:
+	  value = map->l_addr + *reloc_addr;
+	  value = ((Elf32_Addr (*) (void)) value) ();
+	  *reloc_addr = value;
+	  break;
 	default:
 	  _dl_reloc_bad_type (map, r_type, 0);
 	  break;
@@ -500,6 +506,7 @@
       Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
 
       if (sym != NULL
+	  && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
 	  && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
 			       0))
 	value = ((Elf32_Addr (*) (void)) value) ();
@@ -609,6 +616,11 @@
 		  MIN (sym->st_size, refsym->st_size));
 	  break;
 #  endif /* !RESOLVE_CONFLICT_FIND_MAP */
+	case R_386_IRELATIVE:
+	  value = map->l_addr + reloc->r_addend;
+	  value = ((Elf32_Addr (*) (void)) value) ();
+	  *reloc_addr = value;
+	  break;
 	default:
 	  /* We add these checks in the version to relocate ld.so only
 	     if we are still debugging.  */
@@ -703,6 +715,12 @@
 # endif
 	}
     }
+  else if (__builtin_expect (r_type == R_386_IRELATIVE, 0))
+    {
+      Elf32_Addr value = map->l_addr + *reloc_addr;
+      value = ((Elf32_Addr (*) (void)) value) ();
+      *reloc_addr = value;
+    }
   else
     _dl_reloc_bad_type (map, r_type, 1);
 }
@@ -726,6 +744,12 @@
       td->arg = (void*)reloc;
       td->entry = _dl_tlsdesc_resolve_rela;
     }
+  else if (__builtin_expect (r_type == R_386_IRELATIVE, 0))
+    {
+      Elf32_Addr value = map->l_addr + reloc->r_addend;
+      value = ((Elf32_Addr (*) (void)) value) ();
+      *reloc_addr = value;
+    }
   else
     _dl_reloc_bad_type (map, r_type, 1);
 }

Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/internal_accept4.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/internal_accept4.S (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/internal_accept4.S Mon Jun  1 00:09:13 2009
@@ -1,0 +1,1 @@
+/* Not needed, accept4.S has everything.  */

Modified: fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c Mon Jun  1 00:09:13 2009
@@ -489,10 +489,10 @@
 	}
 
 #ifdef USE_MULTIARCH
-      eax = __cpu_features.cpuid[INTEL_CPUID_INDEX_1].eax;
-      ebx = __cpu_features.cpuid[INTEL_CPUID_INDEX_1].ebx;
-      ecx = __cpu_features.cpuid[INTEL_CPUID_INDEX_1].ecx;
-      edx = __cpu_features.cpuid[INTEL_CPUID_INDEX_1].edx;
+      eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
+      ebx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ebx;
+      ecx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx;
+      edx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx;
 #else
       asm volatile ("cpuid"
 		    : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)

Added: fsf/trunk/libc/sysdeps/x86_64/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/dl-irel.h (added)
+++ fsf/trunk/libc/sysdeps/x86_64/dl-irel.h Mon Jun  1 00:09:13 2009
@@ -1,0 +1,44 @@
+/* Machine-dependent ELF indirect relocation inline functions.
+   x86-64 version.
+   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 _DL_IREL_H
+#define _DL_IREL_H
+
+#include <unistd.h>
+
+#define ELF_MACHINE_IRELA	1
+
+static inline void
+__attribute ((always_inline))
+elf_irela (const Elf64_Rela *reloc)
+{
+  Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
+  const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
+
+  if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 1))
+    {
+      Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) ();
+      *reloc_addr = value;
+    }
+  else
+    _exit (-1);
+}
+
+#endif /* dl-irel.h */

Modified: fsf/trunk/libc/sysdeps/x86_64/dl-machine.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/dl-machine.h (original)
+++ fsf/trunk/libc/sysdeps/x86_64/dl-machine.h Mon Jun  1 00:09:13 2009
@@ -297,6 +297,7 @@
 			  : (Elf64_Addr) sym_map->l_addr + sym->st_value);
 
       if (sym != NULL
+	  && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
 	  && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
 			       0))
 	value = ((Elf64_Addr (*) (void)) value) ();
@@ -442,6 +443,11 @@
 	    }
 	  break;
 #  endif
+	case R_X86_64_IRELATIVE:
+	  value = map->l_addr + reloc->r_addend;
+	  value = ((Elf64_Addr (*) (void)) value) ();
+	  *reloc_addr = value;
+	  break;
 	default:
 	  _dl_reloc_bad_type (map, r_type, 0);
 	  break;
@@ -488,6 +494,12 @@
       td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
 			  + map->l_addr);
     }
+  else if (__builtin_expect (r_type == R_X86_64_IRELATIVE, 0))
+    {
+      Elf64_Addr value = map->l_addr + reloc->r_addend;
+      value = ((Elf64_Addr (*) (void)) value) ();
+      *reloc_addr = value;
+    }
   else
     _dl_reloc_bad_type (map, r_type, 1);
 }

Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.c Mon Jun  1 00:09:13 2009
@@ -1,6 +1,6 @@
 /* Initialize CPU feature data.
    This file is part of the GNU C Library.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -41,11 +41,12 @@
     {
       __cpu_features.kind = arch_kind_intel;
 
+    get_common_cpuid:
       asm volatile ("cpuid"
-		    : "=a" (__cpu_features.cpuid[INTEL_CPUID_INDEX_1].eax),
-		      "=b" (__cpu_features.cpuid[INTEL_CPUID_INDEX_1].ebx),
-		      "=c" (__cpu_features.cpuid[INTEL_CPUID_INDEX_1].ecx),
-		      "=d" (__cpu_features.cpuid[INTEL_CPUID_INDEX_1].edx)
+		    : "=a" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax),
+		      "=b" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ebx),
+		      "=c" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx),
+		      "=d" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx)
 		    : "0" (1));
     }
   /* This spells out "AuthenticAMD".  */
@@ -53,12 +54,7 @@
     {
       __cpu_features.kind = arch_kind_amd;
 
-      asm volatile ("cpuid"
-		    : "=a" (__cpu_features.cpuid[AMD_CPUID_INDEX_1].eax),
-		      "=b" (__cpu_features.cpuid[AMD_CPUID_INDEX_1].ebx),
-		      "=c" (__cpu_features.cpuid[AMD_CPUID_INDEX_1].ecx),
-		      "=d" (__cpu_features.cpuid[AMD_CPUID_INDEX_1].edx)
-		    : "0" (1));
+      goto get_common_cpuid;
     }
   else
     __cpu_features.kind = arch_kind_other;

Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h Mon Jun  1 00:09:13 2009
@@ -1,5 +1,5 @@
 /* This file is part of the GNU C Library.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -20,16 +20,9 @@
 
 enum
   {
-    INTEL_CPUID_INDEX_1 = 0,
+    COMMON_CPUID_INDEX_1 = 0,
     /* Keep the following line at the end.  */
-    INTEL_CPUID_INDEX_MAX
-  };
-
-enum
-  {
-    AMD_CPUID_INDEX_1 = 0,
-    /* Keep the following line at the end.  */
-    AMD_CPUID_INDEX_MAX
+    COMMON_CPUID_INDEX_MAX
   };
 
 extern struct cpu_features
@@ -48,7 +41,7 @@
     unsigned int ebx;
     unsigned int ecx;
     unsigned int edx;
-  } cpuid[MAX (INTEL_CPUID_INDEX_MAX, AMD_CPUID_INDEX_MAX)];
+  } cpuid[COMMON_CPUID_INDEX_MAX];
 } __cpu_features attribute_hidden;
 
 
@@ -61,10 +54,5 @@
 
 /* Following are the feature tests used throughout libc.  */
 
-#define INTEL_HAS_POPCOUNT \
-  (__cpu_features.kind == arch_kind_intel				\
-   && (__cpu_features.cpuid[INTEL_CPUID_INDEX_1].ecx & (1 << 23)) != 0)
-
-#define AMD_HAS_POPCOUNT \
-  (__cpu_features.kind == arch_kind_amd				\
-   && (__cpu_features.cpuid[AMD_CPUID_INDEX_1].ecx & (1 << 23)) != 0)
+#define HAS_POPCOUNT \
+  ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0)

Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/sched_cpucount.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/sched_cpucount.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/sched_cpucount.c Mon Jun  1 00:09:13 2009
@@ -1,6 +1,6 @@
 /* Count bits in CPU set.  x86-64 multi-arch version.
    This file is part of the GNU C Library.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,25 +18,20 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#ifdef SHARED
-# include <sched.h>
-# include "init-arch.h"
+#include <sched.h>
+#include "init-arch.h"
 
-# define __sched_cpucount static generic_cpucount
-# include <posix/sched_cpucount.c>
-# undef __sched_cpucount
+#define __sched_cpucount static generic_cpucount
+#include <posix/sched_cpucount.c>
+#undef __sched_cpucount
 
-# define POPCNT(l) \
+#define POPCNT(l) \
   ({ __cpu_mask r; \
      asm ("popcntq %1, %0" : "=r" (r) : "0" (l));\
      r; })
-# define __sched_cpucount static popcount_cpucount
-# include <posix/sched_cpucount.c>
-# undef __sched_cpucount
+#define __sched_cpucount static popcount_cpucount
+#include <posix/sched_cpucount.c>
+#undef __sched_cpucount
 
 libc_ifunc (__sched_cpucount,
-	    INTEL_HAS_POPCOUNT || AMD_HAS_POPCOUNT
-	    ? popcount_cpucount : generic_cpucount);
-#else
-# include_next <sched_cpucount.c>
-#endif
+	    HAS_POPCOUNT ? popcount_cpucount : generic_cpucount);