[NewPM][TSan] Reiterate the TSan port
authorPhilip Pfaffe <philip.pfaffe@gmail.com>
Wed, 16 Jan 2019 09:28:01 +0000 (09:28 +0000)
committerPhilip Pfaffe <philip.pfaffe@gmail.com>
Wed, 16 Jan 2019 09:28:01 +0000 (09:28 +0000)
commit685c76d7a3d868059020a4e21b99a34b143fc9b5
treec2785e27cc6ce4b4bfc34c17e115c3746f1cadb2
parenta3a25afe38b3b58ef479e384ac3f0622c3d93187
[NewPM][TSan] Reiterate the TSan port

Summary:
Second iteration of D56433 which got reverted in rL350719. The problem
in the previous version was that we dropped the thunk calling the tsan init
function. The new version keeps the thunk which should appease dyld, but is not
actually OK wrt. the current semantics of function passes. Hence, add a
helper to insert the functions only on the first time. The helper
allows hooking into the insertion to be able to append them to the
global ctors list.

Reviewers: chandlerc, vitalybuka, fedor.sergeev, leonardchan

Subscribers: hiraditya, bollu, llvm-commits

Differential Revision: https://reviews.llvm.org/D56538

llvm-svn: 351314
12 files changed:
clang/lib/CodeGen/BackendUtil.cpp
llvm/bindings/go/llvm/InstrumentationBindings.cpp
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Transforms/Instrumentation.h
llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h [new file with mode: 0644]
llvm/include/llvm/Transforms/Utils/ModuleUtils.h
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
llvm/lib/Transforms/Utils/ModuleUtils.cpp
llvm/test/Instrumentation/ThreadSanitizer/tsan_basic.ll