Commit Graph

7094 Commits

Author SHA1 Message Date
Diana Picus
1063f931d5 [llc] Remove exit-on-error flag from MIR tests (PR27770)
This is made possible by removing an assert in llc that assumed
MIRParser::parseLLVMModule would exit on error. MIRParser's documentation states
that it returns null if a parsing error occurs, so there's no reason to assert.
We can instead just fall through to where the check for a module is performed
and exit if it is null.

This commit is part of the clean-up after r269655.

Fixes PR27770

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272254 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 10:31:05 +00:00
Teresa Johnson
875352d9b1 [ThinLTO/gold] Enable summary-based internalization
Summary: Enable existing summary-based importing support in the gold-plugin.

Reviewers: mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272239 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 01:14:13 +00:00
Richard Smith
0eeb3d4004 Search for llvm-symbolizer binary in the same directory as argv[0], before
looking for it along $PATH. This allows installs of LLVM tools outside of
$PATH to find the symbolizer and produce pretty backtraces if they crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272232 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 00:53:21 +00:00
Zachary Turner
22ca3e86a7 [pdbdump-fuzzer] Try to fix build errors in fuzzer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272230 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 00:21:37 +00:00
Chris Bieneman
0fd0a998e1 [CMake] Cleanup uses of USES_TERMINAL
Now that we are on CMake 3.4.3 we no longer need a version check around this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272211 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 22:19:25 +00:00
Benjamin Kramer
36538ffe93 Apply most suggestions of clang-tidy's performance-unnecessary-value-param
Avoids unnecessary copies. All changes audited & pass tests with asan.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272190 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 19:09:22 +00:00
Zachary Turner
99272168e0 [pdb] Handle stream index errors better.
Reviewed By: ruiu
Differential Revision: http://reviews.llvm.org/D21128

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272172 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 17:26:39 +00:00
Benjamin Kramer
04a303b821 Avoid copies of std::strings and APInt/APFloats where we only read from it
As suggested by clang-tidy's performance-unnecessary-copy-initialization.
This can easily hit lifetime issues, so I audited every change and ran the
tests under asan, which came back clean.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272126 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 10:01:20 +00:00
Zachary Turner
44e9b3090f [pdb] Try to fix use after free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 00:25:08 +00:00
Rui Ueyama
5ae402a784 [pdbdump] Print out # of hash buckets.
In the reference code, the field name is `cHashBuckets`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272075 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 23:53:43 +00:00
Rui Ueyama
650053d1ce [pdbdump] Print out TPI hash key size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272073 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 23:44:27 +00:00
Vedant Kumar
192404027d Retry^4 "[llvm-profdata] Add option to ingest filepaths from a file"
Changes since the initial commit:
- Use echo instead of printf. This should side-step the character
  escaping issues on Windows.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 22:47:31 +00:00
George Rimar
df40105b52 [llvm-readobj] - Teach llvm-readobj to dump .gnu.version_r sections
SHT_GNU_verneed (.gnu.version_r) is a version dependency section.
It was the last symbol versioning relative section that was not dumped,
now it is.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271998 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 11:04:49 +00:00
Zachary Turner
6e00ec14d5 [pdb] Use MappedBlockStream to parse the PDB directory.
In order to efficiently write PDBs, we need to be able to make a
StreamWriter class similar to a StreamReader, which can transparently deal
with writing to discontiguous streams, and we need to use this for all
writing, similar to how we use StreamReader for all reading.

Most discontiguous streams are the typical numbered streams that appear in
a PDB file and are described by the directory, but the exception to this,
that until now has been parsed by hand, is the directory itself.
MappedBlockStream works by querying the directory to find out which blocks
a stream occupies and various other things, so naturally the same logic
could not possibly work to describe the blocks that the directory itself
resided on.

To solve this, I've introduced an abstraction IPDBStreamData, which allows
the client to query for the list of blocks occupied by the stream, as well
as the stream length. I provide two implementations of this: one which
queries the directory (for indexed streams), and one which queries the
super block (for the directory stream).

This has the side benefit of vastly simplifying the code to parse the
directory. Whereas before a mini state machine was rolled by hand, now we
simply use FixedStreamArray to read out the stream sizes, then build a
vector of FixedStreamArrays for the stream map, all in just a few lines of
code.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 05:28:55 +00:00
Vedant Kumar
4333164ff3 Revert "Retry^2 "[llvm-profdata] Add option to ingest filepaths from a file""
This reverts commit r271953. It's still breaking on Windows, though the
list initialization issue is fixed:

http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/3751

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271963 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 23:43:56 +00:00
Vedant Kumar
6039b79bbe Retry^2 "[llvm-profdata] Add option to ingest filepaths from a file"
Changes since the initial commit:
- Normalize file paths read from the file to prevent Windows path
  separators from escaping parts of the path.
- Since we need to store the normalized file paths in WeightedFile,
  don't do tricky things to keep the source MemoryBuffer alive.
- Don't use list-initialization for a std::string in WeightedFile.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271953 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 23:17:22 +00:00
Vedant Kumar
acd5f5a519 Revert "Retry "[llvm-profdata] Add option to ingest filepaths from a file"
This reverts commit r271949. It breaks the Windows build:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/12796

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271952 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 23:01:42 +00:00
Vedant Kumar
8771e1714b Retry "[llvm-profdata] Add option to ingest filepaths from a file"
Changes since the initial commit:
- Normalize file paths read from the file to prevent Windows path
  separators from escaping parts of the path.
- Since we need to store the normalized file paths in WeightedFile,
  don't do tricky things to keep the source MemoryBuffer alive.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271949 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 22:39:22 +00:00
Rui Ueyama
1895d4095b [pdbdump] Print section header flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271943 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 21:34:55 +00:00
Chris Bieneman
ce66300bb0 [yaml2obj] Get rid of MachO header union
This is based on post-commit feedback from Sean Silva.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271942 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 21:18:43 +00:00
Zachary Turner
4efa5e541f [llvm-pdbdump] Dump stream sizes and stream blocks to yaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271940 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 20:37:17 +00:00
Zachary Turner
61e0e2783c [llvm-pdbdump] Dump MSF headers to YAML.
This is the simplest possible patch to get some kind of YAML
output.  All it dumps is the MSF header fields so that in
theory an empty MSF file could be reconstructed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271939 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 20:37:05 +00:00
Rui Ueyama
24ef682bfb [pdbdump] Print out New FPO stream contents.
The data strucutre in the new FPO stream is described in the
PE/COFF spec. There is one record per function if frame pointer
is omitted.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271926 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 18:39:21 +00:00
Chandler Carruth
557c624777 [llvm-profdata] Revert r271709 and the 3 subsequent commits - the code
and/or tests aren't working on Windows currently.

There seems to be some problem with quoting the file paths. I don't
understand the test structure here or the code well enough to try to
come up with a way to correctly handle paths with back slashes in them,
and this has caused the Windows builds to be failing for 7 hours now, so
I'm reverting the whole thing to bring them back to life. Sorry for the
disruption, but a couple of these were bug fixes anyways that can be
folded into a fresh commit.

Reverts the following patches:

r271756: Clean up the way we create the input filenames buffer (NFC)
r271748: Fix use-after-free from discarded MemoryBuffer (NFC)
r271710: Fix option description (NFC)
r271709: Add option to ingest filepaths from a file

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271760 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-04 03:08:01 +00:00
Vedant Kumar
ae73627d2a [llvm-profdata] Clean up the way we create the input filenames buffer (NFC)
Create the buffer before calling parseInputFilenamesFile(), and add a
comment explaining why this is done.

Thanks to David Li for the suggestion!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271756 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-04 00:36:28 +00:00
Vedant Kumar
8288f17aa3 [llvm-profdata] Fix use-after-free from discarded MemoryBuffer (NFC)
Thanks to Justin Bogner for pointing this out!

Caught by ASAN.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271748 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 23:12:38 +00:00
Rui Ueyama
e5f15a26d7 pdbdump: print out TPI hashes.
Differential Revision: http://reviews.llvm.org/D20945

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271736 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 20:48:51 +00:00
Teresa Johnson
ca03c97596 [ThinLTO/gold] Pass import lists by reference (NFC)
In my earlier patch r271690 I missed passing a map by reference in one
place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271732 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 20:46:32 +00:00
Reid Kleckner
1ac3f3eb9d [Symbolize] Check if the PE file has a PDB and emit an error if we can't load it
Summary:
Previously we would try to load PDBs for every PE executable we tried to
symbolize. If that failed, we would fall back to DWARF. If there wasn't
any DWARF, we'd print mostly useless symbol information using the export
table.

With this change, we only try to load PDBs for executables that claim to
have them. If that fails, we can now print an error rather than falling
back silently. This should make it a lot easier to diagnose and fix
common symbolization issues, such as not having DIA or not having a PDB.

Reviewers: zturner, eugenis

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271725 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 20:25:09 +00:00
Zachary Turner
041e9f2c56 [llvm-pdbdump] Introduce an abstraction for the output style.
This opens the door to introducing a YAML outputter which can be
used for machine consumption.  Currently the yaml output style
is unimplemented and returns an error if you try to use it.

Reviewed By: rnk, ruiu
Differential Revision: http://reviews.llvm.org/D20967

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271712 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 19:28:33 +00:00
Vedant Kumar
c992504387 [llvm-profdata] Fix option description (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271710 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 19:10:25 +00:00
Vedant Kumar
c80b40eaea [llvm-profdata] Add option to ingest filepaths from a file
Differential Revision: http://reviews.llvm.org/D20980

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271709 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 19:05:20 +00:00
Teresa Johnson
7afe8bff4c [ThinLTO/gold] Pass down the imports lists from the thin link (NFC)
No longer need to compute the imports in each backend thread.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271690 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 17:15:54 +00:00
Chris Bieneman
b7daa1728d [yaml2obj] Sort MachO LinkEdit write operations based on offset
This re-applies r271611, and hopefully the bots won't break this time.

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271687 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 16:58:05 +00:00
Vedant Kumar
ae4bf05906 Trim some spaces (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271681 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 15:58:59 +00:00
Zachary Turner
f7d0c1f9cf [pdb] Print out file names instead of file offsets.
When printing line information and file checksums, we were printing
the file offset field from the struct header.  This teaches
llvm-pdbdump how to turn those numbers into the filename.  In the
case of file checksums, this is done by looking in the global
string table.  In the case of line contributions, this is done
by indexing into the file names buffer of the DBI stream.  Why
they use a different technique I don't know.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271630 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 05:52:57 +00:00
Zachary Turner
c5689fd37c [pdb] Dump file checksums from pdb codeview line info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271622 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 04:01:48 +00:00
Zachary Turner
7e17f48869 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 03:25:59 +00:00
Rui Ueyama
a4bbfe5926 Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03 02:42:30 +00:00
Chris Bieneman
865444b50d 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271613 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 23:58:13 +00:00
Chris Bieneman
a83a726efc [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271611 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 23:52:08 +00:00
Chris Bieneman
4aa4497a7d [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271604 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 22:54:06 +00:00
NAKAMURA Takumi
ba1a4e2c28 Fixup r271533, or check-clang didn't find llvm-lto as the target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 20:39:24 +00:00
Zachary Turner
b36db5aff2 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271576 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 20:11:22 +00:00
Rui Ueyama
698e829b29 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 18:20:20 +00:00
David Majnemer
2dffc15239 Rename IMAGE_DEBUG_TYPE_NO_TIMESTAMP to IMAGE_DEBUG_TYPE_REPRO
This matches the COFF spec

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 17:32:11 +00:00
Reid Kleckner
fb1a91169a [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271539 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 17:10:43 +00:00
Vedant Kumar
706cb9d996 [llvm-cov] Use string getters (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271537 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 17:00:50 +00:00
Zachary Turner
8839a0f88f [pdb] Parse and dump section map and section contribs
Differential Revision: http://reviews.llvm.org/D20876
Reviewed By: rnk, ruiu

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271488 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02 05:07:49 +00:00
Tamas Berghammer
d9d9726dd8 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271440 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 23:00:45 +00:00