Commit Graph

156 Commits

Author SHA1 Message Date
Rafael Espindola 676223170f getLoadName is only implemented for ELF, make it ELF only.
llvm-svn: 215219
2014-08-08 16:39:22 +00:00
Rafael Espindola 3f6481d0d3 Remove some calls to std::move.
Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get
a reference to it.

Thanks to David Blaikie for the suggestion.

llvm-svn: 214516
2014-08-01 14:31:55 +00:00
Rafael Espindola 437b0d5887 Use std::unique_ptr to make the ownership explicit.
llvm-svn: 214377
2014-07-31 03:12:45 +00:00
Simon Atanasyan 1cd169f137 [Mips] Support SHT_MIPS_ABIFLAGS section type flag in the llvm-readobj,
obj2yaml and yaml2obj tools.

llvm-svn: 212908
2014-07-13 15:28:54 +00:00
Simon Atanasyan 5a63aa305d [llvm-readobj] Fix output of MIPS GOT without local and global entries.
llvm-svn: 212374
2014-07-05 19:28:49 +00:00
Tim Northover 07f99fb769 llvm-readobj: fix MachO relocatoin printing a bit.
There were two issues here:
1. At the very least, scattered relocations cannot use the same code to
   determine the corresponding symbol being referred to. For some reason we
   pretend there is no symbol, even when one actually exists in the symtab, so to
   match this behaviour getRelocationSymbol should simply return symbols_end for
   scattered relocations.
2. Printing "-" when we can't get a symbol (including the scattered case, but
   not exclusively), isn't that helpful. In both cases there *is* interesting
   information in that field, so we should print it. As hex will do.

Small part of rdar://problem/17553104

llvm-svn: 212332
2014-07-04 10:57:56 +00:00
Benjamin Kramer 0e18484696 Rephrase loop so it doesn't leave unused bools around in Release mode.
llvm-svn: 212102
2014-07-01 14:46:44 +00:00
Saleem Abdulrasool d90f86d53c Support: update DLLCharacteristics enumeration
Add the new AppContainer characteristic which is import for Windows Store
(Metro) compatible applications.  Add the new Control Flow Guard flag to bring
the enumeration up to date with the current values as of Windows 8.1.

llvm-svn: 211855
2014-06-27 03:11:18 +00:00
Alp Toker e69170a110 Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754.

llvm-svn: 211814
2014-06-26 22:52:05 +00:00
Alp Toker 614717388c Introduce a string_ostream string builder facilty
string_ostream is a safe and efficient string builder that combines opaque
stack storage with a built-in ostream interface.

small_string_ostream<bytes> additionally permits an explicit stack storage size
other than the default 128 bytes to be provided. Beyond that, storage is
transferred to the heap.

This convenient class can be used in most places an
std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair
would previously have been used, in order to guarantee consistent access
without byte truncation.

The patch also converts much of LLVM to use the new facility. These changes
include several probable bug fixes for truncated output, a programming error
that's no longer possible with the new interface.

llvm-svn: 211749
2014-06-26 00:00:48 +00:00
Simon Atanasyan c217c4047a [llvm-readobj] Fix member functions name style.
llvm-svn: 211152
2014-06-18 09:24:01 +00:00
Simon Atanasyan a4ba8ec792 [llvm-readobj] Fix compile error.
llvm-svn: 211151
2014-06-18 09:23:55 +00:00
Simon Atanasyan 80433900cc [llvm-readobj][ELF] New `-mips-plt-got` command line option to output
MIPS GOT section.

Patch reviewed by Rafael Espindola.

llvm-svn: 211150
2014-06-18 08:47:09 +00:00
Rafael Espindola ae460027a4 Convert the Archive API to use ErrorOr.
Now that we have c++11, even things like ErrorOr<std::unique_ptr<...>> are
easy to use.

No intended functionality change.

llvm-svn: 211033
2014-06-16 16:08:36 +00:00
Rafael Espindola 54f1997979 Remove unused and odd code.
This code was never being used and any use of it would look fairly strange.
For example, it would try to map a object_error::parse_failed to
std::errc::invalid_argument.

llvm-svn: 210912
2014-06-13 15:36:17 +00:00
Rafael Espindola 4453e42945 Remove 'using std::error_code' from tools.
llvm-svn: 210876
2014-06-13 03:07:50 +00:00
Rafael Espindola bff5d0d16a Remove all uses of 'using std::error_code' from headers.
llvm-svn: 210866
2014-06-13 01:25:41 +00:00
Rafael Espindola 3acea39853 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
Rafael Espindola a6e9c3e43a Remove system_error.h.
This is a minimal change to remove the header. I will remove the occurrences
of "using std::error_code" in a followup patch.

llvm-svn: 210803
2014-06-12 17:38:55 +00:00
Rafael Espindola 25188c95de Don't import error_category into the llvm namespace.
llvm-svn: 210733
2014-06-12 01:45:43 +00:00
Rafael Espindola acc5d7c911 Don't import error_condition into the llvm namespace.
llvm-svn: 210731
2014-06-12 01:29:42 +00:00
Rafael Espindola 5c4f829424 Use std::error_code instead of llvm::error_code.
The idea of this patch is to turn llvm/Support/system_error.h into a
transitional header that just brings in the erorr_code api to the llvm
namespace. I will remove it shortly afterwards.

The cases where the general idea needed some tweaking:

* std::errc is a namespace in msvc, so we cannot use "using std::errc". I could
add an #ifdef, but there were not that many uses, so I just added std:: to
them in this patch.

* Template specialization had to be moved to the std namespace in this
patch set already.

* The msvc implementation of default_error_condition doesn't seem to
provide the same transformations as we need. Not too surprising since
the standard doesn't actually say what "equivalent" means. I fixed the
problem by keeping our old mapping and using it at error_code
construction time.

Despite these shortcomings I think this is still a good thing. Some reasons:

* The different implementations of system_error might improve over time.
* It removes 925 lines of code from llvm already.
* It removes 6313 bytes from the text segment of the clang binary when
it is built with gcc and 2816 bytes when building with clang and
libstdc++.

llvm-svn: 210687
2014-06-11 19:05:50 +00:00
Rafael Espindola 933c9509da Use an enum class.
llvm-svn: 210623
2014-06-11 01:22:20 +00:00
Rafael Espindola f5d07fa586 Mark a few functions noexcept.
This reduces the difference between std::error_code and llvm::error_code.

llvm-svn: 210591
2014-06-10 21:26:47 +00:00
Simon Atanasyan 414736ee24 [llvm-readobj][ELF] Factor out the code retrieve ELF symbol information
(section name, section index, full name) into the separate functions.

No functional changes.

llvm-svn: 210509
2014-06-10 05:59:15 +00:00
Saleem Abdulrasool c86b54c86d tools: add a high level explanation for WoA EH data
Add a brief explanation of the data section layout for the unwind data that the
Windows on ARM EH models.  This is simply to provide a rough idea of the layout
of the code involved in the decoding of the unwinding.  Details on the involved
data structures are available in the associated support header.  The bulk of it
is related to printing out the byte-code to help validate generation of WoA EH.

No functional change.

llvm-svn: 210397
2014-06-07 19:23:07 +00:00
Saleem Abdulrasool 72e9a25c76 tools: fix parenthesis warning from GCC
Add parenthesis as suggested by GCC.

llvm-svn: 210194
2014-06-04 16:03:20 +00:00
Saleem Abdulrasool 8c49170879 tools: fix silly typo in llvm-readobj
Case insensitive case preserving file systems are not a good choice for
development.

llvm-svn: 210193
2014-06-04 16:03:18 +00:00
Saleem Abdulrasool e6971cab30 tools: initial implementation of WoA EH decoding
Add support to llvm-readobj to decode Windows ARM Exception Handling data.  This
uses the previously added datastructures to decode the information into a format
that can be used by tests.  This is a necessary step to add support for emitting
Windows on ARM exception handling information.

A fair amount of formatting inspiration is drawn from the Win64 EH printer as
well as the ARM EHABI printer.  This allows for a reasonably thorough look into
the encoded data.

llvm-svn: 210192
2014-06-04 15:47:15 +00:00
Saleem Abdulrasool 6ba36dc132 tools: introduce StreamWriter::printBoolean
Add a helper print method to print a boolean value as "Yes" or "No".  This is
intended to be used by the Windows ARM EH printer.

llvm-svn: 210191
2014-06-04 15:47:11 +00:00
Simon Atanasyan 28a1160bc6 [Object][ELF] Range-based loop simplification.
No functional changes.

llvm-svn: 210164
2014-06-04 05:51:44 +00:00
Rafael Espindola a3f2e3f01e There is no std::errc::success, remove the llvm one.
llvm-svn: 209960
2014-05-31 03:21:04 +00:00
Saleem Abdulrasool 65dbbb5dd6 tools: avoid use of std::function
Remove the use of the std::function and replace the capturing lambda with a
non-capturing one, opting to pass the user data down to the context.  This is
needed as std::function is not yet available on all hosted platforms (it
requires RTTI, which breaks on Windows).

Thanks to Nico Rieck for pointing this out!

llvm-svn: 209607
2014-05-25 21:37:59 +00:00
Saleem Abdulrasool e8839a755a tools: split out Win64EHDumper from COFFDumper
Move the implementation of the Win64 EH printer from the COFFDumper into its own
class.  This is in preparation for adding support to print ARM EH information.
The only real change here is in printUnwindInfo where we now lambda lift the
implicit this parameter for the resolveFunction.  Also setup the printing to
handle ARM.  This now has set the stage to introduce ARM EH printing.

llvm-svn: 209606
2014-05-25 20:26:45 +00:00
Saleem Abdulrasool 4e08f62775 tools: inline simple single-use function
This inlines the single use function in preparation for splitting the Win64EH
printing out of the COFFDumper into its own entity.

llvm-svn: 209605
2014-05-25 20:26:40 +00:00
Saleem Abdulrasool 5dd27f42f9 tools: refactor COFFDumper symbol resolution logic
Make the use of the cache more transparent to the users.  There is no reason
that the cached entries really need to be passed along.  The overhead for doing
so is minimal: a single extra parameter.  This requires that some standalone
functions be brought into the COFFDumper class so that they may access the
cache.

llvm-svn: 209604
2014-05-25 20:26:37 +00:00
Saleem Abdulrasool 3617c96d46 tools: use references rather than out pointers in COFFDumper
Switch to use references for parameters that are guaranteed to be non-null.
Simplifies the code a slight bit in preparation for another change.

llvm-svn: 209603
2014-05-25 20:26:33 +00:00
Saleem Abdulrasool 443264c51f build: sort llvm-readobj sources
Sort the source files.  NFC.

llvm-svn: 209587
2014-05-24 20:04:21 +00:00
Saleem Abdulrasool 12688f40c1 llvm-readobj: remove some dead code
llvm-svn: 209586
2014-05-24 19:54:28 +00:00
Simon Atanasyan 9cb4090867 [Mips] Add more relocation types and MIPS specific e_flags constants.
llvm-svn: 209201
2014-05-20 09:27:49 +00:00
Saleem Abdulrasool 4a6f58380a llvm-readobj: use range-based for loop
Convert an additional site to a range based for loop.  NFC.

llvm-svn: 209194
2014-05-20 05:18:06 +00:00
Simon Atanasyan ca8b562709 [llvm-readobj] Print values of FLAGS and MIPS_FLAGS dynamic table tags
in a human readable form.

llvm-svn: 208489
2014-05-11 08:48:09 +00:00
Simon Atanasyan 80070b5598 [llvm-readobj] Transform 'switch' with the only 'case' statement
to 'if' statement.

No functional changes,

llvm-svn: 207748
2014-05-01 11:57:40 +00:00
Simon Atanasyan c48c58437d [llvm-readobj] Add support for Mips specific ELF header e_flags.
llvm-svn: 207744
2014-05-01 11:07:19 +00:00
Craig Topper e73658ddbb [C++] Use 'nullptr'.
llvm-svn: 207394
2014-04-28 04:05:08 +00:00
Craig Topper e6cb63e471 [C++] Use 'nullptr'. Tools edition.
llvm-svn: 207176
2014-04-25 04:24:47 +00:00
Simon Atanasyan 883b44e7d0 [C++11] Range-based loop simplification.
llvm-svn: 206715
2014-04-20 21:05:30 +00:00
Saleem Abdulrasool 3b5e00130e tools: fix invalid printing, buffer overrun in llvm-readobj
All auxiliary records are consumed when accessing a File record.

llvm-svn: 206354
2014-04-16 04:15:29 +00:00
Saleem Abdulrasool d38c6b1e4b tools: address possible non-null terminated filenames
If a filename is a multiple of 18 characters, there will be no null-terminator.
This will result in an invalid access by the constructed StringRef.  Add a test
case to exercise this and fix that handling.  Address this same vulnerability in
llvm-readobj as well.

llvm-svn: 206145
2014-04-14 02:37:23 +00:00
Saleem Abdulrasool 381037066e tools: remove duplication of coff_aux_file
Now that COFF::coff_aux_file is defined, use that rather than redefining the
type locally.

llvm-svn: 206140
2014-04-13 22:54:15 +00:00