Fix compilation on Linux systems without vDSO support v2017.05.15.00
authorKoen De Keyser <koen.dekeyser@gmail.com>
Sat, 13 May 2017 18:01:56 +0000 (11:01 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 13 May 2017 18:19:12 +0000 (11:19 -0700)
commit55b25ffb4a79f111e195c51fd489ba43b7e808a0
tree127c62decbb1ab33f16a785ad9403e37b87056d0
parent7728c4b3b4a0122c2728e3ef548aa4d356ba7adf
Fix compilation on Linux systems without vDSO support

Summary:
Problems:
- The vDSO check code in configure.ac is broken, and will always fail (uses AC_LANG_PROGRAM but with arguments in the AC_LANG_SOURCE style)
- On Linux, using dlopen/dlsym requires -ldl (libdl) during the link phase. This check was missing and this argument was not added to the linker arguments.
- On a Linux system without vDSO support, libfolly.so still uses vDSO in ClockGettimeWrappers.cpp

Solution:
- Switched to AC_LANG_SOURCE
- Required libdl to exist when build target is Linux. This also adds this dependency to libfolly.la, resulting in fixing a dependency issue for Proxygen (recent Proxygen build would have issues in building examples due to failing linking step due to missing dlopen / dlsym / dlclose symbols)
- In ClockGettimeWrappers.cpp, checking if `__linux__` is set is not sufficient to determine that the system has vDSO support. The autoconf script already exposes a correct check: FOLLY_HAVE_LINUX_VDSO (this is already used in folly/detail/CacheLocality.cpp), so switched to that one.
Closes https://github.com/facebook/folly/pull/592

Reviewed By: yfeldblum

Differential Revision: D5049816

Pulled By: Orvid

fbshipit-source-id: 58b2ed4c4101274505c61b4825accf262c0d56ef
folly/ClockGettimeWrappers.cpp
folly/configure.ac