summaryrefslogtreecommitdiffstats
path: root/llvm/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* Try to work around compile errors with older versions of GCC.Adrian Prantl2019-04-221-6/+10
| | | | llvm-svn: 358927
* [dsymutil] Collect parseable Swift interfaces in the .dSYM bundle.Adrian Prantl2019-04-226-49/+175
| | | | | | | | | | | | | | | | | | When a Swift module built with debug info imports a library without debug info from a textual interface, the textual interface is necessary to reconstruct types defined in the library's interface. By recording the Swift interface files in DWARF dsymutil can collect them and LLDB can find them. This patch teaches dsymutil to look for DW_TAG_imported_modules and records all references to parseable Swift ingterfrace files and copies them to a.out.dSYM/Contents/Resources/<Arch>/<ModuleName>.swiftinterface <rdar://problem/49751748> llvm-svn: 358921
* Use llvm::stable_sort. NFCFangrui Song2019-04-227-22/+18
| | | | llvm-svn: 358897
* Attemp get llvm-jitlink building on WindowsNico Weber2019-04-211-6/+4
| | | | | | | | By removing an include of dlfcn.h that looks unused. And clang-format a too-long line while here. llvm-svn: 358864
* [JITLink] Add an option to dump relocated section content.Lang Hames2019-04-211-3/+82
| | | | | | | | The -dump-relocated-section-content option will dump the contents of each section after relocations are applied, and before any checks are run or code executed. llvm-svn: 358863
* [JITLink] Add BinaryFormat to JITLink's dependencies.Lang Hames2019-04-202-1/+3
| | | | | | | | | Hopefully this will fix the missing dependence on llvm::identify_magic that is showing up on some PPC bots. E.g. http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/9617 llvm-svn: 358827
* [JITLink] Add llvm-jitlink subdirectory to tools/LLVMBuild.txtLang Hames2019-04-201-0/+1
| | | | llvm-svn: 358823
* Initial implementation of JITLink - A replacement for RuntimeDyld.Lang Hames2019-04-206-1/+783
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: JITLink is a jit-linker that performs the same high-level task as RuntimeDyld: it parses relocatable object files and makes their contents runnable in a target process. JITLink aims to improve on RuntimeDyld in several ways: (1) A clear design intended to maximize code-sharing while minimizing coupling. RuntimeDyld has been developed in an ad-hoc fashion for a number of years and this had led to intermingling of code for multiple architectures (e.g. in RuntimeDyldELF::processRelocationRef) in a way that makes the code more difficult to read, reason about, extend. JITLink is designed to isolate format and architecture specific code, while still sharing generic code. (2) Support for native code models. RuntimeDyld required the use of large code models (where calls to external functions are made indirectly via registers) for many of platforms due to its restrictive model for stub generation (one "stub" per symbol). JITLink allows arbitrary mutation of the atom graph, allowing both GOT and PLT atoms to be added naturally. (3) Native support for asynchronous linking. JITLink uses asynchronous calls for symbol resolution and finalization: these callbacks are passed a continuation function that they must call to complete the linker's work. This allows for cleaner interoperation with the new concurrent ORC JIT APIs, while still being easily implementable in synchronous style if asynchrony is not needed. To maximise sharing, the design has a hierarchy of common code: (1) Generic atom-graph data structure and algorithms (e.g. dead stripping and | memory allocation) that are intended to be shared by all architectures. | + -- (2) Shared per-format code that utilizes (1), e.g. Generic MachO to | atom-graph parsing. | + -- (3) Architecture specific code that uses (1) and (2). E.g. JITLinkerMachO_x86_64, which adds x86-64 specific relocation support to (2) to build and patch up the atom graph. To support asynchronous symbol resolution and finalization, the callbacks for these operations take continuations as arguments: using JITLinkAsyncLookupContinuation = std::function<void(Expected<AsyncLookupResult> LR)>; using JITLinkAsyncLookupFunction = std::function<void(const DenseSet<StringRef> &Symbols, JITLinkAsyncLookupContinuation LookupContinuation)>; using FinalizeContinuation = std::function<void(Error)>; virtual void finalizeAsync(FinalizeContinuation OnFinalize); In addition to its headline features, JITLink also makes other improvements: - Dead stripping support: symbols that are not used (e.g. redundant ODR definitions) are discarded, and take up no memory in the target process (In contrast, RuntimeDyld supported pointer equality for weak definitions, but the redundant definitions stayed resident in memory). - Improved exception handling support. JITLink provides a much more extensive eh-frame parser than RuntimeDyld, and is able to correctly fix up many eh-frame sections that RuntimeDyld currently (silently) fails on. - More extensive validation and error handling throughout. This initial patch supports linking MachO/x86-64 only. Work on support for other architectures and formats will happen in-tree. Differential Revision: https://reviews.llvm.org/D58704 llvm-svn: 358818
* [llvm-objdump] Fix End in disassemblyObject after rL358806Fangrui Song2019-04-201-3/+3
| | | | llvm-svn: 358809
* [llvm-objdump] Don't disassemble symbols before SectionAddrFangrui Song2019-04-201-4/+6
| | | | | | | | | This was caught by UBSAN tools/llvm-objdump/X86/macho-disassembly-g-dsym.test tools/llvm-objdump/X86/hex-displacement.test llvm-svn: 358806
* [llvm-objdump] Simplify --{start,stop}-addressFangrui Song2019-04-201-23/+13
| | | | llvm-svn: 358803
* [NewPassManager] Adding pass tuning options: loop vectorize.Alina Sbirlea2019-04-191-1/+1
| | | | | | | | | | | | | | | | Summary: Trying to add the plumbing necessary to add tuning options to the new pass manager. Testing with the flags for loop vectorize. Reviewers: chandlerc Subscribers: sanjoy, mehdi_amini, jlebar, steven_wu, dexonsmith, dang, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59723 llvm-svn: 358763
* [dsymutil] DwarfLinker: delete unused parameterFangrui Song2019-04-191-7/+6
| | | | llvm-svn: 358762
* [llvm-symbolizer] Add llvm-addr2lineIgor Kudrin2019-04-192-2/+14
| | | | | | | | | | | | | This adds an alias for llvm-symbolizer with different defaults so that it can be used as a drop-in replacement for GNU's addr2line. If a substring "addr2line" is found in the tool's name: * it defaults "-i", "-f" and "-C" to OFF; * it uses "--output-style=GNU" by default. Differential Revision: https://reviews.llvm.org/D60067 llvm-svn: 358749
* [llvm-symbolizer] Unhide and document the "-output-style" optionIgor Kudrin2019-04-191-1/+1
| | | | | | | | | With the latest changes, the option gets useful for users of llvm-symbolizer, not only for the upcoming llvm-addr2line. Differential Revision: https://reviews.llvm.org/D60816 llvm-svn: 358748
* [llvm-symbolizer] Make the output with -output-style=GNU closer to addr2line'sIgor Kudrin2019-04-191-1/+13
| | | | | | | | | | | | | | | | This patch addresses two differences in the output of llvm-symbolizer and GNU's addr2line: * llvm-symbolizer prints an empty line after the report for an address. * With "-f -i=0", llvm-symbolizer replaces the name of an inlined function with the name from the symbol table, i. e., the top caller function in the inlining chain. addr2line preserves the name of the inlined function. Differential Revision: https://reviews.llvm.org/D60770 llvm-svn: 358747
* [llvm-objcopy] Add -B mipsJordan Rupprecht2019-04-181-0/+1
| | | | llvm-svn: 358667
* [yaml2elf/obj2yaml] - Allow normal parsing/dumping of the .rela.dyn sectionGeorge Rimar2019-04-181-2/+3
| | | | | | | | | | | | | | | .rela.dyn is a section that has sh_info normally set to zero. And Info is an optional field in the description of the relocation section in YAML. But currently, yaml2obj would fail to produce the object when Info is not explicitly listed. The patch fixes the issue. Differential revision: https://reviews.llvm.org/D60820 llvm-svn: 358656
* [llvm-objcopy][llvm-strip] Add switch to allow removing referenced sectionsJames Henderson2019-04-188-43/+84
| | | | | | | | | | | | | | | | | | | | llvm-objcopy currently emits an error if a section to be removed is referenced by another section. This is a reasonable thing to do, but is different to GNU objcopy. We should allow users who know what they are doing to have a way to produce the invalid ELF. This change adds a new switch --allow-broken-links to both llvm-strip and llvm-objcopy to do precisely that. The corresponding sh_link field is then set to 0 instead of an error being emitted. I cannot use llvm-readelf/readobj to test the link fields because they emit an error if any sections, like the .dynsym, cannot be properly loaded. Reviewed by: rupprecht, grimar Differential Revision: https://reviews.llvm.org/D60324 llvm-svn: 358649
* [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbolsSteven Wu2019-04-171-24/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Reapply r357931 with fixes to ThinLTO testcases and llvm-lto tool. ThinLTOCodeGenerator currently does not preserve llvm.used symbols and it can internalize them. In order to pass the necessary information to the legacy ThinLTOCodeGenerator, the input to the code generator is rewritten to be based on lto::InputFile. Now ThinLTO using the legacy LTO API will requires data layout in Module. "internalize" thinlto action in llvm-lto is updated to run both "promote" and "internalize" with the same configuration as ThinLTOCodeGenerator. The old "promote" + "internalize" option does not produce the same output as ThinLTOCodeGenerator. This fixes: PR41236 rdar://problem/49293439 Reviewers: tejohnson, pcc, kromanova, dexonsmith Reviewed By: tejohnson Subscribers: ormris, bd1976llvm, mehdi_amini, inglorion, eraman, hiraditya, jkorous, dexonsmith, arphaman, dang, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60421 llvm-svn: 358601
* Change some llvm::{lower,upper}_bound to llvm::bsearch. NFCFangrui Song2019-04-171-22/+19
| | | | llvm-svn: 358564
* [llvm-objcopy] Support full list of bfd targets that lld uses.Jordan Rupprecht2019-04-172-23/+44
| | | | | | | | | | | | | | | | | | | | | Summary: This change takes the full list of bfd targets that lld supports (see `ScriptParser.cpp`), including generic handling for `*-freebsd` targets (which uses the same settings but with a FreeBSD OSABI). In particular this adds mips support for `--output-target` (but not yet via `--binary-architecture`). lld and llvm-objcopy use their own different custom data structures, so I'd prefer to check this in as-is (add support directly in llvm-objcopy, including all the test coverage) and do a separate NFC patch(s) that consolidate the two by putting this mapping into libobject. See [[ https://bugs.llvm.org/show_bug.cgi?id=41462 | PR41462 ]]. Reviewers: jhenderson, jakehehrlich, espindola, alexshap, arichardson Reviewed By: arichardson Subscribers: fedor.sergeev, emaste, sdardis, krytarowski, atanasyan, llvm-commits, MaskRay, arichardson Tags: #llvm Differential Revision: https://reviews.llvm.org/D60773 llvm-svn: 358562
* [MCA] Moved the bottleneck analysis to its own file. NFCIAndrea Di Biagio2019-04-176-154/+260
| | | | llvm-svn: 358554
* llvm-undname: Add a -raw-file flag to pass a raw buffer to microsoftDemangleNico Weber2019-04-161-4/+23
| | | | | | | | | | | | | | The default handling splits input into lines. Since llvm-microsoft-demangle-fuzzer doesn't do this, oss-fuzz produces inputs that only trigger crashes if the input isn't split into lines. This adds a hidden flag -raw-file which passes file contents to microsoftDemangle() in the same way the fuzzer does, for reproducing oss-fuzz reports. Also change llvm-undname to have a non-0 exit code for invalid symbols. Differential Revision: https://reviews.llvm.org/D60771 llvm-svn: 358485
* [llvm-objdump] Align instructions to a tab stop in disassembly outputFangrui Song2019-04-161-5/+18
| | | | | | | | | | | | | | | | | | | | | | | This relands D60376/rL358405, with the difference: sed 'y/\t/ /' -> tr '\t' ' ' BSD sed doesn't support escape characters for the 'y' command. I didn't use it in rL358405 because it was not listed at https://llvm.org/docs/GettingStarted.html#software but it should be available. Original description: In GNU objdump, -w/--wide aligns instructions in the disassembly output. This patch does the same to llvm-objdump. However, we always use the wide format (-w/--wide is ignored), because the narrow format (instructions are misaligned) is probably not very useful. In llvm-readobj, we made a similar decision: always use the wide format, accept but ignore -W/--wide. To save some columns, we change the tab before hex bytes (controlled by --[no-]show-raw-insn) to a space. llvm-svn: 358474
* [llvm-objdump] Simplify PrintHelpMessage() logicFangrui Song2019-04-161-28/+9
| | | | | | | | This relands rL358418. It missed one test that should also use -macho Note, all the other -private-header -exports-trie tests are used together with -macho. llvm-svn: 358472
* Revert r358405: "[llvm-objdump] Align instructions to a tab stop in ↵Alex Lorenz2019-04-151-18/+5
| | | | | | | | | disassembly output" The test fails on darwin due to a sed error: sed: 1: "y/\t/ /": transform strings are not the same length llvm-svn: 358459
* Revert r358418: "[llvm-objdump] Simplify PrintHelpMessage() logic"Alex Lorenz2019-04-151-9/+28
| | | | | | | This reverts commit r358418 as it broke `test/Object/objdump-export-list` on Darwin. llvm-svn: 358443
* [CommandLineParser] Add DefaultOption flagDon Hinton2019-04-151-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add DefaultOption flag to CommandLineParser which provides a default option or alias, but allows users to override it for some other purpose as needed. Also, add `-h` as a default alias to `-help`, which can be seamlessly overridden by applications like llvm-objdump and llvm-readobj which use `-h` as an alias for other options. (relanding after revert, r358414) Added DefaultOptions.clear() to reset(). Reviewers: alexfh, klimek Reviewed By: klimek Subscribers: kristina, MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59746 llvm-svn: 358428
* [llvm-objdump] Simplify PrintHelpMessage() logicFangrui Song2019-04-151-28/+9
| | | | llvm-svn: 358418
* [llvm-objdump] Wrap things in namespace llvmFangrui Song2019-04-155-115/+109
| | | | llvm-svn: 358417
* [llvm-objdump] Delete unused forward declarationsFangrui Song2019-04-151-2/+0
| | | | llvm-svn: 358416
* [llvm-objdump] Reorganize cl::opt variables and move Mach-O specifics to ↵Fangrui Song2019-04-153-294/+284
| | | | | | MachODump.cpp llvm-svn: 358415
* Revert r358337: "[CommandLineParser] Add DefaultOption flag"Ilya Biryukov2019-04-151-0/+7
| | | | | | | The change causes test failures under asan. Reverting to unbreak our integrate. llvm-svn: 358414
* [llvm-objdump] Align instructions to a tab stop in disassembly outputFangrui Song2019-04-151-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In GNU objdump, -w/--wide aligns instructions in the disassembly output. This patch does the same to llvm-objdump. However, we always use the wide format (-w/--wide is ignored), because the narrow format (instructions are misaligned) is probably not very useful. In llvm-readobj, we made a similar decision: always use the wide format, accept but ignore -W/--wide. To save some columns, we change the tab before hex bytes (controlled by --[no-]show-raw-insn) to a space. Reviewers: rupprecht, jhenderson, grimar Reviewed By: jhenderson Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60376 llvm-svn: 358405
* [llvm-readelf] Correctly dump symbols whose section id is SHN_XINDEXEugene Leviant2019-04-151-3/+4
| | | | | | Differential revision: https://reviews.llvm.org/D60614 llvm-svn: 358396
* [llvm-readobj] Reapply: Improve error message for --string-dumpStephen Tozer2019-04-152-16/+11
| | | | | | | | | | | | | | | | | This is a resubmission of a previous patch that caused test failures, with the fixes for the relevant tests included. Fixes bug 40630: https://bugs.llvm.org/show_bug.cgi?id=40630 This patch changes the error message when the section specified by --string-dump cannot be found by including the name of the section in the error message and changing the prefix text to not imply that the file itself was invalid. As part of this change some uses of std::error_code have been replaced with the llvm Error class to better encapsulate the error info (rather than passing File strings around), and the WithColor class replaces string literal error prefixes. llvm-svn: 358395
* [CommandLineParser] Add DefaultOption flagDon Hinton2019-04-131-7/+0
| | | | | | | | | | | | | | | | | | | | | | Summary: Add DefaultOption flag to CommandLineParser which provides a default option or alias, but allows users to override it for some other purpose as needed. Also, add `-h` as a default alias to `-help`, which can be seamlessly overridden by applications like llvm-objdump and llvm-readobj which use `-h` as an alias for other options. Reviewers: alexfh, klimek Reviewed By: klimek Subscribers: MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59746 llvm-svn: 358337
* [StackMaps] Add location size to llvm-readobj -stackmap outputPhilip Reames2019-04-131-6/+6
| | | | | | | | | | | | | | | | The size field of a location can be different for each entry, so it is useful to have this displayed in the output of llvm-readobj -stackmap. Below is an example of how the output would look: Record ID: 2882400000, instruction offset: 16 3 locations: #1: Constant 1, size: 8 #2: Constant 2, size: 8 #3: Constant 3, size: 8 0 live-outs: [ ] Patch By: jacob.hughes@kcl.ac.uk (with heavy modification by me) Differential Revision: https://reviews.llvm.org/D59169 llvm-svn: 358324
* [llvm-readobj] Minor style tweak for consistency sake [NFC]Philip Reames2019-04-132-4/+4
| | | | llvm-svn: 358323
* [StackMaps] Remove format version from the class name [NFC]Philip Reames2019-04-133-5/+5
| | | | | | Motivation is to reduce silly diffs when we change the format. For instance, this causes most of D59020 to disappear. llvm-svn: 358322
* [WebAssembly] Add DataCount section to object filesThomas Lively2019-04-123-5/+21
| | | | | | | | | | | | | | | | | | | Summary: This ensures that object files will continue to validate as WebAssembly modules in the presence of bulk memory operations. Engines that don't support bulk memory operations will not recognize the DataCount section and will report validation errors, but that's ok because object files aren't supposed to be run directly anyway. Reviewers: aheejin, dschuff, sbc100 Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60623 llvm-svn: 358315
* Simplify decoupling between RuntimeDyld/RuntimeDyldChecker, add 'got_addr' util.Lang Hames2019-04-121-86/+93
| | | | | | | | | | | | | | | | | | | | | | | | | This patch reduces the number of functions in the interface between RuntimeDyld and RuntimeDyldChecker by combining "GetXAddress" and "GetXContent" functions into "GetXInfo" functions that return a struct describing both the address and content. The GetStubOffset function is also replaced with a pair of utilities, GetStubInfo and GetGOTInfo, that fit the new scheme. For RuntimeDyld both of these functions will return the same result, but for the new JITLink linker (https://reviews.llvm.org/D58704) these will provide the addresses of PLT stubs and GOT entries respectively. For JITLink's use, a 'got_addr' utility has been added to the rtdyld-check language, and the syntax of 'got_addr' and 'stub_addr' has been changed: both functions now take two arguments, a 'stub container name' and a target symbol name. For llvm-rtdyld/RuntimeDyld the stub container name is the object file name and section name, separated by a slash. E.g.: rtdyld-check: *{8}(stub_addr(foo.o/__text, y)) = y For the upcoming llvm-jitlink utility, which creates stubs on a per-file basis rather than a per-section basis, the container name is just the file name. E.g.: jitlink-check: *{8}(got_addr(foo.o, y)) = y llvm-svn: 358295
* [llvm-objcopy] Fill .symtab_shndx section correctlyEugene Leviant2019-04-122-12/+31
| | | | | | Differential revision: https://reviews.llvm.org/D60555 llvm-svn: 358278
* [llvm-readobj] Change variables' name to match LLVM-style. NFC.Xing GUO2019-04-121-37/+41
| | | | llvm-svn: 358259
* Revert "Use llvm::lower_bound. NFC"Ali Tamur2019-04-111-7/+14
| | | | | | | | | This reverts commit rL358161. This patch have broken the test: llvm/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s llvm-svn: 358199
* Make llvm-nm -help great againSerge Guelton2019-04-111-33/+58
| | | | | | | | | Only display help from the llvm-nm category instead of all llvm options, which make it much more usable. There's still an issue with -s, which is probably a bug in llvm::cl and worth another commit. Differential Revision: https://reviews.llvm.org/D60411 llvm-svn: 358185
* Use llvm::lower_bound. NFCFangrui Song2019-04-111-14/+7
| | | | llvm-svn: 358161
* [llvm-exegesis] Fix serialization/deserialization of special NoRegister ↵Roman Lebedev2019-04-111-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | register (PR41448) Summary: A *lot* of instructions have this special register. It seems this never really worked, but i finally noticed it only because it happened to break for `CMOV16rm` instruction. We serialized that register as "" (empty string), which is naturally 'ignored' during deserialization, so we re-create a `MCInst` with too few operands. And when we then happened to try to resolve variant sched class for this mis-serialized instruction, and the variant predicate tried to read an operand that was out of bounds since we got less operands, we crashed. Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=41448 | PR41448 ]]. Reviewers: craig.topper, courbet Reviewed By: courbet Subscribers: tschuett, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60517 llvm-svn: 358153
* [llvm-exegesis] Pacify bots - don't std::move() - prevents copy elisionRoman Lebedev2019-04-101-2/+2
| | | | llvm-svn: 358079
OpenPOWER on IntegriCloud