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: not 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: error: '[[FILE]]': a section [index 2] has an invalid sh_name (0x1) offset which goes past the end of the section name string table 47 48--- !ELF 49FileHeader: 50 Class: ELFCLASS64 51 Data: ELFDATA2LSB 52 Type: ET_DYN 53 Machine: EM_X86_64 54 SHStrNdx: 0 55Sections: 56 - Name: .foo 57 Type: SHT_PROGBITS 58 ShName: 0 59 - Name: .bar 60 Type: SHT_PROGBITS 61 ShName: 1 62