From abb1acc6ba94cac1f50377e925135afcc718d0ed Mon Sep 17 00:00:00 2001 From: Orvid King Date: Wed, 12 Aug 2015 13:12:46 -0700 Subject: [PATCH] Disable VDSO on MSVC 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/folly/detail/CacheLocality.cpp b/folly/detail/CacheLocality.cpp index 26cb1265..87f85928 100644 --- a/folly/detail/CacheLocality.cpp +++ b/folly/detail/CacheLocality.cpp @@ -16,8 +16,10 @@ #include +#ifndef _MSC_VER #define _GNU_SOURCE 1 // for RTLD_NOLOAD #include +#endif #include #include @@ -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() { -- 2.34.1