$OpenBSD: patch-lib_Target_X86_X86Subtarget_cpp,v 1.2 2019/01/28 06:27:28 jca Exp $

Turn on -mretpoline by default in clang on amd64.

Index: lib/Target/X86/X86Subtarget.cpp
--- lib/Target/X86/X86Subtarget.cpp.orig
+++ lib/Target/X86/X86Subtarget.cpp
@@ -238,6 +238,14 @@ void X86Subtarget::initSubtargetFeatures(StringRef CPU
       FullFS = "+sahf";
   }
 
+  // OpenBSD/amd64 defaults to -mretpoline.
+  if (isTargetOpenBSD() && In64BitMode) {
+    if (!FullFS.empty())
+      FullFS = "+retpoline," + FullFS;
+    else
+      FullFS = "+retpoline";
+  }
+
   // Parse features string and set the CPU.
   ParseSubtargetFeatures(CPUName, FullFS);
 
