summaryrefslogtreecommitdiffstats
path: root/llvm/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-objcopy][MachO] Implement --strip-debugFangrui Song2019-11-211-3/+3
| | | | | | Reviewed By: alexshap Differential Revision: https://reviews.llvm.org/D70476
* [llvm-objcopy][MachO] Fix symbol order in the symbol tableFangrui Song2019-11-211-3/+5
| | | | | | | | | | Only consider isUndefinedSymbol() when the symbol is not local. This fixes an assert failure when copying the symbol table, if a n_type=0x20 symbol is followed by a n_type=0x64 symbol. Reviewed By: alexshap, seiya Differential Revision: https://reviews.llvm.org/D70475
* Reland 9f3fdb0d7fab: [Driver] Use VFS to check if sanitizer blacklists existIlya Biryukov2019-11-213-4/+9
| | | | | | | With updates to various LLVM tools that use SpecialCastList. It was tempting to use RealFileSystem as the default, but that makes it too easy to accidentally forget passing VFS in clang code.
* dwarfdump --statistics: Use new location list apiPavel Labath2019-11-211-38/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch removes manual location list handling in the statistics code and replaces it with the new DWARFDie api, which provides access to a "cooked" location list. This has the following effects: - the code now properly handles split-dwarf location lists - it will automatically support dwarf5 location lists once support for those is added - it properly handles location lists with base address selection entries - it fixes a bug where the location list code was using the first DW_AT_ranges range as a "base address" of the compile unit (it should have used DW_AT_low_pc instead. The effect of this was that the computation of the start address of a variable in its scope was broken for these kinds of compile units. This only manifested itself on linked files, since in object files the first DW_AT_ranges range normally starts at 0. Since pretty much every kind of location list was broken in some way, it's hard to verify that the new implementation is correct -- the output will be different in all non-trivial cases, and mostly with good reason. Most of the existing statistics tests continue to pass though, and a visual inspection of the statistics for non-trivial inputs shows that the data is more "reasonable" now. I have updated the "dwo statistics" test to include the new numbers, as the previous ones were completely bogus, and I have added a targeted test for the "base address" bug. Reviewers: dblaikie, cmtice, vsk Subscribers: aprantl, SouraVX, JDevlieghere, djtodoro, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70444
* [llvm-readobj] - Improve dumping of the SHT_LLVM_LINKER_OPTIONS sections.Georgii Rymar2019-11-201-6/+26
| | | | | | | I've added a few tests that shows how the current code could overrun the section data buffer while dumping. I had to rewrite the code to fix this. Differential revision: https://reviews.llvm.org/D70112
* [llvm-readobj/llvm-readelf] - Improve dumping of versioning sections.Georgii Rymar2019-11-201-2/+2
| | | | | | | | | | | | | Our elf-versioninfo.test is not perfect. It does not properly test how flags are dumped and also we have a bug: they are dumped as enums in LLVM style now, i.e not dumped properly. GNU style uses a `versionFlagToString` method to build a string from flags which seems is consistent with GNU readelf. In this patch I fixed the issues mentioned. Differential revision: https://reviews.llvm.org/D70399
* Introduce llvm-install-name-toolAlexander Shaposhnikov2019-11-1910-20/+186
| | | | | | | | | | This diff adds a new "driver" for llvm-objcopy which is supposed to emulate the behavior of install-name-tool. This is a recommit of b5913e6 with ubsan, test dependencies issues fixed. Differential revision: https://reviews.llvm.org/D69146 Test plan: make check-all
* [LTO][Legacy] Add API for passing LLVM options separatelyFrancis Visoiu Mistrih2019-11-192-1/+13
| | | | | | | | | | | | In order to correctly pass options to LLVM, including options containing spaces which are used as delimiters for multiple options in lto_codegen_debug_options, add a new API: lto_codegen_debug_options_array. Unfortunately, tools/lto has no testing infrastructure yet, so there are no tests associated with this patch. Differential Revision: https://reviews.llvm.org/D70463
* Revert "Introduce llvm-install-name-tool"Alexander Shaposhnikov2019-11-1910-186/+20
| | | | | This temporarily reverts the commit 88f00aef684ff84a6494e1f17d5466c5678f703d. The change broke the buildbot http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/36836
* Introduce llvm-install-name-toolAlexander Shaposhnikov2019-11-1910-20/+186
| | | | | | | | | | This diff adds a new "driver" for llvm-objcopy which is supposed to emulate the behavior of install-name-tool. This is a recommit of b5913e6d2 with ubsan issues fixed. Differential revision: https://reviews.llvm.org/D69146 Test plan: make check-all
* [llvm-objdump] Print relocation addends in hexadecimalDavid Bozier2019-11-191-3/+6
| | | | | | | | | | | | | | Summary: Matches GNU objdump. Makes debugging easier for me as I'm working out addresses from symbol+addend, so it would be good to be calculating in a single format. Reviewers: MaskRay, grimar, jhenderson, bd1976llvm Reviewed By: jhenderson Subscribers: sdardis, jrtc27, atanasyan, rupprecht, seiya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69997
* bugpoint: Add option to disable attribute removalMatt Arsenault2019-11-191-23/+29
| | | | | | | This takes a long time and never reduces anything useful for me (e.g. I've been waiting for 3 hours on a testcase and it hasn't found any attributes to remove yet). This should probably start by assuming no attributes matter, and adding back.
* [llvm-cxxfilt] Improve strip-underscore behaviorSteven Wu2019-11-181-1/+20
| | | | | | | | | | | | | | | | | | | | Summary: For platform that uses macho format, c++filt should be stripping the leading underscore by default. Introduce the binutil compatible "-n" option to control strip-undercore behaivor together with the existing "-_" option and fallback to system default if none of them are set. rdar://problem/57173514 Reviewers: compnerd, erik.pilkington, dexonsmith, mattd Reviewed By: compnerd, erik.pilkington Subscribers: jkorous, ributzka, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70250
* Revert "[DWARF5]Addition of alignment atrribute in typedef DIE."Sam McCall2019-11-181-1/+1
| | | | | This reverts commit 423f541c1a322963cf482683fe9777ef0692082d, which breaks llvm-c ABI.
* Fix cppcheck shadow variable warning. NFC.Simon Pilgrim2019-11-181-3/+3
|
* llvm-objcopy - fix uninitialized variable warnings. NFC.Simon Pilgrim2019-11-182-18/+18
|
* llvm-rc - fix uninitialized variable warnings. NFC.Simon Pilgrim2019-11-182-2/+2
|
* [DWARF5]Addition of alignment atrribute in typedef DIE.Sourabh Singh Tomar2019-11-161-1/+1
| | | | | | | | | | | | This patch, adds support for DW_AT_alignment[DWARF5] attribute, to be emitted with typdef DIE. When explicit alignment is specified. Patch by Awanish Pandey <Awanish.Pandey@amd.com> Reviewers: aprantl, dblaikie, jini.susan.george, SouraVX, alok, deadalinx Differential Revision: https://reviews.llvm.org/D70111
* [llvm-cov] Fix illegal cast from uint64_t to int64_tSajjad Mirza2019-11-151-3/+13
| | | | | | | | | | | | | | | | | Summary: Counters are stored as uint64_t in the coverage mapping, but exporting in JSON requires signed integers. Clamp the values to the smaller range to make the conversion safe. Reviewers: Dor1s, vsk Reviewed By: Dor1s Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70200
* [llvm-objcopy][MachO] Implement --redefine-sym and --redefine-symsFangrui Song2019-11-152-3/+15
| | | | | | | | | | Similar to D46029 (ELF) and D70036 (COFF), but for MachO. Note, when --strip-symbol (not implemented for MachO) is also specified, --redefine-sym executes before --strip-symbol. Reviewed By: jhenderson, seiya Differential Revision: https://reviews.llvm.org/D70212
* DWARFDebugLoc(v4): Add an incremental parsing functionPavel Labath2019-11-151-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a visitLocationList function to the DWARF v4 location lists, similar to what already exists for DWARF v5. It follows the approach outlined in previous patches (D69672), where the parsed form is always stored in the DWARF v5 format, which makes it easier for generic code to be built on top of that. v4 location lists are "upgraded" during parsing, and then this upgrade is undone while dumping. Both "inline" and section-based dumping is rewritten to reuse the existing "generic" location list dumper. This means that the output format is consistent for all location lists (the only thing one needs to implement is the function which prints the "raw" form of a location list), and that debug_loc dumping correctly processes base address selection entries, etc. The previous existing debug_loc functionality (e.g., parseOneLocationList) is rewritten on top of the new API, but it is not removed as there is still code which uses them. This will be done in follow-up patches, after I build the API to access the "interpreted" location lists in a generic way (as that is what those users really want). Reviewers: dblaikie, probinson, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69847
* [llvm-objcopy][MachO] Implement --remove-sectionSeiya Nuta2019-11-151-5/+12
| | | | | | | | | | | | Reviewers: alexshap, rupprecht, jhenderson Reviewed By: rupprecht, jhenderson Subscribers: jakehehrlich, abrachet, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66282
* [llvm-dis] Fix the disable-output flagMatthew Voss2019-11-141-1/+1
| | | | | | My change in llvmorg-10-init-9872-g141bb5f308f broke this flag. Thanks to @rsmith for the bug.
* Add support for multi-module bitcode files to llvm-disMatthew Voss2019-11-141-41/+59
| | | | | | | | | | | | | | Summary: This change allows llvm-dis to disassemble multi-module bitcode files, including the associated module summary. Reviewers: tejohnson, pcc, mehdi_amini Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70153
* [llvm-objcopy][COFF] Add support for extended relocation tablesSergey Dmitriev2019-11-142-6/+20
| | | | | | | | | | | | | | Summary: This patch adds support for COFF objects with extended relocation tables to the llvm-objcopy tool. Reviewers: jhenderson, MaskRay, mstorsjo, alexshap, rupprecht Reviewed By: mstorsjo Subscribers: jakehehrlich, abrachet, seiya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70205
* Move CodeGenFileType enum to Support/CodeGen.hReid Kleckner2019-11-134-11/+11
| | | | | | | Avoids the need to include TargetMachine.h from various places just for an enum. Various other enums live here, such as the optimization level, TLS model, etc. Data suggests that this change probably doesn't matter, but it seems nice to have anyway.
* Sink all InitializePasses.h includesReid Kleckner2019-11-133-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This file lists every pass in LLVM, and is included by Pass.h, which is very popular. Every time we add, remove, or rename a pass in LLVM, it caused lots of recompilation. I found this fact by looking at this table, which is sorted by the number of times a file was changed over the last 100,000 git commits multiplied by the number of object files that depend on it in the current checkout: recompiles touches affected_files header 342380 95 3604 llvm/include/llvm/ADT/STLExtras.h 314730 234 1345 llvm/include/llvm/InitializePasses.h 307036 118 2602 llvm/include/llvm/ADT/APInt.h 213049 59 3611 llvm/include/llvm/Support/MathExtras.h 170422 47 3626 llvm/include/llvm/Support/Compiler.h 162225 45 3605 llvm/include/llvm/ADT/Optional.h 158319 63 2513 llvm/include/llvm/ADT/Triple.h 140322 39 3598 llvm/include/llvm/ADT/StringRef.h 137647 59 2333 llvm/include/llvm/Support/Error.h 131619 73 1803 llvm/include/llvm/Support/FileSystem.h Before this change, touching InitializePasses.h would cause 1345 files to recompile. After this change, touching it only causes 550 compiles in an incremental rebuild. Reviewers: bkramer, asbirlea, bollu, jdoerfert Differential Revision: https://reviews.llvm.org/D70211
* Add -disable-builtin option to optDimitry Andric2019-11-131-0/+19
| | | | | | | | | | | | | | | | | | Summary: The option allows to disable specific target library builtin functions, instead of -disable-simplify-libcalls, which disables all of them. This is a prerequisite for D70143, which fixes PR43081. Reviewers: xbolva00, spatel, jdoerfert, efriedma Reviewed By: efriedma Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70193
* [llvm-bcanalyzer] Don't dump the contents if -dump is not passedFrancis Visoiu Mistrih2019-11-131-2/+3
| | | | | | With all the previous refactorings this slipped through and now we always dump the contents of the bitcode files, even if -dump is not passed.
* [llvm-objcopy][COFF] Implement --redefine-sym and --redefine-symsFangrui Song2019-11-121-4/+9
| | | | | | | | | | | | | The parsing error tests in ELF/redefine-symbols.test are not specific to ELF. Move them to redefine-symbols.test. Add COFF/redefine-symbols.test for COFF specific tests. Also fix the documentation regarding --redefine-syms: the old and new names are separated by whitespace, not an equals sign. Reviewed By: mstorsjo Differential Revision: https://reviews.llvm.org/D70036
* [Examples] Add IRTransformations directory to examples.Florian Hahn2019-11-122-0/+12
| | | | | | | | | | | | | | | | | | | This patch adds a new IRTransformations directory to llvm/examples/. This is intended to serve as a new home for example transformations/analysis code used by various tutorials. If LLVM_BUILD_EXAMPLES is enabled, the ExamplesIRTransforms library is linked into the opt binary and the example passes become available. To start off with, it contains the CFG simplifications used in the IR part of the 'Getting Started With LLVM: Basics' tutorial at the US LLVM Developers Meeting 2019. Reviewers: paquette, jfb, meikeb, lhames, kbarton Reviewed By: paquette Differential Revision: https://reviews.llvm.org/D69416
* [yaml2obj/obj2yaml] - Add support for SHT_LLVM_LINKER_OPTIONS sections.Georgii Rymar2019-11-121-0/+41
| | | | | | | SHT_LLVM_LINKER_OPTIONS section contains pairs of null-terminated strings. This patch adds support for them. Differential revision: https://reviews.llvm.org/D69895
* [yaml2obj] - Add a way to describe the custom data that is not part of an ↵Georgii Rymar2019-11-111-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | output section. Currently there is no way to describe the data that is not a part of an output section. It can be a data used to align sections or to fill the gaps with something, or another kind of custom data. In this patch I suggest a way to describe it. It looks like that: ``` Sections: - Type: CustomFiller Pattern: "CCDD" Size: 4 - Name: .bar Type: SHT_PROGBITS Content: "FF" ``` I.e. I've added a kind of synthetic section with a synthetic type "CustomFiller". In the code it is called a "SyntheticFiller", which is "a synthetic section which might be used to write the custom data around regular output sections. It does not present in the sections header table, but it might affect the output file size and program headers produced. Think about it as about piece of data." `SyntheticFiller` currently has a `Pattern` field and a `Size` field + an optional `Name`. When written, `Size` of bytes in the output will be filled with a `Pattern`. It is possible to reference a named filler it by name from the program headers description, just like any other normal section. Differential revision: https://reviews.llvm.org/D69709
* llvm-exegesis - fix shadow variable warnings. NFCI.Simon Pilgrim2019-11-092-5/+5
|
* llvm-ranlib/nm: Don't print usage message except for usage errorsSam Clegg2019-11-081-26/+32
| | | | | | | Also, fix a bug in ranlib where it didn't correctly detect being run without any argument and would try to operate on the empty string. Differential Revision: https://reviews.llvm.org/D70021
* Obj2YamlError - fix uninitialized variable warning. NFCI.Simon Pilgrim2019-11-081-1/+1
|
* [debugify] Move the Debugify pass from tools/opt to lib/Transform/UtilsDaniel Sanders2019-11-075-540/+23
| | | | | | | | | | | | | | | | | | | Summary: I need to make use of this pass from a driver program that isn't opt. Therefore this patch moves this pass into the LLVM library so that it is available for use elsewhere. There was one function I kept in tools/opt which is exportDebugifyStats() this is because it's serializing the statistics into a human readable format and this seemed more in keeping with opt than a library function Reviewers: vsk, aprantl Subscribers: mgorny, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69926
* [llvm-ar] Support verbose mode for operation 'x'Fangrui Song2019-11-071-1/+5
| | | | | | Reviewed By: jhenderson, kongyi Differential Revision: https://reviews.llvm.org/D69911
* Using crtp to refactor the xcoff section headerdiggerlin2019-11-071-11/+2
| | | | | | | | | | | | | SUMMARY: According to https://reviews.llvm.org/D68575#inline-617586, Create a NFC patch for it. Using crtp to refactor the xcoff section header Move the define of SectionFlagsReservedMask and SectionFlagsTypeMask from XCOFFDumper.cpp to XCOFFObjectFile.h Reviewers: hubert.reinterpretcast,jasonliu Subscribers: rupprecht, seiyai,hiraditya Differential Revision: https://reviews.llvm.org/D69131
* Revert "Introduce llvm-install-name-tool"Alexander Shaposhnikov2019-11-068-170/+8
| | | | This reverts commit b5913e6d2f6d13fb753df701619731ca11936316.
* Introduce llvm-install-name-toolAlexander Shaposhnikov2019-11-068-8/+170
| | | | | | | | | This diff adds a new "driver" for llvm-objcopy which is supposed to emulate the behavior of install-name-tool. Differential revision: https://reviews.llvm.org/D69146 Test plan: make check-all
* [NFC] Add SUPPORT_PLUGINS to add_llvm_executable()David Tenty2019-11-063-9/+3
| | | | | | | | | | | | | | | | | | | Summary: this allows us to move logic about when it is appropriate set LLVM_NO_DEAD_STRIP out of each tool and into add_llvm_executable, which will enable future platform specific handling. This is a follow on to the reverted D69356 Reviewers: hubert.reinterpretcast, beanz, lhames Reviewed By: beanz Subscribers: mgorny, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69638
* [llvm-objcopy][ELF] Implement --only-keep-debugFangrui Song2019-11-054-25/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --only-keep-debug produces a debug file as the output that only preserves contents of sections useful for debugging purposes (the binutils implementation preserves SHT_NOTE and non-SHF_ALLOC sections), by changing their section types to SHT_NOBITS and rewritting file offsets. See https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html The intended use case is: ``` llvm-objcopy --only-keep-debug a a.dbg llvm-objcopy --strip-debug a b llvm-objcopy --add-gnu-debuglink=a.dbg b ``` The current layout algorithm is incapable of deleting contents and shrinking segments, so it is not suitable for implementing the functionality. This patch adds a new algorithm which assigns sh_offset to sections first, then modifies p_offset/p_filesz of program headers. It bears a resemblance to lld/ELF/Writer.cpp. Reviewed By: jhenderson, jakehehrlich Differential Revision: https://reviews.llvm.org/D67137
* [llvm-objcopy][ELF] Add OriginalType & OriginalFlagsFangrui Song2019-11-052-23/+26
| | | | | | | | | | | `llvm::objcopy::elf::*Section::classof` matches Type and Flags, yet Type and Flags are mutable (by setSectionFlagsAndTypes and upcoming --only-keep-debug feature). Add OriginalType & OriginalFlags to be used in classof, to prevent classof results from changing. Reviewed By: jakehehrlich, jhenderson, alexshap Differential Revision: https://reviews.llvm.org/D69739
* [IR] Add Freeze instructionaqjune2019-11-051-0/+5
| | | | | | | | | | | | | | | | | | Summary: - Define Instruction::Freeze, let it be UnaryOperator - Add support for freeze to LLLexer/LLParser/BitcodeReader/BitcodeWriter The format is `%x = freeze <ty> %v` - Add support for freeze instruction to llvm-c interface. - Add m_Freeze in PatternMatch. - Erase freeze when lowering IR to SelDag. Reviewers: deadalnix, hfinkel, efriedma, lebedev.ri, nlopes, jdoerfert, regehr, filcab, delcypher, whitequark Reviewed By: lebedev.ri, jdoerfert Subscribers: jfb, kristof.beyls, hiraditya, lebedev.ri, steven_wu, dexonsmith, xbolva00, delcypher, spatel, regehr, trentxintong, vsk, filcab, nlopes, mehdi_amini, deadalnix, llvm-commits Differential Revision: https://reviews.llvm.org/D29011
* Fix clone_constant_impl to correctly deal with null pointersaqjune2019-11-051-0/+7
| | | | | | | | | | | | | | | | | | | | | Summary: This patch resolves llvm-c-test's following error ``` LLVM ERROR: LLVMGetValueKind returned incorrect type ``` which arises when the input bitcode contains a null pointer. Reviewers: jdoerfert, CodaFi, deadalnix Reviewed By: jdoerfert Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68928
* [llvm-readobj] Change errors to warnings for symbol section name dumpingJames Henderson2019-11-041-15/+53
| | | | | | | | | | | | | | | Also only print each such warning once. LLVM-style output will now print "<?>" for sections it cannot identify, e.g. because the section index is invalid. GNU output continues to print the raw index. In both cases where the st_shndx value is SHN_XINDEX and the index cannot be looked up in the SHT_SYMTAB_SHNDX section (e.g. because it is missing), the symbol is printed like other symbols with st_shndx >= SHN_LORESERVE. Reviewed by: grimar, MaskRay Differential Revision: https://reviews.llvm.org/D69671
* Fix uninitialized variable warning. NFCI.Simon Pilgrim2019-11-021-1/+1
|
* [dsymutil] Add support for linking remarksFrancis Visoiu Mistrih2019-11-015-1/+132
| | | | | | | | | | | | | | | | | | | | This adds support to dsymutil for linking remark files and placing them in the final .dSYM bundle. The result will be placed in: * a.out.dSYM/Contents/Resources/Remarks/a.out or * a.out.dSYM/Contents/Resources/Remarks/a.out-<arch> for universal binaries When multi-threaded, this runs a third thread which loops over all the object files and parses remarks as it finds __remarks sections. Testing this involves running dsymutil on pre-built binaries and object files, then running llvm-bcanalyzer on the final result to check for remarks. Differential Revision: https://reviews.llvm.org/D69142
* [dsymutil] Add DW_TAG_common_block to dieNeedsChildrenToBeMeaningfulJonas Devlieghere2019-11-011-3/+4
| | | | | | | | Ensure we walk the children of common blocks when deciding what DIEs to keep. Otherwise we might incorrectly discard them leading to missing variables in the linked debug info. This also sorts the list of DW_TAGs alphabetically.
OpenPOWER on IntegriCloud