Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / obj2yaml / ELF / DWARF / debug-addr.yaml
blob556473fc6956ed58fc4e63cfdf240f4c28a2e7d9
1 ## Test how we dump the .debug_addr section.
3 ## a) Dumping address tables from various object files.
5 ## Dumping address tables from a little endian 64-bit object file.
6 # RUN: yaml2obj --docnum=1 %s -DADDRESS=0xFFFFFFFFFFFFFFFF \
7 # RUN:   -DADDRSIZE=4 | obj2yaml | \
8 # RUN:   FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
9 # RUN:     -DLENGTH1=0x14 -DADDRSIZE1=0x8 -DADDR=0xFFFFFFFFFFFFFFFF \
10 # RUN:     -DLENGTH2=0xC -DADDRSIZE2=0x4
12 ## Dumping address tables from a big endian 64-bit object file.
13 # RUN: yaml2obj --docnum=1 %s -DENDIAN=MSB -DADDRESS=0xFFFFFFFFFFFFFFFF \
14 # RUN:   -DADDRSIZE=4 | obj2yaml | \
15 # RUN:   FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
16 # RUN:     -DLENGTH1=0x14 -DADDRSIZE1=0x8 -DADDR=0xFFFFFFFFFFFFFFFF \
17 # RUN:     -DLENGTH2=0xC -DADDRSIZE2=0x4
19 ## Dumping address tables from a little endian 32-bit object file.
20 # RUN: yaml2obj --docnum=1 %s -DBITS=32 -DADDRESS=0xFFFFFFFF \
21 # RUN:   -DADDRSIZE=8 | obj2yaml | \
22 # RUN:   FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
23 # RUN:     -DLENGTH1=0xC -DADDRSIZE1=0x4 -DADDR=0xFFFFFFFF \
24 # RUN:     -DLENGTH2=0x14 -DADDRSIZE2=0x8
26 ## Dumping address tables from a big endian 32-bit object file.
27 # RUN: yaml2obj --docnum=1 %s -DBITS=32 -DENDIAN=MSB -DADDRESS=0xFFFFFFFF \
28 # RUN:   -DADDRSIZE=8 | obj2yaml | \
29 # RUN:   FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
30 # RUN:     -DLENGTH1=0xC -DADDRSIZE1=0x4 -DADDR=0xFFFFFFFF \
31 # RUN:     -DLENGTH2=0x14 -DADDRSIZE2=0x8
33 #      BASIC: DWARF:
34 # BASIC-NEXT:   debug_addr:
35 # BASIC-NEXT:     - Length:      [[LENGTH1]]
36 # BASIC-NEXT:       Version:     0x5
37 # BASIC-NEXT:       AddressSize: [[ADDRSIZE1]]
38 # BASIC-NEXT:       Entries:
39 # BASIC-NEXT:         - Address: 0x1234
40 # BASIC-NEXT:         - Address: 0x5678
41 # BASIC-NEXT:     - Format:      DWARF64
42 # BASIC-NEXT:       Length:      [[LENGTH1]]
43 # BASIC-NEXT:       Version:     0x5
44 # BASIC-NEXT:       AddressSize: [[ADDRSIZE1]]
45 # BASIC-NEXT:       Entries:
46 # BASIC-NEXT:         - Address: 0x1234
47 # BASIC-NEXT:         - Address: [[ADDR]]
48 # BASIC-NEXT:     - Length:      [[LENGTH2]]
49 # BASIC-NEXT:       Version:     0x5
50 # BASIC-NEXT:       AddressSize: [[ADDRSIZE2]]
51 # BASIC-NEXT:       Entries:
52 # BASIC-NEXT:         - Address: 0x1234
53 # BASIC-NEXT:         - Address: 0x5678
54 # BASIC-NEXT:     - Format:      DWARF64
55 # BASIC-NEXT:       Length:      [[LENGTH2]]
56 # BASIC-NEXT:       Version:     0x5
57 # BASIC-NEXT:       AddressSize: [[ADDRSIZE2]]
58 # BASIC-NEXT:       Entries:
59 # BASIC-NEXT:         - Address: 0x1234
60 # BASIC-NEXT:         - Address: 0x5678
61 # BASIC-NEXT: ...
63 --- !ELF
64 FileHeader:
65   Class: ELFCLASS[[BITS=64]]
66   Data:  ELFDATA2[[ENDIAN=LSB]]
67   Type:  ET_EXEC
68 DWARF:
69   debug_addr:
70     ## A DWARF32 address table.
71     - Version:     5
72       Entries:
73         - Address: 0x1234
74         - Address: 0x5678
75     ## A DWARF64 address table.
76     - Format:      DWARF64
77       Version:     5
78       Entries:
79         - Address: 0x1234
80         - Address: [[ADDRESS]]
81     ## A DWARF32 address table with a mutable address size.
82     - Version:     5
83       AddressSize: [[ADDRSIZE]]
84       Entries:
85         - Address: 0x1234
86         - Address: 0x5678
87     ## A DWARF64 address table with a mutable address size.
88     - Format:      DWARF64
89       Version:     5
90       AddressSize: [[ADDRSIZE]]
91       Entries:
92         - Address: 0x1234
93         - Address: 0x5678
95 ## b) Test dumping a .debug_addr section whose section header properties are
96 ## overridden.
98 ## Override the sh_type field.
99 # RUN: yaml2obj --docnum=2 %s -DTYPE=SHT_STRTAB | obj2yaml | \
100 # RUN:   FileCheck %s -DTYPE=SHT_STRTAB --check-prefix=COMMON
102 ## Override the sh_flags field.
103 # RUN: yaml2obj --docnum=2 %s -DFLAGS='[ SHF_ALLOC ]' | obj2yaml | \
104 # RUN:   FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,FLAGS
106 ## Override the sh_link field.
107 # RUN: yaml2obj --docnum=2 %s -DLINK=.sec | obj2yaml | \
108 # RUN:   FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,LINK
110 ## Override the sh_addr field.
111 # RUN: yaml2obj --docnum=2 %s -DADDRESS=0x2020 | obj2yaml | \
112 # RUN:   FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,ADDR
114 ## Override the sh_addralign field.
115 # RUN: yaml2obj --docnum=2 %s -DADDRALIGN=3 | obj2yaml | \
116 # RUN:   FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,ADDRALIGN
118 ## Override the sh_entsize field.
119 # RUN: yaml2obj --docnum=2 %s -DENTSIZE=3 | obj2yaml | \
120 # RUN:   FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,ENTSIZE
122 ## Override the sh_info field.
123 # RUN: yaml2obj --docnum=2 %s -DINFO=3 | obj2yaml | \
124 # RUN:   FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,INFO
126 #         COMMON: Sections:
127 #    COMMON-NEXT:   - Name:         .debug_addr
128 #    COMMON-NEXT:     Type:         [[TYPE]]
129 #     FLAGS-NEXT:     Flags:        [ SHF_ALLOC ]
130 #      LINK-NEXT:     Link:         .sec
131 #      ADDR-NEXT:     Address:      0x2020
132 # ADDRALIGN-NEXT:     AddressAlign: 0x3
133 #   ENTSIZE-NEXT:     EntSize:      0x3
134 #      INFO-NEXT:     Info:         0x3
135 #    COMMON-NEXT:   - Name:         .sec
136 #    COMMON-NEXT:     Type:         SHT_PROGBITS
137 #    COMMON-NEXT: DWARF:
138 #    COMMON-NEXT:   debug_addr:
139 #    COMMON-NEXT:     - Length:      0x14
140 #    COMMON-NEXT:       Version:     0x5
141 #    COMMON-NEXT:       AddressSize: 0x8
142 #    COMMON-NEXT:       Entries:
143 #    COMMON-NEXT:         - Address: 0x1234
144 #    COMMON-NEXT:         - Address: 0x5678
145 #    COMMON-NEXT: ...
147 --- !ELF
148 FileHeader:
149   Class: ELFCLASS64
150   Data:  ELFDATA2LSB
151   Type:  ET_EXEC
152 Sections:
153   - Name:         .debug_addr
154     Type:         [[TYPE=SHT_PROGBITS]]
155     Flags:        [[FLAGS=<none>]]
156     Link:         [[LINK=<none>]]
157     EntSize:      [[ENTSIZE=<none>]]
158     Info:         [[INFO=<none>]]
159     AddressAlign: [[ADDRALIGN=0]]
160     Address:      [[ADDRESS=<none>]]
161   - Name:         .sec
162     Type:         SHT_PROGBITS
163 DWARF:
164   debug_addr:
165     - Version: 5
166       Entries:
167         - Address: 0x1234
168         - Address: 0x5678
170 ## c) Test dumping an address table whose version isn't 5.
171 ## This causes the DWARF parser to fail to parse it and we will dump it as a raw
172 ## content section.
174 # RUN: yaml2obj --docnum=3 %s -DCONTENT="AABBCC" | obj2yaml | \
175 # RUN:   FileCheck %s --check-prefix=RAW --implicit-check-not=DWARF:
177 #      RAW: Sections:
178 # RAW-NEXT:   - Name:         .debug_addr
179 # RAW-NEXT:     Type:         SHT_PROGBITS
180 # RAW-NEXT:     AddressAlign: 0x1
181 # RAW-NEXT:     Content:      AABBCC
182 # RAW-NEXT: ...
184 --- !ELF
185 FileHeader:
186   Class: ELFCLASS64
187   Data:  ELFDATA2LSB
188   Type:  ET_EXEC
189 Sections:
190   - Name:         .debug_addr
191     Type:         SHT_PROGBITS
192     AddressAlign: 1
193     Size:         [[SIZE=<none>]]
194     Content:      [[CONTENT=<none>]]
196 ## d) Test dumping an empty .debug_addr section.
198 # RUN: yaml2obj --docnum=3 %s -DSIZE=0 | obj2yaml | \
199 # RUN:   FileCheck %s --check-prefix=EMPTY --implicit-check-not=Sections:
201 #      EMPTY: DWARF:
202 # EMPTY-NEXT:   debug_addr: []
203 # EMPTY-NEXT: ...