Commit Graph

5769 Commits

Author SHA1 Message Date
Lang Hames 37cc9fadd5 [Orc] Tidy up initialization based on review feedback for r239561 from dblaikie.
NFC.

llvm-svn: 239645
2015-06-12 23:13:06 +00:00
Lang Hames 2e36ddf671 [Orc] Fix a bug in the CompileOnDemand layer where stub decls were not cloned
into partitions. Also, add an option to clone stub definitions (not just decls)
into partitions: these definitions could be inlined in some places to avoid the
overhead of calling via the stub.

Found by inspection - no test case yet, although I plan to add a unit test for
this once the CompileOnDemand layer refactoring settles down.

llvm-svn: 239640
2015-06-12 21:31:15 +00:00
Douglas Katzman 8f01f1cfc3 Wrap some long lines in LLVMBuild files. NFC
As suggested by jroelofs in a prior review (D9752),
it makes sense to generally prefer multi-line format.

llvm-svn: 239632
2015-06-12 18:44:57 +00:00
Rafael Espindola c74ac023d8 Have the ELF symbol predicates match more directly the spec.
The underlaying issues is that this code can't really know if an OS specific or
processor specific section number should return true or false.

One option would be to assert or return an error, but that looks like over
engineering since extensions are not that common.

It seems better to have these be direct implementation of the ELF spec so that
they are natural for someone familiar with ELF reading the code.

Code that does have to handle OS/Architecture specific values can do it at
a higher level.

llvm-svn: 239618
2015-06-12 17:23:39 +00:00
Lang Hames 3f9960a969 [Orc] Remove some unnecesary includes and whitespace that slipped in to r239561.
NFC.

llvm-svn: 239564
2015-06-11 22:12:24 +00:00
Lang Hames 6a14edd914 [Orc] Make partition identification in the CompileOnDemand layer lazy.
This also breaks out the logical dylib symbol resolution logic.

llvm-svn: 239561
2015-06-11 21:45:19 +00:00
Peter Collingbourne bc05163f15 LibDriver, llvm-lib: introduce.
llvm-lib is intended to be a lib.exe compatible utility that also
understands bitcode. The implementation lives in a library so that
lld can use it to implement /lib.

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

llvm-svn: 239434
2015-06-09 21:50:22 +00:00
Rui Ueyama 7d09919534 Remove object_error::success and use std::error_code() instead
make_error_code(object_error) is slow because object::object_category()
uses a ManagedStatic variable. But the real problem is that the function is
called too frequently. This patch uses std::error_code() instead of
object_error::success. In most cases, we return "success", so this patch
reduces number of function calls to that function.

http://reviews.llvm.org/D10333

llvm-svn: 239409
2015-06-09 15:20:42 +00:00
Lang Hames 1899d0c3b1 [lli] Make the OptLevel (-O=<char>) option accessible to the lazy JIT.
No test case - this only affects generated code performance.

llvm-svn: 239383
2015-06-09 02:43:27 +00:00
Davide Italiano 056decbfee [llvm-readobj] Use the new symbol API.
llvm-svn: 239286
2015-06-08 04:55:29 +00:00
Peter Collingbourne 144af17704 Do not build LLD from tools/Makefile, as LLD no longer has a Makefile build.
llvm-svn: 239283
2015-06-08 04:04:13 +00:00
Peter Collingbourne fd66a48a75 llvm-ar: Move archive writer to Object.
No functional change intended, other than some minor changes to certain
diagnostics.

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

llvm-svn: 239278
2015-06-08 02:32:01 +00:00
Colin LeMahieu 14ec76eb63 [objdump] Moving PrintImmHex out of MachODump and in to llvm-objdump and setting instprinter appropriately.
llvm-svn: 239265
2015-06-07 21:07:17 +00:00
Colin LeMahieu 229a1e69fc Teaching llvm-mc how to understand the defsym command line option. This allows integer-constant symbols to be defined on the command line and used during assembly.
llvm-svn: 239240
2015-06-07 01:46:24 +00:00
Frederic Riss 5a642079d7 [dsymutil] Add support for linking the debug_frame section.
Linking the debug frame section is actually very easy as we just have to
patch the start address in the FDE header and then copy the rest of the
FDE without even looking at it. The only small complexity comes from the
handling of the CIEs that we should unique across object file. This is
also really easy by using a StringMap keyed on the raw contents of the
CIE.

llvm-svn: 239198
2015-06-05 23:06:11 +00:00
Frederic Riss a81e88141e [dsymutil] Rename a variable to appease some bots.
Anyway having the type and the name of the member being the same
thing wasn't the wisest of the choices.

llvm-svn: 239190
2015-06-05 21:21:57 +00:00
Frederic Riss 4f5874a51f [dsymutil] Have the YAML deserialization rewrite the object address of symbols.
The main use of the YAML debug map format is for testing inside LLVM. If we have IR
files in the tests used to generate object files, then we obviously don't know the
addresses of the symbols inside the object files beforehand.

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

llvm-svn: 239189
2015-06-05 21:12:07 +00:00
Frederic Riss f37964cc41 [dsymutil] Apply clang-format. NFC
llvm-svn: 239186
2015-06-05 20:27:07 +00:00
Frederic Riss 4d0ba66869 [dsymutil] Out-line the YAML serialization code. NFC
It will get a bit bigger in an upcoming commit. No need to have all
of that in the header.

Also move parseYAMLDebugMap() to the same place as the serialization
code. This way it will be able to share a private Context object with
it.

llvm-svn: 239185
2015-06-05 20:27:04 +00:00
Frederic Riss c0866ad2c0 [dsymutil] Handle the -oso-prepend-path option when the input is a YAML debug map
All the tests using a YAML debug map will need this.

llvm-svn: 239163
2015-06-05 16:35:44 +00:00
Alexey Samsonov 50d0fbd2b9 llvm-objdump: return non-zero exit code for certain cases of invalid input
* If the input file is missing;
* If the type of input object file can't be recognized;
* If the object file can't be parsed correctly.

llvm-svn: 239065
2015-06-04 18:34:11 +00:00
Rafael Espindola 7884c95c7e Disassemble the start of sections even if there is no symbol there.
We already handled a section with no symbols, extend that to also handle a
section with symbols that don't include the section start.

llvm-svn: 239039
2015-06-04 15:01:05 +00:00
Alexey Samsonov d319c4fbbc [Object, MachO] Introduce MachOObjectFile::load_commands() range iterator.
Summary:
Now users don't have to manually deal with getFirstLoadCommandInfo() /
getNextLoadCommandInfo(), calculate the number of load segments, etc.

No functionality change.

Test Plan: regression test suite

Reviewers: rafael, lhames, loladiro

Subscribers: llvm-commits

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

llvm-svn: 238983
2015-06-03 22:19:36 +00:00
Frederic Riss 90e0bd96ff Reapply r238941 - [dsymutil] Accept a YAML debug map as input instead of a binary.
With a couple more constructors that GCC thinks are necessary.

Original commit message:

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

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

llvm-svn: 238959
2015-06-03 20:29:24 +00:00
Sanjay Patel f9d009b755 add missing dependency on Target lib for tools
This was exposed by r238842 (which was reverted by r238900)
when doing a CMake build with -DBUILD_SHARED_LIBS=ON.

llvm-svn: 238953
2015-06-03 19:07:51 +00:00
Tim Northover 5af339a1a9 RuntimeDyld: override EH frame registration with trivial version.
llvm-rtdyld was relying on the default memory manager's EH frame registration,
which is host-dependent rather than target-dependent. As a result, big-endian
ELF Mips EH frames were being registered on OS X (and elsewhere). This is a
really bad idea.

llvm-svn: 238951
2015-06-03 18:26:52 +00:00
Frederic Riss 28dbc5ab8b Revert "[dsymutil] Accept a YAML debug map as input instead of a binary."
This reverts commit r238941 while I figure out the bot issues.

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

llvm-svn: 238941
2015-06-03 16:57:16 +00:00
Frederic Riss 34238cfa24 [dsymutil] Replace -parse-only option with -dump-debug-map
As the serialized debug map is becoming a first class citizen, a way
to cleanly dump it is required. We used -parse-only combined with
-v for that purpose before, but it dumps a lot of unrelated debug
stuff. Dumping the debug map was the only use of the -parse-only flag
anyway, so replace it with a more useful option.

llvm-svn: 238940
2015-06-03 16:57:12 +00:00
Frederic Riss 9b07a8d9c9 [dsymutil] Reflow option declarations to be more readable.
llvm-svn: 238939
2015-06-03 16:57:07 +00:00
Rafael Espindola 75d5b5495f Fix the interpretation of a 0 st_name.
The ELF spec is very clear:

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

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

llvm-svn: 238899
2015-06-03 05:14:22 +00:00
Rafael Espindola 37070a5a3a Move to llvm-objdump a large amount of code to that is only used there.
llvm-svn: 238898
2015-06-03 04:48:06 +00:00
Justin Bogner 733013c631 llvm-cov: Make llvm-cov --version DTRT
In r233132 we started requiring a subcommand in llvm-cov, but this
made `llvm-cov --version` invalid, which is kind of silly. Print
version information in this case, as most people would expect.

llvm-svn: 238897
2015-06-03 02:48:09 +00:00
Rafael Espindola ac729b468c Simplify now that we always use an alignment of 2 for ELF files.
This saves 123144 bytes out of llvm-nm on powerpc64le.

llvm-svn: 238824
2015-06-02 12:05:27 +00:00
Frederic Riss f30ad9bb2a [dsymutil] Remove extraneous std::move of local in return statement.
llvm-svn: 238790
2015-06-01 22:03:05 +00:00
Frederic Riss 88ad8d2b92 [dsymutil] Remove unnecessary ';'
llvm-svn: 238783
2015-06-01 21:25:53 +00:00
Frederic Riss 08462f7859 [dsymutil] Use YAMLIO to dump debug map.
Doing so will allow us to also accept a YAML debug map in input as using
YAMLIO gives us the parsing for free. Being able to have textual debug
maps will in turn allow much more control over the tests, because 1/
no need to check-in a binary containing the debug map and 2/ it will allow
to use the same objects/IR files with made-up debug-maps to test
different scenari.

llvm-svn: 238781
2015-06-01 21:12:45 +00:00
Peter Collingbourne 3cc69d90f0 Make the C++ LTO API easier to use from C++ clients.
Start using C++ types such as StringRef and MemoryBuffer in the C++ LTO
API. In doing so, clarify the ownership of the native object file: the caller
now owns it, not the LTOCodeGenerator. The C libLTO library has been modified
to use a derived class of LTOCodeGenerator that owns the object file.

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

llvm-svn: 238776
2015-06-01 20:08:30 +00:00
Rafael Espindola 5eb02e45e3 Simplify another function that doesn't fail.
llvm-svn: 238703
2015-06-01 00:27:26 +00:00
Rafael Espindola a4d22472f3 Simplify interface of function that doesn't fail.
llvm-svn: 238700
2015-05-31 23:52:50 +00:00
Rafael Espindola a82ce1d97a For COFF and MachO, compute the gap between to symbols.
Before r238028 we used to do this in O(N^2), now we do it in O(N log N).

llvm-svn: 238698
2015-05-31 23:15:35 +00:00
Rafael Espindola da1762754b Use a range loop. NFC.
llvm-svn: 238693
2015-05-31 22:13:51 +00:00
Keno Fischer 281b6941cf Add RelocVisitor support for MachO
This commit adds partial support for MachO relocations to RelocVisitor.
A simple test case is added to show that relocations are indeed being
applied and that using llvm-dwarfdump on MachO files no longer errors.
Correctness is not yet tested, due to an unrelated bug in DebugInfo,
which will be fixed with appropriate testcase in a followup commit.

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

llvm-svn: 238663
2015-05-30 19:44:53 +00:00
Benjamin Kramer f5e2fc474d Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

llvm-svn: 238602
2015-05-29 19:43:39 +00:00
Colin LeMahieu 35436a2634 [Objdump] Removing unused parameter.
llvm-svn: 238557
2015-05-29 14:48:25 +00:00
Colin LeMahieu 68d967d92e [Hexagon] Disassembling, printing, and emitting instructions a whole-bundle at a time which is the semantic unit for Hexagon. Fixing tests to use the new format. Disabling tests in the direct object emission path for a followup patch.
llvm-svn: 238556
2015-05-29 14:44:13 +00:00
Aaron Ballman 1196ca2113 Removing a switch statement that only contains a default; NFC.
llvm-svn: 238552
2015-05-29 13:00:07 +00:00
Colin LeMahieu 0b5890d411 [llvm] Adding vdtor to fix warning.
llvm-svn: 238494
2015-05-28 20:59:08 +00:00
Colin LeMahieu fb76b007d3 [Objdump] Allow instruction pretty printing to be specialized by the target triple.
Differential Revision: http://reviews.llvm.org/D8427

llvm-svn: 238457
2015-05-28 19:07:14 +00:00
Duncan P. N. Exon Smith b04fb5ed25 AsmPrinter: Rename begin_values() => values_begin(), NFC
llvm-svn: 238456
2015-05-28 18:55:38 +00:00