From 990129f49dcc7205208dec5e29b252be8659896d Mon Sep 17 00:00:00 2001 From: kettenis Date: Mon, 17 Apr 2023 18:10:26 +0000 Subject: [PATCH] Make -mbranch-protection=bti the default on OpenBSD. ok deraadt@ --- gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp b/gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp index c2519ca57a3..67d4c1daa78 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp +++ b/gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp @@ -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= -- 2.20.1