Commit Graph

6951 Commits

Author SHA1 Message Date
Zachary Turner
8e5ffc9803 Revert "[obj2yaml] [yaml2obj] Support MachO section and section_64
structs"

This reverts commits r269845, r269846, and r269850 as they
introduce a crash in obj2yaml when trying to do a roundtrip.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269865 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 23:38:22 +00:00
David Blaikie
34ab13fd25 llvm-dwp: Move error handling code closer to use
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 23:37:44 +00:00
Rui Ueyama
dce33b5457 pdbdump: Print out more strcutures.
I don't yet fully understand the meaning of these data strcutures,
but at least it seems that their sizes and types are correct.
With this change, we can read publics streams till end.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 23:07:48 +00:00
David Blaikie
7fdce00ff3 llvm-dwp: Add error handling for multiple type sections in a dwp file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269851 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 22:00:57 +00:00
Chris Bieneman
b04144c7d6 [obj2yaml] [yaml2obj] Support MachO section and section_64 structs
This patch adds round trip support for MachO section structs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269845 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 21:31:02 +00:00
Chris Bieneman
0865cea8c3 Reapply r269782 "[obj2yaml] [yaml2obj] Support for MachO load command structures""
This adds support for all the MachO *_command structures. The load_command payloads still are not represented, but that will come next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269808 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 19:44:06 +00:00
David Blaikie
293233a048 llvm-dwp: Simplify duplicate DWO ID error handling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269805 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 19:40:28 +00:00
Reid Kleckner
4e35fa54a6 [ThinLTO] Use semicolon to separate path prefix replacement
Summary:
Colons can appear in Windows paths after drive letters. Both colon and
semicolon are valid characters in filenames, but neither are very
common. Semicolon seems just as good, and makes the test pass on
Windows.

Reviewers: tejohnson

Subscribers: joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269798 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 18:43:22 +00:00
Chris Bieneman
923a9ba5c6 Revert "[obj2yaml] [yaml2obj] Support for MachO load command structures"
This reverts commit r269782 because it broke bots with -fpermissive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269785 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 17:13:50 +00:00
Kevin Enderby
77be094e2f Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is in an archive to use something like libx.a(foo.o) as part of
the error message.

Also changed llvm-objdump and llvm-size to be like llvm-nm and ignore non-object
files in archives and not produce any error message.

To do this Archive::Child::getAsBinary() was changed from ErrorOr<...> to
Expected<...> then that was threaded up to its users.

Converting this interface 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 one place yet to be fully converted.

Again 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 comments for those.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269784 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 17:10:12 +00:00
Chris Bieneman
4a038a7aac [obj2yaml] [yaml2obj] Support for MachO load command structures
This adds support for all the MachO *_command structures. The load_command payloads still are not represented, but that will come next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269782 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 17:03:28 +00:00
Teresa Johnson
a486381660 [ThinLTO] Option to control path of distributed backend files
Summary:
Add support to control where files for a distributed backend (the
individual index files and optional imports files) are created.

This is invoked with a new thinlto-prefix-replace option in the gold
plugin and llvm-lto. If specified, expects a string of the form
"oldprefix:newprefix", and instead of generating these files in the
same directory path as the corresponding bitcode file, will use a path
formed by replacing the bitcode file's path prefix matching oldprefix
with newprefix.

Also add a new replace_path_prefix helper to Path.h in libSupport.

Depends on D19636.

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269771 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 14:45:30 +00:00
David Blaikie
4945c5367f llvm-dwp: Provide error handling for invalid string field forms
This diagnostic could be improved by adding the name of the input file
containing the invalid data and/or some information about how to
identify the specific offending attribute/tag in the input. But that's
not an immediate priority as these corner cases of invalid input
shouldn't come up too often.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269727 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17 00:07:10 +00:00
David Blaikie
dd6e786ff7 llvm-dwp: Add error handling for invalid (non-CU) top level tag in debug_info.dwo
The diagnostic could be improved a bit to include information about
which input file had the mistake (& which unit (counted, since the name
of the unit won't be accessible) within the input).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269723 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 23:26:29 +00:00
Michael Kuperstein
e7eda98078 Remove extra semicolon to fix warning. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269722 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 23:09:32 +00:00
Vedant Kumar
ce4aff93aa Revert "Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""
This reverts commit r269694. MSVC says:

error C2086: 'char llvm::ProfErrorInfoBase<enum llvm::instrprof_error>::ID' : redefinition

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269700 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 21:03:38 +00:00
Vedant Kumar
515ee3e025 Retry^2 "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Changes since the initial commit:
- Address undefined-var-template warning.
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269694 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 20:49:39 +00:00
David Blaikie
119b9304a9 llvm-dwp: Streamline duplicate DWO ID diagnostic handling
Actually use the error return path rather than printing the duplicate
information then a separate error. But also just tidy up/deduplicate
some of the code for generating the diagnostic text.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269692 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 20:42:27 +00:00
Renato Golin
3b0d377ef8 [llc] New diagnostic handler
Without a diagnostic handler installed, llc's behaviour is to exit on the first
error that it encounters. This is very different from the behaviour of clang
and other front ends, which try to gather as many errors as possible before
exiting.

This commit adds a diagnostic handler to llc, allowing it to find and report
more than one error. The old behaviour is preserved under a flag (-exit-on-error).

Some of the tests fail with the new diagnostic handler, so they have to use the
new flag in order to run under the previous behaviour. Some of these are known
bugs, others need further investigation. Ideally, we should fix the tests and
remove the flag at some point in the future.

Reapplied after fixing the LLDB build that was broken due to the new
DiagnosticSeverity in LLVMContext.h, and fixed an UB in the new change.

Patch by Diana Picus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269655 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 14:28:02 +00:00
NAKAMURA Takumi
5c6fd15179 macho2yaml.cpp: Fix "reserved" uninitialized.
FIXME: It should reflect actual field.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269645 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 11:03:56 +00:00
Davide Italiano
d1aa4ea020 [PM] Refactor cross-registration of AM into an helper.
Requested by: Chandler Carruth.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269582 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 23:21:50 +00:00
Renato Golin
7e38263edc Revert "[llc] New diagnostic handler"
This reverts commit r269563. Even though now it passes all LLDB bots
after a local fix, there's a new buildbot it fails with tests that we
hadn't seen locally:

http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/15647

Adding those tests to the list to investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269568 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 14:37:11 +00:00
Renato Golin
2c05d88b8d [llc] New diagnostic handler
Without a diagnostic handler installed, llc's behaviour is to exit on the first
error that it encounters. This is very different from the behaviour of clang
and other front ends, which try to gather as many errors as possible before
exiting.

This commit adds a diagnostic handler to llc, allowing it to find and report
more than one error. The old behaviour is preserved under a flag (-exit-on-error).

Some of the tests fail with the new diagnostic handler, so they have to use the
new flag in order to run under the previous behaviour. Some of these are known
bugs, others need further investigation. Ideally, we should fix the tests and
remove the flag at some point in the future.

Reapplied after fixing the LLDB build that was broken due to the new
DiagnosticSeverity in LLVMContext.h.

Patch by Diana Picus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269563 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 13:15:22 +00:00
Chandler Carruth
2e531af53a Revert "Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC""
This reverts commit r269491. It triggers warnings with Clang, breaking
builds for -Werror users including several build bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 05:26:26 +00:00
Mehdi Amini
b01d46ba1c Add testing in llvm-lto for ThinLTO caching.
Trying to improve code coverage for `make check`

From: mehdi_amini <mehdi_amini@91177308-0d34-0410-b5e6-96231b3b80d8>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269545 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 05:16:41 +00:00
Mehdi Amini
68d85bb896 Revert "Add testing in llvm-lto for ThinLTO caching."
This reverts commit r269538 and r269542.
"rename()" is expected to fail across filesystems, will handle this.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269543 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 05:07:44 +00:00
Mehdi Amini
82d7fff155 Add testing in llvm-lto for ThinLTO caching.
Trying to improve code coverage for `make check`

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269538 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 04:41:26 +00:00
Reid Kleckner
fed38e2afb [codeview] Add type stream merging prototype
Summary:
This code is intended to be used as part of LLD's PDB writing. Until
that exists, this is exposed via llvm-readobj for testing purposes.

Type stream merging uses the following algorithm:

- Begin with a new empty stream, and a new empty hash table that maps
  from type record contents to new type index.
- For each new type stream, maintain a map from source type index to
  destination type index.
- For each record, copy it and rewrite its type indices to be valid in
  the destination type stream.
- If the new type record is not already present in the destination
  stream hash table, append it to the destination type stream, assign it
  the next type index, and update the two hash tables.
- If the type record already exists in the destination stream, discard
  it and update the type index map to forward the source type index to
  the existing destination type index.

Reviewers: zturner, ruiu

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-14 00:02:53 +00:00
Vedant Kumar
db1d476217 Retry "[ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

Changes since the initial commit:
- Fix error message printing in llvm-profdata.
- Check errors in loadTestingFormat() + annotateAllFunctions().
- Defer error handling in InstrProfIterator to InstrProfReader.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 21:50:56 +00:00
Rui Ueyama
2acb5f6a3a pdbdump: Print "Publics" stream.
Publics stream seems to contain information as to public symbols.
It actually contains a serialized hash table along with fixed-sized
headers. This patch is not complete. It scans only till the end of
the stream and dump the header information. I'll write code to
de-serialize the hash table later.

Reviewers: zturner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269484 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 21:21:53 +00:00
Vedant Kumar
8007bdd41f Revert "(HEAD -> master, origin/master, origin/HEAD) [ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC"
This reverts commit r269462. It fails two llvm-profdata tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 20:09:39 +00:00
Vedant Kumar
5b34ed8191 [ProfileData] (llvm) Use Error in InstrProf and Coverage, NFC
Transition InstrProf and Coverage over to the stricter Error/Expected
interface.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 20:01:27 +00:00
Chris Bieneman
062cef56d2 [obj2yaml] [yaml2obj] Basic support for MachO::load_command
This patch adds basic support for MachO::load_command. Load command types and sizes are encoded in the YAML and expanded back into MachO.

The YAML doesn't yet support load command structs, that is coming next. In the meantime as a temporary measure when writing MachO files the load commands are padded with zeros so that the generated binary is valid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 17:41:41 +00:00
Renato Golin
865778e04a Revert "[llc] New diagnostic handler"
This reverts commit r269428, as it breaks the LLDB build. We need to
understand how to change LLDB in the same way as LLC before landing this
again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269432 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 16:02:44 +00:00
Renato Golin
89ca6c01c0 [llc] New diagnostic handler
Without a diagnostic handler installed, llc's behaviour is to exit on the first
error that it encounters. This is very different from the behaviour of clang
and other front ends, which try to gather as many errors as possible before
exiting.

This commit adds a diagnostic handler to llc, allowing it to find and report
more than one error. The old behaviour is preserved under a flag (-exit-on-error).

Some of the tests fail with the new diagnostic handler, so they have to use the
new flag in order to run under the previous behaviour. Some of these are known
bugs, others need further investigation. Ideally, we should fix the tests and
remove the flag at some point in the future.

Patch by Diana Picus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 15:37:46 +00:00
Daniel Sanders
acd1ec74e6 [llvm-mc-fuzzer] Use LLVMFuzzerInitialize() instead of a custom main() and FuzzerDriver()
Reviewers: kcc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269405 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 10:23:04 +00:00
Teresa Johnson
49414096bd [ThinLTO] Use correct pipeline for ThinLTO in gold-plugin.
This change is the gold side of the change made in D17115 and clang
patch r261045 to add a ThinLTO specific pipeline that moves more of
the optimization to the backends.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269386 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 01:25:31 +00:00
Adrian Prantl
07368be39d dsymutil: Fix the DWOId mismatch check for cached modules.
In verbose mode, we emit a warning if the DWOId of a skeleton CU
mismatches the DWOId of the referenced module. This patch updates the
cached DWOId after a module has been loaded to the DWOId of the module
on disk (instead of storing the DWOId we expected to load). This
allows us to correctly emit the mismatch warning for all subsequent
object files that want to import the same module. This patch also
ensures both warnings are only emitted in verbose mode.

rdar://problem/26214027

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269383 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 00:17:58 +00:00
Reid Kleckner
30e317fc1e [codeview] Try to handle errors better in record iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269381 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 23:26:23 +00:00
Hemant Kulkarni
41502c50b8 llvm-readobj: Fix GNU style entry point print width
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269376 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 22:51:26 +00:00
Hemant Kulkarni
173f1b5e61 llvm-readobj: Change Hex output for GNU style dynamic table print
Dynamic table when printed shows uppercase tag/values.
This changes it to lower case when printing in GNU style

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 22:16:53 +00:00
David Blaikie
13dad4bbfc llvm-dwp: Use llvm::Error to improve diagnostic quality/error handling in llvm-dwp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269339 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 19:59:54 +00:00
Hemant Kulkarni
edf855dc9d llvm-readobj: Fix the GNU section header flags for SHF_MASKPROC and SHF_MASKOS
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269338 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 19:58:52 +00:00
Chris Bieneman
d14ab8292e [obj2yaml] Fix ASAN bot failure
I was leaking out of a unique_ptr, should have just kept it in the unique_ptr.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/12738/steps/check-llvm%20asan/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 19:57:07 +00:00
Chris Bieneman
d6f6aaf5e7 [yaml2macho] Handle mach_header_64 reserved field
I've added the reserved field as an "optional" in YAML, but I've added asserts in the yaml2macho code to enforce that the field is present in mach_header_64, but not in mach_header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269320 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 18:21:09 +00:00
Chris Bieneman
891a32ccca [yaml2macho] Use memset instead of bzero
This should fix the bots I broke.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269319 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 18:02:13 +00:00
Zachary Turner
4f4637e6d1 Make CodeView record serialization more generic.
This introduces a variadic template and some helper macros to
safely and correctly deserialize many types of common record
fields while maintaining error checking.

Differential Revision: http://reviews.llvm.org/D20183
Reviewed By: rnk, amccarth

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269315 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 17:45:44 +00:00
Chris Bieneman
ed0b17172e [yaml2obj] Support for dumping mach_header from yaml
With this change obj2yaml and yaml2obj can now round-trip mach_headers.

This change also adds ObjectYAML/MachO tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269314 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 17:44:48 +00:00
Chris Bieneman
dfa9a6bd95 [obj2yaml] Include all mach_header fields in yaml
Since we want to be able to use yaml to describe degenerate object files as well as valid ones, we need to be explicit of some fields in your yaml definitions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269313 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 17:44:43 +00:00
Chris Bieneman
0e9948288b [macho2yaml] Add support for dumping mach_headers
This patch adds the ability to dump mach headers. For my local clang binary the macho2yaml output is now:

--- !mach-o
FileHeader:
  cputype:         0x01000007
  cpusubtype:      0x80000003
  filetype:        0x00000002
  ncmds:           19
  flags:           0x00A18085
...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269304 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 16:04:20 +00:00