1## Check what --sections prints when there is no section header string table. 2 3# RUN: yaml2obj %s -o %t 4# RUN: llvm-readelf --sections %t \ 5# RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix=GNU 6# RUN: llvm-readobj --sections %t 2>&1 \ 7# RUN: | FileCheck %s -DFILE=%t --check-prefix=LLVM 8 9# GNU:Section Headers: 10# GNU-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al 11# GNU-NEXT: [ 0] <no-strings> NULL 0000000000000000 000000 000000 00 0 0 0 12# GNU-NEXT: [ 1] <no-strings> PROGBITS 0000000000000000 000040 000000 00 0 0 0 13# GNU-NEXT: [ 2] <no-strings> PROGBITS 0000000000000000 000040 000000 00 0 0 0 14# GNU-NEXT: [ 3] <no-strings> STRTAB 0000000000000000 000040 000001 00 0 0 1 15# GNU-NEXT: [ 4] <no-strings> STRTAB 0000000000000000 000041 00001d 00 0 0 1 16 17# LLVM: Sections [ 18# LLVM-NEXT: Section { 19# LLVM-NEXT: Index: 0 20# LLVM-NEXT: Name: (0) 21# LLVM-NEXT: Type: SHT_NULL (0x0) 22# LLVM-NEXT: Flags [ (0x0) 23# LLVM-NEXT: ] 24# LLVM-NEXT: Address: 0x0 25# LLVM-NEXT: Offset: 0x0 26# LLVM-NEXT: Size: 0 27# LLVM-NEXT: Link: 0 28# LLVM-NEXT: Info: 0 29# LLVM-NEXT: AddressAlignment: 0 30# LLVM-NEXT: EntrySize: 0 31# LLVM-NEXT: } 32# LLVM-NEXT: Section { 33# LLVM-NEXT: Index: 1 34# LLVM-NEXT: Name: (0) 35# LLVM-NEXT: Type: SHT_PROGBITS (0x1) 36# LLVM-NEXT: Flags [ (0x0) 37# LLVM-NEXT: ] 38# LLVM-NEXT: Address: 0x0 39# LLVM-NEXT: Offset: 0x40 40# LLVM-NEXT: Size: 0 41# LLVM-NEXT: Link: 0 42# LLVM-NEXT: Info: 0 43# LLVM-NEXT: AddressAlignment: 0 44# LLVM-NEXT: EntrySize: 0 45# LLVM-NEXT: } 46# LLVM-NEXT: Section { 47# LLVM-NEXT: Index: 2 48# LLVM-NEXT: warning: '[[FILE]]': unable to get the name of SHT_PROGBITS section with index 2: a section [index 2] has an invalid sh_name (0x1) offset which goes past the end of the section name string table 49# LLVM-NEXT: Name: <?> (1) 50# LLVM-NEXT: Type: SHT_PROGBITS (0x1) 51# LLVM-NEXT: Flags [ (0x0) 52# LLVM-NEXT: ] 53# LLVM-NEXT: Address: 0x0 54# LLVM-NEXT: Offset: 0x40 55# LLVM-NEXT: Size: 0 56# LLVM-NEXT: Link: 0 57# LLVM-NEXT: Info: 0 58# LLVM-NEXT: AddressAlignment: 0 59# LLVM-NEXT: EntrySize: 0 60# LLVM-NEXT: } 61# LLVM-NEXT: Section { 62# LLVM-NEXT: Index: 3 63# LLVM-NEXT: warning: '[[FILE]]': unable to get the name of SHT_STRTAB section with index 3: a section [index 3] has an invalid sh_name (0x15) offset which goes past the end of the section name string table 64# LLVM-NEXT: Name: <?> (21) 65# LLVM-NEXT: Type: SHT_STRTAB (0x3) 66# LLVM-NEXT: Flags [ (0x0) 67# LLVM-NEXT: ] 68# LLVM-NEXT: Address: 0x0 69# LLVM-NEXT: Offset: 0x40 70# LLVM-NEXT: Size: 1 71# LLVM-NEXT: Link: 0 72# LLVM-NEXT: Info: 0 73# LLVM-NEXT: AddressAlignment: 1 74# LLVM-NEXT: EntrySize: 0 75# LLVM-NEXT: } 76# LLVM-NEXT: Section { 77# LLVM-NEXT: Index: 4 78# LLVM-NEXT: warning: '[[FILE]]': unable to get the name of SHT_STRTAB section with index 4: a section [index 4] has an invalid sh_name (0xb) offset which goes past the end of the section name string table 79# LLVM-NEXT: Name: <?> (11) 80# LLVM-NEXT: Type: SHT_STRTAB (0x3) 81# LLVM-NEXT: Flags [ (0x0) 82# LLVM-NEXT: ] 83# LLVM-NEXT: Address: 0x0 84# LLVM-NEXT: Offset: 0x41 85# LLVM-NEXT: Size: 29 86# LLVM-NEXT: Link: 0 87# LLVM-NEXT: Info: 0 88# LLVM-NEXT: AddressAlignment: 1 89# LLVM-NEXT: EntrySize: 0 90# LLVM-NEXT: } 91# LLVM-NEXT: ] 92 93--- !ELF 94FileHeader: 95 Class: ELFCLASS64 96 Data: ELFDATA2LSB 97 Type: ET_DYN 98 EShStrNdx: 0 99Sections: 100 - Name: .foo 101 Type: SHT_PROGBITS 102 ShName: 0 103 - Name: .bar 104 Type: SHT_PROGBITS 105 ShName: 1 106