[UBSan] Call UBSan initialization as early as possible.
authorAlexey Samsonov <vonosmas@gmail.com>
Fri, 25 Jul 2014 22:24:34 +0000 (22:24 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Fri, 25 Jul 2014 22:24:34 +0000 (22:24 +0000)
commit6eb53d6460183b51a2cde13b30031572af65d3fe
treee324c3a92b6405f0d49bd9bcf6bcd0d1809a0c3f
parentac4b69e40bfebe502c8bee936539b352b0c14fa2
[UBSan] Call UBSan initialization as early as possible.

Specifically, use .preinit_array initialization on Linux and dynamic global
initializer on another platforms. Historically UBSan didn't have any
initialization code and its runtime was stateless. This is no longer the
case - UBSan relies on some non-trivial functionality from sanitizer_common
(e.g. online symbolization) and is now configurable by runtime flags.
Additionally, we've dropped support for enabling UBSan only for a few shared
objects, so UBSan is now always linked into the main executable, so now
we can use similar initialization as all the rest sanitizers.

llvm-svn: 213983
compiler-rt/lib/ubsan/CMakeLists.txt
compiler-rt/lib/ubsan/ubsan_diag.cc
compiler-rt/lib/ubsan/ubsan_init.cc [new file with mode: 0644]
compiler-rt/lib/ubsan/ubsan_init.h [new file with mode: 0644]