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