summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil/dsymutil.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [dsymutil] Add support for linking remarksFrancis Visoiu Mistrih2019-11-011-0/+16
| | | | | | | | | | | | | | | | | | | | 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] Print warning/error for unknown/missing arguments.Jonas Devlieghere2019-10-161-0/+10
| | | | | | | | | After changing dsymutil to use libOption, we lost error reporting for missing required arguments (input files). Additionally, we stopped complaining about unknown arguments. This patch fixes both and adds a test. llvm-svn: 375044
* [dsymutil] Fix stack-use-after-scopeJonas Devlieghere2019-10-041-2/+2
| | | | | | | | | | The lambda is taking the stack-allocated Verify boolean by reference and it would go out of scope on the next iteration. Moving it out of the loop should fix the issue. Fixes https://bugs.llvm.org/show_bug.cgi?id=43549 llvm-svn: 373683
* [dsymutil] Don't overload LinkOptions.Jonas Devlieghere2019-10-031-35/+34
| | | | | | | | | This should fix the build bots: error: declaration of ‘llvm::dsymutil::LinkOptions DsymutilOptions::LinkOptions’ [-fpermissive] llvm-svn: 373640
* Fix build failure with GCC on identifier reusing.Michael Liao2019-10-031-1/+1
| | | | | | | - GCC is different from clang and other compilers on that. https://godbolt.org/z/CeQE1V llvm-svn: 373633
* [dsymutil] Improve consistency by removing redundant namespaces (NFC)Jonas Devlieghere2019-10-031-44/+40
| | | | | | | The dsymutil implementation file has a using-directive for the llvm namespace. This patch just removes redundant namespace qualifiers. llvm-svn: 373623
* [dsymutil] Tablegenify option parsingJonas Devlieghere2019-10-031-297/+291
| | | | | | | | | | | | | | | | | | | This patch reimplements command line option parsing in dsymutil with Tablegen and libOption. The main motivation for this change is to prevent clashes with other cl::opt options defined in llvm. Although it's a bit more heavyweight, it has some nice advantages such as no global static initializers and better separation between the code and the option definitions. I also used this opportunity to improve how dsymutil deals with incompatible options. Instead of having checks spread across the code, everything is now grouped together in verifyOptions. The fact that the options are no longer global means that we need to pass them around a bit more, but I think it's worth the trade-off. Differential revision: https://reviews.llvm.org/D68361 llvm-svn: 373622
* Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song2019-08-051-2/+2
| | | | | | F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
* [dsymutil] Fix heap-use-after-free related to the LinkOptions.Jonas Devlieghere2019-08-011-5/+6
| | | | | | | | | In r367348, I changed dsymutil to pass the LinkOptions by value isntead of by const reference. However, the options were still captured by reference in the LinkLambda. This patch fixes that by passing them in by value. llvm-svn: 367635
* [dsymutil] Use the number of threads specified.Jonas Devlieghere2019-06-071-3/+5
| | | | | | | | Before this patch we used either a single thread, or the number of hardware threads available, effectively ignoring the number of threads specified on the command line. llvm-svn: 362815
* [dsymutil] Fix use-after-free when sys::path::append grows the buffer.Adrian Prantl2019-04-231-2/+2
| | | | | | <rdar://problem/50117620> llvm-svn: 359003
* Revert "[dsymutil] Fix use-after-free when sys::path::append grows the buffer."Adrian Prantl2019-04-231-1/+1
| | | | llvm-svn: 359002
* [dsymutil] Fix use-after-free when sys::path::append grows the buffer.Adrian Prantl2019-04-231-1/+1
| | | | | | <rdar://problem/50117620> llvm-svn: 359001
* Fully qualify llvm::Optional, some compilers complain otherwise.Adrian Prantl2019-04-221-3/+4
| | | | llvm-svn: 358933
* 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-221-22/+33
| | | | | | | | | | | | | | | | | | 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
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [dsymutil] Upstream unobfuscation logic.Jonas Devlieghere2019-01-071-1/+26
| | | | | | | | | | The unobufscation support for BCSymbolMaps was the last piece of code that hasn't been upstreamed yet. This patch contains a reworked version of the existing code and relevant tests. Differential revision: https://reviews.llvm.org/D56346 llvm-svn: 350580
* [dsymutil] Improve error reporting when we cannot create output file.Jonas Devlieghere2018-10-231-31/+42
| | | | | | | | | Before this patch we were returning an empty string in case we couldn't create the output file. Now we return an expected string so we can return and print the proper issue. We now return errors instead of bools and defer printing to the call site. llvm-svn: 344983
* [dsymutil] Simplify temporary file handling.Jonas Devlieghere2018-07-291-29/+11
| | | | | | | | | | | Dsymutil's update functionality was broken on Windows because we tried to rename a file while we're holding open handles to that file. TempFile provides a solution for this through its keep(Twine) method. This patch changes dsymutil to make use of that functionality. Differential revision: https://reviews.llvm.org/D49860 llvm-svn: 338216
* [dsymutil] Add support for generating DWARF5 accelerator tables.Jonas Devlieghere2018-07-251-7/+14
| | | | | | | | | | | | | | | | | | This patch add support for emitting DWARF5 accelerator tables (.debug_names) from dsymutil. Just as with the Apple style accelerator tables, it's possible to update existing dSYMs. This patch includes a test that show how you can convert back and forth between the two types. If no kind of table is specified, dsymutil will default to generating Apple-style accelerator tables whenever it finds those in its input. The same is true when there are no accelerator tables at all. Finally, in the remaining case, where there's at least one DWARF v5 table and no Apple ones, the output will contains a DWARF accelerator tables (.debug_names). Differential revision: https://reviews.llvm.org/D49137 llvm-svn: 337980
* [dsymutil] Add support for outputting assemblyJonas Devlieghere2018-07-091-0/+8
| | | | | | | | | | | | | When implementing the DWARF accelerator tables in dsymutil I ran into an assertion in the assembler. Debugging these kind of issues is a lot easier when looking at the assembly instead of debugging the assembler itself. Since it's only a matter of creating an AsmStreamer instead of a MCObjectStreamer it made sense to turn this into a (hidden) dsymutil feature. Differential revision: https://reviews.llvm.org/D49079 llvm-svn: 336561
* [dsymutil] Make the CachedBinaryHolder the defaultJonas Devlieghere2018-06-291-1/+1
| | | | | | | | Replaces all uses of the old binary holder with its cached variant. Differential revision: https://reviews.llvm.org/D48770 llvm-svn: 335991
* [dsymutil] Introduce a new CachedBinaryHolderJonas Devlieghere2018-06-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | The original binary holder has an optimization where it caches a static library (archive) between consecutive calls to GetObjects. However, the actual memory buffer wasn't cached between calls. This made sense when dsymutil was processing objects one after each other, but when processing them in parallel, several binaries have to be in memory at the same time. For this reason, every link context contained a binary holder. Having one binary holder per context is problematic, because the same static archive was cached for every object file. Luckily, when the file is mmap'ed, this was only costing us virtual memory. This patch introduces a new BinaryHolder variant that is fully cached, for all the object files it load, as well as the static archives. This way, we don't have to give up on this optimization of bypassing the file system. Differential revision: https://reviews.llvm.org/D48501 llvm-svn: 335990
* [dsymutil] Move abstractions into separate files (NFC)Jonas Devlieghere2018-06-271-0/+1
| | | | | | | | | | | This patch splits off some abstractions used by dsymutil's dwarf linker and moves them into separate header and implementation files. This almost halves the number of LOC in DwarfLinker.cpp and makes it a lot easier to understand what functionality lives where. Differential revision: https://reviews.llvm.org/D48647 llvm-svn: 335749
* [ADT] Make escaping fn conform to coding guidelinesJonas Devlieghere2018-05-311-3/+3
| | | | | | | | As noted by Adrian on llvm-commits, PrintHTMLEscaped and PrintEscaped in StringExtras did not conform to the LLVM coding guidelines. This commit rectifies that. llvm-svn: 333669
* [dsymutil] Escape HTML special characters in plist.Jonas Devlieghere2018-05-301-8/+17
| | | | | | | | | | When printing string in the Plist, we weren't escaping the characters which lead to invalid XML. This patch adds the escape logic to StringExtras. rdar://39785334 llvm-svn: 333565
* [Support] Add color cl category.Jonas Devlieghere2018-05-241-1/+1
| | | | | | | | | This commit adds a color category so tools can document this option and enables it for dwarfdump and dsymuttil. rdar://problem/40498996 llvm-svn: 333176
* [Support] Add convenience functions to WithColor. NFC.Jonas Devlieghere2018-04-141-21/+21
| | | | | | | | | Create convenience functions for printing error, warning and note to stdout. Previously we had similar functions being used in dsymutil, but given that this pattern is so common it makes sense to make it available globally. llvm-svn: 330091
* Define InitLLVM to do common initialization all at once.Rui Ueyama2018-04-131-5/+3
| | | | | | | | | | | We have a few functions that virtually all command wants to run on process startup/shutdown. This patch adds InitLLVM class to do that all at once, so that we don't need to copy-n-paste boilerplate code to each llvm command's main() function. Differential Revision: https://reviews.llvm.org/D45602 llvm-svn: 330046
* [dsymutil] Apply recursion workaround for threadingJonas Devlieghere2018-04-031-6/+7
| | | | | | | | | | | | The DwarfLinker can have some very deep recursion that can max out the (significantly smaller) stack when using threads. We don't want this limitation when we only have a single thread. We already have this workaround for the architecture-related threading. This patch applies the same workaround to the parallel analysis and cloning. Differential revision: https://reviews.llvm.org/D45172 llvm-svn: 329093
* [dsymutil] Upstream emitting of papertrail warnings.Jonas Devlieghere2018-04-021-2/+14
| | | | | | | | | | When running dsymutil as part of your build system, it can be desirable for warnings to be part of the end product, rather than just being emitted to the output stream. This patch upstreams that functionality. Differential revision: https://reviews.llvm.org/D44639 llvm-svn: 328965
* [dsymutil] Unify error handling outside DwarfLinker.Jonas Devlieghere2018-03-131-19/+21
| | | | | | | | This is a follow-up to r327137 where we unified error handling for the DwarfLinker. This replaces calls to errs() and outs() with the appropriate ostream wrapper everywhere in dsymutil. llvm-svn: 327411
* [dsymutil] Embed toolchain in dSYM bundleJonas Devlieghere2018-03-081-2/+11
| | | | | | | | | Allow us to embed the (Xcode) toolchain in the dSYM bundle's property list. Differential revision: https://reviews.llvm.org/D44151 llvm-svn: 326994
* [dsymutil] Use llvm::sys::path to join bundle path.Jonas Devlieghere2018-02-081-3/+4
| | | | | | | | When processing a dSYM bundle, use llvm::sys::path to join the different path components instead of using a string with hard coded forward slashes as separators. llvm-svn: 324622
* Re-land [dsymutil] Upstream update featureJonas Devlieghere2018-02-081-14/+115
| | | | | | | | | | This commit attempts to re-land the r324480 which was reverted in r324493 because it broke the Windows bots. For now I disabled the two update tests on Windows until I'm able to debug this. Differential revision: https://reviews.llvm.org/D42880 llvm-svn: 324592
* Revert dsymutil -update commitsJonas Devlieghere2018-02-071-115/+14
| | | | | | | Revert "[dsymutil][test] Check the updated dSYM instead of companion file." Revert "[dsymutil] Upstream update feature." llvm-svn: 324493
* [dsymutil] Upstream update feature.Jonas Devlieghere2018-02-071-14/+115
| | | | | | | | | | | Now that dsymutil can generate accelerator tables, we can upstream the update logic that, as the name implies, updates the accelerator tables in an existing dSYM bundle. In combination with `-minimize` this can be used to remove redundant .debug_(inlines|pubtypes|pubnames). Differential revision: https://reviews.llvm.org/D42880 llvm-svn: 324480
* [dsymutil] Enable -minimize feature.Jonas Devlieghere2018-01-301-0/+10
| | | | | | | | | | | | | Passing -minimize to dsymutil prevents the emission of .debug_inlines, .debug_pubnames, and .debug_pubtypes in favor of the Apple accelerator tables. The actual check in the DWARF linker was added in r323655. This patch simply enables it. Differential revision: https://reviews.llvm.org/D42688 llvm-svn: 323812
* [dsymutil] Re-enable threadingJonas Devlieghere2017-12-131-28/+27
| | | | | | | | | | | | | | | | Threading was disabled in r317263 because it broke a test in combination with `-DLLVM_ENABLE_THREADS=OFF`. This was because a ThreadPool warning was piped to llvm-dwarfdump which was expecting to read an object from stdin. This patch re-enables threading and fixes the offending test. Unfortunately this required more than just moving the ThreadPool out of the for loop because of the TempFile refactoring that took place in the meantime. Differential revision: https://reviews.llvm.org/D41180 llvm-svn: 320601
* [dsymutil] Add -verify option to run DWARF verifier after linking.Jonas Devlieghere2017-12-071-0/+41
| | | | | | | | | | | This patch adds support for running the DWARF verifier on the linked debug info files. If the -verify options is specified and verification fails, dsymutil exists with abort with non-zero exit code. This behavior is *not* enabled by default. Differential revision: https://reviews.llvm.org/D40777 llvm-svn: 320033
* [dsymutil] Upstream getBundleInfo implementationJonas Devlieghere2017-11-301-17/+20
| | | | | | | | | | | | | This patch implements `getBundleInfo`, which uses CoreFoundation to obtain information about the CFBundle. This information is needed to populate the Plist in the dSYM bundle. This change only applies to darwin and is an NFC as far as other platforms are concerned. Differential revision: https://reviews.llvm.org/D40244 llvm-svn: 319416
* Try to fix the windows build.Rafael Espindola2017-11-171-2/+2
| | | | llvm-svn: 318535
* Use TempFile in dsymutil.Rafael Espindola2017-11-171-60/+49
| | | | | | | I don't think there is any functionality change, but the code is easier to understand IMHO. llvm-svn: 318534
* make exitDsymutil static.Rafael Espindola2017-11-161-1/+3
| | | | | | | | | The objective is to remove it completelly. This first patch removes the last use outside dsymutil.cpp and makes it static. llvm-svn: 318429
* Simplify file handling in dsymutil.Rafael Espindola2017-11-151-1/+10
| | | | | | | | | | | This moves the file handling out of DwarfLinker.cpp. This fixes what is at least an oddity if not a bug. DwarfLinker.cpp was using ToolOutputFile, which uses RemoveFileOnSignal. The issue is that dsymutil.cpp uses that too. It is now clear from the interface that only dsymutil.cpp is responsible for creating and deleting files. llvm-svn: 318334
* Fix llvm-dsymutil test in -DLLVM_ENABLE_THREADS=OFF modeHans Wennborg2017-11-021-4/+5
| | | | | | | After r316999, tools/dsymutil/X86/alias.test started failing in builds that have threading disabled. llvm-svn: 317263
* [dsymutil][doc] Improve wording in manpage and rename file.Jonas Devlieghere2017-11-021-2/+2
| | | | | | | | | | - Improve wording - Rename llvm-dsymutil to dsymutil - Name -arch=<arch> argument Differential revision: https://reviews.llvm.org/D39561 llvm-svn: 317226
* [dsymutil, llvm-objcopy] Fix some Clang-tidy modernize and Include What You ↵Eugene Zelenko2017-11-011-8/+15
| | | | | | Use warnings; other minor fixes (NFC). llvm-svn: 317123
* [dsymutil][NFC} Rename thread related command line optionsJonas Devlieghere2017-11-011-6/+6
| | | | | | | | | | | This makes the command line options consistent with llvm-cov and llvm-profdata, which both use `-num-threads` and `-j`. This also addresses the conflict reported after landing D39355. Differential revision: https://reviews.llvm.org/D39496 llvm-svn: 317104
OpenPOWER on IntegriCloud