[PATCH] D19218: [sanitizer] Fix 'dyld: Symbol not found: _dyldVersionNumber' link error on old Darwin systems.

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 03:28:16 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL266868: [sanitizer] Fix 'dyld: Symbol not found: _dyldVersionNumber' link error on… (authored by chefmax).

Changed prior to commit:
  http://reviews.llvm.org/D19218?vs=54038&id=54339#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19218

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc

Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
@@ -564,10 +564,14 @@
   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19218.54339.patch
Type: text/x-patch
Size: 988 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160420/269e1b7d/attachment.bin>


More information about the llvm-commits mailing list