1 ## This test checks warning messages if --start-address/--stop-address
2 ## do not intersect with address ranges of sections that have the SHF_ALLOC
5 # RUN: yaml2obj --docnum=1 %s -o %t
6 # RUN: yaml2obj --docnum=2 %s -o %t.2
7 # RUN: yaml2obj --docnum=3 %s -o %t.o
8 # RUN: yaml2obj --docnum=4 %s -o %t.3
10 ## Warn if no section covers any part of the specified range.
12 ## - Section ends at start of range:
15 # RUN: llvm-objdump --file-headers --start-address=0x1004 --stop-address=0x1006 %t 2>&1 \
16 # RUN: | FileCheck %s --check-prefix=WARN
18 ## - Range is between two sections:
20 ## | section | | section |
21 # RUN: llvm-objdump --file-headers --start-address=0x1005 --stop-address=0x1006 %t 2>&1 \
22 # RUN: | FileCheck %s --check-prefix=WARN
24 ## - Range appears after any section:
27 # RUN: llvm-objdump --file-headers --start-address=0x1405 --stop-address=0x1406 %t 2>&1 \
28 # RUN: | FileCheck %s --check-prefix=WARN
30 ## - Range starts at 0. (--start-address defaults to 0).
31 # RUN: llvm-objdump --file-headers --stop-address=0x1000 %t 2>&1 \
32 # RUN: | FileCheck %s --check-prefix=WARN-STOP-ONLY
34 ## - Range ends at UINT64_MAX. (--stop-address defaults to UINT64_MAX)
35 # RUN: llvm-objdump --file-headers --start-address=0x1500 %t 2>&1 \
36 # RUN: | FileCheck %s --check-prefix=WARN-START-ONLY
38 ## No warning if a section covers at least part of the specified range.
40 ## - Ranges are identical:
43 # RUN: llvm-objdump --file-headers --start-address=0x1000 --stop-address=0x1004 %t 2>&1 \
44 # RUN: | FileCheck %s --implicit-check-not=warning:
46 ## - Range is entirely within section:
49 # RUN: llvm-objdump --file-headers --start-address=0x1001 --stop-address=0x1003 %t 2>&1 \
50 # RUN: | FileCheck %s --implicit-check-not=warning:
52 ## - Section is entirely within range:
55 # RUN: llvm-objdump --file-headers --start-address=0xfff --stop-address=0x1005 %t 2>&1 \
56 # RUN: | FileCheck %s --implicit-check-not=warning:
58 ## - Section and range share same start, section larger:
61 # RUN: llvm-objdump --file-headers --start-address=0x1000 --stop-address=0x1003 %t 2>&1 \
62 # RUN: | FileCheck %s --implicit-check-not=warning:
64 ## - Section and range share same start, range larger:
67 # RUN: llvm-objdump --file-headers --start-address=0x1000 --stop-address=0x1005 %t 2>&1 \
68 # RUN: | FileCheck %s --implicit-check-not=warning:
70 ## - Section and range share same end, section larger:
73 # RUN: llvm-objdump --file-headers --start-address=0x1001 --stop-address=0x1004 %t 2>&1 \
74 # RUN: | FileCheck %s --implicit-check-not=warning:
76 ## - Section and range share same end, range larger:
79 # RUN: llvm-objdump --file-headers --start-address=0xfff --stop-address=0x1004 %t 2>&1 \
80 # RUN: | FileCheck %s --implicit-check-not=warning:
82 ## - Section and range partially overlap, range first:
85 # RUN: llvm-objdump --file-headers --start-address=0xfff --stop-address=0x1003 %t 2>&1 \
86 # RUN: | FileCheck %s --implicit-check-not=warning:
88 ## - Section and range partially overlap, section first:
91 # RUN: llvm-objdump --file-headers --start-address=0x1001 --stop-address=0x1005 %t 2>&1 \
92 # RUN: | FileCheck %s --implicit-check-not=warning:
94 ## - Range starts before first section and ends after second:
96 ## | section | | section |
97 # RUN: llvm-objdump --file-headers --start-address=0xfff --stop-address=0x1405 %t 2>&1 \
98 # RUN: | FileCheck %s --implicit-check-not=warning:
100 ## Warn only for the input file that does not have the specified range.
101 # RUN: llvm-objdump --file-headers --start-address=0x2001 --stop-address=0x2005 %t %t.2 2>&1 \
102 # RUN: | FileCheck %s --check-prefix=MULTI-INPUT
104 ## Warn if the specified range is in a segment but not in any section.
105 # RUN: llvm-objdump --file-headers --start-address=0x1008 --stop-address=0x1009 %t 2>&1 \
106 # RUN: | FileCheck %s --check-prefix=WARN
108 ## Warning for --start-address/--stop-address works regardless of the other options used including --section.
109 # RUN: llvm-objdump --syms --section=.text2 --start-address=0x1004 --stop-address=0x1005 %t 2>&1 \
110 # RUN: | FileCheck %s --check-prefix=WARN
112 ## Sections without the SHF_ALLOC flag are ignored in address range calculation.
113 # RUN: llvm-objdump --file-headers --start-address=0x1 --stop-address=0x3 %t.3 2>&1 \
114 # RUN: | FileCheck %s --check-prefix=WARN
116 ## No warning for relocatable objects.
117 # RUN: llvm-objdump --file-headers --start-address=0x1004 --stop-address=0x1005 %t.o 2>&1 \
118 # RUN: | FileCheck %s --implicit-check-not=warning:
120 ## No warning if neither --start-address nor --stop-address are specified.
121 # RUN: llvm-objdump --file-headers %t 2>&1 | FileCheck %s --implicit-check-not=warning:
123 # WARN: warning: {{.*}}: no section overlaps the range {{.*}} specified by --start-address/--stop-address
124 # WARN-STOP-ONLY: warning: {{.*}}: no section has address less than 0x1000 specified by --stop-address
125 # WARN-START-ONLY: warning: {{.*}}: no section has address greater than or equal to 0x1500 specified by --start-address
127 # MULTI-INPUT: file format
128 # MULTI-INPUT: warning: {{.*}}: no section overlaps the range [0x2001,0x2005) specified by --start-address/--stop-address
129 # MULTI-INPUT: file format
130 # MULTI-INPUT-NOT: warning:
141 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
146 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
151 Flags: [ PF_X, PF_R ]
166 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
171 Flags: [ PF_X, PF_R ]
186 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]