I'd like to propose a change in the way we version the ASan libraries (and other sanitizers as well), and I'd like to get feedback on this proposal. We currently have the "ABI version" number embedded into the ASan initializer symbol name (__asan_init_v5), which is occasionally bumped when there is a significant ABI-breaking change. My understanding is that this number doesn't guarantee compatibility. It indicates that the ABI changed, but there might have been smaller incompatible changes when the version is unchanged. This can easily cause issues especially when using dynamic libraries (.dylib, .so), because they are (and need to be) distributed with applications and libraries, so users can easily end up using a stale version of the ASan library.
I'd like to include the LLVM release number into that symbol name so users are actually forced to use the library that was distributed with the compiler they used. We should also provide a way for vendors who make their own releases to change this version to indicate that it's a different build than the open-source one. Local (development) builds should also have a different version. This could reuse a version-string schema already used by Clang.
Secondly, I'd like to make the error message about a version mismatch clearer by changing the name of the undefined symbol to be something like __asan_version_mismatch_check_xxx (following by the version string). We obviously don't want the initializer to be named like that, so it's a separate symbol.
Attached is an incomplete (work in progress, llvm backend part missing) patch which outlines how this could be done.
Any feedback is welcome!