1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

13 Commits

Author SHA1 Message Date
Rafael Espindola
5c95668155 This reverts commit r260488 and r260489.
Original messages:
    Revert "[readobj] Handle ELF files with no section table or with no program headers."
    Revert "[readobj] Dump DT_JMPREL relocations when outputting dynamic relocations."

r260489 depends on r260488 and among other issues r260488 deleted error
handling code.

llvm-svn: 260962
2016-02-16 14:17:48 +00:00
Michael J. Spencer
4b64c43150 [readobj] Handle ELF files with no section table or with no program headers.
This adds support for finding the dynamic table and dynamic symbol table via
the section table or the program header table. If there's no section table an
attempt is made to figure out the length of the dynamic symbol table.

llvm-svn: 260488
2016-02-11 04:59:45 +00:00
Rafael Espindola
a72d6ae775 Report an error if a SHT_SYMTAB_SHNDX section has the wrong size.
llvm-svn: 245873
2015-08-24 21:09:41 +00:00
Rafael Espindola
8c9308a255 Refactor duplicated code and check for invalid symbol table size.
llvm-svn: 242981
2015-07-23 03:24:22 +00:00
Rafael Espindola
954192d707 Improve error message.
Thanks to Sean Silva for the suggestion.

llvm-svn: 241255
2015-07-02 11:48:48 +00:00
Rafael Espindola
2aa69908b2 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.

llvm-svn: 241156
2015-07-01 12:56:27 +00:00
Rafael Espindola
f97ba343b7 Remove Elf_Shdr_Iter. Diagnose files with invalid section header sizes.
llvm-svn: 241109
2015-06-30 19:58:10 +00:00
Rafael Espindola
fc1039bb12 Add a test of an elf file with an invalid section index.
We were already checking, but were missing a test.

llvm-svn: 241094
2015-06-30 18:23:07 +00:00
Rafael Espindola
ba4f1ed96a Report an error on invalid sh_entsize.
llvm-svn: 241070
2015-06-30 14:59:20 +00:00
Rafael Espindola
50a3948f04 Factor out the checking of string tables.
This moves the error checking for string tables to getStringTable which returns
an ErrorOr<StringRef>.

This improves error checking, makes it uniform across all string tables and
makes it possible to check them once instead of once per name.

llvm-svn: 240950
2015-06-29 14:39:25 +00:00
Rafael Espindola
f9a95b0fa5 Add a testcase for an invalid file.
We were already checking this, but had no tests.

llvm-svn: 240945
2015-06-29 14:12:14 +00:00
Rafael Espindola
d966b65619 Convert an assert that can fail into error checking.
llvm-svn: 240944
2015-06-29 14:02:24 +00:00
Rafael Espindola
e8ff3dd7fa Improve error handling of getRelocationAddend.
This patch changes getRelocationAddend to use ErrorOr and considers it an error
to try to get the addend of a REL section.

If, for example, a x86_64 file has a REL section, that file is corrupted and
we should reject it.

Using ErrorOr is not ideal since we check the section type once per relocation
instead of once per section.

Checking once per section would involve getRelocationAddend just asserting and
callers checking the section before iterating over the relocations.

In any case, this is an improvement and includes a test.

llvm-svn: 240176
2015-06-19 20:58:43 +00:00