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

[Commits] r18563 - in /fsf/trunk/libc: ./ elf/ nptl/ nptl/sysdeps/unix/sysv/linux/ nptl/sysdeps/unix/sysv/linux/x86_64/ nptl/sysdeps/x...



Author: eglibc
Date: Wed May 16 00:01:41 2012
New Revision: 18563

Log:
Import glibc-mainline for 2012-05-16

Added:
    fsf/trunk/libc/nptl/tst-cancel-self-cancelstate.c
    fsf/trunk/libc/nptl/tst-cancel-self-canceltype.c
    fsf/trunk/libc/nptl/tst-cancel-self-cleanup.c
    fsf/trunk/libc/nptl/tst-cancel-self-testcancel.c
    fsf/trunk/libc/nptl/tst-cancel-self.c
    fsf/trunk/libc/sysdeps/generic/stackguard-macros.h
    fsf/trunk/libc/sysdeps/i386/stackguard-macros.h
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbf.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/stackguard-macros.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/stackguard-macros.h
    fsf/trunk/libc/sysdeps/s390/s390-32/stackguard-macros.h
    fsf/trunk/libc/sysdeps/s390/s390-64/stackguard-macros.h
    fsf/trunk/libc/sysdeps/sparc/sparc32/stackguard-macros.h
    fsf/trunk/libc/sysdeps/sparc/sparc64/stackguard-macros.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/sigaltstack-offsets.sym
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/dl-cache.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
    fsf/trunk/libc/sysdeps/x86_64/64/Implies-after
    fsf/trunk/libc/sysdeps/x86_64/stackguard-macros.h
    fsf/trunk/libc/sysdeps/x86_64/x32/Implies-after
    fsf/trunk/libc/sysdeps/x86_64/x32/sysdep.h
Removed:
    fsf/trunk/libc/README.libm
    fsf/trunk/libc/elf/stackguard-macros.h
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/configure
    fsf/trunk/libc/configure.in
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/Makefile
    fsf/trunk/libc/nptl/descr.h
    fsf/trunk/libc/nptl/pthreadP.h
    fsf/trunk/libc/nptl/pthread_cancel.c
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/libc_multiple_threads.c
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
    fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
    fsf/trunk/libc/nptl/tst-stackguard1.c
    fsf/trunk/libc/nptl/vars.c
    fsf/trunk/libc/nscd/nscd-client.h
    fsf/trunk/libc/nscd/nscd_gethst_r.c
    fsf/trunk/libc/nscd/nscd_helper.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_log10.c
    fsf/trunk/libc/sysdeps/ieee754/dbl-64/e_log2.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/getsysstats.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/Makefile
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/clone.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/sigaction.c
    fsf/trunk/libc/sysdeps/x86_64/Implies
    fsf/trunk/libc/sysdeps/x86_64/__longjmp.S
    fsf/trunk/libc/sysdeps/x86_64/dl-trampoline.h
    fsf/trunk/libc/sysdeps/x86_64/memcpy.S
    fsf/trunk/libc/sysdeps/x86_64/multiarch/memcmp-sse4.S
    fsf/trunk/libc/sysdeps/x86_64/multiarch/memcpy-ssse3-back.S
    fsf/trunk/libc/sysdeps/x86_64/multiarch/memcpy-ssse3.S
    fsf/trunk/libc/sysdeps/x86_64/multiarch/strcmp-sse42.S
    fsf/trunk/libc/sysdeps/x86_64/setjmp.S
    fsf/trunk/libc/sysdeps/x86_64/stackinfo.h
    fsf/trunk/libc/sysdeps/x86_64/start.S
    fsf/trunk/libc/sysdeps/x86_64/strcmp.S
    fsf/trunk/libc/sysdeps/x86_64/sysdep.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed May 16 00:01:41 2012
@@ -1,3 +1,178 @@
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/Makefile (gen-as-const-headers):
+	Add sigaltstack-offsets.sym.
+	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Include
+	<sigaltstack-offsets.h>.
+	(CALL_FAIL): Use RSP_LP to operate on stack.  Use RDI_LP on
+	longjmp_msg pointer.
+	(____longjmp_chk): Use R8_LP and RDX_LP on SP and PC.  Use
+	R*_LP, sizeSS, oSS_FLAGS, oSS_SP and oSS_SIZE for alternate
+	signal stack.
+	* sysdeps/unix/sysv/linux/x86_64/sigaltstack-offsets.sym: New.
+
+2012-05-15  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* elf/stackguard-macros.h: Remove file.
+	* sysdeps/generic/stackguard-macros.h: New file.
+	* sysdeps/i386/stackguard-macros.h: Likewise.
+	* sysdeps/powerpc/powerpc32/stackguard-macros.h: Likewise.
+	* sysdeps/powerpc/powerpc64/stackguard-macros.h: Likewise.
+	* sysdeps/s390/s390-32/stackguard-macros.h: Likewise.
+	* sysdeps/s390/s390-64/stackguard-macros.h: Likewise.
+	* sysdeps/sparc/sparc32/stackguard-macros.h: Likewise.
+	* sysdeps/sparc/sparc64/stackguard-macros.h: Likewise.
+	* sysdeps/x86_64/stackguard-macros.h: Likewise.
+	* nptl/tst-stackguard1.c: Include <stackguard-macros.h> not
+	<elf/stackguard-macros.h>.
+
+	[BZ #14109]
+	* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h (elf_vrreg_t): Use
+	__aligned__ in attribute.
+	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h (__psw_t): Likewise.
+	(gregset_t): Likewise.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/Implies (wordsize-64): Moved to ....
+	* sysdeps/x86_64/64/Implies-after: Here.  New file.
+	* sysdeps/x86_64/x32/Implies-after: New file.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/dl-trampoline.h: Use R*_LP to pass arguments
+	and access return value for _dl_profile_fixup.  Use R10_LP to
+	load frame size.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/x32/init-first.c: New.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/sysdep.h: Allowed to be include more than once.
+	* sysdeps/x86_64/x32/sysdep.h: New file.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/__longjmp.S: Use R*_LP on SP and PC.
+	* sysdeps/x86_64/setjmp.S: Likewise.
+
+2012-05-15  Adhemerval Zanella  <azanella@xxxxxxxxxxxxxxxxxx>
+
+	* sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c: New file.
+	* sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c: New file.
+	* sysdeps/ieee754/dbl-64/e_log2.c: Fixing indents.
+	* sysdeps/ieee754/dbl-64/e_log10.c: Likewise and also
+	remove unused global constant.
+
+2012-05-15  Chris Metcalf  <cmetcalf@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/getsysstats.c: Remove duplicate
+	include of <not-cancel.h>.
+
+2012-05-15  Roland McGrath  <roland@xxxxxxxxxxxxx>
+
+	* nscd/nscd-client.h (__nscd_acquire_maplock): Fix formatting.
+
+2012-05-15  Jeff Law  <law@xxxxxxxxxx>
+	    Andreas Jaeger  <aj@xxxxxxx>
+
+	[BZ #13594]
+	* nscd/nscd-client.h (__nscd_acquire_maplock): New function, split
+	out from...
+	* nscd/nscd_helper.c (__nscd_get_map_ref): ... here.
+	* nscd/nscd-client.h: Add __nscd_acquire_maplock.
+	* nscd/nscd_gethst_r.c (__nscd_get_nl_timestamp): Add locking to
+	code changing __hst_map_handle.map.
+
+2012-05-15  Roland McGrath  <roland@xxxxxxxxxxxxx>
+
+	* configure.in (sysnames): Look for Implies-before and Implies-after
+	files.
+	* configure: Regenerated.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/sigaction.c (RESTORE2): Replace
+	8-byte data alignment with LP_SIZE alignment.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/clone.S: Load pointer to TID
+	into R10_LP.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/x32/dl-cache.h: New.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile: New file.
+	* sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c:
+	Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S: Likewise.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/stackinfo.h (stackinfo_get_sp): Use RSP_LP.
+	(stackinfo_sub_sp): Likewise.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/strcmp-sse42.S: Load pointers into
+	RAX_LP.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/memcpy-ssse3.S: Load cache sizes
+	into R*_LP.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Load cache
+	sizes into R*_LP.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/strcmp.S: Load pointers into R*_LP.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/memcpy.S: Load __x86_64_data_cache_size_half
+	into R11_LP and load __x86_64_shared_cache_size_half into
+	R8_LP.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/memcmp-sse4.S: Load cache size into
+	R8_LP.
+
+2012-05-15  Adhemerval Zanella  <azanella@xxxxxxxxxxxxxxxxxx>
+
+	* sysdeps/powerpc/powerpc32/power7/fpu/s_logb.c: New file. Optimized
+	logb for POWER7.
+	* sysdeps/powerpc/powerpc32/power7/fpu/s_logbf.c: New file. Optimized
+	logbf for POWER7.
+	* sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c: New file. Optimized
+	logbl for POWER7.
+	* sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c: New file. Use
+	powerpc32/power7/fpu/s_logb.c via #include.
+	* sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c: New file. Use
+	powerpc32/power7/fpu/s_logbf.c via #include.
+	* sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c: New file. Use
+	powerpc32/power7/fpu/s_logbl.c via #include.
+
+2012-05-15  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* README.libm: Remove file.
+
+2012-05-14  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/start.S: Simulate popping 4-byte argument
+	count for x32.  Use R*_LP and omit operand-size suffix.
+
 2012-05-14  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
 
 	* shlib-versions: Move x86_64-.*-linux.* entries to ...

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Wed May 16 00:01:41 2012
@@ -15,17 +15,19 @@
   5077, 5461, 5805, 5993, 6471, 6486, 6578, 6649, 6730, 6770, 6794, 6884,
   6890, 6894, 6895, 6907, 6911, 6959, 7064, 9739, 9902, 10110, 10135, 10140,
   10153, 10210, 10254, 10346, 10545, 10716, 11174, 11322, 11365, 11451,
-  11494, 11521, 11837, 11959, 12047, 12340, 13058, 13525, 13526, 13527,
-  13528, 13529, 13530, 13531, 13532, 13533, 13547, 13551, 13552, 13553,
-  13555, 13559, 13563, 13566, 13583, 13592, 13618, 13637, 13656, 13658,
-  13673, 13691, 13695, 13704, 13705, 13706, 13726, 13738, 13739, 13750,
-  13758, 13760, 13761, 13775, 13786, 13787, 13792, 13806, 13824, 13840,
-  13841, 13844, 13846, 13851, 13852, 13854, 13871, 13872, 13873, 13879,
-  13883, 13884, 13885, 13886, 13892, 13895, 13908, 13910, 13911, 13912,
-  13913, 13914, 13915, 13916, 13917, 13918, 13919, 13920, 13921, 13922,
-  13923, 13924, 13926, 13927, 13928, 13938, 13941, 13942, 13954, 13955,
-  13956, 13963, 13967, 13970, 13973, 13979, 13983, 14012, 14027, 14033,
-  14034, 14040, 14049, 14053, 14055, 14064, 14080, 14083, 14103, 14104
+  11494, 11521, 11677, 11837, 11959, 12047, 12097, 12193, 12297, 12298,
+  12301, 12340, 12354, 13058, 13361, 13525, 13526, 13527, 13528, 13529,
+  13530, 13531, 13532, 13533, 13547, 13551, 13552, 13553, 13555, 13556,
+  13559, 13563, 13566, 13583, 13592, 13594, 13613, 13618, 13637, 13656,
+  13658, 13673, 13691, 13695, 13704, 13705, 13706, 13726, 13738, 13739,
+  13750, 13758, 13760, 13761, 13775, 13786, 13787, 13792, 13806, 13824,
+  13840, 13841, 13844, 13846, 13851, 13852, 13854, 13871, 13872, 13873,
+  13879, 13883, 13884, 13885, 13886, 13892, 13895, 13908, 13910, 13911,
+  13912, 13913, 13914, 13915, 13916, 13917, 13918, 13919, 13920, 13921,
+  13922, 13923, 13924, 13926, 13927, 13928, 13938, 13941, 13942, 13954,
+  13955, 13956, 13963, 13967, 13970, 13973, 13979, 13983, 13986, 14012,
+  14027, 14033, 14034, 14040, 14043, 14044, 14049, 14053, 14055, 14064,
+  14080, 14083, 14103, 14104, 14109
 
 * ISO C11 support:
 

Removed: fsf/trunk/libc/README.libm
==============================================================================
--- fsf/trunk/libc/README.libm (original)
+++ fsf/trunk/libc/README.libm (removed)
@@ -1,856 +1,0 @@
-The following functions for the `long double' versions of the libm
-function have to be written:
-
-e_acosl.c
-e_asinl.c
-e_atan2l.c
-e_expl.c
-e_fmodl.c
-e_hypotl.c
-e_j0l.c
-e_j1l.c
-e_jnl.c
-e_lgammal_r.c
-e_logl.c
-e_log10l.c
-e_powl.c
-e_rem_pio2l.c
-e_sinhl.c
-e_sqrtl.c
-
-k_cosl.c
-k_rem_pio2l.c
-k_sinl.c
-k_tanl.c
-
-s_atanl.c
-s_erfl.c
-s_expm1l.c
-s_log1pl.c
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-			       Methods
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-arcsin
-~~~~~~
- *	Since  asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...
- *	we approximate asin(x) on [0,0.5] by
- *		asin(x) = x + x*x^2*R(x^2)
- *	where
- *		R(x^2) is a rational approximation of (asin(x)-x)/x^3
- *	and its remez error is bounded by
- *		|(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75)
- *
- *	For x in [0.5,1]
- *		asin(x) = pi/2-2*asin(sqrt((1-x)/2))
- *	Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2;
- *	then for x>0.98
- *		asin(x) = pi/2 - 2*(s+s*z*R(z))
- *			= pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)
- *	For x<=0.98, let pio4_hi = pio2_hi/2, then
- *		f = hi part of s;
- *		c = sqrt(z) - f = (z-f*f)/(s+f) 	...f+c=sqrt(z)
- *	and
- *		asin(x) = pi/2 - 2*(s+s*z*R(z))
- *			= pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)
- *			= pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c))
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-arccos
-~~~~~~
- * Method :
- *	acos(x)  = pi/2 - asin(x)
- *	acos(-x) = pi/2 + asin(x)
- * For |x|<=0.5
- *	acos(x) = pi/2 - (x + x*x^2*R(x^2))	(see asin.c)
- * For x>0.5
- * 	acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2)))
- *		= 2asin(sqrt((1-x)/2))
- *		= 2s + 2s*z*R(z) 	...z=(1-x)/2, s=sqrt(z)
- *		= 2f + (2c + 2s*z*R(z))
- *     where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term
- *     for f so that f+c ~ sqrt(z).
- * For x<-0.5
- *	acos(x) = pi - 2asin(sqrt((1-|x|)/2))
- *		= pi - 0.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-atan2
-~~~~~
- * Method :
- *	1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
- *	2. Reduce x to positive by (if x and y are unexceptional):
- *		ARG (x+iy) = arctan(y/x)   	   ... if x > 0,
- *		ARG (x+iy) = pi - arctan[y/(-x)]   ... if x < 0,
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-atan
-~~~~
- * Method
- *   1. Reduce x to positive by atan(x) = -atan(-x).
- *   2. According to the integer k=4t+0.25 chopped, t=x, the argument
- *      is further reduced to one of the following intervals and the
- *      arctangent of t is evaluated by the corresponding formula:
- *
- *      [0,7/16]      atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...)
- *      [7/16,11/16]  atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) )
- *      [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) )
- *      [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) )
- *      [39/16,INF]   atan(x) = atan(INF) + atan( -1/t )
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-exp
-~~~
- * Method
- *   1. Argument reduction:
- *      Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.
- *	Given x, find r and integer k such that
- *
- *               x = k*ln2 + r,  |r| <= 0.5*ln2.
- *
- *      Here r will be represented as r = hi-lo for better
- *	accuracy.
- *
- *   2. Approximation of exp(r) by a special rational function on
- *	the interval [0,0.34658]:
- *	Write
- *	    R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ...
- *      We use a special Reme algorithm on [0,0.34658] to generate
- * 	a polynomial of degree 5 to approximate R. The maximum error
- *	of this polynomial approximation is bounded by 2**-59. In
- *	other words,
- *	    R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5
- *  	(where z=r*r, and the values of P1 to P5 are listed below)
- *	and
- *	    |                  5          |     -59
- *	    | 2.0+P1*z+...+P5*z   -  R(z) | <= 2
- *	    |                             |
- *	The computation of exp(r) thus becomes
- *                             2*r
- *		exp(r) = 1 + -------
- *		              R - r
- *                                 r*R1(r)
- *		       = 1 + r + ----------- (for better accuracy)
- *		                  2 - R1(r)
- *	where
- *			         2       4             10
- *		R1(r) = r - (P1*r  + P2*r  + ... + P5*r   ).
- *
- *   3. Scale back to obtain exp(x):
- *	From step 1, we have
- *	   exp(x) = 2^k * exp(r)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-hypot
-~~~~~
- *	If (assume round-to-nearest) z=x*x+y*y
- *	has error less than sqrt(2)/2 ulp, than
- *	sqrt(z) has error less than 1 ulp (exercise).
- *
- *	So, compute sqrt(x*x+y*y) with some care as
- *	follows to get the error below 1 ulp:
- *
- *	Assume x>y>0;
- *	(if possible, set rounding to round-to-nearest)
- *	1. if x > 2y  use
- *		x1*x1+(y*y+(x2*(x+x1))) for x*x+y*y
- *	where x1 = x with lower 32 bits cleared, x2 = x-x1; else
- *	2. if x <= 2y use
- *		t1*y1+((x-y)*(x-y)+(t1*y2+t2*y))
- *	where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1,
- *	y1= y with lower 32 bits chopped, y2 = y-y1.
- *
- *	NOTE: scaling may be necessary if some argument is too
- *	      large or too tiny
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-j0/y0
-~~~~~
- * Method -- j0(x):
- *	1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ...
- *	2. Reduce x to |x| since j0(x)=j0(-x),  and
- *	   for x in (0,2)
- *		j0(x) = 1-z/4+ z^2*R0/S0,  where z = x*x;
- *	   (precision:  |j0-1+z/4-z^2R0/S0 |<2**-63.67 )
- *	   for x in (2,inf)
- * 		j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))
- * 	   where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
- *	   as follow:
- *		cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)
- *			= 1/sqrt(2) * (cos(x) + sin(x))
- *		sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4)
- *			= 1/sqrt(2) * (sin(x) - cos(x))
- * 	   (To avoid cancellation, use
- *		sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * 	    to compute the worse one.)
- *
- * Method -- y0(x):
- *	1. For x<2.
- *	   Since
- *		y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...)
- *	   therefore y0(x)-2/pi*j0(x)*ln(x) is an even function.
- *	   We use the following function to approximate y0,
- *		y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2
- *	   where
- *		U(z) = u00 + u01*z + ... + u06*z^6
- *		V(z) = 1  + v01*z + ... + v04*z^4
- *	   with absolute approximation error bounded by 2**-72.
- *	   Note: For tiny x, U/V = u0 and j0(x)~1, hence
- *		y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27)
- *	2. For x>=2.
- * 		y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0))
- * 	   where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)
- *	   by the method mentioned above.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-j1/y1
-~~~~~
- * Method -- j1(x):
- *	1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ...
- *	2. Reduce x to |x| since j1(x)=-j1(-x),  and
- *	   for x in (0,2)
- *		j1(x) = x/2 + x*z*R0/S0,  where z = x*x;
- *	   (precision:  |j1/x - 1/2 - R0/S0 |<2**-61.51 )
- *	   for x in (2,inf)
- * 		j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
- * 		y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- * 	   where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
- *	   as follow:
- *		cos(x1) =  cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
- *			=  1/sqrt(2) * (sin(x) - cos(x))
- *		sin(x1) =  sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
- *			= -1/sqrt(2) * (sin(x) + cos(x))
- * 	   (To avoid cancellation, use
- *		sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * 	    to compute the worse one.)
- *
- * Method -- y1(x):
- *	1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN
- *	2. For x<2.
- *	   Since
- *		y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...)
- *	   therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function.
- *	   We use the following function to approximate y1,
- *		y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2
- *	   where for x in [0,2] (abs err less than 2**-65.89)
- *		U(z) = U0[0] + U0[1]*z + ... + U0[4]*z^4
- *		V(z) = 1  + v0[0]*z + ... + v0[4]*z^5
- *	   Note: For tiny x, 1/x dominate y1 and hence
- *		y1(tiny) = -2/pi/tiny, (choose tiny<2**-54)
- *	3. For x>=2.
- * 		y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- * 	   where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
- *	   by method mentioned above.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-jn/yn
-~~~~~
- * Note 2. About jn(n,x), yn(n,x)
- *	For n=0, j0(x) is called,
- *	for n=1, j1(x) is called,
- *	for n<x, forward recursion us used starting
- *	from values of j0(x) and j1(x).
- *	for n>x, a continued fraction approximation to
- *	j(n,x)/j(n-1,x) is evaluated and then backward
- *	recursion is used starting from a supposed value
- *	for j(n,x). The resulting value of j(0,x) is
- *	compared with the actual value to correct the
- *	supposed value of j(n,x).
- *
- *	yn(n,x) is similar in all respects, except
- *	that forward recursion is used for all
- *	values of n>1.
-
-jn:
-    /* (x >> n**2)
-     *	    Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
-     *	    Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
-     *	    Let s=sin(x), c=cos(x),
-     *		xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
-     *
-     *		   n	sin(xn)*sqt2	cos(xn)*sqt2
-     *		----------------------------------
-     *		   0	 s-c		 c+s
-     *		   1	-s-c 		-c+s
-     *		   2	-s+c		-c-s
-     *		   3	 s+c		 c-s
-...
-    /* x is tiny, return the first Taylor expansion of J(n,x)
-     * J(n,x) = 1/n!*(x/2)^n  - ...
-...
-		/* use backward recurrence */
-		/* 			x      x^2      x^2
-		 *  J(n,x)/J(n-1,x) =  ----   ------   ------   .....
-		 *			2n  - 2(n+1) - 2(n+2)
-		 *
-		 * 			1      1        1
-		 *  (for large x)   =  ----  ------   ------   .....
-		 *			2n   2(n+1)   2(n+2)
-		 *			-- - ------ - ------ -
-		 *			 x     x         x
-		 *
-		 * Let w = 2n/x and h=2/x, then the above quotient
-		 * is equal to the continued fraction:
-		 *		    1
-		 *	= -----------------------
-		 *		       1
-		 *	   w - -----------------
-		 *			  1
-		 * 	        w+h - ---------
-		 *		       w+2h - ...
-		 *
-		 * To determine how many terms needed, let
-		 * Q(0) = w, Q(1) = w(w+h) - 1,
-		 * Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
-		 * When Q(k) > 1e4	good for single
-		 * When Q(k) > 1e9	good for double
-		 * When Q(k) > 1e17	good for quadruple
-
-...
-		/*  estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)
-		 *  Hence, if n*(log(2n/x)) > ...
-		 *  single 8.8722839355e+01
-		 *  double 7.09782712893383973096e+02
-		 *  long double 1.1356523406294143949491931077970765006170e+04
-		 *  then recurrent value may overflow and the result is
-		 *  likely underflow to zero
-
-yn:
-    /* (x >> n**2)
-     *	    Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
-     *	    Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
-     *	    Let s=sin(x), c=cos(x),
-     *		xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
-     *
-     *		   n	sin(xn)*sqt2	cos(xn)*sqt2
-     *		----------------------------------
-     *		   0	 s-c		 c+s
-     *		   1	-s-c 		-c+s
-     *		   2	-s+c		-c-s
-     *		   3	 s+c		 c-s
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-lgamma
-~~~~~~
- * Method:
- *   1. Argument Reduction for 0 < x <= 8
- * 	Since gamma(1+s)=s*gamma(s), for x in [0,8], we may
- * 	reduce x to a number in [1.5,2.5] by
- * 		lgamma(1+s) = log(s) + lgamma(s)
- *	for example,
- *		lgamma(7.3) = log(6.3) + lgamma(6.3)
- *			    = log(6.3*5.3) + lgamma(5.3)
- *			    = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3)
- *   2. Polynomial approximation of lgamma around its
- *	minimun ymin=1.461632144968362245 to maintain monotonicity.
- *	On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use
- *		Let z = x-ymin;
- *		lgamma(x) = -1.214862905358496078218 + z^2*poly(z)
- *	where
- *		poly(z) is a 14 degree polynomial.
- *   2. Rational approximation in the primary interval [2,3]
- *	We use the following approximation:
- *		s = x-2.0;
- *		lgamma(x) = 0.5*s + s*P(s)/Q(s)
- *	with accuracy
- *		|P/Q - (lgamma(x)-0.5s)| < 2**-61.71
- *	Our algorithms are based on the following observation
- *
- *                             zeta(2)-1    2    zeta(3)-1    3
- * lgamma(2+s) = s*(1-Euler) + --------- * s  -  --------- * s  + ...
- *                                 2                 3
- *
- *	where Euler = 0.5771... is the Euler constant, which is very
- *	close to 0.5.
- *
- *   3. For x>=8, we have
- *	lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+....
- *	(better formula:
- *	   lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...)
- *	Let z = 1/x, then we approximation
- *		f(z) = lgamma(x) - (x-0.5)(log(x)-1)
- *	by
- *	  			    3       5             11
- *		w = w0 + w1*z + w2*z  + w3*z  + ... + w6*z
- *	where
- *		|w - f(z)| < 2**-58.74
- *
- *   4. For negative x, since (G is gamma function)
- *		-x*G(-x)*G(x) = pi/sin(pi*x),
- * 	we have
- * 		G(x) = pi/(sin(pi*x)*(-x)*G(-x))
- *	since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0
- *	Hence, for x<0, signgam = sign(sin(pi*x)) and
- *		lgamma(x) = log(|Gamma(x)|)
- *			  = log(pi/(|x*sin(pi*x)|)) - lgamma(-x);
- *	Note: one should avoid compute pi*(-x) directly in the
- *	      computation of sin(pi*(-x)).
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-log
-~~~
- * Method :
- *   1. Argument Reduction: find k and f such that
- *			x = 2^k * (1+f),
- *	   where  sqrt(2)/2 < 1+f < sqrt(2) .
- *
- *   2. Approximation of log(1+f).
- *	Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
- *		 = 2s + 2/3 s**3 + 2/5 s**5 + .....,
- *	     	 = 2s + s*R
- *      We use a special Reme algorithm on [0,0.1716] to generate
- * 	a polynomial of degree 14 to approximate R The maximum error
- *	of this polynomial approximation is bounded by 2**-58.45. In
- *	other words,
- *		        2      4      6      8      10      12      14
- *	    R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s  +Lg6*s  +Lg7*s
- *  	(the values of Lg1 to Lg7 are listed in the program)
- *	and
- *	    |      2          14          |     -58.45
- *	    | Lg1*s +...+Lg7*s    -  R(z) | <= 2
- *	    |                             |
- *	Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
- *	In order to guarantee error in log below 1ulp, we compute log
- *	by
- *		log(1+f) = f - s*(f - R)	(if f is not too large)
- *		log(1+f) = f - (hfsq - s*(hfsq+R)).	(better accuracy)
- *
- *	3. Finally,  log(x) = k*ln2 + log(1+f).
- *			    = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
- *	   Here ln2 is split into two floating point number:
- *			ln2_hi + ln2_lo,
- *	   where n*ln2_hi is always exact for |n| < 2000.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-log10
-~~~~~
- * Method :
- *	Let log10_2hi = leading 40 bits of log10(2) and
- *	    log10_2lo = log10(2) - log10_2hi,
- *	    ivln10   = 1/log(10) rounded.
- *	Then
- *		n = ilogb(x),
- *		if(n<0)  n = n+1;
- *		x = scalbn(x,-n);
- *		log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x))
- *
- * Note 1:
- *	To guarantee log10(10**n)=n, where 10**n is normal, the rounding
- *	mode must set to Round-to-Nearest.
- * Note 2:
- *	[1/log(10)] rounded to 53 bits has error  .198   ulps;
- *	log10 is monotonic at all binary break points.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-pow
-~~~
- * Method:  Let x =  2   * (1+f)
- *	1. Compute and return log2(x) in two pieces:
- *		log2(x) = w1 + w2,
- *	   where w1 has 53-24 = 29 bit trailing zeros.
- *	2. Perform y*log2(x) = n+y' by simulating muti-precision
- *	   arithmetic, where |y'|<=0.5.
- *	3. Return x**y = 2**n*exp(y'*log2)
- *
- * Special cases:
- *	1.  (anything) ** 0  is 1
- *	2.  (anything) ** 1  is itself
- *	3.  (anything) ** NAN is NAN
- *	4.  NAN ** (anything except 0) is NAN
- *	5.  +-(|x| > 1) **  +INF is +INF
- *	6.  +-(|x| > 1) **  -INF is +0
- *	7.  +-(|x| < 1) **  +INF is +0
- *	8.  +-(|x| < 1) **  -INF is +INF
- *	9.  +-1         ** +-INF is NAN
- *	10. +0 ** (+anything except 0, NAN)               is +0
- *	11. -0 ** (+anything except 0, NAN, odd integer)  is +0
- *	12. +0 ** (-anything except 0, NAN)               is +INF
- *	13. -0 ** (-anything except 0, NAN, odd integer)  is +INF
- *	14. -0 ** (odd integer) = -( +0 ** (odd integer) )
- *	15. +INF ** (+anything except 0,NAN) is +INF
- *	16. +INF ** (-anything except 0,NAN) is +0
- *	17. -INF ** (anything)  = -0 ** (-anything)
- *	18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
- *	19. (-anything except 0 and inf) ** (non-integer) is NAN
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-rem_pio2	return the remainder of x rem pi/2 in y[0]+y[1]
-~~~~~~~~
-This is one of the basic functions which is written with highest accuracy
-in mind.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-sinh
-~~~~
- * Method :
- * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
- *	1. Replace x by |x| (sinh(-x) = -sinh(x)).
- *	2.
- *		                                    E + E/(E+1)
- *	    0        <= x <= 22     :  sinh(x) := --------------, E=expm1(x)
- *			       			        2
- *
- *	    22       <= x <= lnovft :  sinh(x) := exp(x)/2
- *	    lnovft   <= x <= ln2ovft:  sinh(x) := exp(x/2)/2 * exp(x/2)
- *	    ln2ovft  <  x	    :  sinh(x) := x*shuge (overflow)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-sqrt
-~~~~
- * Method:
- *   Bit by bit method using integer arithmetic. (Slow, but portable)
- *   1. Normalization
- *	Scale x to y in [1,4) with even powers of 2:
- *	find an integer k such that  1 <= (y=x*2^(-2k)) < 4, then
- *		sqrt(x) = 2^k * sqrt(y)
- *   2. Bit by bit computation
- *	Let q  = sqrt(y) truncated to i bit after binary point (q = 1),
- *	     i							 0
- *                                     i+1         2
- *	    s  = 2*q , and	y  =  2   * ( y - q  ).		(1)
- *	     i      i            i                 i
- *
- *	To compute q    from q , one checks whether
- *		    i+1       i
- *
- *			      -(i+1) 2
- *			(q + 2      ) <= y.			(2)
- *     			  i
- *							      -(i+1)
- *	If (2) is false, then q   = q ; otherwise q   = q  + 2      .
- *		 	       i+1   i             i+1   i
- *
- *	With some algebric manipulation, it is not difficult to see
- *	that (2) is equivalent to
- *                             -(i+1)
- *			s  +  2       <= y			(3)
- *			 i                i
- *
- *	The advantage of (3) is that s  and y  can be computed by
- *				      i      i
- *	the following recurrence formula:
- *	    if (3) is false
- *
- *	    s     =  s  ,	y    = y   ;			(4)
- *	     i+1      i		 i+1    i
- *
- *	    otherwise,
- *                         -i                     -(i+1)
- *	    s	  =  s  + 2  ,  y    = y  -  s  - 2  		(5)
- *           i+1      i          i+1    i     i
- *
- *	One may easily use induction to prove (4) and (5).
- *	Note. Since the left hand side of (3) contain only i+2 bits,
- *	      it does not necessary to do a full (53-bit) comparison
- *	      in (3).
- *   3. Final rounding
- *	After generating the 53 bits result, we compute one more bit.
- *	Together with the remainder, we can decide whether the
- *	result is exact, bigger than 1/2ulp, or less than 1/2ulp
- *	(it will never equal to 1/2ulp).
- *	The rounding mode can be detected by checking whether
- *	huge + tiny is equal to huge, and whether huge - tiny is
- *	equal to huge for some floating point number "huge" and "tiny".
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-cos
-~~~
- * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164
- * Input x is assumed to be bounded by ~pi/4 in magnitude.
- * Input y is the tail of x.
- *
- * Algorithm
- *	1. Since cos(-x) = cos(x), we need only to consider positive x.
- *	2. if x < 2^-27 (hx<0x3e400000 0), return 1 with inexact if x!=0.
- *	3. cos(x) is approximated by a polynomial of degree 14 on
- *	   [0,pi/4]
- *		  	                 4            14
- *	   	cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x
- *	   where the remez error is
- *
- * 	|              2     4     6     8     10    12     14 |     -58
- * 	|cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x  +C6*x  )| <= 2
- * 	|    					               |
- *
- * 	               4     6     8     10    12     14
- *	4. let r = C1*x +C2*x +C3*x +C4*x +C5*x  +C6*x  , then
- *	       cos(x) = 1 - x*x/2 + r
- *	   since cos(x+y) ~ cos(x) - sin(x)*y
- *			  ~ cos(x) - x*y,
- *	   a correction term is necessary in cos(x) and hence
- *		cos(x+y) = 1 - (x*x/2 - (r - x*y))
- *	   For better accuracy when x > 0.3, let qx = |x|/4 with
- *	   the last 32 bits mask off, and if x > 0.78125, let qx = 0.28125.
- *	   Then
- *		cos(x+y) = (1-qx) - ((x*x/2-qx) - (r-x*y)).
- *	   Note that 1-qx and (x*x/2-qx) is EXACT here, and the
- *	   magnitude of the latter is at least a quarter of x*x/2,
- *	   thus, reducing the rounding error in the subtraction.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-sin
-~~~
- * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854
- * Input x is assumed to be bounded by ~pi/4 in magnitude.
- * Input y is the tail of x.
- * Input iy indicates whether y is 0. (if iy=0, y assume to be 0).
- *
- * Algorithm
- *	1. Since sin(-x) = -sin(x), we need only to consider positive x.
- *	2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0.
- *	3. sin(x) is approximated by a polynomial of degree 13 on
- *	   [0,pi/4]
- *		  	         3            13
- *	   	sin(x) ~ x + S1*x + ... + S6*x
- *	   where
- *
- * 	|sin(x)         2     4     6     8     10     12  |     -58
- * 	|----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x  +S6*x   )| <= 2
- * 	|  x 					           |
- *
- *	4. sin(x+y) = sin(x) + sin'(x')*y
- *		    ~ sin(x) + (1-x*x/2)*y
- *	   For better accuracy, let
- *		     3      2      2      2      2
- *		r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6))))
- *	   then                   3    2
- *		sin(x) = x + (S1*x + (x *(r-y/2)+y))
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-tan
-~~~
- * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
- * Input x is assumed to be bounded by ~pi/4 in magnitude.
- * Input y is the tail of x.
- * Input k indicates whether tan (if k=1) or
- * -1/tan (if k= -1) is returned.
- *
- * Algorithm
- *	1. Since tan(-x) = -tan(x), we need only to consider positive x.
- *	2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0.
- *	3. tan(x) is approximated by a odd polynomial of degree 27 on
- *	   [0,0.67434]
- *		  	         3             27
- *	   	tan(x) ~ x + T1*x + ... + T13*x
- *	   where
- *
- * 	        |tan(x)         2     4            26   |     -59.2
- * 	        |----- - (1+T1*x +T2*x +.... +T13*x    )| <= 2
- * 	        |  x 					|
- *
- *	   Note: tan(x+y) = tan(x) + tan'(x)*y
- *		          ~ tan(x) + (1+x*x)*y
- *	   Therefore, for better accuracy in computing tan(x+y), let
- *		     3      2      2       2       2
- *		r = x *(T2+x *(T3+x *(...+x *(T12+x *T13))))
- *	   then
- *		 		    3    2
- *		tan(x+y) = x + (T1*x + (x *(r+y)+y))
- *
- *      4. For x in [0.67434,pi/4],  let y = pi/4 - x, then
- *		tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y))
- *		       = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-atan
-~~~~
- * Method
- *   1. Reduce x to positive by atan(x) = -atan(-x).
- *   2. According to the integer k=4t+0.25 chopped, t=x, the argument
- *      is further reduced to one of the following intervals and the
- *      arctangent of t is evaluated by the corresponding formula:
- *
- *      [0,7/16]      atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...)
- *      [7/16,11/16]  atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) )
- *      [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) )
- *      [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) )
- *      [39/16,INF]   atan(x) = atan(INF) + atan( -1/t )
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-erf
-~~~
- *			     x
- *		      2      |\
- *     erf(x)  =  ---------  | exp(-t*t)dt
- *	 	   sqrt(pi) \|
- *			     0
- *
- *     erfc(x) =  1-erf(x)
- *  Note that
- *		erf(-x) = -erf(x)
- *		erfc(-x) = 2 - erfc(x)
- *
- * Method:
- *	1. For |x| in [0, 0.84375]
- *	    erf(x)  = x + x*R(x^2)
- *          erfc(x) = 1 - erf(x)           if x in [-.84375,0.25]
- *                  = 0.5 + ((0.5-x)-x*R)  if x in [0.25,0.84375]
- *	   where R = P/Q where P is an odd poly of degree 8 and
- *	   Q is an odd poly of degree 10.
- *						 -57.90
- *			| R - (erf(x)-x)/x | <= 2
- *
- *
- *	   Remark. The formula is derived by noting
- *          erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....)
- *	   and that
- *          2/sqrt(pi) = 1.128379167095512573896158903121545171688
- *	   is close to one. The interval is chosen because the fix
- *	   point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is
- *	   near 0.6174), and by some experiment, 0.84375 is chosen to
- * 	   guarantee the error is less than one ulp for erf.
- *
- *      2. For |x| in [0.84375,1.25], let s = |x| - 1, and
- *         c = 0.84506291151 rounded to single (24 bits)
- *         	erf(x)  = sign(x) * (c  + P1(s)/Q1(s))
- *         	erfc(x) = (1-c)  - P1(s)/Q1(s) if x > 0
- *			  1+(c+P1(s)/Q1(s))    if x < 0
- *         	|P1/Q1 - (erf(|x|)-c)| <= 2**-59.06
- *	   Remark: here we use the taylor series expansion at x=1.
- *		erf(1+s) = erf(1) + s*Poly(s)
- *			 = 0.845.. + P1(s)/Q1(s)
- *	   That is, we use rational approximation to approximate
- *			erf(1+s) - (c = (single)0.84506291151)
- *	   Note that |P1/Q1|< 0.078 for x in [0.84375,1.25]
- *	   where
- *		P1(s) = degree 6 poly in s
- *		Q1(s) = degree 6 poly in s
- *
- *      3. For x in [1.25,1/0.35(~2.857143)],
- *         	erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1)
- *         	erf(x)  = 1 - erfc(x)
- *	   where
- *		R1(z) = degree 7 poly in z, (z=1/x^2)
- *		S1(z) = degree 8 poly in z
- *
- *      4. For x in [1/0.35,28]
- *         	erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0
- *			= 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6<x<0
- *			= 2.0 - tiny		(if x <= -6)
- *         	erf(x)  = sign(x)*(1.0 - erfc(x)) if x < 6, else
- *         	erf(x)  = sign(x)*(1.0 - tiny)
- *	   where
- *		R2(z) = degree 6 poly in z, (z=1/x^2)
- *		S2(z) = degree 7 poly in z
- *
- *      Note1:
- *	   To compute exp(-x*x-0.5625+R/S), let s be a single
- *	   precision number and s := x; then
- *		-x*x = -s*s + (s-x)*(s+x)
- *	        exp(-x*x-0.5626+R/S) =
- *			exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S);
- *      Note2:
- *	   Here 4 and 5 make use of the asymptotic series
- *			  exp(-x*x)
- *		erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )
- *			  x*sqrt(pi)
- *	   We use rational approximation to approximate
- *      	g(s)=f(1/x^2) = log(erfc(x)*x) - x*x + 0.5625
- *	   Here is the error bound for R1/S1 and R2/S2
- *      	|R1/S1 - f(x)|  < 2**(-62.57)
- *      	|R2/S2 - f(x)|  < 2**(-61.52)
- *
- *      5. For inf > x >= 28
- *         	erf(x)  = sign(x) *(1 - tiny)  (raise inexact)
- *         	erfc(x) = tiny*tiny (raise underflow) if x > 0
- *			= 2 - tiny if x<0
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-expm1	Returns exp(x)-1, the exponential of x minus 1
-~~~~~
- * Method
- *   1. Argument reduction:
- *	Given x, find r and integer k such that
- *
- *               x = k*ln2 + r,  |r| <= 0.5*ln2 ~ 0.34658
- *
- *      Here a correction term c will be computed to compensate
- *	the error in r when rounded to a floating-point number.
- *
- *   2. Approximating expm1(r) by a special rational function on
- *	the interval [0,0.34658]:
- *	Since
- *	    r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 - r^4/360 + ...
- *	we define R1(r*r) by
- *	    r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 * R1(r*r)
- *	That is,
- *	    R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r)
- *		     = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r))
- *		     = 1 - r^2/60 + r^4/2520 - r^6/100800 + ...
- *      We use a special Reme algorithm on [0,0.347] to generate
- * 	a polynomial of degree 5 in r*r to approximate R1. The
- *	maximum error of this polynomial approximation is bounded
- *	by 2**-61. In other words,
- *	    R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5
- *	where 	Q1  =  -1.6666666666666567384E-2,
- * 		Q2  =   3.9682539681370365873E-4,
- * 		Q3  =  -9.9206344733435987357E-6,
- * 		Q4  =   2.5051361420808517002E-7,
- * 		Q5  =  -6.2843505682382617102E-9;
- *  	(where z=r*r, and the values of Q1 to Q5 are listed below)
- *	with error bounded by
- *	    |                  5           |     -61
- *	    | 1.0+Q1*z+...+Q5*z   -  R1(z) | <= 2
- *	    |                              |
- *
- *	expm1(r) = exp(r)-1 is then computed by the following
- * 	specific way which minimize the accumulation rounding error:
- *			       2     3
- *			      r     r    [ 3 - (R1 + R1*r/2)  ]
- *	      expm1(r) = r + --- + --- * [--------------------]
- *		              2     2    [ 6 - r*(3 - R1*r/2) ]
- *
- *	To compensate the error in the argument reduction, we use
- *		expm1(r+c) = expm1(r) + c + expm1(r)*c
- *			   ~ expm1(r) + c + r*c
- *	Thus c+r*c will be added in as the correction terms for
- *	expm1(r+c). Now rearrange the term to avoid optimization
- * 	screw up:
- *		        (      2                                    2 )
- *		        ({  ( r    [ R1 -  (3 - R1*r/2) ]  )  }    r  )
- *	 expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- )
- *	                ({  ( 2    [ 6 - r*(3 - R1*r/2) ]  )  }    2  )
- *                      (                                             )
- *
- *		   = r - E
- *   3. Scale back to obtain expm1(x):
- *	From step 1, we have
- *	   expm1(x) = either 2^k*[expm1(r)+1] - 1
- *		    = or     2^k*[expm1(r) + (1-2^-k)]
- *   4. Implementation notes:
- *	(A). To save one multiplication, we scale the coefficient Qi
- *	     to Qi*2^i, and replace z by (x^2)/2.
- *	(B). To achieve maximum accuracy, we compute expm1(x) by
- *	  (i)   if x < -56*ln2, return -1.0, (raise inexact if x!=inf)
- *	  (ii)  if k=0, return r-E
- *	  (iii) if k=-1, return 0.5*(r-E)-0.5
- *        (iv)	if k=1 if r < -0.25, return 2*((r+0.5)- E)
- *	       	       else	     return  1.0+2.0*(r-E);
- *	  (v)   if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1)
- *	  (vi)  if k <= 20, return 2^k((1-2^-k)-(E-r)), else
- *	  (vii) return 2^k(1-((E+2^-k)-r))
- *
- * Special cases:
- *	expm1(INF) is INF, expm1(NaN) is NaN;
- *	expm1(-INF) is -1, and
- *	for finite argument, only expm1(0)=0 is exact.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-log1p
-~~~~~
- * Method :
- *   1. Argument Reduction: find k and f such that
- *			1+x = 2^k * (1+f),
- *	   where  sqrt(2)/2 < 1+f < sqrt(2) .
- *
- *      Note. If k=0, then f=x is exact. However, if k!=0, then f
- *	may not be representable exactly. In that case, a correction
- *	term is need. Let u=1+x rounded. Let c = (1+x)-u, then
- *	log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u),
- *	and add back the correction term c/u.
- *	(Note: when x > 2**53, one can simply return log(x))
- *
- *   2. Approximation of log1p(f).
- *	Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
- *		 = 2s + 2/3 s**3 + 2/5 s**5 + .....,
- *	     	 = 2s + s*R
- *      We use a special Reme algorithm on [0,0.1716] to generate
- * 	a polynomial of degree 14 to approximate R The maximum error
- *	of this polynomial approximation is bounded by 2**-58.45. In
- *	other words,
- *		        2      4      6      8      10      12      14
- *	    R(z) ~ Lp1*s +Lp2*s +Lp3*s +Lp4*s +Lp5*s  +Lp6*s  +Lp7*s
- *  	(the values of Lp1 to Lp7 are listed in the program)
- *	and
- *	    |      2          14          |     -58.45
- *	    | Lp1*s +...+Lp7*s    -  R(z) | <= 2
- *	    |                             |
- *	Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
- *	In order to guarantee error in log below 1ulp, we compute log
- *	by
- *		log1p(f) = f - (hfsq - s*(hfsq+R)).
- *
- *	3. Finally, log1p(x) = k*ln2 + log1p(f).
- *		 	     = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
- *	   Here ln2 is split into two floating point number:
- *			ln2_hi + ln2_lo,
- *	   where n*ln2_hi is always exact for |n| < 2000.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Modified: fsf/trunk/libc/configure
==============================================================================
--- fsf/trunk/libc/configure (original)
+++ fsf/trunk/libc/configure Wed May 16 00:01:41 2012
@@ -4324,48 +4324,53 @@
   test -n "$enable_debug_configure" &&
   echo "DEBUG: name/Implies $xsrcdir$name/Implies" >&2
 
-  if test -f $xsrcdir$name/Implies; then
-    # Collect more names from the `Implies' file (removing comments).
-    implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
-    implied=
-    for x in $implied_candidate; do
-      found=no
-      if test -d $xsrcdir$name_base/$x; then
-	implied="$implied $name_base/$x";
-	found=yes
-      fi
-      for d in $add_ons_pfx ''; do
-	try="${d}sysdeps/$x"
-	case $d in
-	 /*) try_srcdir= ;;
-	 *) try_srcdir=$srcdir/ ;;
-	esac
-	test -n "$enable_debug_configure" &&
-	 echo "DEBUG: $name implied $x try($d) {$try_srcdir}$try" >&2
-	if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
-	then
-	  implied="$implied $try"
+  for implies_file in Implies Implies-before Implies-after; do
+    implies_type=`echo $implies_file | sed s/-/_/`
+    eval ${implies_type}=
+    if test -f $xsrcdir$name/$implies_file; then
+      # Collect more names from the `Implies' file (removing comments).
+      implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
+      for x in $implied_candidate; do
+	found=no
+	if test -d $xsrcdir$name_base/$x; then
+	  eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
 	  found=yes
-	  case "$sysnames_add_ons" in
-	  *" $d "*) ;;
-	  *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
+	fi
+	for d in $add_ons_pfx ''; do
+	  try="${d}sysdeps/$x"
+	  case $d in
+	   /*) try_srcdir= ;;
+	   *) try_srcdir=$srcdir/ ;;
 	  esac
+	  test -n "$enable_debug_configure" &&
+	   echo "DEBUG: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
+	  if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
+	  then
+	    eval "${implies_type}=\"\$${implies_type} \$try\""
+	    found=yes
+	    case "$sysnames_add_ons" in
+	    *" $d "*) ;;
+	    *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
+	    esac
+	  fi
+	done
+	if test $found = no; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $name/$implies_file specifies nonexistent $x" >&5
+$as_echo "$as_me: WARNING: $name/$implies_file specifies nonexistent $x" >&2;}
 	fi
       done
-      if test $found = no; then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $name/Implies specifies nonexistent $x" >&5
-$as_echo "$as_me: WARNING: $name/Implies specifies nonexistent $x" >&2;}
-      fi
-    done
-  else
-    implied=
-  fi
+    fi
+  done
 
   # Add NAME to the list of names.
   names="$names $name"
 
   # Find the parent of NAME, using the empty string if it has none.
   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
+
+  test -n "$enable_debug_configure" &&
+    echo "DEBUG: $name Implies='$Implies' rest='$*' parent='$parent' \
+Implies_before='$Implies_after' Implies_after='$Implies_after'" >&2
 
   # Add the names implied by NAME, and NAME's parent (if it has one), to
   # the list of names to be processed (the argument list).  We prepend the
@@ -4374,7 +4379,7 @@
   # configuration components; this ensures that for sysv4, unix/common
   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
   # after sysv4).
-  sysnames="`echo $implied $* $parent`"
+  sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
   test -n "$sysnames" && set $sysnames
 done
 

Modified: fsf/trunk/libc/configure.in
==============================================================================
--- fsf/trunk/libc/configure.in (original)
+++ fsf/trunk/libc/configure.in Wed May 16 00:01:41 2012
@@ -761,41 +761,42 @@
   test -n "$enable_debug_configure" &&
   echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
 
-  if test -f $xsrcdir$name/Implies; then
-    # Collect more names from the `Implies' file (removing comments).
-    implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
-    implied=
-    for x in $implied_candidate; do
-      found=no
-      if test -d $xsrcdir$name_base/$x; then
-	implied="$implied $name_base/$x";
-	found=yes
-      fi
-      for d in $add_ons_pfx ''; do
-	try="${d}sysdeps/$x"
-	case $d in
-	 /*) try_srcdir= ;;
-	 *) try_srcdir=$srcdir/ ;;
-	esac
-	test -n "$enable_debug_configure" &&
-	 echo "[DEBUG]: $name implied $x try($d) {$try_srcdir}$try" >&2
-	if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
-	then
-	  implied="$implied $try"
+  for implies_file in Implies Implies-before Implies-after; do
+    implies_type=`echo $implies_file | sed s/-/_/`
+    eval ${implies_type}=
+    if test -f $xsrcdir$name/$implies_file; then
+      # Collect more names from the `Implies' file (removing comments).
+      implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
+      for x in $implied_candidate; do
+	found=no
+	if test -d $xsrcdir$name_base/$x; then
+	  eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
 	  found=yes
-	  case "$sysnames_add_ons" in
-	  *" $d "*) ;;
-	  *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
+	fi
+	for d in $add_ons_pfx ''; do
+	  try="${d}sysdeps/$x"
+	  case $d in
+	   /*) try_srcdir= ;;
+	   *) try_srcdir=$srcdir/ ;;
 	  esac
+	  test -n "$enable_debug_configure" &&
+	   echo "[DEBUG]: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
+	  if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
+	  then
+	    eval "${implies_type}=\"\$${implies_type} \$try\""
+	    found=yes
+	    case "$sysnames_add_ons" in
+	    *" $d "*) ;;
+	    *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
+	    esac
+	  fi
+	done
+	if test $found = no; then
+	  AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
 	fi
       done
-      if test $found = no; then
-	AC_MSG_WARN($name/Implies specifies nonexistent $x)
-      fi
-    done
-  else
-    implied=
-  fi
+    fi
+  done
 
   # Add NAME to the list of names.
   names="$names $name"
@@ -804,6 +805,10 @@
 changequote(,)dnl
   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
 changequote([,])dnl
+
+  test -n "$enable_debug_configure" &&
+    echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
+Implies_before='$Implies_after' Implies_after='$Implies_after'" >&2
 
   # Add the names implied by NAME, and NAME's parent (if it has one), to
   # the list of names to be processed (the argument list).  We prepend the
@@ -812,7 +817,7 @@
   # configuration components; this ensures that for sysv4, unix/common
   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
   # after sysv4).
-  sysnames="`echo $implied $* $parent`"
+  sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
   test -n "$sysnames" && set $sysnames
 done
 

Removed: fsf/trunk/libc/elf/stackguard-macros.h
==============================================================================
--- fsf/trunk/libc/elf/stackguard-macros.h (original)
+++ fsf/trunk/libc/elf/stackguard-macros.h (removed)
@@ -1,32 +1,0 @@
-#include <stdint.h>
-
-#ifdef __i386__
-# define STACK_CHK_GUARD \
-  ({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; })
-#elif defined __x86_64__
-# define STACK_CHK_GUARD \
-  ({ uintptr_t x;						\
-     asm ("mov %%fs:%c1, %0" : "=r" (x)				\
-	  : "i" (offsetof (tcbhead_t, stack_guard))); x; })
-#elif defined __powerpc64__
-# define STACK_CHK_GUARD \
-  ({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; })
-#elif defined __powerpc__
-# define STACK_CHK_GUARD \
-  ({ uintptr_t x; asm ("lwz %0,-28680(2)" : "=r" (x)); x; })
-#elif defined __sparc__ && defined __arch64__
-# define STACK_CHK_GUARD \
-  ({ uintptr_t x; asm ("ldx [%%g7+0x28], %0" : "=r" (x)); x; })
-#elif defined __sparc__
-# define STACK_CHK_GUARD \
-  ({ uintptr_t x; asm ("ld [%%g7+0x14], %0" : "=r" (x)); x; })
-#elif defined __s390x__
-# define STACK_CHK_GUARD \
-  ({ uintptr_t x; asm ("ear %0,%%a0; sllg %0,%0,32; ear %0,%%a1; lg %0,0x28(%0)" : "=a" (x)); x; })
-#elif defined __s390__
-# define STACK_CHK_GUARD \
-  ({ uintptr_t x; asm ("ear %0,%%a0; l %0,0x14(%0)" : "=a" (x)); x; })
-#elif !defined STACK_CHK_GUARD
-extern uintptr_t __stack_chk_guard;
-# define STACK_CHK_GUARD __stack_chk_guard
-#endif

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Wed May 16 00:01:41 2012
@@ -1,3 +1,110 @@
+2012-05-15  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* pthreadP.h [!__NR_set_robust_list] (__NR_set_robust_list): Do
+	not define.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_lock): Load
+	futex pointer into RDI_LP.  Use RSP_LP to operate on stack.
+	(lll_robust_lock): Likewise.
+	(lll_cond_lock): Likewise.
+	(lll_robust_cond_lock): Likewise.
+	(lll_timedlock): Likewise.
+	(lll_robust_timedlock): Likewise.
+	(lll_unlock): Likewise.
+	(lll_robust_unlock): Likewise.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Use
+	LP_OP(cmp) and RCX_LP on dep_mutex pointer.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Use LP_OP(op)
+	on NWAITERS.
+	(__gcc_personality_v0): Replace 8-byte data alignment with
+	LP_SIZE alignment and .quad with ASM_ADDR.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Use LP_OP(op)
+	on NWAITERS.
+	(__gcc_personality_v0): Replace 8-byte data alignment with
+	LP_SIZE alignment and .quad with ASM_ADDR.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/sem_post.S: Use LP_OP(cmp) on
+	NWAITERS, which is unsigned long int.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_once.S
+	(__gcc_personality_v0): Replace 8-byte data alignment with
+	LP_SIZE alignment and .quad with ASM_ADDR.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Use
+	LP_OP(cmp), RSI_LP and R8_LP on dep_mutex pointer.  Load
+	__vdso_clock_gettime pointer into RAX_LP.
+	(__gcc_personality_v0): Replace 8-byte data alignment with
+	LP_SIZE alignment and .quad with ASM_ADDR.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Use
+	LP_OP(cmp), RSI_LP and R8_LP on dep_mutex pointer.  Load
+	__vdso_clock_gettime pointer into RAX_LP.
+	(__gcc_personality_v0): Replace 8-byte data alignment with
+	LP_SIZE alignment and .quad with ASM_ADDR.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Use
+	LP_OP(cmp) and R8_LP on dep_mutex pointer.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Use LP_OP(mov)
+	to update pointer in memory.  Load pointer into RDI_LP.
+
+2012-05-15  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+	(LLL_STUB_UNWIND_INFO_START): Align label to LP_SIZE instead
+	of 8.
+	(LLL_STUB_UNWIND_INFO_END): Likewise.
+	(lll_timedlock): Load timeout pointer into RDX_LP.
+	(lll_robust_timedlock): Likewise.
+
+2012-05-15  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+	    Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #13613]
+	* Makefile (tests): Add test cases.
+	* descr.h (struct pthread): Add a comment describing multiple_threads.
+	* pthreadP.h (__pthread_multiple_threads): Expand comment to include
+	single-process case.
+	* pthread_cancel.c (pthread_cancel): Enable multiple_threads
+	before setting cancelstate of the thread.
+	* sysdeps/unix/sysv/linux/libc_multiple_threads.c
+	(__libc_multiple_threads): Add explanatory comment.
+	* tst-cancel-self-cancelstate.c: New test case.
+	* tst-cancel-self-canceltype.c: Likewise.
+	* tst-cancel-self-cleanup.c: Supporting file for test cases.
+	* tst-cancel-self-testcancel.c: New test case.
+	* tst-cancel-self.c: Likewise.
+	* vars.c: Expand comment to include single-process case.
+
+2012-05-14  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/tls.h: Don't include <bits/wordsize.h>.
+	(tcbhead_t): Remove __x86_64__ check.  Align rtld_savespace_sse
+	to 32 bytes.
+
 2012-05-14  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
 
 	* sysdeps/pthread/pthread.h (__PTHREAD_RWLOCK_INT_FLAGS_SHARED):

Modified: fsf/trunk/libc/nptl/Makefile
==============================================================================
--- fsf/trunk/libc/nptl/Makefile (original)
+++ fsf/trunk/libc/nptl/Makefile Wed May 16 00:01:41 2012
@@ -236,6 +236,8 @@
 	tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
 	tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
 	tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
+	tst-cancel-self tst-cancel-self-cancelstate \
+	tst-cancel-self-canceltype tst-cancel-self-testcancel \
 	tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
 	tst-flock1 tst-flock2 \
 	tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \

Modified: fsf/trunk/libc/nptl/descr.h
==============================================================================
--- fsf/trunk/libc/nptl/descr.h (original)
+++ fsf/trunk/libc/nptl/descr.h Wed May 16 00:01:41 2012
@@ -131,6 +131,21 @@
 #else
     struct
     {
+      /* multiple_threads is enabled either when the process has spawned at
+	 least one thread or when a single-threaded process cancels itself.
+	 This enables additional code to introduce locking before doing some
+	 compare_and_exchange operations and also enable cancellation points.
+	 The concepts of multiple threads and cancellation points ideally
+	 should be separate, since it is not necessary for multiple threads to
+	 have been created for cancellation points to be enabled, as is the
+	 case is when single-threaded process cancels itself.
+
+	 Since enabling multiple_threads enables additional code in
+	 cancellation points and compare_and_exchange operations, there is a
+	 potential for an unneeded performance hit when it is enabled in a
+	 single-threaded, self-canceling process.  This is OK though, since a
+	 single-threaded process will enable async cancellation only when it
+	 looks to cancel itself and is hence going to end anyway.  */
       int multiple_threads;
       int gscope_flag;
 # ifndef __ASSUME_PRIVATE_FUTEX

Modified: fsf/trunk/libc/nptl/pthreadP.h
==============================================================================
--- fsf/trunk/libc/nptl/pthreadP.h (original)
+++ fsf/trunk/libc/nptl/pthreadP.h Wed May 16 00:01:41 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2009, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -378,7 +378,9 @@
 				 const struct pthread_functions *functions)
      internal_function;
 
-/* Variable set to a nonzero value if more than one thread runs or ran.  */
+/* Variable set to a nonzero value either if more than one thread runs or ran,
+   or if a single-threaded process is trying to cancel itself.  See
+   nptl/descr.h for more context on the single-threaded process case.  */
 extern int __pthread_multiple_threads attribute_hidden;
 /* Pointer to the corresponding variable in libc.  */
 extern int *__libc_multiple_threads_ptr attribute_hidden;
@@ -580,15 +582,4 @@
 # define PTHREAD_STATIC_FN_REQUIRE(name) __asm (".globl " #name);
 #endif
 
-
-#ifndef __NR_set_robust_list
-/* XXX For the time being...  Once we can rely on the kernel headers
-   having the definition remove these lines.  */
-# if defined __i386__
-#  define __NR_set_robust_list  311
-# elif defined __x86_64__
-#  define __NR_set_robust_list  273
-# endif
-#endif
-
 #endif	/* pthreadP.h */

Modified: fsf/trunk/libc/nptl/pthread_cancel.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_cancel.c (original)
+++ fsf/trunk/libc/nptl/pthread_cancel.c Wed May 16 00:01:41 2012
@@ -95,6 +95,14 @@
 
 	  break;
 	}
+
+	/* A single-threaded process should be able to kill itself, since there is
+	   nothing in the POSIX specification that says that it cannot.  So we set
+	   multiple_threads to true so that cancellation points get executed.  */
+	THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
+#ifndef TLS_MULTIPLE_THREADS_IN_TCB
+	__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
+#endif
     }
   /* Mark the thread as canceled.  This has to be done
      atomically since other bits could be modified as well.  */

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/libc_multiple_threads.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/libc_multiple_threads.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/libc_multiple_threads.c Wed May 16 00:01:41 2012
@@ -20,6 +20,9 @@
 
 #ifndef NOT_IN_libc
 # ifndef TLS_MULTIPLE_THREADS_IN_TCB
+/* Variable set to a nonzero value either if more than one thread runs or ran,
+   or if a single-threaded process is trying to cancel itself.  See
+   nptl/descr.h for more context on the single-threaded process case.  */
 int __libc_multiple_threads attribute_hidden;
 # endif
 #endif

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S Wed May 16 00:01:41 2012
@@ -72,10 +72,10 @@
 
 3:	subq	$8, %rsp
 	cfi_adjust_cfa_offset(8)
-	movq	$TCB_PTHREAD_CANCELED, %fs:RESULT
+	LP_OP(mov) $TCB_PTHREAD_CANCELED, %fs:RESULT
 	lock
 	orl	$TCB_EXITING_BITMASK, %fs:CANCELHANDLING
-	movq	%fs:CLEANUP_JMP_BUF, %rdi
+	mov	%fs:CLEANUP_JMP_BUF, %RDI_LP
 #ifdef SHARED
 	call	__pthread_unwind@PLT
 #else
@@ -106,7 +106,7 @@
 	/* Performance doesn't matter in this loop.  We will
 	   delay until the thread is canceled.  And we will unlikely
 	   enter the loop twice.  */
-4:	movq	%fs:0, %rdi
+4:	mov	%fs:0, %RDI_LP
 	movl	$__NR_futex, %eax
 	xorq	%r10, %r10
 	addq	$CANCELHANDLING, %rdi

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h Wed May 16 00:01:41 2012
@@ -1,4 +1,5 @@
-/* Copyright (C) 2002-2004, 2006-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2004, 2006-2008, 2009, 2012
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -119,7 +120,7 @@
 	".byte	0x12	# DW_CFA_def_cfa_sf\n\t" 		\
 	".uleb128 0x7\n\t" 					\
 	".sleb128 16\n\t" 					\
-	".align 8\n" 						\
+	".align " LP_SIZE "\n" 					\
 "9:\t"	".long	23f-10f	# FDE Length\n" 			\
 "10:\t"	".long	10b-7b	# FDE CIE offset\n\t" 			\
 	".long	1b-.	# FDE initial location\n\t" 		\
@@ -166,7 +167,7 @@
 	".uleb128 22f-21f\n" 					\
 "21:\t"	".byte	0x80	# DW_OP_breg16\n\t" 			\
 	".sleb128 4b-5b\n" 					\
-"22:\t"	".align 8\n" 						\
+"22:\t"	".align " LP_SIZE "\n" 					\
 "23:\t"	".previous\n"
 
 /* Unwind info for
@@ -298,10 +299,10 @@
 			   ".subsection 1\n\t"				      \
 			   ".type _L_lock_%=, @function\n"		      \
 			   "_L_lock_%=:\n"				      \
-			   "1:\tleaq %2, %%rdi\n"			      \
-			   "2:\tsubq $128, %%rsp\n"			      \
+			   "1:\tlea %2, %%" RDI_LP "\n"			      \
+			   "2:\tsub $128, %%" RSP_LP "\n"		      \
 			   "3:\tcallq __lll_lock_wait_private\n"	      \
-			   "4:\taddq $128, %%rsp\n"			      \
+			   "4:\tadd $128, %%" RSP_LP "\n"		      \
 			   "5:\tjmp 24f\n"				      \
 			   "6:\t.size _L_lock_%=, 6b-1b\n\t"		      \
 			   ".previous\n"				      \
@@ -316,10 +317,10 @@
 			   ".subsection 1\n\t"				      \
 			   ".type _L_lock_%=, @function\n"		      \
 			   "_L_lock_%=:\n"				      \
-			   "1:\tleaq %2, %%rdi\n"			      \
-			   "2:\tsubq $128, %%rsp\n"			      \
+			   "1:\tlea %2, %%" RDI_LP "\n"			      \
+			   "2:\tsub $128, %%" RSP_LP "\n"		      \
 			   "3:\tcallq __lll_lock_wait\n"		      \
-			   "4:\taddq $128, %%rsp\n"			      \
+			   "4:\tadd $128, %%" RSP_LP "\n"		      \
 			   "5:\tjmp 24f\n"				      \
 			   "6:\t.size _L_lock_%=, 6b-1b\n\t"		      \
 			   ".previous\n"				      \
@@ -338,10 +339,10 @@
 		      ".subsection 1\n\t"				      \
 		      ".type _L_robust_lock_%=, @function\n"		      \
 		      "_L_robust_lock_%=:\n"				      \
-		      "1:\tleaq %2, %%rdi\n"				      \
-		      "2:\tsubq $128, %%rsp\n"				      \
+		      "1:\tlea %2, %%" RDI_LP "\n"			      \
+		      "2:\tsub $128, %%" RSP_LP "\n"			      \
 		      "3:\tcallq __lll_robust_lock_wait\n"		      \
-		      "4:\taddq $128, %%rsp\n"				      \
+		      "4:\tadd $128, %%" RSP_LP "\n"			      \
 		      "5:\tjmp 24f\n"					      \
 		      "6:\t.size _L_robust_lock_%=, 6b-1b\n\t"		      \
 		      ".previous\n"					      \
@@ -361,10 +362,10 @@
 			 ".subsection 1\n\t"				      \
 			 ".type _L_cond_lock_%=, @function\n"		      \
 			 "_L_cond_lock_%=:\n"				      \
-			 "1:\tleaq %2, %%rdi\n"				      \
-			 "2:\tsubq $128, %%rsp\n"			      \
+			 "1:\tlea %2, %%" RDI_LP "\n"			      \
+			 "2:\tsub $128, %%" RSP_LP "\n"			      \
 			 "3:\tcallq __lll_lock_wait\n"			      \
-			 "4:\taddq $128, %%rsp\n"			      \
+			 "4:\tadd $128, %%" RSP_LP "\n"			      \
 			 "5:\tjmp 24f\n"				      \
 			 "6:\t.size _L_cond_lock_%=, 6b-1b\n\t"		      \
 			 ".previous\n"					      \
@@ -383,10 +384,10 @@
 		      ".subsection 1\n\t"				      \
 		      ".type _L_robust_cond_lock_%=, @function\n"	      \
 		      "_L_robust_cond_lock_%=:\n"			      \
-		      "1:\tleaq %2, %%rdi\n"				      \
-		      "2:\tsubq $128, %%rsp\n"				      \
+		      "1:\tlea %2, %%" RDI_LP "\n"			      \
+		      "2:\tsub $128, %%" RSP_LP "\n"			      \
 		      "3:\tcallq __lll_robust_lock_wait\n"		      \
-		      "4:\taddq $128, %%rsp\n"				      \
+		      "4:\tadd $128, %%" RSP_LP "\n"			      \
 		      "5:\tjmp 24f\n"					      \
 		      "6:\t.size _L_robust_cond_lock_%=, 6b-1b\n\t"	      \
 		      ".previous\n"					      \
@@ -406,11 +407,11 @@
 		       ".subsection 1\n\t"				      \
 		       ".type _L_timedlock_%=, @function\n"		      \
 		       "_L_timedlock_%=:\n"				      \
-		       "1:\tleaq %4, %%rdi\n"				      \
-		       "0:\tmovq %8, %%rdx\n"				      \
-		       "2:\tsubq $128, %%rsp\n"				      \
+		       "1:\tlea %4, %%" RDI_LP "\n"			      \
+		       "0:\tmov %8, %%" RDX_LP "\n"			      \
+		       "2:\tsub $128, %%" RSP_LP "\n"			      \
 		       "3:\tcallq __lll_timedlock_wait\n"		      \
-		       "4:\taddq $128, %%rsp\n"				      \
+		       "4:\tadd $128, %%" RSP_LP "\n"			      \
 		       "5:\tjmp 24f\n"					      \
 		       "6:\t.size _L_timedlock_%=, 6b-1b\n\t"		      \
 		       ".previous\n"					      \
@@ -430,11 +431,11 @@
 		       ".subsection 1\n\t"				      \
 		       ".type _L_robust_timedlock_%=, @function\n"	      \
 		       "_L_robust_timedlock_%=:\n"			      \
-		       "1:\tleaq %4, %%rdi\n"				      \
-		       "0:\tmovq %8, %%rdx\n"				      \
-		       "2:\tsubq $128, %%rsp\n"				      \
+		       "1:\tlea %4, %%" RDI_LP "\n"			      \
+		       "0:\tmov %8, %%" RDX_LP "\n"			      \
+		       "2:\tsub $128, %%" RSP_LP "\n"			      \
 		       "3:\tcallq __lll_robust_timedlock_wait\n"	      \
-		       "4:\taddq $128, %%rsp\n"				      \
+		       "4:\tadd $128, %%" RSP_LP "\n"			      \
 		       "5:\tjmp 24f\n"					      \
 		       "6:\t.size _L_robust_timedlock_%=, 6b-1b\n\t"	      \
 		       ".previous\n"					      \
@@ -468,10 +469,10 @@
 			   ".subsection 1\n\t"				      \
 			   ".type _L_unlock_%=, @function\n"		      \
 			   "_L_unlock_%=:\n"				      \
-			   "1:\tleaq %0, %%rdi\n"			      \
-			   "2:\tsubq $128, %%rsp\n"			      \
+			   "1:\tlea %0, %%" RDI_LP "\n"			      \
+			   "2:\tsub $128, %%" RSP_LP "\n"		      \
 			   "3:\tcallq __lll_unlock_wake_private\n"	      \
-			   "4:\taddq $128, %%rsp\n"			      \
+			   "4:\tadd $128, %%" RSP_LP "\n"		      \
 			   "5:\tjmp 24f\n"				      \
 			   "6:\t.size _L_unlock_%=, 6b-1b\n\t"		      \
 			   ".previous\n"				      \
@@ -485,10 +486,10 @@
 			   ".subsection 1\n\t"				      \
 			   ".type _L_unlock_%=, @function\n"		      \
 			   "_L_unlock_%=:\n"				      \
-			   "1:\tleaq %0, %%rdi\n"			      \
-			   "2:\tsubq $128, %%rsp\n"			      \
+			   "1:\tlea %0, %%" RDI_LP "\n"			      \
+			   "2:\tsub $128, %%" RSP_LP "\n"		      \
 			   "3:\tcallq __lll_unlock_wake\n"		      \
-			   "4:\taddq $128, %%rsp\n"			      \
+			   "4:\tadd $128, %%" RSP_LP "\n"		      \
 			   "5:\tjmp 24f\n"				      \
 			   "6:\t.size _L_unlock_%=, 6b-1b\n\t"		      \
 			   ".previous\n"				      \
@@ -508,10 +509,10 @@
 			".subsection 1\n\t"				      \
 			".type _L_robust_unlock_%=, @function\n"	      \
 			"_L_robust_unlock_%=:\n"			      \
-			"1:\tleaq %0, %%rdi\n"				      \
-			"2:\tsubq $128, %%rsp\n"			      \
+			"1:\tlea %0, %%" RDI_LP "\n"			      \
+			"2:\tsub $128, %%" RSP_LP "\n"			      \
 			"3:\tcallq __lll_unlock_wake\n"			      \
-			"4:\taddq $128, %%rsp\n"			      \
+			"4:\tadd $128, %%" RSP_LP "\n"			      \
 			"5:\tjmp 24f\n"					      \
 			"6:\t.size _L_robust_unlock_%=, 6b-1b\n\t"	      \
 			".previous\n"					      \

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S Wed May 16 00:01:41 2012
@@ -59,14 +59,14 @@
 	incl	broadcast_seq-cond_futex(%rdi)
 
 	/* Get the address of the mutex used.  */
-	movq	dep_mutex-cond_futex(%rdi), %r8
+	mov	dep_mutex-cond_futex(%rdi), %R8_LP
 
 	/* Unlock.  */
 	LOCK
 	decl	cond_lock-cond_futex(%rdi)
 	jne	7f
 
-8:	cmpq	$-1, %r8
+8:	cmp	$-1, %R8_LP
 	je	9f
 
 	/* Do not use requeue for pshared condvars.  */
@@ -128,7 +128,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -140,7 +140,7 @@
 
 	/* Unlock in loop requires wakeup.  */
 5:	addq	$cond_lock-cond_futex, %rdi
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -149,7 +149,7 @@
 
 	/* Unlock in loop requires wakeup.  */
 7:	addq	$cond_lock-cond_futex, %rdi
-	cmpq	$-1, %r8
+	cmp	$-1, %R8_LP
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -158,7 +158,7 @@
 	jmp	8b
 
 9:	/* The futex requeue functionality is not available.  */
-	cmpq	$-1, %r8
+	cmp	$-1, %R8_LP
 	movl	$0x7fffffff, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S Wed May 16 00:01:41 2012
@@ -55,14 +55,14 @@
 	addl	$1, (%rdi)
 
 	/* Wake up one thread.  */
-	cmpq	$-1, dep_mutex(%r8)
+	LP_OP(cmp) $-1, dep_mutex(%r8)
 	movl	$FUTEX_WAKE_OP, %esi
 	movl	$1, %edx
 	movl	$SYS_futex, %eax
 	je	8f
 
 	/* Get the address of the mutex used.  */
-	movq    dep_mutex(%r8), %rcx
+	mov     dep_mutex(%r8), %RCX_LP
 	movl	MUTEX_KIND(%rcx), %r11d
 	andl	$(ROBUST_BIT|PI_BIT), %r11d
 	cmpl	$PI_BIT, %r11d
@@ -134,7 +134,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -150,7 +150,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S Wed May 16 00:01:41 2012
@@ -89,7 +89,7 @@
 		    +--------------------------+
 	*/
 
-	cmpq	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 
 	/* Prepare structure passed to cancellation handler.  */
 	movq	%rdi, 8(%rsp)
@@ -97,7 +97,7 @@
 	movq	%rdx, %r13
 
 	je	22f
-	movq	%rsi, dep_mutex(%rdi)
+	mov	%RSI_LP, dep_mutex(%rdi)
 
 22:
 	xorl	%r15d, %r15d
@@ -163,10 +163,10 @@
 
 	movq	%r13, %r10
 	movl	$FUTEX_WAIT_BITSET, %esi
-	cmpq	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	je	60f
 
-	movq	dep_mutex(%rdi), %r8
+	mov	dep_mutex(%rdi), %R8_LP
 	/* Requeue to a non-robust PI mutex if the PI bit is set and
 	the robust bit is not set.  */
 	movl	MUTEX_KIND(%r8), %eax
@@ -268,7 +268,7 @@
 	jne	55f
 
 	addq	$cond_nwaiters, %rdi
-	cmpq	$-1, dep_mutex-cond_nwaiters(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi)
 	movl	$1, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax
@@ -331,7 +331,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -343,7 +343,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -355,7 +355,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -370,7 +370,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -391,7 +391,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -446,9 +446,9 @@
 	   kernel.  */
 	leaq	32(%rsp), %rsi
 #  ifdef SHARED
-	movq	__vdso_clock_gettime@GOTPCREL(%rip), %rax
-	movq	(%rax), %rax
-	PTR_DEMANGLE (%rax)
+	mov	__vdso_clock_gettime@GOTPCREL(%rip), %RAX_LP
+	mov	(%rax), %RAX_LP
+	PTR_DEMANGLE (%RAX_LP)
 	call	*%rax
 #  else
 	movl	$__NR_clock_gettime, %eax
@@ -508,7 +508,7 @@
 	movl	%eax, (%rsp)
 
 	leaq	32(%rsp), %r10
-	cmpq	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	movq	%r12, %rdx
 # ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAIT, %eax
@@ -568,7 +568,7 @@
 # if cond_lock != 0
 	addq	$cond_lock, %rdi
 # endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -580,7 +580,7 @@
 # if cond_lock != 0
 	addq	$cond_lock, %rdi
 # endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -592,7 +592,7 @@
 # if cond_lock != 0
 	addq	$cond_lock, %rdi
 # endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -675,7 +675,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -708,7 +708,7 @@
 	andl	$~((1 << nwaiters_shift) - 1), %eax
 	jne	4f
 
-	cmpq	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	leaq	cond_nwaiters(%rdi), %rdi
 	movl	$1, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
@@ -736,7 +736,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -746,7 +746,7 @@
 2:	testq	%r12, %r12
 	jnz	5f
 	addq	$cond_futex, %rdi
-	cmpq	$-1, dep_mutex-cond_futex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi)
 	movl	$0x7fffffff, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax
@@ -805,9 +805,9 @@
 	.hidden	DW.ref.__gcc_personality_v0
 	.weak	DW.ref.__gcc_personality_v0
 	.section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-	.align	8
+	.align	LP_SIZE
 	.type	DW.ref.__gcc_personality_v0, @object
-	.size	DW.ref.__gcc_personality_v0, 8
+	.size	DW.ref.__gcc_personality_v0, LP_SIZE
 DW.ref.__gcc_personality_v0:
-	.quad	__gcc_personality_v0
-#endif
+	ASM_ADDR __gcc_personality_v0
+#endif

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S Wed May 16 00:01:41 2012
@@ -65,14 +65,14 @@
 	            +--------------------------+
 	*/
 
-	cmpq	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 
 		/* Prepare structure passed to cancellation handler.  */
 	movq	%rdi, 8(%rsp)
 	movq	%rsi, 16(%rsp)
 
 	je	15f
-	movq	%rsi, dep_mutex(%rdi)
+	mov	%RSI_LP, dep_mutex(%rdi)
 
 	/* Get internal lock.  */
 15:	movl	$1, %esi
@@ -120,12 +120,12 @@
 	movl	%eax, (%rsp)
 
 	xorq	%r10, %r10
-	cmpq	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	leaq	cond_futex(%rdi), %rdi
 	movl	$FUTEX_WAIT, %esi
 	je	60f
 
-	movq	dep_mutex-cond_futex(%rdi), %r8
+	mov	dep_mutex-cond_futex(%rdi), %R8_LP
 	/* Requeue to a non-robust PI mutex if the PI bit is set and
 	the robust bit is not set.  */
 	movl	MUTEX_KIND(%r8), %eax
@@ -206,7 +206,7 @@
 	jne	17f
 
 	addq	$cond_nwaiters, %rdi
-	cmpq	$-1, dep_mutex-cond_nwaiters(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi)
 	movl	$1, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax
@@ -255,7 +255,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -267,7 +267,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -283,7 +283,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -298,7 +298,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -319,7 +319,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -348,7 +348,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -374,7 +374,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -386,7 +386,7 @@
 93:
 	/* Set the rest of SYS_futex args for FUTEX_WAIT_REQUEUE_PI. */
 	xorq	%r10, %r10
-	movq	dep_mutex(%rdi), %r8
+	mov	dep_mutex(%rdi), %R8_LP
 	leaq	cond_futex(%rdi), %rdi
 	jmp	90b
 .LcleanupEND2:
@@ -434,7 +434,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -467,7 +467,7 @@
 	andl	$~((1 << nwaiters_shift) - 1), %eax
 	jne	4f
 
-	cmpq	$-1, dep_mutex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex(%rdi)
 	leaq	cond_nwaiters(%rdi), %rdi
 	movl	$1, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
@@ -495,7 +495,7 @@
 #if cond_lock != 0
 	addq	$cond_lock, %rdi
 #endif
-	cmpq	$-1, dep_mutex-cond_lock(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
 	movl	$LLL_PRIVATE, %eax
 	movl	$LLL_SHARED, %esi
 	cmovne	%eax, %esi
@@ -506,7 +506,7 @@
 2:	testl	%ecx, %ecx
 	jnz	5f
 	addq	$cond_futex, %rdi
-	cmpq	$-1, dep_mutex-cond_futex(%rdi)
+	LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi)
 	movl	$0x7fffffff, %edx
 #ifdef __ASSUME_PRIVATE_FUTEX
 	movl	$FUTEX_WAKE, %eax
@@ -559,9 +559,9 @@
 	.hidden	DW.ref.__gcc_personality_v0
 	.weak	DW.ref.__gcc_personality_v0
 	.section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-	.align	8
+	.align	LP_SIZE
 	.type	DW.ref.__gcc_personality_v0, @object
-	.size	DW.ref.__gcc_personality_v0, 8
+	.size	DW.ref.__gcc_personality_v0, LP_SIZE
 DW.ref.__gcc_personality_v0:
-	.quad	__gcc_personality_v0
-#endif
+	ASM_ADDR __gcc_personality_v0
+#endif

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S Wed May 16 00:01:41 2012
@@ -188,9 +188,9 @@
 	.hidden	DW.ref.__gcc_personality_v0
 	.weak	DW.ref.__gcc_personality_v0
 	.section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-	.align	8
+	.align	LP_SIZE
 	.type	DW.ref.__gcc_personality_v0, @object
-	.size	DW.ref.__gcc_personality_v0, 8
+	.size	DW.ref.__gcc_personality_v0, LP_SIZE
 DW.ref.__gcc_personality_v0:
-	.quad	__gcc_personality_v0
+	ASM_ADDR __gcc_personality_v0
 #endif

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_post.S Wed May 16 00:01:41 2012
@@ -45,7 +45,7 @@
 #endif
 	jnz	0b
 
-	cmpq	$0, NWAITERS(%rdi)
+	LP_OP(cmp) $0, NWAITERS(%rdi)
 	je	2f
 
 	movl	$SYS_futex, %eax

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S Wed May 16 00:01:41 2012
@@ -83,7 +83,7 @@
 	movq	%rsi, %r10
 
 	LOCK
-	addq	$1, NWAITERS(%rdi)
+	LP_OP(add) $1, NWAITERS(%rdi)
 
 .LcleanupSTART:
 13:	call	__pthread_enable_asynccancel
@@ -134,7 +134,7 @@
 	xorl	%eax, %eax
 
 15:	LOCK
-	subq	$1, NWAITERS(%rdi)
+	LP_OP(sub) $1, NWAITERS(%rdi)
 
 	leaq	8(%rsp), %rsp
 	cfi_adjust_cfa_offset(-8)
@@ -189,7 +189,7 @@
 	movq	%rsi, %r13
 
 	LOCK
-	addq	$1, NWAITERS(%r12)
+	LP_OP(add) $1, NWAITERS(%r12)
 
 7:	xorl	%esi, %esi
 	movq	%rsp,%rdi
@@ -266,7 +266,7 @@
 	xorl	%eax, %eax
 
 45:	LOCK
-	subq	$1, NWAITERS(%r12)
+	LP_OP(sub) $1, NWAITERS(%r12)
 
 	addq	$STACKFRAME, %rsp
 	cfi_adjust_cfa_offset(-STACKFRAME)
@@ -304,7 +304,7 @@
 
 	movq	(%rsp), %rdi
 	LOCK
-	subq	$1, NWAITERS(%rdi)
+	LP_OP(sub) $1, NWAITERS(%rdi)
 	movq	%rax, %rdi
 .LcallUR:
 	call	_Unwind_Resume@PLT
@@ -324,7 +324,7 @@
 	cfi_rel_offset(%r14, STACKFRAME)
 
 	LOCK
-	subq	$1, NWAITERS(%r12)
+	LP_OP(sub) $1, NWAITERS(%r12)
 	movq	%rax, %rdi
 	movq	STACKFRAME(%rsp), %r14
 	movq	STACKFRAME+8(%rsp), %r13
@@ -372,9 +372,9 @@
 	.hidden	DW.ref.__gcc_personality_v0
 	.weak	DW.ref.__gcc_personality_v0
 	.section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-	.align	8
+	.align	LP_SIZE
 	.type	DW.ref.__gcc_personality_v0, @object
-	.size	DW.ref.__gcc_personality_v0, 8
+	.size	DW.ref.__gcc_personality_v0, LP_SIZE
 DW.ref.__gcc_personality_v0:
-	.quad	__gcc_personality_v0
-#endif
+	ASM_ADDR __gcc_personality_v0
+#endif

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S Wed May 16 00:01:41 2012
@@ -66,7 +66,7 @@
 	cfi_adjust_cfa_offset(8)
 
 	LOCK
-	addq	$1, NWAITERS(%rdi)
+	LP_OP(add) $1, NWAITERS(%rdi)
 
 .LcleanupSTART:
 6:	call	__pthread_enable_asynccancel
@@ -115,7 +115,7 @@
 	xorl	%eax, %eax
 
 9:	LOCK
-	subq	$1, NWAITERS(%rdi)
+	LP_OP(sub) $1, NWAITERS(%rdi)
 
 	leaq	8(%rsp), %rsp
 	cfi_adjust_cfa_offset(-8)
@@ -136,7 +136,7 @@
 sem_wait_cleanup:
 	movq	(%rsp), %rdi
 	LOCK
-	subq	$1, NWAITERS(%rdi)
+	LP_OP(sub) $1, NWAITERS(%rdi)
 	movq	%rax, %rdi
 .LcallUR:
 	call	_Unwind_Resume@PLT
@@ -168,9 +168,9 @@
 	.hidden	DW.ref.__gcc_personality_v0
 	.weak	DW.ref.__gcc_personality_v0
 	.section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
-	.align	8
+	.align	LP_SIZE
 	.type	DW.ref.__gcc_personality_v0, @object
-	.size	DW.ref.__gcc_personality_v0, 8
+	.size	DW.ref.__gcc_personality_v0, LP_SIZE
 DW.ref.__gcc_personality_v0:
-	.quad	__gcc_personality_v0
+	ASM_ADDR __gcc_personality_v0
 #endif

Modified: fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h Wed May 16 00:01:41 2012
@@ -27,7 +27,6 @@
 # include <stdlib.h>
 # include <sysdep.h>
 # include <kernel-features.h>
-# include <bits/wordsize.h>
 # include <xmmintrin.h>
 
 
@@ -60,18 +59,14 @@
 # else
   int __unused1;
 # endif
-# if __WORDSIZE == 64
   int rtld_must_xmm_save;
-# endif
   /* Reservation of some values for the TM ABI.  */
   void *__private_tm[5];
-# if __WORDSIZE == 64
   long int __unused2;
   /* Have space for the post-AVX register size.  */
-  __m128 rtld_savespace_sse[8][4];
+  __m128 rtld_savespace_sse[8][4] __attribute__ ((aligned (32)));
 
   void *__padding[8];
-# endif
 } tcbhead_t;
 
 #else /* __ASSEMBLER__ */

Added: fsf/trunk/libc/nptl/tst-cancel-self-cancelstate.c
==============================================================================
--- fsf/trunk/libc/nptl/tst-cancel-self-cancelstate.c (added)
+++ fsf/trunk/libc/nptl/tst-cancel-self-cancelstate.c Wed May 16 00:01:41 2012
@@ -1,0 +1,65 @@
+/* Copyright (C) 2012 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "tst-cancel-self-cleanup.c"
+
+
+static int
+do_test (void)
+{
+  int ret = 0;
+  volatile int should_fail = 1;
+
+  pthread_cleanup_push (cleanup, &should_fail);
+
+  if ((ret = pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL)) != 0)
+    {
+      printf ("setcancelstate(disable) failed: %s\n", strerror (ret));
+      exit (1);
+    }
+
+  if ((ret = pthread_cancel (pthread_self ())) != 0)
+    {
+      printf ("cancel failed: %s\n", strerror (ret));
+      exit (1);
+    }
+
+  usleep (100);
+  should_fail = 0;
+
+  if ((ret = pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL)) != 0)
+    {
+      printf ("setcancelstate(enable) failed: %s\n", strerror (ret));
+      exit (1);
+    }
+
+  /* The write syscall within this printf should give us our cancellation
+     point.  */
+  printf ("Could not cancel self.\n");
+  pthread_cleanup_pop (0);
+
+  return 1;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Added: fsf/trunk/libc/nptl/tst-cancel-self-canceltype.c
==============================================================================
--- fsf/trunk/libc/nptl/tst-cancel-self-canceltype.c (added)
+++ fsf/trunk/libc/nptl/tst-cancel-self-canceltype.c Wed May 16 00:01:41 2012
@@ -1,0 +1,53 @@
+/* Copyright (C) 2012 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "tst-cancel-self-cleanup.c"
+
+
+static int
+do_test (void)
+{
+  int ret = 0, should_fail = 0;
+
+  pthread_cleanup_push (cleanup, &should_fail);
+
+  if ((ret = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL)) != 0)
+    {
+      printf ("setcanceltype failed: %s\n", strerror (ret));
+      exit (1);
+    }
+
+  if ((ret = pthread_cancel (pthread_self ())) != 0)
+    {
+      printf ("cancel failed: %s\n", strerror (ret));
+      exit (1);
+    }
+
+  /* Wait to be canceled. Don't give any cancellation points to play with.  */
+  while (1);
+  pthread_cleanup_pop (0);
+
+  return 1;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Added: fsf/trunk/libc/nptl/tst-cancel-self-cleanup.c
==============================================================================
--- fsf/trunk/libc/nptl/tst-cancel-self-cleanup.c (added)
+++ fsf/trunk/libc/nptl/tst-cancel-self-cleanup.c Wed May 16 00:01:41 2012
@@ -1,0 +1,23 @@
+/* Copyright (C) 2012 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+static void
+cleanup (void *cleanup_should_fail)
+{
+  printf ("Main thread got cancelled and is being cleaned up now\n");
+  exit (*(int *)cleanup_should_fail);
+}

Added: fsf/trunk/libc/nptl/tst-cancel-self-testcancel.c
==============================================================================
--- fsf/trunk/libc/nptl/tst-cancel-self-testcancel.c (added)
+++ fsf/trunk/libc/nptl/tst-cancel-self-testcancel.c Wed May 16 00:01:41 2012
@@ -1,0 +1,48 @@
+/* Copyright (C) 2012 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "tst-cancel-self-cleanup.c"
+
+
+static int
+do_test (void)
+{
+  int ret = 0, should_fail = 0;
+
+  pthread_cleanup_push (cleanup, &should_fail);
+  if ((ret = pthread_cancel (pthread_self ())) != 0)
+    {
+      printf ("cancel failed: %s\n", strerror (ret));
+      exit (1);
+    }
+
+  pthread_testcancel ();
+
+  printf ("Could not cancel self.\n");
+  pthread_cleanup_pop (0);
+
+  return 1;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Added: fsf/trunk/libc/nptl/tst-cancel-self.c
==============================================================================
--- fsf/trunk/libc/nptl/tst-cancel-self.c (added)
+++ fsf/trunk/libc/nptl/tst-cancel-self.c Wed May 16 00:01:41 2012
@@ -1,0 +1,48 @@
+/* Copyright (C) 2012 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "tst-cancel-self-cleanup.c"
+
+
+static int
+do_test (void)
+{
+  int ret = 0, should_fail = 0;
+
+  pthread_cleanup_push (cleanup, &should_fail);
+  if ((ret = pthread_cancel (pthread_self ())) != 0)
+    {
+      printf ("cancel failed: %s\n", strerror (ret));
+      exit (1);
+    }
+
+  /* The write syscall within this printf should give us our cancellation
+     point.  */
+  printf ("Could not cancel self.\n");
+  pthread_cleanup_pop (0);
+
+  return 1;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/nptl/tst-stackguard1.c
==============================================================================
--- fsf/trunk/libc/nptl/tst-stackguard1.c (original)
+++ fsf/trunk/libc/nptl/tst-stackguard1.c Wed May 16 00:01:41 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2005.
 
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/wait.h>
-#include <elf/stackguard-macros.h>
+#include <stackguard-macros.h>
 #include <unistd.h>
 
 static const char *command;

Modified: fsf/trunk/libc/nptl/vars.c
==============================================================================
--- fsf/trunk/libc/nptl/vars.c (original)
+++ fsf/trunk/libc/nptl/vars.c Wed May 16 00:01:41 2012
@@ -32,7 +32,9 @@
 int __is_smp attribute_hidden;
 
 #ifndef TLS_MULTIPLE_THREADS_IN_TCB
-/* Variable set to a nonzero value if more than one thread runs or ran.  */
+/* Variable set to a nonzero value either if more than one thread runs or ran,
+   or if a single-threaded process is trying to cancel itself.  See
+   nptl/descr.h for more context on the single-threaded process case.  */
 int __pthread_multiple_threads attribute_hidden;
 #endif
 

Modified: fsf/trunk/libc/nscd/nscd-client.h
==============================================================================
--- fsf/trunk/libc/nscd/nscd-client.h (original)
+++ fsf/trunk/libc/nscd/nscd-client.h Wed May 16 00:01:41 2012
@@ -1,5 +1,4 @@
-/* Copyright (c) 1998, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2011
-   Free Software Foundation, Inc.
+/* Copyright (c) 1998-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@xxxxxxx>, 1998.
 
@@ -322,6 +321,25 @@
 };
 #define libc_locked_map_ptr(class, name) class struct locked_map_ptr name
 
+/* Try acquiring lock for mapptr, returns true if it succeeds, false
+   if not.  */
+static inline bool
+__nscd_acquire_maplock (volatile struct locked_map_ptr *mapptr)
+{
+  int cnt = 0;
+  while (__builtin_expect (atomic_compare_and_exchange_val_acq (&mapptr->lock,
+								1, 0) != 0, 0))
+    {
+      // XXX Best number of rounds?
+      if (__builtin_expect (++cnt > 5, 0))
+	return false;
+
+      atomic_delay ();
+    }
+
+  return true;
+}
+
 
 /* Open socket connection to nscd server.  */

[... 1889 lines stripped ...]
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits