Commit Graph

874 Commits

Author SHA1 Message Date
Rafael Espindola
102130d17c Add a missing error handling to llvm-lto.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257395 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 22:08:22 +00:00
Mike Aizatsky
d9750d38e1 [llvm-symbolizer] -print-source-context-lines option to print source code around the line.
Differential Revision: http://reviews.llvm.org/D15909

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257236 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-09 00:14:35 +00:00
Xinliang David Li
36838feb74 [PGO] Ensure vp data in indexed profile always sorted
Done in  InstrProfWriter to eliminate the need for client
code to do the sorting. The operation is done once and reused 
many times so it is more efficient. Update unit test to remove
sorting. Also update expected output of affected tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257145 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-08 05:45:21 +00:00
Mike Aizatsky
ba07fc7f19 [llvm-symbolizer] Print out non-address lines verbatim.
Differential Revision: http://reviews.llvm.org/D15876

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257115 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-07 23:57:41 +00:00
Dimitry Andric
e135ddf4bb Fix one file that I didn't convert properly in r256707.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256720 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-03 22:33:32 +00:00
Dimitry Andric
ac6a87b06e Fix several accidental DOS line endings in source files
Summary:
There are a number of files in the tree which have been accidentally checked in with DOS line endings.  Convert these to native line endings.

There are also a few files which have DOS line endings on purpose, and I have set the svn:eol-style property to 'CRLF' on those.

Reviewers: joerg, aaron.ballman

Subscribers: aaron.ballman, sanjoy, dsanders, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256707 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-03 17:22:03 +00:00
James Y Knight
c1b271062b Fix gold test after r256465.
That commit added a new pass, and this test is sensitive to what the
first pass after verify is called.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256532 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-29 03:48:37 +00:00
Adrian Prantl
8eb4aa5936 llvm-dwarfdump: Add support for dumping .dSYM bundles.
This replicates the logic of Darwin dwarfdump for manually opening up
.dSYM bundles without introducing any new dependencies.
<rdar://problem/20491670>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256350 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-23 21:51:13 +00:00
Teresa Johnson
311da8d9a9 Handle empty Subprogram list when linking metadata.
Use an iterator that handles an empty subprogram list.

Fixes PR25915.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256224 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-22 01:17:19 +00:00
Teresa Johnson
8c9c853ff4 Add testcase for r256161 (PR25907)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256174 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-21 18:24:35 +00:00
Xinliang David Li
5a75233380 Fix a bug in test case -- duplicate entries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256117 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-20 08:49:31 +00:00
Pete Cooper
11fd7a2269 Revert "Improve DWARFDebugFrame::parse to also handle __eh_frame."
This reverts commit r256008.

Its breaking multiple buildbots, although works for me locally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256013 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 19:45:38 +00:00
Pete Cooper
3c9c3bf291 Improve DWARFDebugFrame::parse to also handle __eh_frame.
LLVM MC has single methods which can handle the output of EH frame and DWARF CIE's and FDE's.

This code improves DWARFDebugFrame::parse to do the same for parsing.

This also allows llvm-objdump to support the --dwarf=frames option which objdump supports.  This
option dumps the .eh_frame section using the new code in DWARFDebugFrame::parse.

http://reviews.llvm.org/D15535

Reviewed by Rafael Espindola.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256008 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 18:51:08 +00:00
Teresa Johnson
e8df234a6e [ThinLTO/LTO] Don't link in unneeded metadata
Summary:
Third patch split out from http://reviews.llvm.org/D14752.

Only map in needed DISubroutine metadata (imported or otherwise linked
in functions and other DISubroutine referenced by inlined instructions).
This is supported for ThinLTO, LTO and llvm-link --only-needed, with
associated tests for each one.

Depends on D14838.

Reviewers: dexonsmith, joker.eph

Subscribers: davidxl, llvm-commits, joker.eph

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256003 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 17:51:37 +00:00
Rafael Espindola
5d2e46b5fa Pass -m elf_x84_64 to gold invocations.
Fixes pr25868.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255930 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-17 21:56:27 +00:00
Nathan Slingerland
fd56824d39 [PGO] Handle and report overflow during profile merge for all types of data
Summary: Surface counter overflow when merging profile data. Merging still occurs on overflow but counts saturate to the maximum representable value. Overflow is reported to the user.

Reviewers: davidxl, dnovillo, silvas

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255825 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16 21:45:43 +00:00
Mike Aizatsky
bca907f5fb [sancov] blacklist support.
Summary:
Using the blacklist the user can filter own unwanted functions
from all outputs. By default blacklist contains "fun:__sancov*" line.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255732 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16 00:31:48 +00:00
Xinliang David Li
0c7a64a037 Test cleanup -- remove duplicate run lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255673 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15 21:15:06 +00:00
Nathan Slingerland
824c3eccff [llvm-profdata] Add support for weighted merge of profile data (2nd try)
Summary:
This change adds support for specifying a weight when merging profile data with the llvm-profdata tool.
Weights are specified by using the --weighted-input=<weight>,<filename> option. Input files not specified
with this option (normal positional list after options) are given a default weight of 1.

Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the
input data from multiple training runs.

Both sampled and instrumented profiles are supported.

Reviewers: davidxl, dnovillo, bogner, silvas

Subscribers: silvas, davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15 17:37:09 +00:00
Reid Kleckner
f2829c933c [llvm-readobj] s/FunctionName/LinkageName/ for codeview dumping
The symbol being printed in this field comes from the main symbol table,
not 0xF1 subsection. Use LinkageName to make that a lot clearer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255596 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15 01:23:55 +00:00
Pete Cooper
2d6ab4db1c Start implementing FDE dumping when printing the eh_frame.
This code adds some simple decoding of the FDE's in an eh_frame.

There's still more to be done in terms of error handling and verification.

Also, we need to be able to decode the CFI's.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255550 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14 21:49:49 +00:00
Pete Cooper
832d1103af Print the eh_frame section in MachoDump.
This is the start of work to dump the contents of the eh_frame section.

It currently emits CIE entries.  FDE entries will come later.

It also needs improved error checking which will follow soon.

http://reviews.llvm.org/D15502

Reviewed by Kevin Enderby and Lang Hames.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255546 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14 21:39:27 +00:00
Xinliang David Li
ea0570fdaf [PGO] Value profiling text format reader/writer support
This patch adds the missing functionality in parsable
text format support for value profiling.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255523 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14 18:44:01 +00:00
David Blaikie
cd49eb3fa1 [llvm-dwp] Deduplicate type units
It's O(N^2) because it does a simple walk through the existing types to
find duplicates, but that will be fixed in a follow-up commit to use a
mapping data structure of some kind.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255482 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14 07:42:00 +00:00
David Blaikie
ea8e65febc [llvm-dwp] Remove some unused test code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14 07:41:56 +00:00
Xinliang David Li
d70808f6bb [PGO] Revert r255365: solution incomplete, not handling lambda yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255369 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-11 20:23:22 +00:00
Xinliang David Li
b6b389aaac [PGO] Stop using invalid char in instr variable names.
Before the patch, -fprofile-instr-generate compile will fail
if no integrated-as is specified when the file contains
any static functions (the -S output is also invalid).

This patch fixed the issue. With the change, the index format
version will be bumped up by 1. Backward compatibility is 
preserved with this change.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255365 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-11 19:53:19 +00:00
Frederic Riss
ba16151251 [dsymutil] Ignore absolute symbols in the debug map
Quoting from the comment added to the code:

    // Objective-C on i386 uses artificial absolute symbols to
    // perform some link time checks. Those symbols have a fixed 0
    // address that might conflict with real symbols in the object
    // file. As I cannot see a way for absolute symbols to find
    // their way into the debug information, let's just ignore those.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255350 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-11 17:50:37 +00:00
Rafael Espindola
da5132018f Slit lib/Linker in two.
A linker normally has two stages: symbol resolution and "moving stuff".

In lib/Linker there is the complication of lazy linking some globals,
but it was still far more mixed than it needed to.

This splits the linker into a lower level IRMover and the linker proper.
The IRMover just takes a list of globals to move and a callback that
lets the user control what is lazy linked.

The main motivation is that now tools/gold (and soon lld) can use their
own symbol resolution to instruct IRMover what to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255254 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-10 14:19:35 +00:00
David Blaikie
f8a6223dd0 [llvm-dwp] Restructure inputs for test case so they're all grouped together
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254922 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-07 18:46:41 +00:00
David Blaikie
2b76269756 [llvm-dwp] Add coverage for both the presence and absence of type units, and fix/remove the emission of a broken tu_index when no type units are present
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:41:53 +00:00
David Blaikie
28683ac9d5 [llvm-dwp] Fix the type_units.test since I renamed its inputs as well
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254830 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:11:17 +00:00
David Blaikie
eaf992ce08 [llvm-dwp] Rename the sufficiently-modified test to reflect it's non-simplicity
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254829 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:10:05 +00:00
David Blaikie
543e02b438 [llvm-dwp] Support debug_tu_index
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254827 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-05 03:05:45 +00:00
David Blaikie
fca82775a2 [llvm-dwp] Remove some out of date comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254772 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 21:38:39 +00:00
David Blaikie
a2b2c5abb0 [llvm-dwp] Implement the required on-disk probed hash table
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254770 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 21:30:23 +00:00
David Blaikie
19d1511e67 [llvm-dwp] Include the debug_line.dwo section
This probably shouldn't be generated in the .dwo file for CUs, only for
TUs, but it's in the sample .dwos (generated by clang) so dwp should
reflect that.

Arguably the DWP tool could be smart enough to know that the CUs
shouldn't need a debug_line.dwo section and skip that even when it's
legitimately generated for TUs, but that's a bit more off-book.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254767 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 21:16:42 +00:00
Mike Aizatsky
4d585624eb sancov -not-covered-functions.
Summary: The command prints out list of functions that were not entered.
To do this, addresses are first converted to function locations. Set
operations are used for function locations.

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

review

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254742 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 18:35:37 +00:00
David Blaikie
2a3cc32f71 [llvm-dwp] Retrieve the DWOID from the CU for the cu_index entry
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254731 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 17:20:04 +00:00
Nathan Slingerland
8061fe5c67 Revert "[llvm-profdata] Add support for weighted merge of profile data"
This reverts commit b7250858d9.

Reverting in order to investigate Windows test failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254687 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 02:13:58 +00:00
Nathan Slingerland
b7250858d9 [llvm-profdata] Add support for weighted merge of profile data
This change adds support for an optional weight when merging profile data with the llvm-profdata tool.
Weights are specified by adding an option ':<weight>' suffix to the input file names.

Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the
input data from multiple training runs.

Both sampled and instrumented profiles are supported.

Reviewers: dnovillo, bogner, davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04 00:00:20 +00:00
Xinliang David Li
aeaec5e3f9 [PGO] Add v2 format compatibility test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254572 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 01:05:31 +00:00
David Blaikie
dc56408249 [llvm-dwp] Include only the non-empty columns in the cu_index
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254555 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 22:01:56 +00:00
Nathan Slingerland
1c2b998913 [llvm-profdata] Change instr prof counter overflow to saturate rather than discard
Summary: This changes overflow handling during instrumentation profile merge. Rathar than throwing away records that would result in counter overflow, merged counts are instead clamped to the maximum representable value. A warning about counter overflow is still surfaced to the user as before.

Reviewers: dnovillo, davidxl, silvas

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254525 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 18:19:24 +00:00
David Blaikie
5001b2a939 [llvm-dwp] Emit a rather fictional debug_cu_index
This is very rudimentary support for debug_cu_index, but it is enough to
allow llvm-dwarfdump to find the offsets for  contributions and
correctly dump debug_info.

It will need to actually find the real signature of the unit and build
the real hash table with the right number of buckets, as per the DWP
specification.

It will also need to be expanded to cover the tu_index as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254489 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02 06:21:34 +00:00
David Blaikie
8e31526513 [llvm-dwp] Deduplicate strings in the debug_str.dwo section
Also, ensure that references to those strings in debug_str_offsets.dwo
correctly refer to the deduplicated strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254441 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 19:17:58 +00:00
David Blaikie
0fb89f7b82 [llvm-dwp] Correctly update debug_str_offsets.dwo when linking dwo files
This doesn't deduplicate strings in the debug_str section, nor does it
properly wire up the index so that debug_info can /find/ these strings,
but it does correct the str_offsets specifically.

Follow up patches to address those related/next issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 18:07:07 +00:00
David Blaikie
bb823837e0 [llvm-dwp] Initial partial prototype
This just concatenates the common DWP sections without doing any of the
fancy DWP things like:

1) update str_offsets
2) deduplicating strings
3) merging/creating cu/tu_index

Patches for these will follow shortly.

(also not sure about target triple/object file type for this tool - do I
really need a whole triple just to write an object file that contains
purely static/hardcoded bytes in each section? & I guess I should just
pick it based on the first input, maybe, rather than hardcoding for now
- but we only produce .dwo on ELF platforms with objcopy for now anyway)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254355 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01 00:48:39 +00:00
Rafael Espindola
e3f14b0e8c Add a passing test.
When a comdat is discarded, any globals defined in it become undefined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254258 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-29 15:52:12 +00:00
Rafael Espindola
eab2da952c Don't depend on the order the IR is copied.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254257 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-29 15:22:49 +00:00
Rafael Espindola
ed1d7091b5 Don't depend on the order the IR is copied.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254256 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-29 15:08:39 +00:00
Rafael Espindola
39066cae68 Test both input file orders.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254186 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-27 03:50:34 +00:00
Rafael Espindola
d2a2e5d4e8 Add missing file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254185 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-27 03:47:29 +00:00
Rafael Espindola
9e7173acbb Make the test a bit more interesting.
It now covers a regular function replacing an available_externally one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254184 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-27 02:07:37 +00:00
Rafael Espindola
30e6c88594 Add a few passing lto tests.
I found these while trying to get a prototype to bootstrap.

They cover things like
* Handling of non linker visible stuff (append, available_externally)
* Type merging
* Alias to dropped globals
* Dropping linkage when converting to a declaration.

These should hopefully be generally useful for anyone refactoring the
plugin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254174 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-26 19:53:12 +00:00
Rafael Espindola
2195ce5049 Make this test a bit more strict.
It now tests with files in both orders.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253993 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-24 16:43:53 +00:00
Rafael Espindola
42fec0866c Add an already passing test.
This tests that a declaration can resolve to an alias.

I broke this locally while prototyping a change and it looks like a nice
test to have.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253984 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-24 14:15:50 +00:00
Xinliang David Li
55f78334c1 [PGO] Add --text option for llvm-profdata show|merge commands
The new option is similar to the SampleProfile dump option.

- dump raw/indexed format into text profile format
- merge the profile and output into text profile format.

Note that Value Profiling data text format is not yet designed. 
That functionality will be added later.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253913 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 20:47:38 +00:00
Rafael Espindola
a2197f8f51 Have a single way for creating unique value names.
We had two code paths. One would create names like "foo.1" and the other
names like "foo1".

For globals it is important to use "foo.1" to help C++ name demangling.
For locals there is no strong reason to go one way or the other so I
kept the most common mangling (foo1).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253804 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-22 00:16:24 +00:00
Teresa Johnson
f1f60632b0 [ThinLTO] Handle bitcode without function summary sections gracefully
Summary:
Several fixes to the handling of bitcode files without function summary
sections so that they are skipped during ThinLTO processing in llvm-lto
and the gold plugin when appropriate instead of aborting.

1 Don't assert when trying to add a FunctionInfo that doesn't have
  a summary attached.
2 Skip FunctionInfo structures that don't have attached function summary
  sections when trying to create the combined function summary.
3 In both llvm-lto and gold-plugin, check whether a bitcode file has
  a function summary section before trying to parse the index, and skip
  the bitcode file if it does not.
4 Fix hasFunctionSummaryInMemBuffer in BitcodeReader, which had a bug
  where we returned to early while looking for the summary section.

Also added llvm-lto and gold-plugin based tests for cases where we
don't have function summaries in the bitcode file. I verified that
either the first couple fixes described above are enough to avoid the
crashes, or fixes 1,3,4. But have combined them all here for added
robustness.

Reviewers: joker.eph

Subscribers: llvm-commits, joker.eph

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253796 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-21 21:55:48 +00:00
Diego Novillo
5d8ee1bd0d SamplePGO - Sort samples by source location when emitting as text.
When dumping function samples or writing them out as text format, it
helps if the samples are emitted sorted by source location. The sorting
of the maps is a bit slow, so we only do it on demand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253568 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 15:33:08 +00:00
Betul Buyukkurt
a5be9e3cfb [PGO] Value profiling support
This change introduces an instrumentation intrinsic instruction for
value profiling purposes, the lowering of the instrumentation intrinsic
and raw reader updates. The raw profile data files for llvm-profdata
testing are updated.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253484 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 18:14:55 +00:00
James Molloy
66b8eaaca4 [LTO] Appease buildbots take 3
This time I've found a linux box and checked it there. This test now passes.

Because I'd introduced an undefined reference in @bar, gold now returns an error. This doesn't matter for the test itself, because it also emits the remarks the test is checking for. But it does cause LIT to notice a nonzero return code which it faults on.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253454 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 12:08:24 +00:00
James Molloy
9e9da1f7c3 [LTO] Buildbot appeasing take 2
Let's try again. This time using the right function signature. It's a real pity I can't run this on a darwin machine...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253453 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 11:37:32 +00:00
James Molloy
e2c844f486 [LTO] Fix up test/tools/gold/X86/remarks.ll
It needs the same fixes as in test/LTO/X86/remarks.ll, but this test appears not to get run on my system (but does on the buildbot). Strange.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253452 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 11:32:14 +00:00
David Majnemer
6ac90f1dbd [llvm-objdump] Use the COFF export table for additional symbols
Most linked executables do not have a symbol table in COFF.
However, it is pretty typical to have some export entries.  Use those
entries to inform the disassembler about potential function definitions
and call targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253429 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 02:49:19 +00:00
Nathan Slingerland
0833ccb526 [llvm-profdata] Improve error messaging when merging mismatched profile data
Summary:
This change tries to make the root cause of instrumented profile data merge failures clearer.

Previous:

$ llvm-profdata merge test_0.profraw test_1.profraw -o test_merged.profdata
test_1.profraw: foo: Function count mismatch
test_1.profraw: bar: Function count mismatch
test_1.profraw: baz: Function count mismatch
...

Changed:

$ llvm-profdata merge test_0.profraw test_1.profraw -o test_merged.profdata
test_1.profraw: foo: Function basic block count change detected (counter mismatch)
Make sure that all profile data to be merged is generated from the same binary.
test_1.profraw: bar: Function basic block count change detected (counter mismatch)
test_1.profraw: baz: Function basic block count change detected (counter mismatch)
...

Reviewers: dnovillo, davidxl, bogner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253384 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 22:08:53 +00:00
Mike Aizatsky
e656ca2d31 enabling sancov tests on linux x86_64 only
Differential Revision: http://reviews.llvm.org/D14728

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253354 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-17 18:25:21 +00:00
Diego Novillo
dbe26eba86 SamplePGO - Add dump routines for LineLocation, SampleRecord and FunctionSamples
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253071 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 20:24:28 +00:00
NAKAMURA Takumi
08ccc7e7d1 llvm/test/tools/llvm-profdata/text-format-errors.test: Use prepared version of the input file, instead of using echo.
...and s/\C9/\xC9/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253014 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 06:06:58 +00:00
Nathan Slingerland
572e633224 [llvm-profdata] Add check for text profile formats and improve error reporting (2nd try)
Summary:
This change addresses two possible instances of user error / confusion when
merging sampled profile data.

Previously any input that didn't match the raw or processed instrumented format
would automatically be interpreted as instrumented profile text format data.
No error would be reported during the merge.

Example:
If foo-sampled.profdata and bar-sampled.profdata are binary sampled profiles:

Old behavior:
$ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -output foobar-sampled.profdata
$ llvm-profdata show -sample foobar-sampled.profdata
error: foobar-sampled.profdata:1: Expected 'mangled_name:NUM:NUM', found  lprofi

This change adds basic checks for valid input data when assuming text input.
It also makes error messages related to file format validity more specific about
the assumbed profile data type.

New behavior:
$ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -o foobar-sampled.profdata
error: foo.profdata: Unrecognized instrumentation profile encoding format
Perhaps you forgot to use the -sample option?

Reviewers: bogner, davidxl, dnovillo

Subscribers: davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253009 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 03:47:58 +00:00
Mike Aizatsky
8b07272072 disabling sancov tests: too many failures on different platforms.
Differential Revision: http://reviews.llvm.org/D14624

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252945 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 20:47:12 +00:00
Mike Aizatsky
4192660fd2 sancov tests - platform independent separators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252943 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 20:17:49 +00:00
Mike Aizatsky
91e7b1246c sancov test suite
Differential Revision: http://reviews.llvm.org/D14589

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252933 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 19:34:21 +00:00
Nathan Slingerland
69c9ea3b39 reverting r252916 to investigate test failure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252921 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 18:39:26 +00:00
Nathan Slingerland
7b81b822ba [llvm-profdata] Add check for text profile formats and improve error reporting
Summary:
This change addresses two possible instances of user error / confusion when
merging sampled profile data.

Previously any input that didn't match the raw or processed instrumented format
would automatically be interpreted as instrumented profile text format data.
No error would be reported during the merge.

Example:
If foo-sampled.profdata and bar-sampled.profdata are binary sampled profiles:

Old behavior:
$ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -output foobar-sampled.profdata
$ llvm-profdata show -sample foobar-sampled.profdata
error: foobar-sampled.profdata:1: Expected 'mangled_name:NUM:NUM', found  lprofi

This change adds basic checks for valid input data when assuming text input.
It also makes error messages related to file format validity more specific about
the assumbed profile data type.

New behavior:
$ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -o foobar-sampled.profdata
error: foo.profdata: Unrecognized instrumentation profile encoding format
Perhaps you forgot to use the -sample option?

Reviewers: bogner, davidxl, dnovillo

Subscribers: davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252916 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 18:06:18 +00:00
Kuba Brecka
4e0567ae26 [Object, MachO] Mark symbols from DATA and BSS sections as ST_Data
In `MachOObjectFile::getSymbolType` we currently always return `SymbolRef::ST_Function` for symbols from any section. In order for llvm-symbolizer to correctly symbolize Mach-O globals, symbols from data and BSS sections should return `SymbolRef::ST_Data`.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252867 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-12 09:40:29 +00:00
Hemant Kulkarni
a07496f56a [Symbolizer]: Add -pretty-print option
Differential Revision: http://reviews.llvm.org/D13671



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252798 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 20:41:43 +00:00
Colin LeMahieu
55b72798ae Reverting r252760
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252770 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 18:11:06 +00:00
Hemant Kulkarni
5776ed04ce [Symbolizer]: Add -pretty-print option
Differential Revision: http://reviews.llvm.org/D13671


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252760 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 17:47:54 +00:00
Adrian Prantl
b29f9e5c41 dsymutil: Prune module forward decl DIEs if a uniquable definition was
already emitted and fix a latent bug in DIECloner where the DW_CHILDREN_yes
flag is set based on the number of children in the input DIE rather than
the number of children that are actually being cloned.

rdar://problem/23439845

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252649 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 21:31:05 +00:00
Kevin Enderby
7f0edadcaf Fix llvm-nm(1) printing of llvm-bitcode files for -format darwin to match darwin’s nm(1).
Also a small fix to match printing of Mach-O objects with -format posix.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252567 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 00:31:08 +00:00
Colin LeMahieu
71c7876d91 [Hexagon] Removing XFAIL on Hexagon target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252450 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-09 06:15:55 +00:00
Peter Collingbourne
5f220beefc DI: Reverse direction of subprogram -> function edge.
Previously, subprograms contained a metadata reference to the function they
described. Because most clients need to get or set a subprogram for a given
function rather than the other way around, this created unneeded inefficiency.

For example, many passes needed to call the function llvm::makeSubprogramMap()
to build a mapping from functions to subprograms, and the IR linker needed to
fix up function references in a way that caused quadratic complexity in the IR
linking phase of LTO.

This change reverses the direction of the edge by storing the subprogram as
function-level metadata and removing DISubprogram's function field.

Since this is an IR change, a bitcode upgrade has been provided.

Fixes PR23367. An upgrade script for textual IR for out-of-tree clients is
attached to the PR.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252219 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05 22:03:56 +00:00
Kevin Enderby
268709a810 Reapply r250906 with many suggested updates from Rafael Espindola.
The needed lld matching changes to be submitted immediately next,
but this revision will cause lld failures with this alone which is expected.

This removes the eating of the error in Archive::Child::getSize() when the characters
in the size field in the archive header for the member is not a number.  To do this we
have all of the needed methods return ErrorOr to push them up until we get out of lib.
Then the tools and can handle the error in whatever way is appropriate for that tool.

So the solution is to plumb all the ErrorOr stuff through everything that touches archives.
This include its iterators as one can create an Archive object but the first or any other
Child object may fail to be created due to a bad size field in its header.

Thanks to Lang Hames on the changes making child_iterator contain an
ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add
operator overloading for * and -> .

We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash”
and using report_fatal_error() to move the error checking will cause the program to
stop, neither of which are really correct in library code. There are still some uses of
these that should be cleaned up in this library code for other than the size field.

The test cases use archives with text files so one can see the non-digit character,
in this case a ‘%’, in the size field.

These changes will require corresponding changes to the lld project.  That will be
committed immediately after this change.  But this revision will cause lld failures
with this alone which is expected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252192 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05 19:24:56 +00:00
Kevin Enderby
06e1752041 Allow llvm-nm’s single letter command line flags to be grouped.
Which is needed if we want to replace darwin’s nm(1) with llvm-nm
as there are many uses of grouped flags.  The added test case is
one specific case that is in real use.

rdar://23337419


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251864 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-02 23:42:05 +00:00
Kevin Enderby
05f3dabc64 Implemented the code to make llvm-nm’s -g option work.
While llvm-nm parses the -g option and has help that describes it as:

  -extern-only            - Show only external symbols

There is no code in the program to use the boolean valve it sets from the
command line.

rdar://23261095


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251718 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-30 19:55:32 +00:00
Kevin Enderby
da785374d9 Backing out commit r250906 as it broke lld.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250908 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-21 17:13:20 +00:00
Kevin Enderby
e36c14fbed This removes the eating of the error in Archive::Child::getSize() when the characters
in the size field in the archive header for the member is not a number.  To do this we
have all of the needed methods return ErrorOr to push them up until we get out of lib.
Then the tools and can handle the error in whatever way is appropriate for that tool.

So the solution is to plumb all the ErrorOr stuff through everything that touches archives.
This include its iterators as one can create an Archive object but the first or any other
Child object may fail to be created due to a bad size field in its header.

Thanks to Lang Hames on the changes making child_iterator contain an
ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add
operator overloading for * and -> .

We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash”
and using report_fatal_error() to move the error checking will cause the program to
stop, neither of which are really correct in library code. There are still some uses of
these that should be cleaned up in this library code for other than the size field.

Also corrected the code where the size gets us to the “at the end of the archive”
which is OK but past the end of the archive will return object_error::parse_failed now.

The test cases use archives with text files so one can see the non-digit character,
in this case a ‘%’, in the size field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250906 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-21 16:59:24 +00:00
Teresa Johnson
2b24129f17 Fix windows bot failures from r250699 by removing "/" from expected path
in test output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250701 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 15:19:02 +00:00
Teresa Johnson
d6e77b7d15 llvm-lto support for generating combined function indexes
Summary:
This patch adds support to llvm-lto that mirrors the support added by
r249270 to the gold plugin. This enables better testing of combined
index generation for ThinLTO.

Added a new test, and this support will be used in the test in D13515.

Reviewers: joker.eph

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250699 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 14:30:44 +00:00
Reid Kleckner
c9b72b9208 Disable a test relying on symbol demangling on non-Windows platforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250587 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 23:56:14 +00:00
Reid Kleckner
dd65b7a9f5 [llvm-symbolizer] Use the export table if no symbols are present
This lets us make guesses about symbols in third party DLLs without
debug info, like MSVCR120.dll or kernel32.dll. dbghelp does the same
thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 23:43:22 +00:00
Davide Italiano
c813f4ca03 [llvm-readobj] Teach ELFDumper about symbol versioning.
Differential Revision:	 http://reviews.llvm.org/D13824


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250575 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 23:19:01 +00:00
Davide Italiano
600b09339d [llvm-readobj/ELF] Dump DT_VERDEF/DT_VERDEFNUM correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250464 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 22:04:55 +00:00
Igor Kudrin
c2fd5af986 [llvm-readobj/ELF] fix: add correct test inputs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250292 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 12:21:30 +00:00
Igor Kudrin
4598154b64 [llvm-readobj/ELF] Print GNU Hash section
Add a new command line switch, -gnu-hash-table, to print the content of that section.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250291 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 12:11:50 +00:00
Kevin Enderby
1cd4c56bf6 Tweak to r250117 and change to use ErrorOr and drop isSizeValid for
ArchiveMemberHeader, suggestion by Rafael Espíndola.

Also The clang-x86-win2008-selfhost bot still does not like the
malformed-machos 00000031.a test, so removing it for now.  All
the other bots are fine with it however.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250222 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 20:48:04 +00:00
Kevin Enderby
76771afe22 The issue with the malformed-machos 00000031.a test is that it needed ‘-arch x86_64’
flag as it was a Mach-O universal file.

The default as to which architecture slice that is dumped without an -arch flag
depends on the host architecture and the contents of the universal file.  The
malformed archive 00000031.a file has both an x86_64 and i386 slice.  So for
for x86_64 hosts only that slice is dumped, for non-x86_64 hosts, which is many
of the bots both slices are dumped.

The test is intended to only check that the malformation of the x86_64 which
has a non-decimal characters in the size field of the archive header so it no
longer crashes.

The problem turned out that the i388 slice of the malformed archive had a
different malformation which was causing the non-x86_64 bots to get this error:

llvm-objdump -macho -disassemble -arch i386 00000031.a 
Archive : .00000031.a
00000031.a(c_start.o):
LLVM ERROR: Symbol name entry points before beginning or past end of file.

and causing the test as it was written to fail.  So by adding ‘-arch x86_64’ it
should correct the test and the malformation on the i388 slice will not be
dumped.

Also the removal of the malformed-machos mem-crup-0261.macho was not causing
the issue so that is put back in.

Sorry for the churn on these tests, Kev


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250184 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 17:06:34 +00:00
Kevin Enderby
48ca1e5c87 Looks like malformed-machos 00000031.a test is just getting a different error
on some of the bots.  I’ll remove this test for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250141 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 01:27:28 +00:00
Kevin Enderby
7286892343 Remove the correct unstable malformed-machos test mem-crup-0261.macho and
restore the malformed-machos 00000031.a test.  Hopefully this will get all the
build bots happy again.  I’ll again keep an eye on them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250130 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 00:05:17 +00:00
Kevin Enderby
2a70637970 Temporarily remove the test added in r250117 while I investigate why two
of the build bots get a different error on that malformed file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250120 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 23:03:43 +00:00
Kevin Enderby
062054e5ca Fixed bugs in llvm-obdump while parsing Mach-O files from malformed archives
that caused aborts.  This was because of the characters of the ‘Size’ field in
the archive header did not contain decimal characters.

rdar://22983603


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250117 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 22:04:54 +00:00
Hemant Kulkarni
e8d28f3d7a [llvm-symbolizer] Add -print-address option
Differential Revision: http://reviews.llvm.org/D13518


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 19:26:44 +00:00
Colin LeMahieu
7e08dd1195 [llvm-symbolizer] Reverting r250067
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250072 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 17:57:02 +00:00
Hemant Kulkarni
6bd07138eb [llvm-symbolizer] Add -print-address option
Differential Revision  http://reviews.llvm.org/D13518


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250067 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 17:31:22 +00:00
Kevin Enderby
ce2a091823 Move llvm-objdump malformed Mach-O tests to X86 test directory.
rdar://22983603


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249927 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-10 01:06:20 +00:00
Kevin Enderby
3d5fd2a768 Fix a bugs in the Mach-O disassembler when disassembling from a
malformed Mach-O file that caused a crash.  This was because of an
assert where the code was incorrectly attempting to parse relocation
entries off of the sections and the filetype was not an MH_OBJECT.

rdar://22983603


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249921 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-10 00:05:01 +00:00
Diego Novillo
50072bfa3e Add inline stack streaming to binary sample profiles.
With this patch we can now read and write inline stacks in sample
profiles to the binary encoded profiles.

In a subsequent patch, I will add a string table to the binary encoding.
Right now function names are emitted as strings every time we find them.
This is too bloated and will produce large files in applications with
lots of inlining.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249861 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 17:54:24 +00:00
Reid Kleckner
9352676b65 Fix pdb.test when python is not on PATH
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249847 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 16:49:56 +00:00
Kevin Enderby
af90719473 Fixed two bugs in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused crashes.  The first because the
offset in a dyld bind table entry was out of range.  The second because their
was no image info section and the routine printing it did not have the
need check to see the section did not exist.

rdar://22983603


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249845 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 16:48:44 +00:00
Reid Kleckner
283573e081 Fix coff-dwarf test for non-Windows platforms that cannot demangle MS C++ names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249795 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 01:11:40 +00:00
Reid Kleckner
00fda73267 Address review comments, remove error case and return 0 instead as required by tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249785 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 00:15:08 +00:00
Reid Kleckner
27a9e1dbcf [llvm-symbolizer] Make --relative-address work with DWARF contexts
Summary:
Previously the relative address flag only affected PDB debug info.  Now
both DIContext implementations always expect to be passed virtual
addresses. llvm-symbolizer is now responsible for adding ImageBase to
module offsets when --relative-offset is passed.

Reviewers: zturner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249784 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 00:15:01 +00:00
Kevin Enderby
1ef3c282a2 Fix a bug in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused a crash because of a
section header had a size that extended past the end of the file.

rdar://22983603


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249768 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 22:50:55 +00:00
Diego Novillo
3bc8dc3685 Re-apply r249644: Handle inline stacks in gcov-encoded sample profiles.
This fixes memory allocation problems by making the merge operation keep
the profile readers around until the merged profile has been emitted.
This is needed to prevent the inlined function names to disappear from
the function profiles. Since all the names are kept as references, once
the reader disappears, the names are also deallocated.

Additionally, XFAIL on big-endian architectures. The test case uses a
gcov file generated on a little-endian system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249724 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 19:40:37 +00:00
Kevin Enderby
9ba45e98f4 Fix a bug in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused a crash because of loops
in the class meta data.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249700 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 16:56:35 +00:00
Teresa Johnson
6b9f46e4e4 Support for llvm-bcanalyzer dumping of record array strings.
Summary:
Adds support for automatically detecting and printing strings
represented by Array abbrev operands, analogous to the string dumping
performed for Blob abbrev operands.

Enhanced the ThinLTO combined index test to check for the appropriate
module and function strings.

Reviewers: dexonsmith, joker.eph, davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249695 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 15:56:24 +00:00
Diego Novillo
7308c418b8 Revert "Handle inline stacks in gcov-encoded sample profiles."
This reverts commit r249644.

The buildbots are failing the new test I added. Investigating.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249648 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 01:17:26 +00:00
Diego Novillo
6fd08c8868 Handle inline stacks in gcov-encoded sample profiles.
This patch adds support for reading sample profiles with inline stacks.
Inline stacks in a profile are generated when the sampled binary has
samples in inlined functions.

For instance, if main() calls foo() and foo() calls bar(), and bar() is
inlined into foo() and foo() inlined into main(), the profile may look
something like:

main total:364084 head:0
  [ ... ]
  2.3: _Z3fool total:243786
    1: 60149
    1.2: 38568
    1.4: 46511
    1.7: _Z3bari total:98558
      1.1: 52672
      1.2: 45886

At line 2, discriminator 3, main() calls foo(). In turn, foo() calls
bar() at line 1, discriminator 7.

In the textual format, this stacking of inline calls is represented
with indentation.

With this change, LLVM can now read sample profile files generated by
the create_gcov tool from https://github.com/google/autofdo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249644 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 00:39:11 +00:00
Kevin Enderby
23090caf75 Fix two bugs in llvm-objdump’s printing of Objective-C meta data
from malformed Mach-O files that caused crashes.

We recently got about 700 malformed Mach-O files which we have
been using the improve the robustness of tools that deal with reading
data from object files.  These resulted in about 20 small bug fixes to
the darwin based tools.

The goal here is to also improve the robustness of llvm-objdump and
this is the first two fixes.  In talking with Tim Northover the approach
we thought might be best is to:

1) Only include tests for the malformed Mach-O files that cause crashes
(not all 700+ tests).
2) The test should only contain the command line option that caused the
crash and not all the others that don’t matter.
3) There should be only one line for the FileCheck that is past the point
of the crash if possible and if possible indicates the malformation.

Again the goal is to fix crashes and not so much care about how the
printing of malformed data comes out.

Tim also suggested if we really wanted to add test cases for all 700+
malformed Mach-O files putting them in the regression tests might be
an option.  But many of these do not cause crashes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249479 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-06 22:27:08 +00:00
Adrian Prantl
fce2219764 dsymutil: Don't prune forward declarations inside of an imported TAG_module
if there exists not definition for the type.
For this to work, we need to clone the imported modules before building
the decl context chains of the DIEs in the non-skeleton CUs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249362 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 23:11:20 +00:00
Alexandros Lamprineas
966b579475 Added missing test for [ARM] AttributeParser. Check that build attribute
Tag_Advanced_SIMD_arch is set correctly when targeting v8.1-a NEON.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249304 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 12:13:29 +00:00
Teresa Johnson
b97baa5fe5 Support for function summary index bitcode sections and files.
Summary:
The bitcode format is described in this document:
  https://drive.google.com/file/d/0B036uwnWM6RWdnBLakxmeDdOeXc/view
For more info on ThinLTO see:
  https://sites.google.com/site/llvmthinlto

The first customer is ThinLTO, however the data structures are designed
and named more generally based on prior feedback. There are a few
comments regarding how certain interfaces are used by ThinLTO, and the
options added here to gold currently have ThinLTO-specific names as the
behavior they provoke is currently ThinLTO-specific.

This patch includes support for generating per-module function indexes,
the combined index file via the gold plugin, and several tests
(more are included with the associated clang patch D11908).

Reviewers: dexonsmith, davidxl, joker.eph

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-04 14:33:43 +00:00
Davide Italiano
3cd5d8c094 [llvm-size] Attempt to fix a test failure on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249247 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-03 20:20:28 +00:00
Davide Italiano
982ae9e22d [llvm-size] Fix time to check if time of use bug.
This was the last tool relying on this pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249244 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-03 19:44:06 +00:00
Adrian Prantl
bc01088257 dsymutil: Also ignore the ByteSize when building the DeclContext cache for
clang modules.

Forward decls of ObjC interfaces don't have a bytesize.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249110 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 00:27:08 +00:00
Davide Italiano
52c0444e5e [PATCH] D13360: [llvm-objdump] Teach -d about AArch64 mapping symbols
AArch64 uses $d* and $x* to interleave between text and data.
llvm-objdump didn't know about this so it ended up printing garbage.
This patch is a first step towards a solution of the problem.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249083 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 21:57:09 +00:00
Dehao Chen
badd989bba http://reviews.llvm.org/D13145
Support hierarachical sample profile format.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248865 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-30 00:42:46 +00:00
Zachary Turner
c9736fba4b [llvm-pdbdump] Add include-only filters.
PDB files have a lot of noise in them, with hundreds (or thousands)
of symbols from system libraries and compiler generated types.  If
you're only looking for a specific type, this can be problematic.

This CL allows you to display *only* types, variables, or compilands
matching a particular pattern.  These filters can even be combined
with exclude filters.  Include-only filters are given priority, so
that first the set of items to display is limited only to those that
match the include filters, and then the set of exclude filters is
applied to those.  If there are no include filters specified, then
it means "display everything".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248822 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29 19:49:06 +00:00
Adrian Prantl
c10a184867 dsymutil: Fix the condition to distinguish module imports form definitions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248512 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 16:10:14 +00:00
Adrian Prantl
54a3f636d8 dsymutil: Don't prune forward declarations inside a module definition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248428 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 20:44:37 +00:00
Adrian Prantl
557aebcdfa Fix this dsymutil testcase by not passing in a path to the modulemap file,
so the lookup works as expected after prepending the oso-prepend-path.

This manifested only on Windows, because "/" is not a relative path there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248423 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 19:53:10 +00:00
Adrian Prantl
0769c6afd6 Fix the order of operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248406 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 18:09:01 +00:00
Adrian Prantl
51ac5bb4c4 Temporarily make testcase more verbose to debug a msvc buildbot failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248403 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 17:59:45 +00:00
Adrian Prantl
43df582edb dsymutil: Resolve forward decls for types defined in clang modules.
This patch extends llvm-dsymutil's ODR type uniquing machinery to also
resolve forward decls for types defined in clang modules.

http://reviews.llvm.org/D13038

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248398 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 17:35:52 +00:00
Adrian Prantl
f4ad7592cd dsymutil: print a warning when there is a module hash mismatch.
This also updates the module binaries in the test directory because
their module hash mismatched.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248396 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 17:11:10 +00:00
Adrian Prantl
d2136b34aa dsymutil: Follow references to clang modules and recursively clone the
debug info.

This does not yet resolve external type references.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 22:20:50 +00:00
Davide Italiano
919b448c2e [llvm-readobj] Fix another "time of check to time of use bug".
It seems there's more copy-paste between tools than needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247954 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-17 22:29:58 +00:00
Teresa Johnson
15c79f6c94 Disable the second verification run when performing LTO through
gold in NDEBUG mode.
Follow on patch for r247729 - LTO: Disable extra verify runs in release
builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247824 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16 18:06:45 +00:00
Mehdi Amini
617bb47635 Improve "default_triple" specification: make it at the directory level for test/tools/llvm-mc
From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247819 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16 17:03:12 +00:00
Mehdi Amini
793a2b15e7 Make the default triple optional by allowing an empty string
When building LLVM as a (potentially dynamic) library that can be linked against
by multiple compilers, the default triple is not really meaningful.
We allow to explicitely set it to an empty string when configuring LLVM.
In this case, said "target independent" tests in the test suite that are using
the default triple are disabled by matching the newly available feature
"default_triple".

Reviewers: probinson, echristo
Differential Revision: http://reviews.llvm.org/D12660

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247775 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16 05:34:32 +00:00
Davide Italiano
a4ff83ab8f [llvm-cxxdump] Remove duplicate code check.
We already fail with 'No such file or directory' when we try to open
the file -- if that doesn't exist. Also add a test to verify this behavior.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247744 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 23:35:32 +00:00
Justin Bogner
7bfd1e9106 test: Add "REQUIRES: native" so this test passes with no default triple configured
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247719 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 21:13:33 +00:00
Davide Italiano
97095fc404 [llvm-mc] Better error handling in ENOENT case + test.
This is a follow up to r247518.
As a general note, I think we could do a much better job testing for
error conditions in tools. I already anticipated in a previous mail,
but while implementing this I noticed that the code coverage we have 
for error checking is pretty low. I can arbitrarily remove checks from 
several tools and the suite still passes.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 17:10:01 +00:00
Arnaud A. de Grandmaison
7f81eabc26 Tweak 2 x86 gold tests so they can run on non-x86 platforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247415 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 14:45:34 +00:00
NAKAMURA Takumi
15125487c5 Fix llvm/test/tools/gold/X86/bad-alias.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247391 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 08:03:17 +00:00
Frederic Riss
5f69f9fb81 [dsymutil] Discard useless location attributes.
When cloning the debug info for a function that hasn't been linked,
strip the DIEs from all location attributes that wouldn't contain any
meaningful information anyway.

This kind of situation can happen when a function got discarded by the
linker, but its debug information is still wanted in the final link
because it was marked as required as some other DIE dependency. The easiest
way to get into that situation is to have using directives. They get
linked unconditionally, but their targets might not always be present.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247386 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 04:17:30 +00:00
David Blaikie
7f52e5c241 Fix the gold test cases after alias changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247381 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 03:28:37 +00:00
David Blaikie
21f77df7b6 [opaque pointer type] Add textual IR support for explicit type parameter for global aliases
update.py:
import fileinput
import sys
import re

alias_match_prefix = r"(.*(?:=|:|^)\s*(?:external |)(?:(?:private|internal|linkonce|linkonce_odr|weak|weak_odr|common|appending|extern_weak|available_externally) )?(?:default |hidden |protected )?(?:dllimport |dllexport )?(?:unnamed_addr |)(?:thread_local(?:\([a-z]*\))? )?alias"
plain = re.compile(alias_match_prefix + r" (.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|addrspacecast|\[\[[a-zA-Z]|\{\{).*$)")
cast  = re.compile(alias_match_prefix + r") ((?:bitcast|inttoptr|addrspacecast)\s*\(.* to (.*?)(| addrspace\(\d+\) *)\*\)\s*(?:;.*)?$)")
gep   = re.compile(alias_match_prefix + r") ((?:getelementptr)\s*(?:inbounds)?\s*\((?P<type>.*), (?P=type)(?:\s*addrspace\(\d+\)\s*)?\* .*\)\s*(?:;.*)?$)")

def conv(line):
  m = re.match(cast, line)
  if m:
    return m.group(1) + " " + m.group(3) + ", " + m.group(2)
  m = re.match(gep, line)
  if m:
    return m.group(1) + " " + m.group(3) + ", " + m.group(2)
  m = re.match(plain, line)
  if m:
    return m.group(1) + ", " + m.group(2) + m.group(3) + "*" + m.group(4) + "\n"
  return line

for line in sys.stdin:
  sys.stdout.write(conv(line))

apply.sh:
for name in "$@"
do
  python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
  rm -f "$name.tmp"
done

The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247378 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 03:22:04 +00:00
NAKAMURA Takumi
d0e460175a Tweak llvm/test/tools/gold/X86/parallel.ll to run with pthread-unaware ld.gold on Linux.
If ld.gold is configured without --enable-thread, ld.gold might not load libpthread.so.
Preloading LLVMgold.so loads also libpthread.so.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246739 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 00:48:59 +00:00
Frederic Riss
ef8ad01b02 Reapply r246012 [dsymutil] Emit real dSYM companion binaries.
With a fix for big endian machines. Thanks to Daniel Sanders for the debugging!

Original commit message:

The binaries containing the linked DWARF generated by dsymutil are not
standard relocatable object files like emitted did previsously. They should be
dSYM companion files, which means they have a different file type in the
header, but also a couple other peculiarities:
 - they contain the segments and sections from the original binary in their
load commands, but not the actual contents. This means they get an address
and a size, but their offset is always 0 (but these are not virtual sections)
 - they also conatin all the defined symbols from the original binary

This makes MC a really bad fit to emit these kind of binaries. The approach
that was used in this patch is to leverage MC's section layout for the
debug sections, but to use a replacement for MachObjectWriter that lives
in MachOUtils.cpp. Some of the low-level helpers from MachObjectWriter
were reused too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246673 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 16:49:13 +00:00
NAKAMURA Takumi
3a491e5d33 Suppress llvm/test/tools/gold/X86/parallel.ll while investigating.
For me,

  Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff7deb0dc in _dl_fixup () from /lib64/ld-linux-x86-64.so.2

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 10:59:21 +00:00
Peter Collingbourne
0a1d37b2e8 gold-plugin: Implement parallel LTO code generation using llvm::splitCodeGen.
Parallelism can be enabled using a new plugin option, jobs=N, where N is
the number of code generation threads.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246584 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 20:40:22 +00:00
Davide Italiano
70b9edea77 [llvm-readobj] MachO -- correctly dump section field 'Reserved3'
Before we incorrectly ignored it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246556 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 16:29:02 +00:00
Rui Ueyama
5c1fa7fc49 Object: Fix COFF import file's symbols.
If a symbol is marked as "data", the symbol should be exported
with __imp_ prefix. Previously, the symbol was exported as-is.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246532 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 06:01:53 +00:00
Frederic Riss
42829a5316 [dsymutil] Do not mistakenly reuse the current object file when the next one isn't found.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246412 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 05:16:35 +00:00
Frederic Riss
b70b4156ad [dsymutil] Fix testcase.
This testcase required 2 copies of the same file, and the second
copy was missing. It was currently working because of a bug I'm
about to fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246411 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 05:16:30 +00:00
Frederic Riss
9be5804a89 [dsymutil] Do not crash on empty debug_range range.
The fix is trivial (The actual patch is 2 lines, but as it changes
indentation it looks like more).
clang does not produce this kind of (slightly bogus) debug info
anymore, thus I had to rely on a hand-crafted assembly test to trigger
that case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246410 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 05:09:32 +00:00
Frederic Riss
efe3016477 [dsymutil] Fix handling of inlined_subprogram low_pcs
The value of an inlined subprogram low_pc attribute should not
get relocated, but it can happen that it matches the enclosing
function's start address and thus gets the generic treatment.
Special case it to avoid applying the PC offset twice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246406 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 01:43:14 +00:00
Frederic Riss
a8a34c5382 [dsymutil] Implement -symtab/-s option.
This option dumps the STAB entries that define the debug map(s)
stored in the input binaries, and then exits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246403 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 00:29:09 +00:00
Rafael Espindola
7ef469f951 Split the gold tests into X86 and PowerPC directories.
Patch by Than McIntosh!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246328 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 20:33:56 +00:00
Duncan P. N. Exon Smith
a5ae7c1c9f DI: Require subprogram definitions to be distinct
As a follow-up to r246098, require `DISubprogram` definitions
(`isDefinition: true`) to be 'distinct'.  Specifically, add an assembler
check, a verifier check, and bitcode upgrading logic to combat testcase
bitrot after the `DIBuilder` change.

While working on the testcases, I realized that
test/Linker/subprogram-linkonce-weak-odr.ll isn't relevant anymore.  Its
purpose was to check for a corner case in PR22792 where two subprogram
definitions match exactly and share the same metadata node.  The new
verifier check, requiring that subprogram definitions are 'distinct',
precludes that possibility.

I updated almost all the IR with the following script:

    git grep -l -E -e '= !DISubprogram\(.* isDefinition: true' |
    grep -v test/Bitcode |
    xargs sed -i '' -e 's/= \(!DISubprogram(.*, isDefinition: true\)/= distinct \1/'

Likely some variant of would work for out-of-tree testcases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246327 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 20:26:49 +00:00
Rui Ueyama
c2aa1793ed llvm-readobj: Dump more info for COFF import libraries.
This patch teaches llvm-readobj to print out COFF import file header fields.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246291 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 10:27:50 +00:00
Rui Ueyama
40e22518fc Re-apply r246276 - Object: Teach llvm-ar to create symbol table for COFF short import files
This patch includes a fix for a llvm-readobj test. With this patch, 
the tool does no longer print out COFF headers for the short import
file, but that's probably desirable because the header for the short
import file is dummy.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246283 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 07:40:30 +00:00
Frederic Riss
8990143706 Revert "[dsymutil] Emit real dSYM companion binaries."
This reverts commit r246012.
Some bots do not like it (mips/s390).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246019 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 06:41:57 +00:00
Frederic Riss
3f0363c113 [dsymutil] Emit real dSYM companion binaries.
The binaries containing the linked DWARF generated by dsymutil are not
standard relocatable object files like emitted did previsously. They should be
dSYM companion files, which means they have a different file type in the
header, but also a couple other peculiarities:
 - they contain the segments and sections from the original binary in their
load commands, but not the actual contents. This means they get an address
and a size, but their offset is always 0 (but these are not virtual sections)
 - they also conatin all the defined symbols from the original binary

This makes MC a really bad fit to emit these kind of binaries. The approach
that was used in this patch is to leverage MC's section layout for the
debug sections, but to use a replacement for MachObjectWriter that lives
in MachOUtils.cpp. Some of the low-level helpers from MachObjectWriter
were reused too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246012 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 05:10:04 +00:00
Frederic Riss
65ce0b1a58 [dsymutil] Store an optional BinaryPath in the debug map.
llvm-dsymutil needs to emit dSYM companion bundles. These are binary files
that replicate some of the orignal binary file properties (sections and
symbols). To get acces to these properties, pass the binary path in the
debug map.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246011 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 05:09:59 +00:00
Frederic Riss
30f9092463 [dsymutil] actually fix test.
Not all machines have lipo installed. Do not try to invoke it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245991 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 23:29:43 +00:00
Frederic Riss
3abc9b6333 [dsymutil] Reapply r245960.
There was an issue in the test setup because the test requires an arch that
wasn't filtered by the lit.local.cfg, but given the set of bots that failed,
I'm not confident this is the (only) issue. So this commit also adds more
output to the test to help me track down the failure if it happens again.

Original commit message:
[dsymutil] Rewrite thumb triple names in user visible messages.

We autodetect triples from the input file(s) while reading the mach-o debug map.
As we need to create a Target from those triples, we always chose the thumb
variant (because the arm variant might not be 'instantiable' eg armv7m). The
user visible architecture names should still be 'arm' and not 'thumb' variants
though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245988 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 23:15:26 +00:00
Frederic Riss
89ea38c62f Revert "[dsymutil] Rewrite thumb triple names in user visible messages."
This reverts commit r245960.

Multiple bots are failing on the new test. It seemd like llvm-dsymutil exits with an error. Investigating.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245964 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 18:43:11 +00:00
Frederic Riss
0e221a0b65 [dsymutil] Rewrite thumb triple names in user visible messages.
We autodetect triples from the input file(s) while reading the mach-o debug map.
As we need to create a Target from those triples, we always chose the thumb
variant (because the arm variant might not be 'instantiable' eg armv7m). The
user visible architecture names should still be 'arm' and not 'thumb' variants
though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245960 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 18:19:48 +00:00
Frederic Riss
909125ad03 [dsymutil] Not finding any debug info is not a fatal error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245959 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 18:19:43 +00:00
Frederic Riss
8f7e8462cd [dsymutil] Remove old ODR uniquing tests
These tests have been obsoleted by the refactored versions introduced
in the previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245804 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-23 02:38:37 +00:00
Frederic Riss
b7e7dd4975 [dsymutil] Refactor ODR uniquing tests to be more readable.
This patch adds all the refactored tests in new files, the old
tests will be removed by a followup commit.

Thanks to D. Blaikie for all the feedback.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245803 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-23 02:38:29 +00:00
Peter Collingbourne
c1e784cb78 TransformUtils: Introduce module splitter.
The module splitter splits a module into linkable partitions. It will
be used to implement parallel LTO code generation.

This initial version of the splitter does not attempt to deal with the
somewhat subtle symbol visibility issues around module splitting. These
will be dealt with in a future change.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245662 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 02:48:20 +00:00
Yaron Keren
1cca7d1ed6 Enable five passing dsymutil tests on Windows.
These tests pass with Windows 7 x64 + MSYS2. I'll see if the bots like
them as well and disable the failing ones.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244572 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 06:05:27 +00:00
Reid Kleckner
b28578be8a [llvm-symbolizer] Remove underscores and other C mangling on Windows
Summary:
This makes it so that reports symbolized after the fact with
llvm-symbolizer are more similar to the ones we generate at runtime with
in-process dbghelp.

Reviewers: samsonov

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244512 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 21:47:11 +00:00
Jonathan Roelofs
993a1116f7 Fix a bunch of trivial cases of 'CHECK[^:]*$' in the tests. NFCI
I looked into adding a warning / error for this to FileCheck, but there doesn't
seem to be a good way to avoid it triggering on the instances of it in RUN lines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 19:01:27 +00:00
Frederic Riss
54c40cfb7b [dsymutil] Use the new MCDwarfLineTableParams customization to emit linetables
llvm-dsymutil has to be able to process debug info produced by other compilers
which use different line table settings. The testcase wasn't generated by
another compiler, but by a modified clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244319 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-07 15:14:13 +00:00
NAKAMURA Takumi
34620e340b Tweak llvm/test/tools/dsymutil/arch-option.test to avoid globbing on mingw-w64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244311 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-07 08:38:22 +00:00
Tom Stellard
9baa291a86 ELF: Add AMDGPU specific defintions
Reviewers: rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244303 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-07 01:35:24 +00:00
Frederic Riss
af511be69a [dsymutil] Implement dSYM bundle creation
A dSYM bundle is a file hierarchy that looks slike this:
 <bundle name>.dSYM/
     Contents/
        Info.plist
        Resources/
           DWARF/
              <DWARF file(s)>

This is the default output mode of dsymutil.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 21:05:06 +00:00
Frederic Riss
e88f2f375e [dsymutil] Add (unimplemented) --flat option
dsymutil should by default generate dSYM bundles which are filesystem
hierarchies containing the debug info and an additional Info.plist.
Currently llvm-dsymutil emits raw binaries containing the debug info.
This is what we call the 'flat mode'. Add a -f/-flat option that is
supposed to enable that flat mode, but don't wire it for now, only
pass it to the tests that will need it to stay functional once we
do bundle generation by default.
This basically makes this commit NFC and removes the noise from the
actual commit that adds support for bundle generation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244269 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 21:05:01 +00:00
Peter Collingbourne
f4fa49e750 COFF: Assign the correct symbol type to internal functions.
The COFFSymbolRef::isFunctionDefinition() function tests for several conditions
that are not related to whether a symbol is a function, but rather whether
the symbol meets the requirements for a function definition auxiliary record,
which excludes certain symbols such as internal functions and undefined
references. The test we need to determine the symbol type is much simpler:
we only need to compare the complex type against IMAGE_SYM_DTYPE_FUNCTION.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244195 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 05:26:35 +00:00
Frederic Riss
349b419025 Revert "Make sure all temporary files get created under %T."
This reverts commit r244163. The workaround shouldn't be necessary
after r244172, and moreover the commit was slightly buggy as it
dis a simple mkdir without removing the directory first, which could
cause 'File exists' errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244182 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 23:53:38 +00:00
Frederic Riss
8012b5f7df [dsymutil] Update source used to generate test binary.
Forgot to include that in the last commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244171 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 23:33:45 +00:00
Artem Belevich
3d0846737a Make sure all temporary files get created under %T.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244163 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 22:54:36 +00:00
Frederic Riss
1b709aa2a3 [dsymutil] Add support for the -arch option.
This option allows to select a subset of the architectures when
performing a universal binary link. The filter is done completely
in the mach-o specific part of the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244160 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 22:33:28 +00:00
Frederic Riss
edcd9600c0 [dsymutil] Fix test patterns.
Depending on the filesystem paths, the YAML dump might quote paths.
Account for that in the regex patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244094 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 18:45:13 +00:00
Frederic Riss
7a4257861d [dsymutil] Implement support for handling mach-o universal binaries as main input/output.
The DWARF linker isn't touched by this, the implementation links
individual files and merges them together into a fat binary by
calling out to the 'lipo' utility.

The main change is that the MachODebugMapParser can now return
multiple debug maps for a single binary.

The test just verifies that lipo would be invoked correctly, but
doesn't actually generate a binary. This mimics the way clang
tests its external iplatform tools integration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244087 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 18:27:44 +00:00
Mehdi Amini
44cb0f3803 Update test suite to make "ninja check" succeed without native backend builtin
Requires "native" feature in most places that were failing.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243960 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-04 06:32:54 +00:00
Justin Bogner
7e6adbea62 lto: Avoid relying on the environment for this test
It's better to pass libLTO to ld64 via the command line flag than rely
on setting DYLD_LIBRARY_PATH.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243911 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-03 22:43:14 +00:00
Duncan P. N. Exon Smith
c61bc48acb DI: Disallow uniquable DICompileUnits
Since r241097, `DIBuilder` has only created distinct `DICompileUnit`s.
The backend is liable to start relying on that (if it hasn't already),
so make uniquable `DICompileUnit`s illegal and automatically upgrade old
bitcode.  This is a nice cleanup, since we can remove an unnecessary
`DenseSet` (and the associated uniquing info) from `LLVMContextImpl`.

Almost all the testcases were updated with this script:

    git grep -e '= !DICompileUnit' -l -- test |
    grep -v test/Bitcode |
    xargs sed -i '' -e 's,= !DICompileUnit,= distinct !DICompileUnit,'

I imagine something similar should work for out-of-tree testcases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243885 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-03 17:26:41 +00:00
Alexander Kornienko
21481e0320 Fix the test added at r243777.
When RUN: lines are split into multiple lines, each one must be prefixed with
RUN:.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243868 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-03 09:13:19 +00:00
Simon Atanasyan
e35d602838 [Mips] Support DT_MIPS_RLD_MAP_REL dynamic section tag in the llvm-readobj
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-01 12:02:02 +00:00
Frederic Riss
d353c91d49 [dsymutil] Support multiple input files on the command line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243777 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 20:22:20 +00:00
Duncan P. N. Exon Smith
bf2040f00c DI: Remove DW_TAG_arg_variable and DW_TAG_auto_variable
Remove the fake `DW_TAG_auto_variable` and `DW_TAG_arg_variable` tags,
using `DW_TAG_variable` in their place Stop exposing the `tag:` field at
all in the assembly format for `DILocalVariable`.

Most of the testcase updates were generated by the following sed script:

    find test/ -name "*.ll" -o -name "*.mir" |
    xargs grep -l 'DILocalVariable' |
    xargs sed -i '' \
      -e 's/tag: DW_TAG_arg_variable, //' \
      -e 's/tag: DW_TAG_auto_variable, //'

There were only a handful of tests in `test/Assembly` that I needed to
update by hand.

(Note: a follow-up could change `DILocalVariable::DILocalVariable()` to
set the tag to `DW_TAG_formal_parameter` instead of `DW_TAG_variable`
(as appropriate), instead of having that logic magically in the backend
in `DbgVariable`.  I've added a FIXME to that effect.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243774 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 18:58:39 +00:00
Frederic Riss
2096f62462 [dsymutil] Rename -v option to -verbose
The dsymutil-classic -v option dumps the tool version rather than
putting it in verbose mode. Rename -v to -verbose and update the
tests that use it (in the process removing it from a few tests that
didn't require it anymore since the -dump-debug-map option was
introduced).
A followup commit will reintroduce the -v option that dumps the
version.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243582 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 22:29:34 +00:00
Colin LeMahieu
154b3f0725 [llvm-objdump] Merging MachO DumpSections in to FilterSections. Simplifying some predicate logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243556 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 19:08:10 +00:00
Colin LeMahieu
edbf9d742e [llvm-objdump] Added -j flag to filter sections that are operated on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243526 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 15:45:39 +00:00
Colin LeMahieu
937b1cee1a [llvm-mc] Add --no-warn flag with -W alias to disable outputting warnings while assembling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243338 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 22:39:14 +00:00
Colin LeMahieu
f78e199cb2 [llvm-mc] Pushing plumbing through for --fatal-warnings flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243334 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-27 21:56:53 +00:00
NAKAMURA Takumi
ca1494b52d llvm/test/tools/dsymutil/ARM/lit.local.cfg: Fix possibly typo, s/X86/ARM/.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243106 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24 11:55:11 +00:00
Frederic Riss
fa7f7bd017 [dsymutil] Implement support for universal mach-o object files.
This patch allows llvm-dsymutil to read universal (aka fat) macho object
files and archives. The patch touches nearly everything in the BinaryHolder,
but it is fairly mechinical: the methods that returned MemoryBufferRefs or
ObjectFiles now return a vector of those, and the high-level access function
takes a triple argument to select the architecture.

There is no support yet for handling fat executables and thus no support for
writing fat object files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243096 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24 06:41:11 +00:00
Frederic Riss
1556296615 [dsymutil] Make the triple detection more strict.
MachOObjectFile offers a method for detecting the correct triple, use
it instead of the previous approximation. This doesn't matter right
now, but it will become important for mach-o universal (fat) binaries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243095 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-24 06:41:04 +00:00
Colin LeMahieu
5fb71b264d Moving tests in to X86 directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243049 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23 21:55:26 +00:00
Colin LeMahieu
8782d64e37 Using an input object file instead of trying to generate an object file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243044 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23 21:40:19 +00:00
Colin LeMahieu
a5c7608532 Specifying a test triple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243042 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23 21:24:52 +00:00
Colin LeMahieu
ea8050283f [llvm-objdump] Add -D and --disassemble-all flags that attempt disassembly on all sections instead of just text sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243041 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-23 20:58:49 +00:00
Frederic Riss
00d14ddf9d [dsymutil] Check archive members timestamps.
The debug map contains the timestamp of the object files in references.
We do not check these in the general case, but it's really useful if
you have archives where different versions of an object file have been
appended. This allows llvm-dsymutil to find the right one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242965 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 23:24:00 +00:00
Frederic Riss
309fcf84b8 [dsymutil] Implement ODR uniquing for C++ code.
This optimization allows the DWARF linker to reuse definition of
types it has emitted in previous CUs rather than reemitting them
in each CU that references them. The size and link time gains are
huge. For example when linking the DWARF for a debug build of
clang, this generates a ~150M dwarf file instead of a ~700M one
(the numbers date back a bit and must not be totally accurate
these days).

As with all the other parts of the llvm-dsymutil codebase, the
goal is to keep bit-for-bit compatibility with dsymutil-classic.
The code is littered with a lot of FIXMEs that should be
addressed once we can get rid of the compatibilty goal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242847 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-21 22:41:43 +00:00
Simon Atanasyan
13c5e09c6e [llvm-readobj] Print MIPS PLT table
Now the -mips-plt-got prints both MIPS GOT and PLT tables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241836 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09 18:23:10 +00:00
David Majnemer
b1d6ad18ba [CodeView] Add support for emitting column information
Column information is present in CodeView when the line table subsection
has bit 0 set to 1 in it's flags field.  The column information is
represented as a pair of 16-bit quantities: a starting and ending
column.  This information is present at the end of the chunk, after all
the line-PC pairs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241764 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09 00:19:51 +00:00
Adrian Prantl
54a2768153 llvm-objdump: Replace the -macho -raw option with a generic -raw-clang-ast
option that works with all object container formats.
Now that clang modules/PCH are object containers this option is useful to
to construct pipes like

  llvm-objdump -raw-clang-ast foo.pcm | llvm-bcanalyzer -

to inspect the AST contents in a PCH container.
Will be tested via clang.

Belatedly addresses review feedback for r233390.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-08 02:04:15 +00:00
Rafael Espindola
38e853141d Pass -m to the linker in this test.
Fixes the test on a ppc host.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 18:04:54 +00:00
Rafael Espindola
bd1e605b5c objdump: Don't print a (always 0) size for MachO symbols.
Only common symbol on MachO and COFF have a size.

For COFF we already had a custom format.

For MachO, there is no native objdump and we were printing it as ELF. Now
we only print the sizes for symbols that actually have them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240422 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 15:45:38 +00:00
Rafael Espindola
da523bd707 Add a test for the previous commit.
This shows how two symbols at the same address are handled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240374 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 03:42:44 +00:00
Rafael Espindola
393bbf5c86 Fix tests when X86 is not enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240368 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 02:45:44 +00:00
Rafael Espindola
dba070638a Compute correct symbol sizes for MachO and COFF.
Before this would dump from the symbol start to the end of the section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240367 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-23 02:20:37 +00:00
Frederic Riss
11fcb49922 [Object] Search for architecures by name in MachOUniversalBinary::getObjectForArch()
The reason we need to search by name rather than by Triple::ArchType
is to handle subarchitecture correclty. There is no different ArchType
for the x86_64h architecture (it identifies itself as x86_64), or for
the various ARM subarches. The only way to get to the subarch slice
in an universal binary is to search by name.

This issue led to hard to debug and transient symbolication failures
in Asan tests (it mostly works, because the files are very similar).

This also affects the Profiling infrastucture as it is the other user
of that API.

Reviewers: samsonov, bogner

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240339 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 21:33:24 +00:00
Rafael Espindola
0ed63077a2 Add a triple to the test to fix it on some hosts.
The slp vectorizer doesn't optimize this case in 32 bits.

Fixes PR23453.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240289 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 15:44:20 +00:00
Rafael Espindola
28b186f3cc Improve the --expand-relocs handling of MachO.
In a relocation target can take 3 basic forms

* A r_value in scattered relocations.
* A symbol in external relocations.
* A section is non-external relocations.

Have the dump reflect that. With this change we go from

CHECK-NEXT:       Extern: 0
CHECK-NEXT:       Type: X86_64_RELOC_SUBTRACTOR (5)
CHECK-NEXT:       Symbol: 0x2
CHECK-NEXT:       Scattered: 0

To just

// CHECK-NEXT:       Type: X86_64_RELOC_SUBTRACTOR (5)
// CHECK-NEXT:       Section: __data (2)

Since the relocation is with a section, we print the seciton name and don't
need to say that it is not scattered or external.

Someone motivated can add further special cases for things like
ARM64_RELOC_ADDEND and ARM_RELOC_PAIR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240073 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-18 22:38:20 +00:00
Rafael Espindola
50cef0052f Pass --expand-relocs to a few more tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240069 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-18 22:12:47 +00:00
Simon Atanasyan
3bcfd461f6 [llvm-readobj] Print MIPS .reginfo section content
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239856 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 21:47:43 +00:00
Frederic Riss
37c67e6bb6 Have MachOObjectFile::isValidArch() accept armv7
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 17:37:03 +00:00
Rafael Espindola
99e760ad9e gold-plugin: save the .o when given -save-temps.
The plugin now save the bitcode before and after optimizations and the
.o that is passed to the linker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239726 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 13:36:27 +00:00
Frederic Riss
c7968ac7b5 [dsymutil] Fix misspelled CHECK line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239200 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 23:46:18 +00:00
Frederic Riss
9ccf07fb89 [dsymutil] Add support for linking the debug_frame section.
Linking the debug frame section is actually very easy as we just have to
patch the start address in the FDE header and then copy the rest of the
FDE without even looking at it. The only small complexity comes from the
handling of the CIEs that we should unique across object file. This is
also really easy by using a StringMap keyed on the raw contents of the
CIE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239198 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 23:06:11 +00:00
Frederic Riss
dfbf8971ca [dsymutil] Have the YAML deserialization rewrite the object address of symbols.
The main use of the YAML debug map format is for testing inside LLVM. If we have IR
files in the tests used to generate object files, then we obviously don't know the
addresses of the symbols inside the object files beforehand.

This change lets the YAML import lookup the addresses in the object files and rewrite
them. This will allow to have test that really don't need any binary input.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239189 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 21:12:07 +00:00
Frederic Riss
8a5883aabe [dsymutil] Handle the -oso-prepend-path option when the input is a YAML debug map
All the tests using a YAML debug map will need this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239163 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 16:35:44 +00:00
Alexey Samsonov
23fd513829 Fix buildbot failure on Windows by relaxing test expectations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239074 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 19:22:00 +00:00
Alexey Samsonov
1b77d22c66 llvm-objdump: return non-zero exit code for certain cases of invalid input
* If the input file is missing;
* If the type of input object file can't be recognized;
* If the object file can't be parsed correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 18:34:11 +00:00
Frederic Riss
696c93c900 Reapply r238941 - [dsymutil] Accept a YAML debug map as input instead of a binary.
With a couple more constructors that GCC thinks are necessary.

Original commit message:

[dsymutil] Accept a YAML debug map as input instead of a binary.

To do this, the user needs to pass the new -y flag.
As it wasn't tested before, the debug map YAML deserialization was
completely buggy (mainly because the DebugMapObject has a dual
mapping that allows to search by name and by address, but only the
StringMap got populated). It's fixed and tested in this commit by
augmenting some test with a 2 stage dwarf link: a frist llvm-dsymutil
reads the debug map and pipes it in a second instance that does the
actual link without touching the initial binary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238959 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 20:29:24 +00:00
Frederic Riss
57c68eeefe Revert "[dsymutil] Accept a YAML debug map as input instead of a binary."
This reverts commit r238941 while I figure out the bot issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238943 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 17:08:42 +00:00
Frederic Riss
001b032fea [dsymutil] Accept a YAML debug map as input instead of a binary.
To do this, the user needs to pass the new -y flag.
As it wasn't tested before, the debug map YAML deserialization was
completely buggy (mainly because the DebugMapObject has a dual
mapping that allows to search by name and by address, but only the
StringMap got populated). It's fixed and tested in this commit by
augmenting some test with a 2 stage dwarf link: a frist llvm-dsymutil
reads the debug map and pipes it in a second instance that does the
actual link without touching the initial binary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238941 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 16:57:16 +00:00
Frederic Riss
7745dac9d0 [dsymutil] Replace -parse-only option with -dump-debug-map
As the serialized debug map is becoming a first class citizen, a way
to cleanly dump it is required. We used -parse-only combined with
-v for that purpose before, but it dumps a lot of unrelated debug
stuff. Dumping the debug map was the only use of the -parse-only flag
anyway, so replace it with a more useful option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238940 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 16:57:12 +00:00
Rafael Espindola
201a551929 Fix the interpretation of a 0 st_name.
The ELF spec is very clear:

-----------------------------------------------------------------------------
If the value is non-zero, it represents a string table index that gives the
symbol name. Otherwise, the symbol table entry has no name.
--------------------------------------------------------------------------

In particular, a st_name of 0 most certainly doesn't mean that the symbol has
the same name as the section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 05:14:22 +00:00
Frederic Riss
786b471cc6 [dsymutil] Use YAMLIO to dump debug map.
Doing so will allow us to also accept a YAML debug map in input as using
YAMLIO gives us the parsing for free. Being able to have textual debug
maps will in turn allow much more control over the tests, because 1/
no need to check-in a binary containing the debug map and 2/ it will allow
to use the same objects/IR files with made-up debug-maps to test
different scenari.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238781 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 21:12:45 +00:00
Davide Italiano
a651b2236f Clarify how the binary file checked in was generated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238665 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 22:43:36 +00:00
Davide Italiano
41a6e6a698 [llvm-readobj/ELF] Teach how to decode DF_1_XXX flags
llvm-readobj -dynamic-table output.
Before:
0x000000006FFFFFFB unknown

After:
0x000000006FFFFFFB FLAGS_1 NOW ORIGIN

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238151 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-25 19:12:18 +00:00
Rafael Espindola
7b677dd986 Stop inventing symbol sizes.
MachO and COFF quite reasonably only define the size for common symbols.

We used to try to figure out the "size" by computing the gap from one symbol to
the next.

This would not be correct in general, since a part of a section can belong to no
visible symbol (padding, private globals).

It was also really expensive, since we would walk every symbol to find the size
of one.

If a caller really wants this, it can sort all the symbols once and get all the
gaps ("size") in O(n log n) instead of O(n^2).

On MachO this also has the advantage of centralizing all the checks for an
invalid n_sect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238028 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 15:43:00 +00:00
Simon Atanasyan
975307cc50 [llvm-readobj] Teach llvm-readobj to print PT_MIPS_ABIFLAGS program header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237451 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 15:59:22 +00:00
Justin Bogner
98f0f26fdf InstrProf: Fix display of large numbers in llvm-cov
llvm-cov was truncating numbers that were larger than a particular
fixed width, which is as confusing as it is useless. Instead, we use
engineering notation with SI prefix for magnitude.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237307 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 22:41:48 +00:00
Simon Atanasyan
ef7c2568fa [llvm-readobj] Print .MIPS.abiflags section content
This change adds new flag -mips-abi-flags to the llvm-readobj. This flag
forces printing of .MIPS.abiflags section content.

https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking#10.2.1._.MIPS.abiflags

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236737 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-07 15:40:35 +00:00
Justin Bogner
406a47c17f InstrProf: Give coverage its own errors instead of piggy backing on instrprof
Since the coverage mapping reader and the instrprof reader were
emitting a shared set of error codes, the error messages you'd get
back from llvm-cov were ambiguous about what was actually wrong. Add
another error category to fix this.

I've also improved the wording on a couple of the instrprof errors,
for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236665 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 23:19:35 +00:00
Zachary Turner
43afa42908 A few fixes for llvm-symbolizer on Windows.
Specifically, this patch correctly respects the -demangle option,
and additionally adds a hidden --relative-address option allows
input addresses to be relative to the module load address instead
of absolute addresses into the image.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236653 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 22:26:30 +00:00
Zachary Turner
7c69a58214 [llvm-pdbdump] Support dynamic load address and external symbols.
This patch adds the --load-address command line option to
llvm-pdbdump, which dumps all addresses assuming the module has
loaded at the specified address.

Additionally, this patch adds an option to llvm-pdbdump to support
dumping of public symbols (i.e. symbols with external linkage).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236342 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-01 20:24:26 +00:00
Kevin Enderby
28b8dea315 For llvm-objdump, with the -archive-headers and -macho options, use the -non-verbose
option to print the archive headers using raw numeric values.  Also add the -archive-member-offsets
for use with these to also trigger printing of the offset of the archive member from the start
of the archive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236252 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 20:30:42 +00:00
Zachary Turner
7b8e8e5dc0 Make llvm-symbolizer work on Windows.
Differential Revision: http://reviews.llvm.org/D9234
Reviewed By: Alexey Samsonov

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235900 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-27 17:19:51 +00:00