| Index: lib/Target/TargetMachine.cpp
|
| diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp
|
| index 309e1bf2786db8796bbbf360f30d8683a9aad9b1..cda41aa27e5c9bea9c19a98aabcacb72165b0598 100644
|
| --- a/lib/Target/TargetMachine.cpp
|
| +++ b/lib/Target/TargetMachine.cpp
|
| @@ -30,6 +30,26 @@
|
| using namespace llvm;
|
|
|
| //---------------------------------------------------------------------------
|
| +
|
| +// @LOCALMOD-BEGIN
|
| +namespace llvm {
|
| + bool TLSUseCall;
|
| +}
|
| +
|
| +// 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
|
| //
|
|
|
| @@ -112,7 +132,8 @@ TLSModel::Model TargetMachine::getTLSModel(const GlobalValue *GV) const {
|
| bool isHidden = GV->hasHiddenVisibility();
|
|
|
| TLSModel::Model Model;
|
| - if (isPIC && !isPIE) {
|
| + if (isPIC && !isPIE &&
|
| + !ForceTLSNonPIC) { // @LOCALMOD
|
| if (isLocal || isHidden)
|
| Model = TLSModel::LocalDynamic;
|
| else
|
|
|