summaryrefslogtreecommitdiffstats
path: root/llvm/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[llvm] Add symbol table support to llvm-objcopy"Petr Hosek2017-08-262-147/+0
| | | | | | This reverts commit r311826 because it's failing on llvm-i686-linux-RA. llvm-svn: 311827
* [llvm] Add symbol table support to llvm-objcopyPetr Hosek2017-08-262-0/+147
| | | | | | | | | | This change adds support for SHT_SYMTAB sections. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D34167 llvm-svn: 311826
* [llvm-objcopy] New layout algorithm that lays out segments firstPetr Hosek2017-08-262-48/+41
| | | | | | | | | | | | | | | | The current file layout algorithm in llvm-objcopy is simple but difficult to reason about. It also makes it very complicated to support nested segments and to support segments that have offsets that come before a point after the program headers. To support these cases and simplify one of the most critical parts llvm-objcopy I rewrote the layout algorithm. Laying out segments first solves most of the issues encountered by the previous algorithm. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D36494 llvm-svn: 311825
* Update LLVM fuzzers to use the libFuzzer bundled with the compiler toolchainGeorge Karpenkov2017-08-237-24/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D37041 llvm-svn: 311515
* Remove llvm-pdbutil/fuzzer.George Karpenkov2017-08-233-124/+0
| | | | | | | | The code does not compile, is not maintained, and does not have a buildbot. Differential Revision: https://reviews.llvm.org/D37032 llvm-svn: 311512
* dsymutil: don't copy compile units without children from PCM filesAdrian Prantl2017-08-221-0/+2
| | | | | | rdar://problem/33830532 llvm-svn: 311416
* [llvm-pdbutil] Add support for dumping detailed module stats.Zachary Turner2017-08-2112-138/+398
| | | | | | | | | | | | | | | This adds support for dumping a summary of module symbols and CodeView debug chunks. This option prints a table for each module of all of the symbols that occurred in the module and the number of times it occurred and total byte size. Then at the end it prints the totals for the entire file. Additionally, this patch adds the -jmc (just my code) option, which suppresses modules which are from external libraries or linker imports, so that you can focus only on the object files and libraries that originate from your own source code. llvm-svn: 311338
* Keep Optimization Remark Yaml in NewPMSam Elliott2017-08-203-11/+17
| | | | | | | | | | | | | | | | | | | Summary: The New Pass Manager infrastructure was forgetting to keep around the optimization remark yaml file that the compiler might have been producing. This meant setting the option to '-' for stdout worked, but setting it to a filename didn't give file output (presumably it was deleted because compilation didn't explicitly keep it). This change just ensures that the file is kept if compilation succeeds. So far I have updated one of the optimization remark output tests to add a version with the new pass manager. It is my intention for this patch to also include changes to all tests that use `-opt-remark-output=` but I wanted to get the code patch ready for review while I was making all those changes. Fixes https://bugs.llvm.org/show_bug.cgi?id=33951 Reviewers: anemet, chandlerc Reviewed By: anemet, chandlerc Subscribers: javed.absar, chandlerc, fhahn, llvm-commits Differential Revision: https://reviews.llvm.org/D36906 llvm-svn: 311271
* llvm-mt: Merge manifest namespaces.Eric Beckmann2017-08-191-1/+4
| | | | | | | | | | | mt.exe performs a tree merge where certain element nodes are combined into one. This introduces the possibility of xml namespaces conflicting with each other. The original mt.exe has a hierarchy whereby certain namespace names can override others, and nodes that would then end up in ambigious namespaces have their namespaces explicitly defined. This namespace handles this merging process. llvm-svn: 311215
* Reapply: [llvm-rc] Add basic RC scripts parsing ability.Marek Sokolowski2017-08-186-0/+625
| | | | | | | | | | | | | | As for now, the parser supports a limited set of statements and resources. This will be extended in the following patches. Thanks to Nico Weber (thakis) for his original work in this area. This patch was originally submitted as r311175 and got reverted in r311177 because of the problems with compilation under gcc. Differential Revision: https://reviews.llvm.org/D36340 llvm-svn: 311184
* Revert "[llvm-rc] Add basic RC scripts parsing ability."Marek Sokolowski2017-08-186-623/+0
| | | | | | | | This reverts commit r311175. This failed some buildbots compilation. llvm-svn: 311177
* [llvm-rc] Add basic RC scripts parsing ability.Marek Sokolowski2017-08-186-0/+623
| | | | | | | | | | | As for now, the parser supports a limited set of statements and resources. This will be extended in the following patches. Thanks to Nico Weber (thakis) for his original work in this area. Differential Revision: https://reviews.llvm.org/D36340 llvm-svn: 311175
* Remove useless default case in switchVictor Leschuk2017-08-181-3/+0
| | | | llvm-svn: 311149
* Fix warning about covered switch default.Zachary Turner2017-08-171-1/+1
| | | | llvm-svn: 311129
* [llvm-pdbutil] Fix some dumping issues.Zachary Turner2017-08-171-6/+7
| | | | | | | | | | | | | | | | | When dumping, we were treating the S_INLINESITESYM as referring to a type record, when it actually refers to an id record. We had this correct in TypeIndexDiscovery, so our merging algorithm should be fine, but we had it wrong in the dumper, which means it would appear to work most of the time, unless the index was out of bounds in the type stream, when it would fail. Fixed this, and audited a few other cases to make them match the behavior in TypeIndexDiscovery. Also, I've now observed a new symbol record with kind 0x1168 which I have no clue what it is, so to avoid crashing we have to just print "Unknown Symbol Kind". llvm-svn: 311117
* Fix a few minor issues when dumping symbols.Zachary Turner2017-08-172-1/+7
| | | | | | | | | | | | 1) We weren't handling symbol types that weren't able to parse, even if we knew what the leaf type was. This was triggering when trying to dump /DEBUG:FASTLINK PDBs, where we expect a certain symbol to show up, but we just don't know how to parse it. 2) We lost the code for dumping record bytes, so this was added back. llvm-svn: 311116
* [ThinLTO] Fix ThinLTO crash while destroying contextCharles Saternos2017-08-151-5/+10
| | | | | | | | Fix for PR32763 An assert that checks if a Ref was untracked fails during ThinLTO context cleanup. The issue is because lazy loading temporary nodes didn't properly track ValueAsMetadata nodes. This patch ensures that the temporary nodes are properly tracked when they're replaced with the value. llvm-svn: 310967
* [llvm-cov] Add an option which maps the location of source directories on ↵Sean Eveson2017-08-141-44/+77
| | | | | | | | | | | | | | | | | | | another machine to your local copies Summary: This patch adds the -path-equivalence option (example: llvm-cov show -path-equivalence=/origin/path,/local/path) which maps the source code path from one machine to another when using `llvm-cov show`. This is similar to the -filename-equivalence option, but doesn't require you to specify all the source files on the command line. This allows you to generate the coverage data on one machine (e.g. in a CI system), and then use llvm-cov on another machine where you have the same code base on a different path. Reviewers: vsk Reviewed By: vsk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36391 llvm-svn: 310827
* [opt-viewer] Listify `dict_items` for Py3 indexingBrian Gesiak2017-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: In Python 2, calling `dict.items()` returns an indexable `list`, whereas on Python 3 it returns a set-like `dict_items` object, which cannot be indexed. Explicitly onvert the `dict_items` object so that it can be indexed when using Python 3. In combination with D36622, D36623, and D36624, this change allows `opt-viewer.py` to exit successfully when run with Python 3.4. Test Plan: Run `opt-viewer.py` using Python 3.4 and confirm it does not encounter a runtime error when when indexing into `dict.items()`. Reviewers: anemet Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36630 llvm-svn: 310810
* Output S_SECTION symbols to the Linker module.Zachary Turner2017-08-114-73/+108
| | | | | | | | | | | | | | PDBs need to contain 1 module for each object file/compiland, and a special one synthesized by the linker. This one contains a symbol record for each output section in the executable with its address information. This patch adds such symbols to the linker module. Note that we also are supposed to add an S_COFFGROUP symbol for what appears to be each input section that contributes to each output section, but it's not entirely clear how to generate these yet, so I'm leaving that for a separate patch. llvm-svn: 310754
* [opt-viewer] Decode HTML bytes for Python 3Brian Gesiak2017-08-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: When using Python 3, `pygments.highlight()` returns a `bytes` object, not a `str`, causing the call to `str.replace` on the following line to fail with a runtime exception: `TypeError: 'str' does not support the buffer interface`. Decode the bytes into a string in order to fix the exception. Test Plan: Run `opt-viewer.py` with Python 3.4, and confirm no runtime error occurs when calling `str.replace`. Reviewers: anemet Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36624 llvm-svn: 310741
* [opt-viewer] Use Python 3-compatible iteritemsBrian Gesiak2017-08-111-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: Replace a usage of a Python 2-specific `dict.iteritems()` with the Python 3-compatible definition provided at the top of the same file. Test Plan: Run `opt-viewer.py` using Python 3 and confirm it no longer encounters a runtime error when calling `dict.iteritems()`. Reviewers: anemet Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36623 llvm-svn: 310740
* [opt-viewer] Use Python 3-compatible `intern()`Brian Gesiak2017-08-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | Summary: In Python 2, `intern()` is a builtin function available to all programs. In Python 3, it was moved into the `sys` module, available as `sys.intern`. Import it such that, within `optrecord.py`, `intern()` is available whether run using Python 2 or 3. Test Plan: Run `opt-viewer.py` using Python 3, confirm it no longer encounters a runtime error when `intern()` is called. Reviewers: anemet Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36622 llvm-svn: 310739
* Orc: PR33769: Don't rely on comparisons with default constructed iteratorsDavid Blaikie2017-08-111-8/+8
| | | | llvm-svn: 310729
* [gold-plugin] Use more StringRef. No functionality change intended.Benjamin Kramer2017-08-101-14/+10
| | | | llvm-svn: 310652
* [gold-plugin] Avoid race condition when creating temporary files.Benjamin Kramer2017-08-101-11/+12
| | | | | | | | This is both a potential security issue and a potential functionality issue because we create temporary files from multiple threads. Use the safe version of createTemporaryFile instead. llvm-svn: 310636
* Fix 'not all control paths return' warning on windows builds. NFCI.Simon Pilgrim2017-08-101-3/+1
| | | | llvm-svn: 310631
* Fixup for r310621: Hint the compilers about unreachable code.Marek Sokolowski2017-08-101-0/+4
| | | | llvm-svn: 310623
* Add .rc scripts tokenizer.Marek Sokolowski2017-08-105-2/+464
| | | | | | | | | | | | This extends the shell of llvm-rc tool with the ability of tokenization of the input files. Currently, ASCII and ASCII-compatible UTF-8 files are supported. Thanks to Nico Weber (thakis) for his original work in this area. Differential Revision: https://reviews.llvm.org/D35957 llvm-svn: 310621
* [llvm-cov] Rearrange entries in report index.Eli Friedman2017-08-093-13/+58
| | | | | | | | | | | | | | Files which don't contain any functions are likely useless; don't include them in the main table. Put the links at the bottom of the page, in case someone wants to figure out coverage for code inside a macro. Not sure if this is the best solution, but it seems like an improvement. Differential Revision: https://reviews.llvm.org/D36298 llvm-svn: 310518
* [PDB] Fix an issue writing the publics stream.Zachary Turner2017-08-091-18/+37
| | | | | | | | | | | | | In the refactor to merge the publics and globals stream, a bug was introduced that wrote the wrong value for one of the fields of the PublicsStreamHeader. This caused debugging in WinDbg to break. We had no way of dumping any of these fields, so in addition to fixing the bug I've added dumping support for them along with a test that verifies the correct value is written. llvm-svn: 310439
* [PDB] Fix linking of function symbols and local variables.Zachary Turner2017-08-083-7/+38
| | | | | | | | | | | | | | | | | | | | | | | | The compiler outputs PROC32_ID symbols into the object files for functions, and these symbols have an embedded type index which, when copied to the PDB, refer to the IPI stream. However, the symbols themselves are also converted into regular symbols (e.g. S_GPROC32_ID -> S_GPROC32), and type indices in the regular symbol records refer to the TPI stream. So this patch applies two fixes to function records. 1. It converts ID symbols to the proper non-ID record type. 2. After remapping the type index from the object file's index space to the PDB file/IPI stream's index space, it then remaps that index to the TPI stream's index space by. Besides functions, during the remapping process we were also discarding symbol record types which we did not recognize. In particular, we were discarding S_BPREL32 records, which is what MSVC uses to describe local variables on the stack. So this patch fixes that as well by copying them to the PDB. Differential Revision: https://reviews.llvm.org/D36426 llvm-svn: 310394
* dsymutil: support dwarf version mismatches between object and clang moduleAdrian Prantl2017-08-081-1/+3
| | | | | | | | | | This adds a missing call to maybeUpdateMaxDwarfVersion when visitng a clang module. Failing to do so will cause a failure when emitting DWARF 4 forms into a CU that AsmPrinter believes to be DWARF 2. rdar://problem/33666528 llvm-svn: 310392
* [llvm-pdbutil] Don't crash when a section contrib's isect is invalid.Zachary Turner2017-08-071-2/+6
| | | | llvm-svn: 310298
* [llvm-objdump] Use PRIx64 for output of ARM64_RELOC_ADDENDSimon Dardis2017-08-071-1/+1
| | | | llvm-svn: 310250
* [llvm][llvm-objcopy] When outputting to binary don't output segments that ↵Petr Hosek2017-08-041-2/+6
| | | | | | | | | | | | | | | | | cover no sections Sometimes LLD will produce a PT_LOAD segment that only covers the headers (and covers no sections). GNU objcopy does not output the segment contents for these sections. In particular this is an issue in building magenta because the final link step for the kernel would produce just such a PT_LOAD segment. This change is to support this case and to match what GNU objcopy does in this case. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D36196 llvm-svn: 310149
* Enable llvm-pdbutil to list enumerations using native PDB readerAdrian McCarthy2017-08-041-14/+18
| | | | | | | | | | | | | | | This extends the native reader to enable llvm-pdbutil to list the enums in a PDB and it includes a simple test. It does not yet list the values in the enumerations, which requires an actual implementation of NativeEnumSymbol::FindChildren. To exercise this code, use a command like: llvm-pdbutil pretty -native -enums foo.pdb Differential Revision: https://reviews.llvm.org/D35738 llvm-svn: 310144
* [pdbutil] When dumping section contribs, show the section name.Zachary Turner2017-08-041-40/+75
| | | | llvm-svn: 310128
* Reland "[llvm][llvm-objcopy] Added support for outputting to binary in ↵Petr Hosek2017-08-044-88/+192
| | | | | | | | | | | | | | | | llvm-objcopy" This change adds the "-O binary" flag which directs llvm-objcopy to output the object file to the same format as GNU objcopy does when given the flag "-O binary". This was done by splitting the Object class into two subclasses ObjectELF and ObjectBianry which each output a different format but relay on the same code to read in the Object in Object. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D34480 llvm-svn: 310127
* [llvm-pdbutil] Dump image section headers.Zachary Turner2017-08-044-7/+96
| | | | | | | | | | Image section headers are stored in the DBI stream, but we had no way to dump them. This patch adds dumping support, along with some tests that LLD actually dumps them correctly. Differential Revision: https://reviews.llvm.org/D36332 llvm-svn: 310107
* [Polly][PM] Register polly passes with the opt tool for the new-pm pathPhilip Pfaffe2017-08-041-0/+11
| | | | | | | | | | | | | | Summary: When polly is linked into the tools because of the LLVM_POLLY_LINK_INTO_TOOLS option being set, we need to register its passes with the PassBuilder. Because polly is linked in, we can directly call its callback registration method, which registers the appropriate callbacks with the new PM's PassBuilder. This essentially follows exactly the way it worked with the legacy PM. Reviewers: grosser, chandlerc, bollu Reviewed By: grosser Subscribers: pollydev, llvm-commits Differential Revision: https://reviews.llvm.org/D36273 llvm-svn: 310043
* Revert "[llvm][llvm-objcopy] Added support for outputting to binary in ↵Petr Hosek2017-08-044-192/+88
| | | | | | | | | | llvm-objcopy" This breaks the build on clang-s390x-linux. This reverts commit r310018. llvm-svn: 310026
* Reland "[llvm][llvm-objcopy] Added support for outputting to binary in ↵Petr Hosek2017-08-044-88/+192
| | | | | | | | | | | | | | | | llvm-objcopy" This change adds the "-O binary" flag which directs llvm-objcopy to output the object file to the same format as GNU objcopy does when given the flag "-O binary". This was done by splitting the Object class into two subclasses ObjectELF and ObjectBianry which each output a different format but relay on the same code to read in the Object in Object. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D34480 llvm-svn: 310018
* [llvm-cov] Ignore unclosed line segments when setting line countsVedant Kumar2017-08-042-22/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes a slight change to the way llvm-cov determines line execution counts. If there are multiple line segments on a line, the line count is the max count among the regions which start *and* end on the line. This avoids an issue posed by deferred regions which start on the same line as a terminated region, e.g: if (false) return; //< The line count should be 0, even though a new region //< starts at the semi-colon. foo(); Another change is that counts from line segments which don't correspond to region entries are considered. This enables the first change, and corrects an outstanding issue (see the showLineExecutionCounts.cpp test change). This is related to D35925. Testing: check-profile, llvm-cov lit tests Differential Revision: https://reviews.llvm.org/D36014 llvm-svn: 310012
* [llvm-cov] NFC: make_unique-ify two allocationsVedant Kumar2017-08-041-4/+4
| | | | llvm-svn: 310011
* [llvm-pdbutil] Add an option to only dump specific module indices.Zachary Turner2017-08-033-45/+56
| | | | | | | | | Often something interesting (like a symbol) is in a particular module, and you don't want to dump symbols from all other 300 modules to see the one you want. This adds a -modi option so that we only dump the specified module. llvm-svn: 310000
* [GlobalISel] Make GlobalISel a non-optional library.Quentin Colombet2017-08-031-5/+1
| | | | | | | | With this change, the GlobalISel library gets always built. In particular, this is not possible to opt GlobalISel out of the build using the LLVM_BUILD_GLOBAL_ISEL variable any more. llvm-svn: 309990
* [llvm-pdbutil] Allow diff to force module equivalencies.Zachary Turner2017-08-033-21/+83
| | | | | | | | | | | Sometimes the normal module equivalence detection algorithm doesn't quite work. For example, you might build the same program with MSVC and clang-cl, outputting to different object files, exes, and PDBs, then compare them. If the object files have different names though, then they won't be treated as equivalent. This way we can force specific module indices to be treated as equivalent. llvm-svn: 309983
* Delete Default and JITDefault code modelsRafael Espindola2017-08-034-60/+10
| | | | | | | | | | | | | | | IMHO it is an antipattern to have a enum value that is Default. At any given piece of code it is not clear if we have to handle Default or if has already been mapped to a concrete value. In this case in particular, only the target can do the mapping and it is nice to make sure it is always done. This deletes the two default enum values of CodeModel and uses an explicit Optional<CodeModel> when it is possible that it is unspecified. llvm-svn: 309911
* [Coverage] Add an API to retrive all instantiations of a function (NFC)Vedant Kumar2017-08-024-48/+67
| | | | | | | | | | | | | | | | | | | | | | | | | The CoverageMapping::getInstantiations() API retrieved all function records corresponding to functions with more than one instantiation (e.g template functions with multiple specializations). However, there was no simple way to determine *which* function a given record was an instantiation of. This was an oversight, since it's useful to aggregate coverage information over all instantiations of a function. llvm-cov works around this by building a mapping of source locations to instantiation sets, but this duplicates logic that libCoverage already has (see FunctionInstantiationSetCollector). This change adds a new API, CoverageMapping::getInstantiationGroups(), which returns a list of InstantiationGroups. A group contains records for each instantiation of some particular function, and also provides utilities to get the total execution count within the group, the source location of the common definition, etc. This lets removes some hacky logic in llvm-cov by reusing FunctionInstantiationSetCollector and makes the CoverageMapping API friendlier for other clients. llvm-svn: 309904
OpenPOWER on IntegriCloud