mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-01 01:26:56 +00:00
[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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user