[Bug libgcc/85388] config/i386/morestack.S is incompatible with CET

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 13 03:41:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85388

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
I am testing this patch:

diff --git a/gcc/config/i386/cet.h b/gcc/config/i386/cet.h
index 9dca41bad2d..309d90ec87c 100644
--- a/gcc/config/i386/cet.h
+++ b/gcc/config/i386/cet.h
@@ -33,12 +33,14 @@
 #ifdef __ASSEMBLER__

 # ifdef __IBT__
+#  define _CET_NOTRACK notrack
 #  ifdef __x86_64__
 #   define _CET_ENDBR endbr64
 #  else
 #   define _CET_ENDBR endbr32
 #  endif
 # else
+#  define _CET_NOTRACK
 #  define _CET_ENDBR
 # endif

diff --git a/libgcc/config/i386/morestack.S b/libgcc/config/i386/morestack.S
index 99e65eaaff4..c0cda479806 100644
--- a/libgcc/config/i386/morestack.S
+++ b/libgcc/config/i386/morestack.S
@@ -543,7 +543,7 @@ __morestack:

        movq    -16(%rbp),%rax          # Restore caller's %rax.

-       call    *%r10                   # Call our caller!
+       _CET_NOTRACK call *%r10         # Call our caller!

        # The caller will return here, as predicted.


More information about the Gcc-bugs mailing list