diff options
author | Josh Magee <joshua_magee@playstation.sony.com> | 2014-04-17 19:08:36 +0000 |
---|---|---|
committer | Josh Magee <joshua_magee@playstation.sony.com> | 2014-04-17 19:08:36 +0000 |
commit | adfde5fef6f667870c510d05bf6b09839ba02e4b (patch) | |
tree | 380160a0a99108afd623fdc4bb55368f56173537 /llvm/lib/CodeGen/StackProtector.cpp | |
parent | 037f26f2123e10f8b5c01cf5eb2cceaa254ad9b7 (diff) | |
download | bcm5719-llvm-adfde5fef6f667870c510d05bf6b09839ba02e4b.tar.gz bcm5719-llvm-adfde5fef6f667870c510d05bf6b09839ba02e4b.zip |
[stack protector] Make the StackProtector pass respect ssp-buffer-size.
Previously, SSPBufferSize was assigned the value of the "stack-protector-buffer-size"
attribute after all uses of SSPBufferSize. The effect was that the default
SSPBufferSize was always used during analysis. I moved the check for the
attribute before the analysis; now --param ssp-buffer-size= works correctly again.
Differential Revision: http://reviews.llvm.org/D3349
llvm-svn: 206486
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackProtector.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index a63ba8c4067..1ffd910604f 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -86,15 +86,15 @@ bool StackProtector::runOnFunction(Function &Fn) { DT = DTWP ? &DTWP->getDomTree() : nullptr; TLI = TM->getTargetLowering(); - if (!RequiresStackProtector()) - return false; - Attribute Attr = Fn.getAttributes().getAttribute( AttributeSet::FunctionIndex, "stack-protector-buffer-size"); if (Attr.isStringAttribute() && Attr.getValueAsString().getAsInteger(10, SSPBufferSize)) return false; // Invalid integer string + if (!RequiresStackProtector()) + return false; + ++NumFunProtected; return InsertStackProtectors(); } |