Differential Revision: http://reviews.llvm.org/D19733
llvm-svn: 268106
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index b39b58d..3a45b33 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -109,7 +109,7 @@
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();