summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-objdump] - Dump the archive headers when -all-headers is specified.George Rimar2019-01-181-2/+2
| | | | | | | | | | | When -all-headers is given it is supposed to dump all headers, but now it skips the archive headers for no reason. The patch fixes that. Differential revision: https://reviews.llvm.org/D56780 llvm-svn: 351547
* [llvm-objdump] - Move getRelocationValueString and dependenices out of the ↵George Rimar2019-01-181-426/+5
| | | | | | | | | | | | | | | | | | | | llvm-objdump.cpp getRelocationValueString is a dispatcher function that calls the corresponding ELF/COFF/Wasm/MachO implementations that currently live in the llvm-objdump.cpp file. These implementations better be moved to ELFDump.cpp, COFFDump.cpp and other corresponding files, to move platform specific implementation out from the common logic. The patch does that. Also, I had to move ToolSectionFilter helper and SectionFilterIterator, SectionFilter to a header to make them available across the objdump code. Differential revision: https://reviews.llvm.org/D56842 llvm-svn: 351545
* [llvm-objdump] - Show aliases in -help.George Rimar2019-01-181-34/+35
| | | | | | | | | | | | | | | Currently llvm-objdump is inconsistent. When -help is specified it shows no aliases except two. Aliases are shown with -help-hidden though. GNU objdump also prints them by default. This patch does a change to always show all aliases when -help is given. Differential revision: https://reviews.llvm.org/D56853 llvm-svn: 351542
* Revert r351529 "[llvm-objdump][NFC] Improve readability."Clement Courbet2019-01-181-37/+28
| | | | | | Breaks labels-branch.s llvm-svn: 351534
* [llvm-objdump][NFC] Improve readability.Clement Courbet2019-01-181-28/+37
| | | | | | | | | | | | | | Summary: Introduce a `struct SectionSymbol` instead of `tuple<uint64_t, StringRef, uint8>`. Reviewers: jhenderson, davide Subscribers: rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D56858 llvm-svn: 351529
* [WebAssembly] Fixed objdump not parsing function headers.Wouter van Oortmerssen2019-01-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: objdump was interpreting the function header containing the locals declaration as instructions. To parse these without injecting target specific code in objdump, MCDisassembler::onSymbolStart was added to be implemented by the WebAssembly implemention. WasmObjectFile now returns a code offset for the "address" of a symbol, rather than the index. This is also more in-line with what other targets do. Also ensured that the AsmParser correctly puts each function in its own segment to enable this test case. Reviewers: sbc100, dschuff Subscribers: jgravelle-google, aheejin, sunfish, rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D56684 llvm-svn: 351460
* Move demangling function from llvm-objdump to Demangle libraryJames Henderson2019-01-171-15/+0
| | | | | | | | | | | | | | | | This allows it to be used in an upcoming llvm-readobj change. A small change in internal behaviour of the function is to always call the microsoftDemangle function if the string does not have an itanium encoding prefix, rather than only if it starts with '?'. This is harmless because the microsoftDemangle function does the same check already. Reviewed by: grimar, erik.pilkington Differential Revision: https://reviews.llvm.org/D56721 llvm-svn: 351448
* [llvm-objdump] - Fix comment. NFC.George Rimar2019-01-171-1/+1
| | | | | | Forgot to address this one. llvm-svn: 351418
* [llvm-objdump] - Simplify the getRelocationValueString. NFCI.George Rimar2019-01-171-38/+22
| | | | | | | | | | This refactors the getRelocationValueString method. It is a bit overcomplicated and it is possible to reduce it without losing the functionality it seems. Differential revision: https://reviews.llvm.org/D56778 llvm-svn: 351417
* [llvm-obdump] - Fix the help lines for -stop-address and -z.George Rimar2019-01-151-4/+4
| | | | | | | It was broken by me by mistake in r350823 during addressing the review comment before committing (changed not the right text line). llvm-svn: 351192
* [llvm-objdump] - Cleanup the code. NFCI.George Rimar2019-01-151-278/+250
| | | | | | | | | | | | | | | | | This is a cosmetic cleanup for the llvm-objdump code. This patch: * Renames things to match the official LLVM code style (lower case -> upper case). * Removes few obviously excessive variables. * Moves a few lines closer to the place of use, reorders the code a bit to simplify it, to avoid doing excessive returns and to avoid using 'else` after returns. I focused only on a llvm-objdump.h/llvm-objdump.cpp files. Few changes in the MachODump.cpp and COFFDump.cpp are a result of llvm-objdump.h modification. Differential revision: https://reviews.llvm.org/D56637 llvm-svn: 351171
* [llvm-objdump] - Change the output for --all-headers.George Rimar2019-01-121-5/+5
| | | | | | | | | | | This is for https://bugs.llvm.org/show_bug.cgi?id=40008, it starts printing the file headers when --all-headers is given and do a minor cosmetic change. Differential revision: https://reviews.llvm.org/D56588 llvm-svn: 351006
* [llvm-objdump] - Do not include reserved undefined symbol in -t output.George Rimar2019-01-101-1/+8
| | | | | | | | | | | | | | | | | | | | This is https://bugs.llvm.org/show_bug.cgi?id=26892, GNU objdump hides the special symbol entry: SYMBOL TABLE: 000000000000a7e0 l F .text 00000000000003f9 bi_copymodules while llvm-objdump does not: SYMBOL TABLE: 0000000000000000 *UND* 00000000 000000000000a7e0 l F .text 000003f9 bi_copymodules Patch makes the behavior of the llvm-objdump to be consistent with the GNU objdump. Differential revision: https://reviews.llvm.org/D56076 llvm-svn: 350840
* [llvm-objdump] - Implement -z/--disassemble-zeroes.George Rimar2019-01-101-1/+41
| | | | | | | | | | | | | | This is https://bugs.llvm.org/show_bug.cgi?id=37151, GNU objdump spec says that "Normally the disassembly output will skip blocks of zeroes.", but currently, llvm-objdump prints them. The patch implements the -z/--disassemble-zeroes option and switches the default to always skip blocks of zeroes. Differential revision: https://reviews.llvm.org/D56083 llvm-svn: 350823
* [llvm-objdump] - Print symbol addressed when dumping disassembly output (-d)George Rimar2019-01-091-0/+3
| | | | | | | | | | | | | | | | | | | | When GNU objdump dumps the input with -d it prints the symbol addresses, for example: 0000000000000031 <foo>: 31: 00 00 add %al,(%rax) ... llvm-objdump currently does not do that. Patch changes the behavior to match the GNU objdump. That is useful for implementing -z/--disassemble-zeroes (D56083), it allows omitting first zero bytes and keep the information about the symbol address in the output. Differential revision: https://reviews.llvm.org/D56123 llvm-svn: 350726
* [binutils] NFC: fix clang-tidy warning: use empty() instead of size() == 0Jordan Rupprecht2018-12-201-3/+3
| | | | llvm-svn: 349710
* [llvm-objdump] - Fix one more BB.George Rimar2018-12-191-1/+4
| | | | | | | | | Should fix the http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25876/steps/build/logs/stdio: /home/grosser/buildslave/polly-amd64-linux/llvm.src/tools/llvm-objdump/llvm-objdump.cpp:539:25: error: conditional expression is ambiguous; 'std::string' (aka 'basic_string<char>') can be converted to 'typename std::remove_reference<StringRef>::type' (aka 'llvm::StringRef') and vice versa Target = Demangle ? demangle(*SymName) : *SymName; llvm-svn: 349617
* [llvm-objdump] - Fix BB.George Rimar2018-12-191-16/+15
| | | | | | Move the helper method before the first incocation in the file. llvm-svn: 349614
* [llvm-objdump] - Demangle the symbols when printing symbol table and ↵George Rimar2018-12-191-27/+28
| | | | | | | | | | | | | | | relocations. This is https://bugs.llvm.org/show_bug.cgi?id=40009, llvm-objdump does not demangle the symbols when prints symbol table and/or relocations. Patch teaches it to do that. Differential revision: https://reviews.llvm.org/D55821 llvm-svn: 349613
* [llvm-objdump] Print a blank row at the end of sectionsXing GUO2018-11-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When using option `-x` (--all-headers), it will print `Sections`, `Symbol Table`, `Program Header` ... `Sections` and `Symbol Table` will be connected together. Before: ``` Sections: Idx Name Size Address Type 0 00000000 0000000000000000 ... 29 .shstrtab 0000011a 0000000000000000 SYMBOL TABLE: ... ``` After: ``` Sections: Idx Name Size Address Type 0 00000000 0000000000000000 ... 29 .shstrtab 0000011a 0000000000000000 SYMBOL TABLE: ... ``` Reviewers: Higuoxing Reviewed By: Higuoxing Subscribers: llvm-commits, jhenderson Differential Revision: https://reviews.llvm.org/D54665 llvm-svn: 347135
* [llvm-objdump] Use WithColor for error reportingJonas Devlieghere2018-11-111-27/+38
| | | | | | Use helpers from Support/WithError.h to print errors. llvm-svn: 346623
* [llvm-objdump] Add symbol 'O' for object dataKristina Brooks2018-11-111-0/+2
| | | | | | | | | | | | | Improve compatibility with GNU objdump by showing `O` next to global symbol names, instead of a blank space. Patch by Higuoxing (Xing). Reviewers: MaskRay Differential Revision: https://reviews.llvm.org/D54380 llvm-svn: 346610
* [Support] Make error banner optional in logAllUnhandledErrorsJonas Devlieghere2018-11-111-2/+2
| | | | | | | | In a lot of places an empty string was passed as the ErrorBanner to logAllUnhandledErrors. This patch makes that argument optional to simplify the call sites. llvm-svn: 346604
* [llvm-objdump] Mark syms/t flags as NotHidden. NFC.Kristina Brooks2018-10-311-0/+1
| | | | | | | Slight improvement to help output of llvm-objdump that exposes the shorter -t flag for -syms instead of it being hidden away. llvm-svn: 345704
* [llvm-objdump] Add --reloc alias for -r (PR39407)Kristina Brooks2018-10-311-1/+5
| | | | | | | | | | | | | This addresses PR39407 (https://bugs.llvm.org/show_bug.cgi?id=39407) improving compatibility with GNU binutils counterparts. Reviewed By: kristina Patch by Higuoxing (Xing). Differential Revision: https://reviews.llvm.org/D53804 llvm-svn: 345703
* [llvm-objdump] support '--syms' as an alias of -tKristina Brooks2018-10-311-2/+3
| | | | | | | | | | | This adds support for '--syms' as an alias of '-t' for llvm-objdump, fixing PR39406 (https://bugs.llvm.org/show_bug.cgi?id=39406). Patch by Higuoxing (Xing). Differential Revision: https://reviews.llvm.org/D53803 llvm-svn: 345697
* [llvm-objdump] Don't crash when using `-a` on non-archivesJames Henderson2018-10-291-4/+4
| | | | | | | | | | | | | This fixes PR39402. The crash was caused when dereferencing nullptr in DumpObject and printArchiveChild. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D53690 Patch by Xing GUO llvm-svn: 345503
* [llvm-objdump] Add '--full-contents' as alias for '-s'James Henderson2018-10-291-1/+5
| | | | | | | | | | | | This fixes PR39404. Reviewed By: jhenderson Patch by Xing Guo Differential Revision: https://reviews.llvm.org/D53576 llvm-svn: 345495
* [llvm-objdump] Fix --file-headers (-f) optionPetar Jovanovic2018-10-191-1/+4
| | | | | | | | | | | | | | | | | Changed the format call to match the surrounding code. Previously it was printing an unsigned int while the return type being printed was long unsigned int or wider. This caused problems for big-endian systems which were discovered on mips64. Also, the printed address had less characters than it should because the character count was directly obtained from the number of bytes in the address. The tests were adapted to fit this fix and now use longer addresses. Patch by Milos Stojanovic. Differential Revision: https://reviews.llvm.org/D53403 llvm-svn: 344818
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-271-3/+3
| | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: dblaikie, javed.absar, JDevlieghere, andreadb Subscribers: MatzeB, sanjoy, arsenm, dschuff, mehdi_amini, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, javed.absar, gbedwell, jrtc27, mgrang, atanasyan, steven_wu, george.burgess.iv, dexonsmith, kristina, jsji, llvm-commits Differential Revision: https://reviews.llvm.org/D52573 llvm-svn: 343163
* [llvm-objdump] Label calls to the PLT.Joel Galenson2018-08-241-0/+36
| | | | | | Differential Revision: https://reviews.llvm.org/D50204 llvm-svn: 340611
* [llvm-objdump] Add ability to demangle COFF symbols.Zachary Turner2018-08-201-14/+14
| | | | llvm-svn: 340221
* [ADT] Normalize empty triple componentsPetr Hosek2018-08-081-1/+0
| | | | | | | | | | | | | | | | | LLVM triple normalization is handling "unknown" and empty components differently; for example given "x86_64-unknown-linux-gnu" and "x86_64-linux-gnu" which should be equivalent, triple normalization returns "x86_64-unknown-linux-gnu" and "x86_64--linux-gnu". autoconf's config.sub returns "x86_64-unknown-linux-gnu" for both "x86_64-linux-gnu" and "x86_64-unknown-linux-gnu". This changes the triple normalization to behave the same way, replacing empty triple components with "unknown". This addresses PR37129. Differential Revision: https://reviews.llvm.org/D50219 llvm-svn: 339294
* objdump: Better handling of Mach-O universal binariesDave Lee2018-08-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With Mach-O, there is a flag requirement discrepancy between working with universal binaries and thin binaries. Many flags that don't require the `-macho` flag (for example `-private-headers` and `-disassemble`) fail to work on universal binaries unless `-macho` is given. When this happens, the error message is unhelpful, stating: The file was not recognized as a valid object file. Which can lead to confusion. This change allows generic flags to be used on universal binaries with and without the `-macho` flag. This means flags that can be used for thin files can be used consistently with fat files too. To do this, the universal binary support within `ParseInputMachO()` is extracted into a new function. This new function is called directly from `DumpInput()` when the input binary is universal. Additionally the `-arch` flag validation in `ParseInputMachO()` was extracted to be reused. Reviewers: compnerd Reviewed By: compnerd Subscribers: keith, llvm-commits Differential Revision: https://reviews.llvm.org/D48702 llvm-svn: 338792
* [ADT] Replace std::isprint by llvm::isPrint.Michael Kruse2018-07-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The standard library functions ::isprint/std::isprint have platform- and locale-dependent behavior which makes LLVM's output less predictable. In particular, regression tests my fail depending on the implementation of these functions. Implement llvm::isPrint in StringExtras.h with a standard behavior and replace all uses of ::isprint/std::isprint by a call it llvm::isPrint. The function is inlined and does not look up language settings so it should perform better than the standard library's version. Such a replacement has already been done for isdigit, isalpha, isxdigit in r314883. gtest does the same in gtest-printers.cc using the following justification: // Returns true if c is a printable ASCII character. We test the // value of c directly instead of calling isprint(), which is buggy on // Windows Mobile. inline bool IsPrintableAscii(wchar_t c) { return 0x20 <= c && c <= 0x7E; } Similar issues have also been encountered by Julia: https://github.com/JuliaLang/julia/issues/7416 I noticed the problem myself when on Windows isprint('\t') started to evaluate to true (see https://stackoverflow.com/questions/51435249) and thus caused several unit tests to fail. The result of isprint doesn't seem to be well-defined even for ASCII characters. Therefore I suggest to replace isprint by a platform-independent version. Differential Revision: https://reviews.llvm.org/D49680 llvm-svn: 338034
* [llvm-objdump] Add dynamic section printing to private-headers optionPaul Semel2018-07-251-2/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D49016 llvm-svn: 337902
* [llvm-objdump] Add -demangle (-C) optionPaul Semel2018-07-181-1/+37
| | | | | | Differential Revision: https://reviews.llvm.org/D49043 llvm-svn: 337401
* [llvm-objdump] - An attempt to fix BB after r337361.George Rimar2018-07-181-2/+2
| | | | | | | | | | | Seems r337361 is the reason of the following ARM BB failures: http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick http://lab.llvm.org:8011/builders/clang-cmake-armv8-full/builds/4633 Reason is unclear to me, other bots are OK. If this will not help, I'll revert r337361. llvm-svn: 337371
* [llvm-objdump] - Stop reporting bogus section IDs.George Rimar2018-07-181-4/+3
| | | | | | | | | | | | | | | | Imagine we have a file with few sections, and one of them is .foo with index N != 0. Problem is that when llvm-objdump is given a -section=.foo parameter it lists .foo as a section at index 0. That makes impossible to write test cases which needs to find the index of the particular section, while ignoring dumping of others. The patch fixes that. Differential revision: https://reviews.llvm.org/D49372 llvm-svn: 337361
* Revert "[llvm-objdump] Add -demangle (-C) option"Paul Semel2018-07-111-37/+1
| | | | | | | This reverts commit 3a44ccd156e0edd2e89226f8ed63928e227900bb. This reverts commit d5cfc836bb5552e20507d3612d13ff66ff9e36a0. llvm-svn: 336829
* [llvm-objdump] Add -demangle (-C) optionPaul Semel2018-07-111-1/+37
| | | | | | Differential Revision: https://reviews.llvm.org/D49043 llvm-svn: 336816
* [llvm-objdump] Add --archive-headers (-a) optionPaul Semel2018-07-051-5/+83
| | | | llvm-svn: 336357
* [llvm-objdump] Add --file-headers (-f) optionPaul Semel2018-07-041-0/+24
| | | | llvm-svn: 336284
* Handle absolute symbols as branch targets in disassembly.Sterling Augustine2018-06-281-21/+35
| | | | | | https://reviews.llvm.org/D48554 llvm-svn: 335903
* [llvm-objdump] Add -x --all-headers optionsFangrui Song2018-06-271-0/+9
| | | | | | | | | | Reviewers: paulsemel, echristo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48622 llvm-svn: 335785
* [llvm-objdump] Add -R optionPaul Semel2018-06-071-17/+70
| | | | | | | | This option prints dynamic relocation entries of the given file Differential Revision: https://reviews.llvm.org/D47493 llvm-svn: 334196
* Implemented sane default for llvm-objdump's relocation Value formatDaniel Cederman2018-06-011-72/+10
| | | | | | | | | | | | | | | | | | | | | Summary: "Unknown" for platforms that were not manually added into the switch did not make sense at all. Now it prints Target + addend for all elf-machines that were not explicitly mentioned. Addresses PR21059 and PR25124. Original author: fedor.sergeev Reviewers: jyknight, espindola, fedor.sergeev Reviewed By: jyknight Subscribers: eraman, dcederman, jfb, dschuff, aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D36464 llvm-svn: 333726
* Hexagon: Put relocations after instructions not packets.Sid Manning2018-05-141-290/+319
| | | | | | | | | | | | | Change relocation output so that relocation information follows individual instructions rather than clustering them at the end of packets. This change required shifting block of code but the actual change is in HexagonPrettyPrinter's PrintInst. Differential Revision: https://reviews.llvm.org/D46728 llvm-svn: 332283
* Remove @brief commands from doxygen comments, too.Adrian Prantl2018-05-011-3/+3
| | | | | | | | | | | | | | | | | This is a follow-up to r331272. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done https://reviews.llvm.org/D46290 llvm-svn: 331275
* [WebAssembly] objdump: Don't assume all relocations have symbolsSam Clegg2018-04-261-2/+6
| | | | | | | | Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46134 llvm-svn: 330959
OpenPOWER on IntegriCloud