xref: /llvm-project/llvm/test/tools/llvm-objdump/X86/start-stop-address-relocatable-object.test (revision 71e2ca6e32105b35aeadeab25010e8f999c47c23)
1## Show how --start-address and --stop-address work in a relocatable object.
2## They limit the disassembly to the relative offset ranges within sections.
3# RUN: yaml2obj %s -o %t.o
4# RUN: llvm-objdump -d %t.o --start-address=1 --stop-address=2 | FileCheck %s --check-prefix=COMMON
5# RUN: llvm-objdump -d %t.o --start-address=1 | FileCheck %s --check-prefixes=START,COMMON
6# RUN: llvm-objdump -d %t.o --stop-address=2 | FileCheck %s --check-prefixes=STOP,COMMON
7
8# COMMON:       Disassembly of section .text:
9# COMMON-EMPTY:
10# COMMON-NEXT:  0000000000000000 <.text>:
11# STOP-NEXT:           0: 90                            nop
12# COMMON-NEXT:         1: 90                            nop
13# START-NEXT:          2: 90                            nop
14# COMMON-EMPTY:
15# COMMON-NEXT:  Disassembly of section .text2:
16# COMMON-EMPTY:
17# COMMON-NEXT:  0000000000000000 <.text2>:
18# STOP-NEXT:           0: c3                            retq
19# COMMON-NEXT:         1: c3                            retq
20# START-NEXT:          2: c3                            retq
21# STOP-EMPTY:
22# STOP-NEXT:    Disassembly of section .text3:
23# STOP-EMPTY:
24# STOP-NEXT:    0000000000000000 <.text3>:
25# STOP-NEXT:           0: cc                            int3
26# COMMON-NOT:   {{.}}
27
28--- !ELF
29FileHeader:
30  Class:   ELFCLASS64
31  Data:    ELFDATA2LSB
32  Type:    ET_REL
33  Machine: EM_X86_64
34Sections:
35  - Name:         .text
36    Type:         SHT_PROGBITS
37    Flags:        [SHF_ALLOC, SHF_EXECINSTR]
38    Content:      '909090'
39  - Name:         .text2
40    Type:         SHT_PROGBITS
41    Flags:        [SHF_ALLOC, SHF_EXECINSTR]
42    Content:      'c3c3c3'
43  - Name:         .text3
44    Type:         SHT_PROGBITS
45    Flags:        [SHF_ALLOC, SHF_EXECINSTR]
46    Content:      'cc'
47