[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
Tue Nov 13 05:42:43 PST 2018
delcypher added inline comments.
================
Comment at: lib/asan/asan_flags.inc:164
" when other library has to be preloaded system-wide)")
+ASAN_FLAG(bool, disable_init, false,
+ "If true, disables all initialization of the "
----------------
krytarowski wrote:
> Why to add a flag for it? As far as I understand it, we require this option to workaround some issue on Darwin and it's not needed so far by others. If I understanding removal of this property will break startup on Darwin.
>
> If so, shouldn't this be just Darwin specific hardcoded property rather than generalized and unsupported option for everybody?
We need a flag because we still need ASan's init to behave as it did previously in most scenarios (i.e. `disable_init=0`). It is only in the case where we want to perform `dlopen()` on the ASan dynamic library that we need to set `disable_init=1`.
Put another way, the problem we are trying to fix cannot be hard-coded because it is a dynamic property (how the ASan library is being loaded). I've made supporting this feature a static property guarded on `SANITIZER_SUPPORTS_DISABLED_INIT` which is only true on Darwin.
================
Comment at: lib/asan/asan_internal.h:117
+#else
+void HandleDisabledInit() { Die(); }
+#endif
----------------
krytarowski wrote:
> Shouldn't we add 'static inline'? Some compilers may complain that there is no prototype for a function.
To be honest I'd rather stick the definition for non-Darwin platforms for in a `.cc` file but I wasn't sure where to put it so I just left it here.
If there isn't a better home for the non-Darwin implementation it I'll be happy to add `static inline`.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D54469
More information about the llvm-commits
mailing list