266 lines · yaml
1## Test that in the presence of SHT_LLVM_BB_ADDR_MAP sections,2## --symbolize-operands can display <BB*> labels.3 4## Executable object file with separate SHT_LLVM_BB_ADDR_MAP sections for multiple text sections.5## RUN: yaml2obj --docnum=1 %s -o %t16## RUN: llvm-objdump %t1 -d --symbolize-operands -M intel --no-show-raw-insn --no-leading-addr | \7## RUN: FileCheck %s --match-full-lines --check-prefixes=INTEL8## RUN: llvm-objdump %t1 -d --symbolize-operands -M att --no-show-raw-insn --no-leading-addr | \9## RUN: FileCheck %s --match-full-lines --check-prefixes=ATT10 11## Executable object file with a single SHT_LLVM_BB_ADDR_MAP for multiple text sections.12# RUN: yaml2obj --docnum=2 %s -o %t213# RUN: llvm-objdump %t2 -d --symbolize-operands -M intel --no-show-raw-insn --no-leading-addr | \14# RUN: FileCheck %s --match-full-lines --check-prefixes=INTEL15# RUN: llvm-objdump %t2 -d --symbolize-operands -M att --no-show-raw-insn --no-leading-addr | \16# RUN: FileCheck %s --match-full-lines --check-prefixes=ATT17 18## Expect to find the branch and basic block labels and global variable name.19# ATT: <foo>:20# ATT-NEXT: <BB3>:21# ATT-NEXT: pushq %rax22# ATT-NEXT: <BB1>:23# ATT-NEXT: cmpl , %eax <symbol>24# ATT-NEXT: nop25# ATT-NEXT: <BB2>:26# ATT-NEXT: jge <BB5>27# ATT-NEXT: jmp <BB1>28# ATT-NEXT: <BB4>:29# ATT-NEXT: jge <foo.cold>30# ATT-NEXT: <BB5>:31# ATT-NEXT: retq32# ATT: <bar>:33# ATT-NEXT: <BB0>:34# ATT-NEXT: pushq %rax35# ATT-NEXT: movl %edx, %eax36# ATT-NEXT: je <BB4>37# ATT-NEXT: <BB2>:38# ATT-NEXT: xorl %esi, %esi39# ATT-NEXT: <BB4>:40# ATT-NEXT: callq <bar>41# ATT-NEXT: retq42# ATT: <foo.cold>:43# ATT-NEXT: <BB6>:44# ATT-NEXT: retq45 46# INTEL: <foo>:47# INTEL-NEXT: <BB3>:48# INTEL-NEXT: push rax49# INTEL-NEXT: <BB1>:50# INTEL-NEXT: cmp eax, dword ptr <symbol>51# INTEL-NEXT: nop52# INTEL-NEXT: <BB2>:53# INTEL-NEXT: jge <BB5>54# INTEL-NEXT: jmp <BB1>55# INTEL-NEXT: <BB4>:56# INTEL-NEXT: jge <foo.cold>57# INTEL-NEXT: <BB5>:58# INTEL-NEXT: ret59# INTEL: <bar>:60# INTEL-NEXT: <BB0>:61# INTEL-NEXT: push rax62# INTEL-NEXT: mov eax, edx63# INTEL-NEXT: je <BB4>64# INTEL-NEXT: <BB2>:65# INTEL-NEXT: xor esi, esi66# INTEL-NEXT: <BB4>:67# INTEL-NEXT: call <bar>68# INTEL-NEXT: ret69# INTEL: <foo.cold>:70# INTEL-NEXT: <BB6>:71# INTEL-NEXT: ret72 73## This object file contains a separate text section and SHT_LLVM_BB_ADDR_MAP74## section for each of the two functions foo and bar.75## This is used to test --symbolize-operands on reloctable and non-relocotable76## object files.77--- !ELF78FileHeader:79 Class: ELFCLASS6480 Data: ELFDATA2LSB81 Type: ET_EXEC82 Machine: EM_X86_6483Sections:84 - Name: .text.foo85 Type: SHT_PROGBITS86 Address: 0x400087 Flags: [SHF_ALLOC, SHF_EXECINSTR]88 Content: '503b0505300000907d08ebf50f8dee1f0000c3'89 - Name: .text.bar90 Type: SHT_PROGBITS91 Address: 0x500092 Flags: [SHF_ALLOC, SHF_EXECINSTR]93 Content: '5089d0740231f6e8f4ffffffc3'94 - Name: .text.split95 Type: SHT_PROGBITS96 Address: 0x600097 Flags: [SHF_ALLOC, SHF_EXECINSTR]98 Content: 'c3'99 - Name: .data100 Type: SHT_PROGBITS101 Flags: [SHF_ALLOC, SHF_WRITE]102 Address: 0x7000103 - Name: .llvm_bb_addr_map.foo104 Type: SHT_LLVM_BB_ADDR_MAP105 Link: .text.foo106 Entries:107 - Version: 2108 Feature: 0x8109 BBRanges:110 - BaseAddress: 0x4000111 BBEntries:112 - ID: 3113 AddressOffset: 0x0114 Size: 0x1115 Metadata: 0x1116 - ID: 1117 AddressOffset: 0x0118 Size: 0x6119 Metadata: 0x0120 - ID: 2121 AddressOffset: 0x1122 Size: 0x4123 Metadata: 0x0124 - ID: 4125 AddressOffset: 0x0126 Size: 0x6127 Metadata: 0x1128 - ID: 5129 AddressOffset: 0x0130 Size: 0x1131 Metadata: 0x2132 - BaseAddress: 0x6000133 BBEntries:134 - ID: 6135 AddressOffset: 0x0136 Size: 0x1137 Metadata: 0x2138 - Name: .llvm_bb_addr_map.bar139 Type: SHT_LLVM_BB_ADDR_MAP140 Link: .text.bar141 Entries:142 - Version: 2143 BBRanges:144 - BaseAddress: 0x5000145 BBEntries:146 - ID: 0147 AddressOffset: 0x0148 Size: 0x1149 Metadata: 0x1150 - ID: 2151 AddressOffset: 0x4152 Size: 0x2153 Metadata: 0x0154 - ID: 4155 AddressOffset: 0x0156 Size: 0x6157 Metadata: 0x0158 159Symbols:160 - Name: foo161 Section: .text.foo162 Value: 0x4000163 - Name: foo.cold164 Section: .text.split165 Value: 0x6000166 - Name: bar167 Section: .text.bar168 Value: 0x5000169 - Name: symbol170 Section: .data171 Value: 0x700c172 173## This object file contains a single SHT_LLVM_BB_ADDR_MAP for two text174## sections .text.foo and .text.bar.175--- !ELF176FileHeader:177 Class: ELFCLASS64178 Data: ELFDATA2LSB179 Type: ET_EXEC180 Machine: EM_X86_64181Sections:182 - Name: .text.foo183 Type: SHT_PROGBITS184 Address: 0x4000185 Flags: [SHF_ALLOC, SHF_EXECINSTR]186 Content: '503b0505300000907d08ebf50f8dee1f0000c3'187 - Name: .text.bar188 Type: SHT_PROGBITS189 Address: 0x5000190 Flags: [SHF_ALLOC, SHF_EXECINSTR]191 Content: '5089d0740231f6e8f4ffffffc3'192 - Name: .text.split193 Type: SHT_PROGBITS194 Address: 0x6000195 Flags: [SHF_ALLOC, SHF_EXECINSTR]196 Content: 'c3'197 - Name: .data198 Type: SHT_PROGBITS199 Flags: [SHF_ALLOC, SHF_WRITE]200 Address: 0x7000201 - Name: .llvm_bb_addr_map.foo202 Type: SHT_LLVM_BB_ADDR_MAP203 Link: .text.foo204 Entries:205 - Version: 2206 Feature: 0x8207 BBRanges:208 - BaseAddress: 0x4000209 BBEntries:210 - ID: 3211 AddressOffset: 0x0212 Size: 0x1213 Metadata: 0x1214 - ID: 1215 AddressOffset: 0x0216 Size: 0x6217 Metadata: 0x0218 - ID: 2219 AddressOffset: 0x1220 Size: 0x4221 Metadata: 0x0222 - ID: 4223 AddressOffset: 0x0224 Size: 0x6225 Metadata: 0x1226 - ID: 5227 AddressOffset: 0x0228 Size: 0x1229 Metadata: 0x2230 - BaseAddress: 0x6000231 BBEntries:232 - ID: 6233 AddressOffset: 0x0234 Size: 0x1235 Metadata: 0x2236 - Version: 2237 BBRanges:238 - BaseAddress: 0x5000239 BBEntries:240 - ID: 0241 AddressOffset: 0x0242 Size: 0x1243 Metadata: 0x1244 - ID: 2245 AddressOffset: 0x4246 Size: 0x2247 Metadata: 0x0248 - ID: 4249 AddressOffset: 0x0250 Size: 0x6251 Metadata: 0x0252 253Symbols:254 - Name: foo255 Section: .text.foo256 Value: 0x4000257 - Name: foo.cold258 Section: .text.split259 Value: 0x6000260 - Name: bar261 Section: .text.bar262 Value: 0x5000263 - Name: symbol264 Section: .data265 Value: 0x700c266