1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
llvm-mirror/test/Object/corrupt.test
Rafael Espindola 0d29f912e2 Add dynamic_table iterators back to ELF.h.
In tree they are only used by llvm-readobj, but it is also used by
https://github.com/mono/CppSharp.

While at it, add some missing error checking.

llvm-svn: 244320
2015-08-07 15:25:20 +00:00

73 lines
2.5 KiB
Plaintext

// Section name offset overflows section name string table.
RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -sections \
RUN: 2>&1 | FileCheck --check-prefix=SECNAME %s
SECNAME: Error reading file: Invalid data was encountered while parsing the file.
// Section data offset past end of file.
RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -sections -section-data \
RUN: 2>&1 | FileCheck --check-prefix=SECDATA %s
SECDATA: Error reading file: Invalid data was encountered while parsing the file.
// Symbol name offset overflows string table.
RUN: not llvm-readobj %p/Inputs/corrupt.elf-x86-64 -symbols \
RUN: 2>&1 | FileCheck --check-prefix=SYMNAME %s
SYMNAME: Error reading file: Invalid data was encountered while parsing the file.
// Version index in .gnu.version overflows the version map.
RUN: not llvm-readobj %p/Inputs/corrupt-version.elf-x86_64 -dt \
RUN: 2>&1 | FileCheck --check-prefix=VER %s
VER: Error reading file: Invalid version entry.
// The file is missing the dynamic string table but has references to it.
RUN: not llvm-readobj -dynamic-table %p/Inputs/corrupt-invalid-strtab.elf.x86-64 \
RUN: 2>&1 | FileCheck --check-prefix=STRTAB %s
STRTAB: Invalid dynamic string table reference
RUN: not llvm-readobj -program-headers \
RUN: %p/Inputs/corrupt-invalid-phentsize.elf.x86-64 2>&1 | \
RUN: FileCheck --check-prefix=PHENTSIZE %s
PHENTSIZE: Invalid program header size
RUN: not llvm-readobj -dynamic-table \
RUN: %p/Inputs/corrupt-invalid-virtual-addr.elf.x86-64 2>&1 | \
RUN: FileCheck --check-prefix=VIRTADDR %s
VIRTADDR: Virtual address is not in any segment
RUN: not llvm-readobj -dyn-relocations \
RUN: %p/Inputs/corrupt-invalid-relocation-size.elf.x86-64 2>&1 | \
RUN: FileCheck --check-prefix=RELOC %s
RELOC: Invalid relocation entry size
RUN: not llvm-readobj -dyn-relocations \
RUN: %p/Inputs/corrupt-invalid-dynamic-table-size.elf.x86-64 2>&1 | \
RUN: FileCheck --check-prefix=DYN-TABLE-SIZE %s
DYN-TABLE-SIZE: Invalid dynamic table size
RUN: not llvm-readobj -dyn-relocations \
RUN: %p/Inputs/corrupt-invalid-dynamic-table-offset.elf.x86-64 2>&1 | \
RUN: FileCheck --check-prefix=DYN-TABLE-OFFSET %s
DYN-TABLE-OFFSET: Invalid data was encountered while parsing the file.
RUN: not llvm-readobj -dyn-relocations \
RUN: %p/Inputs/corrupt-invalid-dynamic-table-too-large.elf.x86-64 2>&1 | \
RUN: FileCheck --check-prefix=DYN-TABLE-TOO-LARGE %s
DYN-TABLE-TOO-LARGE: Invalid data was encountered while parsing the file.