gcc/libgcc/config/i386
Igor Tsimbalist 6a10fff4e2 Add Intel CET support for EH in libgcc.
Control-flow Enforcement Technology (CET), published by Intel,
introduces the Shadow Stack feature, which ensures a return from a
function is done to exactly the same location from where the function
was called. When EH is present the control-flow transfer may skip some
stack frames and the shadow stack has to be adjusted not to signal a
violation of a control-flow transfer. It's done by counting a number
of skiping frames and adjasting shadow stack pointer by this number.

Having new semantic of the 'ret' instruction if CET is supported in HW
the 'ret' instruction cannot be generated in ix86_expand_epilogue when
we are returning after EH is processed. Added a code in
ix86_expand_epilogue to adjust Shadow Stack pointer and to generate an
indirect jump instead of 'ret'. As sp register is used during this
adjustment thus the argument in pro_epilogue_adjust_stack is changed
to update cfa_reg based on whether control-flow instrumentation is set.
Without updating the cfa_reg field there is an assert later in dwarf2
pass related to mismatch the stack register and cfa_reg value.

gcc/
	* config/i386/i386.c (ix86_expand_epilogue): Change simple
	return to indirect jump for EH return if control-flow protection
	is enabled. Change explicit 'false' argument in
	pro_epilogue_adjust_stack with a value of flag_cf_protection.
	* config/i386/i386.md (simple_return_indirect_internal): Remove
	SImode restriction to support 64-bit.

libgcc/
	* config/i386/linux-unwind.h: Include
	config/i386/shadow-stack-unwind.h.
	* config/i386/shadow-stack-unwind.h: New file.
	* unwind-dw2.c: (uw_install_context): Add a frame parameter and
	pass it to _Unwind_Frames_Extra.
	* unwind-generic.h (_Unwind_Frames_Extra): New.
	* unwind.inc (_Unwind_RaiseException_Phase2): Add frames_p
	parameter. Add local variable frames to count number of frames.
	(_Unwind_ForcedUnwind_Phase2): Likewise.
	(_Unwind_RaiseException): Add local variable frames to count
	number of frames, pass it to _Unwind_RaiseException_Phase2 and
	uw_install_context.
	(_Unwind_ForcedUnwind): Likewise.
	(_Unwind_Resume): Likewise.
	(_Unwind_Resume_or_Rethrow): Likewise.

From-SVN: r254876
2017-11-17 16:21:23 +01:00
..
32 Update copyright years. 2017-01-01 13:07:43 +01:00
64
avx_resms64.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
avx_resms64f.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
avx_resms64fx.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
avx_resms64x.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
avx_savms64.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
avx_savms64f.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
cpuinfo.c config.gcc: Support "knm". 2017-09-20 15:47:30 +02:00
cpuinfo.h config.gcc: Support "knm". 2017-09-20 15:47:30 +02:00
crtfastmath.c Update copyright years. 2017-01-01 13:07:43 +01:00
crti.S Update copyright years. 2017-01-01 13:07:43 +01:00
crtn.S Update copyright years. 2017-01-01 13:07:43 +01:00
crtprec.c Update copyright years. 2017-01-01 13:07:43 +01:00
cygming-crtbegin.c * config/i386/cygming-crtbegin.c (LIBGCJ_SONAME): No longer #define. 2017-01-21 08:52:32 +00:00
cygming-crtend.c Update copyright years. 2017-01-01 13:07:43 +01:00
cygwin.S Update copyright years. 2017-01-01 13:07:43 +01:00
darwin-lib.h Update copyright years. 2017-01-01 13:07:43 +01:00
dragonfly-unwind.h Fix Unwind support on DragonFly BSD after sigtramp move 2017-07-19 16:55:11 +01:00
elf-lib.h Update copyright years. 2017-01-01 13:07:43 +01:00
enable-execute-stack-mingw32.c Update copyright years. 2017-01-01 13:07:43 +01:00
freebsd-unwind.h re PR libgcc/82635 (std::thread's join broken on FreeBSD with all GCCs >= 5) 2017-11-04 20:40:23 +01:00
gthr-win32.c Update copyright years. 2017-01-01 13:07:43 +01:00
gthr-win32.h gthr-win32.h: Define NOGDI before windows.h include to prevent w32api CC_NONE macro clash... 2017-03-02 11:03:23 +00:00
i386-asm.h PR target/82196 addendum: Fix Darwin build breakage and test FAILS on Solaris 2017-09-23 11:02:54 +00:00
libgcc-bsd.ver Update copyright years. 2017-01-01 13:07:43 +01:00
libgcc-cygming.ver Update copyright years. 2017-01-01 13:07:43 +01:00
libgcc-darwin.10.4.ver Update copyright years. 2017-01-01 13:07:43 +01:00
libgcc-darwin.10.5.ver Update copyright years. 2017-01-01 13:07:43 +01:00
libgcc-glibc.ver Update copyright years. 2017-01-01 13:07:43 +01:00
libgcc-sol2.ver Update copyright years. 2017-01-01 13:07:43 +01:00
linux-unwind.h Add Intel CET support for EH in libgcc. 2017-11-17 16:21:23 +01:00
morestack.S Enable building libgcc with CET options. 2017-11-17 14:34:39 +01:00
resms64.h Enable building libgcc with CET options. 2017-11-17 14:34:39 +01:00
resms64f.h Enable building libgcc with CET options. 2017-11-17 14:34:39 +01:00
resms64fx.h Enable building libgcc with CET options. 2017-11-17 14:34:39 +01:00
resms64x.h Enable building libgcc with CET options. 2017-11-17 14:34:39 +01:00
savms64.h Enable building libgcc with CET options. 2017-11-17 14:34:39 +01:00
savms64f.h Enable building libgcc with CET options. 2017-11-17 14:34:39 +01:00
sfp-exceptions.c Update copyright years. 2017-01-01 13:07:43 +01:00
sfp-machine.h [libgcc] Remove semicolon after do {} while (0) in FP_HANDLE_EXCEPTIONS 2017-11-07 08:11:43 +00:00
shadow-stack-unwind.h Add Intel CET support for EH in libgcc. 2017-11-17 16:21:23 +01:00
sol2-c1.S Update copyright years. 2017-01-01 13:07:43 +01:00
sol2-unwind.h Update copyright years. 2017-01-01 13:07:43 +01:00
sse_resms64.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
sse_resms64f.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
sse_resms64fx.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
sse_resms64x.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
sse_savms64.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
sse_savms64f.S PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
t-chkstk
t-cpuinfo
t-cpuinfo-static
t-crtpc
t-crtstuff
t-cygming
t-cygwin
t-darwin
t-dlldir
t-dlldir-x
t-dragonfly
t-dw2-eh
t-freebsd
t-gthr-win32
t-linux Enable building libgcc with CET options. 2017-11-17 14:34:39 +01:00
t-mingw32
t-mingw-pthread
t-msabi PR target/82196 correct choice of avx/sse stubs for -mcall-ms2sysv-xlogues 2017-09-17 22:04:40 +00:00
t-nto
t-seh-eh
t-sjlj-eh
t-slibgcc-cygming
t-softfp
t-sol2
t-stack-i386
value-unwind.h Update copyright years. 2017-01-01 13:07:43 +01:00
w32-unwind.h Update copyright years. 2017-01-01 13:07:43 +01:00