Disable VDSO on MSVC
authorOrvid King <blah38621@gmail.com>
Wed, 12 Aug 2015 20:12:46 +0000 (13:12 -0700)
committerfacebook-github-bot-1 <folly-bot@fb.com>
Wed, 12 Aug 2015 20:20:36 +0000 (13:20 -0700)
Summary: MSVC will never be able to load VDSO, and doesn't even have dlopen, so just return `nullptr`, and let the fallback mechanisms handle it from there.
Closes #282

Reviewed By: @yfeldblum

Differential Revision: D2307461

Pulled By: @sgolemon

folly/detail/CacheLocality.cpp

index 26cb12651991ccebf549d4a121bae2899b927f29..87f85928d17433b0f5089f345ec30762009138ea 100644 (file)
 
 #include <folly/detail/CacheLocality.h>
 
+#ifndef _MSC_VER
 #define _GNU_SOURCE 1 // for RTLD_NOLOAD
 #include <dlfcn.h>
+#endif
 #include <fstream>
 
 #include <folly/Conv.h>
@@ -204,6 +206,9 @@ CacheLocality CacheLocality::uniform(size_t numCpus) {
 /// Resolves the dynamically loaded symbol __vdso_getcpu, returning null
 /// on failure
 static Getcpu::Func loadVdsoGetcpu() {
+#ifdef _MSC_VER
+  return nullptr;
+#else
   void* h = dlopen("linux-vdso.so.1", RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
   if (h == nullptr) {
     return nullptr;
@@ -219,6 +224,7 @@ static Getcpu::Func loadVdsoGetcpu() {
   }
 
   return func;
+#endif
 }
 
 Getcpu::Func Getcpu::vdsoFunc() {