> >> 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: 
> >> 
> > 
> > Thanks, we are not compiling the compiler. 
>
> You don't need to - just define this function somewhere in your exe 
> and libasan will automatically find it and take it's return value as 
> default option string. To control the string from cmdline you'll just 
> need to return a cmdline-controlled macro from it. 
>

Ah, OK, thanks.

So I'm clear, I need to add the following:

    #ifdef MYLIB_ASAN_CHECK_CXX_ORDER
    bool check_initialization_order
    {
        reutn true;
    }
    #endif

And then the following when building for the sanitizer:

    export CXX=clang++
    export CXXF:AGS+"-g3 -O2 -DMYLIB_ASAN_CHECK_CXX_ORDER"
    make

Is that correct?

My last question is, how can I detect when initializer order checking is 
available? We currently use the following in our test script to detect when 
Address Sanitzer is available:

    $CXX -x c++ -fsanitize=address adhoc.cpp.proto -c -o $TMP/adhoc > 
/dev/null 2>&1
    if [ "$?" -eq "0" ] && [ "$IS_X86" -ne "0" ]; then
        HAVE_ASAN=1
    else
        HAVE_ASAN=0
    fi

But its not clear to me how to determine when this particular feature is 
available.

Thanks again for the help.

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to