[PATCH] D29646: [X86] Add separate-stack-seg feature
Michael LeMay via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 7 08:17:43 PST 2017
mlemay-intel created this revision.
Add support for separate-stack-seg feature that restricts access to the stack to
help prevent stack corruption. The implementation of this feature may vary
depending on available HW support and other factors.
https://reviews.llvm.org/D29646
Files:
lib/Target/X86/X86.td
lib/Target/X86/X86Subtarget.cpp
lib/Target/X86/X86Subtarget.h
Index: lib/Target/X86/X86Subtarget.h
===================================================================
--- lib/Target/X86/X86Subtarget.h
+++ lib/Target/X86/X86Subtarget.h
@@ -289,6 +289,9 @@
/// Use software floating point for code generation.
bool UseSoftFloat;
+ /// Restrict access to the stack
+ bool UseSeparateStackSeg;
+
/// The minimum alignment known to hold of the stack frame on
/// entry to the function and which must be maintained by every function.
unsigned stackAlignment;
@@ -487,6 +490,7 @@
bool isAtom() const { return X86ProcFamily == IntelAtom; }
bool isSLM() const { return X86ProcFamily == IntelSLM; }
bool useSoftFloat() const { return UseSoftFloat; }
+ bool useSeparateStackSeg() const { return UseSeparateStackSeg; }
/// Use mfence if we have SSE2 or we're on x86-64 (even if we asked for
/// no-sse2). There isn't any reason to disable it if the target processor
Index: lib/Target/X86/X86Subtarget.cpp
===================================================================
--- lib/Target/X86/X86Subtarget.cpp
+++ lib/Target/X86/X86Subtarget.cpp
@@ -304,6 +304,7 @@
// FIXME: this is a known good value for Yonah. How about others?
MaxInlineSizeThreshold = 128;
UseSoftFloat = false;
+ UseSeparateStackSeg = false;
}
X86Subtarget &X86Subtarget::initializeSubtargetDependencies(StringRef CPU,
Index: lib/Target/X86/X86.td
===================================================================
--- lib/Target/X86/X86.td
+++ lib/Target/X86/X86.td
@@ -270,6 +270,9 @@
: SubtargetFeature<
"fast-lzcnt", "HasFastLZCNT", "true",
"LZCNT instructions are as fast as most simple integer ops">;
+def FeatureSeparateStackSeg
+ : SubtargetFeature<"separate-stack-seg", "UseSeparateStackSeg", "true",
+ "Restrict access to the stack">;
//===----------------------------------------------------------------------===//
// X86 processors supported.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29646.87444.patch
Type: text/x-patch
Size: 1961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170207/ecd7f5b2/attachment.bin>
More information about the llvm-commits
mailing list