This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Don't hardcode ASan runtime version in ASan dll thunk
ClosedPublic

Authored by samsonov on Jul 7 2014, 12:06 PM.

Details

Reviewers
kcc
timurrrr
Summary

Instead, include ASan headers in asan_dll_thunk.cc and make
use of __asan_init macro expansion.

Diff Detail

Event Timeline

samsonov updated this revision to Diff 11126.Jul 7 2014, 12:06 PM
samsonov retitled this revision from to [ASan] Don't hardcode ASan runtime version in ASan dll thunk.
samsonov updated this object.
samsonov edited the test plan for this revision. (Show Details)
samsonov added a reviewer: timurrrr.
samsonov added a subscriber: Unknown Object (MLST).
timurrrr edited edge metadata.Jul 8 2014, 7:01 AM

This doesn't compile :-(

lib/asan/asan_dll_thunk.cc
238

The thing is that asan_interface_internal.h defines pretty much the same set of functions that I do here using the INTERFACE_FUNCTION macro. For editing simplicity reasons, the INTERFACE_FUNCTION macro doesn't know the argument types of the function, so we end up with conflicts between two declarations:

asan_dll_thunk.cc(238) : error C2733: '__asan_memcpy' : second C linkage of overloaded function not allowed
      asan_interface_internal.h(156) : see declaration of '__asan_memcpy'
asan_dll_thunk.cc(238) : error C2440: 'type cast' : cannot convert from 'overloaded-function' to '__sanitizer::uptr'
      Context does not allow for disambiguation of overloaded function

This is basically the reason why I haven't just used __asan_init in the first place...
Can we move declarations/definitions between headers somehow or have a minimalistic declaration-only new header for __asan_init?

lib/asan/asan_interface_internal.h
36

Suggestion: can probably use the # macro operator here?

samsonov added a reviewer: kcc.Jul 9 2014, 4:26 PM
samsonov added inline comments.
lib/asan/asan_dll_thunk.cc
238

Yeah, let's create asan_init_version.h which would hold all the comments about ABI versions and have

#define ASAN_VERSIONED_INIT __asan_init_v4

and get rid of all __asan_init mentions throughout the code.

Kostya, are you OK with that?

timurrrr accepted this revision.Jul 10 2014, 3:44 AM
timurrrr edited edge metadata.

Done in r212699 / D4459.
[accepting merely to close this review]

This revision is now accepted and ready to land.Jul 10 2014, 3:44 AM
timurrrr closed this revision.Jul 10 2014, 3:44 AM