[llvm] 03f7b13 - [X86] Initialize TargetOptions::StackProtectorGuardOffset member to its default value

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 00:04:35 PDT 2021


Author: LemonBoy
Date: 2021-04-07T09:04:25+02:00
New Revision: 03f7b13d4452e3ee7749ed0cd354071eced25502

URL: https://github.com/llvm/llvm-project/commit/03f7b13d4452e3ee7749ed0cd354071eced25502
DIFF: https://github.com/llvm/llvm-project/commit/03f7b13d4452e3ee7749ed0cd354071eced25502.diff

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

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.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D99952

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index ae858fc2d7a79..651dbe163a811 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -332,7 +332,7 @@ namespace llvm {
     unsigned XRayOmitFunctionIndex : 1;
 
     /// Stack protector guard offset to use.
-    unsigned StackProtectorGuardOffset : 32;
+    unsigned StackProtectorGuardOffset = -1U;
 
     /// Stack protector guard mode to use, e.g. tls, global.
     StackProtectorGuards StackProtectorGuard =


        


More information about the llvm-commits mailing list