1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

6034 Commits

Author SHA1 Message Date
Davide Italiano
175cdd0c04 [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

llvm-svn: 246474
2015-08-31 19:32:31 +00:00
Karl Schimpf
c9db4d6473 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

llvm-svn: 246458
2015-08-31 17:55:32 +00:00
Davide Italiano
1dab53a08c [llvm-readobj] Add pair of missing braces.
This fixes a regression introduced in r246151.

llvm-svn: 246453
2015-08-31 17:12:23 +00:00
Frederic Riss
3827771c05 [dsymutil] Do not mistakenly reuse the current object file when the next one isn't found.
llvm-svn: 246412
2015-08-31 05:16:35 +00:00
Frederic Riss
f40460817a [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.

llvm-svn: 246410
2015-08-31 05:09:32 +00:00
Frederic Riss
2953a251de [dsymutil] Fix caching of current range. NFC.
The current range cache will will just be hit more often, no
visible external change.

llvm-svn: 246409
2015-08-31 05:09:26 +00:00
Frederic Riss
d13fc7e4bb [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.

llvm-svn: 246406
2015-08-31 01:43:14 +00:00
Frederic Riss
b447bcabea [dsymutil] Do not construct a StringRef from a std::string temporary
llvm-svn: 246404
2015-08-31 00:49:34 +00:00
Frederic Riss
e4c25bb014 [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.

llvm-svn: 246403
2015-08-31 00:29:09 +00:00
Rui Ueyama
349a98f1e0 llvm-readobj: Dump more info for COFF import libraries.
This patch teaches llvm-readobj to print out COFF import file header fields.

llvm-svn: 246291
2015-08-28 10:27:50 +00:00
Rui Ueyama
0fad42df2f 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.

llvm-svn: 246283
2015-08-28 07:40:30 +00:00
Peter Collingbourne
b346721555 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

llvm-svn: 246236
2015-08-27 23:37:36 +00:00
Michael J. Spencer
78bdd69848 [yaml2obj] Support numeric indexes to create invalid files. Will be used by lld test.
llvm-svn: 246233
2015-08-27 23:11:20 +00:00
Davide Italiano
aaf02e450d [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

llvm-svn: 246151
2015-08-27 15:11:32 +00:00
Davide Italiano
de5be57bc6 [llvm-objdump] Use the new MinVersion API introduced in r245938. NFC.
llvm-svn: 246031
2015-08-26 12:26:11 +00:00
Frederic Riss
dd547fbadd Revert "[dsymutil] Emit real dSYM companion binaries."
This reverts commit r246012.
Some bots do not like it (mips/s390).

llvm-svn: 246019
2015-08-26 06:41:57 +00:00
Frederic Riss
0a9bf9e3f1 [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.

llvm-svn: 246012
2015-08-26 05:10:04 +00:00
Frederic Riss
7a4905efc2 [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.

llvm-svn: 246011
2015-08-26 05:09:59 +00:00
Frederic Riss
b2e76242cf [dsymutil] Make the warn and error helpers globally available. NFC.
llvm-svn: 246010
2015-08-26 05:09:55 +00:00
Frederic Riss
eaf3e44947 [dsymutil] Split NonRelocatableStringPool into its own file. NFC.
llvm-svn: 246009
2015-08-26 05:09:52 +00:00
Frederic Riss
f7cdc109f3 [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.

llvm-svn: 245988
2015-08-25 23:15:26 +00:00
Frederic Riss
0d55393ca3 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.

llvm-svn: 245964
2015-08-25 18:43:11 +00:00
Frederic Riss
16713145e7 [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.

llvm-svn: 245960
2015-08-25 18:19:48 +00:00
Frederic Riss
c80ee6a7d0 [dsymutil] Not finding any debug info is not a fatal error
llvm-svn: 245959
2015-08-25 18:19:43 +00:00
Peter Collingbourne
1d5cde4afc 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

llvm-svn: 245891
2015-08-24 22:22:53 +00:00
Davide Italiano
aab4507d18 [llvm-readobj/ELF] Factor out common code.
llvm-svn: 245813
2015-08-23 14:06:40 +00:00
Peter Collingbourne
db573c5328 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.

llvm-svn: 245756
2015-08-21 22:57:17 +00:00
Davide Italiano
256ba29add [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

llvm-svn: 245732
2015-08-21 20:28:30 +00:00
Peter Collingbourne
9092fbc31c llvm-lto: Re-order code.
This saves us from needing to asave a pointer, and will be needed for an
upcoming ownership change.

llvm-svn: 245722
2015-08-21 19:09:42 +00:00
Peter Collingbourne
96b0ffdce8 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

llvm-svn: 245662
2015-08-21 02:48:20 +00:00
David Majnemer
ee4740a5b5 Replace some calls to isa<LandingPadInst> with isEHPad()
No functionality change is intended.

llvm-svn: 245487
2015-08-19 19:54:02 +00:00
Chandler Carruth
bf271cc4e6 [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

llvm-svn: 245318
2015-08-18 17:51:53 +00:00
Chris Bieneman
a1024936aa [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

llvm-svn: 245064
2015-08-14 16:20:31 +00:00
David Majnemer
d8399d92f8 [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.

llvm-svn: 244932
2015-08-13 18:31:43 +00:00
Yaron Keren
9267630cbc 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.

llvm-svn: 244928
2015-08-13 18:12:56 +00:00
Yaron Keren
35b21efd71 Remove raw_svector_ostream::resync and users. It's no-op after r244870.
llvm-svn: 244888
2015-08-13 12:42:25 +00:00
Reid Kleckner
b6442713bb [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

llvm-svn: 244512
2015-08-10 21:47:11 +00:00
Rafael Espindola
d1fc658396 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.

llvm-svn: 244510
2015-08-10 21:29:35 +00:00
Rafael Espindola
6e87ed90fd Use higher level functions in llvm-objdump.
This matches the rest of llvm-objdump better and isolates it from upcoming
changes to ELFFile.

llvm-svn: 244500
2015-08-10 20:50:40 +00:00
Rafael Espindola
e12302b7c2 Delete getDotSymtabSec.
Another step in avoiding iterating over all sections in the ELFFile constructor.

llvm-svn: 244496
2015-08-10 20:25:04 +00:00
Rafael Espindola
29d199aa4d Use continue to reduce indentation. NFC.
llvm-svn: 244480
2015-08-10 18:57:42 +00:00
Yaron Keren
61f6d7c22d Recommit r244470+ r244471 together, the bot failed between them.
llvm-svn: 244476
2015-08-10 18:27:51 +00:00
Yaron Keren
88665eff12 Revert r244470 and 244471 while looking into it.
llvm-svn: 244472
2015-08-10 18:14:56 +00:00
Yaron Keren
47dad377e0 Second part of r244470 (source file was unsaved in editor).
llvm-svn: 244471
2015-08-10 18:06:01 +00:00
Yaron Keren
0093118b2a 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.

llvm-svn: 244470
2015-08-10 18:03:35 +00:00
Yaron Keren
ea9a1cc024 Fully apply David Blaikie suggestion and add comment explaining why.
llvm-svn: 244461
2015-08-10 16:53:30 +00:00
Yaron Keren
620d03e422 Modify r244405 to clearer code, per David Blaikie suggestion.
llvm-svn: 244455
2015-08-10 16:15:51 +00:00
Rafael Espindola
16999b6002 elf2yaml: Use existing section walk to find the symbol table. NFC.
llvm-svn: 244447
2015-08-10 14:27:50 +00:00
Yaron Keren
59a9ea3f96 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.

llvm-svn: 244405
2015-08-08 21:03:19 +00:00
Rafael Espindola
088669ce42 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.

llvm-svn: 244375
2015-08-07 23:27:14 +00:00