brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 14d2c38 Raw
79 lines · plain
1# This test checks that MarkRAStates pass ignores functions with2# malformed .cfi_negate_ra_state sequences in the input binary.3 4# The cases checked are:5#   - extra .cfi_negate_ra_state in Signed state: checked in foo,6#   - extra .cfi_negate_ra_state in Unsigned state: checked in bar,7#   - missing .cfi_negate_ra_state from PSign or PAuth instructions: checked in baz.8 9# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o10# RUN: %clang %cflags  %t.o -o %t.exe -Wl,-q11# RUN: llvm-bolt %t.exe -o %t.exe.bolt --no-threads | FileCheck %s --check-prefix=CHECK-BOLT12 13# CHECK-BOLT: BOLT-INFO: inconsistent RAStates in function foo: ptr authenticating inst encountered in Unsigned RA state14# CHECK-BOLT: BOLT-INFO: inconsistent RAStates in function bar: ptr signing inst encountered in Signed RA state15# CHECK-BOLT: BOLT-INFO: inconsistent RAStates in function baz: ptr sign/auth inst without .cfi_negate_ra_state16 17# Check that the incorrect functions got ignored, so they are not in the new .text section18# RUN: llvm-objdump %t.exe.bolt -d -j .text | FileCheck %s --check-prefix=CHECK-OBJDUMP19# CHECK-OBJDUMP-NOT: <foo>:20# CHECK-OBJDUMP-NOT: <bar>:21# CHECK-OBJDUMP-NOT: <baz>:22 23 24  .text25  .globl  foo26  .p2align        227  .type   foo,@function28foo:29  .cfi_startproc30  hint    #2531  .cfi_negate_ra_state32  mov x1, #033  .cfi_negate_ra_state        // Incorrect CFI in signed state34  hint    #2935  .cfi_negate_ra_state36  ret37  .cfi_endproc38  .size   foo, .-foo39 40  .text41  .globl  bar42  .p2align        243  .type   bar,@function44bar:45  .cfi_startproc46  mov x1, #047  .cfi_negate_ra_state      // Incorrect CFI in unsigned state48  hint    #2549  .cfi_negate_ra_state50  mov x1, #051  hint    #2952  .cfi_negate_ra_state53  ret54  .cfi_endproc55  .size   bar, .-bar56 57  .text58  .globl  baz59  .p2align        260  .type   baz,@function61baz:62  .cfi_startproc63  mov x1, #064  hint    #2565  .cfi_negate_ra_state66  mov x1, #067  hint    #2968                            // Missing .cfi_negate_ra_state69  ret70  .cfi_endproc71  .size   baz, .-baz72 73  .global _start74  .type _start, %function75_start:76  b foo77  b bar78  b baz79