summaryrefslogtreecommitdiff
path: root/tools/llvm-dwp
AgeCommit message (Collapse)Author
2017-12-13Remove redundant includes from tools.Michael Zolotukhin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320631 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27Rename MCTargetOptionsCommandFlags.h to .def as it is not a normal/modular ↵David Blaikie
header as much as it is for stamping out some global/static variables git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319086 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-02[tools] Add option to install binutils symlinksShoaib Meenai
The LLVM tools can be used as a replacement for binutils, in which case it's convenient to create symlinks with the binutils names. Add support for these symlinks in the build system. As with any other llvm tool symlinks, the user can limit the installed symlinks by only adding the desired ones to `LLVM_TOOLCHAIN_TOOLS`. Differential Revision: https://reviews.llvm.org/D39530 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317272 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.Lang Hames
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[MC] Have MCObjectStreamer take its MCAsmBackend argument via unique_ptr.Lang Hames
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315410 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-02[llvm-dwp] Implement -e optionAlexander Shaposhnikov
The binutils utility dwp has an option "-e" https://gcc.gnu.org/wiki/DebugFissionDWP to specify an executable/library to get the list of *.dwo files from it. This option is particularly useful when someone runs the tool manually outside of a build system. This diff adds an implementation of "-e" to llvm-dwp. Test plan: make check-all Differential revision: https://reviews.llvm.org/D37371 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312409 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02Don't pass the code model to MCRafael Espindola
I was surprised to see the code model being passed to MC. After all, it assembles code, it doesn't create it. The one place it is used is in the expansion of .cfi directives to handle .eh_frame being more that 2gb away from the code. As far as I can tell, gnu assembler doesn't even have an option to enable this. Compiling a c file with gcc -mcmodel=large produces a regular looking .eh_frame. This is probably because in practice linker parse and recreate .eh_frames. In llvm this is used because the JIT can place the code and .eh_frame very far apart. Ideally we would fix the jit and delete this option. This is hard. Apart from confusion another problem with the current interface is that most callers pass CodeModel::Default, which is bad since MC has no way to map it to the target default if it actually needed to. This patch then replaces the argument with a boolean with a default value. The vast majority of users don't ever need to look at it. In fact, only CodeGen and llvm-mc use it and llvm-mc just to enable more testing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309884 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-26[DWARF] NFC: Collect info used by DWARFFormValue into a helper.Paul Robinson
Some forms have sizes that depend on the DWARF version, DWARF format (32/64-bit), or the size of an address. Collect these into a struct to simplify passing them around. Require callers to provide one when they query a form's size. Differential Revision: http://reviews.llvm.org/D34570 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306315 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-18[lib/Object] - Minor API update for llvm::Decompressor.George Rimar
I revisited Decompressor API (issue with it was triggered during D32865 review) and found it is probably provides more then we really need. Issue was about next method's signature: Error decompress(SmallString<32> &Out); It is too strict. At first I wanted to change it to decompress(SmallVectorImpl<char> &Out), but then found it is still not flexible because sticks to SmallVector. During reviews was suggested to use templating to simplify code. Patch do that. Differential revision: https://reviews.llvm.org/D33200 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303331 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-13[llvm-dwp] - Reuse object::Decompressor classGeorge Rimar
One more place where Decompressor class can be reused. Differential revision: https://reviews.llvm.org/D28679 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291906 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-19[CMake] llvm-dwp depends on intrinsics_genChris Bieneman
llvm-dwp.cpp has the following include chain: llvm/CodeGen/AsmPrinter.h llvm/CodeGen/MachineFunctionPass.h llvm/CodeGen/MachineFunction.h llvm/CodeGen/MachineBasicBlock.h llvm/CodeGen/MachineInstr.h llvm/Analysis/AliasAnalysis.h llvm/IR/CallSite.h llvm/IR/Attributes.h llvm/IR/Attributes.gen This means llvm-dwp needs to depend on intrinsics_gen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287429 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11Clean up DWARFFormValue by reducing duplicated code and removing ↵Greg Clayton
DWARFFormValue::getFixedFormSizes() In preparation for a follow on patch that improves DWARF parsing speed, clean up DWARFFormValue so that we have can get the fixed byte size of a form value given a DWARFUnit or given the version, address byte size and dwarf32/64. This patch cleans up code so that everyone is using one of the new DWARFFormValue functions: static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, const DWARFUnit *U = nullptr); static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, uint16_t Version, uint8_t AddrSize, bool Dwarf32); This patch changes DWARFFormValue::skipValue() to rely on the output of DWARFFormValue::getFixedByteSize(...) instead of duplicating the code in each function. This will reduce the number of changes we need to make to DWARF to fewer places in DWARFFormValue when we add support for new form. This patch also starts to support DWARF64 so that we can get correct byte sizes for forms that vary according the DWARF 32/64. To reduce the code duplication a new FormSizeHelper pure virtual class was created that can be created as a FormSizeHelperDWARFUnit when you have a DWARFUnit, or FormSizeHelperManual where you manually specify the DWARF version, address byte size and DWARF32/DWARF64. There is now a single implementation of a function that gets the fixed byte size (instead of two where one took a DWARFUnit and one took the DWARF version, address byte size and DWARFFormat enum) and one function to skip the form values. https://reviews.llvm.org/D26526 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286597 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11Make the Error class constructor protectedMehdi Amini
This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-27Switch all DWARF variables for tags, attributes and forms over to use the ↵Greg Clayton
llvm::dwarf enumerations instead of using raw uint16_t values. This allows easier debugging as users can see the values of the enumerations in the variables view that will show the enumeration string instead of just a number. https://reviews.llvm.org/D26013 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285309 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-25MC] Provide an MCTargetOptions to implementors of MCAsmBackendCtorTy, NFCJoel Jones
Some targets, notably AArch64 for ILP32, have different relocation encodings based upon the ABI. This is an enabling change, so a future patch can use the ABIName from MCTargetOptions to chose which relocations to use. Tested using check-llvm. The corresponding change to clang is in: http://reviews.llvm.org/D16538 Patch by: Joel Jones Differential Revision: https://reviews.llvm.org/D16213 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276654 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25llvm-dwp: Ensure uncompressed sections are not relocated during processing ↵David Blaikie
of later inputs Richard Smith identified this in post commit review of r270466. The string sections in particular (in the future, possibly all sections - so I'm not going to bother pulling out just the string sections for the extra lifetime handling right now) need to remain valid during processing of all inputs so that elements of the DWPStringPool can be looked up repeatedly without having to make in-memory copies of string contents in the noncompressed case (more common in dwp+dwp merge steps where the memory is a bigger problem because the files are larger). Using the SmallVector (or any vector) a reallocation on push_back could cause any of the nested SmallStrings in small mode to move in memory and invalid pointers to their contents. Using a deque the SmallStrings will never move around since no elements are removed from the container. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270797 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23llvm-dwp: Reduce indentationDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23llvm-dwp: Split out processing of input sections to improve readabilityDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270503 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23llvm-dwp: Pull out compression handling helperDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270496 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23llvm-dwp: More error handling around invalid compressed sectionsDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23llvm-dwp: Ensure compressed sections are preserved long enough for use in ↵David Blaikie
the string pool Now that the string pool is referential rather than maintaining its own copy of string data, compressed sections (well, technically only the debug_str section*) need to be preserved for the lifetime of the pool to match. * I'm not currently optimizing for memory footprint with compressed input - the major memory limit I'm hitting is on dwp+dwp merge steps and we aren't currently compressing contents in dwp files, just in the .dwo inputs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270462 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23llvm-dwp: Fix the build by moving DWPStringPool into the llvm namespaceDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270453 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23llvm-dwp: Add an abstraction for the DWP string poolDavid Blaikie
Also reference strings in the memory mapped file, reduces memory usage on a large test case by 18.5%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270449 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18Don't pass a Reloc::Model to MC.Rafael Espindola
MC only needs to know if the output is PIC or not. It never has to decide about creating GOTs and PLTs for example. The only thing that MC itself uses this information for is expanding "macros" in sparc and mips. The rest I am pretty sure could be moved to CodeGen. This is a cleanup and isolates the code from future changes to Reloc::Model. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17llvm-dwp: remove some unused error handlingDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269866 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17llvm-dwp: Move error handling code closer to useDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17llvm-dwp: Add error handling for multiple type sections in a dwp file.David Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269851 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17llvm-dwp: Simplify duplicate DWO ID error handlingDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269805 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-17llvm-dwp: Provide error handling for invalid string field formsDavid Blaikie
This diagnostic could be improved by adding the name of the input file containing the invalid data and/or some information about how to identify the specific offending attribute/tag in the input. But that's not an immediate priority as these corner cases of invalid input shouldn't come up too often. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269727 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16llvm-dwp: Add error handling for invalid (non-CU) top level tag in ↵David Blaikie
debug_info.dwo The diagnostic could be improved a bit to include information about which input file had the mistake (& which unit (counted, since the name of the unit won't be accessible) within the input). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269723 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16llvm-dwp: Streamline duplicate DWO ID diagnostic handlingDavid Blaikie
Actually use the error return path rather than printing the duplicate information then a separate error. But also just tidy up/deduplicate some of the code for generating the diagnostic text. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269692 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12llvm-dwp: Use llvm::Error to improve diagnostic quality/error handling in ↵David Blaikie
llvm-dwp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269339 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18[NFC] Header cleanupMehdi Amini
Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-13llvm-dwp: Add assert textDavid Blaikie
Post-commit feedback from Eric Christopher on r265452. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266225 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump ↵Kevin Enderby
to produce a real error message Produce the first specific error message for a malformed Mach-O file describing the problem instead of the generic message for object_error::parse_failed of "Invalid data was encountered while parsing the file”.  Many more good error messages will follow after this first one. This is built on Lang Hames’ great work of adding the ’Error' class for structured error handling and threading Error through MachOObjectFile construction. And making createMachOObjectFile return Expected<...> . So to to get the error to the llvm-obdump tool, I changed the stack of these methods to also return Expected<...> : object::ObjectFile::createObjectFile() object::SymbolicFile::createSymbolicFile() object::createBinary() Then finally in ParseInputMachO() in MachODump.cpp the error can be reported and the specific error message can be printed in llvm-objdump and can be seen in the existing test case for the existing malformed binary but with the updated error message. Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now use of errorToErrorCode() and errorOrToExpected() are used where the callers are yet to be converted. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values. So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: “// TODO: Actually report errors helpfully” and a call something like consumeError(ObjOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05llvm-dwp: Handle GCC's use of multiple debug_types.dwo sections in a single ↵David Blaikie
.dwo file (also includes the .test file missing from my previous commit, r265452) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265457 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05llvm-dwp: Handle dwo files produced by GCCDavid Blaikie
To start with, handle DW_FORM_string names. Follow up commit will handle the interesting quirk with type units I was originally aiming for here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265452 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-05llvm-dwp: Simplify hashing code a bitDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265426 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-26llvm-dwp: Include the dwo name (if available) when diagnosing duplicate CU ↵David Blaikie
IDs from dwp input files If you're building dwps from other dwps, it can be hard to track down a duplicate CU ID if it comes from two compilations of the same file in different modes, etc. By including the .dwo path (which is hopefully more unique than the file path) it can help track down where the duplicates came from. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264520 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24llvm-dwp: Coalesce code for reading the CU's DW_AT_GNU_dwo_id and DW_AT_nameDavid Blaikie
Going to be reading the DW_AT_GNU_dwo_name shortly as well, and there was already enough duplication here that it was worth refactoring rather than adding even more. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264350 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01llvm-dwp: Add missing copyright notice to llvm-dwp.cppDavid Blaikie
Addressing feedback on IRC by Sean Silva. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262416 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01Revert "llvm-dwp: Keep ObjectFiles alive until object emission their ↵David Blaikie
contents can be referenced directly rather than copied" Accidentally committed. This reverts commit r262389. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262395 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01llvm-dwp: Keep ObjectFiles alive until object emission their contents can be ↵David Blaikie
referenced directly rather than copied git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262389 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26llvm-dwp: provide diagnostics for duplicate DWO IDsDavid Blaikie
These diagnostics aren't perfect - in the case of merging several dwos into dwps and those dwps into more dwps - just getting the message about the original source file name might not be much help (since it's the same in both dwos, by definition - but doesn't tell you which chain of dwps to backtrack) It might be worth adding the DW_AT_dwo_id to the split debug info to improve the diagnostic experience - might help track down the duplicates better. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261988 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26llvm-dwp: Support empty .dwo filesDavid Blaikie
Though a bit odd, this is handy for a few reasons - for example, in a build system that wants consistent input/output of build steps, but where split-dwarf might be overriden/disabled by the user on a per-file basis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261987 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19llvm-dwp: Improve performance (N^2 to amortized N) by using a MapVector ↵David Blaikie
instead of linear searches through a vector Figured this would be a problem, but didn't want to jump the gun - large inputs demonstrate it pretty easily (mostly for type units, but might as well do the same for CUs too). A random sample 6m27s -> 27s change. Also, by checking this up-front for CUs (rather than when building the cu_index) we can probably provide better error messages (see FIXMEs), hopefully providing the name of the CUs rather than just their signature. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19llvm-dwp: Don't test compression when zlib isn't availableDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261298 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19llvm-dwp: Support compressed inputDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-18Add parentheses around arithmetic in operand of '|'.Benjamin Kramer
This avoids a operator precedence warning for mixing + and | in an expression. I checked that this matches the definition in the Split DWARF proposal. Patch by Cong Liu! Differential Revision: http://reviews.llvm.org/D17375 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261207 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17llvm-dwp: Support for type units when merging DWPs into larger DWPsDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261072 91177308-0d34-0410-b5e6-96231b3b80d8