[PATCH] D39888: [lsan] Only use VM_MEMORY_OS_ALLOC_ONCE on Darwin versions that support it

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 07:59:04 PST 2017


kubamracek added a comment.

In https://reviews.llvm.org/D39888#926079, @ro wrote:

> In https://reviews.llvm.org/D39888#924761, @kubamracek wrote:
>
> > If the only problem here is that `VM_MEMORY_OS_ALLOC_ONCE` is not defined in older SDKs, then I suggest to simply copy the definition from the header and define something like `kSanitizerVmMemoryOsAllocOnce` ourselves (and add an explaining comment, of course). We certainly did that in other parts to avoid depending on the SDK.
>
>
> But what does this buy us?  AFAICS, the underlying functionality only appeared in OS X 10.9 and no way/amount of providing the macros
>  will introduce the kernel side of that.


As said previously, LSan is only tested on 10.11+ and I don't think anyone is going to support it on older macOS versions. If you just want to get it to compile (and not worry about it it not working), copying the constant from the header is the easiest way to go. But it's up to you.

  // 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

Can you explain? Is this the same problem? Another problem? If it's not specific to LSan then please move to a separate patch.

Secondarily, I believe the code should still be working even when VM_MEMORY_OS_ALLOC_ONCE is not provided by the kernel: We will simply not find any VM_MEMORY_OS_ALLOC_ONCE regions and move on.


https://reviews.llvm.org/D39888





More information about the llvm-commits mailing list