[PATCH] D102287: [MC][X86] Add TrapFillValue definition

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 17:38:05 PDT 2021


Amir created this revision.
Amir added reviewers: lhames, grosbach.
Herald added subscribers: pengfei, hiraditya.
Amir published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Adds the parametrized TrapFillValue that is used to fill the executable
space with instructions that trap. Used by BOLT to overwrite functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102287

Files:
  llvm/include/llvm/MC/MCAsmInfo.h
  llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp


Index: llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
===================================================================
--- llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
+++ llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
@@ -45,6 +45,8 @@
 
   TextAlignFillValue = 0x90;
 
+  TrapFillValue = 0xCC;
+
   if (!is64Bit)
     Data64bitsDirective = nullptr;       // we can't emit a 64-bit unit
 
@@ -95,6 +97,8 @@
 
   TextAlignFillValue = 0x90;
 
+  TrapFillValue = 0xCC;
+
   // Debug Information
   SupportsDebugInformation = true;
 
@@ -134,6 +138,8 @@
 
   TextAlignFillValue = 0x90;
 
+  TrapFillValue = 0xCC;
+
   AllowAtInName = true;
 }
 
@@ -167,5 +173,7 @@
 
   TextAlignFillValue = 0x90;
 
+  TrapFillValue = 0xCC;
+
   AllowAtInName = true;
 }
Index: llvm/include/llvm/MC/MCAsmInfo.h
===================================================================
--- llvm/include/llvm/MC/MCAsmInfo.h
+++ llvm/include/llvm/MC/MCAsmInfo.h
@@ -316,6 +316,10 @@
   /// result of a alignment directive.  Defaults to 0
   unsigned TextAlignFillValue = 0;
 
+  /// If non-zero, this is used to fill the executable space with instructions
+  /// that will trap. Defaults to 0
+  unsigned TrapFillValue = 0;
+
   //===--- Global Variable Emission Directives --------------------------===//
 
   /// This is the directive used to declare a global entity. Defaults to
@@ -669,6 +673,7 @@
   }
   bool getAlignmentIsInBytes() const { return AlignmentIsInBytes; }
   unsigned getTextAlignFillValue() const { return TextAlignFillValue; }
+  unsigned getTrapFillValue() const { return TrapFillValue; }
   const char *getGlobalDirective() const { return GlobalDirective; }
 
   bool doesSetDirectiveSuppressReloc() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102287.344594.patch
Type: text/x-patch
Size: 1717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210512/e45f1051/attachment.bin>


More information about the llvm-commits mailing list