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
62 lines
2.5 KiB
Plaintext
62 lines
2.5 KiB
Plaintext
# Test the different ways of hooking the fini function for instrumentation (via
|
|
# DT_FINI and via DT_FINI_ARRAY). We test the latter for both PIE and non-PIE
|
|
# binaries because of the different ways of handling relocations (static or
|
|
# dynamic).
|
|
# All tests perform the following steps:
|
|
# - Compile and link for the case to be tested
|
|
# - Some sanity-checks on the dynamic section and relocations in the binary to
|
|
# verify it has the shape we want for testing:
|
|
# - DT_FINI or DT_FINI_ARRAY in dynamic section
|
|
# - No relative relocations for non-PIE
|
|
# - Instrument
|
|
# - Run instrumented binary
|
|
# - Verify generated profile
|
|
REQUIRES: system-linux,bolt-runtime
|
|
|
|
RUN: %clang %cflags -pie %p/Inputs/basic-instrumentation.s -Wl,-q -o %t.exe
|
|
RUN: llvm-readelf -d %t.exe | FileCheck --check-prefix=DYN-FINI %s
|
|
RUN: llvm-readelf -r %t.exe | FileCheck --check-prefix=RELOC-PIE %s
|
|
RUN: llvm-bolt %t.exe -o %t --instrument \
|
|
RUN: --instrumentation-file=%t \
|
|
RUN: --instrumentation-file-append-pid
|
|
RUN: rm -f %t.*.fdata
|
|
RUN: %t
|
|
RUN: cat %t.*.fdata | FileCheck %s
|
|
|
|
RUN: %clang %cflags -pie %p/Inputs/basic-instrumentation.s -Wl,-q,-fini=0 -o %t-no-fini.exe
|
|
RUN: llvm-readelf -d %t-no-fini.exe | FileCheck --check-prefix=DYN-NO-FINI %s
|
|
RUN: llvm-readelf -r %t-no-fini.exe | FileCheck --check-prefix=RELOC-PIE %s
|
|
RUN: llvm-bolt %t-no-fini.exe -o %t-no-fini --instrument \
|
|
RUN: --instrumentation-file=%t-no-fini \
|
|
RUN: --instrumentation-file-append-pid
|
|
RUN: rm -f %t-no-fini.*.fdata
|
|
RUN: %t-no-fini
|
|
RUN: cat %t-no-fini.*.fdata | FileCheck %s
|
|
|
|
RUN: %clang %cflags -no-pie %p/Inputs/basic-instrumentation.s -Wl,-q,-fini=0 -o %t-no-pie-no-fini.exe
|
|
RUN: llvm-readelf -d %t-no-pie-no-fini.exe | FileCheck --check-prefix=DYN-NO-FINI %s
|
|
RUN: llvm-readelf -r %t-no-pie-no-fini.exe | FileCheck --check-prefix=RELOC-NO-PIE %s
|
|
RUN: llvm-bolt %t-no-pie-no-fini.exe -o %t-no-pie-no-fini --instrument \
|
|
RUN: --instrumentation-file=%t-no-pie-no-fini \
|
|
RUN: --instrumentation-file-append-pid
|
|
RUN: rm -f %t-no-pie-no-fini.*.fdata
|
|
RUN: %t-no-pie-no-fini
|
|
RUN: cat %t-no-pie-no-fini.*.fdata | FileCheck %s
|
|
|
|
# With fini: dynamic section should contain DT_FINI
|
|
DYN-FINI: (FINI)
|
|
|
|
# Without fini: dynamic section should only contain DT_FINI_ARRAY
|
|
DYN-NO-FINI-NOT: (FINI)
|
|
DYN-NO-FINI: (FINI_ARRAY)
|
|
DYN-NO-FINI: (FINI_ARRAYSZ)
|
|
|
|
# With PIE: binary should have relative relocations
|
|
RELOC-PIE: R_AARCH64_RELATIVE
|
|
|
|
# Without PIE: binary should not have relative relocations
|
|
RELOC-NO-PIE-NOT: R_AARCH64_RELATIVE
|
|
|
|
# The instrumented profile should at least say main was called once
|
|
CHECK: main 0 0 1{{$}}
|