30 lines · plain
1## Verify that BOLT does not crash while encountering instruction sequence that2## does not perfectly match jump table pattern.3 4# REQUIRES: system-linux5 6# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o7# RUN: %clang %cflags --target=aarch64-unknown-linux %t.o -o %t.exe -Wl,-q8# RUN: llvm-bolt %t.exe -o %t.bolt --print-cfg 2>&1 | FileCheck %s9 10 .section .text11 .align 412 .globl _start13 .type _start, %function14_start:15 sub w0, w0, #0x4a16## The address loaded into x22 is undefined. However, the instructions that17## follow ldr, use the x22 address as a regular jump table.18 ldr x22, [x29, #0x98]19 ldrb w0, [x22, w0, uxtw]20 adr x1, #1221 add x0, x1, w0, sxtb #222 br x023# CHECK: br x0 # UNKNOWN24.L0:25 ret26.size _start, .-_start27 28## Force relocation mode.29 .reloc 0, R_AARCH64_NONE30