]> granicus.if.org Git - llvm/commit
[asan] Put ctor/dtor in comdat.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 6 Apr 2017 19:55:13 +0000 (19:55 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 6 Apr 2017 19:55:13 +0000 (19:55 +0000)
commit9d134816b420f2d44f586180a0d065bec5d6b50f
tree7072d726fbc667e1bcb167946ba15016123443a3
parentfcc345974fe4e03b1f4dd6660a7fb2820709323f
[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 rebase of r298756.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299696 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/AddressSanitizer.cpp
test/Instrumentation/AddressSanitizer/instrument_global.ll
test/Instrumentation/AddressSanitizer/no-globals.ll [new file with mode: 0644]