1 # The second and third ADR instructions are non-local to functions
2 # and must be replaced with ADRP + ADD by BOLT
3 # Also since main is non-simple, we can't change it's length so we have to
4 # replace NOP with adrp, and if there is no nop before adr in non-simple
5 # function, we can't guarantee we didn't break possible jump tables, so we
8 # REQUIRES: system-linux
10 # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
12 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
13 # RUN: llvm-bolt %t.exe -o %t.bolt --adr-relaxation=true
14 # RUN: llvm-objdump --no-print-imm-hex -d --disassemble-symbols=main %t.bolt | FileCheck %s
16 # RUN: not llvm-bolt %t.exe -o %t.bolt --adr-relaxation=true --strict \
17 # RUN: 2>&1 | FileCheck %s --check-prefix CHECK-ERROR
51 # CHECK-NEXT: adr x0, 0x{{[1-8a-f][0-9a-f]*}}
52 # CHECK-NEXT: adrp x1, 0x{{[1-8a-f][0-9a-f]*}}
53 # CHECK-NEXT: add x1, x1, #{{[1-8a-f][0-9a-f]*}}
54 # CHECK-NEXT: adrp x2, 0x{{[1-8a-f][0-9a-f]*}}
55 # CHECK-NEXT: add x2, x2, #{{[1-8a-f][0-9a-f]*}}
56 # CHECK-NEXT: adr x3, 0x{{[1-8a-f][0-9a-f]*}}
57 # CHECK-ERROR: BOLT-ERROR: Cannot relax adr in non-simple function main