summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaxim Ostapenko <m.ostapenko@partner.samsung.com>2016-04-20 10:22:37 +0000
committerMaxim Ostapenko <m.ostapenko@partner.samsung.com>2016-04-20 10:22:37 +0000
commit2d7f4d38d2ceb4f5b80865af34106e40233e1061 (patch)
tree4440fd94d435f01db516004b2180300ecd10120f /lib
parentc59940d1d0f5e28e574576d248b4422897056d8e (diff)
[sanitizer] Fix 'dyld: Symbol not found: _dyldVersionNumber' link error on old Darwin systems.
This patch fixes https://github.com/google/sanitizers/issues/669. On older Darwin systems (in particular, Darwin 10), dyld doesn't export '_dyldVersionNumber' symbol so we would have 'undefined reference' error in sanitzer library. Although sanitizers support was added to LLVM on OS X 10.7+ where '_dyldVersionNumber' symbol is already exported, GCC users still may want use them on older systems. Differential Revision: http://reviews.llvm.org/D19218 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266868 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/sanitizer_common/sanitizer_mac.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_mac.cc b/lib/sanitizer_common/sanitizer_mac.cc
index 35cd3c596..c2e8b1ec3 100644
--- a/lib/sanitizer_common/sanitizer_mac.cc
+++ b/lib/sanitizer_common/sanitizer_mac.cc
@@ -564,10 +564,14 @@ bool ReexecDisabled() {
return false;
}
-extern "C" double dyldVersionNumber;
+extern "C" SANITIZER_WEAK_ATTRIBUTE double dyldVersionNumber;
static const double kMinDyldVersionWithAutoInterposition = 360.0;
bool DyldNeedsEnvVariable() {
+ // Although sanitizer support was added to LLVM on OS X 10.7+, GCC users
+ // still may want use them on older systems. On older Darwin platforms, dyld
+ // doesn't export dyldVersionNumber symbol and we simply return true.
+ if (!&dyldVersionNumber) return true;
// If running on OS X 10.11+ or iOS 9.0+, dyld will interpose even if
// DYLD_INSERT_LIBRARIES is not set. However, checking OS version via
// GetMacosVersion() doesn't work for the simulator. Let's instead check