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

31 Commits

Author SHA1 Message Date
Zachary Turner
6491f0eb80 Move llvm-readobj/StreamWriter to Support.
We wish to re-use this from llvm-pdbdump, and it provides a nice
way to print structured data in scoped format that could prove
useful for many other dumping tools as well.  Moving to support
and changing name to ScopedPrinter to better reflect its purpose.

llvm-svn: 268342
2016-05-03 00:28:04 +00:00
Kevin Enderby
92582f2b18 Thread Expected<...> up from libObject’s getName() for symbols to allow llvm-objdump to produce a good error message.
Produce another specific error message for a malformed Mach-O file when a symbol’s
string index is past the end of the string table.  The existing test case in test/Object/macho-invalid.test
for macho-invalid-symbol-name-past-eof now reports the error with the message indicating
that a symbol at a specific index has a bad sting index and that bad string index value.
 
Again converting interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. Where the existing code reported the error with a
string message or an error code it was converted to do the same.  There is some
code for this that could be factored into a routine but I would like to leave that for
the code owners post-commit to do as they want for handling an llvm::Error.  An
example of how this could be done is shown in the diff in
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h which had a Check() routine
already for std::error_code so I added one like it for llvm::Error .

Also there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values.  So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comment:
“// TODO: Actually report errors helpfully” and a call something like
consumeError(NameOrErr.takeError()) so the buggy code will not crash
since needed to deal with the Error.

Note there fixes needed to lld that goes along with this that I will commit right after this.
So expect lld not to built after this commit and before the next one.

llvm-svn: 266919
2016-04-20 21:24:34 +00:00
Benjamin Kramer
7bb55f0a55 One more batch of self-containing headers.
llvm-svn: 258974
2016-01-27 19:29:56 +00:00
Rafael Espindola
83b930d662 Pass a symbol table to getRelocationSymbol instead of returning one.
This removes a report_fatal_error from library and avoids checking a
section property for every section entry.

llvm-svn: 246656
2015-09-02 15:07:39 +00:00
Rafael Espindola
d1fc658396 Don't iterate over all sections in the ELFFile constructor.
With this we finally have an ELFFile that is O(1) to construct. This is helpful
for programs like lld which have to do their own section walk.

llvm-svn: 244510
2015-08-10 21:29:35 +00:00
Rafael Espindola
e12302b7c2 Delete getDotSymtabSec.
Another step in avoiding iterating over all sections in the ELFFile constructor.

llvm-svn: 244496
2015-08-10 20:25:04 +00:00
Rafael Espindola
29d199aa4d Use continue to reduce indentation. NFC.
llvm-svn: 244480
2015-08-10 18:57:42 +00:00
Rafael Espindola
246909bb95 Remove the symbol iteration functions that don't take a symbol table.
Another step in making ELFFile's constructor not iterate over all sections.

llvm-svn: 244351
2015-08-07 20:07:27 +00:00
Rafael Espindola
baa0c22119 Replace the last uses of ELF::getSymbolName in llvm-readobj.
llvm-svn: 242798
2015-07-21 16:26:21 +00:00
Rafael Espindola
1c58b24a44 Remove Elf_Rela_Iter and Elf_Rel_Iter.
Use just the pointers and check for invalid relocation sections.

llvm-svn: 242700
2015-07-20 20:07:50 +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
3a75bab05c Use range loop.
llvm-svn: 241104
2015-06-30 19:13:25 +00:00
Rafael Espindola
e704554299 Use range loop.
llvm-svn: 241100
2015-06-30 19:02:00 +00:00
Rafael Espindola
479ebec42f Fix the name of the iterator functions to match the coding standards.
llvm-svn: 241074
2015-06-30 15:33:44 +00:00
Rafael Espindola
a75ed1253b Remove Elf_Sym_Iter.
It was a fairly broken concept for an ELF only class.

An ELF file can have two symbol tables, but they have exactly the same
format. There is no concept of a dynamic or a static symbol. Storing this
on the iterator also makes us do more work per symbol than necessary. To fetch
a name we would:

* Find if we had a static or a dynamic symbol.
* Look at the corresponding symbol table and find the string table section.
* Look at the string table section to fetch its contents.
* Compute the name as a substring of the string table.

All but the last step can be done per symbol table instead of per symbol. This
is a step in that direction.

llvm-svn: 240939
2015-06-29 12:38:31 +00:00
Benjamin Kramer
da144ed5a2 Canonicalize header guards into a common format.
Add header guards to files that were missing guards. Remove #endif comments
as they don't seem common in LLVM (we can easily add them back if we decide
they're useful)

Changes made by clang-tidy with minor tweaks.

llvm-svn: 215558
2014-08-13 16:26:38 +00:00
Rafael Espindola
e726a14d05 Remove all uses of 'using std::error_code' from headers.
llvm-svn: 210866
2014-06-13 01:25:41 +00:00
Rafael Espindola
e0e308ff6d Don't use 'using std::error_code' in include/llvm.
This should make sure that most new uses use the std prefix.

llvm-svn: 210835
2014-06-12 21:46:39 +00:00
Craig Topper
b663bffa27 [C++] Use 'nullptr'.
llvm-svn: 207394
2014-04-28 04:05:08 +00:00
Saleem Abdulrasool
5aa6f4f593 tools: remove unnecessary copy of array_lengthof
llvm-svn: 206115
2014-04-12 18:04:27 +00:00
Saleem Abdulrasool
e05d1e5d25 tools: cast the right operand
Properly apply the fix intended by SVN r201032.

llvm-svn: 201036
2014-02-09 03:13:07 +00:00
Saleem Abdulrasool
8b7368c793 tools: explicitly cast to avoid a warning
llvm-svn: 201032
2014-02-09 01:12:21 +00:00
Saleem Abdulrasool
cf3459a929 tools: handle out-of-line personality 0 decoding
In some cases it is possible to have a personality 0 unwinding opcodes in the
extab (such as when .handlerdata is used in the assembly).  Simply decode the 3
opcodes for that case.

llvm-svn: 201030
2014-02-08 23:17:08 +00:00
Saleem Abdulrasool
cf1137c9ec tools: use 64-bit print specifier
Try to repair the ARM Cortex-A15 buildbot by using a more appropriate conversion
specifier.

llvm-svn: 199711
2014-01-21 04:31:29 +00:00
Saleem Abdulrasool
aae6a31cf3 tools: support decoding ARM EHABI opcodes in readobj
Add support to llvm-readobj to decode the actual opcodes.  The ARM EHABI opcodes
are a variable length instruction set that describe the operations required for
properly unwinding stack frames.

The primary motivation for this change is to ease the creation of tests for the
ARM EHABI object emission as well as the unwinding directive handling in the ARM
IAS.

Thanks to Logan Chien for an extra test case!

llvm-svn: 199708
2014-01-21 02:33:15 +00:00
Chandler Carruth
44c680cdaf [cleanup] Add a missing include exposed by resorting other includes.
Should fix the build.

llvm-svn: 199081
2014-01-13 08:09:47 +00:00
Chandler Carruth
03b6c941a3 Re-sort #include lines again, prior to moving headers around.
llvm-svn: 199080
2014-01-13 08:04:33 +00:00
Saleem Abdulrasool
1416d93593 llvm-readobj: address review comments for ARM EHABI printing
Rename bytecode to opcodes to make it more clear.  Change an impossible case to
llvm_unreachable instead.  Avoid allocation of a buffer by modifying the
PrintOpcodes iteration.

llvm-svn: 198848
2014-01-09 04:31:18 +00:00
Saleem Abdulrasool
a66068772d llvm-readobj: fix endianness
Explicitly handle endianness to ensure that bytes are read properly on
big-endian systems.

llvm-svn: 198847
2014-01-09 04:31:14 +00:00
Saleem Abdulrasool
869aa34c78 llvm-readobj: add support for ARM EHABI unwind info
This adds some preliminary support for decoding ARM EHABI unwinding information.
The major functionality that remains from complete support is bytecode
translation.

Each Unwind Index Table is printed out as a separate entity along with its
section index, name, offset, and entries.

Each entry lists the function address, and if possible, the name, of the
function to which it corresponds.  The encoding model, personality routine or
index, and byte code is also listed.

llvm-svn: 198734
2014-01-08 03:28:09 +00:00