[ExecutionEngine] After a heroic dev-meeting hack session, the JIT supports TLS.

Turns on EmulatedTLS support by default in EngineBuilder. ;)

llvm-svn: 316200
This commit is contained in:
Lang Hames 2017-10-20 00:53:16 +00:00
parent b200492512
commit 1d2150fbc9
4 changed files with 27 additions and 1 deletions

View File

@ -541,6 +541,7 @@ private:
SmallVector<std::string, 4> MAttrs;
bool VerifyModules;
bool UseOrcMCJITReplacement;
bool EmulatedTLS = true;
public:
/// Default constructor for EngineBuilder.
@ -641,6 +642,10 @@ public:
this->UseOrcMCJITReplacement = UseOrcMCJITReplacement;
}
void setEmulatedTLS(bool EmulatedTLS) {
this->EmulatedTLS = EmulatedTLS;
}
TargetMachine *selectTarget();
/// selectTarget - Pick a target either via -march or by guessing the native

View File

@ -95,7 +95,8 @@ TargetMachine *EngineBuilder::selectTarget(const Triple &TargetTriple,
TargetMachine *Target =
TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr,
Options, RelocModel, CMModel, OptLevel,
/*JIT*/ true);
/*JIT*/ true);
Target->Options.EmulatedTLS = EmulatedTLS;
assert(Target && "Could not allocate target machine!");
return Target;
}

View File

@ -0,0 +1,10 @@
; RUN: %lli %s > /dev/null
@x = thread_local local_unnamed_addr global i32 0
define i32 @main() {
entry:
store i32 42, i32* @x
ret i32 0
}

View File

@ -0,0 +1,10 @@
; RUN: %lli %s > /dev/null
@x = thread_local local_unnamed_addr global i32 0
define i32 @main() {
entry:
store i32 42, i32* @x
ret i32 0
}