$OpenBSD: patch-include_llvm_CodeGen_AsmPrinter_h,v 1.4 2021/05/18 03:35:07 rsadowski Exp $

Use int3 trap padding between functions instead of trapsleds with a leading jump.

Index: include/llvm/CodeGen/AsmPrinter.h
--- include/llvm/CodeGen/AsmPrinter.h.orig
+++ include/llvm/CodeGen/AsmPrinter.h
@@ -375,6 +375,11 @@ class AsmPrinter : public MachineFunctionPass { (publi
   /// correctness.
   void emitAlignment(Align Alignment, const GlobalObject *GV = nullptr) const;
 
+  /// Emit an alignment directive to the specified power of two boundary,
+  /// like emitAlignment, but call emitTrapToAlignment to fill with
+  /// trap instructions instead of NOPs.
+  void emitTrapAlignment(Align Alignment, const GlobalObject *GO = nullptr) const;
+
   /// Lower the specified LLVM Constant to an MCExpr.
   virtual const MCExpr *lowerConstant(const Constant *CV);
 
@@ -435,6 +440,11 @@ class AsmPrinter : public MachineFunctionPass { (publi
   virtual void emitInstruction(const MachineInstr *) {
     llvm_unreachable("EmitInstruction not implemented");
   }
+
+  /// Emit an alignment directive to the specified power
+  /// of two boundary, but use Trap instructions for alignment
+  /// sections that should never be executed.
+  virtual void emitTrapToAlignment(Align Alignment) const;
 
   /// Return the symbol for the specified constant pool entry.
   virtual MCSymbol *GetCPISymbol(unsigned CPID) const;
