https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63888
--- Comment #34 from Kostya Serebryany <kcc at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #31) > Any progress on this? > > If not, I'm considering doing: > --- libsanitizer/asan/asan_globals.cc.jj 2014-11-14 00:10:34.000000000 > +0100 > +++ libsanitizer/asan/asan_globals.cc 2015-02-20 11:43:33.179177767 +0100 > @@ -148,7 +148,9 @@ static void RegisterGlobal(const Global > CHECK(AddrIsInMem(g->beg)); > CHECK(AddrIsAlignedByGranularity(g->beg)); > CHECK(AddrIsAlignedByGranularity(g->size_with_redzone)); > - if (flags()->detect_odr_violation) { > + // This "ODR violation" detection is fundamentally incompatible with > + // how GCC registers globals. Disable as useless until rewritten > upstream. > + if (0 && flags()->detect_odr_violation) { > // Try detecting ODR (One Definition Rule) violation, i.e. the situation > // where two globals with the same name are defined in different > modules. > if (__asan_region_is_poisoned(g->beg, g->size_with_redzone)) { > for now. Sorry, this got pushed back in the queue... Sure, feel free to commit something like this. Slightly better place is at the definition of detect_odr_violation -- change the default to 0 and mark the change with some visible markers. Obviously we'll need to do a proper fix upstream before the next merge. Frankly, I am not at all motivated to do any significant surgery in the llvm compiler instrumentation because for me everything works fine. We can extend the Global struct to have a boolean (bit?) that says whether we are checking for ODRs (as you suggested above). This will be a new ABI break. Not a big deal, of course. I wonder if we can somehow else detect that the module is compiled with GCC and disable the checking in that case?