[PATCH] D54469: Introduce new `disable_init` ASan option that is only supported on platforms where `SANITIZER_SUPPORTS_DISABLED_INIT` is true. Currently this is only supported on Darwin.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 14 08:49:46 PST 2018


delcypher marked an inline comment as done.
delcypher added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_platform.h:348-352
+#if SANITIZER_MAC
+#define SANITIZER_SUPPORTS_INIT_FOR_DLOPEN 1
+#else
+#define SANITIZER_SUPPORTS_INIT_FOR_DLOPEN 0
+#endif
----------------
kubamracek wrote:
> Why do we need this? I'd remove it.
Two reasons:

1. I wanted the feature to be zero-cost for platforms that don't use it. You can see it's used in the `if` condition in `AsanInitInternal()`. It's a compile time constant so for platforms that don't support this feature the branch should just be folded away and so it won't even be checked at runtime.
2. We need to something to let us switch between the definitions of  `InitIsViaDlopen()` and ` HandleDlopenInit()`. This macro is used for this.

If you have a clean solution to handle the second reason without `SANITIZER_SUPPORTS_INIT_FOR_DLOPEN` then I can implement it.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54469





More information about the llvm-commits mailing list