|
1 | 1 | ; RUN: llc -dwarf-version=5 -split-dwarf-file=foo.dwo -O0 %s -mtriple=riscv64-unknown-linux-gnu -filetype=obj -o %t |
2 | 2 | ; RUN: llvm-dwarfdump -v %t | FileCheck --check-prefix=DWARF5 %s |
3 | 3 | ; RUN: llvm-dwarfdump --debug-info %t 2> %t.txt |
4 | | -; RUN: FileCheck --input-file=%t.txt %s --check-prefix=RELOCS --implicit-check-not=warning: |
| 4 | +; RUN: FileCheck --input-file=%t.txt %s --check-prefix=RELOCS --allow-empty --implicit-check-not=warning: |
5 | 5 |
|
6 | 6 | ; RUN: llc -dwarf-version=4 -split-dwarf-file=foo.dwo -O0 %s -mtriple=riscv64-unknown-linux-gnu -filetype=obj -o %t |
7 | 7 | ; RUN: llvm-dwarfdump -v %t | FileCheck --check-prefix=DWARF4 %s |
8 | 8 | ; RUN: llvm-dwarfdump --debug-info %t 2> %t.txt |
9 | | -; RUN: FileCheck --input-file=%t.txt %s --check-prefix=RELOCS --implicit-check-not=warning: |
| 9 | +; RUN: FileCheck --input-file=%t.txt %s --check-prefix=RELOCS --allow-empty --implicit-check-not=warning: |
| 10 | +; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s |
10 | 11 |
|
11 | 12 | ; In the RISC-V architecture, the .text section is subject to |
12 | 13 | ; relaxation, meaning the start address of each function can change |
|
49 | 50 |
|
50 | 51 | ; clang -g -S -gsplit-dwarf --target=riscv64 -march=rv64gc -O0 relax_dwo_ranges.cpp |
51 | 52 |
|
52 | | -; Currently, square() still uses an offset to represent the function's end address, |
53 | | -; which requires a relocation here. |
54 | | -; RELOCS: warning: unexpected relocations for dwo section '.debug_info.dwo' |
| 53 | +; RELOCS-NOT: warning: unexpected relocations for dwo section '.debug_info.dwo' |
55 | 54 |
|
| 55 | +; Make sure we don't produce any relocations in any .dwo section |
| 56 | +; HDR-NOT: .rela.{{.*}}.dwo |
| 57 | + |
| 58 | +; Ensure that 'square()' function uses indexed start and end addresses |
56 | 59 | ; DWARF5: .debug_info.dwo contents: |
57 | 60 | ; DWARF5: DW_TAG_subprogram |
58 | | -; DWARF5-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000000 ".text") |
59 | | -; DWARF5-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x00000000) |
| 61 | +; DWARF5-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000000 ".text") |
| 62 | +; DWARF5-NEXT: DW_AT_high_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000000044 ".text") |
60 | 63 | ; DWARF5: DW_AT_name {{.*}} "square") |
61 | 64 | ; DWARF5: DW_TAG_formal_parameter |
62 | 65 |
|
| 66 | +; HDR-NOT: .rela.{{.*}}.dwo |
| 67 | + |
63 | 68 | ; Ensure there is no unnecessary addresses in .o file |
64 | 69 | ; DWARF5: .debug_addr contents: |
65 | 70 | ; DWARF5: Addrs: [ |
66 | 71 | ; DWARF5-NEXT: 0x0000000000000000 |
| 72 | +; DWARF5-NEXT: 0x0000000000000044 |
67 | 73 | ; DWARF5-NEXT: 0x0000000000000046 |
68 | 74 | ; DWARF5-NEXT: 0x000000000000006c |
69 | 75 | ; DWARF5-NEXT: 0x00000000000000b0 |
70 | 76 | ; DWARF5-NEXT: ] |
71 | 77 |
|
| 78 | +; HDR-NOT: .rela.{{.*}}.dwo |
| 79 | + |
72 | 80 | ; Ensure that 'boo()' and 'main()' use DW_RLE_startx_length and DW_RLE_startx_endx |
73 | 81 | ; entries respectively |
74 | 82 | ; DWARF5: .debug_rnglists.dwo contents: |
75 | 83 | ; DWARF5: ranges: |
76 | | -; DWARF5-NEXT: 0x00000014: [DW_RLE_startx_length]: 0x0000000000000001, 0x0000000000000024 => [0x0000000000000046, 0x000000000000006a) |
| 84 | +; DWARF5-NEXT: 0x00000014: [DW_RLE_startx_length]: 0x0000000000000002, 0x0000000000000024 => [0x0000000000000046, 0x000000000000006a) |
77 | 85 | ; DWARF5-NEXT: 0x00000017: [DW_RLE_end_of_list ] |
78 | | -; DWARF5-NEXT: 0x00000018: [DW_RLE_startx_endx ]: 0x0000000000000002, 0x0000000000000003 => [0x000000000000006c, 0x00000000000000b0) |
| 86 | +; DWARF5-NEXT: 0x00000018: [DW_RLE_startx_endx ]: 0x0000000000000003, 0x0000000000000004 => [0x000000000000006c, 0x00000000000000b0) |
79 | 87 | ; DWARF5-NEXT: 0x0000001b: [DW_RLE_end_of_list ] |
80 | 88 | ; DWARF5-EMPTY: |
81 | 89 |
|
| 90 | +; HDR-NOT: .rela.{{.*}}.dwo |
| 91 | + |
82 | 92 | ; DWARF4: .debug_info.dwo contents: |
83 | 93 | ; DWARF4: DW_TAG_subprogram |
84 | | -; DWARF4-NEXT: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000000) address = 0x0000000000000000 ".text") |
85 | | -; DWARF4-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x00000000) |
| 94 | +; DWARF4-NEXT: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000000) address = 0x0000000000000000 ".text") |
| 95 | +; DWARF4-NEXT: DW_AT_high_pc [DW_FORM_GNU_addr_index] (indexed (00000001) address = 0x0000000000000044 ".text") |
86 | 96 | ; DWARF4: DW_AT_name {{.*}} "square") |
87 | 97 |
|
88 | 98 | ; DWARF4: DW_TAG_subprogram |
89 | | -; DWARF4-NEXT: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000001) address = 0x0000000000000046 ".text") |
| 99 | +; DWARF4-NEXT: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000002) address = 0x0000000000000046 ".text") |
90 | 100 | ; DWARF4-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x00000024) |
91 | 101 | ; DWARF4: DW_AT_name {{.*}} "boo") |
92 | 102 |
|
93 | 103 | ; DWARF4: DW_TAG_subprogram |
94 | | -; DWARF4-NEXT: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000002) address = 0x000000000000006c ".text") |
95 | | -; DWARF4-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x00000000) |
| 104 | +; DWARF4-NEXT: DW_AT_low_pc [DW_FORM_GNU_addr_index] (indexed (00000003) address = 0x000000000000006c ".text") |
| 105 | +; DWARF4-NEXT: DW_AT_high_pc [DW_FORM_GNU_addr_index] (indexed (00000004) address = 0x00000000000000b0 ".text") |
96 | 106 | ; DWARF4: DW_AT_name {{.*}} "main") |
97 | 107 |
|
| 108 | +; HDR-NOT: .rela.{{.*}}.dwo |
| 109 | + |
98 | 110 | ; Ensure there is no unnecessary addresses in .o file |
99 | 111 | ; DWARF4: .debug_addr contents: |
100 | 112 | ; DWARF4: Addrs: [ |
101 | 113 | ; DWARF4-NEXT: 0x0000000000000000 |
| 114 | +; DWARF4-NEXT: 0x0000000000000044 |
102 | 115 | ; DWARF4-NEXT: 0x0000000000000046 |
103 | 116 | ; DWARF4-NEXT: 0x000000000000006c |
| 117 | +; DWARF4-NEXT: 0x00000000000000b0 |
104 | 118 | ; DWARF4-NEXT: ] |
105 | 119 |
|
| 120 | +; HDR-NOT: .rela.{{.*}}.dwo |
| 121 | + |
106 | 122 | ; Function Attrs: mustprogress noinline optnone |
107 | 123 | define dso_local noundef signext i32 @_Z6squarei(i32 noundef signext %0) #0 !dbg !11 { |
108 | 124 | %2 = alloca i32, align 4 |
|
0 commit comments