summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump
Commit message (Collapse)AuthorAgeFilesLines
...
* [ARM] Enable objdump to construct triple for ARMSam Parker2017-01-131-2/+19
| | | | | | | | | | | | | Now that The ARMAttributeParser has been moved into the library, it has been modified so that it can parse the attributes without printing them and stores them in a map. ELFObjectFile now queries the attributes to fill out the architecture details of a provided triple for 'arm' and 'thumb' targets. llvm-objdump uses this new functionality. Differential Revision: https://reviews.llvm.org/D28281 llvm-svn: 291898
* llvm-objdump: speed up -objc-meta-dataSaleem Abdulrasool2017-01-081-26/+5
| | | | | | | | | | | | | | | | | | Running a Debug build of objdump -objc-meta-data with a large Mach-O file is currently unnecessarily slow. With some local test input, this change reduces the run time from 75-85s down to 15-20s. The two changes are: Assert on pointer equality not array equality Replace vector<pair<address, symbol>> with DenseMap<address, symbol> Additionally, use a std::unique_ptr rather than handling the memory manually. Patch by Dave Lee! llvm-svn: 291398
* llvm-objdump: sort phdr type strings in advance of adding new onesEd Maste2016-12-241-7/+7
| | | | llvm-svn: 290494
* Fix a bugs with using some Mach-O command line flags like "-arch armv7m".Kevin Enderby2016-12-161-11/+15
| | | | | | | | | | | | | | | | | | The Mach-O command line flag like "-arch armv7m" does not match the arch name part of its llvm Triple which is "thumbv7m-apple-darwin”. I think the best way to fix this is to have llvm::object::MachOObjectFile::getArchTriple() optionally return the name of the Mach-O arch flag that would be used with -arch that matches the CPUType and CPUSubType. Then change llvm::object::MachOUniversalBinary::ObjectForArch::getArchTypeName() to use that and change it to getArchFlagName() as the type name is really part of the Triple and the -arch flag name is a Mach-O thing for a specific Triple with a specific Mcpu value. rdar://29663637 llvm-svn: 290001
* [bpf] change llvm-objdump to print dec instead of hexAlexei Starovoitov2016-12-131-0/+23
| | | | | | | | | since bpf instruction stream is multiple of 8 change llvm-objdump to print decimal instruction number instead of hex address, so that users don't have to do this math manually to match kernel verifier output Signed-off-by: Alexei Starovoitov <ast@kernel.org> llvm-svn: 289569
* [WebAssembly] Add llvm-objdump support for wasm file formatDerek Schuff2016-11-304-0/+32
| | | | | | | | | | | This is the first part of an effort to add wasm binary support across all llvm tools. Patch by Sam Clegg Differential Revision: https://reviews.llvm.org/D26172 llvm-svn: 288251
* Add to llvm-objdump the -no-leading-headers option with the use of the ↵Kevin Enderby2016-11-291-6/+11
| | | | | | | | | | | | | -macho option. In some cases the leading headers of the file name, archive member and architecture slice name in the output of lvm-objdump is not wanted so the tool’s output can be directly used by scripts. This matches the -X option of the Apple otool(1) program. rdar://28491674 llvm-svn: 288199
* Fix spelling mistakes in Tools/Tests comments. NFC.Simon Pilgrim2016-11-201-1/+1
| | | | | | Identified by Pedro Giffuni in PR27636. llvm-svn: 287489
* General clean up of error handling in llvm-objdump to remove its use of ↵Kevin Enderby2016-11-162-40/+54
| | | | | | | | | | | | | | | | | | report_fatal_error(). No real functional change with this commit. The problem with report_fatal_error() is it does not include the tool name and the file name the for which the error message was generated. Uses of report_fatal_error() were change to report_error() or error() to get a better error and to make the code smaller and cleaner. Also changed things like error(errorToErrorCode(SOrErr.takeError())) to use report_error() with a file name and the llvm::Error (as well as the ArchitectureName if available) so the error message is printed. llvm-svn: 287163
* [ELF] Convert ELF.h to Expected<T>.Davide Italiano2016-11-162-17/+18
| | | | | | | | | | | | This has two advantages: 1) We slowly move away from ErrorOr to the new handling interface, in the hope of having an uniform error handling in LLVM, eventually. 2) We're starting to have *meaningful* error messages for invalid object ELF files, rather than a generic "parse error". At some point we should include also the offset to improve the quality of the diagnostic. llvm-svn: 287081
* General clean up of Mach-O error handling in llvm-objdump.Kevin Enderby2016-11-151-173/+72
| | | | | | | | | | | | | | | | | | | | | To get a good error message for all files that could contain Mach-O files the code in llvm-objdump needs to use the archive member name and name of the architecture of a slice of a universal file in those cases where the error come from a Mach-O file in an archive or a universal file. Most of this is fixed by moving the call to checkSymbolTable() into ProcessMachO() and calling it when the operation needs the symbol table. And then calling the form of report_error() that has the ArchiveName and ArchitectureName arguments. One other place needed to call this form of report_error() also with these arguments. Also changed the code in MachODump.cpp to not use report_fatal_error() and use report_error() instead to make the code smaller and cleaner. All cases of this are for errors with the symbol table which should now never be tripped since checkSymbolTable() should be called first to get a good error message in these cases. llvm-svn: 287050
* llvm-objdump: deal with unexpected object files more gracefully.Tim Northover2016-11-151-8/+18
| | | | | | | Specifically, we don't want to segfault on release builds, so print the problem instead. llvm-svn: 287022
* Add a checkSymbolTable() method to the MachOObjectFile class.Kevin Enderby2016-11-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The philosophy of the error checking in libObject for Mach-O files is that the constructor will check the load commands so for their tables the offsets and sizes are properly contained in the file. But there is no checking of the entries of any of the tables. For the contents of the tables themselves the methods accessing the contents of the entries return errors as needed. In some cases this however makes it difficult or cumbersome to produce a good error message which would include the tool name, file name, archive member, and name of the architecture of a slice of a universal file the error occurred in. So idea is that there will be a method to check a table which can be called up front before using it allowing a good error message to be produced before a table is used. And if only verification of the Mach-O file and its tables are wanted a new possible method checkAllTables() could be added to call all of the methods to check all the tables at some time when such methods exist. The checkSymbolTable() is the first of such methods to check one of the Mach-O file tables. This method initially will used in llvm-objdump’s DisassembleMachO() routine before it gets the section and symbol information. As if there are problems with the symbol table currently the error is first encountered by the bool operator() in the SymbolSorter() struct which passed to std::sort(). In this case there is no context as to the file name the symbol which results a poor error message: LLVM ERROR: truncated or malformed object (bad string index: 22 for symbol at index 1) with the added call to the checkSymbolTable() method the error message includes the tool name and file name: llvm-objdump: 'macho-invalid-symbol-strx': truncated or malformed object (bad string table index: 22 past the end of string table, for symbol at index 1) llvm-svn: 286887
* Make the Error class constructor protectedMehdi Amini2016-11-112-6/+7
| | | | | | | | | 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 llvm-svn: 286561
* Remove dead code trying to handle when the amount of data read isChandler Carruth2016-11-041-12/+2
| | | | | | | | | | | | | | | insufficient to populate the expected struct. Prior to this we already bailed out of the routine when this situation comes up, so none of this code had any effect. If someone wants to bring it back to handle these cases, fixing the earlier conditions and adding the necessary test cases that actually exercises it, they can always revert this and go from there. Both of these were noticed by PVS-Studio due to the identical (dead) condition. llvm-svn: 285989
* Add support for the ARM_THREAD_STATE64 andKevin Enderby2016-11-031-0/+84
| | | | | | | | | | | | | in llvm-objdump for Mach-O files add the printing of the ARM_THREAD_STATE64 in the same format as otool-classic(1) on darwin. To do this the 64-bit ARM general tread state needed to be defined in include/llvm/Support/MachO.h . rdar://28985800 llvm-svn: 285967
* Replace a report_fatal_error with an ErrorOr.Rafael Espindola2016-11-031-1/+4
| | | | llvm-svn: 285942
* [RISCV] Add RISC-V ELF definesAlex Bradbury2016-11-011-0/+1
| | | | | | | | | | Add the necessary definitions for RISC-V ELF files, including relocs. Also make necessary trivial change to ELFYaml, llvm-objdump, and llvm-readobj in order to work with RISC-V ELFs. Differential Revision: https://reviews.llvm.org/D23557 llvm-svn: 285708
* Fix an unconditional break in checkMachOAndArchFlagsDavid Majnemer2016-10-311-24/+20
| | | | | | Found by PVS-Studio. llvm-svn: 285598
* llvm-objdump: Make some error messages more consistentJustin Bogner2016-10-261-2/+2
| | | | | | | | | Most of the version of report_error were quoting the filename and printing a colon between the file name and the error message, but this one wasn't doing either of those. Fix the output to be more consistent. llvm-svn: 285252
* For llvm-objdump for Mach-O files add printing ofKevin Enderby2016-10-211-2/+69
| | | | | | | | | | | | the ARM_THREAD_STATE in the same format as otool-classic(1) on darwin. Also remove an extra space in printing the initprot to make the output match otool-classic(1) on darwin. rdar://28851457 llvm-svn: 284852
* Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini2016-10-081-2/+1
| | | | | | | | | | | | | | | template The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 llvm-svn: 283671
* [AMDGPU] Disassembler: print label names in branch instructionsSam Kolton2016-10-061-2/+16
| | | | | | | | | | | | | Summary: Add AMDGPUSymbolizer for finding names for labels from ELF symbol table. Initialize MCObjectFileInfo with some default values. Reviewers: vpykhtin, artem.tamazov, tstellarAMD Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye Differential Revision: https://reviews.llvm.org/D24802 llvm-svn: 283450
* Use StringRef instead of raw pointers in MCAsmInfo/MCInstrInfo APIs (NFC)Mehdi Amini2016-10-011-1/+1
| | | | llvm-svn: 283018
* [llvm-objdump] Switch to a range loop. NFCI.Davide Italiano2016-09-301-5/+3
| | | | llvm-svn: 282982
* [AVR] Allow llvm-objdump to handle AVR ELF filesDylan McKay2016-09-281-0/+1
| | | | llvm-svn: 282585
* Revert "[AMDGPU] Disassembler: print label names in branch instructions"Sam Kolton2016-09-261-12/+0
| | | | | | This reverts commit 6c6dbe625263ec9fcf8de0df27263cf147cde550. llvm-svn: 282396
* [AMDGPU] Disassembler: print label names in branch instructionsSam Kolton2016-09-261-0/+12
| | | | | | | | | | | | Summary: Add AMDGPUSymbolizer for finding names for labels from ELF symbol table. Reviewers: vpykhtin, artem.tamazov, tstellarAMD Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye Differential Revision: https://reviews.llvm.org/D24802 llvm-svn: 282394
* [llvm-objump] Simplify the code. NFCI.Davide Italiano2016-09-181-23/+12
| | | | llvm-svn: 281844
* llvm-objdump: Add --start-address and --stop-address optionsHemant Kulkarni2016-09-121-4/+41
| | | | | | Differential Revision: https://reviews.llvm.org/D24160 llvm-svn: 281232
* llvm-objdump: add missing ) in help output, NFCSaleem Abdulrasool2016-09-081-1/+1
| | | | | | Add a missing ')' in the help output. NFC. llvm-svn: 281000
* Add an c++ itanium demangler to llvm.Rafael Espindola2016-09-063-17/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a copy of the demangler in libcxxabi. The code also has no dependencies on anything else in LLVM. To enforce that I added it as another library. That way a BUILD_SHARED_LIBS will fail if anyone adds an use of StringRef for example. The no llvm dependency combined with the fact that this has to build on linux, OS X and Windows required a few changes to the code. In particular: No constexpr. No alignas On OS X at least this library has only one global symbol: __ZN4llvm16itanium_demangleEPKcPcPmPi My current plan is: Commit something like this Change lld to use it Change lldb to use it as the fallback Add a few #ifdefs so that exactly the same file can be used in libcxxabi to export abi::__cxa_demangle. Once the fast demangler in lldb can handle any names this implementation can be replaced with it and we will have the one true demangler. llvm-svn: 280732
* llvm-objdump: ELF: Handle code and data mix in all scenariosHemant Kulkarni2016-08-251-11/+94
| | | | | | Differential Revision: https://reviews.llvm.org/D23621 llvm-svn: 279770
* llvm-objdump: Add Hexagon printer changes for -S/-l optionsHemant Kulkarni2016-08-181-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D23521 llvm-svn: 279161
* llvm-objdump: add coff import library symbol listing supportSaleem Abdulrasool2016-08-183-0/+43
| | | | | | | | | | This adds behaviour similar to binutils' objdump which can show symbols in an import library. Differences from that stem around the fact that we do not create section symbols nor the all import import descriptor symbol reference. However, this does mean that the tool can serve as a possible replacement for the existing tool. llvm-svn: 279088
* [AMDGPU] llvm-objdump: Skip amd_kernel_code_t only at the begining of kernel ↵Sam Kolton2016-08-171-20/+47
| | | | | | | | | | | | | | symbol. Summary: This change fix bug in AMDGPU disassembly. Previously, presence of symbols other than kernel symbols caused objdump to skip begining of those symbols. Reviewers: tstellarAMD, vpykhtin, Bigcheese, ruiu Subscribers: kzhuravl, arsenm Differential Revision: http://reviews.llvm.org/D21966 llvm-svn: 278921
* llvm-objdump: Implement source[line numbers] interleavingHemant Kulkarni2016-08-152-15/+113
| | | | | | Differential Revsion: https://reviews.llvm.org/D22932 llvm-svn: 278725
* Use the range variant of find/find_if instead of unpacking begin/endDavid Majnemer2016-08-122-15/+14
| | | | | | | | | If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278469
* Use the range variant of find_if instead of unpacking begin/endDavid Majnemer2016-08-121-15/+11
| | | | | | No functionality change is intended. llvm-svn: 278443
* Reapply "More fixes to get good error messages for bad archives."Vedant Kumar2016-08-031-4/+14
| | | | | | | | This reverts commit the revert commit r277627. The build errors mentioned in r277627 were likely caused by an unclean build directory. Sorry for the noise. llvm-svn: 277630
* Revert "More fixes to get good error messages for bad archives."Vedant Kumar2016-08-031-14/+4
| | | | | | | | | | | | | This reverts commit r277540. It breaks the build with: ../lib/Object/Archive.cpp:264:41: error: return type of out-of-line definition of 'llvm::object::ArchiveMemberHeader::getUID' differs from that in the declaration Expected<unsigned> ArchiveMemberHeader::getUID() const { ~~~~~~~~~~~~~~~~~~ ^ include/llvm/Object/Archive.h:53:12: note: previous declaration is here unsigned getUID() const; ~~~~~~~~ ^ llvm-svn: 277627
* More fixes to get good error messages for bad archives.Kevin Enderby2016-08-021-4/+14
| | | | | | | Fixed the last incorrect uses of llvm_unreachable() in the code which were actually just cases of errors in the input Archives. llvm-svn: 277540
* [COFF] Remove a duplicate import_directory_table_entry definitionDavid Majnemer2016-07-311-1/+1
| | | | | | | | We had import_directory_table_entry and coff_import_directory_table_entry, remove one. Also, factor out the logic which determins if a descriptor is a terminator. llvm-svn: 277296
* The next step along the way to getting good error messages for bad archives.Kevin Enderby2016-07-292-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | As mentioned in commit log for r276686 this next step is adding a new method in the ArchiveMemberHeader class to get the full name that does proper error checking, and can be use for error messages. To do this the name of ArchiveMemberHeader::getName() is changed to ArchiveMemberHeader::getRawName() to be consistent with Archive::Child::getRawName(). Then the “new” method is the addition of a new implementation of ArchiveMemberHeader::getName() which gets the full name and provides proper error checking. Which is mostly a rewrite of what was Archive::Child::getName() and cleaning up incorrect uses of llvm_unreachable() in the code which were actually just cases of errors in the input Archives. Then Archive::Child::getName() is changed to return Expected<> and use the new implementation of ArchiveMemberHeader::getName() . Also needed to change Archive::getMemoryBufferRef() with these changes to return Expected<> as well to propagate Errors up. As well as changing Archive::isThinMember() to return Expected<> . llvm-svn: 277177
* Next step along the way to getting good error messages for bad archives.Kevin Enderby2016-07-191-12/+20
| | | | | | | | | This step builds on Lang Hames work to change Archive::child_iterator for better interoperation with Error/Expected. Building on that it is now possible to return an error message when the size field of an archive contains non-decimal characters. llvm-svn: 276025
* BPF: Use official ELF e_machine valueAlexei Starovoitov2016-07-151-0/+1
| | | | | | | | | The same value for EM_BPF is being propagated to glibc, elfutils, and binutils. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Alexei Starovoitov <ast@kernel.org> llvm-svn: 275633
* llvm-objdump: extend __mh_execute_header handling to other special symsTim Northover2016-07-141-5/+7
| | | | | | | | | | We don't need to print any of the special __mh_*_header symbols when disassembling. Since they point at the beginning of the segment (not where the actual code is) they're pretty misleading. Should also fix lld bots. llvm-svn: 275498
* llvm-objdump: handle stubbed and malformed dylibs betterTim Northover2016-07-141-2/+12
| | | | | | | | We were quite happy to read past the end of the valid section data when disassembling. Instead we entirely skip stub dylibs, and tell the user what's happened if their section only has partial data. llvm-svn: 275487
* [Object] Re-apply r275316 now that I have the corresponding LLD patch ready.Lang Hames2016-07-142-32/+24
| | | | llvm-svn: 275361
* [Object] Revert r275316, Archive::child_iterator changes, while I update lld.Lang Hames2016-07-142-24/+32
| | | | | | Should fix the bots broken by r275316. llvm-svn: 275353
OpenPOWER on IntegriCloud