AddressSanitizer and the GC

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 21 13:53:18 PDT 2017


On 7/21/2017 12:06 PM, Johan Engelen wrote:
< [...]

Thanks for your work on this. It is important to support such valuable tools.

One way making such things pretty much cost-free in the olden days was to trick 
the linker into writing NOPs over the function calls by using specially crafted 
fixup records. This worked with dumb linkers, but today's linkers do much more 
semantic inference into what's going on, I'm afraid this may be too brittle.

Unless there is a linker feature to support it? Are some linkers able to NOP out 
a function call if it sees that the function body consists solely of a RET?

Another option is to use a pointer to the asan functions, like:

     if (asan_fp)
         (*asan_fp)(args...)

The asan_fp can then be set to NULL and there's only the overhead of a 
compare/branch rather than a function call. Well, also the load of a global 
variable.


More information about the Digitalmars-d mailing list