[PATCH] D99952: [X86] Initialize TargetOptions::StackProtectorGuardOffset member to its default value

LemonBoy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 06:31:27 PDT 2021


LemonBoy created this revision.
LemonBoy added reviewers: nickdesaulniers, craig.topper, xiangzhangllvm.
Herald added a subscriber: pengfei.
LemonBoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

D88631 <https://reviews.llvm.org/D88631> introduced a set of knobs to tweak how the stack protector is codegen'd for x86 targets, including the offset from the base register where the stack cookie is located. The `StackProtectorGuardOffset` field in `TargetOptions` was left uninitialized instead of being reset to its neutral value -1, making it possible to emit nonsensical code if the frontend doesn't change the field value at all before feeding the `TargetOptions` to the target machine initializer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99952

Files:
  llvm/include/llvm/Target/TargetOptions.h


Index: llvm/include/llvm/Target/TargetOptions.h
===================================================================
--- llvm/include/llvm/Target/TargetOptions.h
+++ llvm/include/llvm/Target/TargetOptions.h
@@ -331,7 +331,7 @@
     unsigned XRayOmitFunctionIndex : 1;
 
     /// Stack protector guard offset to use.
-    unsigned StackProtectorGuardOffset : 32;
+    unsigned StackProtectorGuardOffset = (unsigned)-1;
 
     /// Stack protector guard mode to use, e.g. tls, global.
     StackProtectorGuards StackProtectorGuard =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99952.335496.patch
Type: text/x-patch
Size: 529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210406/35eb03c3/attachment.bin>


More information about the llvm-commits mailing list