Make -mbranch-protection=bti the default on OpenBSD.
authorkettenis <kettenis@openbsd.org>
Mon, 17 Apr 2023 18:10:26 +0000 (18:10 +0000)
committerkettenis <kettenis@openbsd.org>
Mon, 17 Apr 2023 18:10:26 +0000 (18:10 +0000)
ok deraadt@

gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp

index c2519ca..67d4c1d 100644 (file)
@@ -1818,6 +1818,9 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
         Args.MakeArgString(Twine("-msign-return-address-key=") + Key));
     if (IndirectBranches)
       CmdArgs.push_back("-mbranch-target-enforce");
+  } else {
+    if (Triple.isOSOpenBSD())
+      CmdArgs.push_back("-mbranch-target-enforce");
   }
 
   // Handle -msve_vector_bits=<bits>