Commit Graph

6125 Commits

Author SHA1 Message Date
Davide Italiano d91bf8ec59 [llvm-rtdyld] Use range-based loop. NFC.
llvm-svn: 249923
2015-10-10 00:45:24 +00:00
Kevin Enderby d90a4176ff 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

llvm-svn: 249921
2015-10-10 00:05:01 +00:00
Richard Smith 81ff44d89d Fix use of uninitialized bool, found by ubsan in portion of
test/tools/llvm-objdump/malformed-machos.test added in r249845.

llvm-svn: 249909
2015-10-09 22:09:56 +00:00
Chris Bieneman 0ac9109d22 [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

llvm-svn: 249862
2015-10-09 17:55:21 +00:00
Kevin Enderby af7c9d0123 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

llvm-svn: 249845
2015-10-09 16:48:44 +00:00
Frederic Riss 9f5013a138 [dsymutil] Prevent warning
llvm-svn: 249836
2015-10-09 15:04:05 +00:00
Reid Kleckner 21427ada3e Address review comments, remove error case and return 0 instead as required by tests
llvm-svn: 249785
2015-10-09 00:15:08 +00:00
Reid Kleckner e94fef7b3d [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

llvm-svn: 249784
2015-10-09 00:15:01 +00:00
Kevin Enderby 46e642f8c5 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

llvm-svn: 249768
2015-10-08 22:50:55 +00:00
Frederic Riss 02cccde95b [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.

llvm-svn: 249762
2015-10-08 22:35:53 +00:00
Diego Novillo aae1ed8e08 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.

llvm-svn: 249724
2015-10-08 19:40:37 +00:00
Kevin Enderby aac7538216 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.

llvm-svn: 249700
2015-10-08 16:56:35 +00:00
Teresa Johnson b1cfcd4a53 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

llvm-svn: 249695
2015-10-08 15:56:24 +00:00
Pete Cooper e11c9de83d 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.

llvm-svn: 249632
2015-10-07 22:39:17 +00:00
Lang Hames 6df48a97d2 [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.

llvm-svn: 249623
2015-10-07 21:53:41 +00:00
Hans Wennborg 083ca9bb32 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

llvm-svn: 249482
2015-10-06 23:24:35 +00:00
Kevin Enderby a59824a174 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.

llvm-svn: 249479
2015-10-06 22:27:08 +00:00
Adrian Prantl d2793a030b 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.

llvm-svn: 249362
2015-10-05 23:11:20 +00:00
Alexandros Lamprineas 057f0a68cc 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

llvm-svn: 249304
2015-10-05 12:13:29 +00:00
Teresa Johnson 403a787e03 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

llvm-svn: 249270
2015-10-04 14:33:43 +00:00
Davide Italiano f0acbbfd96 [llvm-size] Fix time to check if time of use bug.
This was the last tool relying on this pattern.

llvm-svn: 249244
2015-10-03 19:44:06 +00:00
Kostya Serebryany 20bb5e71b2 [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.
llvm-svn: 249214
2015-10-02 23:34:06 +00:00
Chris Bieneman 042e817bff [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.

llvm-svn: 249202
2015-10-02 22:28:48 +00:00
Adrian Prantl 42562c38f5 dsymutil: Also ignore the ByteSize when building the DeclContext cache for
clang modules.

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

llvm-svn: 249110
2015-10-02 00:27:08 +00:00
Davide Italiano f070688ecf [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

llvm-svn: 249083
2015-10-01 21:57:09 +00:00
Rafael Espindola e883514736 Fix printing of 64 bit values and make test more strict.
llvm-svn: 249043
2015-10-01 17:57:31 +00:00
Davide Italiano c50ae36509 [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.

llvm-svn: 248976
2015-10-01 01:02:37 +00:00
Justin Bogner 9e9a057a9b 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.

llvm-svn: 248833
2015-09-29 22:13:58 +00:00
Zachary Turner 4dddcc64d3 [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".

llvm-svn: 248822
2015-09-29 19:49:06 +00:00
Hans Wennborg cc9deb4801 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

llvm-svn: 248811
2015-09-29 18:02:48 +00:00
Daniel Sanders 4fe1c8b24e [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.

llvm-svn: 248671
2015-09-26 17:09:01 +00:00
Adrian Prantl f3e634b8fb dsymutil: Fix the condition to distinguish module imports form definitions.
llvm-svn: 248512
2015-09-24 16:10:14 +00:00
Benjamin Kramer ac9257b258 [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.

llvm-svn: 248497
2015-09-24 14:52:52 +00:00
Adrian Prantl ea8a724474 dsymutil: Don't prune forward declarations inside a module definition.
llvm-svn: 248428
2015-09-23 20:44:37 +00:00
Adrian Prantl a112ef9e2d 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

llvm-svn: 248398
2015-09-23 17:35:52 +00:00
Adrian Prantl 209370260d 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.

llvm-svn: 248396
2015-09-23 17:11:10 +00:00
Benjamin Kramer 008f4be499 [dsymutil] Plug a memory leak.
llvm-svn: 248372
2015-09-23 10:38:59 +00:00
NAKAMURA Takumi ca6f044f35 dsymutil: Fix a comment. [-Wdocumentation]
llvm-svn: 248353
2015-09-23 00:19:20 +00:00
Adrian Prantl e5162dba49 dsymutil: Follow references to clang modules and recursively clone the
debug info.

This does not yet resolve external type references.

llvm-svn: 248331
2015-09-22 22:20:50 +00:00
Adrian Prantl 4e6b3b2580 dsymutil: Make -oso-prepend-path available to DwarfLinker.
NFC

llvm-svn: 248312
2015-09-22 18:51:01 +00:00
Adrian Prantl fdd9a8275b dsymutil: Make resolveDIEReference and getUnitForOffset static functions.
NFC.

llvm-svn: 248311
2015-09-22 18:50:58 +00:00
Adrian Prantl c3021ee239 dsymutil: Make DwarfLinker::reportWarning() public. (NFC)
llvm-svn: 248310
2015-09-22 18:50:51 +00:00
Davide Italiano 77011ba16a Remove macho-dump. Its functionality is now covered by llvm-readobj.
Approved by: Rafael Espindola, Eric Christopher, Jim Grosbach, 
             Alex Rosenberg

llvm-svn: 248302
2015-09-22 17:46:10 +00:00
Adrian Prantl 6ec471251a Fix a typo.
llvm-svn: 248283
2015-09-22 15:31:14 +00:00
Daniel Sanders b45deab674 [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

llvm-svn: 248253
2015-09-22 09:22:53 +00:00
Davide Italiano 26fabd7ac5 [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

llvm-svn: 248239
2015-09-22 02:14:43 +00:00
Rafael Espindola 8055ed0c12 Avoid SEGFAULT if a requested symbol section is absent.
Patch by Igor Kudrin!

llvm-svn: 248194
2015-09-21 19:17:18 +00:00
Craig Topper 0013be16ff Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type extra times. NFC
llvm-svn: 248140
2015-09-21 05:32:41 +00:00
Davide Italiano a539f63ae1 [obj2yaml] Fix "time of check to time of use" bug. Add a test.
llvm-svn: 248096
2015-09-19 20:49:34 +00:00
Davide Italiano 096cda11fc [llvm-readobj] Fix another "time of check to time of use bug".
It seems there's more copy-paste between tools than needed.

llvm-svn: 247954
2015-09-17 22:29:58 +00:00