From 8f82f28bbaa6ca503e6296b2d26ecf213bceff88 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 27 Oct 2015 23:47:56 +0000 Subject: [PATCH] Remove MIPS16 atomics using __sync_* (bug 17404). MIPS16 atomics used __sync_* with GCC before 4.7, which as noted in bug 17404 is missing the required barrier semantics for atomic_exchange_rel. This patch removes the code in question as dead now GCC before 4.7 is no longer supported for building glibc. Sanity tested with builds for MIPS. [BZ #17404] * sysdeps/mips/atomic-machine.h [__GNUC_PREREQ (4, 8) || (__mips16 && __GNUC_PREREQ (4, 7))]: Change conditional to [__GNUC_PREREQ (4, 8) || __mips16]. [__mips16 && !__GNUC_PREREQ (4, 7)]: Remove conditional code. --- ChangeLog | 6 ++++++ NEWS | 20 ++++++++++---------- sysdeps/mips/atomic-machine.h | 27 +-------------------------- 3 files changed, 17 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f1292efdc..a9a4ad088a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2015-10-27 Joseph Myers + [BZ #17404] + * sysdeps/mips/atomic-machine.h + [__GNUC_PREREQ (4, 8) || (__mips16 && __GNUC_PREREQ (4, 7))]: + Change conditional to [__GNUC_PREREQ (4, 8) || __mips16]. + [__mips16 && !__GNUC_PREREQ (4, 7)]: Remove conditional code. + * resolv/res_send.c (send_vc) [__GNUC_PREREQ (4, 7)]: Make code unconditional. * soft-fp/fmadf4.c [__GNUC_PREREQ (4, 7)]: Likewise. diff --git a/NEWS b/NEWS index 5120ddc24d..335c3a845f 100644 --- a/NEWS +++ b/NEWS @@ -12,16 +12,16 @@ Version 2.23 887, 2542, 2543, 2558, 2898, 4404, 6803, 10432, 14341, 14912, 15367, 15384, 15470, 15491, 15786, 15918, 16141, 16296, 16347, 16399, 16415, 16422, 16517, 16519, 16520, 16521, 16620, 16734, 16973, 16985, 17118, - 17243, 17244, 17250, 17441, 17787, 17886, 17887, 17905, 18084, 18086, - 18240, 18265, 18370, 18421, 18480, 18525, 18595, 18589, 18610, 18611, - 18618, 18647, 18661, 18674, 18675, 18681, 18699, 18724, 18743, 18757, - 18778, 18781, 18787, 18789, 18790, 18795, 18796, 18803, 18820, 18823, - 18824, 18825, 18857, 18863, 18870, 18872, 18873, 18875, 18887, 18918, - 18921, 18928, 18951, 18952, 18953, 18956, 18961, 18966, 18967, 18969, - 18970, 18977, 18980, 18981, 18982, 18985, 19003, 19007, 19012, 19016, - 19018, 19032, 19046, 19049, 19050, 19059, 19071, 19074, 19076, 19077, - 19078, 19079, 19085, 19086, 19088, 19094, 19095, 19124, 19125, 19129, - 19134, 19137, 19156, 19174. + 17243, 17244, 17250, 17404, 17441, 17787, 17886, 17887, 17905, 18084, + 18086, 18240, 18265, 18370, 18421, 18480, 18525, 18595, 18589, 18610, + 18611, 18618, 18647, 18661, 18674, 18675, 18681, 18699, 18724, 18743, + 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796, 18803, 18820, + 18823, 18824, 18825, 18857, 18863, 18870, 18872, 18873, 18875, 18887, + 18918, 18921, 18928, 18951, 18952, 18953, 18956, 18961, 18966, 18967, + 18969, 18970, 18977, 18980, 18981, 18982, 18985, 19003, 19007, 19012, + 19016, 19018, 19032, 19046, 19049, 19050, 19059, 19071, 19074, 19076, + 19077, 19078, 19079, 19085, 19086, 19088, 19094, 19095, 19124, 19125, + 19129, 19134, 19137, 19156, 19174. * There is now a --disable-timezone-tools configure option for disabling the building and installing of the timezone related utilities (zic, zdump, and diff --git a/sysdeps/mips/atomic-machine.h b/sysdeps/mips/atomic-machine.h index 6db8fee1d4..f0a8902590 100644 --- a/sysdeps/mips/atomic-machine.h +++ b/sysdeps/mips/atomic-machine.h @@ -85,7 +85,7 @@ typedef uintmax_t uatomic_max_t; #define MIPS_SYNC_STR_1(X) MIPS_SYNC_STR_2(X) #define MIPS_SYNC_STR MIPS_SYNC_STR_1(MIPS_SYNC) -#if __GNUC_PREREQ (4, 8) || (defined __mips16 && __GNUC_PREREQ (4, 7)) +#if __GNUC_PREREQ (4, 8) || defined __mips16 /* The __atomic_* builtins are available in GCC 4.7 and later, but MIPS support for their efficient implementation was added only in GCC 4.8. We still want to use them even with GCC 4.7 for MIPS16 code where we @@ -213,31 +213,6 @@ typedef uintmax_t uatomic_max_t; __atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \ __ATOMIC_RELEASE) -#elif defined __mips16 /* !__GNUC_PREREQ (4, 7) */ -/* This implementation using __sync* builtins will be removed once glibc - requires GCC 4.7 or later to build. */ - -# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ - __sync_val_compare_and_swap ((mem), (oldval), (newval)) -# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ - (!__sync_bool_compare_and_swap ((mem), (oldval), (newval))) - -# define atomic_exchange_acq(mem, newval) \ - __sync_lock_test_and_set ((mem), (newval)) - -# define atomic_exchange_and_add(mem, val) \ - __sync_fetch_and_add ((mem), (val)) - -# define atomic_bit_test_set(mem, bit) \ - ({ __typeof (bit) __bit = (bit); \ - (__sync_fetch_and_or ((mem), 1 << (__bit)) & (1 << (__bit))); }) - -# define atomic_and(mem, mask) (void) __sync_fetch_and_and ((mem), (mask)) -# define atomic_and_val(mem, mask) __sync_fetch_and_and ((mem), (mask)) - -# define atomic_or(mem, mask) (void) __sync_fetch_and_or ((mem), (mask)) -# define atomic_or_val(mem, mask) __sync_fetch_and_or ((mem), (mask)) - #else /* !__mips16 && !__GNUC_PREREQ (4, 8) */ /* This implementation using inline assembly will be removed once glibc requires GCC 4.8 or later to build. */