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 | a32348530f4dd2afaa695233e77d129b2d79451b (patch) | |
tree | c18ea792e0d3207f8732da761c2fa9cea10fc801 /lib/CodeGen/StackProtector.cpp | |
parent | 09da6b55409ec4fbf69fedff8f74552bbad69469 (diff) | |
download | llvm-a32348530f4dd2afaa695233e77d129b2d79451b.tar.gz llvm-a32348530f4dd2afaa695233e77d129b2d79451b.tar.bz2 llvm-a32348530f4dd2afaa695233e77d129b2d79451b.tar.xz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206486 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StackProtector.cpp')
-rw-r--r-- | lib/CodeGen/StackProtector.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp index a63ba8c406..1ffd910604 100644 --- a/lib/CodeGen/StackProtector.cpp +++ b/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(); } |