xref: /llvm-project/bolt/test/X86/dwarf5-call-pc.test (revision 6aad62cf5b7f91f4b02266cf72469e2c8e28dbef)
1# REQUIRES: system-linux
2
3# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-call-pc-main.s -o %tmain.o
4# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-call-pc-helper.s -o %thelper.o
5# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
6# RUN: llvm-bolt %t.exe -o %t.exe.bolt --update-debug-sections -reorder-blocks=reverse --debug-thread-count=4 --cu-processing-batch-size=4
7# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe > %tmain.txt
8# RUN: llvm-objdump %t.exe --disassemble >> %tmain.txt
9# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe.bolt > %tmainbolt.txt
10# RUN: llvm-objdump %t.exe.bolt --disassemble >> %tmainbolt.txt
11# RUN: cat %tmain.txt | FileCheck --check-prefix=PRECHECK %s
12# RUN: cat %tmainbolt.txt | FileCheck --check-prefix=POSTCHECK %s
13
14## Test checks that DW_AT_call_pc address points to a correct address for jmp instruction.
15
16# PRECHECK: DW_TAG_call_site [6]
17# PRECHECK-NEXT: DW_AT_call_origin [DW_FORM_ref4]
18# PRECHECK-NEXT: DW_AT_call_tail_call
19# PRECHECK-NEXT: DW_AT_call_pc [DW_FORM_addrx]
20# PRECHECK-SAME: address = 0x[[#%x,ADDR:]])
21# PRECHECK: [[#ADDR]]:
22# PRECHECK-SAME: jmp
23
24# POSTCHECK: DW_TAG_call_site [6]
25# POSTCHECK-NEXT: DW_AT_call_origin [DW_FORM_ref4]
26# POSTCHECK-NEXT: DW_AT_call_tail_call
27# POSTCHECK-NEXT: DW_AT_call_pc [DW_FORM_addrx]
28# POSTCHECK-SAME: address = 0x[[#%x,ADDR:]])
29# POSTCHECK: <main>:
30# POSTCHECK: [[#ADDR]]:
31# POSTCHECK-SAME: jmp
32