xref: /llvm-project/llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-labels-exec.test (revision 71e2ca6e32105b35aeadeab25010e8f999c47c23)
1## Show which labels are printed in disassembly of an executable.
2
3# RUN: yaml2obj %s -o %t
4# RUN: llvm-objdump %t -d | FileCheck %s --implicit-check-not=stt_section \
5# RUN:                                   --implicit-check-not=fourth \
6# RUN:                                   --implicit-check-not=absolute \
7# RUN:                                   --implicit-check-not=other
8
9# Match this line so the implicit check-nots don't match the path.
10# CHECK: {{^.*}}file format elf64-x86-64
11
12# CHECK:     0000000000004000 <first>:
13# CHECK:     0000000000004001 <second>:
14# CHECK:     0000000000004002 <third>:
15
16--- !ELF
17FileHeader:
18  Class:   ELFCLASS64
19  Data:    ELFDATA2LSB
20  Type:    ET_EXEC
21  Machine: EM_X86_64
22Sections:
23  - Name:    .text
24    Type:    SHT_PROGBITS
25    Address: 0x4000
26    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
27    Content: '9090909090'
28  - Name:    .text2
29    Type:    SHT_PROGBITS
30    Address: 0x4004
31    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
32    Size:    0
33Symbols:
34  - Name:    first # Shows, with second, that symbol sizes are not used to delineate functions.
35    Value:   0x4000
36    Section: .text
37    Size:    0x2
38  - Name:    second
39    Value:   0x4001
40    Size:    0x1
41    Section: .text
42  - Name:    third # Shows, with fourth, that first symbol is picked.
43    Value:   0x4002
44    Section: .text
45  - Name:    fourth
46    Value:   0x4002
47    Section: .text
48  - Name:    stt_section # Shows that STT_SECTION symbols are ignored even if no other symbol present.
49    Value:   0x4003
50    Type:    STT_SECTION
51    Section: .text
52  - Name:    absolute # Show that absolute symbols are ignored.
53    Value:   0x4004
54    Index:   SHN_ABS
55  - Name:    other # Show that symbols from other sections are ignored.
56    Value:   0x4004
57    Section: .text2
58