Files
TheRock/compiler/amd-llvm/bolt/test/runtime/AArch64/pacret-eh-function-split.cpp
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

43 lines
1.3 KiB
C++

/* This test check that the negate-ra-state CFIs are properly emitted in case of
function splitting. The test checks two things:
- we split at the correct location: to test the feature,
we need to split *before* the bl __cxa_throw@PLT call is made,
so the unwinder has to unwind from the split (cold) part.
- the BOLTed binary runs, and returns the string from foo.
# REQUIRES: system-linux,bolt-runtime
# FDATA: 1 main #split# 1 _Z3foov 0 0 1
# RUN: %clangxx --target=aarch64-unknown-linux-gnu \
# RUN: -mbranch-protection=pac-ret %s -o %t.exe -Wl,-q
# RUN: link_fdata %s %t.exe %t.fdata
# RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-eh \
# RUN: --split-strategy=profile2 --split-all-cold --print-split \
# RUN: --print-only=_Z3foov --data=%t.fdata 2>&1 | FileCheck \
# RUN: --check-prefix=BOLT-CHECK %s
# RUN: %t.bolt | FileCheck %s --check-prefix=RUN-CHECK
# BOLT-CHECK-NOT: bl __cxa_throw@PLT
# BOLT-CHECK: ------- HOT-COLD SPLIT POINT -------
# BOLT-CHECK: bl __cxa_throw@PLT
# RUN-CHECK: Exception caught: Exception from foo().
*/
#include <cstdio>
#include <stdexcept>
void foo() { throw std::runtime_error("Exception from foo()."); }
int main() {
try {
__asm__ __volatile__("split:");
foo();
} catch (const std::exception &e) {
printf("Exception caught: %s\n", e.what());
}
return 0;
}