Commit Graph

5849 Commits

Author SHA1 Message Date
Daniel Sanders
7f5b833aa3 Replace string GNU Triples with llvm::Triple in TargetMachine::getTargetTriple(). NFC.
Summary:
This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: llvm-commits, rengolin

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239815 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 13:15:50 +00:00
Daniel Sanders
0987211e24 Recommit r239721: Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.
Summary:
This affects other tools so the previous C++ API has been retained as a
deprecated function for the moment. Clang has been updated with a trivial
patch (not covered by the pre-commit review) to avoid breaking -Werror builds.
Other in-tree tools will be fixed with similar patches.

This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

The first time this was committed it accidentally fixed an inconsistency in
triples in llvm-mc and this caused a failure. This inconsistency was fixed in
r239808.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: llvm-commits, rengolin

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239812 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 12:18:07 +00:00
Daniel Sanders
a8cc053519 [llvm-mc] The object form of the GNU triple should be the same as the string form.
Summary:
GetTarget() may modify TripleName without also updating TheTriple.
This can lead to situations where the MCObjectStreamer has a different triple
to the rest of LLVM.

This inconsistency caused sparc-little-endian.s to pass on Windows because most
of LLVM had sparcel-pc-win32 while MCObjectStreamer had "". I believe the same
kind of thing was also true of Darwin.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: llvm-commits, rengolin, rafael

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239808 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 09:57:38 +00:00
Duncan P. N. Exon Smith
4aee54eb95 modules: Move ProfileKinds to an anonymous namespace
Fix a build failure with `LLVM_ENABLE_MODULES` due to
`ProfileData::instr` conflicting with a function `instr()` in
`<curses.h>`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239793 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-16 00:43:04 +00:00
Alex Lorenz
a15d888abf MIR Serialization: Connect the machine function analysis pass to the MIR parser.
This commit connects the machine function analysis pass (which creates machine
functions) to the MIR parser, which will initialize the machine functions 
with the state from the MIR file and reconstruct the machine IR.

This commit introduces a new interface called 'MachineFunctionInitializer',
which can be used to provide custom initialization for the machine functions.

This commit also introduces a new diagnostic class called 
'DiagnosticInfoMIRParser' which is used for MIR parsing errors.
This commit modifies the default diagnostic handling in LLVMContext - now the
the diagnostics are printed directly into llvm::errs() so that the MIR parsing 
errors can be printed with colours.  

Reviewers: Justin Bogner

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239753 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 20:30:22 +00:00
Rafael Espindola
99e760ad9e gold-plugin: save the .o when given -save-temps.
The plugin now save the bitcode before and after optimizations and the
.o that is passed to the linker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239726 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 13:36:27 +00:00
Daniel Sanders
ad0b09d10e Revert r239721 - Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.
It appears to cause sparc-little-endian.s to assert on Windows and Darwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239724 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 10:34:38 +00:00
Daniel Sanders
4a867c7a05 Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.
Summary:
This affects other tools so the previous C++ API has been retained as a
deprecated function for the moment. Clang has been updated with a trivial
patch (not covered by the pre-commit review) to avoid breaking -Werror builds.
Other in-tree tools will be fixed with similar trivial patches.

This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: llvm-commits, rengolin

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239721 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 09:19:41 +00:00
Lang Hames
69fb65b52e [Orc] Tidy up initialization based on review feedback for r239561 from dblaikie.
NFC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239645 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-12 23:13:06 +00:00
Lang Hames
fe8e55cbc0 [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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239640 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-12 21:31:15 +00:00
Douglas Katzman
f52f043d3e 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239632 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-12 18:44:57 +00:00
Rafael Espindola
18dd79c396 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239618 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-12 17:23:39 +00:00
Lang Hames
5182687026 [Orc] Remove some unnecesary includes and whitespace that slipped in to r239561.
NFC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239564 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 22:12:24 +00:00
Lang Hames
2e960cb2c4 [Orc] Make partition identification in the CompileOnDemand layer lazy.
This also breaks out the logical dylib symbol resolution logic.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239561 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-11 21:45:19 +00:00
Peter Collingbourne
1d815cac84 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239434 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 21:50:22 +00:00
Rui Ueyama
eae4673c2f 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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239409 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 15:20:42 +00:00
Lang Hames
657c697363 [lli] Make the OptLevel (-O=<char>) option accessible to the lazy JIT.
No test case - this only affects generated code performance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239383 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-09 02:43:27 +00:00
Davide Italiano
f57b36041b [llvm-readobj] Use the new symbol API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239286 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 04:55:29 +00:00
Peter Collingbourne
965c107356 Do not build LLD from tools/Makefile, as LLD no longer has a Makefile build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239283 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 04:04:13 +00:00
Peter Collingbourne
ee2e3d0eb9 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239278 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-08 02:32:01 +00:00
Colin LeMahieu
8cc8dbc062 [objdump] Moving PrintImmHex out of MachODump and in to llvm-objdump and setting instprinter appropriately.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239265 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 21:07:17 +00:00
Colin LeMahieu
4514db2bfb 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239240 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-07 01:46:24 +00:00
Frederic Riss
9ccf07fb89 [dsymutil] Add support for linking the debug_frame section.
Linking the debug frame section is actually very easy as we just have to
patch the start address in the FDE header and then copy the rest of the
FDE without even looking at it. The only small complexity comes from the
handling of the CIEs that we should unique across object file. This is
also really easy by using a StringMap keyed on the raw contents of the
CIE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239198 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 23:06:11 +00:00
Frederic Riss
7bef4c48d6 [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.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239189 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 21:12:07 +00:00
Frederic Riss
0f58c38ebd [dsymutil] Apply clang-format. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239186 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-05 20:27:07 +00:00
Frederic Riss
527bb619d1 [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.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 18:34:11 +00:00
Rafael Espindola
45edf27ed7 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239039 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 15:01:05 +00:00
Alexey Samsonov
40ec40a179 [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

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

Original commit message:

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238959 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 20:29:24 +00:00
Sanjay Patel
5d42ddcd1e 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238953 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 19:07:51 +00:00
Tim Northover
6da0e02282 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.

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

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238940 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 16:57:12 +00:00
Frederic Riss
7953382dce [dsymutil] Reflow option declarations to be more readable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238939 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 16:57:07 +00:00
Rafael Espindola
201a551929 Fix the interpretation of a 0 st_name.
The ELF spec is very clear:

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 05:14:22 +00:00
Rafael Espindola
8c7a0fd91a Move to llvm-objdump a large amount of code to that is only used there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238898 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 04:48:06 +00:00
Justin Bogner
cbf5311a34 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238897 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 02:48:09 +00:00
Rafael Espindola
9751e35f20 Simplify now that we always use an alignment of 2 for ELF files.
This saves 123144 bytes out of llvm-nm on powerpc64le.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238781 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 21:12:45 +00:00
Peter Collingbourne
3fcf5a99cb 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238776 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 20:08:30 +00:00
Rafael Espindola
481f35f113 Simplify another function that doesn't fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 00:27:26 +00:00
Rafael Espindola
64afb8375d Simplify interface of function that doesn't fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238700 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-31 23:52:50 +00:00
Rafael Espindola
f8f9476a1b 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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238698 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-31 23:15:35 +00:00
Rafael Espindola
67635abeaf Use a range loop. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238693 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-31 22:13:51 +00:00