[llvm] r301586 - [asan] Put ctor/dtor in comdat.

Evgenii Stepanov via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 16:28:20 PDT 2017


Does not seem to help. I guess the issue is not with constructors, but
with comdats in general, and we add a ton of those in the follow-up
change.

On Thu, May 4, 2017 at 12:16 PM, Peter Collingbourne <peter at pcc.me.uk> wrote:
> (I mean the gold bug)
>
> On Thu, May 4, 2017 at 12:15 PM, Peter Collingbourne <peter at pcc.me.uk>
> wrote:
>>
>> Can we set the nounwind attribute on the constructor to work around the
>> clang bug?
>>
>> Peter
>>
>> On Thu, May 4, 2017 at 12:11 PM, Evgenii Stepanov via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>>
>>> I agree, I'll add a clang flag for this which will be disabled by
>>> default.
>>>
>>> On Thu, May 4, 2017 at 2:42 AM, Chandler Carruth <chandlerc at gmail.com>
>>> wrote:
>>> > On Thu, Apr 27, 2017 at 1:40 PM Evgeniy Stepanov via llvm-commits
>>> > <llvm-commits at lists.llvm.org> wrote:
>>> >>
>>> >> Author: eugenis
>>> >> Date: Thu Apr 27 15:27:23 2017
>>> >> New Revision: 301586
>>> >>
>>> >> URL: http://llvm.org/viewvc/llvm-project?rev=301586&view=rev
>>> >> Log:
>>> >> [asan] Put ctor/dtor in comdat.
>>> >>
>>> >> When possible, put ASan ctor/dtor in comdat.
>>> >>
>>> >> The only reason not to is global registration, which can be
>>> >> TU-specific. This is not the case when there are no instrumented
>>> >> globals. This is also limited to ELF targets, because MachO does
>>> >> not have comdat, and COFF linkers may GC comdat constructors.
>>> >>
>>> >> The benefit of this is a lot less __asan_init() calls: one per DSO
>>> >> instead of one per TU. It's also necessary for the upcoming
>>> >> gc-sections-for-globals change on Linux, where multiple references to
>>> >> section start symbols trigger quadratic behaviour in gold linker.
>>> >>
>>> >> This is a second re-land of r298756. This time with a flag to disable
>>> >> the whole thing to avoid a bug in the gold linker:
>>> >>   https://sourceware.org/bugzilla/show_bug.cgi?id=19002
>>> >
>>> >
>>> > Evgeniy, I strongly disagree with the default here.
>>> >
>>> > 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.
>>> >
>>> > 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.
>>> >
>>> > 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.
>>> >
>>> > Anyways, that's my 2 cents.
>>> > -Chandler
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>>
>>
>>
>> --
>> --
>> Peter
>
>
>
>
> --
> --
> Peter


More information about the llvm-commits mailing list