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 SVE unwinding 2018-01-13 17:56:52 +00:00
alpha Update copyright years. 2018-01-03 11:03:58 +01:00
arc [ARC] Add support for reduced register file set 2018-01-26 12:34:00 +01:00
arm PR target/86951 arm - Handle speculation barriers on pre-armv7 CPUs 2018-08-23 09:47:34 +00:00
avr Update copyright years. 2018-01-03 11:03:58 +01:00
bfin Update copyright years. 2018-01-03 11:03:58 +01:00
c6x Update copyright years. 2018-01-03 11:03:58 +01:00
cr16 Update copyright years. 2018-01-03 11:03:58 +01:00
cris Update copyright years. 2018-01-03 11:03:58 +01:00
csky C-SKY port: libgcc 2018-08-17 15:08:27 -04:00
epiphany Update copyright years. 2018-01-03 11:03:58 +01:00
fr30 Update copyright years. 2018-01-03 11:03:58 +01:00
frv Update copyright years. 2018-01-03 11:03:58 +01:00
ft32 Update copyright years. 2018-01-03 11:03:58 +01:00
h8300 Update copyright years. 2018-01-03 11:03:58 +01:00
i386 i386: Remove _Unwind_Frames_Increment 2018-07-27 07:40:47 -07:00
ia64 Update copyright years. 2018-01-03 11:03:58 +01:00
iq2000 Update copyright years. 2018-01-03 11:03:58 +01:00
libbid Update copyright years. 2018-01-03 11:03:58 +01:00
lm32 Update copyright years. 2018-01-03 11:03:58 +01:00
m32c Update copyright years. 2018-01-03 11:03:58 +01:00
m32r Update copyright years. 2018-01-03 11:03:58 +01:00
m68k lb1sf68.S (Laddsf$nf): Fix sign bit handling in path to Lf$finfty. 2018-05-23 16:29:01 -06:00
mcore Update copyright years. 2018-01-03 11:03:58 +01:00
microblaze Update copyright years. 2018-01-03 11:03:58 +01:00
mips Update copyright years. 2018-01-03 11:03:58 +01:00
mmix Update copyright years. 2018-01-03 11:03:58 +01:00
moxie Update copyright years. 2018-01-03 11:03:58 +01:00
msp430 Update copyright years. 2018-01-03 11:03:58 +01:00
nds32 [NDS32] Implement more C ISR extension. 2018-08-12 07:38:40 +00:00
nios2 Update copyright years. 2018-01-03 11:03:58 +01:00
nvptx Update copyright years. 2018-01-03 11:03:58 +01:00
pa pa.md (UNSPEC_MEMORY_BARRIER): New unspec enum. 2018-08-11 21:37:55 +00:00
pdp11
riscv RISC-V: Add RV32E support. 2018-05-18 15:53:55 -07:00
rl78 rl78.md: New define_expand "anddi3". 2018-01-22 19:23:15 +00:00
rs6000 re PR target/85358 (PowerPC: Using -mabi=ieeelongdouble -mcpu=power9 breaks __ibm128) 2018-06-18 19:10:08 +00:00
rx Update copyright years. 2018-01-03 11:03:58 +01:00
s390 Update copyright years. 2018-01-03 11:03:58 +01:00
score Update copyright years. 2018-01-03 11:03:58 +01:00
sh Update copyright years. 2018-01-03 11:03:58 +01:00
sol2 Update copyright years. 2018-01-03 11:03:58 +01:00
sparc Update copyright years. 2018-01-03 11:03:58 +01:00
spu Update copyright years. 2018-01-03 11:03:58 +01:00
stormy16 Update copyright years. 2018-01-03 11:03:58 +01:00
tilegx
tilepro Update copyright years. 2018-01-03 11:03:58 +01:00
v850 Update copyright years. 2018-01-03 11:03:58 +01:00
vax Update copyright years. 2018-01-03 11:03:58 +01:00
visium Update copyright years. 2018-01-03 11:03:58 +01:00
vms Update copyright years. 2018-01-03 11:03:58 +01:00
xtensa libgcc: xtensa: fix build with -mtext-section-literals 2018-02-20 20:55:56 +00:00
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 Update copyright years. 2018-01-03 11:03:58 +01:00
darwin-crt3.c Update copyright years. 2018-01-03 11:03:58 +01:00
darwin-crt-tm.c Update copyright years. 2018-01-03 11:03:58 +01:00
gthr-lynx.h Update copyright years. 2018-01-03 11:03:58 +01:00
gthr-rtems.h Update copyright years. 2018-01-03 11:03:58 +01:00
gthr-vxworks.h Update copyright years. 2018-01-03 11:03:58 +01:00
hardfp.c Update copyright years. 2018-01-03 11:03:58 +01:00
libgcc-glibc.ver Update copyright years. 2018-01-03 11:03:58 +01:00
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 Update copyright years. 2018-01-03 11:03:58 +01:00
t-hardfp-sfdf Update copyright years. 2018-01-03 11:03:58 +01:00
t-libgcc-pic
t-libunwind
t-libunwind-elf Update copyright years. 2018-01-03 11:03:58 +01:00
t-linux
t-openbsd-thread
t-rtems
t-slibgcc Update copyright years. 2018-01-03 11:03:58 +01:00
t-slibgcc-darwin
t-slibgcc-elf-ver
t-slibgcc-fuchsia Update copyright years. 2018-01-03 11:03:58 +01:00
t-slibgcc-gld
t-slibgcc-gld-nover
t-slibgcc-hpux
t-slibgcc-libgcc Update copyright years. 2018-01-03 11:03:58 +01:00
t-slibgcc-nolc-override
t-slibgcc-sld
t-slibgcc-vms
t-softfp Update copyright years. 2018-01-03 11:03:58 +01:00
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 Update copyright years. 2018-01-03 11:03:58 +01:00
vxlib.c Update copyright years. 2018-01-03 11:03:58 +01:00