How to enable Initialization Order Fiasco sanitizer from the command line?

Hi Everyone,

We have a C++ library and a test script that grinds though various
configurations. It include various sanitizers. The script is a
security gate, and the self tests must pass for a release.

I want to add the Initialization Order Fiasco sanitizer as a command
line option, and not a envar export. There are some reasons for it,
like a positive confirmation the option exists and explicit invocation
of the checker.

How do I enable Initialization Order Fiasco sanitizer from the command line?

Thanks in advance.

To quote Reid’s response from another group:

“”"
If you want to bake in some options at compile time, there are a few ways to do it. -DASAN_DEFAULT_OPTIONS=check_initialization_order=true will work, or you can define the __asan_default_options function somewhere in the binary like this:

extern “C” const char *__asan_default_options() { return “check_initialization_order=true”; }
“”"