Skip to content

Commit b689be8

Browse files
committed
[android] Use emulated thread-local storage for API 28 and earlier
Android before API 29 and a few other platforms don't support native TLS, so fall back to LLVM's emulated TLS there, just like clang does.
1 parent c690fef commit b689be8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/IRGen/IRGen.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ swift::getIRTargetOptions(const IRGenOptions &Opts, ASTContext &Ctx) {
148148
if (Clang->getTargetInfo().getTriple().isOSBinFormatWasm())
149149
TargetOpts.ThreadModel = llvm::ThreadModel::Single;
150150

151+
if (Clang->getTargetInfo().getTriple().hasDefaultEmulatedTLS())
152+
TargetOpts.EmulatedTLS = true;
153+
151154
if (Opts.EnableGlobalISel) {
152155
TargetOpts.EnableGlobalISel = true;
153156
TargetOpts.GlobalISelAbort = GlobalISelAbortMode::DisableWithDiag;

0 commit comments

Comments
 (0)