1 ## This test checks how we handle the --bb-addr-map option on relocatable
4 ## Fails on windows (https://github.com/llvm/llvm-project/issues/60013).
5 # UNSUPPORTED: system-windows
7 # RUN: yaml2obj %s -o %t1.o
8 # RUN: llvm-readobj %t1.o --bb-addr-map | FileCheck %s
11 # CHECK-NEXT: Function {
13 # CHECK-NEXT: Name: <?>
14 # CHECK-NEXT: BB entries [
17 # CHECK-NEXT: Offset: 0x0
18 # CHECK-NEXT: Size: 0xF
19 # CHECK-NEXT: HasReturn: Yes
20 # CHECK-NEXT: HasTailCall: No
21 # CHECK-NEXT: IsEHPad: No
22 # CHECK-NEXT: CanFallThrough: No
23 # CHECK-NEXT: HasIndirectBranch: No
27 # CHECK-NEXT: Function {
28 # CHECK-NEXT: At: 0x10
29 # CHECK-NEXT: Name: <?>
30 # CHECK-NEXT: BB entries [
33 # CHECK-NEXT: Offset: 0x0
34 # CHECK-NEXT: Size: 0x11
35 # CHECK-NEXT: HasReturn: No
36 # CHECK-NEXT: HasTailCall: No
37 # CHECK-NEXT: IsEHPad: No
38 # CHECK-NEXT: CanFallThrough: Yes
39 # CHECK-NEXT: HasIndirectBranch: No
54 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
55 - Name: .llvm_bb_addr_map
56 Type: SHT_LLVM_BB_ADDR_MAP
71 - Name: .rela.llvm_bb_addr_map
73 Flags: [ SHF_INFO_LINK ]
75 Info: .llvm_bb_addr_map
95 ## Check that if we have a relocatable file and no relocation section for
96 ## a SHT_LLVM_BB_ADDR_MAP section, we give the appropriate warnings.
107 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
108 - Name: .llvm_bb_addr_map
109 Type: SHT_LLVM_BB_ADDR_MAP
112 # RUN: yaml2obj %s --docnum=2 -o %t2.o
113 # RUN: llvm-readobj %t2.o --bb-addr-map 2>&1 | FileCheck %s --check-prefix=NO-RELA -DFILE=%t2.o
115 # NO-RELA: warning: '[[FILE]]': unable to get relocation section for SHT_LLVM_BB_ADDR_MAP section with index 2
117 ## Check that we get a warning if we expect a relocation and it is not present.
128 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
129 - Name: .llvm_bb_addr_map
130 Type: SHT_LLVM_BB_ADDR_MAP
139 - Name: .rela.llvm_bb_addr_map
141 Flags: [ SHF_INFO_LINK ]
142 Info: .llvm_bb_addr_map
144 # RUN: yaml2obj %s --docnum=3 -o %t3.o
145 # RUN: llvm-readobj %t3.o --bb-addr-map 2>&1 | FileCheck %s --check-prefix=MISSING-RELOCATION -DFILE=%t3.o
147 # MISSING-RELOCATION: warning: '[[FILE]]': unable to dump SHT_LLVM_BB_ADDR_MAP section with index 2: failed to get relocation data for offset: 2 in section SHT_LLVM_BB_ADDR_MAP section with index 2
149 ## Check that if we have a missing relocated section, we fail and give the
150 ## appropriate warning.
159 - Name: .rela.llvm_bb_addr_map
161 Flags: [ SHF_INFO_LINK ]
164 # RUN: yaml2obj %s --docnum=4 -o %t4.o
165 # RUN: llvm-readobj %t4.o --bb-addr-map 2>&1 | FileCheck %s --check-prefix=NO-RELOCATED-SECTION -DFILE=%t4.o
167 # NO-RELOCATED-SECTION: warning: '[[FILE]]': failed to get SHT_LLVM_BB_ADDR_MAP section(s): SHT_RELA section with index 1: failed to get a relocated section: invalid section index: 255
169 ## Check that if we have an ET_DYN file with a .rela.dyn section, we don't get
170 ## a warning about a missing relocation section and can get the baddrmap data.
182 - Name: .llvm_bb_addr_map
183 Type: SHT_LLVM_BB_ADDR_MAP
184 Flags: [ SHF_LINK_ORDER ]
194 # RUN: yaml2obj %s --docnum=5 -o %t5.o
195 # RUN: llvm-readobj %t5.o --bb-addr-map 2>&1 | FileCheck %s --check-prefix=ET-DYN-NO-WARNING -DFILE=%t5.o
197 # ET-DYN-NO-WARNING: BBAddrMap [
198 # ET-DYN-NO-WARNING: Function {
199 # ET-DYN-NO-WARNING: At: 0xF
200 # ET-DYN-NO-WARNING: Name: <?>
201 # ET-DYN-NO-WARNING: BB entries [
202 # ET-DYN-NO-WARNING: {
203 # ET-DYN-NO-WARNING: ID: 0
204 # ET-DYN-NO-WARNING: Offset: 0x0
205 # ET-DYN-NO-WARNING: Size: 0xF
206 # ET-DYN-NO-WARNING: HasReturn: Yes
207 # ET-DYN-NO-WARNING: HasTailCall: No
208 # ET-DYN-NO-WARNING: IsEHPad: No
209 # ET-DYN-NO-WARNING: CanFallThrough: No
210 # ET-DYN-NO-WARNING: HasIndirectBranch: No
211 # ET-DYN-NO-WARNING: }
212 # ET-DYN-NO-WARNING: ]
213 # ET-DYN-NO-WARNING: }
214 # ET-DYN-NO-WARNING: ]