|
| 1 | +# Checking that we generate an OpNegateRAState CFI after the split point, |
| 2 | +# when splitting a region with signed RA state. |
| 3 | + |
| 4 | +# REQUIRES: system-linux |
| 5 | + |
| 6 | +# RUN: %clang %cflags -o %t %s |
| 7 | +# RUN: %clang %s %cflags -Wl,-q -o %t |
| 8 | +# RUN: link_fdata --no-lbr %s %t %t.fdata |
| 9 | +# RUN: llvm-bolt %t -o %t.bolt --data %t.fdata -split-functions \ |
| 10 | +# RUN: --print-only foo --print-split --print-all 2>&1 | FileCheck %s |
| 11 | + |
| 12 | +# Checking that we don't see any OpNegateRAState CFIs before the insertion pass. |
| 13 | +# CHECK-NOT: OpNegateRAState |
| 14 | +# CHECK: Binary Function "foo" after insert-negate-ra-state-pass |
| 15 | + |
| 16 | +# CHECK: paciasp |
| 17 | +# CHECK-NEXT: OpNegateRAState |
| 18 | + |
| 19 | +# CHECK: ------- HOT-COLD SPLIT POINT ------- |
| 20 | + |
| 21 | +# CHECK: OpNegateRAState |
| 22 | +# CHECK-NEXT: autiasp |
| 23 | +# CHECK-NEXT: OpNegateRAState |
| 24 | +# CHECK-NEXT: ret |
| 25 | + |
| 26 | +# CHECK: autiasp |
| 27 | +# CHECK-NEXT: OpNegateRAState |
| 28 | +# CHECK-NEXT: ret |
| 29 | + |
| 30 | +# End of the insert-negate-ra-state-pass logs |
| 31 | +# CHECK: Binary Function "foo" after finalize-functions |
| 32 | + |
| 33 | + .text |
| 34 | + .globl foo |
| 35 | + .type foo, %function |
| 36 | +foo: |
| 37 | +.cfi_startproc |
| 38 | +.entry_bb: |
| 39 | + paciasp |
| 40 | + .cfi_negate_ra_state // indicating that paciasp changed the RA state to signed |
| 41 | +# FDATA: 1 foo #.entry_bb# 10 |
| 42 | + cmp x0, #0 |
| 43 | + b.eq .Lcold_bb1 |
| 44 | + autiasp |
| 45 | + .cfi_negate_ra_state // indicating that autiasp changed the RA state to unsigned |
| 46 | + ret |
| 47 | + .cfi_negate_ra_state // ret has unsigned RA state, but the next inst (autiasp) has signed RA state |
| 48 | +.Lcold_bb1: |
| 49 | + autiasp |
| 50 | + .cfi_negate_ra_state // indicating that autiasp changed the RA state to unsigned |
| 51 | + ret |
| 52 | +.cfi_endproc |
| 53 | + .size foo, .-foo |
| 54 | + |
| 55 | +## Force relocation mode. |
| 56 | +.reloc 0, R_AARCH64_NONE |
0 commit comments