Commit Graph

8138 Commits

Author SHA1 Message Date
Sam Clegg
3a8fe655a5 [WebAssembly] Add more support for weak symbols
Add weak symbol tests to MC
Add symbol flags to output of `llvm-readobj -t`.

Differential Revision: https://reviews.llvm.org/D34635

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306330 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 21:01:39 +00:00
Paul Robinson
fd770ea497 [DWARF] NFC: Collect info used by DWARFFormValue into a helper.
Some forms have sizes that depend on the DWARF version, DWARF format
(32/64-bit), or the size of an address.  Collect these into a struct
to simplify passing them around.  Require callers to provide one when
they query a form's size.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306315 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 18:43:01 +00:00
Zachary Turner
7226719a52 [llvm-pdbutil] Add a mode to bytes for dumping split debug chunks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306309 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 17:22:36 +00:00
Simon Pilgrim
7c16260531 [llvm-stress] Add getRandom() helper that was going to be part of D34157. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306294 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 15:41:36 +00:00
Simon Pilgrim
151f40dcea [llvm-stress] Remove Rand32 helper function
To try and help avoid repeats of PR32585, remove Rand32 which is only called by Rand64


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306285 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 13:17:36 +00:00
Simon Pilgrim
2e6fc83eac [llvm-stress] Ensure that the C++11 random device respects its min/max values (PR32585)
As noted on PR32585, the change in D29780/rL295325 resulted in calls to Rand32() (values 0 -> 0xFFFFFFFF) but the min()/max() operators indicated it would be (0 -> 0x7FFFF).

This patch changes the random operator to call Rand() instead which does respect the 0 -> 0x7FFFF range and asserts that the value is in range as well.

Differential Revision: https://reviews.llvm.org/D34089

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306281 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 10:16:34 +00:00
Tobias Grosser
5be3ca82d9 [bugpoint] Do not initialize disassembler passes
We added the initilization of disassembler passes in r306208 with the goal to
bring bugpoint in line with 'opt'. However, 'opt' does itself not initialize
dissassembler passes. As our goal was consistency, we drop the initialization
of dissassembler passes again from bugpoint.

Thanks to Chandler for pointing this out!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306275 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26 06:50:50 +00:00
Tobias Grosser
7f3bf01d63 Ensure backends available in 'opt' are also available in 'bugpoint'
This patch links LLVM back-ends into bugpoint the same way they are already
available in 'opt' and 'clang'. This resolves an inconsistency that allowed the
use of LLVM backends in loadable modules that run in 'opt', but that would
prevent the debugging of these modules with bugpoint due to unavailable /
unresolved symbols.

For e.g. In D31859, Polly requires the NVPTX back-end.

Reviewers: hfinkel, bogner, chandlerc, grosser, Meinersbur

Subscribers: bollu, mgorny, grosser, Meinersbur

Tags: #polly

Contributed by: Singapuram Sanjay

Differential Revision: https://reviews.llvm.org/D32003

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306208 cdac9f57-aa62-4fd3-8940-286f4534e8a0
2017-06-24 08:09:33 +00:00
Lang Hames
72786af0ac [ORC] Re-apply r306166 and r306168 with fix for regression test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306182 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 23:25:28 +00:00
Zachary Turner
554302ac5b [llvm-pdbutil] Dump raw bytes of module symbols and debug chunks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306179 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 23:08:57 +00:00
Rafael Espindola
51e4b46c2c This reverts commit r306166 and r306168.
Revert "[ORC] Remove redundant semicolons from DEFINE_SIMPLE_CONVERSION_FUNCTIONS uses."
Revert "[ORC] Move ORC IR layer interface from addModuleSet to addModule and fix the module type as std::shared_ptr<Module>."

They broke ExecutionEngine/OrcMCJIT/test-global-ctors.ll on linux.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306176 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 22:50:24 +00:00
Reid Kleckner
d24edfe46a [llvm-readobj] Fix COFF RVA table dumping bug
We would return an error in getVaPtr if the RVA table being dumped was
the last data in the .rdata section. Avoid the issue by subtracting one
from the offset and adding it back to get an open interval again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306171 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 22:12:11 +00:00
Zachary Turner
5d2c917523 [llvm-pdbutil] Dump raw bytes of type and id records.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306167 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 21:50:54 +00:00
Lang Hames
a5b199883c [ORC] Move ORC IR layer interface from addModuleSet to addModule and fix the
module type as std::shared_ptr<Module>.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306166 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 21:45:29 +00:00
Zachary Turner
777bbb5e05 [llvm-pdbutil] Dump raw bytes of various DBI stream subsections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306160 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 21:11:54 +00:00
Zachary Turner
055ae72128 [llvm-pdbutil] Show what blocks a stream occupies.
This is useful when you want to look at a specific chunk of a
stream or look for discontinuities, and you need to know the
list of blocks occupied by a stream.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306150 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 20:28:14 +00:00
Zachary Turner
a77c3fdb21 [llvm-pdbutil] Dump raw bytes of pdb name map.
This patch dumps the raw bytes of the pdb name map which contains
the mapping of stream name to stream index for the string table
and other reserved streams.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306148 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 20:18:38 +00:00
Zachary Turner
87f3ec22f7 [llvm-pdbutil] Add the ability to dump raw bytes from the file.
Normally we can only make sense of the content of a PDB in terms
of streams and blocks, but in some cases it may be useful to dump
bytes at a specific absolute file offset.  For example, if you
know that some interesting data is at a particular location and
you want to see some surrounding data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306146 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 19:54:44 +00:00
Zachary Turner
35abb61d54 [llvm-pdbutil] Add a function for formatting MSF data.
The goal here is to make it possible to display absolute
file offsets when dumping byets from an MSF.  The problem is
that when dumping bytes from an MSF, often the bytes will
cross a block boundary and encounter a discontinuity.  We
can't use the normal formatBinary() function for this because
this would just treat the sequence as entirely ascending, and
not account out-of-order blocks.

This patch adds a formatMsfData() function to our printer, and
then uses this function to improve the output of the -stream-data
command line option for dumping bytes from a particular stream.

Test coverage is also expanded to make sure to include all possible
scenarios of offsets, sizes, and crossing block boundaries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306141 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23 18:52:13 +00:00
Lang Hames
08ef6db991 [ORC] Switch the object layer API from addObjectSet to addObject (singular), and
move the ObjectCache from the IRCompileLayer to SimpleCompiler.

This is the first in a series of patches aimed at cleaning up and improving the
robustness and performance of the ORC APIs.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306058 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 21:06:54 +00:00
Zachary Turner
08bb54f87b [llvm-pdbutil] Create a "bytes" subcommand.
This idea originally came about when I was doing some deep
investigation of why certain bytes in a PDB that we round-tripped
differed from their original bytes in the source PDB.  I found
myself having to hack up the code in many places to dump the
bytes of this substream, or that record.  It would be nice if
we could just do this for every possible stream, substream,
debug chunk type, etc.

It doesn't make sense to put this under dump because there's just
so many options that would detract from the more common use case
of just dumping deserialized records.  So making a new subcommand
seems like the most logical course of action.  In doing so, we
already have two command line options that are suitable for this
new subcommand, so start out by moving them there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306056 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 20:58:11 +00:00
Zachary Turner
0895032e6e [llvm-pdbutil] Rename "raw" to "dump".
Now you run llvm-pdbutil dump <options>.  This is a followup
after having renamed the tool, whereas before raw was obviously
just the style of dumping, whereas now "dump" is the action to
perform with the "util".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306055 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 20:57:39 +00:00
Kevin Enderby
bf84e2cbee Updated llvm-objdump for arm64 Mach-O MH_KEXT_BUNDLE file types so
it symbolically disassembles the __text section from the
__TEXT_EXEC segment not the usual __TEXT segment by default.

rdar://30590208


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306046 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 19:50:56 +00:00
Kevin Enderby
96e8b4cb36 Updated llvm-objdump symbolic disassembly with x86_64 Mach-O MH_KEXT_BUNDLE
file types so it symbolically disassembles operands using the external
relocation entries.

rdar://31521343


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306037 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 17:41:22 +00:00
Reid Kleckner
367f21dc72 [llvm-readobj] Dump the COFF image load config
This includes the safe SEH tables and the control flow guard function
table. LLD will emit the guard table soon, and I need a tool that dumps
them for testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305979 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-22 01:10:29 +00:00
David Blaikie
833be198cd ClangFormat some changes from r305226
Post commit review feedback from Justin Bogner

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305919 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-21 15:20:46 +00:00
Kevin Enderby
f8a3ad7e76 Updated llvm-objdump with Mach-O files and the -objc-meta-data option so
that it symbolically prints the superclass when it has dyld bind info for it.

rdar://7638823


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305866 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 22:55:11 +00:00
Kevin Enderby
21b864cd12 Change llvm-objdump with Mach-O files and the -info-plist option with the
-no-leading-headers option so that it does not print the leading header.

rdar://27378808


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305849 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 21:00:25 +00:00
Zachary Turner
d6d2feb9a7 Remove diff pedantic mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305818 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 18:50:30 +00:00
Yuka Takahashi
bc5df29fed [GSoC] Flag value completion for clang
This is patch for GSoC project, bash-completion for clang.

To use this on bash, please run `source clang/utils/bash-autocomplete.sh`.
bash-autocomplete.sh is code for bash-completion.

In this patch, Options.td was mainly changed in order to add value class
in Options.inc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305805 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 16:31:31 +00:00
Sam Clegg
1e975c1249 [WebAssembly] Add support for weak symbols in the binary format
This also introduces the updated format for the
"linking" section which can represent extra
symbol information.  See:
https://github.com/WebAssembly/tool-conventions/pull/10

Differential Revision: https://reviews.llvm.org/D34019

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 04:04:59 +00:00
Vedant Kumar
b9454635c0 [ProfileData] PR33517: Check for failure of symtab creation
With PR33517, it became apparent that symbol table creation can fail
when presented with malformed inputs. This patch makes that sort of
error detectable, so llvm-cov etc. can fail more gracefully.

Specifically, we now check that function names within the symbol table
aren't empty.

Testing: check-{llvm,clang,profile}, some unit test updates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305765 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 01:38:56 +00:00
Kevin Enderby
eaf57f3d1d The change to llvm-nm in r305733 added fields to the struct NMSymbol
that are not set on the main path.  This diff does a memset to 0 the structs
so this change is to hopefully fix the sanitizer-x86_64-linux-fast bot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305762 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 00:41:04 +00:00
Eugene Zelenko
b96297306a [ExecutionEngine] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305760 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19 23:37:52 +00:00
Kevin Enderby
60eaf2356c Fix a FIXME in llvm-objdump for the -exports-trie option that was not adding
in the base address.

Without this Mach-O files, like 64-bit executables, don’t have the correct
addresses printed for their exports.  As the default is to link at address
0x100000000 not zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305744 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19 21:23:07 +00:00
Kevin Enderby
3fe8da4e8c Change llvm-nm for Mach-O files to use dyld info in some cases when printing symbols.
In order to reduce swift binary sizes, Apple is now stripping swift symbols
from the nlist symbol table.  llvm-nm currently only looks at the nlist symbol
table and misses symbols that are present in dyld info.   This makes it hard to
know the set of symbols for a binary using just llvm-nm.  Unless you know to
run llvm-objdump -exports-trie that can output the exported symbols in the dyld
info from the export trie, which does so but in a different format.

Also moving forward the time may come a when a fully linked Mach-O file that
uses dyld will no longer have an nlist symbol table to avoid duplicating the
symbol information.

This change adds three flags to llvm-nm, -add-dyldinfo, -no-dyldinfo, and
-dyldinfo-only.

The first, -add-dyldinfo, has the same effect as when the new bit in the Mach-O
header, MH_NLIST_OUTOFSYNC_WITH_DYLDINFO, appears in a binary.  In that it
looks through the dyld info from the export trie and adds symbols to be printed
that are not already in its internal SymbolList variable.  The -no-dyldinfo
option turns this behavior off.

The -dyldinfo-only option only looks at the dyld information and recreates the
symbol table from the dyld info from the export trie and binding information.
As if it the Mach-O file had no nlist symbol table.

Also fixed a few bugs with Mach-O N_INDR symbols not correctly printing the
indirect name, or in the same format as the old nm-classic program.

rdar://32021551


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305733 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19 19:38:22 +00:00
Eric Beckmann
b741c53806 Have writeCOFFWriter return Expected<unique_ptr>.
Summary: Have writeCOFFWriter return Expected<unique_ptr> instead of requiring being passed an uninitialized unique_ptr.

Reviewers: zturner, ruiu

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D34307

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305730 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19 18:49:05 +00:00
Reid Kleckner
e075b10f6b [CodeView] Fix dumping of public symbol record flags
I noticed nonsensical type information while dumping PDBs produced by
MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305708 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19 16:54:51 +00:00
Zachary Turner
d8c55ee753 Delete TypeDatabase.
Merge the functionality into the random access type collection.
This class was only being used in 2 places, so getting rid of it
simplifies the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305653 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-18 20:52:45 +00:00
Zachary Turner
bd5fe95fd2 Remove some dead code / includes.
I'm trying to get rid of the TypeDatabase class, so the first
step is to minimize its footprint.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305611 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 23:42:15 +00:00
Sam Clegg
b856c16f91 obj2yaml: Improve error reporting
Previously only the error codes were reported which
meant that useful information about malformed inputs
was not shown.

Differential Revision: https://reviews.llvm.org/D34008

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305609 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 23:29:54 +00:00
Eric Beckmann
51c5f771ec Clean up some things in the WindowsResource changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305596 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 22:00:42 +00:00
Eric Beckmann
c501cd4b20 Switch external cvtres.exe for llvm's own resource library.
In this patch, I flip the switch in DriverUtils from using the external
cvtres.exe tool to using the Windows Resource library in llvm.

I also fixed a bug where .rsrc sections were marked as discardable
memory and therefore were placed in the wrong order in the final PE.

Furthermore, I modified WindowsResource to write the coff directly to a
memory buffer instead of to file, also had it use the machine types
already declared in COFF.h instead creating my own enum.

Finally, I flipped the switch to allow all unit tests that had
previously run only on windows due to a winres dependency to run
cross-platform.

Reviewers: zturner, ruiu

Subscribers: llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D34265

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305592 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 21:13:24 +00:00
Evgeniy Stepanov
3184f8d7bb [cfi] CFI-ICall for ThinLTO.
Implement ControlFlowIntegrity for indirect function calls in ThinLTO.
Design follows the RFC in llvm-dev, see
https://groups.google.com/d/msg/llvm-dev/MgUlaphu4Qc/kywu0AqjAQAJ

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305533 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 00:18:29 +00:00
Zachary Turner
68e216b09a [llvm-pdbutil] Add support for dumping cross module imports/exports.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 00:04:24 +00:00
Zachary Turner
f391f226bc [llvm-pdbutil] Add a function for iterating over debug subsections.
NFC, just adds a helper function to reduce boilerplate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:59:56 +00:00
Zachary Turner
7b1eb002e9 [llvm-pdbutil] Add support for dumping lines and inlinee lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305529 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:56:19 +00:00
Zachary Turner
ae75a98ae9 Try to fix uninitialized read reported by msan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305528 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:44:19 +00:00
Zachary Turner
e6f0d3c25c [llvm-pdbutil] Add back support for dumping file checksums.
When dumping module source files, also dump checksums.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305526 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:12:41 +00:00
Zachary Turner
4d56b5f5fd [llvm-pdbutil] Add back the ability to dump hashes and index offsets.
This was regressed in a previous patch that re-wrote the dumper,
and I'm incrementally adding back the pieces that are missing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305524 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:04:42 +00:00