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

6986 Commits

Author SHA1 Message Date
Zachary Turner
6fb9f9896d [pdb] Dump file checksums from pdb codeview line info.
llvm-svn: 271622
2016-06-03 04:01:48 +00:00
Zachary Turner
9277831e4a [codeview] Dump line number and column information.
To facilitate this, a couple of changes had to be made:

1. `ModuleSubstream` got moved from `DebugInfo/PDB` to
`DebugInfo/CodeView`, and various codeview related types are defined
there.  It turns out `DebugInfo/CodeView/Line.h` already defines many of
these structures, but this is really old code that is not endian aware,
doesn't interact well with `StreamInterface` and not very helpful for
getting stuff out of a PDB.  Eventually we should migrate the old readobj
`COFFDumper` code to these new structures, or at least merge their
functionality somehow.

2. A `ModuleSubstream` visitor is introduced.  Depending on where your
module substream array comes from, different subsets of record types can
be expected.  We are already hand parsing these substream arrays in many
places especially in `COFFDumper.cpp`.  In the future we can migrate these
paths to the visitor as well, which should reduce a lot of code in
`COFFDumper.cpp`.

Differential Revision: http://reviews.llvm.org/D20936
Reviewed By: ruiu, majnemer

llvm-svn: 271621
2016-06-03 03:25:59 +00:00
Rui Ueyama
1ca0be6e07 Fix indentation.
llvm-svn: 271620
2016-06-03 02:42:30 +00:00
Chris Bieneman
fd55102977 Revert "[yaml2obj] Sort MachO LinkEdit write operations based on offset"
This reverts commit r271611 because it broke a bot:

http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/38184

I don't currently have a handle on what went wrong, so I'll revert while I investigate.

llvm-svn: 271613
2016-06-02 23:58:13 +00:00
Chris Bieneman
79f5c0a325 [yaml2obj] Sort MachO LinkEdit write operations based on offset
Although ld64 always outputs linkedit data in the same order, it isn't actually required to. This change makes yaml2obj resilient if the offsets are in arbitrary order.

llvm-svn: 271611
2016-06-02 23:52:08 +00:00
Chris Bieneman
45ad72aa8e [obj2yaml] [yaml2obj] Support for MachO nlist and string table
This commit adds round tripping for MachO symbol data. Symbols are entries in the name list, that contain offsets into the string table which is at the end of the __LINKEDIT segment.

llvm-svn: 271604
2016-06-02 22:54:06 +00:00
NAKAMURA Takumi
1c98eb67fa Fixup r271533, or check-clang didn't find llvm-lto as the target.
llvm-svn: 271585
2016-06-02 20:39:24 +00:00
Zachary Turner
8fad65b692 [llvm-pdbdump] Dump CodeView line information.
This first pass only splits apart the records and dumps the line
info kinds and binary data.  Subsequent patches will parse out
the binary data into more useful information and dump it in
detail.

llvm-svn: 271576
2016-06-02 20:11:22 +00:00
Rui Ueyama
7cec8d0bf2 pdbdump: print out COFF section headers.
Unlike other sections that can grow to any size, the COFF section header
stream has maximum length because each record is fixed size and the COFF
file format limits the maximum number of sections. So I decided to not
create a specific stream class for it. Instead, I added a member function
to DbiStream class which returns a vector of COFF headers.

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

llvm-svn: 271557
2016-06-02 18:20:20 +00:00
David Majnemer
73daadec96 Rename IMAGE_DEBUG_TYPE_NO_TIMESTAMP to IMAGE_DEBUG_TYPE_REPRO
This matches the COFF spec

llvm-svn: 271549
2016-06-02 17:32:11 +00:00
Reid Kleckner
e95b89db7a [COFF] Expose the PE debug data directory and dump it
This directory is used to find if there is a PDB associated with an
executable. I plan to use this functionality to teach llvm-symbolizer
whether it should use DIA or DWARF to symbolize a given DLL.

Reviewers: majnemer

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

llvm-svn: 271539
2016-06-02 17:10:43 +00:00
Vedant Kumar
ac1be0e432 [llvm-cov] Use string getters (NFC)
llvm-svn: 271537
2016-06-02 17:00:50 +00:00
Zachary Turner
cc571053da [pdb] Parse and dump section map and section contribs
Differential Revision: http://reviews.llvm.org/D20876
Reviewed By: rnk, ruiu

llvm-svn: 271488
2016-06-02 05:07:49 +00:00
Tamas Berghammer
195e842656 Add new LLVM_EXTERNAL_PROJECTS option to cmake
The new option makes it possible to build external projects as part of
the llvm build without copying (or symlinking) then into llvm/tool with
specifying a few additional cmake variables.

Example usage (2 additional project called foo and bar):
-DLLVM_EXTERNAL_PROJECTS="Foo;Bar"
-DLLVM_EXTERNAL_FOO_SOURCE_DIR=/src/foo
-DLLVM_EXTERNAL_BAR_SOURCE_DIR=/src/bar

Note: This is the extension of the approach we already support for
clang/lldb/poly with adding an option to specify additional supported
projects.

Differential revision: http://reviews.llvm.org/D20838

llvm-svn: 271440
2016-06-01 23:00:45 +00:00
Petr Hosek
f990f1720d [MC] Rename EmitFill to emitFill
This is to match the overloaded variants as well as the new style.

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

llvm-svn: 271359
2016-06-01 01:59:58 +00:00
Kostya Serebryany
8380ae9ee0 llvm-pdbdump-fuzzer: fix the build
llvm-svn: 271352
2016-05-31 23:39:31 +00:00
Lang Hames
96b587081e [Orc] Add conversion to/from RuntimeDyld::SymbolInfo for JITSymbol.
This tidies up some code that was manually constructing RuntimeDyld::SymbolInfo
instances from JITSymbols. It will save more mess in the future when
JITSymbol::getAddress is extended to return an Expected<TargetAddress> rather
than just a TargetAddress, since we'll be able to embed the error checking in
the conversion.

llvm-svn: 271350
2016-05-31 23:14:26 +00:00
Reid Kleckner
ac012a3b34 Speculative build fix for codeview type dumper API change
llvm-svn: 271344
2016-05-31 22:32:54 +00:00
Kevin Enderby
945617b128 Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is from a slice of a Mach-O Universal Binary use something like
"foo.o (for architecture i386)" as part of the error message when expected.

Also fixed places in these tools that were ignoring object file errors from
MachOUniversalBinary::getAsObjectFile() when the code moved on to see if
the slice was an archive.

To do this MachOUniversalBinary::getAsObjectFile() and
MachOUniversalBinary::getObjectForArch() were changed from returning
ErrorOr<...> to Expected<...> then that was threaded up to its users.

Converting these interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now the use of
errorToErrorCode() is still used in two places yet to be fully converted.

llvm-svn: 271332
2016-05-31 20:35:34 +00:00
Reid Kleckner
05a06ad643 [codeview] Improve readability of type record assembly
Adds the method MCStreamer::EmitBinaryData, which is usually an alias
for EmitBytes. In the MCAsmStreamer case, it is overridden to emit hex
dump output like this:
        .byte   0x0e, 0x00, 0x08, 0x10
        .byte   0x03, 0x00, 0x00, 0x00
        .byte   0x00, 0x00, 0x00, 0x00
        .byte   0x00, 0x10, 0x00, 0x00

Also, when verbose asm comments are enabled, this patch prints the dump
output for each comment before its record, like this:
        # ArgList (0x1000) {
        #   TypeLeafKind: LF_ARGLIST (0x1201)
        #   NumArgs: 0
        #   Arguments [
        #   ]
        # }
        .byte   0x06, 0x00, 0x01, 0x12
        .byte   0x00, 0x00, 0x00, 0x00

This should make debugging easier and testing more convenient.

Reviewers: aaboud

Subscribers: majnemer, zturner, amccarth, aaboud, llvm-commits

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

llvm-svn: 271313
2016-05-31 18:45:36 +00:00
Reid Kleckner
0021f4c0e0 [codeview] Add a CVTypeDumper::dump(ArrayRef<uint8_t>) overload
This is a convenient wrapper when the type record is already laid out as
bytes in memory.

llvm-svn: 271309
2016-05-31 18:15:23 +00:00
Chris Bieneman
8ed7724342 [obj2yaml][yaml2obj] Support for reading and dumping the MachO export trie
The MachO export trie is a serially encoded trie keyed by symbol name. This code parses the trie and preserves the structure so that it can be dumped again.

llvm-svn: 271300
2016-05-31 17:26:36 +00:00
David Majnemer
8095f257b6 [llvm-pdbdump-fuzzer] Add a fuzzer for llvm-pdbdump
llvm-svn: 271243
2016-05-31 01:24:40 +00:00
David Majnemer
c44da87d92 [llvm-dwarfdump-fuzzer] Get this compiling again
Looks like the dwarfdump fuzzer has bitrotted, update it to take into
account updates to the libobject API.

llvm-svn: 271242
2016-05-31 01:24:33 +00:00
Benjamin Kramer
6d9ad0a6e9 Remove some 'const' specifiers that do nothing but prevent moving the argument.
Found by clang-tidy's misc-move-const-arg. While there drop some
obsolete c_str() calls.

llvm-svn: 271181
2016-05-29 10:46:35 +00:00
David Majnemer
2ee323bf42 Don't dereference a symbol iterator before checking for the end case
llvm-svn: 271173
2016-05-29 06:18:08 +00:00
Rafael Espindola
ceb4ee788c Move RelaxELFRel out to llvm-mc.
llvm-svn: 271160
2016-05-29 01:11:00 +00:00
David Majnemer
ae2b1f0c97 [COFFDumper] Validate that the next offset is not too large
llvm-svn: 271147
2016-05-28 20:04:50 +00:00
David Majnemer
35bdb1faa1 [COFFDumper] Make sure there is sufficient padding left in the string table
llvm-svn: 271146
2016-05-28 20:04:48 +00:00
David Majnemer
224ed127b5 [COFFDumper] Make sure there is sufficient padding left in the checksum
llvm-svn: 271143
2016-05-28 19:45:58 +00:00
David Majnemer
10a2f95361 [llvm-readobj] Validate the string table offset before using it
llvm-svn: 271139
2016-05-28 19:45:49 +00:00
David Majnemer
43af948fa5 Use consume instead of manually using drop_front
llvm-svn: 271137
2016-05-28 19:17:48 +00:00
David Majnemer
0b4e62545b llvm-pdbdump should have a non-zero exit code on error
llvm-svn: 271132
2016-05-28 18:25:15 +00:00
Zachary Turner
94e5255730 [pdb] Finish conversion to zero copy pdb access.
This converts remaining uses of ByteStream, which was still
left in the symbol stream and type stream, to using the new
StreamInterface zero-copy classes.

RecordIterator is finally deleted, so this is the only way left
now.  Additionally, more error checking is added when iterating
the various streams.

With this, the transition to zero copy pdb access is complete.

llvm-svn: 271101
2016-05-28 05:21:57 +00:00
Benjamin Kramer
a855b3205f Apply clang-tidy's misc-move-constructor-init throughout LLVM.
No functionality change intended, maybe a tiny performance improvement.

llvm-svn: 270997
2016-05-27 14:27:24 +00:00
Benjamin Kramer
63c3e24c6a Avoid some copies by using const references.
clang-tidy's performance-unnecessary-copy-initialization with some manual
fixes. No functional changes intended.

llvm-svn: 270988
2016-05-27 12:30:51 +00:00
George Rimar
f1afe1c451 Recommit 270977 - [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.
Fix: updated clang code which was not updated by mistake.

Original commit message:
[llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.

This patch is strongly based on previously reverted D20331.
(because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style)

Difference that this patch supports both zlib and zlib-gnu styles.

-compress-debug-sections option now supports next values:

-compress-debug-sections=zlib-gnu
-compress-debug-sections=zlib
-compress-debug-sections=none
Previously specifying -compress-debug-sections enabled zlib-gnu compression,
so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior
that was before this patch for case when compression was enabled.

Differential revision: http://reviews.llvm.org/D20676

llvm-svn: 270987
2016-05-27 12:27:32 +00:00
George Rimar
58775f45b6 Revert r270977 ([llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.)
It broke buildbot:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/13585/steps/build/logs/stdio

Initial commit message:
[llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.

This patch is strongly based on previously reverted D20331.
(because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style)

Difference that this patch supports both zlib and zlib-gnu styles.

-compress-debug-sections option now supports next values:

-compress-debug-sections=zlib-gnu
-compress-debug-sections=zlib
-compress-debug-sections=none
Previously specifying -compress-debug-sections enabled zlib-gnu compression,
so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior
that was before this patch for case when compression was enabled.

Differential revision: http://reviews.llvm.org/D20676

llvm-svn: 270978
2016-05-27 10:06:16 +00:00
George Rimar
e48e2c996b [llvm-mc] - Teach llvm-mc to generate zlib styled compression sections.
This patch is strongly based on previously reverted D20331.
(because of gnuutils < 2.26 does not support compressed debug sections in non zlib-gnu style)

Difference that this patch supports both zlib and zlib-gnu styles.

-compress-debug-sections option now supports next values:

-compress-debug-sections=zlib-gnu
-compress-debug-sections=zlib
-compress-debug-sections=none
Previously specifying -compress-debug-sections enabled zlib-gnu compression,
so anyone can put "-compress-debug-sections=zlib-gnu" to restore the behavior
that was before this patch for case when compression was enabled.

Differential revision: http://reviews.llvm.org/D20676

llvm-svn: 270977
2016-05-27 09:58:08 +00:00
Peter Collingbourne
31d9449ed2 Linker: teach the IR mover to return llvm::Error.
This will be needed in order to consistently return an Error
to clients of the API being developed in D20268.

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

llvm-svn: 270967
2016-05-27 05:21:35 +00:00
Zachary Turner
adc0d69155 [codeview] Remove StreamReader copying method.
Since we want to move toward zero-copy access to stream data, we
want to remove all instances of copying operations.  So get rid
of some of those here.

Differential Revision: http://reviews.llvm.org/D20720
Reviewed By: ruiu

llvm-svn: 270960
2016-05-27 03:51:53 +00:00
Zachary Turner
f070dd590e [codeview,pdb] Try really hard to conserve memory when reading.
PDBs can be extremely large.  We're already mapping the entire
PDB into the process's address space, but to make matters worse
the blocks of the PDB are not arranged contiguously.  So, when
we have something like an array or a string embedded into the
stream, we have to make a copy.  Since it's convenient to use
traditional data structures to iterate and manipulate these
records, we need the memory to be contiguous.

As a result of this, we were using roughly twice as much memory
as the file size of the PDB, because every stream was copied
out and re-stitched together contiguously.

This patch addresses this by improving the MappedBlockStream
to allocate from a BumpPtrAllocator only when a read requires
a discontiguous read.  Furthermore, it introduces some data
structures backed by a stream which can iterate over both
fixed and variable length records of a PDB.  Since everything
is backed by a stream and not a buffer, we can read almost
everything from the PDB with zero copies.

Differential Revision: http://reviews.llvm.org/D20654
Reviewed By: ruiu

llvm-svn: 270951
2016-05-27 01:54:44 +00:00
Rui Ueyama
bec79eea24 pdbdump: print out the name of the stream 0.
Differential Revision: http://reviews.llvm.org/D20712

llvm-svn: 270943
2016-05-27 00:32:07 +00:00
Rui Ueyama
2377837e57 pdbdump: Add -raw-all to enable all -raw-* flags.
Differential Revision: http://reviews.llvm.org/D20707

llvm-svn: 270937
2016-05-26 23:26:55 +00:00
Rui Ueyama
236464f52f Fix typo.
llvm-svn: 270934
2016-05-26 23:01:05 +00:00
Chris Bieneman
51f9af7db5 [obj2yaml][yaml2obj] Support for MachO lazy bindings
This adds support for YAML round tripping dyld info lazy bindings. The storage and format of these is the same as regular bind opcodes, they are just interpreted differently by dyld, and can have DONE opcodes in the middle of the opcode lists.

llvm-svn: 270920
2016-05-26 21:29:39 +00:00
Chris Bieneman
f4b7ec3107 [obj2yaml][yaml2obj] Support for MachO weak bindings
This adds support for YAML round tripping dyld info weak bindings. The storage and format of these is the same as regular bind opcodes, they are just interpreted differently by dyld.

llvm-svn: 270911
2016-05-26 20:50:05 +00:00
Chris Bieneman
b1907b87cd [obj2yaml][yaml2obj] Support for MachO bind opcodes
This adds support for YAML round tripping dyld info bind opcodes. Bind opcodes can have signed or unsigned LEB128 data, and they can have symbols associated with them.

llvm-svn: 270901
2016-05-26 20:06:14 +00:00
Lang Hames
3b3dc310e9 [Orc] Merge some common code for creating CompileCallbackManagers and
IndirectStubsManagers.

llvm-svn: 270874
2016-05-26 17:20:35 +00:00
Chris Bieneman
ca3f24eddb [CMake] Restrict libxar linkage to just llvm-objdump
At some point we're going to need libObject to have this dependency, but as it is now this is causing too many headaches. This commit will reduce the linkage to just llvm-objdump where it is strictly needed, and we'll cross the libObject bridge later when we need it.

llvm-svn: 270866
2016-05-26 16:32:40 +00:00