1 ; RUN: llc -mtriple aarch64--none-eabi -mattr=+bti < %s | FileCheck %s
2 ; RUN: llc -mtriple aarch64--none-eabi -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel* -mattr=+bti %s -verify-machineinstrs -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,FALLBACK
4 ; FALLBACK: remark: <unknown>:0:0: unable to translate instruction: call: ' tail call void %p()' (in function: bti_enabled)
6 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
7 target triple = "aarch64-arm-none-eabi"
9 ; When BTI is enabled, all indirect tail-calls must use x16 or x17 (the intra
10 ; procedure call scratch registers) to hold the address, as these instructions
11 ; are allowed to target the "BTI c" instruction at the start of the target
12 ; function. The alternative to this would be to start functions with "BTI jc",
13 ; which increases the number of potential ways they could be called, and
14 ; weakens the security protections.
16 define void @bti_disabled(void ()* %p) {
23 define void @bti_enabled(void ()* %p) "branch-target-enforcement" {
26 ; CHECK: br {{x16|x17}}