aarch64: Fix missing BTI instruction in trampolines
authorOmar Tahir <omar.tahir@arm.com>
Wed, 1 Jul 2020 20:56:16 +0000 (21:56 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 1 Jul 2020 20:56:16 +0000 (21:56 +0100)
commitbe7c41a556464680b17a2c3d5d099ec56a2c223e
tree401276a98cfa498e34f82f17028af3f3102e6efe
parent553c6572061f6f9ef92514e8f13de95d509ad614
aarch64: Fix missing BTI instruction in trampolines

If two functions require trampolines, and the first has BTI enabled
while the second doesn't, the generated template will be lacking
a BTI instruction.  This patch fixes this by always adding a BTI
instruction, which is safe as BTI instructions are ignored on
unsupported architecture versions.

2020-07-01  Omar Tahir  <omar.tahir@arm.com>

gcc/
* config/aarch64/aarch64.c (aarch64_asm_trampoline_template): Always
generate a BTI instruction.

gcc/testsuite/
* gcc.target/aarch64/bti-4.c: New test.
gcc/config/aarch64/aarch64.c
gcc/testsuite/gcc.target/aarch64/bti-4.c [new file with mode: 0644]