[PATCH] D64757: [PEI] Don't re-allocate a pre-allocated stack protector slot

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 10:11:17 PDT 2019


thegameg created this revision.
thegameg added reviewers: john.brawn, aadg.
Herald added subscribers: hiraditya, javed.absar.
Herald added a project: LLVM.

The LocalStackSlotPass pre-allocates a stack protector and makes sure that it comes before the local variables on the stack.

We need to make sure that later during PEI we don't re-allocate a new stack protector slot. If that happens, the new stack protector slot will end up being **after** the local variables that it should be protecting.

Therefore, we would have two slots assigned for two different stack protectors, one at the top of the stack, and one at the bottom. Since PEI will overwrite the assigned slot for the stack protector, the load that is used to compare the value of the stack protector will use the slot assigned by PEI, which is wrong.

For this, we need to check if the object is pre-allocated, and re-use that pre-allocated slot.


https://reviews.llvm.org/D64757

Files:
  llvm/lib/CodeGen/LocalStackSlotAllocation.cpp
  llvm/lib/CodeGen/PrologEpilogInserter.cpp
  test/CodeGen/AArch64/stack-guard-reassign.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64757.209896.patch
Type: text/x-patch
Size: 5143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190715/8ccf6825/attachment.bin>


More information about the llvm-commits mailing list