xref: /llvm-project/llvm/test/tools/llvm-objdump/X86/elf-disassemble.test (revision d6d7f7b1d2639a06002779aed5dccf53fee20c6e)
1## Show that disassembly is printed correctly, for only the desired sections.
2# RUN: yaml2obj %s -o %t.o
3# RUN: llvm-objdump %t.o -d | FileCheck %s --implicit-check-not=Disassembly
4# RUN: llvm-objdump %t.o --disassemble-all | FileCheck %s --check-prefixes=CHECK,ALL
5
6## Show that disassembly is enabled by default for --traceback-table, even for non-XCOFF objects.
7# RUN: llvm-objdump %t.o --traceback-table  | FileCheck %s --implicit-check-not=Disassembly
8
9# CHECK:       Disassembly of section .executable:
10# CHECK-EMPTY:
11# CHECK-NEXT:  0000000000001000 <.executable>:
12# CHECK-NEXT:         0: 90                            nop
13# ALL-EMPTY:
14# ALL-NEXT:    Disassembly of section .writable:
15# ALL-EMPTY:
16# ALL-NEXT:    0000000000002000 <.writable>:
17# ALL-NEXT:           0: c3                            retq
18# ALL-EMPTY:
19# ALL-NEXT:    Disassembly of section .readonly:
20# ALL-EMPTY:
21# ALL-NEXT:    0000000000003000 <.readonly>:
22# ALL-NEXT:           0: 01 00                         addl    %eax, (%rax)
23# ALL-EMPTY:
24# ALL-NEXT:    Disassembly of section .nobits:
25# ALL-EMPTY:
26# ALL-NEXT:    0000000000004000 <.nobits>:
27# ALL-NEXT:    ...
28
29--- !ELF
30FileHeader:
31  Class:   ELFCLASS64
32  Data:    ELFDATA2LSB
33  Type:    ET_REL
34  Machine: EM_X86_64
35Sections:
36  - Name:    .executable
37    Type:    SHT_PROGBITS
38    Address: 0x1000
39    Flags:   [SHF_EXECINSTR]
40    Content: '90'
41  - Name:    .writable
42    Type:    SHT_PROGBITS
43    Address: 0x2000
44    Flags:   [SHF_WRITE]
45    Content: 'c3'
46  - Name:    .readonly
47    Type:    SHT_PROGBITS
48    Address: 0x3000
49    Content: '0100'
50  - Name:    .nobits
51    Type:    SHT_NOBITS
52    Address: 0x4000
53    Size:    4
54