aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringBase.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2020-12-06 22:28:33 +0200
committerMartin Storsjö <martin@martin.st>2020-12-07 09:35:12 +0200
commit78a57069b53a08d5aef98a8472fcfa73dbbc8771 (patch)
treeaf79fc77ca692849c950832a0080a03e2be30d69 /llvm/lib/CodeGen/TargetLoweringBase.cpp
parent62ec4ac90738a5f2d209ed28c822223e58aaaeb7 (diff)
downloadllvm-78a57069b53a08d5aef98a8472fcfa73dbbc8771.zip
llvm-78a57069b53a08d5aef98a8472fcfa73dbbc8771.tar.gz
llvm-78a57069b53a08d5aef98a8472fcfa73dbbc8771.tar.bz2
[CodeGen] Restore accessing __stack_chk_guard via a .refptr stub on mingw after 2518433f861fcb87
Add tests for this particular detail for x86 and arm (similar tests already existed for x86_64 and aarch64). The libssp implementation may be located in a separate DLL, and in those cases, the references need to be in a .refptr stub, to avoid needing to touch up code in the text section at runtime (which is supported but inefficient for x86, and unsupported for arm). Differential Revision: https://reviews.llvm.org/D92738
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringBase.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 61a2de7..7dfd76c 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1973,7 +1973,8 @@ void TargetLoweringBase::insertSSPDeclarations(Module &M) const {
auto *GV = new GlobalVariable(M, Type::getInt8PtrTy(M.getContext()), false,
GlobalVariable::ExternalLinkage, nullptr,
"__stack_chk_guard");
- if (getTargetMachine().getRelocationModel() == Reloc::Static)
+ if (TM.getRelocationModel() == Reloc::Static &&
+ !TM.getTargetTriple().isWindowsGNUEnvironment())
GV->setDSOLocal(true);
}
}