<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Apr 27, 2017 at 1:40 PM Evgeniy Stepanov via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: eugenis<br>
Date: Thu Apr 27 15:27:23 2017<br>
New Revision: 301586<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=301586&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=301586&view=rev</a><br>
Log:<br>
[asan] Put ctor/dtor in comdat.<br>
<br>
When possible, put ASan ctor/dtor in comdat.<br>
<br>
The only reason not to is global registration, which can be<br>
TU-specific. This is not the case when there are no instrumented<br>
globals. This is also limited to ELF targets, because MachO does<br>
not have comdat, and COFF linkers may GC comdat constructors.<br>
<br>
The benefit of this is a lot less __asan_init() calls: one per DSO<br>
instead of one per TU. It's also necessary for the upcoming<br>
gc-sections-for-globals change on Linux, where multiple references to<br>
section start symbols trigger quadratic behaviour in gold linker.<br>
<br>
This is a second re-land of r298756. This time with a flag to disable<br>
the whole thing to avoid a bug in the gold linker:<br>
  <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=19002" rel="noreferrer" target="_blank">https://sourceware.org/bugzilla/show_bug.cgi?id=19002</a></blockquote><div><br></div><div>Evgeniy, I strongly disagree with the default here.</div><div><br></div><div>This bug in gold is likely to be encountered by anyone using a Linux distro with binutils before v2.27 and using gold. Given how slow the BFD linker is compared to gold, that's likely a *lot* of users of LLVM *if* their version of binutils in that old.</div><div><br></div><div>Unfortunately, both LTS versions of Ubuntu (and every version including Xenial and older) have too old of a version of gold. Debian stable has too old of a version. Fedora 25 and older, OpenSuSE 42 and earlier, all have too old of versions of gold.</div><div><br></div><div>I think that this feature needs to be defaulted off. If you want to detect LLD (which is likely to be installed *with* LLVM at least) or detect versions to enable this, great. But I think defaulting this on is really the wrong thing for our users. We're essentially leaving a usability landmine in ASan, with no advertisement, and just letting users figure out why and how to update their linker. That doesn't seem right.</div><div><br></div><div>Anyways, that's my 2 cents.</div><div>-Chandler</div></div></div>