mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
Initial checkin for stack protectors. Here's what it does:
* The prologue is modified to read the __stack_chk_guard global and insert it onto the stack. * The epilogue is modified to read the stored guard from the stack and compare it to the original __stack_chk_guard value. If they differ, then the __stack_chk_fail() function is called. * The stack protector needs to be first on the stack (after the parameters) to catch any stack-smashing activities. Front-end support will follow after a round of beta testing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58673 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -60,6 +60,11 @@ static cl::opt<cl::boolOrDefault>
|
||||
EnableFastISelOption("fast-isel", cl::Hidden,
|
||||
cl::desc("Enable the experimental \"fast\" instruction selector"));
|
||||
|
||||
// Enable stack protectors.
|
||||
static cl::opt<int>
|
||||
EnableStackProtector("enable-stack-protector", cl::init(0),
|
||||
cl::desc("Use ProPolice as a stack protection method."));
|
||||
|
||||
FileModel::Model
|
||||
LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
raw_ostream &Out,
|
||||
@@ -165,6 +170,8 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, bool Fast) {
|
||||
if (!Fast)
|
||||
PM.add(createCodeGenPreparePass(getTargetLowering()));
|
||||
|
||||
PM.add(createStackProtectorPass(EnableStackProtector));
|
||||
|
||||
if (PrintISelInput)
|
||||
PM.add(createPrintFunctionPass("\n\n"
|
||||
"*** Final LLVM Code input to ISel ***\n",
|
||||
|
||||
Reference in New Issue
Block a user