about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2015-04-07 10:13:59 -0300
committerTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2015-04-07 10:13:59 -0300
commitfec49d52bbe7af00c80f014a76357f56293e42bd (patch)
tree869f904ee4c289afaba466e59b2ca3fb02ec9866
parent45af2f6fe19b8a776373cac5a2691460179aa1a3 (diff)
parentd4deb63367247eaddcbe10b872d39ff70659eaf4 (diff)
downloadglibc-fec49d52bbe7af00c80f014a76357f56293e42bd.tar.gz
glibc-fec49d52bbe7af00c80f014a76357f56293e42bd.tar.xz
glibc-fec49d52bbe7af00c80f014a76357f56293e42bd.zip
Merge branch release/2.18/master into ibm/2.18/master
Conflicts:
	NEWS
-rw-r--r--ChangeLog57
-rw-r--r--NEWS11
-rw-r--r--malloc/malloc.c20
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S4
-rw-r--r--nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S4
-rw-r--r--nptl/tst-spin4.c109
-rw-r--r--ports/ChangeLog.aarch6424
-rw-r--r--ports/ChangeLog.alpha5
-rw-r--r--ports/sysdeps/aarch64/dl-trampoline.S30
-rw-r--r--ports/sysdeps/aarch64/fpu/fpu_control.h3
-rw-r--r--ports/sysdeps/aarch64/soft-fp/sfp-machine.h2
-rw-r--r--ports/sysdeps/unix/sysv/linux/aarch64/clone.S7
-rw-r--r--ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S18
-rw-r--r--string/test-strcmp.c28
-rw-r--r--sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S1
-rw-r--r--sysdeps/sparc/sparc64/strcmp.S31
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/eventfd.h2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/resource.h27
-rw-r--r--sysdeps/x86/fpu/bits/mathinline.h6
-rw-r--r--sysdeps/x86_64/x32/symbol-hacks.h2
21 files changed, 360 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index 6df40a4763..f302131dc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1136,6 +1136,63 @@
 	NAME_MAX, PATH_MAX.
 	(Pathconf): Add portability note for _PC_NAME_MAX, _PC_PATH_MAX.
 
+2014-06-03  Guo Yixuan  <culu.gyx@gmail.com>
+
+	[BZ #16882]
+	* nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
+	(pthread_spin_lock): Branch out of spin loop to proper location.
+	* nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
+	(pthread_spin_lock): Likewise.
+
+	* nptl/tst-spin4.c: New test.
+	* nptl/Makefile (tests): Add tst-spin4.
+
+2014-05-17  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+	[BZ #16958]
+	* sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S: Add missing
+	membar to avoid block loads/stores to overlap previous stores.
+
+2014-05-16  Aurelien Jarno  <aurelien@aurel32.net>
+
+	[BZ #16943]
+	* sysdeps/unix/sysv/linux/sparc/bits/resource.h: Declare prlimit
+	and prlimit64.
+
+2014-05-06  Aurelien Jarno  <aurelien@aurel32.net>
+
+        [BZ# 16916]
+        * sysdeps/unix/sysv/linux/sparc/bits/eventfd.h (EFD_SEMAPHORE):
+        Define.
+
+2014-05-01  David S. Miller  <davem@davemloft.net>
+
+	[BZ #16885]
+	* sysdeps/sparc/sparc64/strcmp.S: Fix end comparison handling when
+	multiple zero bytes exist at the end of a string.
+	Reported by Aurelien Jarno <aurelien@aurel32.net>
+
+	* string/test-strcmp.c (check): Add explicit test for situations where
+	there are multiple zero bytes after the first.
+
+2014-01-29  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #16510]
+	* sysdeps/x86/fpu/bits/mathinline.h: Check __SSE2_MATH__ instead
+	of __x86_64__ when disabling x87 inline functions.
+
+2014-01-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #15605]
+	* sysdeps/x86_64/x32/symbol-hacks.h: Include generic symbol-hacks.h.
+
+2014-01-04  Maxim Kuvyrkov  <maxim@kugelworks.com>
+	    Ondřej Bílka  <neleai@seznam.cz>
+
+	[BZ #15073]
+	* malloc/malloc.c (_int_free): Perform sanity check only if we
+        have_lock.
+
 2013-11-11  David S. Miller  <davem@davemloft.net>
 
 	[BZ #16150]
diff --git a/NEWS b/NEWS
index 324dd55d75..ecccd4b68d 100644
--- a/NEWS
+++ b/NEWS
@@ -9,10 +9,11 @@ Version 2.18.1
 
 * The following bugs are resolved with this release:
 
-  14143, 14155, 14547, 14699, 15532, 15427, 15522, 15680, 15723, 15734,
-  15735, 15797, 15892, 15895, 15909, 15915, 15917, 15946, 15996, 16072,
-  16150, 16414, 16430, 16431, 16617, 16618, 17048, 17137, 17187, 17325,
-  17625, 17630, 18104.
+  14143, 14155, 14547, 14699, 15073, 15128, 15532, 15427, 15522, 15680,
+  15723, 15734, 15735, 15797, 15892, 15895, 15909, 15915, 15917, 15946,
+  15996, 16072, 16150, 16169, 16387, 16414, 16430, 16431, 16510, 16617,
+  16618, 16885, 16916, 16943, 16958, 17048, 17137, 17187, 17325, 17625,
+  17630, 18104.
 
 * Support for powerpc64le has been added.
 
@@ -92,7 +93,7 @@ Version 2.18
   15465, 15480, 15485, 15488, 15490, 15492, 15493, 15497, 15506, 15522,
   15529, 15532, 15536, 15553, 15577, 15583, 15618, 15627, 15631, 15654,
   15655, 15666, 15667, 15674, 15711, 15755, 15759, 15797, 15892, 15893,
-  15895.
+  15895, 16882.
 
 * CVE-2013-4332 The pvalloc, valloc, memalign, posix_memalign and
   aligned_alloc functions could allocate too few bytes or corrupt the
diff --git a/malloc/malloc.c b/malloc/malloc.c
index ebbe86dc7c..a7d87e8036 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3830,25 +3830,29 @@ _int_free(mstate av, mchunkptr p, int have_lock)
     unsigned int idx = fastbin_index(size);
     fb = &fastbin (av, idx);
 
-    mchunkptr fd;
-    mchunkptr old = *fb;
+    /* Atomically link P to its fastbin: P->FD = *FB; *FB = P;  */
+    mchunkptr old = *fb, old2;
     unsigned int old_idx = ~0u;
     do
       {
-	/* Another simple check: make sure the top of the bin is not the
-	   record we are going to add (i.e., double free).  */
+	/* Check that the top of the bin is not the record we are going to add
+	   (i.e., double free).  */
 	if (__builtin_expect (old == p, 0))
 	  {
 	    errstr = "double free or corruption (fasttop)";
 	    goto errout;
 	  }
-	if (old != NULL)
+	/* Check that size of fastbin chunk at the top is the same as
+	   size of the chunk that we are adding.  We can dereference OLD
+	   only if we have the lock, otherwise it might have already been
+	   deallocated.  See use of OLD_IDX below for the actual check.  */
+	if (have_lock && old != NULL)
 	  old_idx = fastbin_index(chunksize(old));
-	p->fd = fd = old;
+	p->fd = old2 = old;
       }
-    while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
+    while ((old = catomic_compare_and_exchange_val_rel (fb, p, old2)) != old2);
 
-    if (fd != NULL && __builtin_expect (old_idx != idx, 0))
+    if (have_lock && old != NULL && __builtin_expect (old_idx != idx, 0))
       {
 	errstr = "invalid fastbin entry (free)";
 	goto errout;
diff --git a/nptl/Makefile b/nptl/Makefile
index cd601e5f5a..9f02c68506 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -208,7 +208,7 @@ tests = tst-typesizes \
 	tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
 	tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a tst-mutexpi8 \
 	tst-mutexpi9 \
-	tst-spin1 tst-spin2 tst-spin3 \
+	tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
 	tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
 	tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
 	tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
diff --git a/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S b/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
index 7099f2984a..ad13681412 100644
--- a/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
+++ b/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S
@@ -19,11 +19,11 @@
 
 	.text
 ENTRY(pthread_spin_lock)
-	ldstub		[%o0], %g1
+1:	ldstub		[%o0], %g1
 	orcc		%g1, 0x0, %g0
 	bne,a		2f
 	 ldub		[%o0], %g1
-1:	retl
+	retl
 	 mov		0, %o0
 2:	orcc		%g1, 0x0, %g0
 	bne,a		2b
diff --git a/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S b/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
index 11091e900b..8896a71c9a 100644
--- a/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
+++ b/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S
@@ -19,10 +19,10 @@
 
 	.text
 ENTRY(pthread_spin_lock)
-	ldstub		[%o0], %g1
+1:	ldstub		[%o0], %g1
 	brnz,pn		%g1, 2f
 	 membar		#StoreLoad | #StoreStore
-1:	retl
+	retl
 	 mov		0, %o0
 2:	ldub		[%o0], %g1
 	brnz,pt		%g1, 2b
diff --git a/nptl/tst-spin4.c b/nptl/tst-spin4.c
new file mode 100644
index 0000000000..5b23a172ca
--- /dev/null
+++ b/nptl/tst-spin4.c
@@ -0,0 +1,109 @@
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static int count = 0;
+
+static void *
+thread_add_one (void *arg)
+{
+  int tmp;
+  pthread_spinlock_t *lock = (pthread_spinlock_t *) arg;
+
+  /* When do_test holds the lock for 1 sec, the two thread will be
+     in contention for the lock. */
+  if (pthread_spin_lock (lock) != 0)
+    {
+      puts ("thread_add_one(): spin_lock failed");
+      pthread_exit ((void *) 1l);
+    }
+
+  /* sleep 1s before modifying count */
+  tmp = count;
+  sleep (1);
+  count = tmp + 1;
+
+  if (pthread_spin_unlock (lock) != 0)
+    {
+      puts ("thread_add_one(): spin_unlock failed");
+      pthread_exit ((void *) 1l);
+    }
+
+  return NULL;
+}
+
+static int
+do_test (void)
+{
+  pthread_t thr1, thr2;
+  pthread_spinlock_t lock;
+  int tmp;
+
+  if (pthread_spin_init (&lock, PTHREAD_PROCESS_PRIVATE) != 0)
+    {
+      puts ("spin_init failed");
+      return 1;
+    }
+
+  if (pthread_spin_lock (&lock) != 0)
+    {
+      puts ("1st spin_lock failed");
+      return 1;
+    }
+
+  if (pthread_create (&thr1, NULL, thread_add_one, (void *) &lock) != 0)
+    {
+      puts ("1st pthread_create failed");
+      return 1;
+    }
+
+  if (pthread_create (&thr2, NULL, thread_add_one, (void *) &lock) != 0)
+    {
+      puts ("2nd pthread_create failed");
+      return 1;
+    }
+
+  /* sleep 1s before modifying count */
+  tmp = count;
+  sleep (1);
+  count = tmp + 1;
+
+  if (pthread_spin_unlock (&lock) != 0)
+    {
+      puts ("1st spin_unlock failed");
+      return 1;
+    }
+
+  void *status;
+  if (pthread_join (thr1, &status) != 0)
+    {
+      puts ("1st pthread_join failed");
+      return 1;
+    }
+  if (status != NULL)
+    {
+      puts ("failure in the 1st thread");
+      return 1;
+    }
+  if (pthread_join (thr2, &status) != 0)
+    {
+      puts ("2nd pthread_join failed");
+      return 1;
+    }
+  if (status != NULL)
+    {
+      puts ("failure in the 2nd thread");
+      return 1;
+    }
+
+  if (count != 3)
+    {
+      printf ("count is %d, should be 3\n", count);
+      return 1;
+    }
+  return 0;
+}
+
+#define TIMEOUT 5
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64
index 537ae601e0..89259326d6 100644
--- a/ports/ChangeLog.aarch64
+++ b/ports/ChangeLog.aarch64
@@ -1,3 +1,27 @@
+2014-01-20  Tom Tromey  <tromey@redhat.com>
+
+	[BZ #16169]
+	* sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Add CFI
+	directives;  Zero x29.
+
+2014-01-07  Marcus Shawcroft  <marcus.shawcroft@linaro.org>
+
+	[BZ #16387]
+	* sysdeps/aarch64/fpu/fpu_control.h (_FPU_FPCR_RM_MASK): Define.
+	* sysdeps/aarch64/soft-fp/sfp-machine.h (FP_ROUNDMODE): Adjust
+	rounding mode mask.
+
+2014-01-07  Marcus Shawcroft  <marcus.shawcroft@linaro.org>
+
+	* sysdeps/aarch64/dl-trampoline.S (_dl_runtime_resolve): Correct
+	cfi_adjust_cfa_offset offset.
+
+2013-12-18  Marcus Shawcroft  <marcus.shawcroft@linaro.org>
+
+	[BZ #15128]
+	* sysdeps/aarch64/dl-trampoline.S (_dl_runtime_resolve): Save and
+	restore q0-q7.
+
 2013-07-26  Marcus Shawcroft  <marcus.shawcroft@linaro.org>
 
 	* sysdeps/aarch64/Versions: New file.
diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha
index 4a4db09fb8..0fc0a4b775 100644
--- a/ports/ChangeLog.alpha
+++ b/ports/ChangeLog.alpha
@@ -1,3 +1,8 @@
+2013-11-16  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/unix/sysv/linux/alpha/rt_sigaction.S: Include a nop
+	before each signal thunk.
+
 2013-07-02  Richard Henderson  <rth@redhat.com>
 
         * sysdeps/alpha/fpu/libm-test-ulps: Update.
diff --git a/ports/sysdeps/aarch64/dl-trampoline.S b/ports/sysdeps/aarch64/dl-trampoline.S
index 94c69a0e2d..fc5ec83424 100644
--- a/ports/sysdeps/aarch64/dl-trampoline.S
+++ b/ports/sysdeps/aarch64/dl-trampoline.S
@@ -41,8 +41,8 @@ _dl_runtime_resolve:
 	cfi_rel_offset (lr, 8)
 
 	/* Save arguments.  */
-	stp	x8, x9, [sp, #-80]!
-	cfi_adjust_cfa_offset (80)
+	stp	x8, x9, [sp, #-(80+8*16)]!
+	cfi_adjust_cfa_offset (80+8*16)
 	cfi_rel_offset (x8, 0)
 	cfi_rel_offset (x9, 8)
 
@@ -62,11 +62,27 @@ _dl_runtime_resolve:
 	cfi_rel_offset (x0, 64)
 	cfi_rel_offset (x1, 72)
 
+	stp	q0, q1, [sp, #(80+0*16)]
+	cfi_rel_offset (q0, 80+0*16)
+	cfi_rel_offset (q1, 80+1*16)
+
+	stp	q2, q3, [sp, #(80+2*16)]
+	cfi_rel_offset (q0, 80+2*16)
+	cfi_rel_offset (q1, 80+3*16)
+
+	stp	q4, q5, [sp, #(80+4*16)]
+	cfi_rel_offset (q0, 80+4*16)
+	cfi_rel_offset (q1, 80+5*16)
+
+	stp	q6, q7, [sp, #(80+6*16)]
+	cfi_rel_offset (q0, 80+6*16)
+	cfi_rel_offset (q1, 80+7*16)
+
 	/* Get pointer to linker struct.  */
 	ldr	x0, [ip0, #-8]
 
 	/* Prepare to call _dl_fixup().  */
-	ldr	x1, [sp, 80]	/* Recover &PLTGOT[n] */
+	ldr	x1, [sp, 80+8*16]	/* Recover &PLTGOT[n] */
 
 	sub     x1, x1, ip0
 	add     x1, x1, x1, lsl #1
@@ -81,12 +97,16 @@ _dl_runtime_resolve:
 	mov	ip0, x0
 
 	/* Get arguments and return address back.  */
+	ldp	q0, q1, [sp, #(80+0*16)]
+	ldp	q2, q3, [sp, #(80+2*16)]
+	ldp	q4, q5, [sp, #(80+4*16)]
+	ldp	q6, q7, [sp, #(80+6*16)]
 	ldp	x0, x1, [sp, #64]
 	ldp	x2, x3, [sp, #48]
 	ldp	x4, x5, [sp, #32]
 	ldp	x6, x7, [sp, #16]
-	ldp	x8, x9, [sp], #80
-	cfi_adjust_cfa_offset (-80)
+	ldp	x8, x9, [sp], #(80+8*16)
+	cfi_adjust_cfa_offset (-(80+8*16))
 
 	ldp	ip1, lr, [sp], #16
 	cfi_adjust_cfa_offset (-16)
diff --git a/ports/sysdeps/aarch64/fpu/fpu_control.h b/ports/sysdeps/aarch64/fpu/fpu_control.h
index 89ff7e129d..37059261f7 100644
--- a/ports/sysdeps/aarch64/fpu/fpu_control.h
+++ b/ports/sysdeps/aarch64/fpu/fpu_control.h
@@ -59,6 +59,9 @@
                    E E D D
                        E E
  */
+
+#define _FPU_FPCR_RM_MASK  0xc00000
+
 #define _FPU_FPCR_MASK_IXE 0x1000
 #define _FPU_FPCR_MASK_UFE 0x0800
 #define _FPU_FPCR_MASK_OFE 0x0400
diff --git a/ports/sysdeps/aarch64/soft-fp/sfp-machine.h b/ports/sysdeps/aarch64/soft-fp/sfp-machine.h
index d21d00a934..9bb94e5ccc 100644
--- a/ports/sysdeps/aarch64/soft-fp/sfp-machine.h
+++ b/ports/sysdeps/aarch64/soft-fp/sfp-machine.h
@@ -47,7 +47,7 @@
 
 #define _FP_DECL_EX		fpu_control_t _fcw
 
-#define FP_ROUNDMODE		(_fcw & 0x3)
+#define FP_ROUNDMODE		(_fcw & _FPU_FPCR_RM_MASK)
 
 #define FP_RND_NEAREST		FE_TONEAREST
 #define FP_RND_ZERO		FE_TOWARDZERO
diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/clone.S b/ports/sysdeps/unix/sysv/linux/aarch64/clone.S
index b359e6e8a3..7d8816977f 100644
--- a/ports/sysdeps/unix/sysv/linux/aarch64/clone.S
+++ b/ports/sysdeps/unix/sysv/linux/aarch64/clone.S
@@ -63,6 +63,7 @@ ENTRY(__clone)
 	mov	x8, #SYS_ify(clone)
 	/* X0:flags, x1:newsp, x2:parenttidptr, x3:newtls, x4:childtid.  */
 	svc	0x0
+	cfi_endproc
 	cmp	x0, #0
 	beq	2f
 	blt	3f
@@ -72,6 +73,9 @@ ENTRY(__clone)
 	b	syscall_error
 
 2:
+	cfi_startproc
+	cfi_undefined (x30)
+	mov	x29, 0
 #ifdef RESET_PID
 	tbnz	x5, #CLONE_THREAD_BIT, 3f
 	mov	x0, #-1
@@ -93,7 +97,8 @@ ENTRY(__clone)
 
 	/* We are done, pass the return value through x0.  */
 	b	HIDDEN_JUMPTARGET(_exit)
-
+	cfi_endproc
+	cfi_startproc
 PSEUDO_END (__clone)
 
 weak_alias (__clone, clone)
diff --git a/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S b/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S
index 3d291fd0b4..6efa7386d5 100644
--- a/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S
+++ b/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S
@@ -83,14 +83,21 @@ PSEUDO_END(__syscall_rt_sigaction)
 	cfi_offset (64, \base + 2 * 8)
 	.endm
 
-	.align	4
-
 	cfi_startproc
 	cfi_return_column (64)
 	.cfi_signal_frame
 	SIGCONTEXT_REGS -648
-
 	cfi_def_cfa_offset (648)
+
+	/* While this frame is marked as a signal frame, that only applies
+	   to how this return address is handled for the outer frame.
+	   The return address that arrived here, from the inner frame, is
+	   not marked as a signal frame and so the unwinder still tries to
+	   subtract 1 to examine the presumed call insn.  Thus we must
+	   extend the unwind info to a nop before the start.  */
+	nop
+	.align 4
+
 __syscall_sigreturn:
 	mov	sp, a0
 	ldi	v0, __NR_sigreturn
@@ -98,8 +105,11 @@ __syscall_sigreturn:
 	.size	__syscall_sigreturn, .-__syscall_sigreturn
 	.type	__syscall_sigreturn, @function
 
-	.align 4
+	/* See above wrt including the nop.  */
 	cfi_def_cfa_offset (176 + 648)
+	nop
+	.align 4
+
 __syscall_rt_sigreturn:
 	mov	sp,a0
 	ldi	v0,__NR_rt_sigreturn
diff --git a/string/test-strcmp.c b/string/test-strcmp.c
index f666993929..d4fb82a598 100644
--- a/string/test-strcmp.c
+++ b/string/test-strcmp.c
@@ -329,6 +329,34 @@ check (void)
 		FOR_EACH_IMPL (impl, 0)
 		check_result (impl, s1 + i1, s2 + i2, exp_result);
       }
+
+  /* Test cases where there are multiple zero bytes after the first.  */
+
+  for (size_t i = 0; i < 16 + 1; i++)
+    {
+      s1[i] = 0x00;
+      s2[i] = 0x00;
+    }
+
+  for (size_t i = 0; i < 16; i++)
+    {
+      int exp_result;
+
+      for (int val = 0x01; val < 0x100; val++)
+	{
+	  for (size_t j = 0; j < i; j++)
+	    {
+	      s1[j] = val;
+	      s2[j] = val;
+	    }
+
+	  s2[i] = val;
+
+	  exp_result = SIMPLE_STRCMP (s1, s2);
+	  FOR_EACH_IMPL (impl, 0)
+	    check_result (impl, s1, s2, exp_result);
+	}
+    }
 }
 
 
diff --git a/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S b/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S
index 594405051f..63ba0811d0 100644
--- a/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S
+++ b/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S
@@ -211,6 +211,7 @@ ENTRY(__memcpy_niagara2)
 	 */
 	VISEntryHalf
 
+	membar		#Sync
 	alignaddr	%o1, %g0, %g0
 
 	add		%o1, (64 - 1), %o4
diff --git a/sysdeps/sparc/sparc64/strcmp.S b/sysdeps/sparc/sparc64/strcmp.S
index a36992e437..0b90f575a5 100644
--- a/sysdeps/sparc/sparc64/strcmp.S
+++ b/sysdeps/sparc/sparc64/strcmp.S
@@ -121,6 +121,37 @@ ENTRY(strcmp)
 	movleu	%xcc, -1, %o0
 	srlx	rTMP1, 7, rTMP1
 
+	/* In order not to be influenced by bytes after the zero byte, we
+	 * have to retain only the highest bit in the mask for the comparison
+	 * with rSTRXOR to work properly.
+	 */
+	mov	0, rTMP2
+	andcc	rTMP1, 0x0100, %g0
+
+	movne	%xcc, 8, rTMP2
+	sllx	rTMP1, 63 - 16, %o1
+
+	movrlz	%o1, 16, rTMP2
+	sllx	rTMP1, 63 - 24, %o1
+
+	movrlz	%o1, 24, rTMP2
+	sllx	rTMP1, 63 - 32, %o1
+
+	movrlz	%o1, 32, rTMP2
+	sllx	rTMP1, 63 - 40, %o1
+
+	movrlz	%o1, 40, rTMP2
+	sllx	rTMP1, 63 - 48, %o1
+
+	movrlz	%o1, 48, rTMP2
+	sllx	rTMP1, 63 - 56, %o1
+
+	movrlz	%o1, 56, rTMP2
+
+	srlx	rTMP1, rTMP2, rTMP1
+
+	sllx	rTMP1, rTMP2, rTMP1
+
 	cmp	rTMP1, rSTRXOR
 	retl
 	 movgu	%xcc, 0, %o0
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h b/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h
index b0234d1a20..e348cc6fb6 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h
@@ -22,6 +22,8 @@
 /* Flags for eventfd.  */
 enum
   {
+    EFD_SEMAPHORE = 0x000001,
+#define EFD_SEMAPHORE EFD_SEMAPHORE
     EFD_CLOEXEC = 0x400000,
 #define EFD_CLOEXEC EFD_CLOEXEC
     EFD_NONBLOCK = 0x004000
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index 14c2b70ad3..cee1c0fe88 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -252,3 +252,30 @@ enum __priority_which
   PRIO_USER = 2			/* WHO is a user ID.  */
 #define PRIO_USER PRIO_USER
 };
+
+__BEGIN_DECLS
+
+#ifdef __USE_GNU
+/* Modify and return resource limits of a process atomically.  */
+# ifndef __USE_FILE_OFFSET64
+extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
+		    const struct rlimit *__new_limit,
+		    struct rlimit *__old_limit) __THROW;
+# else
+#  ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (prlimit, (__pid_t __pid,
+				     enum __rlimit_resource __resource,
+				     const struct rlimit *__new_limit,
+				     struct rlimit *__old_limit), prlimit64);
+#  else
+#   define prlimit prlimit64
+#  endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
+		      const struct rlimit64 *__new_limit,
+		      struct rlimit64 *__old_limit) __THROW;
+# endif
+#endif
+
+__END_DECLS
diff --git a/sysdeps/x86/fpu/bits/mathinline.h b/sysdeps/x86/fpu/bits/mathinline.h
index fed64149fc..b4b28f30f1 100644
--- a/sysdeps/x86/fpu/bits/mathinline.h
+++ b/sysdeps/x86/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for i387 and SSE.
-   Copyright (C) 1995-2013 Free Software Foundation, Inc.
+   Copyright (C) 1995-2014 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
@@ -384,7 +384,7 @@ __END_NAMESPACE_C99
 # endif
 #endif
 
-#ifndef __x86_64__
+#ifndef __SSE2_MATH__
 # if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
      && defined __OPTIMIZE__)
 
@@ -970,4 +970,4 @@ __inline_mathcode2 (__ieee754_atan2, __y, __x,
 		    return __value;)
 # endif
 
-#endif /* !__x86_64__ */
+#endif /* !__SSE2_MATH__ */
diff --git a/sysdeps/x86_64/x32/symbol-hacks.h b/sysdeps/x86_64/x32/symbol-hacks.h
index bc7b4c4441..22aad04437 100644
--- a/sysdeps/x86_64/x32/symbol-hacks.h
+++ b/sysdeps/x86_64/x32/symbol-hacks.h
@@ -1 +1 @@
-/* Fortunately nothing to do.  */
+#include <sysdeps/generic/symbol-hacks.h>