[PATCH] D19218: [sanitizer] Fix 'dyld: Symbol not found: _dyldVersionNumber' link error on old Darwin systems.
Maxim Ostapenko via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 18 00:52:08 PDT 2016
m.ostapenko created this revision.
m.ostapenko added reviewers: kcc, samsonov, dvyukov, kubabrecka.
m.ostapenko added subscribers: llvm-commits, ygribov.
m.ostapenko set the repository for this revision to rL LLVM.
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.
Repository:
rL LLVM
http://reviews.llvm.org/D19218
Files:
lib/sanitizer_common/sanitizer_mac.cc
Index: lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- lib/sanitizer_common/sanitizer_mac.cc
+++ lib/sanitizer_common/sanitizer_mac.cc
@@ -560,10 +560,14 @@
reexec_disabled = true;
}
-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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19218.54038.patch
Type: text/x-patch
Size: 944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160418/c080c6e5/attachment.bin>
More information about the llvm-commits
mailing list