summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/TargetMachine.cpp2
-rw-r--r--llvm/lib/Target/X86/X86Subtarget.cpp3
-rw-r--r--llvm/lib/Target/X86/X86Subtarget.h2
3 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index b39b58d7e02..3a45b3343ca 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -109,7 +109,7 @@ TLSModel::Model TargetMachine::getTLSModel(const GlobalValue *GV) const {
bool isLocal = GV->hasLocalLinkage();
bool isDeclaration = GV->isDeclaration();
bool isPIC = getRelocationModel() == Reloc::PIC_;
- bool isPIE = Options.PositionIndependentExecutable;
+ bool isPIE = GV->getParent()->getPIELevel() != PIELevel::Default;
// FIXME: what should we do for protected and internal visibility?
// For variables, is internal different from hidden?
bool isHidden = GV->hasHiddenVisibility();
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index d02a99f081a..ad7c2578aa9 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -159,8 +159,7 @@ unsigned char X86Subtarget::classifyGlobalFunctionReference(
// we don't need to use the PLT - we can directly call it.
// In PIE mode, calls to global functions don't need to go through PLT
if (isTargetELF() && TM.getRelocationModel() == Reloc::PIC_ &&
- (!TM.Options.PositionIndependentExecutable ||
- GV->isDeclarationForLinker()) &&
+ !isGlobalDefinedInPIE(GV, TM) &&
GV->hasDefaultVisibility() && !GV->hasLocalLinkage()) {
return X86II::MO_PLT;
} else if (isPICStyleStubAny() && !GV->isStrongDefinitionForLinker() &&
diff --git a/llvm/lib/Target/X86/X86Subtarget.h b/llvm/lib/Target/X86/X86Subtarget.h
index 170e5c383ae..6ffbde2720a 100644
--- a/llvm/lib/Target/X86/X86Subtarget.h
+++ b/llvm/lib/Target/X86/X86Subtarget.h
@@ -552,7 +552,7 @@ public:
/// Executable (PIE) where its definition cannot be interposed.
bool isGlobalDefinedInPIE(const GlobalValue *GV,
const TargetMachine &TM) const {
- return TM.Options.PositionIndependentExecutable &&
+ return GV->getParent()->getPIELevel() != PIELevel::Default &&
!GV->isDeclarationForLinker();
}
OpenPOWER on IntegriCloud