diff --git a/TARGETS b/TARGETS index f577662c5..74de1608b 100644 --- a/TARGETS +++ b/TARGETS @@ -11,7 +11,8 @@ rocksdb_compiler_flags = [ "-DROCKSDB_MALLOC_USABLE_SIZE", "-DROCKSDB_RANGESYNC_PRESENT", "-DROCKSDB_SCHED_GETCPU_PRESENT", - "-DROCKSDB_SUPPORT_THREAD_LOCAL", + "-DROCKSDB_SUPPORT_THREAD_LOCAL", + "-DHAVE_SSE42", "-DOS_LINUX", # Flags to enable libs we include "-DSNAPPY", diff --git a/buckifier/targets_cfg.py b/buckifier/targets_cfg.py index 3a97b247c..de504e4d9 100644 --- a/buckifier/targets_cfg.py +++ b/buckifier/targets_cfg.py @@ -16,6 +16,7 @@ rocksdb_compiler_flags = [ "-DROCKSDB_RANGESYNC_PRESENT", "-DROCKSDB_SCHED_GETCPU_PRESENT", "-DROCKSDB_SUPPORT_THREAD_LOCAL", + "-DHAVE_SSE42", "-DOS_LINUX", # Flags to enable libs we include "-DSNAPPY", diff --git a/build_tools/fbcode_config.sh b/build_tools/fbcode_config.sh index 1138dae3f..b8609a11c 100644 --- a/build_tools/fbcode_config.sh +++ b/build_tools/fbcode_config.sh @@ -128,7 +128,7 @@ else fi CFLAGS+=" $DEPS_INCLUDE" -CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL" +CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL -DHAVE_SSE42" CXXFLAGS+=" $CFLAGS" EXEC_LDFLAGS=" $SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $LZ4_LIBS $ZSTD_LIBS $GFLAGS_LIBS $NUMA_LIB $TBB_LIBS" diff --git a/build_tools/fbcode_config4.8.1.sh b/build_tools/fbcode_config4.8.1.sh index 58b7ae25b..f5b8334db 100644 --- a/build_tools/fbcode_config4.8.1.sh +++ b/build_tools/fbcode_config4.8.1.sh @@ -93,7 +93,7 @@ else fi CFLAGS+=" $DEPS_INCLUDE" -CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL" +CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_SUPPORT_THREAD_LOCAL -DHAVE_SSE42" CFLAGS+=" -DSNAPPY -DGFLAGS=google -DZLIB -DBZIP2 -DLZ4 -DZSTD -DNUMA -DTBB" CXXFLAGS+=" $CFLAGS" diff --git a/util/crc32c.cc b/util/crc32c.cc index a171b409e..b12f2c7bf 100644 --- a/util/crc32c.cc +++ b/util/crc32c.cc @@ -374,7 +374,9 @@ uint32_t ExtendImpl(uint32_t crc, const char* buf, size_t size) { // Detect if SS42 or not. static bool isSSE42() { -#if defined(__GNUC__) && defined(__x86_64__) && !defined(IOS_CROSS_COMPILE) +#ifndef HAVE_SSE42 + return false; +#elif defined(__GNUC__) && defined(__x86_64__) && !defined(IOS_CROSS_COMPILE) uint32_t c_; uint32_t d_; __asm__("cpuid" : "=c"(c_), "=d"(d_) : "a"(1) : "ebx"); @@ -395,11 +397,7 @@ static inline Function Choose_Extend() { } bool IsFastCrc32Supported() { -#if defined(__SSE4_2__) || defined(_WIN64) return isSSE42(); -#else - return false; -#endif } Function ChosenExtend = Choose_Extend();