Commit Graph

6377 Commits

Author SHA1 Message Date
Teresa Johnson
aa8954c114 Convert gold-plugin unnecessary unique_ptr into local (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250704 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 15:23:03 +00:00
Teresa Johnson
bf3fb71116 Fix required library for r250699 to BitWriter instead of BitReader.
This should fix the mingw3 bot failure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 15:21:46 +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
Craig Topper
44bf343ec1 Make a bunch of static arrays const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250642 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-18 05:15:34 +00:00
Matthias Braun
cc2082e98f StreamWriter: List basic types instead of derived ones in HexNumber
This avoids problems with different (u)intXX definition on different
platforms. Specifically this fixes a case on OS/X which had uint64_t
defined as unsigned long long.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250589 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-17 00:08:45 +00:00
Reid Kleckner
9f85b269f8 Speculative fix for GCC build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250585 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 23:53:12 +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
Chris Bieneman
e0e13ae1e3 [CMake] [Darwin] Add support for generating Xcode-compatible toolchains that xcodebuild and xcrun can search
Summary:
Sometimes you want to install a custom compiler and use it like the system compiler without overriding the system compiler. This patch lets you create xctoolchains that the darwin command line tools can use.

To use this patch set LLVM_CREATE_XCODE_TOOLCHAIN=On in your CMake invocation and build the `install-code-toolchain` target.

After installation you can set the envar EXTERNAL_TOOLCHAINS_DIR to your installed Toolchains directory, and the TOOLCHAINS envar to the toolchain identifier (ex org.llvm.3.8.0svn). This will then cause /usr/bin/clang to call your newly installed clang.

Reviewers: Bigcheese, bogner

Subscribers: tobiasfar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250450 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 20:09:01 +00:00
Benjamin Kramer
44b610a614 Make windows.h less evil.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250386 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 09:38:45 +00:00
Benjamin Kramer
44702c85e2 [llvm-pdbdump] Remove oddly placed parens that MSVC doesn't like
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250385 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 09:32:54 +00:00
David Majnemer
a1079b7d51 Speculatively unbreak Windows build
<windows.h> defines macros named min and max in conflict with
<algorithm>.  Prevent macro expansion by wrapping std::min in
parenthesis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250383 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 09:17:15 +00:00
David Majnemer
4e486b6a4d [llvm-pdbdump] Provide a mechanism to dump the raw contents of a PDB
A PDB can be thought of as a very simple file system.  It is
occasionally illuminating to see the contents of the underlying files.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250356 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 01:27:19 +00:00
Davide Italiano
bd133e68d8 [bugpoint] llvm-gcc doesn't exist anymore ...
... so this comment is stale. Remove it. Range-loopify while here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250354 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 01:12:01 +00:00
Davide Italiano
d88454bff7 [JIT] TrivialMemoryManager: Fail if we can't allocate memory.
TrivialMemoryManager currently doesn't check the return type of AllocateRWX --
and returns a 'null' MemoryBlock to its caller. As pointed out by Lang,
this exposes some serious issues with the MemoryManager interface. There's,
in fact, no way to report back an error to clients rather than aborting in
case memory can't be allocated. Eventually the interface will grow to support
this, but for now, fail sooner rather than later.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250350 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 00:05:32 +00:00
Davide Italiano
f7b2acbdba [Bugpoint] Use 'CC' instead of 'GCC' for variable naming.
We now use clang by default and fallback to gcc when requested.
With this commit, names reflect reality. No functional change
intended.

Discussed with: Rafael Espindola.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250321 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 20:29:54 +00:00
Davide Italiano
e99d2083cf [Bugpoint] Use clang by default.
We now rely on gcc only if either of the following is true:
1) -gcc option is passed by the user
2) clang is not found in the default path.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250318 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 19:48:01 +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
Chris Bieneman
8f0bf9255c [CMake] Add LLVM_VERSION_PATCH to the -current_version flag for libLTO and libLLVM.
This is to match autoconf where LLVM_SUBMIT_SUBVERSION is usually set to ${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250277 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 07:50:21 +00:00
Richard Smith
1184005c1e Rename one of our two llvm::GCOVOptions classes to llvm::GCOV::Options. We used
to get away with this because llvm/Support/GCOV.h was an implementation detail
of the llvm-gcov tool, but it's now being used by FDO.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250258 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 00:04:19 +00:00
Chris Bieneman
b5348ec6af [CMake] Add compatibility and current versioning to libLTO to match autoconf support.
This also adds LLVM_LTO_VERSION_OFFSET to support functional equivalence to autoconf.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250245 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 22:54:29 +00:00
Chris Bieneman
3038b3fcf2 [CMake] libLLVM's compatibility version should be 1.
This is in matching with the autoconf build system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250244 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 22:54:27 +00:00
Richard Smith
9c4cdfd521 Add missing #include, found by modules build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250239 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 22:24:10 +00:00
Vedant Kumar
337f9bbdd1 [uselistorder] Insert blank line, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250231 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 21:51:02 +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
Davide Italiano
dc7bc46ccd [llvm-rtdyld] General modernization/cleanup in preparation for (bigger) changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250004 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 00:57:29 +00:00
Davide Italiano
6dc307b5fd [Bugpoint] Get rid of dead code. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249999 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-11 21:36:11 +00:00
Davide Italiano
f2e1e0eaf4 [llvm-rtdyld] Use range-based loop. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249923 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-10 00:45:24 +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
Richard Smith
213ae79e1a Fix use of uninitialized bool, found by ubsan in portion of
test/tools/llvm-objdump/malformed-machos.test added in r249845.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249909 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 22:09:56 +00:00
Chris Bieneman
0c1b206804 [CMake] If LLVM_DYLIB_EXPORT_ALL is On don't generate an export list at all, just export the world.
This should resolve Bug 24157 - CMake built shared library does not export all public symbols

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249862 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 17:55:21 +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
Frederic Riss
0dbce2b4db [dsymutil] Prevent warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249836 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 15:04:05 +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
Frederic Riss
a642d2c6cb [dsymutil] Try to find lipo first besides dsymutil before looking up the PATH.
Even if we don't have it in PATH, lipo should usually exist in the same directory
as dsymutil. Keep the fallback looking up the PATH, it's very useful when
testing a non-installed executable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249762 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 22:35:53 +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
Pete Cooper
e6fb099e98 Stop linking all target libraries in llvm-nm and llvm-objdump.
llvm-nm only needs the target to parse module level assembly in bitcode.  It doesn't need a disassembler or codegen.

llvm-objdump needs to be able to disassemble a file, but doesn't need asm parsers or codegen.

This reduces the sizes of these tools by a few MB each, depending on how many backends are linked in.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249632 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-07 22:39:17 +00:00
Lang Hames
be06dbe647 [Orc] Enable user supplied partitioning functors in the CompileOnDemand layer.
Previously the CompileOnDemand layer always created single-function partitions.
In theory this new API allows for more interesting partitions, though this has
not been well tested yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249623 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-07 21:53:41 +00:00
Hans Wennborg
4d651e440b Fix Clang-tidy modernize-use-nullptr warnings in source directories and generated files; other minor cleanups.
Patch by Eugene Zelenko!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249482 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-06 23:24:35 +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
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
Kostya Serebryany
9906eefc84 [libFuzzer] make LLVMFuzzerTestOneInput (the fuzzer target function) return int instead of void. The actual return value is not *yet* used (and expected to be 0). This change is API breaking, so the fuzzers will need to be updated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249214 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 23:34:06 +00:00
Chris Bieneman
cdc351d1c9 [CMake] We need to explicitly add llvm-config before clang so that LLVM_BUILD_EXTERNAL_COMPILER_RT can depend on llvm-config.
This patch is a required stepping stone to fix PR14109.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249202 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-02 22:28:48 +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
Rafael Espindola
3fffb697c2 Fix printing of 64 bit values and make test more strict.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249043 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 17:57:31 +00:00
Davide Italiano
8902508581 [llvm-objdump] Fix time of check to time of use bug.
There's already a test that covers this situation, so we should be
fine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248976 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 01:02:37 +00:00
Justin Bogner
c96f87a892 InstrProf: Support for value profiling in the indexed profile format
Add support to the indexed instrprof reader and writer for the format
that will be used for value profiling.

Patch by Betul Buyukkurt, with minor modifications.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248833 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29 22:13:58 +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
Hans Wennborg
d16725c31f Fix Clang-tidy modernize-use-nullptr warnings in examples and include directories; other minor cleanups.
Patch by Eugene Zelenko!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248811 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29 18:02:48 +00:00
Daniel Sanders
0ff0eb0687 [llvm-mc-fuzzer] Fix -jobs option.
The fuzzer argument parser will ignore all options starting with '--' so
operation mode options should begin with '--' and fuzzer options should begin
with '-'. Fuzzer arguments must still follow --fuzzer-args so that they escape
the parsing performed by the CommandLine library.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248671 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-26 17:09:01 +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
Benjamin Kramer
cdac331ff8 [objdump] Make iterator operator* return a reference.
This is closer to the expected behavior of an iterator and avoids awkward
warnings from clang's -Wrange-loop-analysis below.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248497 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 14:52:52 +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
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
Benjamin Kramer
39a9cdb8b7 [dsymutil] Plug a memory leak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248372 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 10:38:59 +00:00
NAKAMURA Takumi
826813ee9f dsymutil: Fix a comment. [-Wdocumentation]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-23 00:19:20 +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
Adrian Prantl
45b0eeb56d dsymutil: Make -oso-prepend-path available to DwarfLinker.
NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248312 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 18:51:01 +00:00
Adrian Prantl
d6d5ed0ca8 dsymutil: Make resolveDIEReference and getUnitForOffset static functions.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248311 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 18:50:58 +00:00
Adrian Prantl
6db2b2be10 dsymutil: Make DwarfLinker::reportWarning() public. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248310 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 18:50:51 +00:00
Davide Italiano
36caf0659f Remove macho-dump. Its functionality is now covered by llvm-readobj.
Approved by: Rafael Espindola, Eric Christopher, Jim Grosbach, 
             Alex Rosenberg


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248302 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 17:46:10 +00:00
Adrian Prantl
c8a4540af1 Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248283 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 15:31:14 +00:00
Daniel Sanders
e59aef6de7 [llvm-mc-fuzzer] Support untested instruction discovery for variable length instruction sets like microMIPS.
Summary:
For fixed length instructions, we can use -max_len to limit the fuzzer to a
single instruction. This doesn't work for variable length instruction sets
since a 4-byte input could consist of one 4-byte instruction or two 2-byte
instructions.

This patch adds a --insn-limit to llvm-mc-fuzzer to limit the input in
terms of instructions processed.

Reviewers: kcc

Subscribers: kcc, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248253 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 09:22:53 +00:00
Davide Italiano
5646beae51 [llvm-readobj/MachO] Ensure we always have valid CmdName/SegmentName.
Otherwise we might end up printing garbage while dumping.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248239 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 02:14:43 +00:00
Rafael Espindola
82ede2f136 Avoid SEGFAULT if a requested symbol section is absent.
Patch by Igor Kudrin!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248194 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 19:17:18 +00:00
Craig Topper
795a06a046 Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type extra times. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248140 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-21 05:32:41 +00:00
Davide Italiano
e986a9d52e [obj2yaml] Fix "time of check to time of use" bug. Add a test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248096 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-19 20:49:34 +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
3011017ecc Restore "Function bitcode index in Value Symbol Table and lazy reading support"
This reverts commit r247898 (which reverted r247894).

Patch fixed to address two issues exposed by buildbots:
- unused variable warning in NDEBUG mode
- std::initializer_list lifetime issue causing test failures

Original Summary:
Support for including the function bitcode indices in the Value Symbol
Table. This requires writing the VST after the function blocks, which in
turn requires a new VST forward declaration record encoding the offset of
the full VST (which is backpatched to contain the offset after the VST
is written).

This patch also enables the lazy function reader to use the new function
indices out of the VST. This support will be used by ThinLTO as well, which
will be in a follow on patch. Backwards compatibility with older bitcode
files is maintained.

A new test is also included.

The bitcode format (used for the lazy reader as well as the upcoming
ThinLTO patches) came out of discussions with Duncan and others and is
described here:
https://drive.google.com/file/d/0B036uwnWM6RWdnBLakxmeDdOeXc/view

Reviewers: dexonsmith, davidxl, joker.eph

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247927 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-17 20:12:00 +00:00
Teresa Johnson
c9d578aaf4 Revert "Function bitcode index in Value Symbol Table and lazy reading support"
Temporarily revert to fix some buildbot issues. One is a minor issue
with a variable unused in NDEBUG mode. More concerning are some test
failures on win7 that I need to dig into.

This reverts commit 4e66a74543459832cfd571db42b4543580ae1d1d.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247898 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-17 16:19:10 +00:00
Teresa Johnson
1f05ba2fcb Function bitcode index in Value Symbol Table and lazy reading support
Summary:
Support for including the function bitcode indices in the Value Symbol
Table. This requires writing the VST after the function blocks, which in
turn requires a new VST forward declaration record encoding the offset of
the full VST (which is backpatched to contain the offset after the VST
is written).

This patch also enables the lazy function reader to use the new function
indices out of the VST. This support will be used by ThinLTO as well, which
will be in a follow on patch. Backwards compatibility with older bitcode
files is maintained.

A new test is also included.

The bitcode format (used for the lazy reader as well as the upcoming
ThinLTO patches) came out of discussions with Duncan and others and is
described here:
https://drive.google.com/file/d/0B036uwnWM6RWdnBLakxmeDdOeXc/view

Reviewers: dexonsmith, davidxl, joker.eph

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247894 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-17 15:52:30 +00:00
Diego Novillo
1e5eaadbbd Check for errors after reading a sample profile in llvm-profdata.
After reading the profile, check if the reader returned any errors
before showing the profile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247873 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-17 00:17:21 +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
Daniel Sanders
5369e0fdbe llvm-mc-fuzzer: A fuzzing tool for the MC layer.
Summary:
Only the disassembler is supported in this patch but it has already found a few
issues in the Mips disassembler (mostly invalid instructions being successfully
disassembled).

Reviewers: kcc

Subscribers: russell.gallop, silvas, kcc, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16 11:49:49 +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
Duncan P. N. Exon Smith
5e60a68a2d Reapply "LTO: Disable extra verify runs in release builds"
This reverts commit r247730, effectively reapplying r247729.  This time
I have an lld commit ready to follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247735 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 23:05:59 +00:00
Duncan P. N. Exon Smith
c567bd6ca2 Revert "LTO: Disable extra verify runs in release builds"
This temporarily reverts commit r247729, as it caused lld build
failures.  I'll recommit once I have an lld patch ready-to-go.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 22:47:38 +00:00
Duncan P. N. Exon Smith
b0d872aece LTO: Disable extra verify runs in release builds
The verifier currently runs three times in LTO: (1) after parsing, (2)
at the beginning of the optimization pipeline, and (3) at the end of it.

The first run is important, since we're not sure where the bitcode comes
from and it's nice to validate it, but in release builds the extra runs
aren't appropriate.

This commit:
  - Allows these runs to be disabled in LTOCodeGenerator.
  - Adds command-line options to llvm-lto.
  - Adds command-line options to libLTO.dylib, and disables the verifier
    by default in release builds (based on NDEBUG).

This shaves about 3.5% off the runtime of ld64 when linking
verify-uselistorder with -flto -g.

rdar://22509081

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247729 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 22:26:11 +00:00
Daniel Sanders
47b167dd84 Revert r247692: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Eric has replied and has demanded the patch be reverted.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247702 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 16:17:27 +00:00
Daniel Sanders
9781f90c7e Re-commit r247683: Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).

For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.

This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.

This commit also contains a trivial patch to clang to account for the C++ API
change. Thanks go to Pavel Labath for fixing LLDB for me.

Reviewers: rengolin

Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247692 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 14:08:28 +00:00
Daniel Sanders
a6aa0c3bcc Revert r247684 - Replace Triple with a new TargetTuple ...
LLDB needs to be updated in the same commit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247686 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 13:46:21 +00:00
Daniel Sanders
7b82808e13 Replace Triple with a new TargetTuple in MCTargetDesc/* and related. NFC.
Summary:
This is the first patch in the series to migrate Triple's (which are ambiguous)
to TargetTuple's (which aren't).

For the moment, TargetTuple simply passes all requests to the Triple object it
holds. Once it has replaced Triple, it will start to implement the interface in
a more suitable way.

This change makes some changes to the public C++ API. In particular,
InitMCSubtargetInfo(), createMCRelocationInfo(), and createMCSymbolizer()
now take TargetTuples instead of Triples. The other public C++ API's have
been left as-is for the moment to reduce patch size.

This commit also contains a trivial patch to clang to account for the C++ API
change.

Reviewers: rengolin

Subscribers: jyknight, dschuff, arsenm, rampitec, danalbert, srhines, javed.absar, dsanders, echristo, emaste, jholewinski, tberghammer, ted, jfb, llvm-commits, rengolin

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247683 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 13:17:40 +00:00
Adrian Prantl
e2e1a3b61d dsymutil: Remove the now obsolete RelocMgr argument from cloneDIE. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247636 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 23:27:26 +00:00
Vedant Kumar
97c9f0cae0 [llvm-cov] Disable name and path truncation
Change the output of llvm-cov s.t it does not truncate function names
and file paths when printing coverage reports.

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

rdar://22531141

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247635 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 23:26:36 +00:00
Chris Bieneman
2ec309f7d1 [CMake] Refactor and cleanup generating and installing symlinks to tools.
Summary: This change generalizes symlink generation and makes symlinks to tools obey LLVM_TOOLCHAIN_TOOLS. It makes it so that if you exclude llvm-ar from LLVM_TOOLCHAIN_TOOLS you don't end up with broken symlinks to llvm-lib and llvm-ranlib in your install.

Reviewers: bogner, chapuni, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247632 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 23:09:06 +00:00
Chris Bieneman
5ab5648165 [CMake] Add llvm-ar subdirectory explicitly.
This is required because ExternalProject_Add requires all targets specified in the DEPENDS argument must exist before calling ExternalProject_Add.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247592 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 18:36:40 +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
Adrian Prantl
afca6b4138 dsymutil: Factor out the DIE cloning into a DIECloner class. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247577 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 16:46:10 +00:00
Davide Italiano
92148557f7 [llvm-mc] More meaningful error if input file doesn't exist.
Before we just printed on stderr the program name. Now at least we
print the name of the file that doesn't exist. There's probably room
for improvement of error handling in llvm-mc (and the tools in general),
but still this is a step forward.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247518 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-13 04:09:40 +00:00
Adrian Prantl
0a0a960468 dsymutil: Factor out the relocation handling into a RelocationManager (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247490 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 23:45:30 +00:00
Yunzhong Gao
7ba3323aff Add a non-exiting diagnostic handler for LTO.
This is in order to give LTO clients a chance to do some clean-up before
terminating the process.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247461 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 20:01:53 +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
Frederic Riss
5571e7771e [dsymutil] Rename some variables NFC.
lldb doesn't like having variables named as an existing type. In order to
ease debugging, rename those variables to avoid that conflict.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247385 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 04:17:25 +00:00
Chris Bieneman
24346ed19f [CMake] Add lto subdirectory explicitly.
This is required because ExternalProject_Add requires all targets specified in the DEPENDS argument must exist before calling ExternalProject_Add.

I have a follow-up patch to clang that enables using the just-built libLTO in bootstrap builds, so we need to be able to add the LTO target as a dependency in clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247316 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 18:22:33 +00:00
Tom Stellard
800a5b0664 llvm-config: Add --build-system option
Summary:
This can be used for distinguishing between cmake and autoconf builds.
Users may need this in order to handle inconsistencies between the
outputs of the two build systems.

Reviewers: echristo, chandlerc, beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247159 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-09 16:39:30 +00:00
Davide Italiano
793616c068 [llvm-readobj] MachO -- dump LinkerOptions load command.
Example output:

Linker Options {
  Size: 32
  Count: 2
  Strings [
    Value: -framework
    Value: Cocoa
  ]
}

There were only two tests using this -- so I converted them as part of
this commit rather than separately.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247106 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-09 00:21:18 +00:00
Davide Italiano
2206b4bc38 [llvm-readobj] Shrink code a little bit. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246976 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-07 20:47:03 +00:00
Andrew Wilkins
f5148ebe0a [cmake] rework LLVM_LINK_LLVM_DYLIB option handling
Summary:
This diff attempts to address the concerns raised in
http://reviews.llvm.org/D12488.

We introduce a new USE_SHARED option to llvm_config,
which, if set, causes the target to be linked against
libLLVM.

add_llvm_utility now uniformly disables linking against
libLLVM. These utilities are not intended for distribution,
and this keeps the option handling more centralised.

llvm-shlib is now processes before any other "tools"
subdirectories, ensuring the libLLVM target is defined
before its dependents.

One main difference from what was requested: llvm_config
does not prune LLVM_DYLIB_COMPONENTS from the components
passed into explicit_llvm_config. This is because the "all"
component does something special, adding additional
libraries (namely libLTO). Adding the component libraries
after libLLVM should not be a problem, as symbols will be
resolved in libLLVM first.

Finally, I'm not really happy with the
DISABLE_LLVM_LINK_LLVM option, but I'm not sure of a
better way to get the following:
 - link all tools and shared libraries to libLLVM if
   LLVM_LINK_LLVM_DYLIB is set
 - some way of explicitly *not* doing so for utilities
   and libLLVM itself
Suggestions for improvement here are particularly welcome.

Reviewers: beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246918 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-05 08:27:33 +00:00
Davide Italiano
cdd5f6d41a [llvm-readobj] MachO: dump the correct field.
This was found while converting a test from macho-dump to llvm-readobj
and will once I commit the converted test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246868 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-04 20:43:00 +00:00
Davide Italiano
7ab2009024 [llvm-readobj] Dump MachO indirect symbols.
Example output:

File: <stdin>
Format: Mach-O 32-bit i386
Arch: i386
AddressSize: 32bit
Indirect Symbols {

Number: 3
Symbols [
  Entry {
    Entry Index: 0
    Symbol Index: 0x4
  }
  Entry {
    Entry Index: 1
    Symbol Index: 0x0
  }
  Entry {
    Entry Index: 2
    Symbol Index: 0x1
  }
]
}

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246789 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 18:10:28 +00:00
Joseph Tremoulet
226889eb73 [WinEH] Add cleanupendpad instruction
Summary:
Add a `cleanupendpad` instruction, used to mark exceptional exits out of
cleanups (for languages/targets that can abort a cleanup with another
exception).  The `cleanupendpad` instruction is similar to the `catchendpad`
instruction in that it is an EH pad which is the target of unwind edges in
the handler and which itself has an unwind edge to the next EH action.
The `cleanupendpad` instruction, similar to `cleanupret` has a `cleanuppad`
argument indicating which cleanup it exits.  The unwind successors of a
`cleanuppad`'s `cleanupendpad`s must agree with each other and with its
`cleanupret`s.

Update WinEHPrepare (and docs/tests) to accomodate `cleanupendpad`.

Reviewers: rnk, andrew.w.kaylor, majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246751 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03 09:09:43 +00:00
Davide Italiano
a1bc1c274d [llvm-reaodbj] Simplify code. No functional change (intended).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246676 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 16:53:25 +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
Davide Italiano
885eb98ce3 [llvm-readobj] MachO: Dump segment command.
Example output:

File: <stdin>
Format: Mach-O arm
Arch: arm
AddressSize: 32bit
Segment {
  Cmd: LC_SEGMENT
  Name:
  Size: 260
  vmaddr: 0x0
  vmsize: 0x10
  fileoff: 408
  filesize: 408
  maxprot: rwx
  initprot: rwx
  nsects: 3
  flags: 0x0
}

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246665 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 16:24:24 +00:00
Rafael Espindola
3c4c9334b2 Pass a symbol table to getRelocationSymbol instead of returning one.
This removes a report_fatal_error from library and avoids checking a
section property for every section entry.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246656 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 15:07:39 +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
Artem Belevich
20264d6c67 New bitcode linker flags:
-only-needed -- link in only symbols needed by destination module
-internalize -- internalize linked symbols

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246561 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 17:55:55 +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
Andrew Wilkins
10add60748 Enable linking tools, shared libraries against libLLVM
Summary:
Three closely related changes, to have a mode in which we link all
executables and shared libraries against libLLVM. 

1. Add a new LLVM_LINK_LLVM_DYLIB cmake option, which, when ON, will link
   executables and shared libraries against libLLVM. For this to work, it
   is necessary to also set LLVM_BUILD_LLVM_DYLIB and LLVM_DYLIB_EXPORT_ALL.

   It is not strictly necessary to set LLVM_DISABLE_LLVM_DYLIB_ATEXIT, but
   we also default to OFF in this mode, or tools tend to misbehave (e.g.
   stdout may not flush on exit when output is buffered.)

   llvm-config and Tablegen do not use libLLVM, as they are dependencies of
   libLLVM.

2. Modify llvm-go to take a new flag, "linkmode=component-libs|dylib".
   Depending on which one is passed (default is component-libs), we link
   with the individual libraries or libLLVM respectively. We pass in dylib
   when LLVM_LINK_LLVM_DYLIB is ON.

3. Fix LLVM_DYLIB_EXPORT_ALL on Linux, and expand the symbols exported to
   actually export all. Don't strip leading underscore from symbols on Linux,
   and make sure we get all exported symbols and weak-with-default symbols
   ("W" in nm output). Without these changes, passes won't load because
   the "Annotate..." symbols defined in lib/Support/Valigrind.cpp are not
   found.

Testing:
 - Ran default build ("ninja") with LLVM, clang, compiler-rt, llgo, lldb.
 - Ran "check", "check-clang", "check-tsan", "check-libgo" targets. I've
   never had much success with LLDB tests, and llgoi is currently broken
   so check-llgo fails for an unrelated reason.
 - Ran "lldb" to ensure it loads.

Reviewers: chandlerc, beanz, pcc, rnk

Subscribers: rnk, chapuni, sylvestre.ledru, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246527 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 03:14:31 +00:00
Davide Italiano
19c43a6286 [llvm-readobj] Dump MachO Dysymtab command.
Example output:

File: <stdin>
Format: Mach-O 64-bit x86-64
Arch: x86_64
AddressSize: 64bit
Dysymtab {

ilocalsym: 0
nlocalsym: 6
iextdefsym: 6
nextdefsym: 2
iundefsym: 8
nundefsym: 0
tocoff: 0
ntoc: 0
modtaboff: 0
nmodtab: 0
extrefsymoff: 0
nextrefsyms: 0
indirectsymoff: 0
nindirectsyms: 0
extreloff: 0
nextrel: 0
locreloff: 0
nlocrel: 0

}

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246474 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 19:32:31 +00:00
Karl Schimpf
1318d71a75 Build a lib/Fuzzer version for llvm-as.
Summary:
This CL is associated with a fuzzing effort to find bugs in LLVM. The
first step is to fuzz llvm-as to find potential issues in generating
IR. Both afl-fuzz and LLVM's lib/Fuzzer are being used.

This CL introduces the executable that implements the in-process
fuzzer using LLVM's lib/Fuzzer. The motivation for using lib/Fuzzer is
based on time comparisons between afl-fuzz and lib/Fuzzer. Early
results show that per-process, the lib/Fuzzer implemenation of llvm-as
(i.e. this CL) generates over 30 times the number of mutations found
by afl-fuzz, per hour runtime. The speedup is due to the removal of
overhead of forking a process, and loading the executable into memory.

I placed this under the tools directory, since it is an executable. It
is also only conditionally built if (using cmake) the flag
LLVM_USEE_SANITIZE_COVERAGE is used, so that it isn't built by
default.

Reviewers: kcc, filcab

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246458 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 17:55:32 +00:00
Davide Italiano
6997c3ae84 [llvm-readobj] Add pair of missing braces.
This fixes a regression introduced in r246151.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246453 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 17:12:23 +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
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
a4d4495cfa [dsymutil] Fix caching of current range. NFC.
The current range cache will will just be hit more often, no
visible external change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246409 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 05:09:26 +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
74e7aca9e0 [dsymutil] Do not construct a StringRef from a std::string temporary
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246404 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-31 00:49:34 +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
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
Peter Collingbourne
daf6885fa4 CodeGen: Introduce splitCodeGen and teach LTOCodeGenerator to use it.
llvm::splitCodeGen is a function that implements the core of parallel LTO
code generation. It uses llvm::SplitModule to split the module into linkable
partitions and spawning one code generation thread per partition. The function
produces multiple object files which can be linked in the usual way.

This has been threaded through to LTOCodeGenerator (and llvm-lto for testing
purposes). Separate patches will add parallel LTO support to the gold plugin
and lld.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246236 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 23:37:36 +00:00
Michael J. Spencer
82f1bf2f60 [yaml2obj] Support numeric indexes to create invalid files. Will be used by lld test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246233 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 23:11:20 +00:00
Davide Italiano
7dbe74f4e3 [llvm-readobj] Add support for dumping MachO min version load command.
Example output:
File: <stdin>
Format: Mach-O arm
Arch: arm
AddressSize: 32bit
MinVersion {
  Cmd: LC_VERSION_MIN_IPHONEOS
  Size: 16
  Version: 99.8.7
  SDK: n/a
}

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246151 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 15:11:32 +00:00
Davide Italiano
80708ae0d8 [llvm-objdump] Use the new MinVersion API introduced in r245938. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246031 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 12:26:11 +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
93639d33f7 [dsymutil] Make the warn and error helpers globally available. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246010 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 05:09:55 +00:00
Frederic Riss
fe893839f9 [dsymutil] Split NonRelocatableStringPool into its own file. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246009 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 05:09:52 +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
Peter Collingbourne
8c1602df50 LTO: Simplify merged module ownership.
This change moves LTOCodeGenerator's ownership of the merged module to a
field of type std::unique_ptr<Module>. This helps simplify parts of the code
and clears the way for the module to be consumed by LLVM CodeGen (see D12132
review comments).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245891 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-24 22:22:53 +00:00
Davide Italiano
a99b964662 [llvm-readobj/ELF] Factor out common code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245813 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-23 14:06:40 +00:00
Peter Collingbourne
aa7ad072c9 LTO: Change signature of LTOCodeGenerator::setCodePICModel() to take a Reloc::Model.
This allows us to remove a bunch of code in LTOCodeGenerator and llvm-lto
and has the side effect of improving error handling in the libLTO C API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245756 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 22:57:17 +00:00
Davide Italiano
241f716c4b [llvm-readobj] Add support for MachO DataInCodeDataCommand.
Example output:

File: <stdin>
Format: Mach-O arm
Arch: arm
AddressSize: 32bit
DataInCode {
  Data offset: 300
  Data size: 32
  Data Regions [
    DICE {
      Index: 0
      Offset: 0
      Length: 4
      Kind: 1
    }
    DICE {
      Index: 1
      Offset: 4
      Length: 4
      Kind: 4
    }
    DICE {
      Index: 2
      Offset: 8
      Length: 2
      Kind: 3
    }
    DICE {
      Index: 3
      Offset: 10
      Length: 1
      Kind: 2
    }
  ]
}

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245732 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 20:28:30 +00:00
Peter Collingbourne
d01f303c32 llvm-lto: Re-order code.
This saves us from needing to asave a pointer, and will be needed for an
upcoming ownership change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245722 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 19:09:42 +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
David Majnemer
42bf5e9e58 Replace some calls to isa<LandingPadInst> with isEHPad()
No functionality change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245487 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 19:54:02 +00:00
Chandler Carruth
896f064a49 [PM/AA] Remove the last relics of the separate IPA library from LLVM,
folding the code into the main Analysis library.

There already wasn't much of a distinction between Analysis and IPA.
A number of the passes in Analysis are actually IPA passes, and there
doesn't seem to be any advantage to separating them.

Moreover, it makes it hard to have interactions between analyses that
are both local and interprocedural. In trying to make the Alias Analysis
infrastructure work with the new pass manager, it becomes particularly
awkward to navigate this split.

I've tried to find all the places where we referenced this, but I may
have missed some. I have also adjusted the C API to continue to be
equivalently functional after this change.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245318 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 17:51:53 +00:00
Chris Bieneman
0a8f7a16c0 [CMake] Fix PR14200, llvm-config output misses -fno-rtti
This change adds RTTI and Exception flags to llvm-config's cxxflags. This solution is a minimal patch to solve the issue, and is recommended for the 3.7 release branch. Tom Stellard's outstanding work is the longer term solution.

Patch By: David Wiberg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245064 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 16:20:31 +00:00
David Majnemer
218b64b5ae [llvm-cxxdump] Correctly process relocations when given multiple files
Archive files wouldn't lead to us reprocessing the section relocations
for the new object files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244932 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 18:31:43 +00:00
Yaron Keren
4b885ee8e2 Remove and forbid raw_svector_ostream::flush() calls.
After r244870 flush() will only compare two null pointers and return,
doing nothing but wasting run time. The call is not required any more
as the stream and its SmallString are always in sync.

Thanks to David Blaikie for reviewing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244928 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 18:12:56 +00:00
Yaron Keren
e65e298541 Remove raw_svector_ostream::resync and users. It's no-op after r244870.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244888 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-13 12:42:25 +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
Rafael Espindola
0d34e64f73 Don't iterate over all sections in the ELFFile constructor.
With this we finally have an ELFFile that is O(1) to construct. This is helpful
for programs like lld which have to do their own section walk.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244510 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 21:29:35 +00:00
Rafael Espindola
e03b9f566c Use higher level functions in llvm-objdump.
This matches the rest of llvm-objdump better and isolates it from upcoming
changes to ELFFile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244500 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 20:50:40 +00:00
Rafael Espindola
4d79d2fcbf Delete getDotSymtabSec.
Another step in avoiding iterating over all sections in the ELFFile constructor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244496 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 20:25:04 +00:00
Rafael Espindola
c505e6df7a Use continue to reduce indentation. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244480 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 18:57:42 +00:00
Yaron Keren
99b2ac6270 Recommit r244470+ r244471 together, the bot failed between them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244476 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 18:27:51 +00:00
Yaron Keren
40c54fb97a Revert r244470 and 244471 while looking into it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 18:14:56 +00:00
Yaron Keren
5e56a4f86e Second part of r244470 (source file was unsaved in editor).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244471 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 18:06:01 +00:00
Yaron Keren
af1c9b3bfb Really implement David Blaikie suggestion in full of seperating
variable initialization from its usage in the push_back making
collapse of the two statements unlikely even without a comment.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244470 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 18:03:35 +00:00
Yaron Keren
3758d95e05 Fully apply David Blaikie suggestion and add comment explaining why.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244461 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 16:53:30 +00:00
Yaron Keren
ccc3705dab Modify r244405 to clearer code, per David Blaikie suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244455 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 16:15:51 +00:00
Rafael Espindola
2295449608 elf2yaml: Use existing section walk to find the symbol table. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244447 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-10 14:27:50 +00:00
Yaron Keren
c19de56ad9 Fix dangling reference in DwarfLinker.cpp. The original code
Seq.emplace_back(Seq.back());

does not work as planned, since Seq.back() may become a dangling reference
when emplace_back is called and possibly reallocates vector. To avoid this,
the vector allocation should be reserved first and only then used.

This broke test/tools/dsymutil/X86/custom-line-table.test with Visual C++ 2013.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244405 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-08 21:03:19 +00:00
Rafael Espindola
e84d8c12d5 Convert getSymbolSection to return an ErrorOr.
This function can actually fail since the symbol contains an index to the
section and that can be invalid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244375 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-07 23:27:14 +00:00
Rafael Espindola
310e6c3606 Don't look for a SHT_DYNSYM in the ELFFile's constructor.
Yet another step in not having it scan every section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-07 20:11:08 +00:00
Rafael Espindola
8081351a70 Remove the symbol iteration functions that don't take a symbol table.
Another step in making ELFFile's constructor not iterate over all sections.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244351 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-07 20:07:27 +00:00
Rafael Espindola
e1358aa4ce Add dynamic_table iterators back to ELF.h.
In tree they are only used by llvm-readobj, but it is also used by
https://github.com/mono/CppSharp.

While at it, add some missing error checking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244320 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-07 15:25:20 +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
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
Davide Italiano
e06606ffd1 [llvm-readobj] Convert to range-loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244300 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-07 00:35:28 +00:00
Rafael Espindola
8a0ff180e8 Move to llvm-readobj code that is only used there.
lld might end up using a small part of this, but it will be in a much
refactored form. For now this unblocks avoiding the full section scan in the
ELFFile constructor.

This also has a (very small) error handling improvement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244282 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 21:54:37 +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
Davide Italiano
0de2088479 [llvm-objdump] Add missing call to exit(1).
Reported by: Rafael Espindola.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244184 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 00:18:52 +00:00
Frederic Riss
e04f789f46 [dsymutil] Do not create temporary files in -no-output mode.
The files were never written to and then deleted, but they were created
nonetheless. To prevent that, create a wrapper around the 2 variants of
createUniqueFile and use the one that only does an access(Exists) call
to check for name unicity in -no-output mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244172 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 23:33:50 +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
Nick Lewycky
3987976693 Replace &vector[0] with vector.data() to avoid invalid dereference caught by debug STL. Also move a '*' for consistency and fix an 80-col violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244134 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 21:16:02 +00:00
David Blaikie
0caff999ff -Wdeprecated clean by making LogBuilder move constructible so it can be returned by value (in DifferenceEngine::logf)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244129 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 21:06:50 +00:00
Richard Diamond
50f5c7d1cd Revert "Fix llvm-config to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components."
It seems I was wrong thinking `autoconf`/`make` only installed shared libraries if configured with `--enable-shared`, even if `--disable-static` is present. I'll re-address with a followup patch.

This reverts commit r243297 for causing PR#24154.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244108 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 20:03:26 +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
Frederic Riss
d2fb7bd3d5 [dsymutil] Introduce exit helper. NFC.
llvm-dsymutil will start creating temporary files in a followup
commit. To ease the correct cleanup of this files, introduce a
helper called to exit dsymutil.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 18:27:38 +00:00
Frederic Riss
cca89d34ba [dsymutil] Split some logic into a helper function. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244085 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 18:27:34 +00:00
Davide Italiano
281c1b093e [llvm-objdump] Call exit(1) on error, i.e. fail early.
Previously we kept going on partly corrupted input, which might result
in garbage being printed, or even worse, random crashes.
Rafael mentioned that this is the GNU behavior as well, but after some
discussion we both agreed it's probably better to emit a reasonable
error message and exit. As a side-effect of this commit, now we don't
rely on global state for error codes anymore. objdump was the last tool
in the toolchain which needed to be converted. Hopefully the old behavior
won't sneak into the tree again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244019 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-05 07:18:31 +00:00
Davide Italiano
c83882c394 [llvm-objdump] Range-loopify. NFC intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243905 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-03 21:46:32 +00:00
Frederic Riss
7cd34c0fee [dwarfdump] Add support for dumping mach-o universal objectfiles
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243862 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-03 00:10:31 +00:00
Frederic Riss
5733daa233 [dwarfdump] Move dumping to a helper function NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243861 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-03 00:10:25 +00:00
Duncan P. N. Exon Smith
401c02a7ed DwarfLinker: Use DIEValueList instead of DIE, NFC
Use `DIEValueList` as a pointer to either `DIEBlock` or `DIELoc` instead
of `DIE`, since soon they won't inherit from the latter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243857 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-02 20:48:47 +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
David Majnemer
4a45f0871a New EH representation for MSVC compatibility
This introduces new instructions neccessary to implement MSVC-compatible
exception handling support.  Most of the middle-end and none of the
back-end haven't been audited or updated to take them into account.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243766 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 17:58:14 +00:00
Mehdi Amini
778e06475b Fix lli with OrcLazyJIT: the default DataLayout was used.
Set the correct one using the TargetMachine instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243664 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30 17:29:33 +00:00
David Majnemer
cfe562c99b [COFF] Add IMAGE_SCN_TYPE_NOLOAD to SectionCharacteristics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243658 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30 16:47:56 +00:00
Frederic Riss
3134cebe28 [dsymutil] Re-add command line option -v this time printing the version.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243584 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 22:29:50 +00:00