Add a `%darwin_min_target_with_tls_support` lit substitution.
authorDan Liew <dan@su-root.co.uk>
Tue, 18 Feb 2020 23:43:25 +0000 (15:43 -0800)
committerDan Liew <dan@su-root.co.uk>
Wed, 19 Feb 2020 23:41:36 +0000 (15:41 -0800)
commit562c6b80192243b141d1ddd15d1827c860992147
tree269885f7f6c0763fcc119e512b043452b49d2e8e
parentd1d5180e6904b3fa86f750a05a6721163e115f4d
Add a `%darwin_min_target_with_tls_support` lit substitution.

Summary:
This substitution expands to the appropriate minimum deployment target
flag where thread local storage (TLS) was first introduced on Darwin
platforms. For all other platforms the substitution expands to an empty
string.

E.g. for macOS the substitution expands to `-mmacosx-version-min=10.12`

This patch adds support for the substitution (and future substitutions)
by doing a minor refactor and then uses the substitution in the relevant
TSan tests.

rdar://problem/59568956

Reviewers: yln, kubamracek, dvyukov, vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D74802
compiler-rt/test/lit.common.cfg.py
compiler-rt/test/tsan/dtls.c
compiler-rt/test/tsan/mutexset7.cpp
compiler-rt/test/tsan/tls_race.cpp
compiler-rt/test/tsan/tls_race2.cpp