From: deraadt Date: Wed, 26 Apr 2023 22:12:44 +0000 (+0000) Subject: On openbsd amd64, the compiler has been found to generate some nasty jump X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=80e1ae21f686dea92992e6a0e268d948aa1b27b0;p=openbsd On openbsd amd64, the compiler has been found to generate some nasty jump table variations (calculate address into %rax, jmp %rax) which is not compatible with IBT endbr64. The specific generated code sequence was found inside clang, which made the debugging experience pretty miserable. So we will have to disable jump tables by default. ok kettenis --- diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp b/gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp index 3c80a6e88e8..524c0098bf8 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp +++ b/gnu/llvm/clang/lib/Driver/ToolChains/Clang.cpp @@ -6017,6 +6017,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } else if (Triple.isOSOpenBSD() && Triple.getArch() == llvm::Triple::x86_64) { // Emit IBT endbr64 instructions by default CmdArgs.push_back("-fcf-protection=branch"); + // jump-table can generate indirect jumps, which are not permitted + CmdArgs.push_back("-fno-jump-tables"); } // Forward -f options with positive and negative forms; we translate these by