xref: /llvm-project/bolt/test/X86/dwarf5-call-pc.test (revision 6aad62cf5b7f91f4b02266cf72469e2c8e28dbef)
111a8dd65SAlexander Yermolovich# REQUIRES: system-linux
211a8dd65SAlexander Yermolovich
311a8dd65SAlexander Yermolovich# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-call-pc-main.s -o %tmain.o
411a8dd65SAlexander Yermolovich# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-call-pc-helper.s -o %thelper.o
511a8dd65SAlexander Yermolovich# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
6*6aad62cfSSayhaan Siddiqui# RUN: llvm-bolt %t.exe -o %t.exe.bolt --update-debug-sections -reorder-blocks=reverse --debug-thread-count=4 --cu-processing-batch-size=4
711a8dd65SAlexander Yermolovich# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe > %tmain.txt
811a8dd65SAlexander Yermolovich# RUN: llvm-objdump %t.exe --disassemble >> %tmain.txt
911a8dd65SAlexander Yermolovich# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe.bolt > %tmainbolt.txt
1011a8dd65SAlexander Yermolovich# RUN: llvm-objdump %t.exe.bolt --disassemble >> %tmainbolt.txt
1111a8dd65SAlexander Yermolovich# RUN: cat %tmain.txt | FileCheck --check-prefix=PRECHECK %s
1211a8dd65SAlexander Yermolovich# RUN: cat %tmainbolt.txt | FileCheck --check-prefix=POSTCHECK %s
1311a8dd65SAlexander Yermolovich
1411791ae7SSayhaan Siddiqui## Test checks that DW_AT_call_pc address points to a correct address for jmp instruction.
1511a8dd65SAlexander Yermolovich
1611a8dd65SAlexander Yermolovich# PRECHECK: DW_TAG_call_site [6]
1711a8dd65SAlexander Yermolovich# PRECHECK-NEXT: DW_AT_call_origin [DW_FORM_ref4]
1811a8dd65SAlexander Yermolovich# PRECHECK-NEXT: DW_AT_call_tail_call
1911a8dd65SAlexander Yermolovich# PRECHECK-NEXT: DW_AT_call_pc [DW_FORM_addrx]
2011a8dd65SAlexander Yermolovich# PRECHECK-SAME: address = 0x[[#%x,ADDR:]])
2111a8dd65SAlexander Yermolovich# PRECHECK: [[#ADDR]]:
2211a8dd65SAlexander Yermolovich# PRECHECK-SAME: jmp
2311a8dd65SAlexander Yermolovich
2411a8dd65SAlexander Yermolovich# POSTCHECK: DW_TAG_call_site [6]
2511a8dd65SAlexander Yermolovich# POSTCHECK-NEXT: DW_AT_call_origin [DW_FORM_ref4]
2611a8dd65SAlexander Yermolovich# POSTCHECK-NEXT: DW_AT_call_tail_call
2711a8dd65SAlexander Yermolovich# POSTCHECK-NEXT: DW_AT_call_pc [DW_FORM_addrx]
2811a8dd65SAlexander Yermolovich# POSTCHECK-SAME: address = 0x[[#%x,ADDR:]])
2911a8dd65SAlexander Yermolovich# POSTCHECK: <main>:
3011a8dd65SAlexander Yermolovich# POSTCHECK: [[#ADDR]]:
3111a8dd65SAlexander Yermolovich# POSTCHECK-SAME: jmp
32