Guard against undefined weak symbols before Mac OS X 10.9 (PR sanitizer/82825)
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Wed, 17 Jan 2018 19:31:43 +0000 (19:31 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Wed, 17 Jan 2018 19:31:43 +0000 (19:31 +0000)
PR sanitizer/82825
* sanitizer_common/sanitizer_internal_defs.h: Cherry-pick upstream
r??????.

From-SVN: r256813

libsanitizer/ChangeLog
libsanitizer/sanitizer_common/sanitizer_internal_defs.h

index 2f57f6acd8252b9b9f823d165a2288506323baed..0f2192aed4d553bcdec8222beabc38379fe7dfcd 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-17  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR sanitizer/82825
+       * sanitizer_common/sanitizer_internal_defs.h: Cherry-pick upstream
+       r??????.
+
 2018-01-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR sanitizer/82824
index ef405dec04854d551fcc26c172c60ea16b418949..edd6a21c1221cf3d8ddb6c066670dd0acd38e693 100644 (file)
 // SANITIZER_SUPPORTS_WEAK_HOOKS means that we support real weak functions that
 // will evaluate to a null pointer when not defined.
 #ifndef SANITIZER_SUPPORTS_WEAK_HOOKS
-#if (SANITIZER_LINUX || SANITIZER_MAC) && !SANITIZER_GO
+#if SANITIZER_LINUX && !SANITIZER_GO
+# define SANITIZER_SUPPORTS_WEAK_HOOKS 1
+// Before Xcode 4.5, the Darwin linker doesn't reliably support undefined
+// weak symbols.  Mac OS X 10.9/Darwin 13 is the first release only supported
+// by Xcode >= 4.5.
+#elif SANITIZER_MAC && \
+    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 && !SANITIZER_GO
 # define SANITIZER_SUPPORTS_WEAK_HOOKS 1
 #else
 # define SANITIZER_SUPPORTS_WEAK_HOOKS 0