8459 Commits

Author SHA1 Message Date
Alexander Richardson
229871c696 [obj2yaml] Don't crash for input files without symbol table
Summary: Previously we would dereference Symtab without checking for null.

Reviewers: davide, atanasyan, rafael

Reviewed By: davide, atanasyan

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313970 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22 09:30:40 +00:00
Jonas Devlieghere
7080e068b5 [dwarfdump] Add support for redirecting output to a file
This patch adds the -o and --out-file options for compatibility with
Darwin's dwarfdump.

Differential revision: https://reviews.llvm.org/D38125

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313969 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22 09:20:57 +00:00
Rafael Espindola
203c90ba80 Convert the archive writer to use Error.
This found one place in lld that was not checking the error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313937 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 23:13:36 +00:00
Kevin Enderby
4d7a2deb50 Fix a bug in llvm-objdump when disassembling using the wrong default CPU
in the second slice of a Mach-O universal file.

The code in llvm-objdump in in DisassembleMachO() was getting the default
CPU then incorrectly setting into the global variable used for the -mcpu option
if that was not set.  This caused a second call to DisassembleMachO() to use
the wrong default CPU when disassembling the next slice in a Mach-O universal
file.  And would result in bad disassembly and an error message about an
recognized processor for the target:

% llvm-objdump -d -m -arch all  fat.macho-armv7s-arm64 
fat.macho-armv7s-arm64 (architecture armv7s):
(__TEXT,__text) section
armv7:
       0:	60 47 	bx	r12
fat.macho-armv7s-arm64 (architecture arm64):
'cortex-a7' is not a recognized processor for this target (ignoring processor)
'cortex-a7' is not a recognized processor for this target (ignoring processor)
(__TEXT,__text) section
___multc3:
       0:		.long	0x1e620810

rdar://34439149


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313921 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 21:45:02 +00:00
Marek Sokolowski
1481a4e7b6 [llvm-readobj] Fix big-endian byte swap in WindowsResourceDumper.
The previous version of dumper implemented UTF-16 byte swap incorrectly
on big-endian machines. This now gets fixed.

Thanks to Bill Seurer for testing the patch locally.

Differential Review: https://reviews.llvm.org/D38150

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313912 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 20:36:38 +00:00
Adrian Prantl
ab669421b2 llvm-dwarfdump: Add support for the --arch command line option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313888 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 16:26:18 +00:00
Benjamin Kramer
3ef466f15f Add missing file from r313884.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 15:32:05 +00:00
Jonas Devlieghere
28b2d0c96f [dsymutil] Don't resolve DIE reference to NULL DIE.
This patch prevents dsymutil from resolving a reference to a NULL DIE
when a bogus reference happens to be coincidentally referencing a NULL
DIE. Now this is detected as an invalid reference and a warning is
printed.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=33873

Differential revision: https://reviews.llvm.org/D38078

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 10:28:33 +00:00
Vedant Kumar
3d39fc2624 [llvm-cov] Improve error messaging for function mismatches
Passing "-dump" to llvm-cov will now print more detailed information
about function hash and counter mismatches. This should make it easier
to debug *.profdata files which contain incorrect records, and to debug
other scenarios where coverage goes missing due to mismatch issues.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313853 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21 01:11:30 +00:00
Adrian Prantl
ff00c9c5ca llvm-dwarfdump: move -eh-frame into the right section in the help output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313836 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 23:29:31 +00:00
Marek Sokolowski
166760504d [llvm-readobj] Fix 'Teach readobj to dump .res files', pt 3.
Fix (r313790) missing ulittle{}_t error on some buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313834 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 23:26:05 +00:00
Marek Sokolowski
bf41ef78ca [llvm-readobj] Fix 'Teach readobj to dump .res files', pt 2.
Another fix-up for r313790. Big-endian hosts swapped byte order in
UTF16 words.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 23:07:39 +00:00
Sam Clegg
b1dd7d6140 [WebAssembly] Add support for local symbol bindings
Differential Revision: https://reviews.llvm.org/D38096

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313817 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 21:17:04 +00:00
Marek Sokolowski
a656eb8f18 [llvm-readobj] Fix 'Teach readobj to dump .res files'.
Fix-up for r313790. Some buildbots couldn't convert size_t to
uint{}_t; do it manually.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313816 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 21:03:37 +00:00
Vlad Tsyrklevich
bbb3280706 Introduce the llvm-cfi-verify tool (resubmission of D37937).
Summary: Resubmission of D37937. Fixed i386 target building (conversion from std::size_t& to uint64_t& failed). Fixed documentation warning failure about docs/CFIVerify.rst not being in the tree.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Patch by Mitch Phillips

Subscribers: sbc100, mgorny, pcc, llvm-commits, kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313809 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 20:38:14 +00:00
Vlad Tsyrklevich
d3762c4675 Revert "Introduce the llvm-cfi-verify tool (resubmission of D37937)."
This reverts commit r313798, it's causing buildbot failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 19:46:02 +00:00
Vlad Tsyrklevich
db99a99806 Introduce the llvm-cfi-verify tool (resubmission of D37937).
Summary: Resubmission of D37937. Fixed i386 target building (conversion from std::size_t& to uint64_t& failed). Fixed documentation warning failure about docs/CFIVerify.rst not being in the tree.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Patch by Mitch Phillips

Subscribers: mgorny, pcc, llvm-commits, kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313798 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 19:14:16 +00:00
Sam Clegg
81e3824428 Reland "[WebAssembly] Add support for naming wasm data segments"
Add adds support for naming data segments.  This is useful
useful linkers so that they can merge similar sections.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 19:03:35 +00:00
Marek Sokolowski
96bd9232ef [llvm-readobj] Teach readobj to dump .res files (WindowsResource).
This enables readobj to output Windows resource files (.res). This way,
we'll be able to test .res outputs without comparing them byte-by-byte
with "magic binary files" generated by MS toolchain.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313790 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 18:33:35 +00:00
Adrian Prantl
ae599aa1b4 llvm-dwarfdump: implement --recurse-depth=<N>
This patch implements the Darwin dwarfdump option --recurse-depth=<N>,
which limits the recursion depth when selectively printing DIEs at an
offset.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313778 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 17:44:00 +00:00
Jake Ehrlich
3028b9dc74 Reland "[llvm-objcopy] Add support for .dynamic, .dynsym, and .dynstr"
I overzealously landed this before I was sure that another change
wouldn't break the build that this change depends on.

This change adds support for sections involved in dynamic loading such
as SHT_DYNAMIC, SHT_DYNSYM, and allocated string tables.

The two added binaries used for tests can be downloaded here and here

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313767 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 17:11:58 +00:00
Mike Edwards
097fb8c422 Reverting due to Green Dragon bot failure.
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/42594/


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313706 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20 01:21:02 +00:00
Sam Clegg
e5c43345fb [WebAssembly] Add support for naming wasm data segments
Add adds support for naming data segments.  This is useful
useful linkers so that they can merge similar sections.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313692 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 23:00:57 +00:00
Vlad Tsyrklevich
bc1a94aae1 Revert "Introduce the llvm-cfi-verify tool."
This reverts commit r313688, it caused build failures for
llvm-i686-linux-RA

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313689 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 22:36:32 +00:00
Vlad Tsyrklevich
b3521af5ae Introduce the llvm-cfi-verify tool.
Summary: Introduces the llvm-cfi-verify tool to llvm. Includes the design document (docs/CFIVerify.rst). Current implementation of the tool is simply a disassembler that identifies and prints the indirect control flow instructions.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Patch by Mitch Phillips

Subscribers: llvm-commits, kcc, pcc, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313688 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 22:33:09 +00:00
Jake Ehrlich
7098693fab Reland "[llvm-objcopy] Add support for nested and overlapping segments"
I didn't initialize a pointer to be nullptr that I needed to.

This change adds support for nested and even overlapping segments. This means
that PT_PHDR, PT_GNU_RELRO, PT_TLS, and PT_DYNAMIC can be supported properly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313682 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 21:37:35 +00:00
Adrian Prantl
fd65d0d80e llvm-dwarfdump: un-hide more command line options
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 20:58:57 +00:00
Jake Ehrlich
4ac8c2f5ab Revert "[llvm-objcopy] Add support for .dynamic, .dynsym, and .dynstr"
This reverts commit r313663. Broken because overlapping-sections was
reverted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313665 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 20:00:04 +00:00
Jake Ehrlich
9957e3f78d Revert "[llvm-objcopy] Add support for nested and overlapping segments"
This reverts commit r313656. Appears to be broken on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313664 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 19:52:09 +00:00
Jake Ehrlich
f5c04b04ae [llvm-objcopy] Add support for .dynamic, .dynsym, and .dynstr
This change adds support for sections involved in dynamic loading such
as SHT_DYNAMIC, SHT_DYNSYM, and allocated string tables.

The two added binaries used for tests can be downloaded [[
https://drive.google.com/file/d/0B3gtIAmiMwZXOXE3T0RobFg4ZTg/view?usp=sharing
| here ]] and [[
https://drive.google.com/file/d/0B3gtIAmiMwZXTFJSQUJZMGxNSXc/view?usp=sharing
| here ]]

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313663 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 19:21:09 +00:00
Jake Ehrlich
46f29ab959 [llvm-objcopy] Add support for nested and overlapping segments
This change adds support for nested and even overlapping segments. This means
that PT_PHDR, PT_GNU_RELRO, PT_TLS, and PT_DYNAMIC can be supported properly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313656 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 18:14:03 +00:00
Vlad Tsyrklevich
b261c46c08 Allow public Triple deduction from ObjectFiles.
Move logic that allows for Triple deduction from an ObjectFile object
out of llvm-objdump.cpp into a public factory, found in the ObjectFile
class.

This should allow other tools in the future to use this logic without
reimplementation.

Patch by Mitch Phillips

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313605 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 02:22:48 +00:00
Vedant Kumar
1ef0d5a130 [llvm-cov] Make report metrics agree with line exec counts, fixes PR34615
Use the same logic as the line-oriented coverage view to determine the
number of covered lines in a function.

Fixes llvm.org/PR34615.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313604 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-19 02:00:12 +00:00
Vedant Kumar
7c57f171e2 [Coverage] Use gap regions to select better line exec counts
After clang started emitting deferred regions (r312818), llvm-cov has
had a hard time picking reasonable line execuction counts. There have
been one or two generic improvements in this area (e.g r310012), but
line counts can still report coverage for whitespace instead of code
(llvm.org/PR34612).

To fix the problem:

 * Introduce a new region kind so that frontends can explicitly label
   gap areas.

   This is done by changing the encoding of the columnEnd field of
   MappingRegion. This doesn't substantially increase binary size, and
   makes it easy to maintain backwards-compatibility.

 * Don't set the line count to a count from a gap area, unless the count
   comes from a wrapped segment.

 * Don't highlight gap areas as uncovered.

Fixes llvm.org/PR34612.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313597 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18 23:37:28 +00:00
Vedant Kumar
2fbca6bfae [llvm-cov] Simplify code to find the first uncovered segment. NFC.
Now that that segment builder is guaranteed to produce segments in
sorted order, we don't need a linear scan to get the right result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313595 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18 23:37:27 +00:00
Yi Kong
74ae606cb2 [ThinLTO/gold] Implement ThinLTO cache pruning support
Differential Revision: https://reviews.llvm.org/D37993

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313592 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18 23:24:55 +00:00
Adrian Prantl
47842dcdbe Replace for_each with a range-based for. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313578 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18 22:11:33 +00:00
Adrian Prantl
8233b30822 llvm-dwarfdump: add a --show-parents options when selectively dumping DIEs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313567 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18 21:27:44 +00:00
Jonas Devlieghere
6ad4356f4d [dwarfdump] Make .eh_frame an alias for .debug_frame
This patch makes the `.eh_frame` extension an alias for `.debug_frame`.
Up till now it was only possible to dump the section using objdump, but
not with dwarfdump. Since the two are essentially interchangeable, we
dump whichever of the two is present.

As a workaround, this patch also adds parsing for 3 currently
unimplemented CFA instructions: `DW_CFA_def_cfa_expression`,
`DW_CFA_expression`, and `DW_CFA_val_expression`. Because I lack the
required knowledge, I just parse the fields without actually creating
the instructions.

Finally, this also fixes the typo in the `.debug_frame` section name
which incorrectly contained a trailing `s`.

Differential revision: https://reviews.llvm.org/D37852

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313530 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18 14:15:57 +00:00
Dean Michael Berris
d6aeff8fd7 [XRay][tools] Support tail-call exits before we write them in the runtime
Summary:
This change adds support for explicit tail-exit records to be written by
the XRay runtime. This lets us differentiate the tail exit
records/events in the log, and allows us to treat those exit events
especially in the future. For now we allow printing those out in YAML
(and reading them in).

Reviewers: kpw, pelikan

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313514 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18 06:08:46 +00:00
Adrian Prantl
d4e3753582 llvm-dwarfdump: support a --show-children option
This will print all children of a DIE when selectively printing only
one DIE at a given offset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16 17:28:00 +00:00
George Rimar
295be907d4 [llvm-readobj] - Teach tool to report error if some section is in multiple COMDAT groups at once.
readelf tool reports an error when output contains the same section
in multiple COMDAT groups. That can be useful.
Path teaches llvm-readobj to do the same.

Differential revision: https://reviews.llvm.org/D37567

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313459 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16 14:29:51 +00:00
Vedant Kumar
5ace25b788 [llvm-cov] Fix a bot failure due to r313417
There's a type mismatch issue with the arguments to a call to std::min
introduced in r313417.

http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/11174

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313422 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 23:14:22 +00:00
Adrian Prantl
b311e92f13 llvm-dwarfdump: Add support for -debug-info=<offset>.
This is the first of many commits that enable selectively dumping just
one record from the debug info.

This reapplies r313412 with some extra qualification to appease GCC and MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313419 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 23:04:04 +00:00
Vedant Kumar
310c280673 [llvm-cov] Avoid over-counting covered lines and regions
* Fix an unsigned integer overflow in the logic that computes the
  number of uncovered lines in a function.

* When aggregating region and line coverage summaries, take into account
  that different instantiations may have a different number of regions.

The new test case provides test coverage for both bugs. I also verified
this change by preparing a coverage report for a stage2 build of llc --
the new assertions should detect any outstanding over-counting bugs.

Fixes PR34613.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313417 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 23:00:02 +00:00
Vedant Kumar
c94f3924be [llvm-cov] Make some summary info fields private. NFC.
There's a bug in the way the line and region summary objects are merged.
It would have been less likely to occur if those objects kept some data
private.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313416 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 23:00:01 +00:00
Vedant Kumar
9f82f26257 [llvm-cov] Remove a redundant field. NFC.
The "NotCovered" fields in the region and line summary structs are
redundant. We should remove them to make the code clearer.

As a follow-up, the "NotCovered" entries should be removed from the
reports as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313415 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 23:00:00 +00:00
Adrian Prantl
ba583516b4 Revert "llvm-dwarfdump: Add support for -debug-info=<offset>."
This reverts commit r313412 because of a g++ incompatibility.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313413 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 22:47:16 +00:00
Adrian Prantl
e11a1f2d13 llvm-dwarfdump: Add support for -debug-info=<offset>.
This is the first of many commits that enable selectively dumping just
one record from the debug info.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313412 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 22:37:56 +00:00
Jake Ehrlich
54405fff49 Test patch to check my commit access
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313404 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 22:04:09 +00:00