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
82 lines
2.5 KiB
LLVM
82 lines
2.5 KiB
LLVM
; RUN: llc -mtriple=thumbv7-linux-gnueabi -filetype=obj < %s
|
|
; RUN: llc -mtriple=thumbv7-linux-gnueabi < %s | FileCheck %s
|
|
|
|
; This test verifies that KCFI instrumentation doesn't cause "out of range
|
|
; pc-relative fixup value" errors when generating object files.
|
|
;
|
|
; The test creates a scenario with enough KCFI-instrumented indirect calls
|
|
; (~32 bytes each) that would push a cbz/cbnz instruction out of its ±126 byte
|
|
; range if the KCFI_CHECK pseudo-instruction size is not properly accounted for.
|
|
;
|
|
; Without the fix (KCFI_CHECK returns size 0):
|
|
; - Backend thinks KCFI checks take no space
|
|
; - Generates cbz to branch over the code
|
|
; - During assembly, cbz target is >126 bytes away
|
|
; - Assembly fails with "error: out of range pc-relative fixup value"
|
|
;
|
|
; With the fix (KCFI_CHECK returns size 32 for Thumb2):
|
|
; - Backend correctly accounts for KCFI check expansion
|
|
; - Avoids cbz or uses longer-range branch instructions
|
|
; - Assembly succeeds, object file is generated
|
|
|
|
declare void @external_function(i32)
|
|
|
|
; Test WITHOUT KCFI: should generate cbz since calls are small
|
|
; CHECK-LABEL: test_without_kcfi:
|
|
; CHECK: cbz
|
|
; CHECK-NOT: bic{{.*}}#1
|
|
define i32 @test_without_kcfi(ptr %callback, i32 %x) {
|
|
entry:
|
|
%cmp = icmp eq i32 %x, 0
|
|
br i1 %cmp, label %if_zero, label %if_nonzero
|
|
|
|
if_nonzero:
|
|
; Regular (non-KCFI) indirect calls - much smaller
|
|
call void %callback()
|
|
call void %callback()
|
|
call void %callback()
|
|
call void %callback()
|
|
call void %callback()
|
|
call void %callback()
|
|
|
|
call void @external_function(i32 %x)
|
|
%add1 = add i32 %x, 1
|
|
ret i32 %add1
|
|
|
|
if_zero:
|
|
call void @external_function(i32 0)
|
|
ret i32 0
|
|
}
|
|
|
|
; Test WITH KCFI: should NOT generate cbz due to large KCFI checks
|
|
; CHECK-LABEL: test_with_kcfi:
|
|
; CHECK-NOT: cbz
|
|
; CHECK: bic{{.*}}#1
|
|
define i32 @test_with_kcfi(ptr %callback, i32 %x) !kcfi_type !1 {
|
|
entry:
|
|
%cmp = icmp eq i32 %x, 0
|
|
br i1 %cmp, label %if_zero, label %if_nonzero
|
|
|
|
if_nonzero:
|
|
; Six KCFI-instrumented indirect calls (~192 bytes total, exceeds cbz range)
|
|
call void %callback() [ "kcfi"(i32 12345678) ]
|
|
call void %callback() [ "kcfi"(i32 12345678) ]
|
|
call void %callback() [ "kcfi"(i32 12345678) ]
|
|
call void %callback() [ "kcfi"(i32 12345678) ]
|
|
call void %callback() [ "kcfi"(i32 12345678) ]
|
|
call void %callback() [ "kcfi"(i32 12345678) ]
|
|
|
|
; Regular call to prevent optimization
|
|
call void @external_function(i32 %x)
|
|
%add1 = add i32 %x, 1
|
|
ret i32 %add1
|
|
|
|
if_zero:
|
|
call void @external_function(i32 0)
|
|
ret i32 0
|
|
}
|
|
|
|
!llvm.module.flags = !{!0}
|
|
!0 = !{i32 4, !"kcfi", i32 1}
|
|
!1 = !{i32 12345678}
|