summaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-05-08 15:13:04 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-05-08 15:13:25 -0700
commit9e20d0f0ce97c34e2424a3342ea573f3255f5ee3 (patch)
tree5872313d212c8c4a8c36081023761515ee6ddb22 /libphobos
parent08c1d39d3a822dfe7d91524ec290e0f230504242 (diff)
switchcontext.S: Include <cet.h> and use _CET_ENDBR
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.
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/ChangeLog7
-rw-r--r--libphobos/libdruntime/config/x86/switchcontext.S8
2 files changed, 15 insertions, 0 deletions
diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index 6a174beda75..c885d926216 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -1,5 +1,12 @@
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.
* configure.ac (CET_FLAGS): Add GCC_CET_FLAGS and AC_SUBST.
* Makefile.in: Regenerated.
diff --git a/libphobos/libdruntime/config/x86/switchcontext.S b/libphobos/libdruntime/config/x86/switchcontext.S
index f5d1a87eb01..35063af491c 100644
--- a/libphobos/libdruntime/config/x86/switchcontext.S
+++ b/libphobos/libdruntime/config/x86/switchcontext.S
@@ -24,6 +24,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "../common/threadasm.S"
+#ifdef __CET__
+# include <cet.h>
+#else
+# define _CET_ENDBR
+#endif
+
#if defined(__i386__)
.text
@@ -32,6 +38,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
.align 16
CSYM(fiber_switchContext):
.cfi_startproc
+ _CET_ENDBR
// save current stack state
push %ebp
mov %esp, %ebp
@@ -66,6 +73,7 @@ CSYM(fiber_switchContext):
.align 16
CSYM(fiber_switchContext):
.cfi_startproc
+ _CET_ENDBR
// Save current stack state.save current stack state
push %rbp
mov %rsp, %rbp