]> granicus.if.org Git - llvm/commit
[asan] Put ctor/dtor in comdat.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Sat, 25 Mar 2017 01:01:11 +0000 (01:01 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Sat, 25 Mar 2017 01:01:11 +0000 (01:01 +0000)
commit261cb614ef2a7ed64d40b52e765aceff993af0ab
tree4a2c067e283002ffee861e96e546ca60df6d101c
parent2061be0b303f54d6ee5797a2ba426b0f574b485f
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298756 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]