1## This test ensures llvm-nm emits a helpful error message when dumping a symbol table 2## whose sh_size isn't a multiple of the symbol size (sh_size % sizeof(Elf_Sym) != 0). 3 4## a) Broken .symtab symbol table. Valid .dynsym symbol table. 5# RUN: yaml2obj -DBITS=32 -DSIZE=33 -DDYNSIZE=32 %s -o %t.32-bit.o 6# RUN: not llvm-nm %t.32-bit.o 2>&1 | FileCheck -DSIZE=33 -DSYMSIZE=16 -DINDEX=2 %s 7# RUN: yaml2obj -DBITS=64 -DSIZE=49 -DDYNSIZE=48 %s -o %t.64-bit.o 8# RUN: not llvm-nm %t.64-bit.o 2>&1 | FileCheck -DSIZE=49 -DSYMSIZE=24 -DINDEX=2 %s 9 10## b) Broken .dynsym symbol table. Valid .symtab symbol table. 11# RUN: yaml2obj -DBITS=32 -DSIZE=32 -DDYNSIZE=33 %s -o %t.32-bit.o 12# RUN: not llvm-nm --dynamic %t.32-bit.o 2>&1 | FileCheck -DSIZE=33 -DSYMSIZE=16 -DINDEX=3 %s 13# RUN: yaml2obj -DBITS=64 -DSIZE=48 -DDYNSIZE=49 %s -o %t.64-bit.o 14# RUN: not llvm-nm --dynamic %t.64-bit.o 2>&1 | FileCheck -DSIZE=49 -DSYMSIZE=24 -DINDEX=3 %s 15 16# CHECK: error: {{.*}} section [index [[INDEX]]] has an invalid sh_size ([[SIZE]]) which is not a multiple of its sh_entsize ([[SYMSIZE]]) 17 18--- !ELF 19FileHeader: 20 Class: ELFCLASS[[BITS]] 21 Data: ELFDATA2LSB 22 Type: ET_DYN 23 Machine: EM_X86_64 24Sections: 25 - Name: .dynstr 26 Type: SHT_STRTAB 27 Content: "00" 28 - Name: .symtab 29 Type: SHT_SYMTAB 30 Size: [[SIZE]] 31 - Name: .dynsym 32 Type: SHT_DYNSYM 33 Size: [[DYNSIZE]] 34