aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/TargetMachine.cpp')
-rw-r--r--lib/Target/TargetMachine.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp
index 382571982b..ffc1d9f0d1 100644
--- a/lib/Target/TargetMachine.cpp
+++ b/lib/Target/TargetMachine.cpp
@@ -27,6 +27,7 @@ using namespace llvm;
namespace llvm {
bool HasDivModLibcall;
bool AsmVerbosityDefault(false);
+ bool TLSUseCall; // @LOCALMOD
}
static cl::opt<bool>
@@ -37,6 +38,20 @@ static cl::opt<bool>
FunctionSections("ffunction-sections",
cl::desc("Emit functions into separate sections"),
cl::init(false));
+// @LOCALMOD-BEGIN
+// Use a function call to get the thread pointer for TLS accesses,
+// instead of using inline code.
+static cl::opt<bool, true>
+EnableTLSUseCall("mtls-use-call",
+ cl::desc("Use a function call to get the thread pointer for TLS accesses."),
+ cl::location(TLSUseCall),
+ cl::init(false));
+
+static cl::opt<bool>
+ ForceTLSNonPIC("force-tls-non-pic",
+ cl::desc("Force TLS to use non-PIC models"),
+ cl::init(false));
+// @LOCALMOD-END
//---------------------------------------------------------------------------
// TargetMachine Class
@@ -111,7 +126,8 @@ TLSModel::Model TargetMachine::getTLSModel(const GlobalValue *GV) const {
bool isHidden = Var->hasHiddenVisibility();
TLSModel::Model Model;
- if (isPIC && !isPIE) {
+ if (isPIC && !isPIE &&
+ !ForceTLSNonPIC) { // @LOCALMOD
if (isLocal || isHidden)
Model = TLSModel::LocalDynamic;
else