llvm-6502/test/Object/invalid.test
Rafael Espindola df3edb6d36 Return ErrorOr from getSection.
This also improves the logic of what is an error:

* getSection(uint_32): only return an error if the index is out of bounds. The
  index 0 corresponds to a perfectly valid entry.
* getSection(Elf_Sym): Returns null for symbols that normally don't have
  sections and error for out of bound indexes.

In many places this just moves the report_fatal_error up the stack, but those
can then be fixed in smaller patches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241156 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-01 12:56:27 +00:00

47 lines
1.8 KiB
Plaintext

RUN: not llvm-dwarfdump %p/Inputs/invalid-bad-rel-type.elf 2>&1 | FileCheck %s
RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-type.elf 2>&1 | FileCheck %s
RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-size.elf 2>&1 | FileCheck %s
CHECK: Invalid data was encountered while parsing the file
RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-non-null.elf 2>&1 | FileCheck --check-prefix=NON-NULL %s
NON-NULL: String table must end with a null terminator
Test the sh_entsize are invalid
RUN: llvm-readobj -s %p/Inputs/invalid-sh_entsize.elf | FileCheck --check-prefix=SECTION %s
SECTION: Name: .dynsym
SECTION-NEXT: Type: SHT_DYNSYM
SECTION-NEXT: Flags [
SECTION-NEXT: SHF_ALLOC
SECTION-NEXT: ]
SECTION-NEXT: Address:
SECTION-NEXT: Offset:
SECTION-NEXT: Size:
SECTION-NEXT: Link:
SECTION-NEXT: Info:
SECTION-NEXT: AddressAlignment:
SECTION-NEXT: EntrySize: 32
SECTION: Name: .symtab
SECTION-NEXT: Type: SHT_SYMTAB
SECTION-NEXT: Flags [
SECTION-NEXT: ]
SECTION-NEXT: Address:
SECTION-NEXT: Offset:
SECTION-NEXT: Size:
SECTION-NEXT: Link:
SECTION-NEXT: Info:
SECTION-NEXT: AddressAlignment:
SECTION-NEXT: EntrySize: 32
RUN: not llvm-readobj -t %p/Inputs/invalid-sh_entsize.elf 2>&1 | FileCheck --check-prefix=INVALID-SYM-SIZE %s
RUN: not llvm-readobj --dyn-symbols %p/Inputs/invalid-sh_entsize.elf 2>&1 | FileCheck --check-prefix=INVALID-SYM-SIZE %s
INVALID-SYM-SIZE: Invalid symbol size
RUN: not llvm-readobj -t %p/Inputs/invalid-section-index.elf 2>&1 | FileCheck --check-prefix=INVALID-SECTION-INDEX %s
INVALID-SECTION-INDEX: Invalid section index
RUN: not llvm-readobj -s %p/Inputs/invalid-section-size.elf 2>&1 | FileCheck --check-prefix=INVALID-SECTION-SIZE %s
INVALID-SECTION-SIZE: Invalid section header size