Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
x86: Enable Intel CET
When Intel CET is enabled, we need to include <cet.h> in assembly codes
to mark Intel CET support and place _CET_ENDBR at the function entry.
  • Loading branch information
hjl-tools committed May 1, 2021
1 parent dc6b04c commit 53ee0b7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions common.h
Expand Up @@ -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(<cet.h>)
#include <cet.h>
#endif
#endif
#ifndef _CET_ENDBR
#define _CET_ENDBR
#endif

#ifdef ARCH_X86
#include "common_x86.h"
#endif
Expand Down
3 changes: 2 additions & 1 deletion common_x86.h
Expand Up @@ -340,7 +340,8 @@ static __inline int blas_quickdivide(unsigned int x, unsigned int y){
.align 16; \
.globl REALNAME ;\
.type REALNAME, @function; \
REALNAME:
REALNAME: \
_CET_ENDBR

#ifdef PROFILE
#define PROFCODE call mcount
Expand Down
3 changes: 2 additions & 1 deletion common_x86_64.h
Expand Up @@ -451,7 +451,8 @@ static __inline unsigned int blas_quickdivide(unsigned int x, unsigned int y){
.align 512; \
.globl REALNAME ;\
.type REALNAME, @function; \
REALNAME:
REALNAME: \
_CET_ENDBR

#ifdef PROFILE
#define PROFCODE call *mcount@GOTPCREL(%rip)
Expand Down

0 comments on commit 53ee0b7

Please sign in to comment.