[compiler-rt] f03ccef - [compiler-rt][libunwind] Allow for CET on OpenBSD (#164341)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 25 14:11:52 PDT 2025
Author: Brad Smith
Date: 2025-10-25T17:11:47-04:00
New Revision: f03ccef45f84b4e947ffc93dc5a6f87a827fddf3
URL: https://github.com/llvm/llvm-project/commit/f03ccef45f84b4e947ffc93dc5a6f87a827fddf3
DIFF: https://github.com/llvm/llvm-project/commit/f03ccef45f84b4e947ffc93dc5a6f87a827fddf3.diff
LOG: [compiler-rt][libunwind] Allow for CET on OpenBSD (#164341)
Added:
Modified:
compiler-rt/CMakeLists.txt
compiler-rt/lib/builtins/assembly.h
libunwind/src/assembly.h
libunwind/src/shadow_stack_unwind.h
Removed:
################################################################################
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 5931b60d0975b..a9e8899f8ae0c 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -315,7 +315,7 @@ include(config-ix)
# Setup Compiler Flags
#================================
-# fcf-protection is a gcc/clang option for CET support on Linux platforms.
+# fcf-protection is a gcc/clang option for CET support on some ELF platforms.
# We need to handle MSVC CET option on Windows platforms.
if (NOT MSVC)
if (COMPILER_RT_ENABLE_CET AND NOT COMPILER_RT_HAS_FCF_PROTECTION_FLAG)
diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h
index ac119af521a37..368cbaf108d31 100644
--- a/compiler-rt/lib/builtins/assembly.h
+++ b/compiler-rt/lib/builtins/assembly.h
@@ -14,7 +14,7 @@
#ifndef COMPILERRT_ASSEMBLY_H
#define COMPILERRT_ASSEMBLY_H
-#if defined(__linux__) && defined(__CET__)
+#ifdef __CET__
#if __has_include(<cet.h>)
#include <cet.h>
#endif
diff --git a/libunwind/src/assembly.h b/libunwind/src/assembly.h
index f8e83e138eff5..f0fcd006f2073 100644
--- a/libunwind/src/assembly.h
+++ b/libunwind/src/assembly.h
@@ -15,7 +15,7 @@
#ifndef UNWIND_ASSEMBLY_H
#define UNWIND_ASSEMBLY_H
-#if defined(__linux__) && defined(__CET__)
+#if defined(__CET__)
#include <cet.h>
#define _LIBUNWIND_CET_ENDBR _CET_ENDBR
#else
diff --git a/libunwind/src/shadow_stack_unwind.h b/libunwind/src/shadow_stack_unwind.h
index 1f229d8317116..b00ca2c9327c7 100644
--- a/libunwind/src/shadow_stack_unwind.h
+++ b/libunwind/src/shadow_stack_unwind.h
@@ -12,8 +12,8 @@
#include "libunwind.h"
-// Currently, CET is implemented on Linux x86 platforms.
-#if defined(_LIBUNWIND_TARGET_LINUX) && defined(__CET__) && defined(__SHSTK__)
+// Currently, CET is implemented on some ELF x86 platforms.
+#if defined(__CET__) && defined(__SHSTK__)
#define _LIBUNWIND_USE_CET 1
#endif
More information about the llvm-commits
mailing list