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
Steven Wu
2a3de303da Revert "[CMake] LINK_LIBS need to be public for Darwin dylib targets"
This reverts r270723. This commit breaks greendragon.

llvm-svn: 270820
2016-05-26 04:35:35 +00:00
Teresa Johnson
be0a5b6b13 [ThinLTO/gold] Handle bitcode archives
Summary:
Several changes were required for ThinLTO links involving bitcode
archive static libraries. With this patch clang/llvm bootstraps with
ThinLTO and gold.

The first is that the gold callbacks get_input_file and
release_input_file can normally be used to get file information for
each constituent bitcode file within an archive. However, these
interfaces lock the underlying file and can't be for each archive
constituent for ThinLTO backends where we get all the input files up
front and don't release any until after the backend threads complete.
However, it is sufficient to only get and release once per file, and
then each consituent bitcode file can be accessed via get_view. This
required saving some information to identify which file handle is the
"leader" for each claimed file sharing the same file descriptor, and
other information so that get_input_file isn't necessary later when
processing the backends.

Second, the module paths in the index need to distinguish between
different constituent bitcode files within the same archive file,
otherwise they will all end up with the same archive file path.
Do this by appending the offset within the archive for the start of the
bitcode file, returned by get_input_file when we claim each bitcode file,
and saving that along with the file handle.

Third, rather than have the function importer try to load a file based
on the module path identifier (which now contains a suffix to
distinguish different bitcode files within an archive), use a custom
module loader. This is the same approach taken in libLTO, and I am using
the support refactored into the new LTO.h header in r270509. The module
loader parses the bitcode files out of the memory buffers returned from
gold via the get_view callback and saved in a map. This also means that
we call the function importer directly, rather than add it to the pass
pipeline (which was in the plan to do already for other reasons).

Reviewers: pcc, joker.eph

Subscribers: llvm-commits, joker.eph

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

llvm-svn: 270814
2016-05-26 01:46:41 +00:00
Saleem Abdulrasool
a8d68795c3 llvm-objdump: support dumping AUX records for weak externals
This is a support COFF feature.  Ensure that we can display the weak externals
auxiliary symbol.  It contains useful information (such as the default binding
and how to resolve the symbol).

This reapplies the previous patch with a modification which hopefully should fix
the endianness issues.  The variadic call would promote the ulittle32_t to a
uint32_t which would lose the byte-swapping behaviour desired.

llvm-svn: 270813
2016-05-26 01:45:12 +00:00
David Blaikie
a25f65e650 llvm-dwp: Ensure uncompressed sections are not relocated during processing of later inputs
Richard Smith identified this in post commit review of r270466. The
string sections in particular (in the future, possibly all sections - so
I'm not going to bother pulling out just the string sections for the
extra lifetime handling right now) need to remain valid during
processing of all inputs so that elements of the DWPStringPool can be
looked up repeatedly without having to make in-memory copies of string
contents in the noncompressed case (more common in dwp+dwp merge steps
where the memory is a bigger problem because the files are larger).

Using the SmallVector (or any vector) a reallocation on push_back could
cause any of the nested SmallStrings in small mode to move in memory and
invalid pointers to their contents. Using a deque the SmallStrings will
never move around since no elements are removed from the container.

llvm-svn: 270797
2016-05-25 23:37:06 +00:00
Zachary Turner
493dc32ae8 [codeview] Move StreamInterface and StreamReader to libcodeview.
We have need to reuse this functionality, including making
additional generic stream types that are smarter about how and
when they copy memory versus referencing the original memory.
So all of these structures belong in the common library
rather than being pdb specific.

llvm-svn: 270751
2016-05-25 20:37:03 +00:00
Zachary Turner
8c7c869714 [llvm-pdbdump] Dump raw stream contents as binary block.
Dumping it as ASCII makes it fairly useless.

llvm-svn: 270742
2016-05-25 18:32:07 +00:00
Chris Bieneman
d8d2780ae0 [obj2yaml] [yaml2obj] MachO support for rebase opcodes
This is the first bit of support for MachO __LINKEDIT segment data.

llvm-svn: 270724
2016-05-25 17:09:07 +00:00
Chris Bieneman
2b1c02aa22 [CMake] LINK_LIBS need to be public for Darwin dylib targets
This should actually address PR27855. This results in adding references to the system libs inside generated dylibs so that they get correctly pulled in when linking against the dylib.

llvm-svn: 270723
2016-05-25 17:08:43 +00:00
Lang Hames
0a4d39f9bf [RuntimeDyld] Call the SymbolResolver::findSymbolInLogicalDylib method when
searching for external symbols, and fall back to the SymbolResolver::findSymbol
method if the former returns null.

This makes RuntimeDyld behave more like a static linker: Symbol definitions
from within the current module's "logical dylib" will be preferred to
external definitions. We can build on this behavior in the future to properly
support weak symbol handling.

Custom symbol resolvers that override the findSymbolInLogicalDylib method may
notice changes due to this patch. Clients who have not overridden this method
should generally be unaffected, however users of the OrcMCJITReplacement class
may notice changes.

llvm-svn: 270716
2016-05-25 16:23:59 +00:00
Zachary Turner
d50b930aa6 [llvm-pdbdump] Decipher the remaining PDB streams.
We know at least know the meaning of every stream of the
PDB file.  Yay!

llvm-svn: 270669
2016-05-25 05:49:48 +00:00
Saleem Abdulrasool
f7d75a7227 Revert "llvm-objdump: support dumping AUX records for weak externals"
Revert it until we can figure out the endianness issue.

llvm-svn: 270667
2016-05-25 05:45:02 +00:00
Zachary Turner
7e718f26a3 [llvm-pdbdump] Dump the IPI stream and all records.
llvm-svn: 270661
2016-05-25 04:35:22 +00:00
Zachary Turner
2984a1ea1d [llvm-pdbdump] Stream 0 isn't actually the MSF superblock.
Oddly enough, I realized we don't actually know what stream
0 is (if anything).

llvm-svn: 270655
2016-05-25 03:53:16 +00:00
Zachary Turner
fff89b5e93 [llvm-pdbdump] Dump stream summary list.
Try to figure out what each stream is, and dump its name.

This gives us a better picture of what streams we still don't
understand.

llvm-svn: 270653
2016-05-25 03:43:17 +00:00
Saleem Abdulrasool
73cac6f912 llvm-objdump: support dumping AUX records for weak externals
This is a support COFF feature.  Ensure that we can display the weak externals
auxiliary symbol.  It contains useful information (such as the default binding
and how to resolve the symbol).

llvm-svn: 270648
2016-05-25 01:59:32 +00:00
Zachary Turner
4aa4d6e21a [codeview] Add support for new type records.
This adds support for parsing and dumping the following
symbol types:

S_LPROCREF
S_ENVBLOCK
S_COMPILE2
S_REGISTER
S_COFFGROUP
S_SECTION
S_THUNK32
S_TRAMPOLINE

As of this patch, the test PDB files no longer have any unknown
symbol types.

llvm-svn: 270628
2016-05-24 22:58:46 +00:00
Zachary Turner
05becfe923 Remove unused global variable.
llvm-svn: 270610
2016-05-24 20:48:18 +00:00
Zachary Turner
4f6bada416 [llvm-pdbdump] Rework command line options.
When dumping huge PDB files, too many of the options were grouped
together so you would get neverending spew of output.  This patch
introduces more granular display options so you can only dump the
fields you actually care about.

llvm-svn: 270607
2016-05-24 20:31:48 +00:00
Peter Collingbourne
665c2772fd Add FIXMEs to all derived classes of std::error_category.
This helps make clear that we're moving away from std::error_code.

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

llvm-svn: 270604
2016-05-24 20:13:46 +00:00
Zachary Turner
8f47ac2281 [codeview, pdb] Dump symbol records in publics stream
Differential Revision: http://reviews.llvm.org/D20580
Reviewed By: ruiu

llvm-svn: 270597
2016-05-24 18:55:14 +00:00
Zachary Turner
8a810b70e5 Dump symbol record details in llvm-pdbdump
This makes use of the newly introduced `CVSymbolVisitor` to dump details
of each type of symbol record in the symbol streams.  Future patches will
bring this visitor based dumping to the publics stream, as well as
creating a `SymbolDumpDelegate` to print more information about
relocations etc.

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

llvm-svn: 270585
2016-05-24 17:30:25 +00:00
Zachary Turner
10ec45b080 Remove unused variable breaking -Werror builds.
llvm-svn: 270529
2016-05-24 03:32:34 +00:00
Zachary Turner
3c95980335 Make a symbol visitor and use it to dump CV symbols.
Differential Revision: http://reviews.llvm.org/D20534
Reviewed By: rnk

llvm-svn: 270511
2016-05-23 23:41:13 +00:00
David Blaikie
2f24ecd6f1 llvm-dwp: Reduce indentation
llvm-svn: 270507
2016-05-23 22:38:06 +00:00
David Blaikie
615566d9bf llvm-dwp: Split out processing of input sections to improve readability
llvm-svn: 270503
2016-05-23 22:21:10 +00:00
Kevin Enderby
df7d6cf49c Tweak to change in r270491 to deal with the lld-x86_64-darwin13 bot having a old xar.h header.
Reviewed the change with Chris Bieneman and Pete Cooper.

llvm-svn: 270502
2016-05-23 22:18:59 +00:00
David Blaikie
dbfa9e5cd4 llvm-dwp: Pull out compression handling helper
llvm-svn: 270496
2016-05-23 21:58:58 +00:00
Kevin Enderby
b9ab4d056f Add the printing the Mach-O (__LLVM,__bundle) xar archive file section "verbosely"
to llvm-objdump. This section is created with -fembed-bitcode option.

This requires the use of libxar and the Cmake and lit support were crafted by
Chris Bieneman!

rdar://26202242

llvm-svn: 270491
2016-05-23 21:34:12 +00:00
Zachary Turner
13dc004006 [codeview] Refactor symbol records to use same pattern as types.
This will pave the way to introduce a full fledged symbol visitor
similar to how we have a type visitor, thus allowing the same
dumping code to be used in llvm-readobj and llvm-pdbdump.

Differential Revision: http://reviews.llvm.org/D20384
Reviewed By: rnk

llvm-svn: 270475
2016-05-23 18:49:06 +00:00
David Blaikie
b01b833a5e llvm-dwp: More error handling around invalid compressed sections
llvm-svn: 270466
2016-05-23 17:59:17 +00:00
David Blaikie
77e2059e14 llvm-dwp: Ensure compressed sections are preserved long enough for use in the string pool
Now that the string pool is referential rather than maintaining its own
copy of string data, compressed sections (well, technically only the
debug_str section*) need to be preserved for the lifetime of the pool to
match.

* I'm not currently optimizing for memory footprint with compressed
  input - the major memory limit I'm hitting is on dwp+dwp merge steps
  and we aren't currently compressing contents in dwp files, just in the
  .dwo inputs.

llvm-svn: 270462
2016-05-23 17:35:51 +00:00
David Blaikie
339c628352 llvm-dwp: Fix the build by moving DWPStringPool into the llvm namespace
llvm-svn: 270453
2016-05-23 16:45:00 +00:00
Xinliang David Li
25d45137cc [profile] show more statistics
Add value profile statistics with the 'show' command.

llvm-svn: 270450
2016-05-23 16:36:11 +00:00
David Blaikie
dd10c6a431 llvm-dwp: Add an abstraction for the DWP string pool
Also reference strings in the memory mapped file, reduces memory usage
on a large test case by 18.5%.

llvm-svn: 270449
2016-05-23 16:32:11 +00:00
George Rimar
8a63746f19 [llvm-readobj] - Teach readobj to recognize SHF_COMPRESSED flag.
Main problem here was that SHF_COMPRESSED has the same value with
XCORE_SHF_CP_SECTION, which was included as standart (common) flag.
As far I understand xCore is a family of controllers and it that
means it's constant should be processed separately,
only if e_machine == EM_XCORE, otherwise llvm-readobj would output
different constants twice for compressed section:

Flags [
..
SHF_COMPRESSED (0x800)
..
XCORE_SHF_CP_SECTION (0x800)
..
]

what probably does not make sence if you're not working with xcore file.

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

llvm-svn: 270320
2016-05-21 10:16:58 +00:00
Chris Bieneman
c0ccb88987 [yaml2obj] [MachO] Fill Segment and Section data
This fills section data with 0xDEADBEEF and segment data not inside a section with 0xBAADDA7A. This results in yaml2obj generating a matching size object file. Any additional bytes in the file are zero'd.

This is a starting point for populating the remaining segment data, and provides a hex viewable file that you can easily see the missing data in.

llvm-svn: 270286
2016-05-20 22:31:50 +00:00
Adrian Prantl
b0eca4f464 dsymutil/modules: Reword the warning for static libraries without module caches
In addition to clarifying the warning message this contains a minor functional
change in that it now warns if the *immediate* parent directory in which the
missing PCM is expected to be isn't found.

This patch also includes a more comprehensive testcase.

rdar://problem/25860711

llvm-svn: 270269
2016-05-20 20:36:06 +00:00
Rui Ueyama
6e6f949eb0 pdbdump: print out symbol names referred by publics stream.
DBI stream contains a stream number of the symbol record stream.
Symbol record streams is an array of length-type-value members.
Each member represents one symbol.

Publics stream contains offsets to the symbol record stream.
This patch is to print out all symbols that are referenced by
the publics stream.

Note that even with this patch, llvm-pdbdump cannot dump all the
information in a publics stream since it contains more information
than symbol names. I'll improve it in followup patches.

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

llvm-svn: 270262
2016-05-20 19:55:17 +00:00
Chris Bieneman
2718792478 [yaml2obj] Removing debug code that scribbled 0xDEADBEEF
Now that MachO load command fields are fully covered we can fill unaccounted for bytes with 0. That allows us to sparsely specify YAML to simplify tests.

Simplifying load_commands test accordingly.

llvm-svn: 270158
2016-05-19 23:26:31 +00:00
Easwaran Raman
22b9d19212 Remove specializations of ProfileSummary
This removes the subclasses of ProfileSummary, moves the members of the derived classes to the base class.

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

llvm-svn: 270143
2016-05-19 21:53:28 +00:00
Easwaran Raman
5807e047c7 Move ProfileSummary to IR.
This splits ProfileSummary into two classes: a ProfileSummary class that has methods to convert from/to metadata and a ProfileSummaryBuilder class that computes the profiles summary which is in ProfileData.

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

llvm-svn: 270136
2016-05-19 21:07:12 +00:00
Chris Bieneman
d8b6eab87c [obj2yaml] [yaml2obj] Support for MachO Load Command data
This re-applies r270115.

Many of the MachO load commands can have data appended after the command structure. This data is frequently strings, but can actually be anything. This patch adds support for three optional fields on load command yaml descriptions.

The new PayloadString YAML field is populated with the data after load commands known to have strings as extra data.

The new ZeroPadBytes YAML field is a count of zero'd bytes after the end of the load command structure before the next command. This can apply anywhere in the file. MachO2YAML verifies that bytes are zero before populating this field, and YAML2MachO will add zero'd bytes.

The new PayloadBytes YAML field stores all bytes after the end of the load command structure before the next command if they are non-zero. This is a catch all for all unhandled bytes. If MachO2Yaml populates PayloadBytes it will not populate ZeroPadBytes, instead zero'd bytes will be in the PayloadBytes structure.

llvm-svn: 270124
2016-05-19 20:54:43 +00:00
Chris Bieneman
5f30aae971 Revert "[obj2yaml] [yaml2obj] Support for MachO Load Command data"
This reverts commit r270115.

This failed on several builders using GCC.

llvm-svn: 270121
2016-05-19 20:48:54 +00:00
Chris Bieneman
49b06248fa [obj2yaml] [yaml2obj] Support for MachO Load Command data
Many of the MachO load commands can have data appended after the command structure. This data is frequently strings, but can actually be anything. This patch adds support for three optional fields on load command yaml descriptions.

The new PayloadString YAML field is populated with the data after load commands known to have strings as extra data.

The new ZeroPadBytes YAML field is a count of zero'd bytes after the end of the load command structure before the next command. This can apply anywhere in the file. MachO2YAML verifies that bytes are zero before populating this field, and YAML2MachO will add zero'd bytes.

The new PayloadBytes YAML field stores all bytes after the end of the load command structure before the next command if they are non-zero. This is a catch all for all unhandled bytes. If MachO2Yaml populates PayloadBytes it will not populate ZeroPadBytes, instead zero'd bytes will be in the PayloadBytes structure.

llvm-svn: 270115
2016-05-19 20:40:03 +00:00
Matthew Simpson
84afa7c057 [ARM, AArch64] Properly initialize InterleavedAccessPass
InterleavedAccessPass is an IR-level pass, so this change will enable testing
it with opt. This is part of D20250.

llvm-svn: 270101
2016-05-19 20:08:32 +00:00
Rui Ueyama
40e46622a7 pdbdump: Rename NumberOfSymbols -> SymbolRecordStreamIndex.
Differential Revision: http://reviews.llvm.org/D20441

llvm-svn: 270088
2016-05-19 18:05:58 +00:00
Peter Collingbourne
1d69c09bab CodeGen: Make the global-merge pass independently testable, and add a test.
llvm-svn: 270023
2016-05-19 04:38:56 +00:00
Vedant Kumar
d34b10ac08 Retry^3 "[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.
- Remove the base ProfError class to work around an MSVC ICE.

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

llvm-svn: 270020
2016-05-19 03:54:45 +00:00
Chris Bieneman
fa3ade1f8d [obj2yaml] Refactoring of dumping MachO section structs
This refactoring is to reduce code duplication between the 32-bit and 64-bit code paths. This refactoring will also make the special casing for other data after load commands cleaner.

llvm-svn: 270001
2016-05-18 23:22:53 +00:00
Rafael Espindola
22e87bbb08 Delete Reloc::Default.
Having an enum member named Default is quite confusing: Is it distinct
from the others?

This patch removes that member and instead uses Optional<Reloc> in
places where we have a user input that still hasn't been maped to the
default value, which is now clear has no be one of the remaining 3
options.

llvm-svn: 269988
2016-05-18 22:04:49 +00:00
Rui Ueyama
d59ebbac95 pdbdump: Print out section offsets in the publics stream.
llvm-svn: 269955
2016-05-18 16:24:16 +00:00
Chris Bieneman
8c72d15f64 Re-apply: [obj2yaml] [yaml2obj] Support MachO section and section_64
This re-applies r269845, r269846, and r269850 with an included fix for a crash reported by zturner.

llvm-svn: 269953
2016-05-18 16:17:23 +00:00
Rafael Espindola
6da3617e7f Don't pass a Reloc::Model to MC.
MC only needs to know if the output is PIC or not. It never has to
decide about creating GOTs and PLTs for example. The only thing that
MC itself uses this information for is expanding "macros" in sparc and
mips. The rest I am pretty sure could be moved to CodeGen.

This is a cleanup and isolates the code from future changes to
Reloc::Model.

llvm-svn: 269909
2016-05-18 11:58:50 +00:00
Igor Kudrin
5a4a55829a [Coverage] Ensure that coverage mapping data has an expected alignment in 'covmapping' files.
Coverage mapping data is organized in a sequence of blocks, each of which is expected
to be aligned by 8 bytes. This feature is used when reading those blocks, see
VersionedCovMapFuncRecordReader::readFunctionRecords(). If a misaligned covearge
mapping data has more than one block, it causes llvm-cov to fail.

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

llvm-svn: 269887
2016-05-18 07:43:27 +00:00
Rafael Espindola
3751b71001 Delete default in fully covered switch.
llvm-svn: 269872
2016-05-18 00:31:06 +00:00
Zachary Turner
d4ae961cf6 [codeview] Some cleanup of Symbol Records.
* Reworks the CVSymbolTypes.def to work similarly to TypeRecords.def.
* Moves some enums from SymbolRecords.h to CodeView.h to maintain
  consistency with how we do type records.
* Generalize a few simple things like the record prefix
* Define the leaf enum and the kind enum similar to how we do with tyep
  records.

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

llvm-svn: 269867
2016-05-17 23:50:21 +00:00
David Blaikie
56a4c5b60b llvm-dwp: remove some unused error handling
llvm-svn: 269866
2016-05-17 23:44:13 +00:00
Zachary Turner
a7ce30b430 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.

llvm-svn: 269865
2016-05-17 23:38:22 +00:00
David Blaikie
5fe872cab0 llvm-dwp: Move error handling code closer to use
llvm-svn: 269864
2016-05-17 23:37:44 +00:00
Rui Ueyama
4030cd1dc2 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

llvm-svn: 269861
2016-05-17 23:07:48 +00:00
David Blaikie
c166a45a3c llvm-dwp: Add error handling for multiple type sections in a dwp file.
llvm-svn: 269851
2016-05-17 22:00:57 +00:00
Chris Bieneman
7ed2a58718 [obj2yaml] [yaml2obj] Support MachO section and section_64 structs
This patch adds round trip support for MachO section structs.

llvm-svn: 269845
2016-05-17 21:31:02 +00:00
Chris Bieneman
6f0b608b03 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.

llvm-svn: 269808
2016-05-17 19:44:06 +00:00
David Blaikie
110042ad5b llvm-dwp: Simplify duplicate DWO ID error handling
llvm-svn: 269805
2016-05-17 19:40:28 +00:00
Reid Kleckner
be9dd41d28 [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

llvm-svn: 269798
2016-05-17 18:43:22 +00:00
Chris Bieneman
8ea85f87a5 Revert "[obj2yaml] [yaml2obj] Support for MachO load command structures"
This reverts commit r269782 because it broke bots with -fpermissive.

llvm-svn: 269785
2016-05-17 17:13:50 +00:00
Kevin Enderby
9024f597c5 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.

llvm-svn: 269784
2016-05-17 17:10:12 +00:00
Chris Bieneman
62cf49e4fb [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.

llvm-svn: 269782
2016-05-17 17:03:28 +00:00
Teresa Johnson
8a51792cf4 [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

llvm-svn: 269771
2016-05-17 14:45:30 +00:00
David Blaikie
b2196ac249 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.

llvm-svn: 269727
2016-05-17 00:07:10 +00:00
David Blaikie
db05b7f61e 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).

llvm-svn: 269723
2016-05-16 23:26:29 +00:00
Michael Kuperstein
a338cd2790 Remove extra semicolon to fix warning. NFC.
llvm-svn: 269722
2016-05-16 23:09:32 +00:00
Vedant Kumar
e233548c19 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

llvm-svn: 269700
2016-05-16 21:03:38 +00:00
Vedant Kumar
511487a013 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

llvm-svn: 269694
2016-05-16 20:49:39 +00:00
David Blaikie
5730660c55 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.

llvm-svn: 269692
2016-05-16 20:42:27 +00:00
Renato Golin
8761d9ca19 [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.

llvm-svn: 269655
2016-05-16 14:28:02 +00:00
NAKAMURA Takumi
8c7afb73df macho2yaml.cpp: Fix "reserved" uninitialized.
FIXME: It should reflect actual field.
llvm-svn: 269645
2016-05-16 11:03:56 +00:00
Davide Italiano
e4bb443f4f [PM] Refactor cross-registration of AM into an helper.
Requested by: Chandler Carruth.

llvm-svn: 269582
2016-05-14 23:21:50 +00:00
Renato Golin
9a07441a63 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.

llvm-svn: 269568
2016-05-14 14:37:11 +00:00
Renato Golin
2f3e6a2fbd [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.

llvm-svn: 269563
2016-05-14 13:15:22 +00:00
Chandler Carruth
838142a962 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.

llvm-svn: 269547
2016-05-14 05:26:26 +00:00
Mehdi Amini
58e5c7badc 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>
llvm-svn: 269545
2016-05-14 05:16:41 +00:00
Mehdi Amini
96aab75b5f 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>
llvm-svn: 269543
2016-05-14 05:07:44 +00:00
Mehdi Amini
fd2524bbf4 Add testing in llvm-lto for ThinLTO caching.
Trying to improve code coverage for `make check`

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 269538
2016-05-14 04:41:26 +00:00
Reid Kleckner
79a13a2ef0 [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

llvm-svn: 269521
2016-05-14 00:02:53 +00:00
Vedant Kumar
b1f881cc44 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

llvm-svn: 269491
2016-05-13 21:50:56 +00:00
Rui Ueyama
497f2c0f25 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

llvm-svn: 269484
2016-05-13 21:21:53 +00:00
Vedant Kumar
f80d958e78 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.

llvm-svn: 269466
2016-05-13 20:09:39 +00:00
Vedant Kumar
edf8350f15 [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

llvm-svn: 269462
2016-05-13 20:01:27 +00:00
Chris Bieneman
58dc349826 [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.

llvm-svn: 269442
2016-05-13 17:41:41 +00:00
Renato Golin
b3cf714aaf 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.

llvm-svn: 269432
2016-05-13 16:02:44 +00:00
Renato Golin
212232b871 [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.

llvm-svn: 269428
2016-05-13 15:37:46 +00:00
Daniel Sanders
06e5313251 [llvm-mc-fuzzer] Use LLVMFuzzerInitialize() instead of a custom main() and FuzzerDriver()
Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 269405
2016-05-13 10:23:04 +00:00
Teresa Johnson
15c15dfb52 [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.

llvm-svn: 269386
2016-05-13 01:25:31 +00:00
Adrian Prantl
f3265872ed 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

llvm-svn: 269383
2016-05-13 00:17:58 +00:00
Reid Kleckner
a9f9bd2354 [codeview] Try to handle errors better in record iterator
llvm-svn: 269381
2016-05-12 23:26:23 +00:00
Hemant Kulkarni
8e06fdb590 llvm-readobj: Fix GNU style entry point print width
llvm-svn: 269376
2016-05-12 22:51:26 +00:00
Hemant Kulkarni
83b2bb885f 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

llvm-svn: 269368
2016-05-12 22:16:53 +00:00
David Blaikie
c96658e3f3 llvm-dwp: Use llvm::Error to improve diagnostic quality/error handling in llvm-dwp
llvm-svn: 269339
2016-05-12 19:59:54 +00:00
Hemant Kulkarni
3dd905c415 llvm-readobj: Fix the GNU section header flags for SHF_MASKPROC and SHF_MASKOS
llvm-svn: 269338
2016-05-12 19:58:52 +00:00