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

[commits] r9162 - in /fsf/trunk/libc: ./ elf/ include/ libio/ localedata/ localedata/locales/ misc/ nptl/ stdio-common/ stdlib/ sysdep...



Author: eglibc
Date: Fri Oct 30 05:59:49 2009
New Revision: 9162

Log:
Import glibc-mainline for 2009-10-30

Added:
    fsf/trunk/libc/misc/mkstemps.c
    fsf/trunk/libc/misc/mkstemps64.c
    fsf/trunk/libc/sysdeps/generic/elf/ifunc-sel.h
    fsf/trunk/libc/sysdeps/powerpc/elf/ifunc-sel.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-irel.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/Makefile
    fsf/trunk/libc/Makerules
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/elf/elf.h
    fsf/trunk/libc/elf/ifuncdep2.c
    fsf/trunk/libc/elf/ifuncmain1.c
    fsf/trunk/libc/elf/ifuncmain1vis.c
    fsf/trunk/libc/elf/ifuncmain2.c
    fsf/trunk/libc/elf/ifuncmain5.c
    fsf/trunk/libc/elf/ifuncmain6pie.c
    fsf/trunk/libc/elf/ifuncmain7.c
    fsf/trunk/libc/elf/ifuncmod1.c
    fsf/trunk/libc/elf/ifuncmod3.c
    fsf/trunk/libc/elf/ifuncmod5.c
    fsf/trunk/libc/include/stdio.h
    fsf/trunk/libc/libio/oldtmpfile.c
    fsf/trunk/libc/localedata/ChangeLog
    fsf/trunk/libc/localedata/locales/es_CO
    fsf/trunk/libc/localedata/locales/shs_CA
    fsf/trunk/libc/misc/Makefile
    fsf/trunk/libc/misc/Versions
    fsf/trunk/libc/misc/mkdtemp.c
    fsf/trunk/libc/misc/mkostemp.c
    fsf/trunk/libc/misc/mkostemp64.c
    fsf/trunk/libc/misc/mkstemp.c
    fsf/trunk/libc/misc/mkstemp64.c
    fsf/trunk/libc/misc/mktemp.c
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/allocatestack.c
    fsf/trunk/libc/nptl/nptl-init.c
    fsf/trunk/libc/stdio-common/tempnam.c
    fsf/trunk/libc/stdio-common/tempname.c
    fsf/trunk/libc/stdio-common/tmpfile.c
    fsf/trunk/libc/stdio-common/tmpnam.c
    fsf/trunk/libc/stdio-common/tmpnam_r.c
    fsf/trunk/libc/stdlib/stdlib.h
    fsf/trunk/libc/sysdeps/gnu/netinet/udp.h
    fsf/trunk/libc/sysdeps/posix/tempname.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-machine.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-machine.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-machine.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Oct 30 05:59:49 2009
@@ -1,3 +1,85 @@
+2009-10-28  Roland McGrath  <roland@xxxxxxxxxx>
+
+	* Makefile (dist-prepare): New target.
+	(tag-for-dist): Target removed.
+	(glibc-%.tar): Pattern rule removed.
+	(%.tar): New pattern rule, does simple use of git archive.
+	(dist-version): Remove variable definition.
+	(dist): Just depend on that.  Add .tar.xz dependency.
+	If dist-version variable not set on command line, depend on
+	dist-prepare, re-invoke with dist-version set via git describe.
+
+	* Makerules (%.xz): New pattern rule.
+
+2009-10-28  Alan Modra  <amodra@xxxxxxxxxxxxxx>
+
+	* elf/ifuncdep2.c: Include ifunc-sel.h.
+	(global): Delete.
+	(foo1_ifunc, foo2_ifunc, foo3_ifunc): Use ifunc_sel.
+	* elf/ifuncmain1.c (global): Delete.
+	* elf/ifuncmain1vis.c: Likewise.
+	* elf/ifuncmain2.c: Likewise.
+	* elf/ifuncmain5.c: Likewise.
+	* elf/ifuncmod3.c: Likewise.
+	* elf/ifuncmain6pie.c: Include ifunc-sel.h.
+	(foo_ifunc): Use ifunc_one.
+	* elf/ifuncmain7.c: Likewise.
+	* elf/ifuncmod1.c: Include ifunc-sel.h.
+	(global): Define protected var.
+	(foo_ifunc, foo_hidden_ifunc, foo_protected_ifunc): Use ifunc_sel.
+	* elf/ifuncmod5.c: Likewise.
+	* sysdeps/generic/elf/ifunc-sel.h: New file.
+	* sysdeps/powerpc/elf/ifunc-sel.h: New file.
+
+2009-07-30  Alan Modra  <amodra@xxxxxxxxxxxxxx>
+
+	* elf/elf.h (R_PPC_NUM, R_PPC64_NUM): Delete unused and incorrect.
+	(R_PPC_REL16*): Correct comments.
+	(R_PPC_IRELATIVE, R_PPC64_IRELATIVE, R_PPC64_JMP_IREL): Define.
+	(R_PPC64_REL16, R_PPC64_REL16_LO, R_PPC64_REL16_HI,
+	 R_PPC64_REL16_HA): Define.
+	* sysdeps/powerpc/powerpc32/dl-irel.h: New file.
+	* sysdeps/powerpc/powerpc64/dl-irel.h: New file.
+	* sysdeps/powerpc/powerpc32/dl-machine.c (__elf_machine_fixup_plt):
+	Delete unused "reloc" param.
+	(__process_machine_rela): Handle R_PPC_IRELATIVE.
+	* sysdeps/powerpc/powerpc32/dl-machine.h (__elf_machine_fixup_plt):
+	Delete "reloc" param.
+	(elf_machine_rela): Handle STT_GNU_IFUNC functions and
+	R_PPC_IRELATIVE.
+	* sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): New function.
+	(elf_machine_rela): Handle STT_GNU_IFUNC functions and new ifunc
+	relocations.
+
+d2009-10-30  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #10315]
+	* sysdeps/gnu/netinet/udp.h: Define UDP_CORK, UDP_ENCAP,
+	UDP_ENCAP_ESPINUDP_NON_IKE, UDP_ENCAP_ESPINUDP, and
+	UDP_ENCAP_L2TPINUDP.
+
+	[BZ #10349]
+	* sysdeps/posix/tempname.c (__gen_tempname): Take new second
+	parameter, specifying length of prefix.
+	* stdio-common/tempname.c: Likewise.
+	* include/stdio.h: Adjust prototypes.
+	* libio/oldtmpfile.c: Adjust caller.
+	* misc/mkdtemp.c: Likewise.
+	* misc/mkostemp.c: Likewise.
+	* misc/mkostemp64.c: Likewise.
+	* misc/mkstemp.c:  Likewise.
+	* misc/mkstemp64.c: Likewise.
+	* misc/mktemp.c: Likewise.
+	* stdio-common/tempnam.c: Likewise.
+	* stdio-common/tmpfile.c: Likewise.
+	* stdio-common/tmpnam.c: Likewise.
+	* stdio-common/tmpnam_r.c: Likewise.
+	* misc/mkstemps.c: New file.
+	* misc/mkstemps64.c: New file.
+	* stdlib/stdlib.h: Add prototypes.
+	* misc/Makefile (routines): Add mkstemps and mkstemps64.
+	* misc/Versions: Export mkstemps and mkstemps64 for GLIBC_2.11.
+
 2009-10-29  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* locale/iso-639.def: Add sml entry.

Modified: fsf/trunk/libc/Makefile
==============================================================================
--- fsf/trunk/libc/Makefile (original)
+++ fsf/trunk/libc/Makefile Fri Oct 30 05:59:49 2009
@@ -347,51 +347,38 @@
 	| $(ETAGS) -o $@ -
 
 # Make the distribution tarfile.
-.PHONY: dist tag-for-dist
+.PHONY: dist dist-prepare
 
 generated := $(generated) stubs.h
 
-files-for-dist := README FAQ INSTALL NOTES configure
-
-tag-of-stem = glibc-$(subst .,_,$*)
-dist-selector = -r $(tag-of-stem)
-
-# Add-ons in the main repository but distributed in their own tar files.
-dist-separate = libidn
-
-glibc-%.tar $(dist-separate:%=glibc-%-%.tar): $(files-for-dist) \
-					      $(foreach D,$(dist-separate),\
-							$D/configure)
-	@rm -fr glibc-$*
-	$(MAKE) -q `find sysdeps $(addsuffix /sysdeps,$(sysdeps-add-ons)) \
-			 -name configure`
-	cvs $(CVSOPTS) -Q export -d glibc-$* $(dist-selector) libc
-# Touch all the configure scripts going into the tarball since cvs export
-# might have delivered configure.in newer than configure.
-	find glibc-$* -name configure -print | xargs touch
-	$(dist-do-separate-dirs)
-	tar cf glibc-$*.tar glibc-$*
-	rm -fr glibc-$*
-define dist-do-separate-dirs
-$(foreach dir,$(dist-separate),
-	@rm -fr glibc-$(dir)-$*
-	mv glibc-$*/$(dir) glibc-$(dir)-$*
-	tar cf glibc-$(dir)-$*.tar glibc-$(dir)-$*
-	rm -fr glibc-$(dir)-$*
-)
-endef
+files-for-dist := README FAQ INSTALL NOTES configure ChangeLog NEWS
+
+# Regenerate stuff, then error if these things are not committed yet.
+dist-prepare: $(files-for-dist)
+	conf=`find sysdeps $(addsuffix /sysdeps,$(sysdeps-add-ons)) \
+		   -name configure`; \
+	$(MAKE) $$conf && \
+	git diff --stat HEAD -- $^ $$conf \
+	| $(AWK) '{ print; rc=1 } END { exit rc }'
+
+%.tar: FORCE
+	git archive --prefix=$*/ $* > $@.new
+	mv -f $@.new $@
 
 # Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
-dist-version = $(version)
-
-dist: $(foreach Z,.bz2 .gz,glibc-$(dist-version).tar$Z \
-		           $(foreach D,$(dist-separate),\
-				     glibc-$D-$(dist-version).tar$Z))
+
+ifneq (,$(strip $(dist-version)))
+dist: $(foreach Z,.bz2 .gz .xz,$(dist-version).tar$Z)
 	md5sum $^
-
-tag-for-dist: tag-$(dist-version)
-tag-%: $(files-for-dist)
-	cvs $(CVSOPTS) -Q tag -c $(tag-of-stem)
+else
+dist: dist-prepare
+	@if v=`git describe`; then \
+	  echo Distribution version $$v; \
+	  $(MAKE) dist dist-version=$$v; \
+	else \
+	  false; \
+	fi
+endif
 
 define format-me
 @rm -f $@

Modified: fsf/trunk/libc/Makerules
==============================================================================
--- fsf/trunk/libc/Makerules (original)
+++ fsf/trunk/libc/Makerules Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 1991-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
@@ -1335,6 +1335,7 @@
 
 %.bz2: %; bzip2 -9vk $<
 %.gz: %; gzip -9vnc $< > $@.new && mv -f $@.new $@
+%.xz: %; xz -9evk $<
 
 # Common cleaning targets.
 

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2009-10-15
+GNU C Library NEWS -- history of user-visible changes.  2009-10-29
 Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -7,7 +7,7 @@
 
 Version 2.11
 
-* New interfaces: execvpe, pthread_sigqueue
+* New interfaces: execvpe, pthread_sigqueue, mkstemps, mkstemps64
   Implemented by Ulrich Drepper.
 
 * Checking version of longjmp added that fails if an uninitialized stack
@@ -16,9 +16,11 @@
 * STT_GNU_IFUNC is now supported in static executables.
   Implemented by H.J. Lu.
 
+* STT_GNU_IFUNC implemented for PPC by Alan Modra.
+
 * New optimized string functions for x86-64: strstr, strcasestr, memcmp,
   strcspn, strpbrk, strspn, strcpy, stpcpy, strncpy, strcmp (SSE2, SSE4.2),
-  strncmp (SSE2, SSE4.2).
+  strncmp (SSE2, SSE4.2), strchr (SSE4.2), strrchr (SSE4.2).
   Contributed by H.J. Lu.
 
   strlen, rawmemchr, strcmp (SSSE3), strncmp (SSSE3).

Modified: fsf/trunk/libc/elf/elf.h
==============================================================================
--- fsf/trunk/libc/elf/elf.h (original)
+++ fsf/trunk/libc/elf/elf.h Fri Oct 30 05:59:49 2009
@@ -2041,9 +2041,6 @@
 #define R_PPC_GOT_DTPREL16_HI	93 /* half16*	(sym+add)@got@dtprel@h */
 #define R_PPC_GOT_DTPREL16_HA	94 /* half16*	(sym+add)@got@dtprel@ha */
 
-/* Keep this the last entry.  */
-#define R_PPC_NUM		95
-
 /* The remaining relocs are from the Embedded ELF ABI, and are not
    in the SVR4 ELF ABI.  */
 #define R_PPC_EMB_NADDR32	101
@@ -2071,11 +2068,14 @@
 #define R_PPC_DIAB_RELSDA_HI	184	/* like EMB_RELSDA, but high 16 bit */
 #define R_PPC_DIAB_RELSDA_HA	185	/* like EMB_RELSDA, adjusted high 16 */
 
+/* GNU extension to support local ifunc.  */
+#define R_PPC_IRELATIVE		248
+
 /* GNU relocs used in PIC code sequences.  */
-#define R_PPC_REL16		249	/* word32   (sym-.) */
-#define R_PPC_REL16_LO		250	/* half16   (sym-.)@l */
-#define R_PPC_REL16_HI		251	/* half16   (sym-.)@h */
-#define R_PPC_REL16_HA		252	/* half16   (sym-.)@ha */
+#define R_PPC_REL16		249	/* half16   (sym+add-.) */
+#define R_PPC_REL16_LO		250	/* half16   (sym+add-.)@l */
+#define R_PPC_REL16_HI		251	/* half16   (sym+add-.)@h */
+#define R_PPC_REL16_HA		252	/* half16   (sym+add-.)@ha */
 
 /* This is a phony reloc to handle any old fashioned TOC16 references
    that may still be in object files.  */
@@ -2197,8 +2197,13 @@
 #define R_PPC64_DTPREL16_HIGHEST 105 /* half16	(sym+add)@dtprel@highest */
 #define R_PPC64_DTPREL16_HIGHESTA 106 /* half16	(sym+add)@dtprel@highesta */
 
-/* Keep this the last entry.  */
-#define R_PPC64_NUM		107
+/* GNU extension to support local ifunc.  */
+#define R_PPC64_JMP_IREL	247
+#define R_PPC64_IRELATIVE	248
+#define R_PPC64_REL16		249	/* half16   (sym+add-.) */
+#define R_PPC64_REL16_LO	250	/* half16   (sym+add-.)@l */
+#define R_PPC64_REL16_HI	251	/* half16   (sym+add-.)@h */
+#define R_PPC64_REL16_HA	252	/* half16   (sym+add-.)@ha */
 
 /* PowerPC64 specific values for the Dyn d_tag field.  */
 #define DT_PPC64_GLINK  (DT_LOPROC + 0)

Modified: fsf/trunk/libc/elf/ifuncdep2.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncdep2.c (original)
+++ fsf/trunk/libc/elf/ifuncdep2.c Fri Oct 30 05:59:49 2009
@@ -1,6 +1,8 @@
 /* Test 3 STT_GNU_IFUNC symbols.  */
 
-extern int global;
+#include "ifunc-sel.h"
+
+int global __attribute__ ((visibility ("protected"))) = -1;
 
 static int
 one (void)
@@ -26,15 +28,7 @@
 void * 
 foo1_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return one;
-    case -1:
-      return minus_one;
-    default:
-      return zero;
-    }
+  return ifunc_sel (one, minus_one, zero);
 }
 
 void * foo2_ifunc (void) __asm__ ("foo2");
@@ -43,15 +37,7 @@
 void * 
 foo2_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return minus_one;
-    case -1:
-      return one;
-    default:
-      return zero;
-    }
+  return ifunc_sel (minus_one, one, zero);
 }
 
 void * foo3_ifunc (void) __asm__ ("foo3");
@@ -60,13 +46,5 @@
 void * 
 foo3_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return one;
-    case -1:
-      return zero;
-    default:
-      return minus_one;
-    }
+  return ifunc_sel (one, zero, minus_one);
 }

Modified: fsf/trunk/libc/elf/ifuncmain1.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain1.c (original)
+++ fsf/trunk/libc/elf/ifuncmain1.c Fri Oct 30 05:59:49 2009
@@ -6,8 +6,6 @@
  */
 
 #include <stdlib.h>
-
-int global = -1;
 
 int ret_foo;
 int ret_foo_hidden;

Modified: fsf/trunk/libc/elf/ifuncmain1vis.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain1vis.c (original)
+++ fsf/trunk/libc/elf/ifuncmain1vis.c Fri Oct 30 05:59:49 2009
@@ -6,8 +6,6 @@
  */
 
 #include <stdlib.h>
-
-int global = -1;
 
 int ret_foo;
 int ret_foo_hidden;

Modified: fsf/trunk/libc/elf/ifuncmain2.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain2.c (original)
+++ fsf/trunk/libc/elf/ifuncmain2.c Fri Oct 30 05:59:49 2009
@@ -2,8 +2,6 @@
    STT_GNU_IFUNC definitions.  */
 
 #include <stdlib.h>
-
-int global = -1;
 
 extern int foo1 (void);
 

Modified: fsf/trunk/libc/elf/ifuncmain5.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain5.c (original)
+++ fsf/trunk/libc/elf/ifuncmain5.c Fri Oct 30 05:59:49 2009
@@ -1,8 +1,6 @@
 /* Test STT_GNU_IFUNC symbols with dynamic function pointer only.  */
 
 #include <stdlib.h>
-
-int global = -1;
 
 extern int foo (void);
 extern int foo_protected (void);

Modified: fsf/trunk/libc/elf/ifuncmain6pie.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain6pie.c (original)
+++ fsf/trunk/libc/elf/ifuncmain6pie.c Fri Oct 30 05:59:49 2009
@@ -6,6 +6,7 @@
  */
 
 #include <stdlib.h>
+#include "ifunc-sel.h"
 
 typedef int (*foo_p) (void);
 extern foo_p foo_ptr;
@@ -22,7 +23,7 @@
 void *
 foo_ifunc (void)
 {
-  return one;
+  return ifunc_one (one);
 }
 
 extern int foo (void);

Modified: fsf/trunk/libc/elf/ifuncmain7.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain7.c (original)
+++ fsf/trunk/libc/elf/ifuncmain7.c Fri Oct 30 05:59:49 2009
@@ -5,6 +5,7 @@
  */
 
 #include <stdlib.h>
+#include "ifunc-sel.h"
 
 extern int foo (void);
 
@@ -21,7 +22,7 @@
 __attribute__ ((used))
 foo_ifunc (void)
 {
-  return one;
+  return ifunc_one (one);
 }
 
 typedef int (*foo_p) (void);

Modified: fsf/trunk/libc/elf/ifuncmod1.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmod1.c (original)
+++ fsf/trunk/libc/elf/ifuncmod1.c Fri Oct 30 05:59:49 2009
@@ -4,8 +4,9 @@
    2. Function pointer.
    3. Visibility.
  */
+#include "ifunc-sel.h"
 
-extern int global;
+int global __attribute__ ((visibility ("protected"))) = -1;
 
 static int
 one (void)
@@ -20,7 +21,7 @@
 }
 
 static int
-zero (void) 
+zero (void)
 {
   return 0;
 }
@@ -28,52 +29,28 @@
 void * foo_ifunc (void) __asm__ ("foo");
 __asm__(".type foo, %gnu_indirect_function");
 
-void * 
+void *
 foo_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return one;
-    case -1:
-      return minus_one;
-    default:
-      return zero;
-    }
+  return ifunc_sel (one, minus_one, zero);
 }
 
 void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
 __asm__(".type foo_hidden, %gnu_indirect_function");
 
-void * 
+void *
 foo_hidden_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return minus_one;
-    case -1:
-      return one;
-    default:
-      return zero;
-    }
+  return ifunc_sel (minus_one, one, zero);
 }
 
 void * foo_protected_ifunc (void) __asm__ ("foo_protected");
 __asm__(".type foo_protected, %gnu_indirect_function");
 
-void * 
+void *
 foo_protected_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return one;
-    case -1:
-      return zero;
-    default:
-      return minus_one;
-    }
+  return ifunc_sel (one, zero, minus_one);
 }
 
 /* Test hidden indirect function.  */

Modified: fsf/trunk/libc/elf/ifuncmod3.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmod3.c (original)
+++ fsf/trunk/libc/elf/ifuncmod3.c Fri Oct 30 05:59:49 2009
@@ -5,4 +5,3 @@
 int ret_foo;
 int ret_foo_hidden;
 int ret_foo_protected;
-int global = -1;

Modified: fsf/trunk/libc/elf/ifuncmod5.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmod5.c (original)
+++ fsf/trunk/libc/elf/ifuncmod5.c Fri Oct 30 05:59:49 2009
@@ -1,6 +1,7 @@
 /* Test STT_GNU_IFUNC symbols without direct function call.  */
+#include "ifunc-sel.h"
 
-extern int global;
+int global __attribute__ ((visibility ("protected"))) = -1;
 
 static int
 one (void)
@@ -26,15 +27,7 @@
 void *
 foo_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return one;
-    case -1:
-      return minus_one;
-    default:
-      return zero;
-    }
+  return ifunc_sel (one, minus_one, zero);
 }
 
 void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
@@ -43,15 +36,7 @@
 void *
 foo_hidden_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return minus_one;
-    case -1:
-      return one;
-    default:
-      return zero;
-    }
+  return ifunc_sel (minus_one, one, zero);
 }
 
 void * foo_protected_ifunc (void) __asm__ ("foo_protected");
@@ -60,15 +45,7 @@
 void *
 foo_protected_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return one;
-    case -1:
-      return zero;
-    default:
-      return minus_one;
-    }
+  return ifunc_sel (one, zero, minus_one);
 }
 
 /* Test hidden indirect function.  */

Modified: fsf/trunk/libc/include/stdio.h
==============================================================================
--- fsf/trunk/libc/include/stdio.h (original)
+++ fsf/trunk/libc/include/stdio.h Fri Oct 30 05:59:49 2009
@@ -80,7 +80,8 @@
 			  __const char *__dir, __const char *__pfx,
 			  int __try_tempdir);
 
-extern int __gen_tempname (char *__tmpl, int __flags, int __kind);
+extern int __gen_tempname (char *__tmpl, int __suffixlen, int __flags,
+			   int __kind);
 /* The __kind argument to __gen_tempname may be one of: */
 #  define __GT_FILE	0	/* create a file */
 #  define __GT_DIR	1	/* create a directory */

Modified: fsf/trunk/libc/libio/oldtmpfile.c
==============================================================================
--- fsf/trunk/libc/libio/oldtmpfile.c (original)
+++ fsf/trunk/libc/libio/oldtmpfile.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1996-2000,2003,2004,2007
+/* Copyright (C) 1991,1993,1996-2000,2003,2004,2007,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -39,7 +39,7 @@
 
   if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 0))
     return NULL;
-  fd = __gen_tempname (buf, 0, __GT_FILE);
+  fd = __gen_tempname (buf, 0, 0, __GT_FILE);
   if (fd < 0)
     return NULL;
 

Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Fri Oct 30 05:59:49 2009
@@ -1,3 +1,13 @@
+2009-10-30  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #10312]
+	* locales/es_CO: Define am_pm , t_fmt_ampm, first_weekday.
+	Patch by Jorge Guerrero <geojorg@xxxxxxxxx>.
+
+	[BZ #10319]
+	* locales/shs_CA: Fix accents.
+	Patch by Neskie Manuel <neskiem@xxxxxxxxx>.
+
 2009-10-29  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #10425]

Modified: fsf/trunk/libc/localedata/locales/es_CO
==============================================================================
--- fsf/trunk/libc/localedata/locales/es_CO (original)
+++ fsf/trunk/libc/localedata/locales/es_CO Fri Oct 30 05:59:49 2009
@@ -117,11 +117,14 @@
 d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
 d_fmt   "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
 t_fmt   "<U0025><U0054>"
-am_pm   "";""
-t_fmt_ampm ""
+am_pm   "<U0041><U004D>";"<U0050><U004D>"
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053>/
+<U0020><U0025><U0070>"
 date_fmt	"<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
+%  FIXME: found in CLDR
+first_weekday 2
 END LC_TIME
 
 LC_PAPER

Modified: fsf/trunk/libc/localedata/locales/shs_CA
==============================================================================
--- fsf/trunk/libc/localedata/locales/shs_CA (original)
+++ fsf/trunk/libc/localedata/locales/shs_CA Fri Oct 30 05:59:49 2009
@@ -55,10 +55,10 @@
 %  Present in iso14651_t1, but these definitions seem to have been
 %  removed from latest iso14651 tables.
 reorder-after <U0041>
-<U00C6> "<a><e>";"<LIG><LIG>";"<CAP><CAP>";IGNORE
+<U00C6> "<U003C><U0061><U003E><U003C><U0065><U003E>";"<U003C><U004C><U0049><U0047><U003E><U003C><U004C><U0049><U0047><U003E>";"<U003C><U0043><U0041><U0050><U003E><U003C><U0043><U0041><U0050><U003E>";IGNORE
 
 reorder-after <U0061>
-<U00E6> "<a><e>";"<LIG><LIG>";"<MIN><MIN>";IGNORE
+<U00E6> "<U003C><U0061><U003E><U003C><U0065><U003E>";"<U003C><U004C><U0049><U0047><U003E><U003C><U004C><U0049><U0047><U003E>";"<U003C><U004D><U0049><U004E><U003E><U003C><U004D><U0049><U004E><U003E>";IGNORE
 
 reorder-end
 
@@ -80,41 +80,41 @@
 abday      "<U0053><U0078><U0065>";/
            "<U0053><U0070><U0065>";/
            "<U0053><U0065><U006C>";/
-           "<U004B><U0065><U006C>";/
-           "<U004D><U0065><U0073>";/
-           "<U0054><U0073><U0065>";/
-           "<U0054><U0071><U006D>"
-day        "<U0053><U0078><U0065><U0074><U0073><U0070><U0065><U0073><U0071><U0027><U0074>";/
-           "<U0053><U0070><U0065><U0074><U006B><U0065><U0073><U0071><U0027><U0074>";/
-           "<U0053><U0065><U006C><U0065><U0073><U0071><U0027><U0074>";/
-           "<U0053><U006B><U0065><U006C><U006C><U0065><U0073><U0071><U0027><U0074>";/
-           "<U0053><U006D><U0065><U0073><U0065><U0073><U0071><U0027><U0074>";/
-           "<U0053><U0074><U0073><U0065><U006C><U006B><U0073><U0074><U0065><U0073><U0071><U0027><U0074>";/
-           "<U0053><U0074><U0071><U006D><U0065><U006B><U0073><U0074><U0065><U0073><U0071><U0027><U0074>"
+           "<U0053><U006B><U0065>";/
+           "<U0053><U006D><U0065>";/
+           "<U0053><U0074><U0073>";/
+           "<U0053><U0074><U0071>"
+day        "<U0053><U0078><U0065><U0074><U0073><U0070><U0065><U0073><U0071><U0313><U0074>";/
+           "<U0053><U0070><U0065><U0074><U006B><U0065><U0073><U0071><U0313><U0074>";/
+           "<U0053><U0065><U006C><U0065><U0073><U0071><U0313><U0074>";/
+           "<U0053><U006B><U0065><U006C><U006C><U0065><U0073><U0071><U0313><U0074>";/
+           "<U0053><U006D><U0065><U0073><U0065><U0073><U0071><U0313><U0074>";/
+           "<U0053><U0074><U0073><U0065><U006C><U006B><U0073><U0074><U0065><U0073><U0071><U0313><U0074>";/
+           "<U0053><U0074><U0071><U006D><U0065><U006B><U0073><U0074><U0065><U0073><U0071><U0313><U0074>"
 abmon      "<U004B><U0077><U0065>";/
            "<U0054><U0073><U0069>";/
            "<U0053><U0071><U0065>";/
-           "<U0045><U0027><U0077>";/
+           "<U00C9><U0077><U0074>";/
            "<U0045><U006C><U006C>";/
            "<U0054><U0073><U0070>";/
            "<U0054><U0071><U0077>";/
-           "<U0043><U0074><U0027>";/
+           "<U0043><U0074><U0313><U00E9>";/
            "<U0051><U0065><U006C>";/
-           "<U0057><U0065><U006C>";/
+           "<U0057><U00E9><U006C>";/
            "<U0055><U0037><U006C>";/
            "<U0054><U0065><U0074>"
-mon        "<U0050><U0065><U006C><U006C><U006B><U0077><U0065><U0074><U0027><U006D><U0069><U006E>";/
-           "<U0050><U0065><U006C><U0063><U0074><U0073><U0069><U0070><U0077><U0065><U006E><U0027><U0074><U0065><U006E>";/
-           "<U0050><U0065><U006C><U006C><U0073><U0071><U0065><U0027><U0070><U0074><U0073>";/
-           "<U0050><U0065><U0073><U006C><U006C><U0065><U0027><U0077><U0074><U0065><U006E>";/
-           "<U0050><U0065><U006C><U006C><U0037><U0065><U006C><U006C><U0037><U0065><U0027><U0037><U006C><U006C><U0071><U0074><U0065><U006E>";/
-           "<U0050><U0065><U006C><U006C><U0074><U0073><U0070><U0065><U0027><U006E><U0074><U0073><U006B>";/
-           "<U0050><U0065><U006C><U006C><U0074><U0071><U0077><U0065><U006C><U0071><U0027><U0077><U0065><U0027><U006C><U0027><U0074>";/
-           "<U0050><U0065><U006C><U006C><U0063><U0074><U0027><U0065><U0027><U0078><U0065><U006C><U0027><U0063><U0074><U0065><U006E>";/
-           "<U0050><U0065><U0073><U0071><U0065><U006C><U0071><U006C><U0065><U0027><U006C><U0074><U0065><U006E>";/
-           "<U0050><U0065><U0073><U006C><U006C><U0077><U0065><U0027><U006C><U0073><U0074><U0065><U006E>";/
-           "<U0050><U0065><U006C><U006C><U0063><U0037><U0065><U006C><U006C><U0037><U0075><U0027><U0037><U006C><U006C><U0063><U0077><U0074><U0065><U006E><U0027>";/
-           "<U0050><U0065><U006C><U006C><U0074><U0065><U0074><U0065><U0027><U0074><U0071><U0027><U0065><U006D>"
+mon        "<U0050><U0065><U006C><U006C><U006B><U0077><U0065><U0074><U0313><U006D><U0069><U006E>";/
+       "<U0050><U0065><U006C><U0063><U0074><U0073><U0069><U0070><U0077><U0065><U006E><U0313><U0074><U0065><U006E>";/
+       "<U0050><U0065><U006C><U006C><U0073><U0071><U00E9><U0070><U0074><U0073>";/
+       "<U0050><U0065><U0073><U006C><U006C><U00E9><U0077><U0074><U0065><U006E>";/
+       "<U0050><U0065><U006C><U006C><U0037><U0065><U006C><U006C><U0037><U00E9><U0037><U006C><U006C><U0071><U0074><U0065><U006E>";/
+       "<U0050><U0065><U006C><U006C><U0074><U0073><U0070><U00E9><U006E><U0074><U0073><U006B>";/
+       "<U0050><U0065><U006C><U006C><U0074><U0071><U0077><U0065><U006C><U0071><U0313><U0077><U00E9><U006C><U0313><U0074>";/
+       "<U0050><U0065><U006C><U006C><U0063><U0074><U0313><U00E9><U0078><U0065><U006C><U0313><U0063><U0074><U0065><U006E>";/
+       "<U0050><U0065><U0073><U0071><U0065><U006C><U0071><U006C><U00E9><U006C><U0074><U0065><U006E>";/
+       "<U0050><U0065><U0073><U006C><U006C><U0077><U00E9><U006C><U0073><U0074><U0065><U006E>";/
+       "<U0050><U0065><U006C><U006C><U0063><U0037><U0065><U006C><U006C><U0037><U00E9><U0037><U006C><U006C><U0063><U0077><U0074><U0065><U006E><U0313>";/
+       "<U0050><U0065><U006C><U006C><U0074><U0065><U0074><U00E9><U0074><U0071><U0313><U0065><U006D>"
 d_t_fmt    "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0072><U0020><U0025><U005A>"
 d_fmt      "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
 t_fmt      "<U0025><U0072>"

Modified: fsf/trunk/libc/misc/Makefile
==============================================================================
--- fsf/trunk/libc/misc/Makefile (original)
+++ fsf/trunk/libc/misc/Makefile Fri Oct 30 05:59:49 2009
@@ -45,7 +45,7 @@
 	    gethostid sethostid \
 	    revoke vhangup \
 	    swapon swapoff mktemp mkstemp mkstemp64 mkdtemp \
-	    mkostemp mkostemp64 \
+	    mkostemp mkostemp64 mkstemps mkstemps64 \
 	    ualarm usleep \
 	    gtty stty \
 	    ptrace \

Modified: fsf/trunk/libc/misc/Versions
==============================================================================
--- fsf/trunk/libc/misc/Versions (original)
+++ fsf/trunk/libc/misc/Versions Fri Oct 30 05:59:49 2009
@@ -140,4 +140,7 @@
   GLIBC_2.10 {
     preadv; preadv64; pwritev; pwritev64;
   }
+  GLIBC_2.11 {
+    mkstemps; mkstemps64;
+  }
 }

Modified: fsf/trunk/libc/misc/mkdtemp.c
==============================================================================
--- fsf/trunk/libc/misc/mkdtemp.c (original)
+++ fsf/trunk/libc/misc/mkdtemp.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2007, 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
@@ -28,7 +28,7 @@
 mkdtemp (template)
      char *template;
 {
-  if (__gen_tempname (template, 0, __GT_DIR))
+  if (__gen_tempname (template, 0, 0, __GT_DIR))
     return NULL;
   else
     return template;

Modified: fsf/trunk/libc/misc/mkostemp.c
==============================================================================
--- fsf/trunk/libc/misc/mkostemp.c (original)
+++ fsf/trunk/libc/misc/mkostemp.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001, 2007, 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
@@ -32,5 +32,5 @@
      char *template;
      int flags;
 {
-  return __gen_tempname (template, flags, __GT_FILE);
+  return __gen_tempname (template, 0, flags, __GT_FILE);
 }

Modified: fsf/trunk/libc/misc/mkostemp64.c
==============================================================================
--- fsf/trunk/libc/misc/mkostemp64.c (original)
+++ fsf/trunk/libc/misc/mkostemp64.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2007, 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
@@ -29,5 +29,5 @@
      char *template;
      int flags;
 {
-  return __gen_tempname (template, flags | O_LARGEFILE, __GT_FILE);
+  return __gen_tempname (template, 0, flags | O_LARGEFILE, __GT_FILE);
 }

Modified: fsf/trunk/libc/misc/mkstemp.c
==============================================================================
--- fsf/trunk/libc/misc/mkstemp.c (original)
+++ fsf/trunk/libc/misc/mkstemp.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2001, 2007, 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
@@ -31,5 +31,5 @@
 mkstemp (template)
      char *template;
 {
-  return __gen_tempname (template, 0, __GT_FILE);
+  return __gen_tempname (template, 0, 0, __GT_FILE);
 }

Modified: fsf/trunk/libc/misc/mkstemp64.c
==============================================================================
--- fsf/trunk/libc/misc/mkstemp64.c (original)
+++ fsf/trunk/libc/misc/mkstemp64.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2007, 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
@@ -28,5 +28,5 @@
 mkstemp64 (template)
      char *template;
 {
-  return __gen_tempname (template, O_LARGEFILE, __GT_FILE);
+  return __gen_tempname (template, 0, O_LARGEFILE, __GT_FILE);
 }

Added: fsf/trunk/libc/misc/mkstemps.c
==============================================================================
--- fsf/trunk/libc/misc/mkstemps.c (added)
+++ fsf/trunk/libc/misc/mkstemps.c Fri Oct 30 05:59:49 2009
@@ -1,0 +1,43 @@
+/* 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.  */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef __GT_FILE
+# define __GT_FILE 0
+#endif
+
+/* Generate a unique temporary file name from TEMPLATE.  The last six
+   characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+   "XXXXXX"; they are replaced with a string that makes the filename
+   unique.  Then open the file and return a fd. */
+int
+mkstemps (template, suffixlen)
+     char *template;
+     int suffixlen;
+{
+  if (suffixlen < 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __gen_tempname (template, suffixlen, 0, __GT_FILE);
+}

Added: fsf/trunk/libc/misc/mkstemps64.c
==============================================================================
--- fsf/trunk/libc/misc/mkstemps64.c (added)
+++ fsf/trunk/libc/misc/mkstemps64.c Fri Oct 30 05:59:49 2009
@@ -1,0 +1,40 @@
+/* Copyright (C) 2000, 2007, 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.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Generate a unique temporary file name from TEMPLATE.  The last six
+   characters before a suffix of length SUFFIXLEN of TEMPLATE must be
+   "XXXXXX"; they are replaced with a string that makes the filename
+   unique.  Then open the file and return a fd. */
+int
+mkstemps64 (template, suffixlen)
+     char *template;
+     int suffixlen;
+{
+  if (suffixlen < 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __gen_tempname (template, suffixlen, O_LARGEFILE, __GT_FILE);
+}

Modified: fsf/trunk/libc/misc/mktemp.c
==============================================================================
--- fsf/trunk/libc/misc/mktemp.c (original)
+++ fsf/trunk/libc/misc/mktemp.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2007, 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
@@ -26,7 +26,7 @@
 mktemp (template)
      char *template;
 {
-  if (__gen_tempname (template, 0, __GT_NOCREATE) < 0)
+  if (__gen_tempname (template, 0, 0, __GT_NOCREATE) < 0)
     /* We return the null string if we can't find a unique file name.  */
     template[0] = '\0';
 

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Fri Oct 30 05:59:49 2009
@@ -1,3 +1,11 @@
+2009-10-30  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #3270]
+	* allocatestack.c (__nptl_setxid): Perform the operation in multiple
+	steps to avoid races with creation and terminations.
+	* nptl-init.c (sighandler_setxid): Adjust.
+	Patch by Daniel Jacobowitz.
+
 2009-09-07  Andreas Schwab  <schwab@xxxxxxxxxx>
 
 	* sysdeps/pthread/bits/libc-lock.h (BP_SYM): Remove space before paren.

Modified: fsf/trunk/libc/nptl/allocatestack.c
==============================================================================
--- fsf/trunk/libc/nptl/allocatestack.c (original)
+++ fsf/trunk/libc/nptl/allocatestack.c Fri Oct 30 05:59:49 2009
@@ -965,22 +965,53 @@
 
 static void
 internal_function
+setxid_mark_thread (struct xid_command *cmdp, struct pthread *t)
+{
+  int ch;
+
+  /* Don't let the thread exit before the setxid handler runs.  */
+  t->setxid_futex = 0;
+
+  do
+    {
+      ch = t->cancelhandling;
+
+      /* If the thread is exiting right now, ignore it.  */
+      if ((ch & EXITING_BITMASK) != 0)
+	return;
+    }
+  while (atomic_compare_and_exchange_bool_acq (&t->cancelhandling,
+					       ch | SETXID_BITMASK, ch));
+}
+
+
+static void
+internal_function
+setxid_unmark_thread (struct xid_command *cmdp, struct pthread *t)
+{
+  int ch;
+
+  do
+    {
+      ch = t->cancelhandling;
+      if ((ch & SETXID_BITMASK) == 0)
+	return;
+    }
+  while (atomic_compare_and_exchange_bool_acq (&t->cancelhandling,
+					       ch & ~SETXID_BITMASK, ch));
+
+  /* Release the futex just in case.  */
+  t->setxid_futex = 1;
+  lll_futex_wake (&t->setxid_futex, 1, LLL_PRIVATE);
+}
+
+
+static int
+internal_function
 setxid_signal_thread (struct xid_command *cmdp, struct pthread *t)
 {
-  if (! IS_DETACHED (t))
-    {
-      int ch;
-      do
-	{
-	  ch = t->cancelhandling;
-
-	  /* If the thread is exiting right now, ignore it.  */
-	  if ((ch & EXITING_BITMASK) != 0)
-	    return;
-	}
-      while (atomic_compare_and_exchange_bool_acq (&t->cancelhandling,
-						   ch | SETXID_BITMASK, ch));
-    }
+  if ((t->cancelhandling & SETXID_BITMASK) == 0)
+    return 0;
 
   int val;
   INTERNAL_SYSCALL_DECL (err);
@@ -997,8 +1028,14 @@
     val = INTERNAL_SYSCALL (tkill, err, 2, t->tid, SIGSETXID);
 #endif
 
+  /* If this failed, it must have had not started yet or else exited.  */
   if (!INTERNAL_SYSCALL_ERROR_P (val, err))
-    atomic_increment (&cmdp->cntr);
+    {
+      atomic_increment (&cmdp->cntr);
+      return 1;
+    }
+  else
+    return 0;
 }
 
 
@@ -1006,6 +1043,7 @@
 attribute_hidden
 __nptl_setxid (struct xid_command *cmdp)
 {
+  int signalled;
   int result;
   lll_lock (stack_cache_lock, LLL_PRIVATE);
 
@@ -1022,7 +1060,7 @@
       if (t == self)
 	continue;
 
-      setxid_signal_thread (cmdp, t);
+      setxid_mark_thread (cmdp, t);
     }
 
   /* Now the list with threads using user-allocated stacks.  */
@@ -1032,14 +1070,61 @@
       if (t == self)
 	continue;
 
-      setxid_signal_thread (cmdp, t);
-    }
-
-  int cur = cmdp->cntr;
-  while (cur != 0)
-    {
-      lll_futex_wait (&cmdp->cntr, cur, LLL_PRIVATE);
-      cur = cmdp->cntr;
+      setxid_mark_thread (cmdp, t);
+    }
+
+  /* Iterate until we don't succeed in signalling anyone.  That means
+     we have gotten all running threads, and their children will be
+     automatically correct once started.  */
+  do
+    {
+      signalled = 0;
+
+      list_for_each (runp, &stack_used)
+	{
+	  struct pthread *t = list_entry (runp, struct pthread, list);
+	  if (t == self)
+	    continue;
+
+	  signalled += setxid_signal_thread (cmdp, t);
+	}
+
+      list_for_each (runp, &__stack_user)
+	{
+	  struct pthread *t = list_entry (runp, struct pthread, list);
+	  if (t == self)
+	    continue;
+
+	  signalled += setxid_signal_thread (cmdp, t);
+	}
+
+      int cur = cmdp->cntr;
+      while (cur != 0)
+	{
+	  lll_futex_wait (&cmdp->cntr, cur, LLL_PRIVATE);
+	  cur = cmdp->cntr;
+	}
+    }
+  while (signalled != 0);
+
+  /* Clean up flags, so that no thread blocks during exit waiting
+     for a signal which will never come.  */
+  list_for_each (runp, &stack_used)
+    {
+      struct pthread *t = list_entry (runp, struct pthread, list);
+      if (t == self)
+	continue;
+
+      setxid_unmark_thread (cmdp, t);
+    }
+
+  list_for_each (runp, &__stack_user)
+    {
+      struct pthread *t = list_entry (runp, struct pthread, list);
+      if (t == self)
+	continue;
+
+      setxid_unmark_thread (cmdp, t);
     }
 
   /* This must be last, otherwise the current thread might not have

Modified: fsf/trunk/libc/nptl/nptl-init.c
==============================================================================
--- fsf/trunk/libc/nptl/nptl-init.c (original)
+++ fsf/trunk/libc/nptl/nptl-init.c Fri Oct 30 05:59:49 2009
@@ -240,17 +240,23 @@
   INTERNAL_SYSCALL_NCS (__xidcmd->syscall_no, err, 3, __xidcmd->id[0],
 			__xidcmd->id[1], __xidcmd->id[2]);
 
-  if (atomic_decrement_val (&__xidcmd->cntr) == 0)
-    lll_futex_wake (&__xidcmd->cntr, 1, LLL_PRIVATE);
-
   /* Reset the SETXID flag.  */
   struct pthread *self = THREAD_SELF;
-  int flags = THREAD_GETMEM (self, cancelhandling);
-  THREAD_SETMEM (self, cancelhandling, flags & ~SETXID_BITMASK);
+  int flags, newval;
+  do
+    {
+      flags = THREAD_GETMEM (self, cancelhandling);
+      newval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
+					  flags & ~SETXID_BITMASK, flags);
+    }
+  while (flags != newval);
 
   /* And release the futex.  */
   self->setxid_futex = 1;
   lll_futex_wake (&self->setxid_futex, 1, LLL_PRIVATE);
+
+  if (atomic_decrement_val (&__xidcmd->cntr) == 0)
+    lll_futex_wake (&__xidcmd->cntr, 1, LLL_PRIVATE);
 }
 
 

Modified: fsf/trunk/libc/stdio-common/tempnam.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tempnam.c (original)
+++ fsf/trunk/libc/stdio-common/tempnam.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1996-2000,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993,1996-2000,2007,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
@@ -34,7 +34,7 @@
   if (__path_search (buf, FILENAME_MAX, dir, pfx, 1))
     return NULL;
 
-  if (__gen_tempname (buf, 0, __GT_NOCREATE))
+  if (__gen_tempname (buf, 0, 0, __GT_NOCREATE))
     return NULL;
 
   return __strdup (buf);

Modified: fsf/trunk/libc/stdio-common/tempname.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tempname.c (original)
+++ fsf/trunk/libc/stdio-common/tempname.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95-98, 99, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95-99, 2007, 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
@@ -47,8 +47,9 @@
  */
 
 int
-__gen_tempname (tmpl, flags, kind)
+__gen_tempname (tmpl, suffixlen, flags, kind)
      char *tmpl;
+     int suffixlen;
      int flags;
      int kind;
 {

Modified: fsf/trunk/libc/stdio-common/tmpfile.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tmpfile.c (original)
+++ fsf/trunk/libc/stdio-common/tmpfile.c Fri Oct 30 05:59:49 2009
@@ -1,5 +1,5 @@
 /* Open a stdio stream on an anonymous temporary file.  Generic/POSIX version.
-   Copyright (C) 1991,1993,1996-2000,2002,2003,2007
+   Copyright (C) 1991,1993,1996-2000,2002,2003,2007,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -48,7 +48,7 @@
 #ifdef FLAGS
   flags = FLAGS;
 #endif
-  fd = __gen_tempname (buf, flags, __GT_FILE);
+  fd = __gen_tempname (buf, 0, flags, __GT_FILE);
   if (fd < 0)
     return NULL;
 

Modified: fsf/trunk/libc/stdio-common/tmpnam.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tmpnam.c (original)
+++ fsf/trunk/libc/stdio-common/tmpnam.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1996-1999,2000,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993,1996-2000,2007,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
@@ -39,7 +39,7 @@
 			0))
     return NULL;
 
-  if (__builtin_expect (__gen_tempname (tmpbuf, 0, __GT_NOCREATE), 0))
+  if (__builtin_expect (__gen_tempname (tmpbuf, 0, 0, __GT_NOCREATE), 0))
     return NULL;
 
   if (s == NULL)

Modified: fsf/trunk/libc/stdio-common/tmpnam_r.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tmpnam_r.c (original)
+++ fsf/trunk/libc/stdio-common/tmpnam_r.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1993,1996-1999,2000,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993,1996-2000,2007,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
@@ -28,7 +28,7 @@
 
   if (__path_search (s, L_tmpnam, NULL, NULL, 0))
     return NULL;
-  if (__gen_tempname (s, 0, __GT_NOCREATE))
+  if (__gen_tempname (s, 0, 0, __GT_NOCREATE))
     return NULL;
 
   return s;

Modified: fsf/trunk/libc/stdlib/stdlib.h
==============================================================================
--- fsf/trunk/libc/stdlib/stdlib.h (original)
+++ fsf/trunk/libc/stdlib/stdlib.h Fri Oct 30 05:59:49 2009
@@ -50,7 +50,7 @@
 #  if defined __GNUC__ && !defined __cplusplus
 #   define __WAIT_INT(status) \
   (__extension__ (((union { __typeof(status) __in; int __i; }) \
-                   { .__in = (status) }).__i))
+		   { .__in = (status) }).__i))
 #  else
 #   define __WAIT_INT(status)	(*(int *) &(status))
 #  endif
@@ -609,7 +609,7 @@
    Returns a file descriptor open on the file for reading and writing,
    or -1 if it cannot create a uniquely-named file.
 
-   This function is a possible cancellation points and therefore not
+   This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 # ifndef __USE_FILE_OFFSET64
 extern int mkstemp (char *__template) __nonnull ((1)) __wur;
@@ -623,6 +623,29 @@
 # endif
 # ifdef __USE_LARGEFILE64
 extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
+# endif
+#endif
+
+#ifdef __USE_MISC
+/* Similar to mkstemp, but the template can have a suffix after the
+   XXXXXX.  The length of the suffix is specified in the second
+   parameter.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+# ifndef __USE_FILE_OFFSET64
+extern int mkstemps (char *__template, int __suffixlen) __nonnull ((1)) __wur;
+# else
+#  ifdef __REDIRECT
+extern int __REDIRECT (mkstemps, (char *__template, int __suffixlen),
+		       mkstemps64) __nonnull ((1)) __wur;
+#  else
+#   define mkstemps mkstemps64
+#  endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int mkstemps64 (char *__template, int __suffixlen)
+     __nonnull ((1)) __wur;
 # endif
 #endif
 

Added: fsf/trunk/libc/sysdeps/generic/elf/ifunc-sel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/elf/ifunc-sel.h (added)
+++ fsf/trunk/libc/sysdeps/generic/elf/ifunc-sel.h Fri Oct 30 05:59:49 2009
@@ -1,0 +1,26 @@
+/* Used by the elf ifunc tests.  */
+#ifndef ELF_IFUNC_SEL_H
+#define ELF_IFUNC_SEL_H 1
+
+extern int global;
+
+static inline void *
+ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void))
+{
+ switch (global)
+   {
+   case 1:
+     return f1;
+   case -1:
+     return f2;
+   default:
+     return f3;
+   }
+}
+
+static inline void *
+ifunc_one (int (*f1) (void))
+{
+  return f1;
+}
+#endif

Modified: fsf/trunk/libc/sysdeps/gnu/netinet/udp.h
==============================================================================
--- fsf/trunk/libc/sysdeps/gnu/netinet/udp.h (original)
+++ fsf/trunk/libc/sysdeps/gnu/netinet/udp.h Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95, 96, 97, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-1997,2004,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
@@ -74,6 +74,16 @@
 };
 #endif
 
+/* UDP socket options */
+#define UDP_CORK	1	/* Never send partially complete segments.  */
+#define UDP_ENCAP	100	/* Set the socket to accept
+				   encapsulated packets.  */
+
+/* UDP encapsulation types */
+#define UDP_ENCAP_ESPINUDP_NON_IKE 1	/* draft-ietf-ipsec-nat-t-ike-00/01 */
+#define UDP_ENCAP_ESPINUDP	2	/* draft-ietf-ipsec-udp-encaps-06 */
+#define UDP_ENCAP_L2TPINUDP	3	/* rfc2661 */
+
 #define SOL_UDP            17      /* sockopt level for UDP */
 
 #endif /* netinet/udp.h */

Modified: fsf/trunk/libc/sysdeps/posix/tempname.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/tempname.c (original)
+++ fsf/trunk/libc/sysdeps/posix/tempname.c Fri Oct 30 05:59:49 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2001, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2001, 2006, 2007, 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
@@ -210,9 +210,9 @@
 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
 
 /* Generate a temporary file name based on TMPL.  TMPL must match the
-   rules for mk[s]temp (i.e. end in "XXXXXX").  The name constructed
-   does not exist at the time of the call to __gen_tempname.  TMPL is
-   overwritten with the result.
+   rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
+   The name constructed does not exist at the time of the call to
+   __gen_tempname.  TMPL is overwritten with the result.
 
    KIND may be one of:
    __GT_NOCREATE:	simply verify that the name does not exist
@@ -223,7 +223,7 @@
 
    We use a clever algorithm to get hard-to-predict names. */
 int
-__gen_tempname (char *tmpl, int flags, int kind)
+__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
 {
   int len;
   char *XXXXXX;
@@ -251,14 +251,14 @@
 #endif
 
   len = strlen (tmpl);
-  if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
+  if (len < 6 + suffixlen || memcmp (&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
     {
       __set_errno (EINVAL);
       return -1;
     }
 
   /* This is where the Xs start.  */
-  XXXXXX = &tmpl[len - 6];
+  XXXXXX = &tmpl[len - 6 - suffixlen];
 
   /* Get some more or less random data.  */
 #ifdef RANDOM_BITS

Added: fsf/trunk/libc/sysdeps/powerpc/elf/ifunc-sel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/elf/ifunc-sel.h (added)
+++ fsf/trunk/libc/sysdeps/powerpc/elf/ifunc-sel.h Fri Oct 30 05:59:49 2009
@@ -1,0 +1,46 @@
+/* Used by the elf ifunc tests.  */
+#ifndef ELF_IFUNC_SEL_H
+#define ELF_IFUNC_SEL_H 1
+
+extern int global;
+
+static inline void *
+ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void))
+{
+  register void *ret __asm__ ("r3");
+  __asm__ ("mflr 12\n\t"
+	   "bcl 20,31,1f\n"
+	   "1:\tmflr 11\n\t"
+	   "mtlr 12\n\t"
+	   "addis 12,11,global-1b@ha\n\t"
+	   "lwz 12,global-1b@l(12)\n\t"
+	   "addis %0,11,%2-1b@ha\n\t"
+	   "addi %0,%0,%2-1b@l\n\t"
+	   "cmpwi 12,1\n\t"
+	   "beqlr\n\t"
+	   "addis %0,11,%3-1b@ha\n\t"
+	   "addi %0,%0,%3-1b@l\n\t"
+	   "cmpwi 12,-1\n\t"
+	   "beqlr\n\t"
+	   "addis %0,11,%4-1b@ha\n\t"
+	   "addi %0,%0,%4-1b@l"
+	   : "=r" (ret)
+	   : "X" (&global), "X" (f1), "X" (f2), "X" (f3));
+  return ret;
+}
+
+static inline void *
+ifunc_one (int (*f1) (void))
+{
+  register void *ret __asm__ ("r3");
+  __asm__ ("mflr 12\n\t"
+	   "bcl 20,31,1f\n"
+	   "1:\tmflr %0\n\t"
+	   "mtlr 12\n\t"
+	   "addis %0,%0,%1-1b@ha\n\t"
+	   "addi %0,%0,%1-1b@l"
+	   : "=r" (ret)
+	   : "X" (f1));
+  return ret;
+}
+#endif

Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-irel.h (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-irel.h Fri Oct 30 05:59:49 2009
@@ -1,0 +1,45 @@
+/* Machine-dependent ELF indirect relocation inline functions.
+   PowerPC 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 <stdio.h>
+#include <unistd.h>
+
+#define ELF_MACHINE_IRELA	1
+
+static inline void
+__attribute ((always_inline))
+elf_irela (const Elf32_Rela *reloc)
+{
+  unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+
+  if (__builtin_expect (r_type == R_PPC_IRELATIVE, 1))
+    {
+      Elf32_Addr *const reloc_addr = (void *) reloc->r_offset;
+      Elf32_Addr value = ((Elf32_Addr (*) (void)) reloc->r_addend) ();
+      *reloc_addr = value;
+    }
+  else
+    __libc_fatal ("unexpected reloc type in static binary");
+}
+
+#endif /* dl-irel.h */

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-machine.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-machine.c (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-machine.c Fri Oct 30 05:59:49 2009
@@ -337,7 +337,7 @@
 }
 
 Elf32_Addr
-__elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
+__elf_machine_fixup_plt (struct link_map *map,
 			 Elf32_Addr *reloc_addr, Elf32_Addr finaladdr)
 {
   Elf32_Sword delta = finaladdr - (Elf32_Word) reloc_addr;
@@ -428,6 +428,10 @@
     case R_PPC_GLOB_DAT:
     case R_PPC_RELATIVE:
       *reloc_addr = finaladdr;
+      return;
+
+    case R_PPC_IRELATIVE:
+      *reloc_addr = ((Elf32_Addr (*) (void)) finaladdr) ();
       return;
 
     case R_PPC_UADDR32:

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-machine.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-machine.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-machine.h Fri Oct 30 05:59:49 2009
@@ -226,7 +226,6 @@
 
 /* Change the PLT entry whose reloc is 'reloc' to call the actual routine.  */
 extern Elf32_Addr __elf_machine_fixup_plt (struct link_map *map,
-					   const Elf32_Rela *reloc,
 					   Elf32_Addr *reloc_addr,
 					   Elf32_Addr finaladdr);
 
@@ -237,7 +236,7 @@
 {
   if (map->l_info[DT_PPC(GOT)] == 0)
     /* Handle old style PLT.  */
-    return __elf_machine_fixup_plt (map, reloc, reloc_addr, finaladdr);
+    return __elf_machine_fixup_plt (map, reloc_addr, finaladdr);
 
   *reloc_addr = finaladdr;
   return finaladdr;
@@ -316,6 +315,11 @@
 #else
   value = reloc->r_addend;
 #endif
+
+  if (sym != NULL
+      && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
+      && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
+    value = ((Elf32_Addr (*) (void)) value) ();
 
   /* A small amount of code is duplicated here for speed.  In libc,
      more than 90% of the relocs are R_PPC_RELATIVE; in the X11 shared

Added: fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h Fri Oct 30 05:59:49 2009
@@ -1,0 +1,58 @@
+/* Machine-dependent ELF indirect relocation inline functions.
+   PowerPC64 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 <stdio.h>
+#include <unistd.h>
+
+#define ELF_MACHINE_IRELA	1
+
+typedef struct
+{
+  Elf64_Addr fd_func;
+  Elf64_Addr fd_toc;
+  Elf64_Addr fd_aux;
+} Elf64_FuncDesc;
+
+static inline void
+__attribute ((always_inline))
+elf_irela (const Elf64_Rela *reloc)
+{
+  unsigned int r_type = ELF64_R_TYPE (reloc->r_info);
+
+  if (__builtin_expect (r_type == R_PPC64_IRELATIVE, 1))
+    {
+      Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
+      Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) ();
+      *reloc_addr = value;
+    }
+  else if (__builtin_expect (r_type == R_PPC64_JMP_IREL, 1))
+    {
+      Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
+      Elf64_Addr value = ((Elf64_Addr (*) (void)) reloc->r_addend) ();
+      *(Elf64_FuncDesc *) reloc_addr = *(Elf64_FuncDesc *) value;
+    }
+  else
+    __libc_fatal ("unexpected reloc type in static binary");
+}
+
+#endif /* dl-irel.h */

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-machine.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-machine.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-machine.h Fri Oct 30 05:59:49 2009
@@ -526,6 +526,29 @@
 }
 #endif
 
+/* Call function at address VALUE (an OPD entry) to resolve ifunc relocs.  */
+auto inline Elf64_Addr __attribute__ ((always_inline))
+resolve_ifunc (Elf64_Addr value,
+	       const struct link_map *map, const struct link_map *sym_map)
+{
+  /* The function we are calling may not yet have its opd entry relocated.  */
+  Elf64_FuncDesc opd;
+  if (map != sym_map
+#if !defined RTLD_BOOTSTRAP && defined SHARED
+      /* Bootstrap map doesn't have l_relocated set for it.  */
+      && sym_map != &GL(dl_rtld_map)
+#endif
+      && !sym_map->l_relocated)
+    {
+      Elf64_FuncDesc *func = (Elf64_FuncDesc *) value;
+      opd.fd_func = func->fd_func + sym_map->l_addr;
+      opd.fd_toc = func->fd_toc + sym_map->l_addr;
+      opd.fd_aux = func->fd_aux;
+      value = (Elf64_Addr) &opd;
+    }
+  return ((Elf64_Addr (*) (void)) value) ();
+}
+
 /* Perform the relocation specified by RELOC and SYM (which is fully
    resolved).  MAP is the object containing the reloc.  */
 auto inline void __attribute__ ((always_inline))
@@ -550,10 +573,16 @@
   if (__builtin_expect (r_type == R_PPC64_NONE, 0))
     return;
 
-  /* We need SYM_MAP even in the absence of TLS, for elf_machine_fixup_plt.  */
+  /* We need SYM_MAP even in the absence of TLS, for elf_machine_fixup_plt
+     and STT_GNU_IFUNC.  */
   struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
   Elf64_Addr value = ((sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value)
 		      + reloc->r_addend);
+
+  if (sym != NULL
+      && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
+      && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
+    value = resolve_ifunc (value, map, sym_map);
 
   /* For relocs that don't edit code, return.
      For relocs that might edit instructions, break from the switch.  */
@@ -564,6 +593,14 @@
       *reloc_addr = value;
       return;
 
+    case R_PPC64_IRELATIVE:
+      value = resolve_ifunc (value, map, sym_map);
+      *reloc_addr = value;
+      return;
+
+    case R_PPC64_JMP_IREL:
+      value = resolve_ifunc (value, map, sym_map);
+      /* Fall thru */
     case R_PPC64_JMP_SLOT:
 #ifdef RESOLVE_CONFLICT_FIND_MAP
       elf_machine_plt_conflict (reloc_addr, value);