gcc/libgcc/config
Richard Earnshaw ebdb6f2377 PR target/86951 arm - Handle speculation barriers on pre-armv7 CPUs
The AArch32 instruction sets prior to Armv7 do not define the ISB and
DSB instructions that are needed to form a speculation barrier.  While
I do not know of any instances of cores based on those instruction
sets being vulnerable to speculative side channel attacks it is
possible to run code built for those ISAs on more recent hardware
where they would become vulnerable.

This patch works around this by using a library call added to libgcc.
That code can then take any platform-specific actions necessary to
ensure safety.

For the moment I've only handled two cases: the library code being
built for armv7 or later anyway and running on Linux.

On Linux we can handle this by calling the kernel function that will
flush a small amount of cache.  Such a sequence ends with a ISB+DSB
sequence if running on an Armv7 or later CPU.

gcc:

	PR target/86951
	* config/arm/arm-protos.h (arm_emit_speculation_barrier): New
	prototype.
	* config/arm/arm.c (speculation_barrier_libfunc): New static
	variable.
	(arm_init_libfuncs): Initialize it.
	(arm_emit_speculation_barrier): New function.
	* config/arm/arm.md (speculation_barrier): Call
	arm_emit_speculation_barrier for architectures that do not have 
	DSB or ISB.
	(speculation_barrier_insn): Only match on Armv7 or later.

libgcc:

	PR target/86951
	* config/arm/lib1funcs.asm (speculation_barrier): New function.
	* config/arm/t-arm (LIB1ASMFUNCS): Add it to list of functions
	to build.

From-SVN: r263806
2018-08-23 09:47:34 +00:00
..
aarch64
alpha
arc
arm PR target/86951 arm - Handle speculation barriers on pre-armv7 CPUs 2018-08-23 09:47:34 +00:00
avr
bfin
c6x
cr16
cris
csky C-SKY port: libgcc 2018-08-17 15:08:27 -04:00
epiphany
fr30
frv
ft32
h8300
i386 i386: Remove _Unwind_Frames_Increment 2018-07-27 07:40:47 -07:00
ia64
iq2000
libbid
lm32
m32c
m32r
m68k
mcore
microblaze
mips
mmix
moxie
msp430
nds32 [NDS32] Implement more C ISR extension. 2018-08-12 07:38:40 +00:00
nios2
nvptx
pa pa.md (UNSPEC_MEMORY_BARRIER): New unspec enum. 2018-08-11 21:37:55 +00:00
pdp11
riscv
rl78
rs6000 re PR target/85358 (PowerPC: Using -mabi=ieeelongdouble -mcpu=power9 breaks __ibm128) 2018-06-18 19:10:08 +00:00
rx
s390
score
sh
sol2
sparc
spu
stormy16
tilegx
tilepro
v850
vax
visium
vms
xtensa
darwin10-unwind-find-enc-func.c Move Darwin10 unwinder fix to a crt shim. 2018-08-22 11:58:43 +00:00
darwin-64.c
darwin-crt3.c
darwin-crt-tm.c
gthr-lynx.h
gthr-rtems.h
gthr-vxworks.h
hardfp.c
libgcc-glibc.ver
libgcc-libsystem.ver
no-sfp-machine.h
no-unwind.h
t-crtfm
t-crtstuff-pic
t-darwin Move Darwin10 unwinder fix to a crt shim. 2018-08-22 11:58:43 +00:00
t-dfprules
t-eh-dw2-dip
t-fdpbit
t-fixedpoint-gnu-prefix
t-fpbit
t-freebsd-thread
t-gnu-prefix
t-hardfp
t-hardfp-sfdf
t-libgcc-pic
t-libunwind
t-libunwind-elf
t-linux
t-openbsd-thread
t-rtems
t-slibgcc
t-slibgcc-darwin
t-slibgcc-elf-ver
t-slibgcc-fuchsia
t-slibgcc-gld
t-slibgcc-gld-nover
t-slibgcc-hpux
t-slibgcc-libgcc
t-slibgcc-nolc-override
t-slibgcc-sld
t-slibgcc-vms
t-softfp
t-softfp-compat
t-softfp-excl
t-softfp-sfdf
t-softfp-sfdftf
t-softfp-tf
t-stack
t-tls
t-vxworks t-vxworks (LIBGCC_INCLUDES): Add -I$(MULTIBUILDTOP)../../gcc/include. 2018-06-07 13:31:24 +00:00
t-vxworks7 t-vxworks (LIBGCC_INCLUDES): Add -I$(MULTIBUILDTOP)../../gcc/include. 2018-06-07 13:31:24 +00:00
unwind-dw2-fde-darwin.c Move Darwin10 unwinder fix to a crt shim. 2018-08-22 11:58:43 +00:00
vxlib-tls.c
vxlib.c