diff options
author | Marcos Pividori <mpividori@google.com> | 2017-02-02 23:01:41 +0000 |
---|---|---|
committer | Marcos Pividori <mpividori@google.com> | 2017-02-02 23:01:41 +0000 |
commit | b88e87d4b2f43a520b71675fc06554040758e636 (patch) | |
tree | dc8593b0cd67f7e4307a94a54ef47562f0a924ee /llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | |
parent | f5d265460d9969661ad30e4222a928ecdf3b9868 (diff) | |
download | llvm-b88e87d4b2f43a520b71675fc06554040758e636.zip llvm-b88e87d4b2f43a520b71675fc06554040758e636.tar.gz llvm-b88e87d4b2f43a520b71675fc06554040758e636.tar.bz2 |
[sanitizer] Add dynamic_runtime_thunk for different sanitizers.
In Windows, when the sanitizer is implemented as a shared library (DLL), we need
an auxiliary static library dynamic_runtime_thunk that will be linked to the
main executable and dlls.
In the sanitizer DLL, we are exposing weak functions with WIN_WEAK_EXPORT_DEF(),
which exports the default implementation with __dll suffix. For example: for
sanitizer coverage, the default implementation of __sanitizer_cov_trace_cmp is
exported as: __sanitizer_cov_trace_cmp__dll.
In the dynamic_runtime_thunk static library, we include weak aliases to the
imported implementation from the dll, using the macro WIN_WEAK_IMPORT_DEF().
By default, all users's programs that include calls to weak functions like
__sanitizer_cov_trace_cmp, will be redirected to the implementation in the dll,
when linking to dynamic_runtime_thunk.
After this diff, we are able to compile code with sanitizer coverage
instrumentation on Windows. When the instrumented object files are linked with
clang-rt_asan_dynamic_runtime_thunk-arch.lib all the weak symbols will be
resolved to the implementation imported from asan dll.
All the files sanitizer_dynamic_runtime_thunk.cc are independent, so we do not
need to include a specific list of sanitizers.
Now, we compile: [asan|ubsan|sanitizer_coverage]_win_dynamic_runtime_thunk.cc
and sanitizer_win_dynamic_runtime_thunk.cc to generate
asan_dynamic_runtime_thunk.lib, because we include asan, ubsan and sanitizer
coverage in the address sanitizer library.
Differential Revision: https://reviews.llvm.org/D29158
llvm-svn: 293953
Diffstat (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp')
0 files changed, 0 insertions, 0 deletions