1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

8616 Commits

Author SHA1 Message Date
NAKAMURA Takumi
c59f1ab92f Untabify.
llvm-svn: 316079
2017-10-18 13:31:28 +00:00
Vlad Tsyrklevich
5114906064 Statically link llvm-cfi-verify's libraries.
Summary:
llvm-cfi-verify (D38379) introduced a potential build failure when compiling with `-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON`. Specific versions of cmake seem to treat the `add_subdirectory()` rule differently. It seems as if old versions of cmake BFS these rules, adding them to the fringe for expansion later. Newer versions of cmake seem to immediately execute CMakeFiles that are present in this subdirectory.

If the subdirectory is expanded through the fringe, the globbing resultant from `llvm_add_implicit_projects()` from `cmake/modules/AddLLVM.cmake:1012` means that `tools/llvm-shlib/CMakeFile.txt` gets executed before `tools/llvm-cfi-verify/lib/CMakeFile.txt`. As the latter CMakeFile adds a new library, this expansion order means that the library files required the unit tests in `unittests/tools/llvm-cfi-verify/` are not present in the dynamic library. This causes unit tests to fail as the required functions can't be found.

This change now ensures that the libraries created by `llvm-cfi-verify` are statically linked into the unit tests. As `tools/llvm-cfi-verify/lib` no longer adds anything to `llvm-shlib`, there should be no concern about the order-of-compilation.

Reviewers: skatkov, pcc

Reviewed By: skatkov, pcc

Subscribers: llvm-commits, kcc, pcc, aheejin, vlad.tsyrklevich, mgorny

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

llvm-svn: 316059
2017-10-18 04:27:53 +00:00
Matt Morehouse
7bcc85d9c5 [llvm-special-case-list-fuzzer] Add fuzz target.
Summary: Create a fuzzer for sanitizer blacklists.

Patch by: hctim

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: llvm-commits, mgorny, kcc

Differential Revision: https://review.llvm.org/D38981

llvm-svn: 316014
2017-10-17 17:43:34 +00:00
Vedant Kumar
200728ffcb [llvm-cov] Add one correction to r315960 (PR34962)
In r315960, I accidentally assumed that the first line segment is
guaranteed to be the non-gap region entry segment (given that one is
present). It can actually be any segment on the line, and the test I
checked in demonstrates that.

llvm-svn: 315963
2017-10-17 01:34:41 +00:00
Vedant Kumar
10feee95ac [llvm-cov] Remove workaround in line execution count calculation (PR34962)
Gap areas make it possible to correctly determine when to use counts
from deferred regions. Before gap areas were introduced, llvm-cov needed
to use a heuristic to do this: it ignored counts from segments that
start, but do not end, on a line. This heuristic breaks down on a simple
example (see PR34962).

This patch removes the heuristic and picks counts from any region entry
segment which isn't a gap area.

llvm-svn: 315960
2017-10-16 23:47:10 +00:00
Kostya Serebryany
8b8004661c fix llvm-isel-fuzzer: LLVMFuzzerTestOneInput should never return non-zero (according to the contract)
llvm-svn: 315933
2017-10-16 20:36:57 +00:00
Konstantin Zhuravlyov
eadde56dfb llvm-readobj: Print AMDGPU note contents
Differential Revision: https://reviews.llvm.org/D38752

llvm-svn: 315819
2017-10-14 18:21:42 +00:00
Konstantin Zhuravlyov
5c29c88b1d llvm-readobj: Print AMDGPU note type names
Differential Revision: https://reviews.llvm.org/D38751

llvm-svn: 315813
2017-10-14 16:43:46 +00:00
Vedant Kumar
e010115612 [llvm-cov] Factor out logic to iterate over line coverage stats (NFC)
There were two copies of the logic needed to construct a line stats
object for each line in a range: this patch brings it down to one. In
the future, this will make it easier for IDE clients to display coverage
in-line in source editors. To do that, we just need to move the new
LineCoverageIterator class to libCoverage.

llvm-svn: 315789
2017-10-14 02:27:29 +00:00
Matt Morehouse
5a545d0e4d [llvm-demangle-fuzzer] Add a fuzz target for ItaniumDemangler.
Patch By: hctim

Reviewers: morehouse, bogner

Reviewed By: bogner

Subscribers: bogner, kcc, llvm-commits, mgorny

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

llvm-svn: 315716
2017-10-13 17:35:37 +00:00
Max Moroz
80a27c3a17 [llvm-cov] Generate "report" for given source paths if sources are specified.
Summary:
Documentation says that user can specify sources for both "show" and
"report" commands. "Show" command respects specified sources, but "report" does
not. It is useful to have both "show" and "report" generated for specified
sources. Also added tests to for both commands with sources specified.

Reviewers: vsk, kcc

Reviewed By: vsk

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

llvm-svn: 315685
2017-10-13 14:44:51 +00:00
Jonas Devlieghere
4d22ee666b Re-land "[dsymutil] Timestmap verification for __swift_ast"
This patch adds timestamp verification for swiftmodule files. A new flag
is provided to allows us to disable this check in order to allow testing
of this feature.

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

llvm-svn: 315684
2017-10-13 14:41:23 +00:00
Keith Wyss
667e4ff926 Removing default case statement from covered switch.
Previous patch did not count on the llvm command line parser to restrict the
inputs, but it is safe to do so.

Fix forward for patch with details:
-- https://reviews.llvm.org/D38650 and
-- https://llvm.org/svn/llvm-project/llvm/trunk@315635 91177308-0d34-0410-b5e6-96231b3b80d8

llvm-svn: 315644
2017-10-13 00:06:35 +00:00
Matthias Braun
6cdc04a20c Revert "TargetMachine: Merge TargetMachine and LLVMTargetMachine"
Reverting to investigate layering effects of MCJIT not linking
libCodeGen but using TargetMachine::getNameWithPrefix() breaking the
lldb bots.

This reverts commit r315633.

llvm-svn: 315637
2017-10-12 22:57:28 +00:00
Keith Wyss
4c3c0b3430 [XRay][tools] Updated stacks tool with flamegraph output.
Summary:
As the first step to allow analysis and visualization of xray collected data,
allow using the llvm-xray stacks tool to emit a complete listing of stacks in
the format consumable by a flamegraph tool.

Possible follow up formats include chrome trace viewer format and sql load
files.

As a POC, I'm able to generate flamegraphs of an xray instrumented llc compiling
hello world.

Reviewers: dberris, pelikan

Subscribers: llvm-commits

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

llvm-svn: 315635
2017-10-12 22:47:42 +00:00
Matthias Braun
e1c491ab05 TargetMachine: Merge TargetMachine and LLVMTargetMachine
Merge LLVMTargetMachine into TargetMachine.

- There is no in-tree target anymore that just implements TargetMachine
  but not LLVMTargetMachine.
- It should still be possible to stub out all the various functions in
  case a target does not want to use lib/CodeGen
- This simplifies the code and avoids methods ending up in the wrong
  interface.

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

llvm-svn: 315633
2017-10-12 22:28:54 +00:00
Justin Bogner
51ab92de46 Re-commit "llvm-isel-fuzzer: Handle a subset of backend flags in the exec name"
Here we add a secondary option parser to llvm-isel-fuzzer (and provide
it for use with other fuzzers). With this, you can copy the fuzzer to
a name like llvm-isel-fuzzer=aarch64-gisel for a fuzzer that fuzzer
AArch64 with GlobalISel enabled, or fuzzer=x86_64 to fuzz x86, with no
flags required. This should be useful for running these in OSS-Fuzz.

Note that this handrolls a subset of cl::opts to recognize, rather
than embedding a complete command parser for argv[0]. If we find we
really need the flexibility of handling arbitrary options at some
point we can rethink this.

This re-applies 315545 using "=" instead of ":" as a separator for
arguments.

llvm-svn: 315557
2017-10-12 04:35:32 +00:00
Hans Wennborg
a5e07fa459 Revert r315545 "llvm-isel-fuzzer: Handle a subset of backend flags in the executable name"
It broke some tests on Windows:

Failing Tests (4):
    LLVM :: tools/llvm-isel-fuzzer/execname-options.ll
    LLVM :: tools/llvm-isel-fuzzer/missing-triple.ll
    LLVM :: tools/llvm-isel-fuzzer/x86-empty-bc.ll
    LLVM :: tools/llvm-isel-fuzzer/x86-empty.ll

> llvm-isel-fuzzer: Handle a subset of backend flags in the executable name
>
> Here we add a secondary option parser to llvm-isel-fuzzer (and provide
> it for use with other fuzzers). With this, you can copy the fuzzer to
> a name like llvm-isel-fuzzer:aarch64-gisel for a fuzzer that fuzzer
> AArch64 with GlobalISel enabled, or fuzzer:x86_64 to fuzz x86, with no
> flags required. This should be useful for running these in OSS-Fuzz.
>
> Note that this handrolls a subset of cl::opts to recognize, rather
> than embedding a complete command parser for argv[0]. If we find we
> really need the flexibility of handling arbitrary options at some
> point we can rethink this.

llvm-svn: 315554
2017-10-12 03:32:09 +00:00
Justin Bogner
2b300def19 llvm-isel-fuzzer: Handle a subset of backend flags in the executable name
Here we add a secondary option parser to llvm-isel-fuzzer (and provide
it for use with other fuzzers). With this, you can copy the fuzzer to
a name like llvm-isel-fuzzer:aarch64-gisel for a fuzzer that fuzzer
AArch64 with GlobalISel enabled, or fuzzer:x86_64 to fuzz x86, with no
flags required. This should be useful for running these in OSS-Fuzz.

Note that this handrolls a subset of cl::opts to recognize, rather
than embedding a complete command parser for argv[0]. If we find we
really need the flexibility of handling arbitrary options at some
point we can rethink this.

llvm-svn: 315545
2017-10-12 01:57:49 +00:00
Zachary Turner
0cc2a53e00 Revert "[ADT] Make Twine's copy constructor private."
This reverts commit 4e4ee1c507e2707bb3c208e1e1b6551c3015cbf5.

This is failing due to some code that isn't built on MSVC
so I didn't catch.  Not immediately obvious how to fix this
at first glance, so I'm reverting for now.

llvm-svn: 315536
2017-10-11 23:54:34 +00:00
Lang Hames
4963aceaec [MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.
MCObjectStreamer owns its MCCodeEmitter -- this fixes the types to reflect that,
and allows us to remove the last instance of MCObjectStreamer's weird "holding
ownership via someone else's reference" trick.

llvm-svn: 315531
2017-10-11 23:34:47 +00:00
Zachary Turner
ab809dc2fa [ADT] Make Twine's copy constructor private.
There's a lot of misuse of Twine scattered around LLVM.  This
ranges in severity from benign (returning a Twine from a function
by value that is just a string literal) to pretty sketchy (storing
a Twine by value in a class).  While there are some uses for
copying Twines, most of the very compelling ones are confined
to the Twine class implementation itself, and other uses are
either dubious or easily worked around.

This patch makes Twine's copy constructor private, and fixes up
all callsites.

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

llvm-svn: 315530
2017-10-11 23:33:06 +00:00
Vlad Tsyrklevich
6daa42dbeb MC Helpers for llvm-cfi-verify.
Add instruction analysis and machinecode traversal helpers in
preparation for control flow graph generation implementation.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: mgorny, llvm-commits, pcc, kcc

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

llvm-svn: 315528
2017-10-11 23:17:29 +00:00
Vlad Tsyrklevich
d0a2c19b62 Reland 'Classify llvm-cfi-verify.'
Summary: Move llvm-cfi-verify into a class in preparation for CFI analysis to come.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: mgorny, llvm-commits, pcc, kcc

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

llvm-svn: 315504
2017-10-11 20:35:01 +00:00
Zachary Turner
bd1a325dfd Fix incorrect integer literal suffix.
llvm-svn: 315501
2017-10-11 20:23:38 +00:00
Zachary Turner
1a5684f1d0 [llvm-rc] Use proper search algorithm for finding resources.
Previously we would only look in the current directory for a
resource, which might not be the same as the directory of the
rc file.  Furthermore, MSVC rc supports a /I option, and can
also look in the system environment.  This patch adds support
for this search algorithm.

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

llvm-svn: 315499
2017-10-11 20:12:09 +00:00
Jake Ehrlich
888c5073d1 Reland "[llvm-objcopy] Add support for --strip-sections to remove all section headers leaving only program headers and loadable segment data"
ubsan caught an issue I made where I was converting a null pointer to a
reference.

elf utils implements a particularly extreme form of stripping that I'd
like to support. eu-strip has an option called "strip-sections" that
removes all section headers and leaves only program headers and the
segment data. I have implemented this option partly as a test but mainly
because in Fuchsia we would like to use this option to minimize the size
of our executables. The other strip options that are on my list include
--strip-all and --strip-debug. This is a preliminary implementation that
I'd like to start using in Fuchsia builds if possible. This change
implements such a stripping option for llvm-objcopy

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

llvm-svn: 315484
2017-10-11 18:09:18 +00:00
Rafael Espindola
7824d0422f Convert a few ErrorOr to Expected.
llvm-svn: 315477
2017-10-11 17:23:15 +00:00
Jonas Devlieghere
bb2f966aec Revert "[dsymutil] Timestmap verification for __swift_ast"
This reverts commit r315456.

llvm-svn: 315458
2017-10-11 13:51:30 +00:00
Jonas Devlieghere
1e74cc6b31 [dsymutil] Timestmap verification for __swift_ast
This patch adds timestamp verification for swiftmodule files.

 - A new flag is provided to allows us to continue testing of the code
   for embedding the__swift_ast. (git doesn't maintain timestamps)
 - Adds a new test for fat (arm) binaries.

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

llvm-svn: 315456
2017-10-11 13:34:52 +00:00
Simon Dardis
811fc0bbc5 [llvm-rc] Fix spelling in message
llvm-svn: 315447
2017-10-11 10:14:22 +00:00
Jake Ehrlich
ef3e8ca734 Revert "[llvm-objcopy] Add support for --strip-sections to remove all section headers leaving only program headers and loadable segment data"
This reverts commit rL315412

llvm-svn: 315417
2017-10-11 02:42:29 +00:00
Jake Ehrlich
319aa8e7b0 [llvm-objcopy] Add support for --strip-sections to remove all section headers leaving only program headers and loadable segment data
elf utils implements a particularly extreme form of stripping that I'd
like to support. eu-strip has an option called "strip-sections" that
removes all section headers and leaves only program headers and the
segment data. I have implemented this option partly as a test but mainly
because in Fuchsia we would like to use this option to minimize the size
of our executables. The other strip options that are on my list include
--strip-all and --strip-debug. This is a preliminary implementation that
I'd like to start using in Fuchsia builds if possible. This change
implements such a stripping option for llvm-objcopy

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

llvm-svn: 315412
2017-10-11 01:59:06 +00:00
Lang Hames
9cbf5c6d82 [MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.
MCObjectStreamer owns its MCAsmBackend -- this fixes the types to reflect that,
and allows us to remove another instance of MCObjectStreamer's weird "holding
ownership via someone else's reference" trick.

llvm-svn: 315410
2017-10-11 01:57:21 +00:00
Jake Ehrlich
0d141d6a28 [llvm-objcopy] Add ability to remove multiple sections by name
This change adds the ability to use the "-R"/"-remove-section" option
multiple times.

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

llvm-svn: 315385
2017-10-10 23:02:43 +00:00
Jake Ehrlich
e8eb4fbe69 [llvm-objcopy] Fix latent bug that allowed some Sections to be improperly cast to StringTableSections
If a Section had Type SHT_STRTAB (which could happen if you had a
.dynstr section) it was possible to cast Section to StringTableSection
and get away with any operation that was supported by SectionBase
without it being noticed. This change makes this bug easier to notice
and fixes it where it occurred. It also made me realize that there was
some duplication of efforts in the loop that calls ::initialize. These
issues are all fixed by this change.

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

llvm-svn: 315372
2017-10-10 21:28:22 +00:00
Vlad Tsyrklevich
79b810fb12 Revert "Classify llvm-cfi-verify."
This reverts commit r315363. It has a simple build failure, but more
importantly I want to confirm that unit tests run in check-all to make
sure that they don't silently break in the future.

llvm-svn: 315370
2017-10-10 21:21:13 +00:00
Vlad Tsyrklevich
ffef765e1f Classify llvm-cfi-verify.
Summary: Move llvm-cfi-verify into a class in preparation for CFI analysis to come.

Reviewers: vlad.tsyrklevich

Reviewed By: vlad.tsyrklevich

Subscribers: mgorny, llvm-commits, pcc, kcc

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

llvm-svn: 315363
2017-10-10 20:59:08 +00:00
Roman Lebedev
3384da9f27 [opt-viewer] Don't Decode HTML bytes for Python 2
Summary:
D36624 added some python3 compatibility. But that fix has a problem..

With python2 (which is specified by `#!/usr/bin/env python2.7`), if the env variables do not specify the UTF8,
and the source file is UTF8 (contains non-ASCII symbols), then the `.decode('utf-8')` causes the following exception:
```
Reading YAML files...
Rendering HTML files...
        8 of 41Traceback (most recent call last):
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 277, in <module>
    print_progress)
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 213, in generate_report
    should_print_progress)
  File "/build/llvm/tools/opt-viewer/optpmap.py", line 45, in pmap
    result = map(_wrapped_func, func_and_args, *args, **kwargs)
  File "/build/llvm/tools/opt-viewer/optpmap.py", line 25, in _wrapped_func
    return func(argument)
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 174, in _render_file
    SourceFileRenderer(source_dir, output_dir, filename).render(remarks)
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 125, in render
    self.render_source_lines(self.source_stream, line_remarks)
  File "/build/llvm/tools/opt-viewer/opt-viewer.py", line 79, in render_source_lines
    </tr>'''.format(**locals()), file=self.stream)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 47: ordinal not in range(128)
```
This is similar to https://bugs.llvm.org/show_bug.cgi?id=33548, which was fixed by https://reviews.llvm.org/D37661

Unlike that fix, here, *removing* `.decode('utf-8')` actually fixes it.

Since i assume that the original fix is needed, i simply made
that fix conditional, since for python2 it actually breaks things.

Reviewers: modocache, anemet

Reviewed By: anemet

Subscribers: fhahn, llvm-commits

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

llvm-svn: 315350
2017-10-10 19:34:15 +00:00
Jake Ehrlich
c58d77a269 [llvm-objcopy] Add support for removing sections
This change adds support for removing sections using the -R field (as
GNU objcopy does as well). This change should let us add many helpful
tests and is a proper stepping stone for adding more general kinds of
stripping.

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

llvm-svn: 315346
2017-10-10 18:47:09 +00:00
Jake Ehrlich
518ecb8d6d Revert "temporary"
I forgot to add a proper commit message. I'm reverting this
to fix that.

This reverts commit r315344.

llvm-svn: 315345
2017-10-10 18:32:22 +00:00
Jake Ehrlich
875bd340c8 temporary
llvm-svn: 315344
2017-10-10 18:28:15 +00:00
Zachary Turner
dff3bfd63c [llvm-rc] Try again to fix errors on big endian systems.
llvm-svn: 315248
2017-10-09 22:59:40 +00:00
Francis Ricci
a55e7b5513 [llvm-objdump] Use initializer list for scoped xar api constructors
llvm-svn: 315243
2017-10-09 20:27:14 +00:00
Zachary Turner
c7deaade4e Fix some C++ value / reference semantics issues.
Some functions were taking Twine's not by const&, these are all
fixed to take by const&.  We also had a case where some functions
were overloaded to accept by const& and &&.  Now there is only
one version which accepts by value and move's the value.

llvm-svn: 315229
2017-10-09 18:50:29 +00:00
Francis Ricci
c869c90b7c [dsymutil] Emit valid debug locations when no symbol flags are set
Summary:
swiftc emits symbols without flags set, which led dsymutil to ignore
them when searching for global symbols, causing dwarf location data
to be omitted. Xcode's dsymutil handles this case correctly, and emits
valid location data. Add this functionality to llvm-dsymutil by
allowing parsing of symbols with no flags set.

Reviewers: aprantl, friss, JDevlieghere

Subscribers: llvm-commits

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

llvm-svn: 315218
2017-10-09 17:27:47 +00:00
Zachary Turner
738623f975 [llvm-rc] Have the tokenizer discard single & block comments.
This allows rc files to have comments.  Eventually we should
just use clang's c preprocessor, but that's a bit larger
effort for minimal gain, and this is straightforward.

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

llvm-svn: 315207
2017-10-09 15:46:13 +00:00
Benjamin Kramer
477e3c6cab Remove unused variables. No functionality change.
llvm-svn: 315185
2017-10-08 19:11:02 +00:00
Zachary Turner
325d2fbbca [llvm-rc] Fix some endianness errors.
llvm-svn: 315128
2017-10-06 23:21:43 +00:00
Zachary Turner
acd37087f2 [llvm-rc] Implement escape sequences in .rc files.
This allows the escape sequences (\a, \n, \r, \t, \\, \x[0-9a-f]*,
\[0-7]*, "") to appear in .rc scripts. These are parsed and output in
the same way as it's done in original MS implementation.

The way these sequences are processed depends on the type of the
resource it resides in, and on whether the user declared the string to
be "wide" or "narrow".

I tried to maintain the maximum compatibility with the original tool
(and fail in some erroneous situations that are accepted by .rc).
However, there are some (extremely rare) cases where Microsoft tool
outputs nonsense. I found it infeasible to detect such casses.

Patch by Marek Sokolowski

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

llvm-svn: 315118
2017-10-06 22:05:15 +00:00
Zachary Turner
ab4c2ad7c5 [llvm-rc] Serialize user-defined resources to .res files.
This allows rc to serialize user-defined resources, as
documented at:

msdn.microsoft.com/en-us/library/windows/desktop/aa381054.aspx

Escape sequences are yet unavailable, and are to be added in one of
child patches.

Patch by: Marek Sokolowski

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

llvm-svn: 315117
2017-10-06 21:52:15 +00:00
Zachary Turner
3dd4f77b2e [llvm-rc] Serialize STRINGTABLE statements to .res file.
This allows llvm-rc to serialize STRINGTABLE resources.

These are output in an unusual way: we locate them at the end of the
file, and strings are merged into bundles of max 16 strings, depending
on their IDs, language, and characteristics.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381050.aspx

Patch by: Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D38420

llvm-svn: 315112
2017-10-06 21:30:55 +00:00
Zachary Turner
761f2d07b0 [llvm-rc] Serialize VERSIONINFO resources to .res files.
This is now able to dump VERSIONINFO resources.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx

Differential Revision: https://reviews.llvm.org/D38410
Patch by: Marek Sokolowski

llvm-svn: 315110
2017-10-06 21:26:06 +00:00
Zachary Turner
e5d5fbb1ef [llvm-rc] Serialize CURSOR and ICON resources to .res
This is part 6 of llvm-rc serialization.

This adds ability to output cursors and icons as resources.

Unfortunately, we can't just copy .cur or .ico files to output - as each
file might contain multiple images, each of them needs to be unpacked
and stored as a separate resource. This forces us to parse cursor and
icon contents. (Fortunately, these formats are pretty similar and can be
processed by mostly common code).

As test files are binary, here is a short explanation of .cur and .ico
files stored:

cursor.cur, cursor-8.cur, cursor-32.cur are sample correct cursor files,
differing in their bit depth.

icon-old.ico, icon-new.ico are sample correct icon files;

icon-png.ico is a sample correct icon file in PNG format (instead of
usual BMP);

cursor-eof.cur is an incorrect cursor file - this is cursor.cur with
some of its final bytes removed.

cursor-bad-offset.cur is an incorrect cursor file - image header states
that image data begins at offset 0xFFFFFFFF.

Sample correct cursors and icons were created by Nico Weber.

Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37878

llvm-svn: 315109
2017-10-06 21:25:44 +00:00
Zachary Turner
c7eb72c5a8 [llvm-rc] Add optional serialization support for DIALOG(EX) resources.
This is part 5 of llvm-rc serialization support.

This allows DIALOG and DIALOGEX to serialize if dialog-specific optional
statements are provided. These are (as of now): CAPTION, FONT, and
STYLE.

Notably, FONT statement can take more than two arguments when describing
DIALOGEX resources (as in
msdn.microsoft.com/en-us/library/windows/desktop/aa381013.aspx). I made
some changes to the parser to reflect this fact.

Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37864

llvm-svn: 315104
2017-10-06 20:51:20 +00:00
Adrian Prantl
72cc88bd96 Unify spelling.
llvm-svn: 315102
2017-10-06 20:24:35 +00:00
Adrian Prantl
d11782d299 llvm-dwarfdump: Add an option to collect debug info quality metrics.
At the last LLVM dev meeting we had a debug info for optimized code
BoF session. In that session I presented some graphs that showed how
the quality of the debug info produced by LLVM changed over the last
couple of years. This is a cleaned up version of the patch I used to
collect the this data. It is implemented as an extension of
llvm-dwarfdump, adding a new --statistics option. The intended
use-case is to automatically run this on the debug info produced by,
e.g., our bots, to identify eyebrow-raising changes or regressions
introduced by new transformations that we could act on.

In the current form, two kinds of data are being collected:

- The number of variables that have a debug location versus the number
  of variables in total (this takes into account inlined instances of
  the same function, so if a variable is completely missing form only
  one instance it will be found).

- The PC range covered by variable location descriptions versus the PC
  range of all variables' containing lexical scopes.

The output format is versioned and extensible, so I'm looking forward
to both bug fixes and ideas for other data that would be interesting
to track.

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

llvm-svn: 315101
2017-10-06 20:24:34 +00:00
Francis Ricci
e83efc05ac Revert "[dsymutil] Emit valid debug locations when no symbol flags are set"
This reverts commit r315082, which fails on non-darwin buildbots.

llvm-svn: 315088
2017-10-06 18:19:52 +00:00
Francis Ricci
de990fae59 [dsymutil] Emit valid debug locations when no symbol flags are set
Summary:
swiftc emits symbols without flags set, which led dsymutil to ignore
them when searching for global symbols, causing dwarf location data
to be omitted. Xcode's dsymutil handles this case correctly, and emits
valid location data. Add this functionality to llvm-dsymutil by
allowing parsing of symbols with no flags set.

Reviewers: aprantl, friss, JDevlieghere

Subscribers: llvm-commits

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

llvm-svn: 315082
2017-10-06 17:43:37 +00:00
Francis Ricci
ae8c64ffc0 Guard xar RAII behind HAVE_LIBXAR
llvm-svn: 315072
2017-10-06 15:54:20 +00:00
Francis Ricci
ca7bdaa659 [llvm-objdump] Add RAII for xar apis
Summary:
xar_open and xar_iter_new require manual calls to close/free functions
to deallocate resources. This makes it easy to introduce memory leaks,
so add RAII struct wrappers for these resources.

Reviewers: enderby, rafael, compnerd, lhames, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 315069
2017-10-06 15:33:28 +00:00
Francis Ricci
af6f8e8c67 [llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

llvm-svn: 315066
2017-10-06 14:49:20 +00:00
Francis Ricci
4d1f801016 Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"
Breaks aarch64 builders

This reverts commit r315014.

llvm-svn: 315034
2017-10-05 23:09:17 +00:00
Francis Ricci
7bb963cfaa [llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

llvm-svn: 315014
2017-10-05 20:03:01 +00:00
Francis Ricci
3f704bf697 Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"
This reverts commit r315004, because of a failing test on non-apple platforms

llvm-svn: 315009
2017-10-05 19:47:13 +00:00
Francis Ricci
6675069a69 [dsymutil] Fix unused variable warning
llvm-svn: 315006
2017-10-05 19:35:55 +00:00
Francis Ricci
9cb28025fb [llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

llvm-svn: 315004
2017-10-05 19:17:28 +00:00
Konstantin Zhuravlyov
fbd1d211cf AMDGPU: Add and set AMDGPU-specific e_flags
Differential Revision: https://reviews.llvm.org/D38556

llvm-svn: 314987
2017-10-05 16:19:18 +00:00
Sean Fertile
3695295d20 Enabling new pass manager in LTO (and thinLTO) link step.
Adds the option 'new-pass-manager' to the gold pluggin to enable using the
new pass manager during the lto/thinlto link step.

Patch by Graham Yiu.

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

llvm-svn: 314963
2017-10-05 01:48:42 +00:00
Rafael Espindola
e01aed9846 Bring r314809 back.
But now include a check for CPU_COUNT so we still build on 10 year old
versions of glibc.

Original message:

Use sched_getaffinity instead of std:🧵:hardware_concurrency.

The issue with std:🧵:hardware_concurrency is that it forwards
to libc and some implementations (like glibc) don't take thread
affinity into consideration.

With this change a llvm program that can execute in only 2 cores will
use 2 threads, even if the machine has 32 cores.

This makes benchmarking a lot easier, but should also help if someone
doesn't want to use all cores for compilation for example.

llvm-svn: 314931
2017-10-04 20:27:01 +00:00
Sanjay Patel
95e7a2f063 [SimplifyCFG] put the optional assumption cache pointer in the options struct; NFCI
This is a follow-up to https://reviews.llvm.org/D38138. 

I fixed the capitalization of some functions because we're changing those
lines anyway and that helped verify that we weren't accidentally dropping 
any options by using default param values.

llvm-svn: 314930
2017-10-04 20:26:25 +00:00
Daniel Neilson
46cdd30793 Revert D38481 due to missing cmake check for CPU_COUNT
Summary:
This reverts D38481. The change breaks systems with older versions of glibc. It
injects a use of CPU_COUNT() from sched.h without checking to ensure that the
function exists first.

Reviewers:

Subscribers:

llvm-svn: 314922
2017-10-04 18:19:03 +00:00
Jake Ehrlich
dd2311d56c [llvm-objcopy] Fix major layout bugs in llvm-objcopy
Somehow a few massive errors slipped though the cracks of testing.

1. The code in Segment::finalize was left over from the old layout
algorithm. In certain situations this would cause very strange issues
with segment layout. For instance in the shift-segments.test case it
would cause the second segment to have the same offset as the first.

2. In debugging this I discovered another issue. Namely section alignment
was not being computed based on Section->Align but instead
Section->Offset which is bizarre and makes no sense. I have no clue how
it worked in the first place. This issue is also fixed

3. Fixing #2 exposed a bug where things were not being written past the end
of the file that technically should have been. This was because in
certain cases (like overlapping-segments) the end of the file wouldn't
always be bumped if the offset could be chosen relative to an existing
segment that already had it's offset chosen. For fully nested segments
this is fine but for overlapping segments this leaves the end of the
file short. So I changed how the offset is bumped when looping though
segments.

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

llvm-svn: 314918
2017-10-04 17:44:42 +00:00
George Rimar
9e031dd8b9 [gold-plugin] - Fix compilation after LLVM update (r314883). NFC.
llvm-svn: 314899
2017-10-04 11:00:30 +00:00
Sean Eveson
69a379ddcd [llvm-cov] Fix showing title when filtering and not outputting to a directory
Differential Revision: https://reviews.llvm.org/D38507

llvm-svn: 314885
2017-10-04 08:54:37 +00:00
Adrian Prantl
7d0f59fbef llvm-dwarfdump: implement the --regex option in combination with --name.
llvm-svn: 314855
2017-10-03 22:08:22 +00:00
Konstantin Zhuravlyov
dd0f62bde0 AMDGPU: Add ELFOSABI_AMDGPU_MESA3D
Differential Revision: https://reviews.llvm.org/D38387

llvm-svn: 314846
2017-10-03 21:14:14 +00:00
Konstantin Zhuravlyov
faac723406 AMDGPU: Add ELFOSABI_AMDGPU_PAL
llvm-svn: 314843
2017-10-03 20:54:07 +00:00
Hans Wennborg
439468e183 Fix -Wcovered-switch-default warnings from r314821
llvm-svn: 314826
2017-10-03 18:44:12 +00:00
Hans Wennborg
059c2fadb1 Revert r314817 "[dwarfdump] Add -lookup option"
The test fails on Linux; see follow-up email on the llvm-commits list.

> Add the option to lookup an address in the debug information and print
> out the file, function, block and line table details.
>
> Differential revision: https://reviews.llvm.org/D38409

This also reverts the follow-up r314818:

> [test] Fix llvm-dwarfdump/cmdline.test
>
> Fixes test/tools/llvm-dwarfdump/cmdline.test

llvm-svn: 314825
2017-10-03 18:39:13 +00:00
Hans Wennborg
abd9b7ecb5 CodeView: Provide a .def file with the register ids
The list of register ids was previously written out in a couple of dirrent
places. This puts it in a .def file and also adds a few more registers (e.g.
the x87 regs) which should lead to more readable dumps, but I didn't include
the whole list since that seems unnecessary.

X86_MC::initLLVMToSEHAndCVRegMapping is pretty ugly, but at least it's not
relying on magic constants anymore. The TODO of using tablegen still stands.

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

llvm-svn: 314821
2017-10-03 18:27:22 +00:00
Jonas Devlieghere
cce4ff485e [dwarfdump] Add -lookup option
Add the option to lookup an address in the debug information and print
out the file, function, block and line table details.

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

llvm-svn: 314817
2017-10-03 17:10:21 +00:00
Rafael Espindola
129f5a2768 Use sched_getaffinity instead of std:🧵:hardware_concurrency.
The issue with std:🧵:hardware_concurrency is that it forwards
to libc and some implementations (like glibc) don't take thread
affinity into consideration.

With this change a llvm program that can execute in only 2 cores will
use 2 threads, even if the machine has 32 cores.

This makes benchmarking a lot easier, but should also help if someone
doesn't want to use all cores for compilation for example.

llvm-svn: 314809
2017-10-03 16:25:15 +00:00
Sean Eveson
39aefb7654 [llvm-cov] Hide files with no coverage from the index when filtering by name
Differential Revision: https://reviews.llvm.org/D38457

llvm-svn: 314782
2017-10-03 11:05:28 +00:00
Alex Bradbury
2a8fff9296 [llvm-readobj][RISCV] Pretty-print RISCV e_flags
llvm-svn: 314772
2017-10-03 08:41:59 +00:00
Adrian Prantl
86532b53d7 llvm-dwarfdump: support the --ignore-case option.
llvm-svn: 314723
2017-10-02 21:21:09 +00:00
Konstantin Zhuravlyov
fd3140ee62 Add ELFOSABI_FIRST_ARCH, ELFOSABI_LAST_ARCH and start using those in llvm-readobj
Differential Revision: https://reviews.llvm.org/D38418

llvm-svn: 314717
2017-10-02 20:49:58 +00:00
Adrian Prantl
6d0ecb4cce Move the stripping of invalid debug info from the Verifier to AutoUpgrade.
This came out of a recent discussion on llvm-dev
(https://reviews.llvm.org/D38042). Currently the Verifier will strip
the debug info metadata from a module if it finds the dbeug info to be
malformed. This feature is very valuable since it allows us to improve
the Verifier by making it stricter without breaking bcompatibility,
but arguable the Verifier pass should not be modifying the IR. This
patch moves the stripping of broken debug info into AutoUpgrade
(UpgradeDebugInfo to be precise), which is a much better location for
this since the stripping of malformed (i.e., produced by older, buggy
versions of Clang) is a (harsh) form of AutoUpgrade.

This change is mostly NFC in nature, the one big difference is the
behavior when LLVM module passes are introducing malformed debug
info. Prior to this patch, a NoAsserts build would have printed a
warning and stripped the debug info, after this patch the Verifier
will report a fatal error. I believe this behavior is actually more
desirable anyway.

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

llvm-svn: 314699
2017-10-02 18:31:29 +00:00
Jonas Devlieghere
6f21edf7e9 [dwarfdump] Add -show-form
This enables printing of DWARF form types after the DWARF attribute
types.

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

llvm-svn: 314685
2017-10-02 16:02:04 +00:00
Marek Sokolowski
22a04dbf48 [llvm-rc] Serialize DIALOG(EX) to .res files (serialization, pt 4).
This is now able to serialize DIALOG and DIALOGEX resources to .res
files. It still can't parse dialog-specific CAPTION, FONT, and STYLE
optional statement - these will be added in the following patch.

A limited set of controls is included. However, more can be easily added
by extending SupportedCtls map defined in ResourceScriptStmt.cpp.

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

llvm-svn: 314578
2017-09-30 00:38:52 +00:00
Adrian Prantl
7815bab680 typos
llvm-svn: 314577
2017-09-30 00:31:15 +00:00
Adrian Prantl
5f4a1a5ebf llvm-dwarfdump: implement the --name lookup option.
llvm-svn: 314576
2017-09-30 00:22:25 +00:00
Adrian Prantl
0aa747f868 Fix 80 column violations
llvm-svn: 314575
2017-09-30 00:22:24 +00:00
Adrian Prantl
b7d8613119 Add comments
llvm-svn: 314574
2017-09-30 00:22:21 +00:00
Marek Sokolowski
138f2c0ded [llvm-rc] Serialize MENU resources to .res files (serialization, pt 3).
This allows MENU resources to be serialized.

MENU resource statement doc:
msdn.microsoft.com/en-us/library/windows/desktop/aa381025.aspx
POPUP sub-statement doc:
msdn.microsoft.com/en-us/library/windows/desktop/aa381030.aspx
MENUITEM sub-statement doc:
msdn.microsoft.com/en-us/library/windows/desktop/aa381024.aspx
MENUHEADER structure:
msdn.microsoft.com/en-us/library/windows/desktop/ms648018.aspx (and
NORMALMENUITEM, POPUPMENUITEM structs).

Thanks for Nico Weber for his original work in this area.

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

llvm-svn: 314562
2017-09-29 22:25:05 +00:00
Marek Sokolowski
b0678b080e [llvm-rc] Serialize ACCELERATORS to .res files (serialization, pt 2).
This allows llvm-rc to serialize ACCELERATORS resources.

Additionally, as this is the first type of resource to support basic
optional resource statements (LANGUAGE, CHARACTERISTICS, VERSION),

ACCELERATORS statement documentation:
msdn.microsoft.com/en-us/library/windows/desktop/aa380610.aspx
Accelerator table structure documentation:
msdn.microsoft.com/en-us/library/windows/desktop/ms648010.aspx
Optional resource statement fields are described in:
msdn.microsoft.com/en-us/library/windows/desktop/ms648027.aspx

Thanks for Nico Weber for his original work in this area.

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

llvm-svn: 314549
2017-09-29 19:07:44 +00:00
Marek Sokolowski
92cb3c7f27 [llvm-rc] Refactoring needed for ACCELERATORS and MENU resources.
This is a part of llvm-rc serialization patch set (serialization, pt 1.5).

This:

* Unifies the internal representation of flags in ACCELERATORS and MENU
   with the corresponding representation in .res files (noticed in
   https://reviews.llvm.org/D37828#inline-329828).
* Creates an RCResource subclass, OptStatementsRCResource, describing
   resource statements that can declare resource-local optional statements
   (proposed in https://reviews.llvm.org/D37824#inline-329775).

These modifications don't fit to any of the current patches, so I'm
submitting them as a separate patch.

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

llvm-svn: 314541
2017-09-29 17:46:32 +00:00
Marek Sokolowski
f3fcbe4a9d [llvm-rc] Serialize HTML resources to .res files (serialization, pt 1).
This allows to process HTML resources defined in .rc scripts and output
them to resulting .res files. Additionally, some infrastructure allowing
to output these files is created.

This is the first resource type we can operate on.

Thanks to Nico Weber for his original work in this area.

Differential Revision: reviews.llvm.org/D37283

llvm-svn: 314538
2017-09-29 17:14:09 +00:00
Adam Nemet
b9cadf35f9 Display relative hotness with two decimal digits after the decimal point
I've seen cases where tiny inlined functions have such a high execution count
that most everything would show up with a relative of hotness of 0%.  Since
the inlined functions effectively disappear you need to tune in the lower
range, thus we need more precision.

llvm-svn: 314537
2017-09-29 16:56:54 +00:00
Sam Clegg
2aed7fe062 [WebAssembly] Allow each data segment to specify its own alignment
Also, add a flags field as we will almost certainly
be needing that soon too.

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

llvm-svn: 314534
2017-09-29 16:50:08 +00:00
Adam Nemet
7be0e0350d Make find_opt_files vararg
This is slightly less verbose for the common case of a single build directory
and more intuitive when using this API directly from the interpreter.

llvm-svn: 314491
2017-09-29 05:20:53 +00:00
Saleem Abdulrasool
44300c3e52 llvm-readobj: fix a few typos (NFC)
Correct the spelling of multiple in a couple of sites.

Patch by Alex Langford!

llvm-svn: 314485
2017-09-29 02:45:44 +00:00
Adrian Prantl
19d0a6e426 llvm-dwarfdump: support .apple-namespaces in --find
llvm-svn: 314481
2017-09-29 00:52:33 +00:00
Marek Sokolowski
f06cd2b407 [llvm-rc] Import all make_unique invocations from llvm namespace.
Previous patch fixed one of LLVM buildbots (lld-x86_64-win7).
However, some others have already been failing because of make_unique
compilation error (llvm-clang-x86_64-expensive-checks-win).

llvm-svn: 314480
2017-09-29 00:33:57 +00:00
Adrian Prantl
d2beca911e llvm-dwarfdump: add support for .apple_types in --find
llvm-svn: 314479
2017-09-29 00:33:22 +00:00
Marek Sokolowski
ad66b459bd [llvm-rc] Add user-defined resources parsing ability. [8/8]
This allows llvm-rc to parse user-defined resources (ref:
msdn.microsoft.com/en-us/library/windows/desktop/aa381054.aspx).
These statements either import files, or put the specified raw data in
the resulting resource file.

Thanks to Nico Weber for his original work in this area.

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

llvm-svn: 314478
2017-09-29 00:14:18 +00:00
Marek Sokolowski
469da485f8 [llvm-rc] Add integer expressions parsing ability. [7/8]
This allows the ints to be written as integer expressions evaluating to
unsigned 16-bit/32-bit integers.

All the expressions may use the following operators: + - & | ~, and
parentheses. Minus token - can be also unary. There is no precedence of
the operators other than the unary operators binding stronger than their
binary counterparts.

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

llvm-svn: 314477
2017-09-28 23:53:25 +00:00
Marek Sokolowski
c776b2e567 [llvm-rc] Fix-up for r314468 (argument-dependent lookup in make_unique).
llvm-svn: 314472
2017-09-28 23:12:53 +00:00
Marek Sokolowski
7414d53a94 [llvm-rc] Add VERSIONINFO parsing ability. [6/8]
This extends the set of llvm-rc parser's available resources by
another one, VERSIONINFO.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx

Thanks to Nico Weber for his original work in this area.

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

llvm-svn: 314468
2017-09-28 22:41:38 +00:00
Adrian Prantl
9d2ec27ba8 try and appease gcc
llvm-svn: 314442
2017-09-28 18:27:00 +00:00
Adrian Prantl
9a78f28e7e llvm-dwarfdump: implement --find for .apple_names
This patch implements the dwarfdump option --find=<name>.  This option
looks for a DIE in the accelerator tables and dumps it if found.  This
initial patch only adds support for .apple_names to keep the review
small, adding the other sections and pubnames support should be
trivial though.

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

llvm-svn: 314439
2017-09-28 18:10:52 +00:00
Sean Eveson
e5dd14d47e [llvm-cov] Create directory structure when filtering using -name*= options
Before this change using any of the -name*= command line options with an output
directory would result in a single file (functions.txt/functions.html)
containing the coverage for those specific functions. Now you get the same
directory structure as when not using any -name*= options.

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

llvm-svn: 314396
2017-09-28 10:07:30 +00:00
Dylan McKay
cf491979b6 Update the description of AVR32 for the ELFDumper
AVR32 is an unrelated architecture with 32-bit addressing.

llvm-svn: 314359
2017-09-27 22:39:37 +00:00
Sean Eveson
79635bcbf9 Revert "[llvm-cov] Create directory structure when filtering using -name*= options"
Test failures.

llvm-svn: 314314
2017-09-27 16:20:07 +00:00
Sean Eveson
bdf63e8c8b [llvm-cov] Create directory structure when filtering using -name*= options
Before this change using any of the -name*= command line options with an output
directory would result in a single file (functions.txt/functions.html)
containing the coverage for those specific functions. Now you get the same
directory structure as when not using any -name*= options.

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

llvm-svn: 314310
2017-09-27 15:37:40 +00:00
Sanjay Patel
097745b159 [SimplifyCFG] add a struct to house optional folds (PR34603)
This was intended to be no-functional-change, but it's not - there's a test diff.

So I thought I should stop here and post it as-is to see if this looks like what was expected 
based on the discussion in PR34603:
https://bugs.llvm.org/show_bug.cgi?id=34603

Notes:
 1. The test improvement occurs because the existing 'LateSimplifyCFG' marker is not carried 
    through the recursive calls to 'SimplifyCFG()->SimplifyCFGOpt().run()->SimplifyCFG()'. 
    The parameter isn't passed down, so we pick up the default value from the function signature 
    after the first level. I assumed that was a bug, so I've passed 'Options' down in all of the 
    'SimplifyCFG' calls.

 2. I split 'LateSimplifyCFG' into 2 bits: ConvertSwitchToLookupTable and KeepCanonicalLoops. 
    This would theoretically allow us to differentiate the transforms controlled by those params 
    independently.

 3. We could stash the optional AssumptionCache pointer and 'LoopHeaders' pointer in the struct too. 
    I just stopped here to minimize the diffs.

 4. Similarly, I stopped short of messing with the pass manager layer. I have another question that 
    could wait for the follow-up: why is the new pass manager creating the pass with LateSimplifyCFG 
    set to true no matter where in the pipeline it's creating SimplifyCFG passes?

    // Create an early function pass manager to cleanup the output of the
    // frontend.
    EarlyFPM.addPass(SimplifyCFGPass());

    -->

    /// \brief Construct a pass with the default thresholds
    /// and switch optimizations.
    SimplifyCFGPass::SimplifyCFGPass()
       : BonusInstThreshold(UserBonusInstThreshold),
         LateSimplifyCFG(true) {}   <-- switches get converted to lookup tables and loops may not be in canonical form

    If this is unintended, then it's possible that the current behavior of dropping the 'LateSimplifyCFG' 
    setting via recursion was masking this bug.

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

llvm-svn: 314308
2017-09-27 14:54:16 +00:00
Sean Eveson
1b0cafe05f [llvm-cov] Improve const-correctness of filters. NFC.
llvm-svn: 314281
2017-09-27 08:32:36 +00:00
Martin Pelikan
181d2d1e9b [XRay] fix the -Werror build by handling all enum cases in switches
Followup to D32840.

llvm-svn: 314270
2017-09-27 05:10:31 +00:00
Martin Pelikan
33c8e86564 [XRay] convert FDR arg1 log entries
Summary:
A new FDR metadata record will support logging a function call argument;
appending multiple metadata records will represent a sequence of arguments
meaning that "holes" are not representable by the buffer format.  Each
call argument is currently a 64-bit value (useful for "this" pointers and
synchronization objects).

If present, we put this argument to the function call "entry" record it
belongs to, and alter its type to notify the user of its presence.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 314269
2017-09-27 04:48:03 +00:00
Jake Ehrlich
5b69666aa1 Reland: [llvm-objcopy] Add support for dynamic relocations
This change adds support for dynamic relocations (allocated
SHT_REL/SHT_RELA sections with a dynamic symbol table as their link).

I had to reland this because of a I wasn't initilizing some pointers.

llvm-svn: 314263
2017-09-27 00:44:00 +00:00
James Y Knight
2763d561fe Initialize the RelocationSectionBase::Section member.
In r314227, it wasn't always, and would thus contain random garbage.

llvm-svn: 314256
2017-09-26 22:44:01 +00:00
Jake Ehrlich
f096324571 [llvm-objcopy] Add support for dynamic relocations
This change adds support for dynamic relocations (allocated
SHT_REL/SHT_RELA sections with a dynamic symbol table as their link).

The binary I added for the test is here:
https://drive.google.com/file/d/0B3gtIAmiMwZXSjJUZE9pUjd4M0k/view?usp=sharing

Unless support for dynamic symbol tables in yaml2obj is added this is
needed.

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

llvm-svn: 314227
2017-09-26 18:02:25 +00:00
Jonas Devlieghere
6225068807 [dsymutil] Better support for symbol aliases
This patch adds logic to follow a symbol's aliases when the symbol name
cannot be found in the current object file. It checks the main binary
for the symbol's address and queries the current object for its aliases
(symbols with the same address) before printing out a warning.

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

llvm-svn: 314198
2017-09-26 08:17:28 +00:00
Vedant Kumar
d0c6992660 [llvm-cov] Warn if -show-functions is used without query files
llvm-cov's report mode does not print any output when -show-functions is
specified and no source files are specified. This can be surprising, so
the tool should at least print out an error message when this happens.

rdar://problem/34636859

llvm-svn: 314175
2017-09-25 23:10:03 +00:00
Vlad Tsyrklevich
0b4abdf3cc Add section headers to SpecialCaseLists
Summary:
Sanitizer blacklist entries currently apply to all sanitizers--there
is no way to specify that an entry should only apply to a specific
sanitizer. This is important for Control Flow Integrity since there are
several different CFI modes that can be enabled at once. For maximum
security, CFI blacklist entries should be scoped to only the specific
CFI mode(s) that entry applies to.

Adding section headers to SpecialCaseLists allows users to specify more
information about list entries, like sanitizer names or other metadata,
like so:

  [section1]
  fun:*fun1*
  [section2|section3]
  fun:*fun23*

The section headers are regular expressions. For backwards compatbility,
blacklist entries entered before a section header are put into the '[*]'
section so that blacklists without sections retain the same behavior.

SpecialCaseList has been modified to also accept a section name when
matching against the blacklist. It has also been modified so the
follow-up change to clang can define a derived class that allows
matching sections by SectionMask instead of by string.

Reviewers: pcc, kcc, eugenis, vsk

Reviewed By: eugenis, vsk

Subscribers: vitalybuka, llvm-commits

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

llvm-svn: 314170
2017-09-25 22:11:11 +00:00
Jake Ehrlich
2e6e774fe6 [llvm-objcopy] Refactor code to include initialize method
This change refactors some of the code to allow for some code
deduplication in later diffs as well as just to make adding a new
section type more self contained to the class itself. The idea for this
was first mentioned by James in D 37915 and will be used in that change
as recommended.

This change follows changes for dynamic sections but precedes support
for dynamic relocations.

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

llvm-svn: 314148
2017-09-25 20:37:28 +00:00
Reid Kleckner
7f2317ba9c Commit missing fixes for tool_file_rename
llvm-svn: 314051
2017-09-23 01:04:42 +00:00
Reid Kleckner
e0df0bbd27 [Support] Rename tool_output_file to ToolOutputFile, NFC
This class isn't similar to anything from the STL, so it shouldn't use
the STL naming conventions.

llvm-svn: 314050
2017-09-23 01:03:17 +00:00
Jonas Devlieghere
004d6f480d [dwarfdump] Fix ambiguous call to make_unique
Fix buildbot failures:
 - http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc2015/builds/13153
 - http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/13566

llvm-svn: 313971
2017-09-22 09:38:52 +00:00
Alexander Richardson
0b11825136 [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

llvm-svn: 313970
2017-09-22 09:30:40 +00:00
Jonas Devlieghere
25e539c814 [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

llvm-svn: 313969
2017-09-22 09:20:57 +00:00
Rafael Espindola
f112256d3c Convert the archive writer to use Error.
This found one place in lld that was not checking the error.

llvm-svn: 313937
2017-09-21 23:13:36 +00:00
Kevin Enderby
63cb9b07be 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

llvm-svn: 313921
2017-09-21 21:45:02 +00:00
Marek Sokolowski
a5b6a9fded [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

llvm-svn: 313912
2017-09-21 20:36:38 +00:00
Adrian Prantl
4055863a09 llvm-dwarfdump: Add support for the --arch command line option.
llvm-svn: 313888
2017-09-21 16:26:18 +00:00
Benjamin Kramer
c90e12840a Add missing file from r313884.
llvm-svn: 313885
2017-09-21 15:32:05 +00:00
Jonas Devlieghere
dd7efc65bd [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

llvm-svn: 313872
2017-09-21 10:28:33 +00:00
Vedant Kumar
0284aa24eb [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.

llvm-svn: 313853
2017-09-21 01:11:30 +00:00
Adrian Prantl
fe878dc115 llvm-dwarfdump: move -eh-frame into the right section in the help output.
llvm-svn: 313836
2017-09-20 23:29:31 +00:00
Marek Sokolowski
91c480c22e [llvm-readobj] Fix 'Teach readobj to dump .res files', pt 3.
Fix (r313790) missing ulittle{}_t error on some buildbots.

llvm-svn: 313834
2017-09-20 23:26:05 +00:00
Marek Sokolowski
0c12f89e99 [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.

llvm-svn: 313833
2017-09-20 23:07:39 +00:00
Sam Clegg
695a583a53 [WebAssembly] Add support for local symbol bindings
Differential Revision: https://reviews.llvm.org/D38096

llvm-svn: 313817
2017-09-20 21:17:04 +00:00
Marek Sokolowski
f92e9caacc [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.

llvm-svn: 313816
2017-09-20 21:03:37 +00:00
Vlad Tsyrklevich
c0e26bc806 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

llvm-svn: 313809
2017-09-20 20:38:14 +00:00
Vlad Tsyrklevich
a7c52cebfb Revert "Introduce the llvm-cfi-verify tool (resubmission of D37937)."
This reverts commit r313798, it's causing buildbot failures.

llvm-svn: 313804
2017-09-20 19:46:02 +00:00
Vlad Tsyrklevich
af7b67d45c 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

llvm-svn: 313798
2017-09-20 19:14:16 +00:00
Sam Clegg
85b547e995 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

llvm-svn: 313795
2017-09-20 19:03:35 +00:00
Marek Sokolowski
2b8a5c6709 [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

llvm-svn: 313790
2017-09-20 18:33:35 +00:00
Adrian Prantl
25bdef70ce 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

llvm-svn: 313778
2017-09-20 17:44:00 +00:00
Jake Ehrlich
250f0cb393 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

llvm-svn: 313767
2017-09-20 17:11:58 +00:00