## Test that in the presence of SHT_LLVM_BB_ADDR_MAP sections, ## --symbolize-operands can display labels. ## Fails on windows (https://github.com/llvm/llvm-project/issues/60013). # UNSUPPORTED: system-windows ## Executable object file. # RUN: yaml2obj --docnum=1 -DFOO_ADDR=0x4000 -DBAR_ADDR=0x5000 %s -o %t1 # RUN: llvm-objdump %t1 -d --symbolize-operands -M intel --no-show-raw-insn --no-leading-addr | \ # RUN: FileCheck %s -DSYM=symbol --match-full-lines --check-prefixes=INTEL # RUN: llvm-objdump %t1 -d --symbolize-operands -M att --no-show-raw-insn --no-leading-addr | \ # RUN: FileCheck %s -DSYM=symbol --match-full-lines --check-prefixes=ATT ## Executable object file with a single SHT_LLVM_BB_ADDR_MAP for multiple text sections. # RUN: yaml2obj --docnum=2 %s -o %t3 # RUN: llvm-objdump %t3 -d --symbolize-operands -M intel --no-show-raw-insn --no-leading-addr | \ # RUN: FileCheck %s -DSYM=symbol --match-full-lines --check-prefixes=INTEL # RUN: llvm-objdump %t3 -d --symbolize-operands -M att --no-show-raw-insn --no-leading-addr | \ # RUN: FileCheck %s -DSYM=symbol --match-full-lines --check-prefixes=ATT ## Expect to find the branch and basic block labels and global variable name. # ATT: : # ATT-NEXT: : # ATT-NEXT: pushq %rax # ATT-NEXT: : # ATT-NEXT: cmpl , %eax <[[SYM]]> # ATT-NEXT: nop # ATT-NEXT: : # ATT-NEXT: jge # ATT-NEXT: jmp # ATT-NEXT: : # ATT-NEXT: retq # ATT: : # ATT-NEXT: : # ATT-NEXT: pushq %rax # ATT-NEXT: movl %edx, %eax # ATT-NEXT: je # ATT-NEXT: : # ATT-NEXT: xorl %esi, %esi # ATT-NEXT: : # ATT-NEXT: callq # ATT-NEXT: retq # INTEL: : # INTEL-NEXT: : # INTEL-NEXT: push rax # INTEL-NEXT: : # INTEL-NEXT: cmp eax, dword ptr <[[SYM]]> # INTEL-NEXT: nop # INTEL-NEXT: : # INTEL-NEXT: jge # INTEL-NEXT: jmp # INTEL-NEXT: : # INTEL-NEXT: ret # INTEL: : # INTEL-NEXT: : # INTEL-NEXT: push rax # INTEL-NEXT: mov eax, edx # INTEL-NEXT: je # INTEL-NEXT: : # INTEL-NEXT: xor esi, esi # INTEL-NEXT: : # INTEL-NEXT: call # INTEL-NEXT: ret ## This object file contains a separate text section and SHT_LLVM_BB_ADDR_MAP ## section for each of the two functions foo and bar. ## This is used to test --symbolize-operands on reloctable and non-relocotable ## object files. --- !ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB Type: ET_EXEC Machine: EM_X86_64 Sections: - Name: .text.foo Type: SHT_PROGBITS Address: [[FOO_ADDR]] Flags: [SHF_ALLOC, SHF_EXECINSTR] Content: '503b0505200000907d02ebf5c3' - Name: .text.bar Type: SHT_PROGBITS Address: [[BAR_ADDR]] Flags: [SHF_ALLOC, SHF_EXECINSTR] Content: '5089d0740231f6e8f4ffffffc3' - Name: .data Type: SHT_PROGBITS Flags: [SHF_ALLOC, SHF_WRITE] Address: 0x6000 - Name: .llvm_bb_addr_map.foo Type: SHT_LLVM_BB_ADDR_MAP Link: .text.foo Entries: - Version: 2 Address: [[FOO_ADDR]] BBEntries: - ID: 3 AddressOffset: 0x0 Size: 0x1 Metadata: 0x1 - ID: 1 AddressOffset: 0x0 Size: 0x6 Metadata: 0x0 - ID: 2 AddressOffset: 0x1 Size: 0x4 Metadata: 0x0 - ID: 5 AddressOffset: 0x0 Size: 0x1 Metadata: 0x2 - Name: .llvm_bb_addr_map.bar Type: SHT_LLVM_BB_ADDR_MAP Link: .text.bar Entries: - Version: 1 Address: [[BAR_ADDR]] BBEntries: - AddressOffset: 0x0 Size: 0x1 Metadata: 0x1 - AddressOffset: 0x4 Size: 0x2 Metadata: 0x0 - AddressOffset: 0x0 Size: 0x6 Metadata: 0x0 Symbols: - Name: foo Section: .text.foo Value: [[FOO_ADDR]] - Name: bar Section: .text.bar Value: [[BAR_ADDR]] - Name: symbol Section: .data Value: 0x600c ## This object file contains a single SHT_LLVM_BB_ADDR_MAP for two text ## sections .text.foo and .text.bar. --- !ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB Type: ET_EXEC Machine: EM_X86_64 Sections: - Name: .text.foo Type: SHT_PROGBITS Address: 0x4000 Flags: [SHF_ALLOC, SHF_EXECINSTR] Content: '503b0505200000907d02ebf5c3' - Name: .text.bar Type: SHT_PROGBITS Address: 0x5000 Flags: [SHF_ALLOC, SHF_EXECINSTR] Content: '5089d0740231f6e8f4ffffffc3' - Name: .data Type: SHT_PROGBITS Flags: [SHF_ALLOC, SHF_WRITE] Address: 0x6000 - Name: .llvm_bb_addr_map.foo Type: SHT_LLVM_BB_ADDR_MAP Link: .text.foo Entries: - Version: 2 Address: 0x4000 BBEntries: - ID: 3 AddressOffset: 0x0 Size: 0x1 Metadata: 0x1 - ID: 1 AddressOffset: 0x0 Size: 0x6 Metadata: 0x0 - ID: 2 AddressOffset: 0x1 Size: 0x4 Metadata: 0x0 - ID: 5 AddressOffset: 0x0 Size: 0x1 Metadata: 0x2 - Version: 1 Address: 0x5000 BBEntries: - AddressOffset: 0x0 Size: 0x1 Metadata: 0x1 - AddressOffset: 0x4 Size: 0x2 Metadata: 0x0 - AddressOffset: 0x0 Size: 0x6 Metadata: 0x0 Symbols: - Name: foo Section: .text.foo Value: 0x4000 - Name: bar Section: .text.bar Value: 0x5000 - Name: symbol Section: .data Value: 0x600c