Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/AArch64/bti-linkage.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

48 lines
1.9 KiB
LLVM

; RUN: llc -mtriple=aarch64-linux-gnu %s -o - | FileCheck %s --check-prefixes=CHECK,NOBTI
; RUN: llc -mtriple=aarch64-none-elf %s -o - | FileCheck %s --check-prefixes=CHECK,NOBTI
; RUN: llc -mtriple=aarch64-none-macho %s -o - | FileCheck %s --check-prefixes=CHECK,BTI
; RUN: llc -mtriple=aarch64-windows-msvc %s -o - | FileCheck %s --check-prefixes=CHECK,BTI
;; This function has internal linkage, and nothing in this translation unit
;; calls it indirectly. So it doesn't need a BTI at the start ... except that
;; it might, if at link time if the linker inserts a long-branch thunk using a
;; BLR instruction.
;;
;; For ELF targets, both Linux and bare-metal, we expect no BTI instruction at
;; the start of the function, because AAELF64 specifies that it's not needed:
;; if the linker wants to do that then it's responsible for making a 'landing
;; pad' near the target function which _does_ have a BTI, and pointing the
;; indirect call at that.
;;
;; But this is specified in AAELF64, so non-ELF targets can't rely on that
;; guarantee, and we expect LLVM to insert the BTI anyway.
define internal void @internal_linkage() "branch-target-enforcement" {
; CHECK-LABEL: internal_linkage:
; BTI: hint #34
; NOBTI-NOT: hint #34
; CHECK: ret
entry:
ret void
}
;; This function has internal linkage but _is_ potentially called indirectly
;; (its address escapes from the module via external_linkage() below), so it
;; needs a BTI irrespective of target triple.
define internal void @indirectly_called() "branch-target-enforcement" {
; CHECK-LABEL: indirectly_called:
; CHECK: hint #34
; CHECK: ret
entry:
ret void
}
;; This function has external linkage, so it needs a BTI in all circumstances.
define ptr @external_linkage() "branch-target-enforcement" {
; CHECK-LABEL: external_linkage:
; CHECK: hint #34
; CHECK: ret
entry:
call void @internal_linkage()
ret ptr @indirectly_called
}