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

161 Commits

Author SHA1 Message Date
David Majnemer
6dd8f341ed Object: Add support for bigobj
This adds support for reading the "bigobj" variant of COFF produced by
cl's /bigobj and mingw's -mbig-obj.

The most significant difference that bigobj brings is more than 2**16
sections to COFF.

bigobj brings a few interesting differences with it:
- It doesn't have a Characteristics field in the file header.
- It doesn't have a SizeOfOptionalHeader field in the file header (it's
  only used in executable files).
- Auxiliary symbol records have the same width as a symbol table entry.
  Since symbol table entries are bigger, so are auxiliary symbol
  records.

Write support will come soon.

Differential Revision: http://reviews.llvm.org/D5259

llvm-svn: 217496
2014-09-10 12:51:52 +00:00
Craig Topper
57c93cf3ef Remove 'virtual' keyword from methods markedwith 'override' keyword.
llvm-svn: 216823
2014-08-30 16:48:34 +00:00
Craig Topper
43cee2f5fc Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
llvm-svn: 216525
2014-08-27 05:25:25 +00:00
Rafael Espindola
08aa78de63 Don't own the buffer in object::Binary.
Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries
(like Archive) and we had to create dummy buffers just to handle that. It is
also a bad fit for IRObjectFile where the Module wants to own the buffer too.

Keeping this ownership would make supporting IR inside native objects
particularly painful.

This patch focuses in lib/Object. If something elsewhere used to own an Binary,
now it also owns a MemoryBuffer.

This patch introduces a few new types.

* MemoryBufferRef. This is just a pair of StringRefs for the data and name.
  This is to MemoryBuffer as StringRef is to std::string.
* OwningBinary. A combination of Binary and a MemoryBuffer. This is needed
  for convenience functions that take a filename and return both the
  buffer and the Binary using that buffer.

The C api now uses OwningBinary to avoid any change in semantics. I will start
a new thread to see if we want to change it and how.

llvm-svn: 216002
2014-08-19 18:44:46 +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
4d002fe555 getLoadName is only implemented for ELF, make it ELF only.
llvm-svn: 215219
2014-08-08 16:39:22 +00:00
Rafael Espindola
19e7ab14ac 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
191faa331e Use std::unique_ptr to make the ownership explicit.
llvm-svn: 214377
2014-07-31 03:12:45 +00:00
Simon Atanasyan
a3c42e92aa [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
e8f2f2cf55 [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
2112de25ee 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
0512c5d49b 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
a85c76778d 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
97022b0c1f 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
fd9ead3b6f 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
dbf36c2043 [llvm-readobj] Fix member functions name style.
llvm-svn: 211152
2014-06-18 09:24:01 +00:00
Simon Atanasyan
3f3206fc86 [llvm-readobj] Fix compile error.
llvm-svn: 211151
2014-06-18 09:23:55 +00:00
Simon Atanasyan
93ed003276 [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
910ec52f4e 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
526c55c690 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
5c15b3d369 Remove 'using std::error_code' from tools.
llvm-svn: 210876
2014-06-13 03:07:50 +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
Rafael Espindola
38dc624425 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
b0ac81f225 Don't import error_category into the llvm namespace.
llvm-svn: 210733
2014-06-12 01:45:43 +00:00
Rafael Espindola
c7f351302b Don't import error_condition into the llvm namespace.
llvm-svn: 210731
2014-06-12 01:29:42 +00:00
Rafael Espindola
cb080681ac 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
d88b6052f3 Use an enum class.
llvm-svn: 210623
2014-06-11 01:22:20 +00:00
Rafael Espindola
80bf4067ff 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
b1c79d4bd5 [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
568c389daa 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
e290e5528b 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
0fa1064ffc 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
dbc78461b0 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
bc0f9b7dd0 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
bc05e277f9 [Object][ELF] Range-based loop simplification.
No functional changes.

llvm-svn: 210164
2014-06-04 05:51:44 +00:00
Rafael Espindola
a46bdb6d4d There is no std::errc::success, remove the llvm one.
llvm-svn: 209960
2014-05-31 03:21:04 +00:00
Saleem Abdulrasool
98b69428dc 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
42cc0f9213 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
e05f29ea98 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
4d1896304d 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
2514c5a7e8 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
91556633a7 build: sort llvm-readobj sources
Sort the source files.  NFC.

llvm-svn: 209587
2014-05-24 20:04:21 +00:00
Saleem Abdulrasool
87d5928f6a llvm-readobj: remove some dead code
llvm-svn: 209586
2014-05-24 19:54:28 +00:00
Simon Atanasyan
1dd1d4e3a7 [Mips] Add more relocation types and MIPS specific e_flags constants.
llvm-svn: 209201
2014-05-20 09:27:49 +00:00
Saleem Abdulrasool
4ac71f7fe6 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
026ba36cfb [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
63414e15c9 [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
a758825238 [llvm-readobj] Add support for Mips specific ELF header e_flags.
llvm-svn: 207744
2014-05-01 11:07:19 +00:00
Craig Topper
b663bffa27 [C++] Use 'nullptr'.
llvm-svn: 207394
2014-04-28 04:05:08 +00:00