[PATCH] D29287: [sanitizer] Fix 'dyld: Symbol not found: _memmem' linkage error on Darwin 10.6

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 05:38:38 PST 2017


kubamracek added a comment.

Maxim, I'm generally fine with this (a few nits), but 10.6 is really ancient today.  We currently only support *running* (i.e. deployment target) on 10.9+, and building on 10.10+.  All our Darwin buildbots (http://lab.llvm.org:8080/) are 10.10+.

I'm afraid that there will always be changes that break more and more stuff on 10.6 or even 10.7 and 10.8.  If these are something that you need supported, we should get public buildbots of these configurations, and I'm afraid we can't provide them.



================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:96
 
-// Direct syscalls, don't call libmalloc hooks.
+// Direct syscalls, don't call libmalloc hooks (but not available one 10.6).
 extern "C" void *__mmap(void *addr, size_t len, int prot, int flags, int fildes,
----------------
typo "one"


================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:107
+     return (uptr)__mmap(addr, length, prot, flags, fd, offset);
+  return (uptr) mmap(addr, length, prot, flags, fd, offset);
 }
----------------
clang-format please


================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:199
 
-// Doesn't call pthread_atfork() handlers.
-extern "C" pid_t __fork(void);
+ // Doesn't call pthread_atfork() handlers (but not available on 10.6).
+extern "C" pid_t __fork(void) SANITIZER_WEAK_ATTRIBUTE;
----------------
drop the space at the start of the line


================
Comment at: lib/sanitizer_common/sanitizer_platform_interceptors.h:51
+// FIXME: enable memmem on Windows.
+# define SI_MEMMEM SI_NOT_WINDOWS
+
----------------
drop the space between # and define


================
Comment at: lib/sanitizer_common/sanitizer_platform_interceptors.h:56-60
+# if defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+     __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070
+# undef SI_MEMMEM
+# define SI_MEMMEM 0
+# endif
----------------
I don't think this is the right place for this.  Can we put something like the following somewhere close to original place where `SANITIZER_INTERCEPT_MEMMEM` was defined:

```
#define SI_MAC_DEPLOYMENT_BELOW_10_7 ...
// memmem on Darwin doesn't exist on 10.6
#define SANITIZER_INTERCEPT_MEMMEM SI_NOT_WINDOWS && !SI_MAC_DEPLOYMENT_BELOW_10_7
```

?


Repository:
  rL LLVM

https://reviews.llvm.org/D29287





More information about the llvm-commits mailing list