[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / X86 / double-rel-scan.s
bloba8318d3c118624bd33c05e08b73c0d45451370d5
1 ## Check that BOLT can correctly use relocations to symbolize instruction
2 ## operands when an instruction can have up to two relocations associated
3 ## with it. The test checks that the update happens in the function that
4 ## is not being optimized/relocated by BOLT.
6 # REQUIRES: system-linux
8 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
9 # RUN: ld.lld %t.o -o %t.exe -q --Ttext=0x80000
10 # RUN: llvm-bolt %t.exe --relocs -o %t.bolt --funcs=foo
11 # RUN: llvm-objdump -d --print-imm-hex %t.exe \
12 # RUN: | FileCheck %s
13 # RUN: llvm-objdump -d --print-imm-hex %t.bolt \
14 # RUN: | FileCheck %s --check-prefix=CHECK-POST-BOLT
16 .text
17 .globl foo
18 .type foo,@function
19 foo:
20 .cfi_startproc
21 ret
22 .cfi_endproc
23 .size foo, .-foo
26 .text
27 .globl _start
28 .type _start,@function
29 _start:
30 .cfi_startproc
32 ## All four MOV instructions below are identical in the input binary, but
33 ## different from each other after BOLT.
35 ## foo value is 0x80000 pre-BOLT. Using relocations, llvm-bolt should correctly
36 ## symbolize 0x80000 instruction operand and differentiate between an immediate
37 ## constant 0x80000 and a reference to foo. When foo is relocated, BOLT should
38 ## update references even from the code that is not being updated.
40 # CHECK: 80000 <foo>:
42 # CHECK: <_start>:
43 # CHECK-POST-BOLT: <_start>:
45 movq $0x80000, 0x80000
46 # CHECK-NEXT: movq $0x80000, 0x80000
47 # CHECK-POST-BOLT-NEXT: movq $0x80000, 0x80000
49 movq $foo, 0x80000
50 # CHECK-NEXT: movq $0x80000, 0x80000
51 # CHECK-POST-BOLT-NEXT: movq $0x[[#%x,ADDR:]], 0x80000
53 movq $0x80000, foo
54 # CHECK-NEXT: movq $0x80000, 0x80000
55 # CHECK-POST-BOLT-NEXT: movq $0x80000, 0x[[#ADDR]]
57 movq $foo, foo
58 # CHECK-NEXT: movq $0x80000, 0x80000
59 # CHECK-POST-BOLT-NEXT: movq $0x[[#ADDR]], 0x[[#ADDR]]
61 ## After BOLT, foo is relocated after _start.
63 # CHECK-POST-BOLT: [[#ADDR]] <foo>:
65 retq
66 .size _start, .-_start
67 .cfi_endproc