diff --git a/common.h b/common.h index 862e0b4db..ac795937c 100644 --- a/common.h +++ b/common.h @@ -416,6 +416,15 @@ please https://github.com/xianyi/OpenBLAS/issues/246 #include "common_alpha.h" #endif +#if (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(__CET__) && defined(__has_include) +#if __has_include() +#include +#endif +#endif +#ifndef _CET_ENDBR +#define _CET_ENDBR +#endif + #ifdef ARCH_X86 #include "common_x86.h" #endif diff --git a/common_x86.h b/common_x86.h index ec928e236..bc77eca58 100644 --- a/common_x86.h +++ b/common_x86.h @@ -340,7 +340,8 @@ REALNAME: .align 16; \ .globl REALNAME ;\ .type REALNAME, @function; \ -REALNAME: +REALNAME: \ + _CET_ENDBR #ifdef PROFILE #define PROFCODE call mcount diff --git a/common_x86_64.h b/common_x86_64.h index b813336c6..729a055ce 100644 --- a/common_x86_64.h +++ b/common_x86_64.h @@ -451,7 +451,8 @@ REALNAME: .align 512; \ .globl REALNAME ;\ .type REALNAME, @function; \ -REALNAME: +REALNAME: \ + _CET_ENDBR #ifdef PROFILE #define PROFCODE call *mcount@GOTPCREL(%rip)