Commit Graph

780 Commits

Author SHA1 Message Date
Rafael Espindola
05601d5da5 Revert "[llvm-objdump] Printing relocations in executable and shared object files. This partially reverts r215844 by removing test objdump-reloc-shared.test which stated GNU objdump doesn't print relocations, it does."
This reverts commit r263971.
It produces the wrong results for .rela.dyn. I will add a test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 20:59:15 +00:00
Colin LeMahieu
bb93856810 [llvm-objdump] Printing relocations in executable and shared object files. This partially reverts r215844 by removing test objdump-reloc-shared.test which stated GNU objdump doesn't print relocations, it does.
In executable and shared object ELF files, relocations in the file contain the final virtual address rather than section offset so this is adjusted to display section offset.

Differential revision: http://reviews.llvm.org/D15965

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263971 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 19:14:50 +00:00
Hemant Kulkarni
962167f0e2 [llvm-readobj] Impl GNU style symbols printing
Implements "readelf -sW and readelf -DsW"

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263952 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 17:18:23 +00:00
Mehdi Amini
e314781f09 Add a test for r263577: "Add missing error handling in llvm-lto"
On Rafael's suggestion!
(also fix a discrepancy between this error message format and the others)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263860 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-19 00:17:32 +00:00
Simon Atanasyan
3ceea102d5 [llvm-objdump] Move test case to the X86 sub-directory because it depends on X86 target supporting. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263781 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-18 09:52:12 +00:00
Simon Atanasyan
d79846fd6b [llvm-objdump] Add REQUIRES x86 directive to fix buildbots
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263708 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-17 11:09:21 +00:00
Simon Atanasyan
bfc21a3426 [llvm-objdump] Add '0x' prefix to a target displacement number to accent its hex format
It might be hard to recognize a hexadecimal number without '0x' prefix.
Besides that '0x' prefix corresponds to GNU objdump behaviour.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263705 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-17 10:43:44 +00:00
Hemant Kulkarni
a7904d39a8 [llvm-readobj] Impl GNU style printing of sections and relocations
Differential Revision: http://reviews.llvm.org/D17523

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 17:25:31 +00:00
David Majnemer
c5335482cf [llvm-objdump] Add support for dumping the PE TLS directory
The PE TLS directory contains information about where the TLS data
resides in the image, what functions should be executed when threads are
created, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263537 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 06:14:01 +00:00
Teresa Johnson
f2403fe5b5 [ThinLTO] Renaming of function index to module summary index (NFC)
(Resubmitting after fixing missing file issue)

With the changes in r263275, there are now more than just functions in
the summary. Completed the renaming of data structures (started in
r263275) to reflect the wider scope. In particular, changed the
FunctionIndex* data structures to ModuleIndex*, and renamed related
variables and comments. Also renamed the files to reflect the changes.

A companion clang patch will immediately succeed this patch to reflect
this renaming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263513 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-15 00:04:37 +00:00
Teresa Johnson
c37b05528e Revert "[ThinLTO] Renaming of function index to module summary index (NFC)"
This reverts commit r263490. Missed a file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263493 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-14 21:18:10 +00:00
Teresa Johnson
256128f217 [ThinLTO] Renaming of function index to module summary index (NFC)
With the changes in r263275, there are now more than just functions in
the summary. Completed the renaming of data structures (started in
r263275) to reflect the wider scope. In particular, changed the
FunctionIndex* data structures to ModuleIndex*, and renamed related
variables and comments. Also renamed the files to reflect the changes.

A companion clang patch will immediately succeed this patch to reflect
this renaming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263490 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-14 21:05:56 +00:00
Mike Aizatsky
b18a07cf76 [sancov] using md5 for anchors in attempt to reduce file size.
Differential Revision: http://reviews.llvm.org/D18102

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263308 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 23:28:28 +00:00
Teresa Johnson
dc6615addb [ThinLTO] Support for reference graph in per-module and combined summary.
Summary:
This patch adds support for including a full reference graph including
call graph edges and other GV references in the summary.

The reference graph edges can be used to make importing decisions
without materializing any source modules, can be used in the plugin
to make file staging decisions for distributed build systems, and is
expected to have other uses.

The call graph edges are recorded in each function summary in the
bitcode via a list of <CalleeValueIds, StaticCount> tuples when no PGO
data exists, or <CalleeValueId, StaticCount, ProfileCount> pairs when
there is PGO, where the ValueId can be mapped to the function GUID via
the ValueSymbolTable. In the function index in memory, the call graph
edges reference the target via the CalleeGUID instead of the
CalleeValueId.

The reference graph edges are recorded in each summary record with a
list of referenced value IDs, which can be mapped to value GUID via the
ValueSymbolTable.

Addtionally, a new summary record type is added to record references
from global variable initializers. A number of bitcode records and data
structures have been renamed to reflect the newly expanded scope of the
summary beyond functions. More cleanup will follow.

Reviewers: joker.eph, davidxl

Subscribers: joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 18:52:24 +00:00
Evgeniy Stepanov
85c673d5c9 [gold] Fix common symbols handling.
LLVM Gold plugin decides which instance of a common symbol it wants
based on the symbol size in claim_file_hook. If the file that
contains the chosen instance is later dropped from the link, we end
up with an undefined reference.

This change delays this decision until the set of the included files
is known.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11 00:51:57 +00:00
Hemant Kulkarni
e57aee0af8 [llvm-readobj] Enable GNU style section group print
Differential Revision: http://reviews.llvm.org/D17822

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263050 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-09 19:16:13 +00:00
Teresa Johnson
9bafe9607a Fix new gold test to specify emulation mode.
The thinlto_linkonceresolution.ll gold linker test introduced in r262727
included a target triple, but didn't set the emulation mode, which is
necessary since the default linker target may be different.

Patch by H.J. Lu

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262745 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 21:19:08 +00:00
Teresa Johnson
4fbd8ea38e [ThinLTO] Ensure prevailing linkonce emitted as weak in ThinLTO backends
Summary:
Since IR files are all compiled into separate independent object files
in ThinLTO mode, the prevailing linkonce symbols must be emitted in its
object file even if it is no longer referenced there, e.g. if no
references remain in the module after inlining, since it may be
referenced by another ThinLTO compiled object file. This is done by
changing LDPR_PREVAILING_DEF_IRONLY* symbols to LDPR_PREVAILING_DEF,
which converts the prevailing linkonce to weak. We also don't need the
other prevailing IRONLY handling for internalization, which is not
currently performed for ThinLTO.

Test case included.

Reviewers: davidxl, rafael

Subscribers: rafael, joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262727 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 17:48:35 +00:00
Teresa Johnson
2209e677a1 [ThinLTO] Launch importing backends in parallel threads from gold plugin
Summary:
Launch ThinLTO backends (LTO and codegen pipelines with importing) in
parallel using a ThreadPool, after creating the combined index.
The number of threads is controlled by the existing -jobs gold plugin
option, or the hardware concurrency if not specified.

The old behavior of exiting after creating the combined index can be
invoked via a new thinlto-index-only plugin option.

This commit involves just the ThinLTO-specific pieces of D15390, the NFC
and other restructuring pieces were committed independently:
  r262677: Add hardware_concurrency interface to llvm::thread (NFC)
  r262719: Change split code gen to use ThreadPool
  r262721: Refactor gold-plugin codegen to prepare for ThinLTO threads (NFC)

Reviewers: pcc, joker.eph, rafael

Subscribers: rafael, davidxl, llvm-commits, joker.eph

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262724 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-04 17:06:02 +00:00
Jacques Pienaar
e0accec873 [lanai] Add ELF enum value and relocations.
Add ELF enum value and relocations for Lanai backed.

General Lanai backend discussion on llvm-dev thread "[RFC] Lanai backend" (http://lists.llvm.org/pipermail/llvm-dev/2016-February/095118.html).

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 21:21:42 +00:00
Simon Atanasyan
b9c447406c [DebugInfo] Dump CIE augmentation data as a list of hex bytes
CIE augmentation data might contain non-printable characters.
The patch prints the data as a list of hex bytes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262361 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 18:38:05 +00:00
Petr Pavlu
3a3e8ddebb [LTO] Fix error reporting from lto_module_create_in_local_context()
Function lto_module_create_in_local_context() would previously
rely on the default LLVMContext being created for it by
LTOModule::makeLTOModule(). This context exits the program on
error and is not arranged to update sLastStringError in
tools/lto/lto.cpp.

Function lto_module_create_in_local_context() now creates an
LLVMContext by itself, sets it up correctly to its needs and then
passes it to LTOModule::createInLocalContext() which takes
ownership of the context and keeps it present for the lifetime of
the returned LTOModule.

Function LTOModule::makeLTOModule() is modified to take a
reference to LLVMContext (instead of a pointer) and no longer
creates a default context when nullptr is passed to it. Method
LTOModule::createInContext() that takes a pointer to LLVMContext
is removed because it allows to pass a nullptr to it. Instead
LTOModule::createFromBuffer() (that takes a reference to
LLVMContext) should be used.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262330 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 13:13:49 +00:00
Mike Aizatsky
4470c2730c [sancov] print_coverage_points command.
Differential Revision: http://reviews.llvm.org/D17670

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262104 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-27 02:21:44 +00:00
Paul Robinson
45648a4496 Fix tests that used CHECK-NEXT-NOT and CHECK-DAG-NOT.
FileCheck actually doesn't support combo suffixes.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 19:40:34 +00:00
David Blaikie
6802c0801c llvm-dwp: provide diagnostics for duplicate DWO IDs
These diagnostics aren't perfect - in the case of merging several dwos
into dwps and those dwps into more dwps - just getting the message about
the original source file name might not be much help (since it's the
same in both dwos, by definition - but doesn't tell you which chain of
dwps to backtrack)

It might be worth adding the DW_AT_dwo_id to the split debug info to
improve the diagnostic experience - might help track down the duplicates
better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261988 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 07:30:15 +00:00
David Blaikie
132af4d0cd llvm-dwp: Support empty .dwo files
Though a bit odd, this is handy for a few reasons - for example, in a
build system that wants consistent input/output of build steps, but
where split-dwarf might be overriden/disabled by the user on a per-file
basis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 07:04:58 +00:00
Hemant Kulkarni
70c478d920 Reverts change r261907 and r261918
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261927 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 20:47:07 +00:00
Hemant Kulkarni
ce1dab33de [llvm-readobj] Enable GNU style sections and relocations printing
http://reviews.llvm.org/D17523

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261907 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 18:02:00 +00:00
NAKAMURA Takumi
35023ef3d4 Revert r260064, "Disable llvm/test/tools/llvm-profdata/value-prof.proftext on win32 for now. Investigating."
It seems unreproducible any more for me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261842 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 08:50:26 +00:00
David Blaikie
8e4a86a83f llvm-dwp: Don't test compression when zlib isn't available
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261298 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 02:03:45 +00:00
David Blaikie
fb07a71142 llvm-dwp: Support compressed input
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 01:51:44 +00:00
David Blaikie
11dc371299 llvm-dwp: Support for type units when merging DWPs into larger DWPs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261072 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 07:00:24 +00:00
Adam Nemet
6782c499e7 Fix test from r261013
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261027 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 22:50:19 +00:00
Adam Nemet
6df4a6f175 [LTO] Support Statistics
Summary:
I thought -Xlinker -mllvm -Xlinker -stats worked at some point but maybe
it never did.

For clang, I believe that stats are printed from cc1_main.  This patch
also prints them for LTO, specifically right after codegen happens.

I only looked at the C API for LTO briefly to see if this is a good
place.  Probably there are still cases where this wouldn't be printed
but it seems to be working for the common case.  I also experimented
putting this in the LTOCodeGenerator destructor but that didn't trigger
for me because ld64 does not destroy the LTOCodeGenerator.

Reviewers: dexonsmith, joker.eph

Subscribers: rafael, joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261013 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 21:41:51 +00:00
Rafael Espindola
ed783357b0 This reverts commit r260488 and r260489.
Original messages:
    Revert "[readobj] Handle ELF files with no section table or with no program headers."
    Revert "[readobj] Dump DT_JMPREL relocations when outputting dynamic relocations."

r260489 depends on r260488 and among other issues r260488 deleted error
handling code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260962 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 14:17:48 +00:00
NAKAMURA Takumi
a8f262c12e Make llvm/test/tools/llvm-symbolizer/pdb/pdb.test Py3-compatible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260887 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-15 13:19:13 +00:00
Davide Italiano
2ad5a3cea4 [llvm-size] Make error handling uniform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260786 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-13 01:38:16 +00:00
Mike Aizatsky
4c8093a71a [sancov] improved object files handling.
Multi-dso programs result in multiple coverage files dumped of the form
'<module_name>.<pid>.sancov'. When analyzing these coverage files it is
important to use correct corresponding object file.

This change removes the "-obj" sancov flag and lets user specify object
file names alongside coverage files. Sancov tool would match them using
<module_name> part of coverage file and short file name of the object
file.

Corresponding changes:
- compiler-rt: http://reviews.llvm.org/D17171
- docs: http://reviews.llvm.org/D17175

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260628 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 00:29:07 +00:00
Michael J. Spencer
9be04e4c36 [readobj] Dump DT_JMPREL relocations when outputting dynamic relocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260489 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 04:59:53 +00:00
Michael J. Spencer
f8cdb803c2 [readobj] Handle ELF files with no section table or with no program headers.
This adds support for finding the dynamic table and dynamic symbol table via
the section table or the program header table. If there's no section table an
attempt is made to figure out the length of the dynamic symbol table.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260488 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 04:59:45 +00:00
Hemant Kulkarni
156817cf0a Make llvm-nm test consistent with other tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260464 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 23:28:43 +00:00
Xinliang David Li
7e57e07d4e Fix buildbot failure (hosts without zlib)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 22:05:41 +00:00
Teresa Johnson
0060160bcf Restore "[ThinLTO] Use MD5 hash in function index." with fix
This restores commit r260408, along with a fix for a bot failure.

The bot failure was caused by dereferencing a unique_ptr in the same
call instruction parameter list where it was passed via std::move.
Apparently due to luck this was not exposed when I built the compiler
with clang, only with gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 21:55:02 +00:00
Hemant Kulkarni
54f4d3a066 [llvm-readobj] Option to emit readelf like output
New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.llvm.org/D14128

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260430 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 20:40:55 +00:00
Xinliang David Li
feb624a121 [Coverage] add covmap v2 binary format regression test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260428 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 20:14:04 +00:00
Teresa Johnson
bc947a0d8d Revert "[ThinLTO] Use MD5 hash in function index." due to bot failure
This reverts commit r260408. Bot failure that I need to investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 19:11:15 +00:00
Teresa Johnson
f38049c501 [ThinLTO] Use MD5 hash in function index.
Summary:
This patch uses the lower 64-bits of the MD5 hash of a function name as
a GUID in the function index, instead of storing function names. Any
local functions are first given a global name by prepending the original
source file name. This is the same naming scheme and GUID used by PGO in
the indexed profile format.

This change has a couple of benefits. The primary benefit is size
reduction in the combined index file, for example 483.xalancbmk's
combined index file was reduced by around 70%. It should also result in
memory savings for the index file in memory, as the in-memory map is
also indexed by the hash instead of the string.

Second, this enables integration with indirect call promotion, since the
indirect call profile targets are recorded using the same global naming
convention and hash. This will enable the function importer to easily
locate function summaries for indirect call profile targets to enable
their import and subsequent promotion.

The original source file name is recorded in the bitcode in a new
module-level record for use in the ThinLTO backend pipeline.

Reviewers: davidxl, joker.eph

Subscribers: llvm-commits, joker.eph

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 18:57:54 +00:00
Hemant Kulkarni
dc8e8f2ccc Revert "[llvm-readobj] Option to emit readelf like output"
This reverts commit a58765909660a7195b32e0cc8c7476168b913750.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260397 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 18:21:01 +00:00
Hemant Kulkarni
d712968e30 [llvm-nm] Add -radix option
Differential Revision: http://reviews.llvm.org/D16822

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260392 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 17:51:39 +00:00
Hemant Kulkarni
fce97aeb2d [llvm-readobj] Option to emit readelf like output
New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.llvm.org/D14128

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260391 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 17:51:28 +00:00