1 # REQUIRES: system-linux
3 # RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-cross-cu-with-loclist.s -o %t.o
4 # RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-loclist.s -o %t1.o
5 # RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-two-entries-loclist.s -o %t2.o
6 # RUN: %clang %cflags %t1.o %t2.o %t.o -o %t.exe
7 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
8 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
9 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=POSTCHECK %s
11 # Tests that BOLT correctly handles location list with DWARF5/DWARF4 when order of CUs is not the same as in input.
13 # PRECHECK: version = 0x0005
14 # PRECHECK: version = 0x0004
15 # PRECHECK: version = 0x0004
16 # PRECHECK: version = 0x0004
18 # POSTCHECK: version = 0x0004
19 # POSTCHECK: DW_TAG_formal_parameter
20 # POSTCHECK-NEXT: DW_AT_location
21 # POSTCHECK-NEXT: DW_AT_name
22 # POSTCHECK-NEXT: DW_AT_decl_file
23 # POSTCHECK-NEXT: DW_AT_decl_line
24 # POSTCHECK-NEXT: DW_AT_type [DW_FORM_ref_addr]
25 # POSTCHECK-SAME: "int")
27 # POSTCHECK: DW_TAG_variable
28 # POSTCHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]
29 # POSTCHECK-NEXT: [0x[[#%.16x,ADDR1:]]
30 # POSTCHECK-SAME: 0x[[#ADDR1 + 0x8]]):
31 # POSTCHECK-SAME: DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit3, DW_OP_stack_value, DW_OP_piece 0x4)
33 # POSTCHECK: version = 0x0004
34 # POSTCHECK: DW_TAG_variable
35 # POSTCHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]
36 # POSTCHECK-NEXT: [0x[[#%.16x,ADDR2:]]
37 # POSTCHECK-SAME: 0x[[#ADDR2 + 0x4]]):
38 # POSTCHECK-SAME: DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit3, DW_OP_stack_value, DW_OP_piece 0x4)
40 # POSTCHECK: version = 0x0005
41 # POSTCHECK: DW_TAG_variable
42 # POSTCHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x0) loclist
43 # POSTCHECK-NEXT: [0x[[#%.16x,ADDR3:]]
44 # POSTCHECK-SAME: 0x[[#ADDR3 + 0x4]]):
45 # POSTCHECK-SAME: DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit3, DW_OP_stack_value, DW_OP_piece 0x4)
47 # POSTCHECK: version = 0x0004
48 # POSTCHECK: DW_TAG_formal_parameter
49 # POSTCHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]
50 # POSTCHECK-NEXT: [0x[[#%.16x,ADDR4:]]
51 # POSTCHECK-SAME: 0x[[#ADDR4 + 0x8]]): DW_OP_reg5 RDI
52 # POSTCHECK-NEXT: [0x[[#%.16x,ADDR5:]]
53 # POSTCHECK-SAME: 0x[[#ADDR5 + 0x16]]): DW_OP_GNU_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)
54 # POSTCHECK: DW_TAG_formal_parameter
55 # POSTCHECK: DW_TAG_formal_parameter
56 # POSTCHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]
57 # POSTCHECK-NEXT: [0x[[#%.16x,ADDR6:]]
58 # POSTCHECK-SAME: 0x[[#ADDR6 + 0x8]]): DW_OP_reg5 RDI
59 # POSTCHECK-NEXT: [0x[[#%.16x,ADDR7:]]
60 # POSTCHECK-SAME: 0x[[#ADDR7 + 0x16]]): DW_OP_GNU_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)