From 78755c775c800cf0b3413a0d1848240308d45fdd Mon Sep 17 00:00:00 2001 From: Hadriel Kaplan Date: Thu, 29 Jan 2015 18:55:15 -0500 Subject: [PATCH] Disable SSE4.2 _ws_mempbrk_sse42 only for older Apple compilers This is a longer term fix to disable _ws_mempbrk_sse42 in older Apple compilers, which the buildbots currently use. This fix is the longer-term fix for the temprorary one introduced in g9a366b04/I2e438ff29. Bug: 10798 Change-Id: I051ca003610c07f7d75cc19b20ff823fe4c1ce05 Reviewed-on: https://code.wireshark.org/review/6851 Petri-Dish: Hadriel Kaplan Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte --- wsutil/ws_mempbrk.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/wsutil/ws_mempbrk.c b/wsutil/ws_mempbrk.c index 72cd99988f..8ad1a17e78 100644 --- a/wsutil/ws_mempbrk.c +++ b/wsutil/ws_mempbrk.c @@ -21,6 +21,19 @@ #include "config.h" +/* see bug 10798: there is a bug in the compiler the buildbots use for Mac OSX + and SSE4.2, so we're not going to use SSE4.2 with Mac OSX right now, for + older Mac OSX compilers. + */ +#ifdef __APPLE__ +#if defined(__clang__) && (__clang_major__ >= 6) +/* allow HAVE_SSE4_2 to be used for clang 6.0+ case because we know it works */ +#else +/* don't allow it otherwise, for Mac OSX */ +#undef HAVE_SSE4_2 +#endif +#endif + #include #include "ws_symbol_export.h" #ifdef HAVE_SSE4_2 @@ -60,11 +73,8 @@ ws_mempbrk(const guint8* haystack, size_t haystacklen, const guint8 *needles) if G_UNLIKELY(have_sse42 < 0) have_sse42 = ws_cpuid_sse42(); -/* -Commented out due to bug 10798 if (haystacklen >= 16 && have_sse42) return _ws_mempbrk_sse42(haystack, haystacklen, needles); -*/ #endif return _ws_mempbrk(haystack, haystacklen, needles);