[Bug target/85397] -mcet -fcf-protection doesn't work with label in nested function

2018-04-19 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85397

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |8.0

--- Comment #6 from H.J. Lu  ---
Fixed for GCC 8.

[Bug target/85397] -mcet -fcf-protection doesn't work with label in nested function

2018-04-19 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85397

--- Comment #5 from hjl at gcc dot gnu.org  ---
Author: hjl
Date: Thu Apr 19 16:36:34 2018
New Revision: 259500

URL: https://gcc.gnu.org/viewcvs?rev=259500&root=gcc&view=rev
Log:
i386: Add save_stack_nonlocal and restore_stack_nonlocal

Define STACK_SAVEAREA_MODE to hold both shadow stack and stack pointers.
Replace builtin_setjmp_setup and builtin_longjmp with save_stack_nonlocal
and restore_stack_nonlocal to support both builtin setjmp/longjmp as well
as non-local goto in nested functions.

gcc/

PR target/85397
* config/i386/i386.h (STACK_SAVEAREA_MODE): New.
* config/i386/i386.md (builtin_setjmp_setup): Removed.
(builtin_longjmp): Likewise.
(save_stack_nonlocal): New pattern.
(restore_stack_nonlocal): Likewise.

gcc/testsuite/

PR target/85397
* gcc.dg/torture/pr85397-1.c: New test.
* gcc.target/i386/cet-sjlj-6a.c: Adjusted.
* gcc.target/i386/cet-sjlj-6b.c: Likewise.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr85397-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.h
trunk/gcc/config/i386/i386.md
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.target/i386/cet-sjlj-6a.c
trunk/gcc/testsuite/gcc.target/i386/cet-sjlj-6b.c

[Bug target/85397] -mcet -fcf-protection doesn't work with label in nested function

2018-04-14 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85397

--- Comment #4 from H.J. Lu  ---
*** Bug 85399 has been marked as a duplicate of this bug. ***

[Bug target/85397] -mcet -fcf-protection doesn't work with label in nested function

2018-04-13 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85397

--- Comment #3 from H.J. Lu  ---
builtin_longjmp has also the same issue as PR 85025.  I fixed it on
hjl/cet/master branch.

[Bug target/85397] -mcet -fcf-protection doesn't work with label in nested function

2018-04-13 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85397

--- Comment #2 from H.J. Lu  ---
Please take a look at hjl/cet/master branch at

https://github.com/hjl-tools/gcc/tree/hjl/cet/master

I replaced builtin_setjmp_setup and builtin_longjmp with save_stack_nonlocal
and restore_stack_nonlocal to save and restore shadow stack to support both
builtin setjmp/longjmp as well as non-local goto in nested functions.

[Bug target/85397] -mcet -fcf-protection doesn't work with label in nested function

2018-04-13 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85397

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-04-13
 Ever confirmed|0   |1

--- Comment #1 from H.J. Lu  ---
Do we need to define save_stack_nonlocal and restore_stack_nonlocal to
save and restore shadow stack pointers?