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.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp
index b9b2526876..e785d330ae 100644
--- a/lib/Target/TargetMachine.cpp
+++ b/lib/Target/TargetMachine.cpp
@@ -25,6 +25,7 @@ using namespace llvm;
namespace llvm {
bool HasDivModLibcall;
bool AsmVerbosityDefault(false);
+ bool TLSUseCall; // @LOCALMOD
}
static cl::opt<bool>
@@ -35,6 +36,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
@@ -83,6 +98,7 @@ TLSModel::Model TargetMachine::getTLSModel(const GlobalValue *GV) const {
bool isHidden = GV->hasHiddenVisibility();
if (getRelocationModel() == Reloc::PIC_ &&
+ !ForceTLSNonPIC && // @LOCALMOD
!Options.PositionIndependentExecutable) {
if (isLocal || isHidden)
return TLSModel::LocalDynamic;