When __CET__ is defined, <cet.h> should be included to add Intel CET
marker to object file and _CET_ENDBR should be placed at function entry
to indicate indirect branch target.
* libdruntime/config/x86/switchcontext.S: Include <cet.h> if
__CET__ is defined.
(_CET_ENDBR): New. Define if __CET__ is not defined.
(fiber_switchContext): Add _CET_ENDBR after .cfi_startproc.
+2020-05-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * libdruntime/config/x86/switchcontext.S: Include <cet.h> if
+ __CET__ is defined.
+ (_CET_ENDBR): New. Define if __CET__ is not defined.
+ (fiber_switchContext): Add _CET_ENDBR after .cfi_startproc.
+
2020-05-08 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.am (AM_MAKEFLAGS): Add $(CET_FLAGS) to GCC FLAGS.
#include "../common/threadasm.S"
+#ifdef __CET__
+# include <cet.h>
+#else
+# define _CET_ENDBR
+#endif
+
#if defined(__i386__)
.text
.align 16
CSYM(fiber_switchContext):
.cfi_startproc
+ _CET_ENDBR
// save current stack state
push %ebp
mov %esp, %ebp
.align 16
CSYM(fiber_switchContext):
.cfi_startproc
+ _CET_ENDBR
// Save current stack state.save current stack state
push %rbp
mov %rsp, %rbp