diff options
author | Bill Wendling <isanbard@gmail.com> | 2008-11-06 22:18:44 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2008-11-06 22:18:44 +0000 |
commit | d939a7b305fb03c827d84084da5a612dcec2325a (patch) | |
tree | 1111115052d2c3f52f1b053f700621e7bada00c1 /llvm/lib/CodeGen/StackProtector.cpp | |
parent | 49d665218c06e24bbb7e082f4bcf55d06e231408 (diff) | |
download | bcm5719-llvm-d939a7b305fb03c827d84084da5a612dcec2325a.tar.gz bcm5719-llvm-d939a7b305fb03c827d84084da5a612dcec2325a.zip |
The size limit is for individual arrays. So if any array has more than 8 bytes
in it, then emit stack protectors.
llvm-svn: 58819
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackProtector.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index 318be93b40d..b1f18edd4c6 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -192,9 +192,6 @@ bool StackProtector::RequiresStackProtector() const { default: return false; case SSP::ALL: return true; case SSP::SOME: { - // If the size of the local variables allocated on the stack is greater than - // SSPBufferSize, then we require a stack protector. - uint64_t StackSize = 0; const TargetData *TD = TLI->getTargetData(); for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) { @@ -208,9 +205,10 @@ bool StackProtector::RequiresStackProtector() const { if (ConstantInt *CI = dyn_cast<ConstantInt>(AI->getArraySize())) { const Type *Ty = AI->getAllocatedType(); uint64_t TySize = TD->getABITypeSize(Ty); - StackSize += TySize * CI->getZExtValue(); // Total allocated size. - if (SSPBufferSize <= StackSize) + // If an array has more than 8 bytes of allocated space, then we + // emit stack protectors. + if (SSPBufferSize <= TySize * CI->getZExtValue()) return true; } else { // This is a call to alloca with a variable size. Default to adding |