diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2014-09-29 20:34:38 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2014-09-29 20:34:38 +0000 |
commit | 6a9bd5876eaca48362e4164fb4f83294a3f382a0 (patch) | |
tree | c04ee38e158fedc5fef2fb8259255b9266299e05 | |
parent | dc4ea43b82b2b1c7615c4fabd67c6a61929cc57b (diff) | |
download | eglibc2-eglibc-2_17.tar.gz |
Merge changes between r25238 and r25891 from /fsf/glibc-2_17-branch.eglibc-2_17
git-svn-id: svn://svn.eglibc.org/branches/eglibc-2_17@25892 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r-- | libc/ChangeLog | 39 | ||||
-rw-r--r-- | libc/NEWS | 4 | ||||
-rw-r--r-- | libc/nptl/Makefile | 2 | ||||
-rw-r--r-- | libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S | 4 | ||||
-rw-r--r-- | libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S | 4 | ||||
-rw-r--r-- | libc/nptl/tst-spin4.c | 109 | ||||
-rw-r--r-- | libc/string/test-strcmp.c | 28 | ||||
-rw-r--r-- | libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S | 1 | ||||
-rw-r--r-- | libc/sysdeps/sparc/sparc64/strcmp.S | 31 | ||||
-rw-r--r-- | libc/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h | 2 | ||||
-rw-r--r-- | libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h | 27 |
11 files changed, 244 insertions, 7 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog index 5246373dd..97227c97b 100644 --- a/libc/ChangeLog +++ b/libc/ChangeLog @@ -1,3 +1,42 @@ +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] @@ -8,7 +8,7 @@ using `glibc' in the "product" field. Version 2.17.1 * The following bugs are resolved with this release: - 15003, 15006, 15073, 15122, 15759, 16510. + 15003, 15006, 15073, 15122, 15759, 16510, 16885, 16916, 16943, 16958. Version 2.17 @@ -29,7 +29,7 @@ Version 2.17 14767, 14783, 14784, 14785, 14793, 14796, 14797, 14801, 14803, 14805, 14807, 14811, 14815, 14821, 14822, 14824, 14828, 14831, 14833, 14835, 14838, 14856, 14863, 14865, 14866, 14868, 14869, 14871, 14872, 14879, - 14889, 14893, 14898, 14914. + 14889, 14893, 14898, 14914, 16882. * Optimization of memcpy for MIPS. diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile index 1cdb76a6e..37743b3d7 100644 --- a/libc/nptl/Makefile +++ b/libc/nptl/Makefile @@ -211,7 +211,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/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S b/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S index 315512170..703dbca69 100644 --- a/libc/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S +++ b/libc/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/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S b/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S index cd3b01fcb..d52c4a6b4 100644 --- a/libc/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S +++ b/libc/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/libc/nptl/tst-spin4.c b/libc/nptl/tst-spin4.c new file mode 100644 index 000000000..5b23a172c --- /dev/null +++ b/libc/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/libc/string/test-strcmp.c b/libc/string/test-strcmp.c index f186fd6cd..73101569a 100644 --- a/libc/string/test-strcmp.c +++ b/libc/string/test-strcmp.c @@ -353,6 +353,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/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S b/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S index fb815e5e5..93f87f739 100644 --- a/libc/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S +++ b/libc/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/libc/sysdeps/sparc/sparc64/strcmp.S b/libc/sysdeps/sparc/sparc64/strcmp.S index 386e0abc6..4abf86f29 100644 --- a/libc/sysdeps/sparc/sparc64/strcmp.S +++ b/libc/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/libc/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h index d76ac5f71..05da814bf 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h +++ b/libc/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/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h index 89fad8feb..08b20559a 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h +++ b/libc/sysdeps/unix/sysv/linux/sparc/bits/resource.h @@ -253,3 +253,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 |