Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / AArch64 / r_aarch64_prelxx.s
blob444dee72b7c04eb0172c85b01979592d954ce840
1 // This test checks processing of R_AARCH64_PREL64/32/16 relocations
2 // S + A - P = Value
3 // S = P - A + Value
5 // REQUIRES: system-linux
7 // RUN: %clang %cflags -nostartfiles -nostdlib %s -o %t.exe -mlittle-endian \
8 // RUN: -Wl,-q -Wl,-z,max-page-size=4
9 // RUN: llvm-readelf -Wa %t.exe | FileCheck %s -check-prefix=CHECKPREL
11 // CHECKPREL: R_AARCH64_PREL16 {{.*}} .dummy + 0
12 // CHECKPREL-NEXT: R_AARCH64_PREL32 {{.*}} _start + 4
13 // CHECKPREL-NEXT: R_AARCH64_PREL64 {{.*}} _start + 8
15 // RUN: llvm-bolt %t.exe -o %t.bolt
16 // RUN: llvm-objdump -D %t.bolt | FileCheck %s --check-prefix=CHECKPREL32
18 // CHECKPREL32: [[#%x,DATATABLEADDR:]] <datatable>:
19 // CHECKPREL32-NEXT: 00:
20 // CHECKPREL32-NEXT: 04: {{.*}} .word 0x[[#%x,VALUE:]]
22 // 4 is offset in datatable
23 // 8 is addend
24 // CHECKPREL32: [[#DATATABLEADDR + 4 - 8 + VALUE]] <_start>:
26 // RUN: llvm-objdump -D %t.bolt | FileCheck %s --check-prefix=CHECKPREL64
27 // CHECKPREL64: [[#%x,DATATABLEADDR:]] <datatable>:
28 // CHECKPREL64-NEXT: 00:
29 // CHECKPREL64-NEXT: 04:
30 // CHECKPREL64-NEXT: 08: {{.*}} .word 0x[[#%x,VALUE:]]
31 // CHECKPREL64-NEXT: 0c: {{.*}} .word 0x00000000
33 // 8 is offset in datatable
34 // 12 is addend
35 // CHECKPREL64: [[#DATATABLEADDR + 8 - 12 + VALUE]] <_start>:
37 .section .text
38 .align 4
39 .globl _start
40 .type _start, %function
41 _start:
42 adr x0, datatable
43 mov x0, #0
44 ret
46 .section .dummy, "a", @progbits
47 dummy:
48 .word 0
50 .data
51 .align 8
52 datatable:
53 .hword dummy - datatable
54 .align 2
55 .word _start - datatable
56 .xword _start - datatable